[Pkg-libvirt-maintainers] Bug#592817: libvirt-bin: libvirt fails to create openvz domain with "cannot set uuid"
Eric Litak
elitak at gmail.com
Fri Aug 13 00:57:19 UTC 2010
Package: libvirt-bin
Version: 0.8.2-1
Severity: normal
*** Please type your report below this line ***
This is probably an upstream bug, but I was told by the libvirt devs to file
this here first. OpenVZ operations were completely broken for me. Creating a
domain with virsh or any other method failed in the same way. It would complain
about not being able to set the UUID, but that was just hiding the real problem.
You can reproduce this if you install libvirtbin=0.8.2-1 and run "virsh
create sample.xml" where sample.xml contains:
<domain type="openvz" id="101">
<name>101</name>
<memory>0</memory>
<currentMemory>0</currentMemory>
<vcpu>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
</os>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<filesystem type="template"><source name="abc"/><target
dir="/"/></filesystem>
<interface type="bridge"><source bridge="vmbr0"/></interface>
</devices>
</domain>
This worked in 0.6.5 and then regressed beyond that release. I hadn't time to
debug it back when I found it. I'm not sure how this went unnoticed for so long.
I had a lot of difficulty debugging this because the errors printed are somewhat
misleading. The real problem is that neither the id nor name is used to pick the
conf file name as it was in 0.6.5. Instead, new code was added to find the
lowest unused ID. With this input, libvirt creates /etc/vz/conf/100.conf for
this container with ID 101. Later on during the "create" command, it tries to
set the UUID of this container and fails to load it's configuration because it's
looking for the wrong file. Here's my patch that excises the changes that caused
the regressions:
diff -ur src/openvz/openvz_driver.c.old src/openvz/openvz_driver.c
--- libvirt-0.8.2/src//openvz/openvz_driver.c 2010-06-29
01:54:08.000000000 -0700
+++ ../src/openvz/openvz_driver.c 2010-08-12 15:43:14.000000000 -0700
@@ -103,10 +103,6 @@
int maxarg, virDomainDefPtr vmdef)
{
int narg;
- int veid;
- int max_veid;
- char str_id[10];
- FILE *fp;
for (narg = 0; narg < maxarg; narg++)
args[narg] = NULL;
@@ -135,36 +131,7 @@
ADD_ARG_LIT(VZCTL);
ADD_ARG_LIT("--quiet");
ADD_ARG_LIT("create");
-
- if ((fp = popen(VZLIST " -a -ovpsid -H 2>/dev/null", "r")) == NULL) {
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("popen failed"));
- return -1;
- }
- max_veid = 0;
- while (!feof(fp)) {
- if (fscanf(fp, "%d\n", &veid) != 1) {
- if (feof(fp))
- break;
-
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to parse vzlist output"));
- goto cleanup;
- }
- if (veid > max_veid) {
- max_veid = veid;
- }
- }
- fclose(fp);
-
- if (max_veid == 0) {
- max_veid = 100;
- } else {
- max_veid++;
- }
-
- sprintf(str_id, "%d", max_veid);
- ADD_ARG_LIT(str_id);
+ ADD_ARG_LIT(vmdef->name);
ADD_ARG_LIT("--name");
ADD_ARG_LIT(vmdef->name);
@@ -188,11 +155,6 @@
openvzError(VIR_ERR_INTERNAL_ERROR,
_("Could not put argument to %s"), VZCTL);
return -1;
-
-cleanup:
- fclose(fp);
- return -1;
-
#undef ADD_ARG
#undef ADD_ARG_LIT
}
This is not the best solution. the "id" attribute is what should be used rather
than the "name" element. Well, the bigger problem is that buried in the code
elsewhere is the logic that's supposed to be able to find domain id 101 even if
it's in file 100.conf that's broken. I didn't even try to find that because it
didn't make sense to me to ever store ctid 101 in 100.conf, especially when I
name the container 101 and give id=101. I think OpenVZ support needs a lot of
work anyway, but that's for the devs to decide.
Again, this is probably for the upstream authors. I will file this again with
them if you agree or I don't get any response after some time.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (990, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libvirt-bin depends on:
ii adduser 3.112 add and remove users and groups
ii libavahi-client3 0.6.26-1 Avahi client library
ii libavahi-common3 0.6.26-1 Avahi common library
ii libblkid1 2.17.2-3.1 block device id library
ii libc6 2.11.2-2 Embedded GNU C Library: Shared
lib
ii libcap-ng0 0.6.4-1 An alternate posix capabilities
li
ii libdevmapper1.02.1 2:1.02.48-2 The Linux Kernel Device Mapper
use
ii libgcrypt11 1.4.5-2 LGPL Crypto library - runtime
libr
ii libgnutls26 2.8.6-1 the GNU TLS library - runtime
libr
ii libnl1 1.1-5 library for dealing with
netlink s
ii libparted0debian1 2.3-1 The GNU Parted disk
partitioning s
ii libpciaccess0 0.12.0-1 Generic PCI access library for
X
ii libreadline6 6.1-3 GNU readline and history
libraries
ii libsasl2-2 2.1.23.dfsg1-5 Cyrus SASL - authentication
abstra
ii libudev0 160-1 libudev shared library
ii libuuid1 2.17.2-3.1 Universally Unique ID library
ii libvirt0 0.8.2-1 library for interfacing with
diffe
ii libxenstore3.0 3.4.0-2 Xenstore communications library
fo
ii libxml2 2.7.7.dfsg-4 GNOME XML library
ii logrotate 3.7.8-4 Log rotation utility
Versions of packages libvirt-bin recommends:
ii bridge-utils 1.4-5 Utilities for configuring the
Linu
ii dnsmasq-base 2.51-1 A small caching DNS proxy and
DHCP
ii iptables 1.4.4-2 administration tools for packet
fi
pn libxml2-utils <none> (no description available)
ii netcat-openbsd 1.89-3 TCP/IP swiss army knife
ii qemu 0.12.5+dfsg-1 fast processor emulator
Versions of packages libvirt-bin suggests:
ii policykit-1 0.96-2 framework for managing
administrat
-- no debconf information
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-libvirt-maintainers/attachments/20100812/3c5bfcfc/attachment.htm>
More information about the Pkg-libvirt-maintainers
mailing list