Comments (2)
I applied this change and created a build. It doesn't appear gracefully runs the shutdown command. Instead it seems to swallow the error that is currently produced.
Here is the output when run with this code change
==> xenserver-iso: Connected to SSH!
2021/03/29 23:07:43 packer-plugin-xenserver plugin: 2021/03/29 23:07:43 Running the provision hook
==> xenserver-iso: Step: Shutting down VM
xenserver-iso: Executing shutdown command...
2021/03/29 23:07:43 packer-plugin-xenserver plugin: 2021/03/29 23:07:43 [DEBUG] Opening new ssh session
2021/03/29 23:07:43 packer-plugin-xenserver plugin: 2021/03/29 23:07:43 [DEBUG] starting remote command: /sbin/shutdown
==> xenserver-iso: Failed to set wall message, ignoring: Interactive authentication required.
2021/03/29 23:07:46 packer-plugin-xenserver plugin: 2021/03/29 23:07:46 [ERROR] Remote command exited with '1': /sbin/shutdown
==> xenserver-iso: Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Interactive authentication required.
xenserver-iso: Waiting for VM to enter Halted state...
==> xenserver-iso: Error waiting for VM to halt: Timed out
==> xenserver-iso: WARNING: Forcing hard shutdown of the VM...
xenserver-iso: Successfully shut down VM
xenserver-iso: Successfully set VM as a template
Here is the output when run from the latest release (v0.3.2)
==> xenserver-iso: Connected to SSH!
==> xenserver-iso: Step: Shutting down VM
xenserver-iso: Executing shutdown command...
==> xenserver-iso: Shutdown command failed: Process exited with status 1
==> xenserver-iso: WARNING: Forcing hard shutdown of the VM...
xenserver-iso: Successfully shut down VM
xenserver-iso: Successfully set VM as a template
So the RemoteCmd.RunWithUi
seems to not return an error even though the command itself did fail. It seems the underlying issue is actually the following lines from the output above
==> xenserver-iso: Failed to set wall message, ignoring: Interactive authentication required.
2021/03/29 23:07:46 packer-plugin-xenserver plugin: 2021/03/29 23:07:46 [ERROR] Remote command exited with '1': /sbin/shutdown
==> xenserver-iso: Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Interactive authentication required.
from packer-plugin-xenserver.
It seems that the better solution would be to use the XAPI's graceful vm shutdown rather than expecting user's of this plugin to supply their own shutdown command. In fact the plugin already has the code for this 😄 (here).
This is used when the shutdown command is omitted from the packer config. I removed it from the centos example and re-ran the build and see that it is working as expected.
==> xenserver-iso: Connected to SSH!
2021/03/29 23:41:27 packer-plugin-xenserver plugin: 2021/03/29 23:41:27 Running the provision hook
==> xenserver-iso: Step: Shutting down VM
xenserver-iso: Attempting to cleanly shutdown the VM...
xenserver-iso: Successfully shut down VM
xenserver-iso: Successfully set VM as a template
2021/03/29 23:41:37 packer-plugin-xenserver plugin: 2021/03/29 23:41:37 Skipping detach of 'iso_vdi_uuid'
2021/03/29 23:41:37 packer-plugin-xenserver plugin: 2021/03/29 23:41:37 Could not find VDI record in VBD 'OpaqueRef:ad300ce7-00c5-453c-91f5-4fb453dc43b9'
2021/03/29 23:41:37 packer-plugin-xenserver plugin: 2021/03/29 23:41:37 Detached VDI '696250ff-7d32-4993-a141-5823d6af859a'
2021/03/29 23:41:37 packer-plugin-xenserver plugin: 2021/03/29 23:41:37 Detached VDI 'feea5dbe-55d8-429f-a978-92cf4e3725e1'
2021/03/29 23:41:37 packer-plugin-xenserver plugin: 2021/03/29 23:41:37 Skipping detach of 'floppy_vdi_uuid'
==> xenserver-iso: Step: export artifact
==> xenserver-iso: Getting XVA https://xen.internal.ddelnano.com/export?uuid=e84eea49-60c4-9ec4-8570-7aa13474950d&session_id=OpaqueRef:b8e115c2-e8c4-4c78-8570-0bb73ce7c547
==> xenserver-iso: Download completed: packer-centos-8.3-x86_64-xenserver
2021/03/29 23:43:39 [INFO] (telemetry) ending xenserver-iso
Build 'xenserver-iso' finished after 23 minutes 2 seconds.
In order to resolve this issue, I think the documentation should be updated to reflect that without a shutdown command it is still a graceful shutdown, however, if your VM requires special shutdown handling then you can customize it if you need to.
from packer-plugin-xenserver.
Related Issues (20)
- New release ? HOT 1
- discord invite link doesn't work HOT 1
- plugin compile instructions incorrect? HOT 6
- Recommended Workflow HOT 2
- Please create a release based on tag v0.4.0 HOT 1
- Update to packer-sdc command for validating plugin compatibility HOT 4
- When using the Packer HCL required plugins stanza getting an error where the 256SUM is not found HOT 4
- xenserver-iso.centos8-local: Error establishing VNC session: error parsing ProtocolVersio
- Release v0.5.0 assets are not compatible with packer 1.7 HOT 3
- packer init examples/ubuntu/ubuntu-2004.pkr.hcl fails HOT 7
- packer examples/ubuntu/ubuntu-2004.pkr.hcl HOT 1
- [FEATURE REQUEST] Add ability to provide content directly to floppy_files and http_directory
- XenServer 8+ doesn't have xs-tools.iso by default, no option to ignore it HOT 3
- ISO Upload - Even is the ISO exists it is uploaded HOT 1
- Support changes of IP address on reboot of VM HOT 5
- Update builder documentation to include the missing (boot) `firmware` parameter HOT 2
- Cannot recreate template if old one (with same name) still exists HOT 3
- Clarification on keep_vm, format, output_directory, and sr_name. HOT 3
- Let users choose if they want a template or a full VM HOT 3
- Boot command fails; Error detecting local IP: ssh: handshake failed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packer-plugin-xenserver.