Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20011

new slave schedule typ: only power on machine if job requests it

      We regsietered all out vm in jenkins an want to do thing on thme by job. At the moment the vm is tried to power on periodeially (dunno what this depends on) and we want only that the machine will be tried to start if the job needs it.

      So not only "do nothing" if its disconneted or don't do anything if its connected furthermore only try to switch it on (power on) and connect it, if any job requires it (by slave name or tah label). I already set option "use this node exluively for assigned jobs" and "on/off on demand/idle" but still the node is automatically swicthed on, although no job runs request it. Its impossible to power down the slave doing maitenance, although the jenkins admin do make it temporatly not availabe before. That is more a woor around than the wanted schedule typ i request in this issue.

          [JENKINS-20011] new slave schedule typ: only power on machine if job requests it

          Jason Swager added a comment -

          What is the "Availability" setting for this slave. If set to "Keep this slave online as much as possible", then this is expected behavior. Jenkins will keep this node online, even if no jobs CAN run on it or are scheduled to run on it. After all, that's what you've asked Jenkins to do.

          If you want the slave to only get powered on when needed, change "Availability" to "Take this slave online when in demand and offline when idle." Then fill in values for "In demand delay" and "Idle delay".

          Jason Swager added a comment - What is the "Availability" setting for this slave. If set to "Keep this slave online as much as possible", then this is expected behavior. Jenkins will keep this node online, even if no jobs CAN run on it or are scheduled to run on it. After all, that's what you've asked Jenkins to do. If you want the slave to only get powered on when needed, change "Availability" to "Take this slave online when in demand and offline when idle." Then fill in values for "In demand delay" and "Idle delay".

          cforce added a comment -

          I need it to never power on only use if already online. The Problem is i need to disconnect then before

          cforce added a comment - I need it to never power on only use if already online. The Problem is i need to disconnect then before

          Jason Swager added a comment -

          If you don't want Jenkins to control the slave as if it where a VM - allowing power-on, power-off, revert on demand - then I would suggest that you don't need the slave to be a vSphere Cloud slave, but just a normal dumb slave. Jenkins lets you create those and leaves the turning on, turning off to you.

          The intent behind the vSphere Cloud slaves is that Jenkins can control the slave more closely. It sounds like you don't want it to have that degree of control. The dumb slave would probably work better for you.

          Jason Swager added a comment - If you don't want Jenkins to control the slave as if it where a VM - allowing power-on, power-off, revert on demand - then I would suggest that you don't need the slave to be a vSphere Cloud slave, but just a normal dumb slave. Jenkins lets you create those and leaves the turning on, turning off to you. The intent behind the vSphere Cloud slaves is that Jenkins can control the slave more closely. It sounds like you don't want it to have that degree of control. The dumb slave would probably work better for you.

          cforce added a comment -

          I do want jenkins to control the slave, but not all teams which have control on the salves have control on jenkins. They want to power off the slave by themself to do restorre from backup's or juts get offline to save hardware ressources fpr some time. Later they start the slave or its backup again. Jenkins shall just use if if its online , also be possible to use the vsphere features then.
          At the moment the plugin tries to immideatlitly start any slave when it went offline. There is no setting to do nothing in that case. I don't want the slave to be put Offline when jenkins mean not to need it, because this salves are also used by our team, for tesing purposes beyond jenkins jobs running there.

          Jenkins shall just use it if its online, don't power on or power off, but for any job istself calls it. This is not the case here, it's caused by the standard vsphere node config, where is no option "only to use if online"

          cforce added a comment - I do want jenkins to control the slave, but not all teams which have control on the salves have control on jenkins. They want to power off the slave by themself to do restorre from backup's or juts get offline to save hardware ressources fpr some time. Later they start the slave or its backup again. Jenkins shall just use if if its online , also be possible to use the vsphere features then. At the moment the plugin tries to immideatlitly start any slave when it went offline. There is no setting to do nothing in that case. I don't want the slave to be put Offline when jenkins mean not to need it, because this salves are also used by our team, for tesing purposes beyond jenkins jobs running there. Jenkins shall just use it if its online, don't power on or power off, but for any job istself calls it. This is not the case here, it's caused by the standard vsphere node config, where is no option "only to use if online"

          Jason Swager added a comment -

          Just to confirm - you don't want Jenkins to power the slave on or off, just use the slave if it is online?

          If this is what you want, then using the vSphere Cloud slave is NOT what you should do. You want to use the Jenkins Dumb Slave - even though the slave is a VM. The Dumb Slave has no capability to turn on or off - it relies on something other than Jenkins (human, timer based power strips, BIOS power timer controls, whatever) to turn the slave on off. If Jenkins sends a job to slave like that, it will just remain in the queue until the slave is powered on and connected.

          Have you tried just using the Dumb Slave? Recommend giving that a try and seeing how that work for your situation.

          Jason Swager added a comment - Just to confirm - you don't want Jenkins to power the slave on or off, just use the slave if it is online? If this is what you want, then using the vSphere Cloud slave is NOT what you should do. You want to use the Jenkins Dumb Slave - even though the slave is a VM. The Dumb Slave has no capability to turn on or off - it relies on something other than Jenkins (human, timer based power strips, BIOS power timer controls, whatever) to turn the slave on off. If Jenkins sends a job to slave like that, it will just remain in the queue until the slave is powered on and connected. Have you tried just using the Dumb Slave? Recommend giving that a try and seeing how that work for your situation.

          cforce added a comment - - edited

          I DO wanna power on the slave, but ONLY if a JOB requests to do it by name or label filter, not because the slave node is just configured.
          I then DO WANT to use the plugins vmware api features in the job jonfig for this node.

          Maybe it would makes things clear if you explain if i need to have the node registered as vmware node if i wannan use the vmware features in the job for this node.
          If not, then you are right - i could use a dumb slave.

          Tx for pointing things out.

          cforce added a comment - - edited I DO wanna power on the slave, but ONLY if a JOB requests to do it by name or label filter, not because the slave node is just configured. I then DO WANT to use the plugins vmware api features in the job jonfig for this node. Maybe it would makes things clear if you explain if i need to have the node registered as vmware node if i wannan use the vmware features in the job for this node. If not, then you are right - i could use a dumb slave. Tx for pointing things out.

          Jason Swager added a comment -

          I think I'm beginning to understand what you want. What you want is this:

          • Power on the slave if a job is scheduled for it.
          • When done with a job, leave the slave alone.
          • Someone can power down the slave and as long as there is no jobs for it, it will remain powered down.
          • If the slave is powered on, Jenkins can use it. But Jenkins won't power it down.

          The vSphere Plugin implements the three existing "schedules" of slave availability: always on, on/off on demand/idle, and on/off on schedule. Actually, the plugin doesn't really implement them, it just implements a way to Connect() and Disconnect() the slave. Jenkins itself - using those three schedules - will tell the slave to connect or disconnect. The slave can refuse to start if it wants, but it can't really implement its own scheduling. Jenkins does that.

          Maybe you could use the "on/off on demand/idle" scheduling. Use a "In demand delay" of 0, so that Jenkins will power on the VM when needed. Then use an "Idle delay" of some very large number (I don't think -1 is infinite in this case, but worth a try...). That way, when a build is done, Jenkins will leave the slave powered on. If someone shuts the slave down, Jenkins won't restart it - unless it needs to run a job on it. And if you power the slave on when there is nothing to do, the long idle delay will prevent it from being shutdown automatically by Jenkins. Well, eventually it will be, but maybe just once a week or month.

          Jason Swager added a comment - I think I'm beginning to understand what you want. What you want is this: Power on the slave if a job is scheduled for it. When done with a job, leave the slave alone. Someone can power down the slave and as long as there is no jobs for it, it will remain powered down. If the slave is powered on, Jenkins can use it. But Jenkins won't power it down. The vSphere Plugin implements the three existing "schedules" of slave availability: always on, on/off on demand/idle, and on/off on schedule. Actually, the plugin doesn't really implement them, it just implements a way to Connect() and Disconnect() the slave. Jenkins itself - using those three schedules - will tell the slave to connect or disconnect. The slave can refuse to start if it wants, but it can't really implement its own scheduling. Jenkins does that. Maybe you could use the "on/off on demand/idle" scheduling. Use a "In demand delay" of 0, so that Jenkins will power on the VM when needed. Then use an "Idle delay" of some very large number (I don't think -1 is infinite in this case, but worth a try...). That way, when a build is done, Jenkins will leave the slave powered on. If someone shuts the slave down, Jenkins won't restart it - unless it needs to run a job on it. And if you power the slave on when there is nothing to do, the long idle delay will prevent it from being shutdown automatically by Jenkins. Well, eventually it will be, but maybe just once a week or month.

          cforce added a comment -

          I already tested the schedule "on/off on demand/idle" but even then the slave immidiately gets started if powered down, although there is no job quering it top do anything on this slave. The "very large delay" is an not to nice workaround, cause some time later it won't work, that would the first and only manually power down to the next period it happens again.
          The problems is that there is no defensive startegy to make use of vmware slaves. At the moment the jenkins admin needs to disconnect the slave before any system oper can do star/stop actions on this machines beyond jenkins, e.g manitenenance or back restores...
          This is i wanna have new feature for this in this issue.

          cforce added a comment - I already tested the schedule "on/off on demand/idle" but even then the slave immidiately gets started if powered down, although there is no job quering it top do anything on this slave. The "very large delay" is an not to nice workaround, cause some time later it won't work, that would the first and only manually power down to the next period it happens again. The problems is that there is no defensive startegy to make use of vmware slaves. At the moment the jenkins admin needs to disconnect the slave before any system oper can do star/stop actions on this machines beyond jenkins, e.g manitenenance or back restores... This is i wanna have new feature for this in this issue.

          Jason Swager added a comment -

          The feature will have to come from the Jenkins core. Jenkins says Connect() - that's what the slave does, whatever it takes. And Jenkins will follow those three schedules.

          There is an existing Jenkins feature: Temporary Offline. If you click on a slave, you can select "Mark this node temporarily offline". When you do that, you can then do whatever you want with the slave VM and Jenkins won't turn it on, or off, or run jobs on it. When I perform maintenance on our slaves, that's the method that I use: put the slave in temporarily offline, then do the maintenance, then bring it back online. But it does take some degree of access. That would the last thing to offer.

          To have Jenkins and the slaves work EXACTLY like you describe, you would have to go into Jenkins core and add new type of scheduling.

          Jason Swager added a comment - The feature will have to come from the Jenkins core. Jenkins says Connect() - that's what the slave does, whatever it takes. And Jenkins will follow those three schedules. There is an existing Jenkins feature: Temporary Offline. If you click on a slave, you can select "Mark this node temporarily offline". When you do that, you can then do whatever you want with the slave VM and Jenkins won't turn it on, or off, or run jobs on it. When I perform maintenance on our slaves, that's the method that I use: put the slave in temporarily offline, then do the maintenance, then bring it back online. But it does take some degree of access. That would the last thing to offer. To have Jenkins and the slaves work EXACTLY like you describe, you would have to go into Jenkins core and add new type of scheduling.

          Jason Swager added a comment -

          Removing vSphere Cloud tag, adding core so that Core folks can take a look at. Also removing assignment to me.

          The problem appears to be that for some reason, Jenkins is wanting to run something on their VM slave. No jobs appear in the history, but it gets started up. Since the vSphere Cloud slave is just responding to a Jenkins request to Connect(), the question is why is Jenkins requesting a connect. Not a vSphere Plugin problems that I'm aware of.

          Jason Swager added a comment - Removing vSphere Cloud tag, adding core so that Core folks can take a look at. Also removing assignment to me. The problem appears to be that for some reason, Jenkins is wanting to run something on their VM slave. No jobs appear in the history, but it gets started up. Since the vSphere Cloud slave is just responding to a Jenkins request to Connect(), the question is why is Jenkins requesting a connect. Not a vSphere Plugin problems that I'm aware of.

            Unassigned Unassigned
            cforce cforce
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: