本文整理汇总了Python中mcvirt.system.System.perform_dd方法的典型用法代码示例。如果您正苦于以下问题:Python System.perform_dd方法的具体用法?Python System.perform_dd怎么用?Python System.perform_dd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mcvirt.system.System
的用法示例。
在下文中一共展示了System.perform_dd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wipe
# 需要导入模块: from mcvirt.system import System [as 别名]
# 或者: from mcvirt.system.System import perform_dd [as 别名]
def wipe(self, _f=None):
"""Wipe the volume"""
self._get_registered_object('auth').assert_user_type('ClusterUser',
allow_indirect=True)
System.perform_dd(source=System.WIPE,
destination=self.get_path(),
size=self.get_size())
示例2: create
# 需要导入模块: from mcvirt.system import System [as 别名]
# 或者: from mcvirt.system.System import perform_dd [as 别名]
def create(self, size, _f=None):
"""Create volume in storage backend"""
self._get_registered_object('auth').assert_permission(PERMISSIONS.MANAGE_STORAGE_VOLUME)
# Ensure volume does not already exist
if self.check_exists():
raise VolumeAlreadyExistsError('Volume (%s) already exists' % self.name)
try:
# Create on local node
System.perform_dd(source=System.WIPE, destination=self.get_path(),
size=size)
except DDCommandError, exc:
raise ExternalStorageCommandErrorException(
"Error whilst creating disk logical volume:\n" + str(exc)
)
示例3: duplicate
# 需要导入模块: from mcvirt.system import System [as 别名]
# 或者: from mcvirt.system.System import perform_dd [as 别名]
def duplicate(self, destination_vm_object, storage_backend=None):
"""Clone the hard drive and attach it to the new VM object"""
self.ensure_exists()
if not storage_backend:
storage_backend = self.storage_backend
# Create new disk object, using the same type, size and disk_id
new_hdd = self._get_registered_object('hard_drive_factory').create(
size=self.get_size(), storage_type=self.get_type(),
driver=self.driver, storage_backend=storage_backend)
# Get path of source and new disks
source_block_device = self._getDiskPath()
destination_block_device = new_hdd.getDiskPath()
# Use dd to duplicate the old disk to the new disk
System.perform_dd(source=source_block_device,
destination=destination_block_device,
size=self.get_size())
return new_hdd