[virt-tools-list] PATCH add volume key to names of iSCSI volumes in storage view
Jefferson Ogata - NOAA Federal
jefferson.ogata at noaa.gov
Wed Dec 4 01:20:17 UTC 2013
Dealing with iSCSI pools in terms of "unit:0:0:1"-type volume names is
fraught with the threat of catastrophic error if a LUN is attached to
the wrong VM. But there aren't many ways to communicate more info about
an underlying iSCSI volume to virt-manager's storage browser.
One way that does exist, however, is the volume key, which is, it seems,
equivalent to "1" followed by the SCSI ID set on the iSCSI target--the
same value found under /dev/disk/by-id/ with a "scsi_" prefix. Since i
explicitly set the SCSI ID to a useful value in my tgt configuration, i
thought it would be useful to present it in the virt-manager storage
view using this vector.
So here's a small patch against the virt-manager-0.9.0-19.el6 SRPM for
CentOS 6.5 that does it. Instead of displaying simply "unit:0:0:1", it
instead displays something like "unit:0:0:1 (1vg1_foo.vda)" where, for
example, i have tgtd configured to set the SCSI ID for the given volume
to "vg1/foo.vda", i.e. the LVM path of the backing store for the given LUN.
Makes it a helluva lot easier to pick the right LUN, for me, anyway.
I hope attachments are okay. Not sure tbird won't muck with it if i
include it inline.
Thoughts?
--
Jefferson Ogata <Jefferson.Ogata at noaa.gov>
National Oceanographic Data Center
You can't step into the same river twice. -- Herakleitos
-------------- next part --------------
--- a/src/virtManager/storagevol.py.nodc 2011-07-22 22:59:14.000000000 +0000
+++ b/src/virtManager/storagevol.py 2013-12-04 00:29:52.000000000 +0000
@@ -37,6 +37,9 @@
def get_path(self):
return self.vol.path()
+ def get_key(self):
+ return self.vol.key()
+
def get_pool(self):
pobj = self.vol.storagePoolLookupByVolume()
return self.conn.get_pool_by_name(pobj.name())
--- a/src/virtManager/storagebrowse.py.nodc 2013-12-04 00:16:32.000000000 +0000
+++ b/src/virtManager/storagebrowse.py 2013-12-04 00:42:11.000000000 +0000
@@ -315,11 +315,17 @@
pool = self.current_pool()
if not pool:
return
+ pool_type = pool.get_type()
vols = pool.get_volumes()
for key in vols.keys():
vol = vols[key]
sensitive = True
+ name = vol.get_name()
+ if pool_type == "iscsi":
+ vol_key = vol.get_key()
+ if vol_key:
+ name += " (%s)" % vol_key
path = vol.get_target_path()
fmt = vol.get_format() or ""
namestr = None
@@ -341,7 +347,7 @@
if fmt == "vmdk":
sensitive = False
- model.append([key, vol.get_name(), vol.get_pretty_capacity(),
+ model.append([key, name, vol.get_pretty_capacity(),
fmt, namestr, sensitive])
def show_err(self, info, details=None):
--- a/src/virtManager/host.py.nodc 2013-12-04 00:16:32.000000000 +0000
+++ b/src/virtManager/host.py 2013-12-04 00:39:35.000000000 +0000
@@ -870,12 +870,18 @@
def populate_storage_volumes(self):
pool = self.current_pool()
+ pool_type = pool.get_type()
model = self.widget("vol-list").get_model()
model.clear()
vols = pool.get_volumes()
for key in vols.keys():
vol = vols[key]
+ name = vol.get_name()
+ if pool_type == "iscsi":
+ vol_key = vol.get_key()
+ if vol_key:
+ name += " (%s)" % vol_key
path = vol.get_target_path()
namestr = None
try:
@@ -887,7 +893,7 @@
except:
logging.exception("Failed to determine if storage volume in "
"use.")
- model.append([key, vol.get_name(), vol.get_pretty_capacity(),
+ model.append([key, name, vol.get_pretty_capacity(),
vol.get_format() or "", namestr])
More information about the virt-tools-list
mailing list