]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Make virDomainDeviceInfoIterate usable without os type
authorPeter Krempa <pkrempa@redhat.com>
Wed, 20 Feb 2013 13:06:52 +0000 (14:06 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 5 Mar 2013 07:34:49 +0000 (08:34 +0100)
Make the iterator function usable in the next patches. Also refactor
some parts to avoid strcmp if not necessary.

This commit tweaks and shadows the change that was done in commit
babe7dada0f90bfde74a716e8fc963b049d76f96 and was needed after the
support for multiple console devices was added. Historically the first
<console> element is alias for the <serial> device.

src/conf/domain_conf.c

index 81b6abb80e9abc318d48a95f15581b5daef43682..dc1bd6e6eb0cb78422ee5c3b61edc4abdbdee761 100644 (file)
@@ -2299,8 +2299,9 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
             return -1;
     }
     for (i = 0; i < def->nconsoles ; i++) {
-        if ((STREQ(def->os.type, "hvm")) && i == 0 &&
-            def->consoles[i]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL)
+        if (i == 0 &&
+            def->consoles[i]->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL &&
+            STREQ_NULLABLE(def->os.type, "hvm"))
             continue;
         device.data.chr = def->consoles[i];
         if (cb(def, &device, &def->consoles[i]->info, opaque) < 0)