[libvirt-sandbox][PATCH] Add missing get_unit_path function into class Container

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

 



RHBZ:https://bugzilla.redhat.com/show_bug.cgi?id=966307

Signed-off-by: Alex Jia <ajia@xxxxxxxxxx>
---
With the patch, we can successfully clone an existing Secure container,
but I met a Warning, I think it may be a LibvirtGObject question,

# virt-sandbox-service clone http1 clonebox
Created sandbox container dir /var/lib/libvirt/filesystems/clonebox
Created unit file /etc/libvirt-sandbox/services/clonebox.sandbox
/usr/lib64/python2.7/site-packages/gi/types.py:47: Warning: g_key_file_set_string: assertion `string != NULL' failed
  return info.invoke(*args, **kwargs)
Created sandbox config /etc/libvirt-sandbox/services/clonebox.sandbox

 bin/virt-sandbox-service |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 4496b29..2595ea2 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -60,6 +60,7 @@ class Container:
     DEFAULT_PATH       = "/var/lib/libvirt/filesystems"
     DEFAULT_IMAGE      = "/var/lib/libvirt/images/%s.raw"
     SELINUX_FILE_TYPE  = "svirt_lxc_file_t"
+    DEFAULT_UNIT       = "/etc/systemd/system/%s_sandbox.service"
 
     def __init__(self, name=None, uri = "lxc:///", path = DEFAULT_PATH, config=None, create=False):
         self.uri = uri
@@ -132,6 +133,11 @@ class Container:
             name = self.get_name()
         return self.DEFAULT_IMAGE % name
 
+    def get_unit_path(self, name = None):
+        if not name:
+            name = self.get_name()
+        return self.DEFAULT_UNIT % name
+
     def set_image(self, size):
         self.use_image = True
         self.size = size * MB
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]