mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemu: check driver name while attaching disk
This bug was reported by Shi Jin(jinzishuai@gmail.com): ============= # 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 check the driver name when we start or restore VM, but we do not check it while attaching a disk. This adds the same check on disk driverName used in qemuBuildCommandLine to qemudDomainAttachDevice. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
This commit is contained in:
parent
08ddbe61f6
commit
e2aec53b97
@ -4025,6 +4025,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,
|
||||
|
Loading…
Reference in New Issue
Block a user