Problem reverting to snapshot in job

210 views
Skip to first unread message

Andreas Tscharner

unread,
Nov 23, 2015, 10:09:29 AM11/23/15
to jenkins...@googlegroups.com
Hello World,

We have Jenkins set up to build our product in a virtual machine. This
works so far.

Now I set the "Use Snapshot" checkbox and wanted to revert the VM to the
snapshot "production". This snapshot exists, I double checked:

root@buildserver:~# virsh snapshot-list build-vm2
Name Creation Time State
------------------------------------------------------------
production 2015-11-09 23:48:03 +0100 shutoff

But if the job should be executed, I get the following error:

Build wurde durch eine SCM-Änderung ausgelöst.
Got snapshot production from job configuration
Preparing to revert build-vm2 to snapshot production.
[EnvInject] - Loading node environment variables.
ERROR: SEVERE ERROR occurs
org.jenkinsci.lib.envinject.EnvInjectException:
hudson.remoting.ChannelClosedException: channel is already closed
at
org.jenkinsci.plugins.envinject.service.EnvironmentVariablesNodeLoader.gatherEnvironmentVariablesNode(EnvironmentVariablesNodeLoader.java:75)
at
org.jenkinsci.plugins.envinject.EnvInjectListener.loadEnvironmentVariablesNode(EnvInjectListener.java:81)
at
org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironment(EnvInjectListener.java:39)
at
hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:572)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:492)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.remoting.ChannelClosedException: channel is already closed
at hudson.remoting.Channel.send(Channel.java:578)
at hudson.remoting.Request.call(Request.java:130)
at hudson.remoting.Channel.call(Channel.java:780)
at hudson.FilePath.act(FilePath.java:1074)
at
org.jenkinsci.plugins.envinject.service.EnvironmentVariablesNodeLoader.gatherEnvironmentVariablesNode(EnvironmentVariablesNodeLoader.java:44)
... 8 more
Caused by: java.io.IOException
at hudson.remoting.Channel.close(Channel.java:1163)
at hudson.remoting.Channel.close(Channel.java:1138)
at
hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.revertVMSnapshot(LibvirtSnapshotRevertRunListener.java:84)
at
hudson.plugins.libvirt.LibvirtSnapshotRevertRunListener.onStarted(LibvirtSnapshotRevertRunListener.java:58)
at hudson.model.listeners.RunListener.fireStarted(RunListener.java:215)
at hudson.model.Run.execute(Run.java:1734)
... 3 more
Checking console output
[description-setter] Description set:
[EnvInject] - [ERROR] - SEVERE ERROR occurs: channel is already closed
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
ERROR: Error: No workspace found!
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE

What can I do to fix this?

TIA and best regards

WENZEL Metromec AG
Andreas Tscharner
--
Andreas Tscharner, Development
WENZEL Metromec AG, Rheinfelsstrasse 1, CH-7007 Chur, Switzerland
phone: +41 (0)81 257 07 00
fax: +41 (0)81 257 07 01
e-mail: mailto:andreas....@metromec.ch
www: http://www.metromec.ch

Jason Swager

unread,
Nov 23, 2015, 10:53:38 AM11/23/15
to Jenkins Users
Is the build running on a VM slave and you're trying to revert to a snapshot of that particular VM slave?

If so - that's not supported.  Jenkins requires that the slave doing a build be up and running for the entire duration of the build.  If you revert your slave while it's doing a build (sort of like rebooting your slave mid-build), the build will fail.

To work around this, split the job across two jobs.  First job reverts the targeted slave VM, second job runs on the targeted slave VM.

Jason Swager

Andreas Tscharner

unread,
Nov 24, 2015, 3:47:10 AM11/24/15
to jenkins...@googlegroups.com
On 23.11.2015 16:53, Jason Swager wrote:
> Is the build running on a VM slave and you're trying to revert to a
> snapshot of that particular VM slave?

Yes
>
> If so - that's not supported. Jenkins requires that the slave doing a

[snip]
> To work around this, split the job across two jobs. First job reverts
> the targeted slave VM, second job runs on the targeted slave VM.

This does not seem to work either. I created a job, which has only "Use
Snapshot" set, the snapshotname "production" and the node where it
should run ("build-vm3")

I got the same/similar error as before:

Gestartet durch Benutzer anonymous
Got snapshot production from job configuration
Preparing to revert build-vm3 to snapshot production.
Finished: FAILURE

Do I have to shut it down before?

Best regards
Andreas
--
Andreas Tscharner <sterne...@gmail.com>
----------------------------------------------------------------------
"Intruder on level one. All Aliens please proceed to level one."
-- Call in "Alien: Resurrection"

Björn Stabel

unread,
Nov 24, 2015, 6:41:04 AM11/24/15
to jenkins...@googlegroups.com
Maybe you need a plugin dedicated to the task that takes care of things
like snapshotting and such. For vSphere, there's
https://wiki.jenkins-ci.org/display/JENKINS/vSphere+Cloud+Plugin

Andreas Tscharner

unread,
Nov 24, 2015, 8:17:49 AM11/24/15
to jenkins...@googlegroups.com
On 24.11.2015 12:40, Björn Stabel wrote:
> Maybe you need a plugin dedicated to the task that takes care of things
> like snapshotting and such. For vSphere, there's
> https://wiki.jenkins-ci.org/display/JENKINS/vSphere+Cloud+Plugin
>

I have the libvirt slaves plugin installed. The host system is a Debian
Linux, running 8 VMs each one with one executor. On the host the VMs are
handled using virsh; qemu is running the VMs.
Reply all
Reply to author
Forward
0 new messages