mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
qemu: Implement random number generator cold (un)plug
Add support for using the attach/detach device APIs on the inactive configuration to add RNG devices.
This commit is contained in:
parent
37b620059b
commit
fe6acfbd0e
@ -380,6 +380,7 @@ virDomainPMSuspendedReasonTypeToString;
|
|||||||
virDomainRedirdevBusTypeFromString;
|
virDomainRedirdevBusTypeFromString;
|
||||||
virDomainRedirdevBusTypeToString;
|
virDomainRedirdevBusTypeToString;
|
||||||
virDomainRNGBackendTypeToString;
|
virDomainRNGBackendTypeToString;
|
||||||
|
virDomainRNGDefFree;
|
||||||
virDomainRNGFind;
|
virDomainRNGFind;
|
||||||
virDomainRNGInsert;
|
virDomainRNGInsert;
|
||||||
virDomainRNGModelTypeToString;
|
virDomainRNGModelTypeToString;
|
||||||
|
@ -7427,6 +7427,23 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
|
|||||||
dev->data.fs = NULL;
|
dev->data.fs = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_DEVICE_RNG:
|
||||||
|
if (dev->data.rng->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
||||||
|
virDomainDefHasDeviceAddress(vmdef, &dev->data.rng->info)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("a device with the same address already exists "));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virDomainRNGInsert(vmdef, dev->data.rng, false) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
dev->data.rng = NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DEVICE_INPUT:
|
case VIR_DOMAIN_DEVICE_INPUT:
|
||||||
case VIR_DOMAIN_DEVICE_SOUND:
|
case VIR_DOMAIN_DEVICE_SOUND:
|
||||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||||
@ -7436,7 +7453,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
|
|||||||
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
||||||
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||||
case VIR_DOMAIN_DEVICE_NVRAM:
|
case VIR_DOMAIN_DEVICE_NVRAM:
|
||||||
case VIR_DOMAIN_DEVICE_RNG:
|
|
||||||
case VIR_DOMAIN_DEVICE_SHMEM:
|
case VIR_DOMAIN_DEVICE_SHMEM:
|
||||||
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||||
case VIR_DOMAIN_DEVICE_NONE:
|
case VIR_DOMAIN_DEVICE_NONE:
|
||||||
@ -7543,6 +7559,16 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
virDomainFSDefFree(fs);
|
virDomainFSDefFree(fs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_DEVICE_RNG:
|
||||||
|
if ((idx = virDomainRNGFind(vmdef, dev->data.rng)) < 0) {
|
||||||
|
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||||
|
_("no matching RNG device was found"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
virDomainRNGDefFree(virDomainRNGRemove(vmdef, idx));
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DEVICE_INPUT:
|
case VIR_DOMAIN_DEVICE_INPUT:
|
||||||
case VIR_DOMAIN_DEVICE_SOUND:
|
case VIR_DOMAIN_DEVICE_SOUND:
|
||||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||||
@ -7552,7 +7578,6 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
||||||
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||||
case VIR_DOMAIN_DEVICE_NVRAM:
|
case VIR_DOMAIN_DEVICE_NVRAM:
|
||||||
case VIR_DOMAIN_DEVICE_RNG:
|
|
||||||
case VIR_DOMAIN_DEVICE_SHMEM:
|
case VIR_DOMAIN_DEVICE_SHMEM:
|
||||||
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||||
case VIR_DOMAIN_DEVICE_NONE:
|
case VIR_DOMAIN_DEVICE_NONE:
|
||||||
|
Loading…
Reference in New Issue
Block a user