]> xenbits.xensource.com Git - libvirt.git/commitdiff
Invert logic for checking for QEMU disk cache options
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 27 Jul 2010 10:21:10 +0000 (11:21 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 28 Jul 2010 10:27:13 +0000 (11:27 +0100)
QEMU has had two different syntax for disk cache options

 Old: on|off
 New: writeback|writethrough|none

QEMU recently added another 'unsafe' option which broke the
libvirt check. We can avoid this & future breakage, if we
do a negative check for the old syntax, instead of a positive
check for the new syntax

* src/qemu/qemu_conf.c: Invert cache option check

src/qemu/qemu_conf.c

index 84f4e6f6c090a487a720e9245acf867d0e4e6df9..baf486ea06298f7368e522e08162daf0551a66fa 100644 (file)
@@ -1170,7 +1170,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
         flags |= QEMUD_CMD_FLAG_DOMID;
     if (strstr(help, "-drive")) {
         flags |= QEMUD_CMD_FLAG_DRIVE;
-        if (strstr(help, "cache=writethrough|writeback|none"))
+        if (strstr(help, "cache=") &&
+            !strstr(help, "cache=on|off"))
             flags |= QEMUD_CMD_FLAG_DRIVE_CACHE_V2;
         if (strstr(help, "format="))
             flags |= QEMUD_CMD_FLAG_DRIVE_FORMAT;