[PATCH 02/13] ch: add DomainDetachDevice skeletons

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

 



On-behalf-of: SAP stefan.kober@xxxxxxx
Signed-off-by: Stefan Kober <stefan.kober@xxxxxxxxxxxxxxxxxxxxx>
---
 src/ch/ch_driver.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 30cfb22649..c64b2ba511 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -2379,6 +2379,40 @@ chDomainAttachDevice(virDomainPtr dom,
     return chDomainAttachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE);
 }
 
+static int
+chDomainDetachDeviceFlags(virDomainPtr dom,
+                          const char */*xml*/,
+                          unsigned int flags)
+{
+    virDomainObj *vm = NULL;
+    int ret = -1;
+
+    if (!(vm = virCHDomainObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainDetachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
+        goto cleanup;
+
+    if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
+        goto cleanup;
+
+    if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
+        goto endjob;
+
+ endjob:
+    virDomainObjEndJob(vm);
+
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+static int chDomainDetachDevice(virDomainPtr dom, const char *xml)
+{
+    return chDomainDetachDeviceFlags(dom, xml,
+                                     VIR_DOMAIN_AFFECT_LIVE);
+}
+
 /* Function Tables */
 static virHypervisorDriver chHypervisorDriver = {
     .name = "CH",
@@ -2442,7 +2476,8 @@ static virHypervisorDriver chHypervisorDriver = {
     .domainInterfaceAddresses = chDomainInterfaceAddresses, /* 11.0.0 */
     .domainAttachDevice = chDomainAttachDevice, /* 11.7.0 */
     .domainAttachDeviceFlags = chDomainAttachDeviceFlags, /* 11.7.0 */
-
+    .domainDetachDevice = chDomainDetachDevice, /* 11.7.0 */
+    .domainDetachDeviceFlags = chDomainDetachDeviceFlags, /* 11.7.0 */
 };
 
 static virConnectDriver chConnectDriver = {
-- 
2.50.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux