本文整理汇总了Python中ci.tests.general.general.General.check_file_is_link方法的典型用法代码示例。如果您正苦于以下问题:Python General.check_file_is_link方法的具体用法?Python General.check_file_is_link怎么用?Python General.check_file_is_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ci.tests.general.general.General
的用法示例。
在下文中一共展示了General.check_file_is_link方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_to_volume
# 需要导入模块: from ci.tests.general.general import General [as 别名]
# 或者: from ci.tests.general.general.General import check_file_is_link [as 别名]
def write_to_volume(vdisk=None, vpool=None, location=None, count=1024, bs='1M', input_type='random',
root_client=None):
"""
Write some data to a file
:param vdisk: Virtual disk to write on
:param vpool: vPool which hosts the Virtual Disk
:param location: Absolute path to file
:param count: amount of blocks to write
:param bs: Size of the blocks to write
:param input_type: Type of input (null, zero, random)
:param root_client: SSHClient object
:return: None
"""
if location is None and (vdisk is None or vpool is None):
raise ValueError('vDisk and vPool must be provided if no location has been provided')
if location is None:
location = GeneralVDisk.get_filesystem_location(vpool=vpool,
vdisk_name=vdisk.name)
if root_client is None:
root_client = SSHClient('127.0.0.1', username='root')
if input_type not in ('null', 'zero', 'random'):
raise ValueError('Invalid input type provided')
if General.check_file_is_link(location, root_client.ip, root_client.username, root_client.password):
print "Writing to {0}".format(root_client.file_read_link(location))
else:
if not root_client.file_exists(location):
raise ValueError('File {0} does not exist on Storage Router {1}'.format(location, root_client.ip))
if not isinstance(count, int) or count < 1:
raise ValueError('Count must be an integer > 0')
root_client.run('dd conv=notrunc if=/dev/{0} of={1} bs={2} count={3}'.format(input_type, location, bs, count))