Am Mittwoch 18 Mai 2011 10:06:38 schrieb Markus Groß:
Based on the device attach/detach code from the QEMU driver.
---
src/libxl/libxl_driver.c | 519 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 519 insertions(+), 0 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index a14ace1..a056be9 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
+
+ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
+ /* If dev exists it was created to modify the domain config. Free it, */
s/,/./
+ virDomainDeviceDefFree(dev);
+ if (!(dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
+ VIR_DOMAIN_XML_INACTIVE)))
+ goto cleanup;
+
+ switch (action) {
+ case LIBXL_DEVICE_ATTACH:
+ ret = libxlDomainAttachDeviceLive(priv, vm, dev);
+ break;
+ case LIBXL_DEVICE_DETACH:
+ ret = libxlDomainDetachDeviceLive(priv, vm, dev);
+ break;
+ case LIBXL_DEVICE_UPDATE:
+ ret = libxlDomainUpdateDeviceLive(priv, vm, dev);
+ default:
+ libxlError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown domain modify action %d"), action);
+ break;
+ }