}
+static void
+qemuBuildDeviceCommandlineHandleOverrides(virJSONValue *props,
+ qemuDomainXmlNsDef *nsdef)
+{
+ const char *alias = virJSONValueObjectGetString(props, "id");
+ size_t i;
+
+ for (i = 0; i < nsdef->ndeviceOverride; i++) {
+ qemuDomainXmlNsDeviceOverride *dev = nsdef->deviceOverride + i;
+ size_t j;
+
+ if (STRNEQ(alias, dev->alias))
+ continue;
+
+ for (j = 0; j < dev->nfrontend; j++) {
+ qemuDomainXmlNsOverrideProperty *prop = dev->frontend + j;
+
+ virJSONValueObjectRemoveKey(props, prop->name, NULL);
+ if (prop->json) {
+ g_autoptr(virJSONValue) copy = virJSONValueCopy(prop->json);
+
+ virJSONValueObjectAppend(props, prop->name, ©);
+ }
+ }
+ }
+}
+
+
static int
qemuBuildDeviceCommandlineFromJSON(virCommand *cmd,
virJSONValue *props,
- const virDomainDef *def G_GNUC_UNUSED,
+ const virDomainDef *def,
virQEMUCaps *qemuCaps)
{
+ qemuDomainXmlNsDef *nsdef = def->namespaceData;
g_autofree char *arg = NULL;
+ if (nsdef && nsdef->ndeviceOverride > 0)
+ qemuBuildDeviceCommandlineHandleOverrides(props, nsdef);
+
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_JSON)) {
if (!(arg = virJSONValueToString(props, false)))
return -1;
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
--device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ua-disk,bootindex=1 \
+-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ua-disk,bootindex=1,prop1=propval1,prop2=-321,prop3=123,prop4=on,prop5=off \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
-unknown parameter \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
--device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ua-disk","bootindex":1}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ua-disk","bootindex":1,"prop1":"propval1","prop2":-321,"prop3":123,"prop4":true,"prop5":false}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
-unknown parameter \