Re: [PATCH v3 1/2] Optimize machine option to set more options with it

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

 



On 2013年04月02日 20:52, Eric Blake wrote:
On 04/02/2013 04:05 AM, Daniel P. Berrange wrote:
On Fri, Mar 29, 2013 at 01:22:46PM +0800, Li Zhang wrote:
From: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>

Currently, -machine option is used only when dump-guest-core is set.

To use options defined in machine option for newer version of QEMU,
it needs to use -machine xxx, and to be compatible with older version
  -M, this patch addes QEMU_CAPS_MACHINE_OPT capability for newer
s/addes/adds/

version which supports -machine option.

ACK
Pushed, after making some fixes (don't have two spaces in the error
message, smaller scope for the buffer, use faster buffer functions, and
report an error if dump_guest_core is present with the -M form where it
is not supported):
Thanks a lot. :)

diff --git i/src/qemu/qemu_command.c w/src/qemu/qemu_command.c
index 14be49f..a6d011e 100644
--- i/src/qemu/qemu_command.c
+++ w/src/qemu/qemu_command.c
@@ -5200,8 +5200,6 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
                         const virDomainDefPtr def,
                         virQEMUCapsPtr qemuCaps)
  {
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
-
      /* This should *never* be NULL, since we always provide
       * a machine in the capabilities data for QEMU. So this
       * check is just here as a safety in case the unexpected
@@ -5214,16 +5212,23 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
           * '-M' to keep the most of the compatibility with older versions.
           */
          virCommandAddArgList(cmd, "-M", def->os.machine, NULL);
+        if (def->mem.dump_core) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("dump-guest-core is not available "
+                             "with this QEMU binary"));
+            return -1;
+        }
      } else {
+        virBuffer buf = VIR_BUFFER_INITIALIZER;

          virCommandAddArg(cmd, "-machine");
-        virBufferAsprintf(&buf, "%s", def->os.machine);
+        virBufferAdd(&buf, def->os.machine, -1);

          if (def->mem.dump_core) {
              if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               "%s", _("dump-guest-core is not available "
-                                " with this QEMU binary"));
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("dump-guest-core is not available "
+                                 "with this QEMU binary"));
                  return -1;
              }

@@ -5231,7 +5236,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,

virDomainMemDumpTypeToString(def->mem.dump_core));
          }

-        virCommandAddArg(cmd, virBufferContentAndReset(&buf));
+        virCommandAddArgBuffer(cmd, &buf);
      }

      return 0;


--
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]