[virt-tools-list] [virt-manager PATCH 1/2] domain: add define method for idmap

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Fri Feb 21 10:13:10 UTC 2014


add define_idmap and get_idmap method.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 virtManager/domain.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index 8d0c95f..45ab6ee 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -573,6 +573,24 @@ class vmmDomain(vmmLibvirtObject):
             guest.title = newvalue or None
         return self._redefine(change)
 
+    # Idmap config define methods
+    def define_idmap(self, idmap_list):
+        def change(guest):
+            guest.idmap.uid_start = uid_start
+            guest.idmap.uid_target = uid_target
+            guest.idmap.uid_count = uid_count
+            guest.idmap.gid_start = gid_start
+            guest.idmap.gid_target = gid_target
+            guest.idmap.gid_count = gid_count
+        def clear(guest):
+            guest.idmap.clear()
+        if idmap_list is not None:
+            (uid_start, uid_target, uid_count, gid_start,
+                    gid_target, gid_count) = idmap_list
+            return self._redefine(change)
+        else:
+            return self._redefine(clear)
+
     # Boot define methods
     def can_use_device_boot_order(self):
         # Return 'True' if guest can use new style boot device ordering
@@ -1058,6 +1076,8 @@ class vmmDomain(vmmLibvirtObject):
         return self.get_xmlobj().emulator
     def get_machtype(self):
         return self.get_xmlobj().os.machine
+    def get_idmap(self):
+        return self.get_xmlobj().idmap
 
     def get_name_or_title(self):
         title = self.get_title()
-- 
1.8.5.3




More information about the virt-tools-list mailing list