Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 149

libvirt-0.8.2-29.el5.src.rpm

From aa8a711e34e9cf0f8c0ef0d5fef57f0973b0853d Mon Sep 17 00:00:00 2001
Message-Id: <aa8a711e34e9cf0f8c0ef0d5fef57f0973b0853d.1284409900.git.jdenemar@redhat.com>
From: Ryan Harper <ryanh@us.ibm.com>
Date: Tue, 24 Aug 2010 11:09:00 -0500
Subject: [PATCH] virsh: remove driver check from attach-disk command

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=609422

Virsh shouldn't check for driver support but rather let the backend handled this.
After removing the check, I can successfully attach file-based images to a qemu
VM with attach-disk.

% virsh attach-disk vm2 /images/test02.img vdc --driver qemu --type disk --subdriver raw
Disk attached successfully

This command generates the following XML:

<disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/images/test02.img'/>
      <target dev='vdc' bus='virtio'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
(cherry picked from commit 12a41822e14b558f7ffb4812978b957f3d228f23)
---
 tools/virsh.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index e07fef3..55685dd 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -7910,13 +7910,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
     mode = vshCommandOptString(cmd, "mode", NULL);
 
     if (driver) {
-        if (STREQ(driver, "file") || STREQ(driver, "tap")) {
+        if (STREQ(driver, "file") || STREQ(driver, "tap"))
             isFile = 1;
-        } else if (STRNEQ(driver, "phy")) {
-            vshError(ctl, _("No support for %s in command 'attach-disk'"),
-                     driver);
-            goto cleanup;
-        }
     }
 
     if (mode) {
-- 
1.7.2.2