提交 3193a594 编写于 作者: M Michal Privoznik

qemuDomainUpdateDeviceConfig: Allow full disk update

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

So far, when it comes to 'virsh update-device --config' of disks
we are limiting ourselves for just the disk source update and
just for CDROMs and floppies. This makes no sense. Especially if
you look around and see that we already allow full update to
graphics and net devices. So let's just take whatever XML user
wants to have there and replace our internal definition with it.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 7b3cf84b
......@@ -8090,35 +8090,23 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
unsigned int parse_flags,
virDomainXMLOptionPtr xmlopt)
{
virDomainDiskDefPtr orig, disk;
virDomainDiskDefPtr newDisk;
virDomainGraphicsDefPtr newGraphics;
virDomainNetDefPtr net;
int pos;
switch ((virDomainDeviceType) dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
disk = dev->data.disk;
if (!(orig = virDomainDiskByName(vmdef, disk->dst, false))) {
newDisk = dev->data.disk;
if ((pos = virDomainDiskIndexByName(vmdef, newDisk->dst, false)) < 0) {
virReportError(VIR_ERR_INVALID_ARG,
_("target %s doesn't exist."), disk->dst);
return -1;
}
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
!(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("this disk doesn't support update"));
_("target %s doesn't exist."), newDisk->dst);
return -1;
}
/*
* Update 'orig'
* We allow updating src/type//driverType/cachemode/
*/
orig->cachemode = disk->cachemode;
orig->startupPolicy = disk->startupPolicy;
virStorageSourceFree(orig->src);
orig->src = disk->src;
disk->src = NULL;
virDomainDiskDefFree(vmdef->disks[pos]);
vmdef->disks[pos] = newDisk;
dev->data.disk = NULL;
break;
case VIR_DOMAIN_DEVICE_GRAPHICS:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册