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

[libvirt] process= support for 'qemu-kvm -name' [Bug 576950]



I wrote (attached here, and to the bug) a quick patch that sets the process
name to the same value as the window title.

I'm unsure where to go from here. Should I add support for converting
"native" QEMU command lines to libvirt XML? What would that look like, since
I'm not modifying the libvirt format? Should it just drop any ,process= from
the QEMU command line it's parsing? I also imagine the test cases will need
updating.

If someone could give me some high-level guidance, I'd be happy to keep
going on this.

john
-- 
John Morrissey          _o            /\         ----  __o
jwm horde net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 616af6e..a175cd7 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1126,8 +1126,11 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
         flags |= QEMUD_CMD_FLAG_ENABLE_KVM;
     if (strstr(help, "-no-reboot"))
         flags |= QEMUD_CMD_FLAG_NO_REBOOT;
-    if (strstr(help, "-name"))
+    if (strstr(help, "-name")) {
         flags |= QEMUD_CMD_FLAG_NAME;
+        if (strstr(help, ",process="))
+            flags |= QEMUD_CMD_FLAG_NAME_PROCESS;
+    }
     if (strstr(help, "-uuid"))
         flags |= QEMUD_CMD_FLAG_UUID;
     if (strstr(help, "-xen-domid"))
@@ -3550,7 +3553,15 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
     if (qemuCmdFlags & QEMUD_CMD_FLAG_NAME) {
         ADD_ARG_LIT("-name");
-        ADD_ARG_LIT(def->name);
+        if (qemuCmdFlags & QEMUD_CMD_FLAG_NAME_PROCESS) {
+            char *name;
+            if (virAsprintf(&name, "%s,process=%s",
+                            def->name, def->name) < 0)
+                goto no_memory;
+            ADD_ARG_LIT(name);
+        else {
+            ADD_ARG_LIT(def->name);
+        }
     }
     if (qemuCmdFlags & QEMUD_CMD_FLAG_UUID) {
         ADD_ARG_LIT("-uuid");
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 2d62cc4..3e65b29 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -84,6 +84,7 @@ enum qemud_cmd_flags {
     QEMUD_CMD_FLAG_NETDEV        = (1 << 29), /* The -netdev flag & netdev_add/remove monitor commands */
     QEMUD_CMD_FLAG_RTC           = (1 << 30), /* The -rtc flag for clock options */
     QEMUD_CMD_FLAG_VNET_HOST     = (1 << 31), /* vnet-host support is available in qemu */
+    QEMUD_CMD_FLAG_NAME_PROCESS  = (1 << 32), /* Is -name process= available */
 };
 
 /* Main driver state */

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