virt-manager/virtman-storage-pool.diff

52 lines
2.2 KiB
Diff
Raw Normal View History

When connecting to a xen host, create default dir storage pool
in /var/lib/xen/images instead of /var/lib/libvirt/images.
Index: virt-manager-0.8.5/src/virtManager/connection.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/connection.py
+++ virt-manager-0.8.5/src/virtManager/connection.py
@@ -1144,7 +1144,8 @@ class vmmConnection(gobject.GObject):
else:
# Try to create the default storage pool
try:
- util.build_default_pool(self.vmm)
+ util.build_default_pool(self.vmm, \
+ self.config.get_default_image_dir(self))
except Exception, e:
logging.debug("Building default pool failed: %s" % str(e))
Index: virt-manager-0.8.5/src/virtManager/util.py
===================================================================
--- virt-manager-0.8.5.orig/src/virtManager/util.py
+++ virt-manager-0.8.5/src/virtManager/util.py
@@ -31,9 +31,8 @@ import virtManager
import virtinst
DEFAULT_POOL_NAME = "default"
-DEFAULT_POOL_PATH = "/var/lib/libvirt/images"
-def build_default_pool(conn):
+def build_default_pool(conn, path):
"""
Helper to build the 'default' storage pool
"""
@@ -54,15 +53,15 @@ def build_default_pool(conn):
try:
logging.debug("Attempting to build default pool with target '%s'" %
- DEFAULT_POOL_PATH)
+ path)
defpool = virtinst.Storage.DirectoryPool(conn=conn,
name=DEFAULT_POOL_NAME,
- target_path=DEFAULT_POOL_PATH)
+ target_path=path)
newpool = defpool.install(build=True, create=True)
newpool.setAutostart(True)
except Exception, e:
raise RuntimeError(_("Couldn't create default storage pool '%s': %s") %
- (DEFAULT_POOL_PATH, str(e)))
+ (path, str(e)))
def get_ideal_path_info(conn, config, name):
path = get_default_dir(conn, config)