本文整理汇总了Python中stack.Stack.register_layer方法的典型用法代码示例。如果您正苦于以下问题:Python Stack.register_layer方法的具体用法?Python Stack.register_layer怎么用?Python Stack.register_layer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stack.Stack
的用法示例。
在下文中一共展示了Stack.register_layer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: safe_teardown
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import register_layer [as 别名]
# sanity check: ensure device is now mounted
if not self.is_mounted:
self.error("Device is not mounted")
self.infomsg("Device successfully mounted\n")
def safe_teardown(self):
self.infomsg("Unmounting directory %s" % self.parent_device)
# sanity check: if mount point not mounted upon, nothing to do
if not self.is_mounted_by_something:
self.infomsg("Mount point not mounted upon; nothing to do\n")
return
self.debugmsg(" Sanity check passed: mount point is mounted upon")
# do the umount
self.do_umount()
self.infomsg(" Ran 'umount' command")
# remove the mount directory
self.remove_mount_point()
# sanity check: ensure device is now unmounted
if self.is_mounted_by_something:
self.error("Device is still mounted; umount failed")
self.infomsg("Device successfully unmounted\n")
# Register this layer
Stack.register_layer(MountPartition)
示例2: vdi_name_label
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import register_layer [as 别名]
#session.xenapi.login_with_password(self.username, self.password)
@property
def vdi_name_label(self):
return self.arg_str
@property
def vdi_record(self):
for (key, val) in self.session.xenapi.VDI.get_all_records().items():
if val['name_label'] == self.vdi_name_label:
return val
return None
@property
def sr_record(self):
try:
sr = self.session.xenapi.SR.get_record(self.vdi_record['SR'])
except Exception, e:
self.error("Unable to get SR: %s" % e)
return sr
@property
def orig_device(self):
return '/dev/VG_XenStorage-%s/VHD-%s' % ( self.sr_record['uuid'],
self.vdi_record['uuid'] )
# Register this layer
if have_xenserver:
Stack.register_layer(XenVDISnapLayer)
示例3: is_snapshot
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import register_layer [as 别名]
(res,stdout,stderr) = self.run_cmd(cmd)
return res
@property
def is_snapshot(self):
cmd = ['lvs', '--noheadings', '-o', 'lv_attr', self.device]
(res,stdout,stderr) = self.run_cmd(cmd)
return stdout.lstrip().rstrip().lower()[0] == 's'
@property
def matches_target(self):
cmd = ['lvs', '--noheadings', '-o', 'origin', self.device]
(res,stdout,stderr) = self.run_cmd(cmd)
return stdout.lstrip().rstrip() == self.lv_name
def create_snapshot(self):
cmd = [self.lvcreate, '-s', '-n', self.device,
'-L', self.size, self.orig_device]
(res,stdout,stderr) = self.run_cmd(cmd)
self.infomsg(" Ran 'lvcreate' command")
def remove_snapshot(self):
# delete the snapshot
cmd = [self.lvremove, '-f', self.device]
(res,stdout,stderr) = self.run_cmd(cmd)
self.infomsg(" Ran 'lvremove' command")
Stack.register_layer(LV)
示例4: create_snapshot
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import register_layer [as 别名]
self.debugmsg(' waiting for %s; currently %s @ %s' %
(('detach','attach')[detach],
('detached','attached')[self.device_exists],
self.timestr))
time.sleep(1)
self.error("Failed to attach/detach disk device '%s' "
"within %d seconds" %
(self.device, self.params.libvirt_attach_timeout))
def create_snapshot(self):
self.libvirt_storage_volume_attach()
# Wait a bit for volume to be attached
self.wait_attach()
def remove_snapshot(self):
self.libvirt_storage_volume_detach()
# Wait a bit for volume to be detached
self.wait_attach(detach=True)
def freshen(self):
'''
Be sure the storage pool is updated whenever setting
up/tearing down
'''
self.libvirt_storage_pool_refresh()
# Register this layer
if have_libvirt:
Stack.register_layer(LibvirtVolLayer)