[libvirt] [BUG] storage.xml: owner|group=-1 → 2^32-1 on 32 Bit
Philipp Hahn
hahn at univention.de
Fri Nov 23 14:17:58 UTC 2012
Hello,
when you install and use libvirt in a 32 bit environment, the handling of
owner and group in /etc/libvirt/storage/*.xml is broken: The initial -1 is
printed as an "unsigned int" and is thus converted to +(2^32-1):
> # cat /etc/libvirt/storage/default.xml
> <!--
> WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
> OVERWRITTEN AND LOST. Changes to this xml configuration should be made
> using: virsh pool-edit default
> or other application using the libvirt API.
> -->
>
> <pool type='dir'>
> <name>default</name>
> <uuid>4e2670b8-9dc3-528e-6fc2-58268e99f44f</uuid>
> <capacity unit='bytes'>0</capacity>
> <allocation unit='bytes'>0</allocation>
> <available unit='bytes'>0</available>
> <source>
> </source>
> <target>
> <path>/var/lib/libvirt/images</path>
> <permissions>
> <mode>0700</mode>
> <owner>4294967295</owner>
> <group>4294967295</group>
> </permissions>
> </target>
> </pool>
When you next restart libvirtd virStorageDefParsePerms() tries to parse that
as an "signed int", which fails in virXPathLongBase() because of
> 182 if (*value != obj->floatval) {
> (gdb) print *value
> $11 = -2147483648
> (gdb) print obj->floatval
> $12 = 4294967295
> (gdb) print /x *value
> $13 = 0x80000000
> (gdb) print /x obj->floatval
> $14 = 0xffffffff
This then prints the following error messages:
> 2012-11-23 14:03:18.877+0000: 25536: error : virStorageDefParsePerms:613 :
> XML error: malformed owner element
> 2012-11-23 14:03:19.581+0000: > 25529: error :
storagePoolSetAutostart:1056 : Failed to create symlink
> '/etc/libvirt/storage/autostart/default.xml' to '/etc/libvirt/storage/def
The change to print owner and group as %d instead of %u was introdeces in
commit 37a10129:
> Update xml schemas according to libvirt source
...
> storage_conf: Print uid_t and gid_t as signed to storage pool XML.
Care to revert that change? Patch is attached.
Sincerely
Philipp
--
Philipp Hahn Open Source Software Engineer hahn at univention.de
Univention GmbH be open. fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
-------------- next part --------------
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7944555..b07a7aa 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1036,10 +1036,10 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
virBufferAddLit(&buf," <permissions>\n");
virBufferAsprintf(&buf," <mode>0%o</mode>\n",
def->target.perms.mode);
- virBufferAsprintf(&buf," <owner>%d</owner>\n",
- (int) def->target.perms.uid);
- virBufferAsprintf(&buf," <group>%d</group>\n",
- (int) def->target.perms.gid);
+ virBufferAsprintf(&buf," <owner>%u</owner>\n",
+ (unsigned int) def->target.perms.uid);
+ virBufferAsprintf(&buf," <group>%u</group>\n",
+ (unsigned int) def->target.perms.gid);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121123/da1ca7cc/attachment-0001.sig>
More information about the libvir-list
mailing list