Re: [PATCH] check driver name while attaching disk

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

 



Thanks Wen.
However, this patch only adds the checking but to make it work we really have to replace the driver name 'file' with 'qemu', don't we?

Thank you very much.
Shi

On Sun, Mar 6, 2011 at 11:35 PM, Wen Congyang <wency@xxxxxxxxxxxxxx> wrote:
This bug was reported by Shi Jin(jinzishuai@xxxxxxxxx):
=============
# virsh attach-disk RHEL6RC /var/lib/libvirt/images/test3.img vdb Â--driver file --subdriver qcow2
Disk attached successfully

# virsh save RHEL6RC /var/lib/libvirt/images/memory.save
Domain RHEL6RC saved to /var/lib/libvirt/images/memory.save

# virsh restore /var/lib/libvirt/images/memory.save
error: Failed to restore domain from /var/lib/libvirt/images/memory.save
error: internal error unsupported driver name 'file' for disk '/var/lib/libvirt/images/test3.img'
=============

We have checked the driver name when we start or restore VM, but we do not check it while attaching
a disk.

Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>

---
Âsrc/qemu/qemu_driver.c | Â Â8 ++++++++
Â1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2892dfe..e94080d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3994,6 +3994,14 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
    goto endjob;

  if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
+ Â Â Â Âif (dev->data.disk->driverName != NULL &&
+ Â Â Â Â Â Â!STREQ(dev->data.disk->driverName, "qemu")) {
+ Â Â Â Â Â ÂqemuReportError(VIR_ERR_INTERNAL_ERROR,
+ Â Â Â Â Â Â Â Â Â Â Â Â Â Â_("unsupported driver name '%s' for disk '%s'"),
+ Â Â Â Â Â Â Â Â Â Â Â Â Â Âdev->data.disk->driverName, dev->data.disk->src);
+ Â Â Â Â Â Âgoto endjob;
+ Â Â Â Â}
+
    if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
      if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) {
        qemuReportError(VIR_ERR_INTERNAL_ERROR,
--
1.7.1



--
Shi Jin, Ph.D.

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