[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/4] Add a new action UPDATE_DEVICE



---
 src/qemu/qemu_driver.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f33882a..98595d1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4237,11 +4237,26 @@ static int qemuDomainDetachDevicePersistent(virDomainDefPtr vmdef,
     return 0;
 }
 
+static int qemuDomainUpdateDevicePersistent(virDomainDefPtr vmdef,
+                                            virDomainDeviceDefPtr device)
+{
+    switch(device->type) {
+    default:
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Sorry, updating device persistently "
+                          "is not supported for now"));
+        return -1;
+    }
+    return 0;
+}
+
 /* XXX: better names are requested */
 #define ATTACH_DEVICE 0        /* Attach device persistently, device must not
                                 * exist before attach. */
 #define DETACH_DEVICE 1        /* Detach device persistently, device must exist
                                 * before detach. */
+#define UPDATE_DEVICE 2        /* Update device persistently, device must exist
+                                * before update. */
 
 static int qemuDomainModifyDevicePersistent(virDomainPtr dom,
                                         const char *xml,
@@ -4305,6 +4320,8 @@ static int qemuDomainModifyDevicePersistent(virDomainPtr dom,
         ret = qemuDomainAttachDevicePersistent(vmdef, device);
     else if (action == DETACH_DEVICE)
         ret = qemuDomainDetachDevicePersistent(vmdef, device);
+    else if (action == UPDATE_DEVICE)
+        ret = qemuDomainUpdateDevicePersistent(vmdef, device);
     else {
         qemuReportError(VIR_ERR_INVALID_ARG, "%s %d",
                         _("Unknown action"), action);
-- 
1.7.3.1


-- 
Thanks,
Hu Tao


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]