[libvirt] [PATCH v2 1/6] test_driver: implement virDomainAttachDeviceFlags
Erik Skultety
eskultet at redhat.com
Fri Aug 16 14:39:31 UTC 2019
...
> +
> + if (operation == TEST_DEVICE_DETACH)
> + parse_flags |= VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;
^This should be added by patch 3/5
> +
> + if (xml) {
> + if (!(dev = virDomainDeviceDefParse(xml, def,
> + driver->caps, driver->xmlopt,
> + NULL, parse_flags)))
> + goto cleanup;
> + } else if (alias) {
> + if (VIR_ALLOC(dev) < 0 || virDomainDefFindDevice(def, alias, dev, true) < 0)
> + goto cleanup;
> + }
> +
> + switch (operation) {
> + case TEST_DEVICE_ATTACH:
> + if (testDomainAttachDeviceLiveAndConfig(def, dev) < 0)
> + goto cleanup;
> + break;
> + case TEST_DEVICE_DETACH:
> + break;
> + case TEST_DEVICE_UPDATE:
> + break;
> + }
> +
> + ret = 0;
> + cleanup:
> + if (xml)
> + virDomainDeviceDefFree(dev);
> + else
> + VIR_FREE(dev);
virDomainDeviceDefFree() can handle both cases.
Reviewed-by: Erik Skultety <eskultet at redhat.com>
More information about the libvir-list
mailing list