Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 8d289cb

Browse files
committed
Add some documentation for storage pool parameters.
1 parent f557878 commit 8d289cb

1 file changed

Lines changed: 41 additions & 14 deletions

File tree

virtinst/Storage.py

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ def set_name(self, val):
130130
# Check that name doesn't collide with other storage objects
131131
self._check_name_collision(val)
132132
self._name = val
133-
name = property(get_name, set_name, doc="""
134-
Name of the storage object
135-
""")
133+
name = property(get_name, set_name, doc=_("Name for the storage object."))
136134

137135
# Get/Set methods for use by some objects. Will register where applicable
138136
def get_perms(self):
@@ -183,7 +181,8 @@ def get_xml_config(self):
183181
if not hasattr(self, "type"):
184182
root_xml = "<%s>\n" % self.object_type
185183
else:
186-
root_xml = "<%s type='%s'>\n" % (self.object_type, self.type)
184+
_type = getattr(self, "type")
185+
root_xml = "<%s type='%s'>\n" % (self.object_type, _type)
187186

188187
xml = "%s" % (root_xml) + \
189188
""" <name>%s</name>\n""" % (self.name) + \
@@ -285,7 +284,6 @@ def get_target_path(self):
285284
def set_target_path(self, val):
286285
self._validate_path(val)
287286
self._target_path = val
288-
target_path = property(get_target_path, set_target_path)
289287

290288
# Get/Set methods for use by some pools. Will be registered when applicable
291289
def get_source_path(self):
@@ -399,6 +397,9 @@ def get_volume_class():
399397

400398
# Register applicable property methods from parent class
401399
perms = property(StorageObject.get_perms, StorageObject.set_perms)
400+
target_path = property(StoragePool.get_target_path,
401+
StoragePool.set_target_path,
402+
doc=_("Directory to use for the storage pool."))
402403

403404
def __init__(self, conn, name, target_path=None, uuid=None, perms=None):
404405
StoragePool.__init__(self, name=name, type=StoragePool.TYPE_DIR,
@@ -433,7 +434,11 @@ def get_volume_class():
433434
# Register applicable property methods from parent class
434435
perms = property(StorageObject.get_perms, StorageObject.set_perms)
435436
source_path = property(StoragePool.get_source_path,
436-
StoragePool.set_source_path)
437+
StoragePool.set_source_path,
438+
doc=_("The existing device to mount for the pool."))
439+
target_path = property(StoragePool.get_target_path,
440+
StoragePool.set_target_path,
441+
doc=_("Location to mount the source device."))
437442

438443
def __init__(self, conn, name, source_path=None, target_path=None,
439444
format="auto", uuid=None, perms=None):
@@ -453,7 +458,8 @@ def set_format(self, val):
453458
if not val in self.formats:
454459
raise ValueError(_("Unknown Filesystem format: %s" % val))
455460
self._format = val
456-
format = property(get_format, set_format)
461+
format = property(get_format, set_format,
462+
doc=_("Filesystem type of the source device."))
457463

458464
def _get_default_target_path(self):
459465
path = (DEFAULT_DIR_TARGET_BASE + self.name)
@@ -484,8 +490,13 @@ def get_volume_class():
484490

485491
# Register applicable property methods from parent class
486492
source_path = property(StoragePool.get_source_path,
487-
StoragePool.set_source_path)
488-
host = property(StoragePool.get_host, StoragePool.set_host)
493+
StoragePool.set_source_path,
494+
doc=_("Path on the host that is being shared."))
495+
host = property(StoragePool.get_host, StoragePool.set_host,
496+
doc=_("Name of the host sharing the storage."))
497+
target_path = property(StoragePool.get_target_path,
498+
StoragePool.set_target_path,
499+
doc=_("Location to mount the source device."))
489500

490501
def __init__(self, conn, name, source_path=None, host=None,
491502
target_path=None, format="auto", uuid=None):
@@ -505,7 +516,8 @@ def set_format(self, val):
505516
if not val in self.formats:
506517
raise ValueError(_("Unknown Network Filesystem format: %s" % val))
507518
self._format = val
508-
format = property(get_format, set_format)
519+
format = property(get_format, set_format,
520+
doc=_("Type of network filesystem."))
509521

510522
def _get_default_target_path(self):
511523
path = (DEFAULT_DIR_TARGET_BASE + self.name)
@@ -535,6 +547,9 @@ def get_volume_class():
535547

536548
# Register applicable property methods from parent class
537549
perms = property(StorageObject.get_perms, StorageObject.set_perms)
550+
target_path = property(StoragePool.get_target_path,
551+
StoragePool.set_target_path,
552+
doc=_("Location of the existing LVM volume group."))
538553

539554
def __init__(self, conn, name, target_path=None, uuid=None, perms=None):
540555
StoragePool.__init__(self, name=name, type=StoragePool.TYPE_LOGICAL,
@@ -560,7 +575,12 @@ class DiskPool(StoragePool):
560575

561576
# Register applicable property methods from parent class
562577
source_path = property(StoragePool.get_source_path,
563-
StoragePool.set_source_path)
578+
StoragePool.set_source_path,
579+
doc=_("Path to the existing disk device."))
580+
target_path = property(StoragePool.get_target_path,
581+
StoragePool.set_target_path,
582+
doc=_("Root location for identifying new storage"
583+
" volumes."))
564584

565585
formats = [ "auto", "bsd", "dos", "dvh", "gpt", "mac", "pc98", "sun" ]
566586

@@ -582,7 +602,8 @@ def set_format(self, val):
582602
if not val in self.formats:
583603
raise ValueError(_("Unknown Disk format: %s" % val))
584604
self._format = val
585-
format = property(get_format, set_format)
605+
format = property(get_format, set_format,
606+
doc=_("Format of the source device's partition table."))
586607

587608
def _get_default_target_path(self):
588609
return DEFAULT_DEV_TARGET
@@ -615,7 +636,12 @@ class iSCSIPool(StoragePool):
615636
Create an iSCSI based storage pool
616637
"""
617638

618-
host = property(StoragePool.get_host, StoragePool.set_host)
639+
host = property(StoragePool.get_host, StoragePool.set_host,
640+
doc=_("Name of the host sharing the storage."))
641+
target_path = property(StoragePool.get_target_path,
642+
StoragePool.set_target_path,
643+
doc=_("Root location for identifying new storage"
644+
" volumes."))
619645

620646
def get_volume_class():
621647
raise NotImplementedError(_("iSCSI volume creation is not "
@@ -638,7 +664,8 @@ def get_source_path(self):
638664
return self._source_path
639665
def set_source_path(self, val):
640666
self._source_path = val
641-
source_path = property(get_source_path, set_source_path)
667+
source_path = property(get_source_path, set_source_path,
668+
doc=_("Path on the host that is being shared."))
642669

643670
def _get_default_target_path(self):
644671
return DEFAULT_ISCSI_TARGET

0 commit comments

Comments
 (0)