mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
libvirt/qemu - support persistent update of disks
Support update of disks by MODIFY_CONFIG This patch includes changes for qemu's disk to support virDomainUpdateDeviceFlags() with VIR_DOMAIN_DEVICE_MODIFY_CONFIG. This patch adds support for CDROM/foppy disk types. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> * src/qemu/qemu_driver.c (qemuDomainUpdateDeviceConfig): support cdrom/floppy.
This commit is contained in:
parent
578391e1bc
commit
f37c29c8aa
@ -4136,10 +4136,48 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef ATTRIBUTE_UNUSED,
|
||||
qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
|
||||
virDomainDeviceDefPtr dev)
|
||||
{
|
||||
virDomainDiskDefPtr orig, disk;
|
||||
int pos;
|
||||
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
disk = dev->data.disk;
|
||||
pos = virDomainDiskIndexByName(vmdef, disk->dst);
|
||||
if (pos < 0) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
_("target %s doesn't exists."), disk->dst);
|
||||
return -1;
|
||||
}
|
||||
orig = vmdef->disks[pos];
|
||||
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
|
||||
!(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
_("this disk doesn't support update"));
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Update 'orig'
|
||||
* We allow updating src/type//driverType/cachemode/
|
||||
*/
|
||||
VIR_FREE(orig->src);
|
||||
orig->src = disk->src;
|
||||
orig->type = disk->type;
|
||||
orig->cachemode = disk->cachemode;
|
||||
if (disk->driverName) {
|
||||
VIR_FREE(orig->driverName);
|
||||
orig->driverName = disk->driverName;
|
||||
disk->driverName = NULL;
|
||||
}
|
||||
if (disk->driverType) {
|
||||
VIR_FREE(orig->driverType);
|
||||
orig->driverType = disk->driverType;
|
||||
disk->driverType = NULL;
|
||||
}
|
||||
disk->src = NULL;
|
||||
break;
|
||||
default:
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("persistent update of device is not supported"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user