mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: make persistent update of graphics device supported
We can change vnc password by using virDomainUpdateDeviceFlags API with live flag. But it can't be changed with config flag. Error is reported as below. error: Operation not supported: persistent update of device 'graphics' is not supported This patch supports the graphics arguments changed with config flag. Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
This commit is contained in:
parent
dec5f07b9e
commit
9603bce7b1
@ -21136,7 +21136,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
||||
{
|
||||
virDomainDeviceDefPtr ret = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
int flags = VIR_DOMAIN_XML_INACTIVE;
|
||||
int flags = VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE;
|
||||
char *xmlStr = NULL;
|
||||
int rc = -1;
|
||||
|
||||
|
@ -7451,6 +7451,7 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps,
|
||||
virDomainDeviceDefPtr dev)
|
||||
{
|
||||
virDomainDiskDefPtr orig, disk;
|
||||
virDomainGraphicsDefPtr newGraphics;
|
||||
virDomainNetDefPtr net;
|
||||
int pos;
|
||||
|
||||
@ -7489,6 +7490,22 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps,
|
||||
orig->startupPolicy = disk->startupPolicy;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
newGraphics = dev->data.graphics;
|
||||
pos = qemuDomainFindGraphicsIndex(vmdef, newGraphics);
|
||||
if (pos < 0) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("cannot find existing graphics type '%s' device to modify"),
|
||||
virDomainGraphicsTypeToString(newGraphics->type));
|
||||
return -1;
|
||||
}
|
||||
|
||||
virDomainGraphicsDefFree(vmdef->graphics[pos]);
|
||||
|
||||
vmdef->graphics[pos] = newGraphics;
|
||||
dev->data.graphics = NULL;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
net = dev->data.net;
|
||||
if ((pos = virDomainNetFindIdx(vmdef, net)) < 0)
|
||||
@ -7508,7 +7525,6 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps,
|
||||
case VIR_DOMAIN_DEVICE_SOUND:
|
||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
||||
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
case VIR_DOMAIN_DEVICE_HUB:
|
||||
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
||||
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||
|
@ -2271,6 +2271,20 @@ qemuDomainFindGraphics(virDomainObjPtr vm,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
qemuDomainFindGraphicsIndex(virDomainDefPtr def,
|
||||
virDomainGraphicsDefPtr dev)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->ngraphics; i++) {
|
||||
if (def->graphics[i]->type == dev->type)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
|
@ -55,6 +55,8 @@ int qemuDomainAttachHostDevice(virConnectPtr conn,
|
||||
virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr hostdev);
|
||||
int qemuDomainFindGraphicsIndex(virDomainDefPtr def,
|
||||
virDomainGraphicsDefPtr dev);
|
||||
int qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainGraphicsDefPtr dev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user