本文整理匯總了Python中virtinst.StoragePool.get_pool_type_desc方法的典型用法代碼示例。如果您正苦於以下問題:Python StoragePool.get_pool_type_desc方法的具體用法?Python StoragePool.get_pool_type_desc怎麽用?Python StoragePool.get_pool_type_desc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類virtinst.StoragePool
的用法示例。
在下文中一共展示了StoragePool.get_pool_type_desc方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _populate_pools
# 需要導入模塊: from virtinst import StoragePool [as 別名]
# 或者: from virtinst.StoragePool import get_pool_type_desc [as 別名]
def _populate_pools(self):
pool_list = self.widget("pool-list")
curpool = self._current_pool()
model = pool_list.get_model()
# Prevent events while the model is modified
pool_list.set_model(None)
try:
pool_list.get_selection().unselect_all()
model.clear()
for pool in self.conn.list_pools():
pool.disconnect_by_obj(self)
pool.connect("state-changed", self._pool_changed_cb)
pool.connect("refreshed", self._pool_changed_cb)
name = pool.get_name()
typ = StoragePool.get_pool_type_desc(pool.get_type())
label = "%s\n<span size='small'>%s</span>" % (name, typ)
row = [None] * POOL_NUM_COLUMNS
row[POOL_COLUMN_CONNKEY] = pool.get_connkey()
row[POOL_COLUMN_LABEL] = label
row[POOL_COLUMN_ISACTIVE] = pool.is_active()
row[POOL_COLUMN_PERCENT] = _get_pool_size_percent(pool)
model.append(row)
finally:
pool_list.set_model(model)
uiutil.set_list_selection(pool_list,
curpool and curpool.get_connkey() or None)
示例2: populate_pool_type
# 需要導入模塊: from virtinst import StoragePool [as 別名]
# 或者: from virtinst.StoragePool import get_pool_type_desc [as 別名]
def populate_pool_type(self):
model = self.widget("pool-type").get_model()
model.clear()
types = StoragePool.get_pool_types()
types.sort()
for typ in types:
model.append([typ, "%s: %s" %
(typ, StoragePool.get_pool_type_desc(typ))])
示例3: populate_storage_pools
# 需要導入模塊: from virtinst import StoragePool [as 別名]
# 或者: from virtinst.StoragePool import get_pool_type_desc [as 別名]
def populate_storage_pools(pool_list, conn, curpool):
model = pool_list.get_model()
# Prevent events while the model is modified
pool_list.set_model(None)
model.clear()
for uuid in conn.list_pool_uuids():
per = get_pool_size_percent(conn, uuid)
pool = conn.get_pool(uuid)
name = pool.get_name()
typ = StoragePool.get_pool_type_desc(pool.get_type())
label = "%s\n<span size='small'>%s</span>" % (name, typ)
model.append([uuid, label, pool.is_active(), per])
pool_list.set_model(model)
uiutil.set_row_selection(pool_list,
curpool and curpool.get_uuid() or None)
示例4: populate_pool_state
# 需要導入模塊: from virtinst import StoragePool [as 別名]
# 或者: from virtinst.StoragePool import get_pool_type_desc [as 別名]
def populate_pool_state(self, uuid):
pool = self.conn.get_pool(uuid)
pool.tick()
auto = pool.get_autostart()
active = pool.is_active()
# Set pool details state
self.widget("pool-details").set_sensitive(True)
self.widget("pool-name").set_markup("<b>%s:</b>" %
pool.get_name())
self.widget("pool-name-entry").set_text(pool.get_name())
self.widget("pool-name-entry").set_editable(not active)
self.widget("pool-sizes").set_markup(
"""<span size="large">%s Free</span> / <i>%s In Use</i>""" %
(pool.get_pretty_available(), pool.get_pretty_allocation()))
self.widget("pool-type").set_text(
StoragePool.get_pool_type_desc(pool.get_type()))
self.widget("pool-location").set_text(
pool.get_target_path())
self.widget("pool-state-icon").set_from_icon_name(
((active and self.ICON_RUNNING) or self.ICON_SHUTOFF),
Gtk.IconSize.BUTTON)
self.widget("pool-state").set_text(
(active and _("Active")) or _("Inactive"))
self.widget("pool-autostart").set_label(
(auto and _("On Boot")) or _("Never"))
self.widget("pool-autostart").set_active(auto)
self.widget("vol-list").set_sensitive(active)
self.repopulate_storage_volumes()
self.widget("pool-delete").set_sensitive(not active)
self.widget("pool-stop").set_sensitive(active)
self.widget("pool-start").set_sensitive(not active)
self.widget("vol-add").set_sensitive(active)
self.widget("vol-add").set_tooltip_text(_("Create new volume"))
self.widget("vol-delete").set_sensitive(False)
if active and not pool.supports_volume_creation():
self.widget("vol-add").set_sensitive(False)
self.widget("vol-add").set_tooltip_text(
_("Pool does not support volume creation"))