Bug 1335585
Summary: | libvirt-guests: filter out xen domain-0 | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | Chris Hoefler <hoeflerb> | ||||
Component: | libvirt | Assignee: | Libvirt Maintainers <libvirt-maint> | ||||
Status: | CLOSED UPSTREAM | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | unspecified | CC: | crobinso, hoeflerb, rbalakri | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-10-10 17:24:56 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Chris Hoefler
2016-05-12 14:50:48 UTC
Thanks for the patch, but I can't reproduce the issue in my hacked up testing. What libvirt version are you using? What host distro is this? Do you know what the default shell on your system is? (In reply to Cole Robinson from comment #1) > Thanks for the patch, but I can't reproduce the issue in my hacked up > testing. > > What libvirt version are you using? > What host distro is this? > Do you know what the default shell on your system is? Ubuntu 16.04 LTS libvirt 1.3.1 /bin/sh is symlinked to /bin/dash Does using /bin/bash reproduce the problem? (without your patch) That's obviously not a solution, I'm just trying to determine if this is a shell compatibility/why I can't reproduce A good thought because dash does occasionally have compatibility issues with bash. But no, I tried by changing the shebang to #!/bin/bash, and also by explicitly invoking the bash shell with source. I get the same problem in both cases. However, I think you are on to something. I noticed the list_guests() function has, echo "$list" | grep -v 00000000-0000-0000-0000-000000000000 as the last line. The quotes around $list inhibit word splitting, so the newlines between uuids don't get interpreted as delimiters. I removed the quotes and now the script works with both bash and dash as expected. The weird part is that word splitting *should* have happened at the original command substitution, list=$(run_virsh_c "$uri" list --uuid $persistent) but, for some reason, it didn't. It gets a seconds chance at the echo statement, but only if the quotes are absent. Maybe your shell has different IFS behavior? I'm running, GNU bash, version 4.3.42(1)-release (x86_64-pc-linux-gnu) and, dash, 0.5.8-2.1ubuntu2 Sigh, that change to grep out 0000... (xen domain-0) is an ubuntu patch which hasn't been submitted upstream. Search for 'libvirt-guests' here: https://launchpad.net/ubuntu/xenial/+source/libvirt/+changelog The patch is by Stefan Bader. So please file a bug against ubuntu, and ask him to submit his patches upstream next time Repurposing this bug to track upstreaming some kind of patch to skip domain-0 in libvirt-guests Stefan's fixed patches are upstream now commit cc38d5661ff11cbe749fa8932e74300f406a7780 Author: Stefan Bader <stefan.bader> Date: Fri Oct 7 09:56:33 2016 +0200 tools: Exclude Xen dom0 from libvirt-guests.sh list With newer versions of libvirt Domain-0 is again visible in the list of running guests but it should not be considered as a guest for shutdown or suspend. Signed-off-by Stefan Bader <stefan.bader> commit 69722fd7ac854f95eac65a4bf3fd86e65fbc470f Author: Stefan Bader <stefan.bader> Date: Fri Oct 7 09:56:32 2016 +0200 tools: Ignore newlines in libvirt-guests.sh guest list The list file expects all guest UUIDs on the same line as the URI which the guests run on. This does not happen when the list is echo'ed in quotes. When stripping the quotes, newlines get transformed into spaces. Without this, only the first guest on the list is actually handled. Based on a fix by Omar Siam <simar> Bug-Ubuntu: http://bugs.launchpad.net/bugs/1591695 Signed-off-by: Stefan Bader <stefan.bader> |