]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Remove using phy as default disk driver in cmdAttachDisk
authorOsier Yang <jyang@redhat.com>
Thu, 2 Dec 2010 01:19:30 +0000 (09:19 +0800)
committerEric Blake <eblake@redhat.com>
Thu, 2 Dec 2010 02:01:06 +0000 (19:01 -0700)
* tools/virsh.c (virsh shouldn't use 'phy' as the disk driver if
user doesn't specify "--driver", it causes bugs, as not all of
hypervisor driver supports 'phy', and actually hypervisor should
known the correct default disk driver and subdriver, so remove it)

tools/virsh.c

index 6a9aba28489bd02eea267c3c62afc89a4a05f271..c09c0d848b3b5c919956ae9a7d9ee91e2562e2dc 100644 (file)
@@ -8668,11 +8668,16 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
         virBufferVSprintf(&buf, " device='%s'", type);
     virBufferAddLit(&buf, ">\n");
 
-    virBufferVSprintf(&buf, "  <driver name='%s'",
-                      (driver) ? driver : "phy");
+    if (driver || subdriver)
+        virBufferVSprintf(&buf, "  <driver");
+
+    if (driver)
+        virBufferVSprintf(&buf, " name='%s'", driver);
     if (subdriver)
         virBufferVSprintf(&buf, " type='%s'", subdriver);
-    virBufferAddLit(&buf, "/>\n");
+
+    if (driver || subdriver)
+        virBufferAddLit(&buf, "/>\n");
 
     virBufferVSprintf(&buf, "  <source %s='%s'/>\n",
                       (isFile) ? "file" : "dev",