[PATCH] Introduce a -libvirt-caps flag as a stop-gap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Today libvirt parses -help output to attempt to enumerate capabilities.  This
is very broken and has led to multiple failures.  Since libvirt is an important
management interface to QEMU, we need to do a better job giving them the ability
to detect what a QEMU executable supports.  Right now, we keep fixing up help
output to appease it's parsing code but this is undesirable.

The Right Solution is to introduce a robust capabilities advertisement that
enumerates every feature we have.  As with most Right Solutions, we don't have
mergable code today and it's unclear that we'll get there by the next release.

This patch introduces an incremental solution of just spitting out the handful
of capabilities libvirt is probing for today.  This interface will need to
remain forever but can stop being updated once we have a Right Solution.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

diff --git a/qemu-options.hx b/qemu-options.hx
index 40cee70..a618914 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2235,7 +2235,26 @@ Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and
 option will prevent QEMU from loading these configuration files at startup.
 ETEXI
 
+DEF("libvirt-caps", 0, QEMU_OPTION_libvirt_caps,
+    "-libvirt-caps   output libvirt-specific capabilities\n",
+    QEMU_ARCH_ALL)
+STEXI
+@item -libvirt-caps
+@findex -libvirt-caps
+Output a common separate list of capabilities that this version of QEMU
+supports and exit.  This interface specifically exists for libvirt's use as an
+intermediate solution until we support a full capabilities system.  One this
+capabilities system exist, this option's output should never change.
+
+The format out this command is:
+
+version: VERSION
+package: PACKAGE
+caps: CAP1[,CAP2...]
+ETEXI
+
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
 @end table
 ETEXI
+
diff --git a/vl.c b/vl.c
index ba6ee11..8fe354d 100644
--- a/vl.c
+++ b/vl.c
@@ -2616,6 +2616,14 @@ int main(int argc, char **argv, char **envp)
                     fclose(fp);
                     break;
                 }
+            case QEMU_OPTION_libvirt_caps:
+                printf("version: " QEMU_VERSION "\n"
+                       "package: " QEMU_PKGVERSION "\n"
+                       "caps: name,enable-kvm,no-reboot,uuid,xen-domid,drive"
+                       ",cache-v2,format,vga,serial,mem-path,chardev,balloon"
+                       ",device,rtc,netdev,sdl,topology\n");
+                exit(0);
+                break;
             default:
                 os_parse_cmd_args(popt->index, optarg);
             }
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]