[virt-manager] [PATCH 2/5] create: Auto-generate fs path if not provided

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

 



Use default place to store file systems of bootstraped containers.

If the current user has effective UID 0 use:
    /var/lib/libvirt/filesystems/<container-name>

otherwise use:
    ~/.local/share/libvirt/filesystems/<container-name>
---
 virtManager/create.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/virtManager/create.py b/virtManager/create.py
index b3f02b7..cec44a6 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -1653,6 +1653,17 @@ class vmmCreate(vmmGObjectUI):
         enable_src = self.widget("install-oscontainer-bootstrap").get_active()
         self.widget("install-oscontainer-source").set_sensitive(enable_src)
 
+        # Auto-generate a path if not specified
+        if enable_src and not self.widget("install-oscontainer-fs").get_text():
+            if os.geteuid() == 0:
+                fs_dir = ['/var/lib/libvirt/filesystems/']
+            else:
+                fs_dir = [os.environ['HOME'],
+                          '.local/share/libvirt/filesystems/']
+
+            fs = fs_dir + [self._generate_default_name(None, None)]
+            self.widget("install-oscontainer-fs").set_text(os.path.join(*fs))
+
 
     ########################
     # Misc helper routines #
-- 
2.9.4

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux