title: How to reserve jenkins agent for private use
body: <p>I'm trying to find a way to get jenkins to allow a user to reserve an agent for private use. This is different to disabling an agent as the user reserving it may still want to run jenkins jobs on it. A simple use case is an agent is having problems running jobs, so it gets put into this reserved state while someone investigates what is going wrong.</p>
  
  <p>I have tried a rather hacky solution using the ownership plugin, if the agent is owned by a dummy user called "free" or owned by the submitter of the job then the job will run, otherwise it will fail.</p>
  
  <p>The problem with the solution I have is that:</p>
  
  <ul>
  <li>unless you go to a node you can't see who the owner is.</li>
  <li>it really needs a way to avoid trying to run the job on the agent instead of failing if it happens to choose one that has been reserved.</li>
  </ul>
  
  <p>The other solution is to have a label "free" that someone would need to change when they want to reserve it to something like "reserved-bob", then have all the jobs take an extra label parameter which defaults to "free". The problem with this is:</p>
  
  <ul>
  <li>it's easy to make a mistake and not set the free label when unreserving the agent or leaving it on when adding the reserve label.</li>
  <li>not easy to find the set of nodes that aren't free</li>
  </ul>
  
  <p>But it does have the advantage that anyone who knows the label could run jobs so it could be reserved by a team.</p>
  
  <p>Any ideas?</p>