本文整理汇总了Python中storops.lib.common.text_var函数的典型用法代码示例。如果您正苦于以下问题:Python text_var函数的具体用法?Python text_var怎么用?Python text_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了text_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mount
def mount(mover_name, name, rw='rw', path=None):
if path is None:
path = '/{}'.format(name)
cmd = text_var('/nas/bin/server_mount', mover_name)
cmd += text_var('rw', rw)
cmd += [name, path]
return cmd
示例2: add_mirror_view_image
def add_mirror_view_image(self, name, sp_ip, lun_id,
recovery_policy=VNXMirrorViewRecoveryPolicy.AUTO,
sync_rate=VNXMirrorViewSyncRate.HIGH):
cmd = 'mirror -sync -addimage'.split()
cmd += text_var('-name', name)
cmd += text_var('-arrayhost', sp_ip)
cmd += int_var('-lun', lun_id)
cmd += VNXMirrorViewRecoveryPolicy.get_opt(recovery_policy)
cmd += enum_var('-syncrate', sync_rate, VNXMirrorViewSyncRate)
return cmd
示例3: copy_snap
def copy_snap(self, src_name, tgt_name,
ignore_migration_check=False,
ignore_dedup_check=False):
cmd = ['snap', '-copy']
cmd += text_var('-id', src_name)
cmd += text_var('-name', tgt_name)
if ignore_migration_check:
cmd.append('-ignoreMigrationCheck')
if ignore_dedup_check:
cmd.append('-ignoreDeduplicationCheck')
return cmd
示例4: copy_ckpt
def copy_ckpt(snap_name, fs_name, connect_id, session_name=None):
if session_name is None:
session_name = '{}:{}'.format(fs_name, snap_name)
cmd = ['/nas/bin/nas_copy']
cmd += text_var('-name', session_name[0:63])
cmd.append('-source')
cmd += text_var('-ckpt', snap_name)
cmd.append('-destination')
cmd += text_var('-fs', fs_name)
cmd += text_var('-interconnect', 'id={}'.format(connect_id))
cmd += ['-overwrite_destination', '-full_copy']
return cmd
示例5: add_user
def add_user(self, name, password, scope=None, role=None):
if scope is None:
scope = VNXUserScopeEnum.GLOBAL
if role is None:
role = VNXUserRoleEnum.ADMIN
cmd = ['security', '-adduser']
cmd += text_var('-user', name)
cmd += text_var('-password', password)
cmd += enum_var('-scope', scope, VNXUserScopeEnum)
cmd += enum_var('-role', role, VNXUserRoleEnum)
cmd.append('-o')
return cmd
示例6: set_path
def set_path(self, sg_name, hba_uid, sp, port_id,
ip, host, vport_id=None):
cmd = ['storagegroup', '-setpath']
cmd += text_var('-gname', sg_name)
cmd += text_var('-hbauid', hba_uid)
cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
cmd += int_var('-spport', port_id)
cmd += int_var('-spvport', vport_id)
cmd += ['-ip', ip]
cmd += text_var('-host', host)
cmd.append('-o')
return cmd
示例7: modify_snap
def modify_snap(self, name, new_name=None, desc=None,
auto_delete=None, rw=None):
opt = []
if new_name is not None and name != new_name:
opt += text_var('-name', new_name)
opt += text_var('-descr', desc)
opt += yes_no_var('-allowAutoDelete', auto_delete)
opt += yes_no_var('-allowReadWrite', rw)
if len(opt) > 0:
cmd = ['snap', '-modify', '-id', name] + opt
else:
cmd = []
return cmd
示例8: create_snap
def create_snap(self, res_id, snap_name,
allow_rw=True, auto_delete=False):
cmd = ['snap', '-create']
try:
cmd += int_var('-res', res_id)
except ValueError:
# string type meaning cg name
cmd += text_var('-res', res_id)
cmd += ['-resType', 'CG']
cmd += text_var('-name', snap_name)
cmd += yes_no_var('-allowReadWrite', allow_rw)
cmd += yes_no_var('-allowAutoDelete', auto_delete)
return cmd
示例9: config_iscsi_ip
def config_iscsi_ip(self, sp, port_id, ip, netmask, gateway,
vport_id=None, vlan_id=None):
if vport_id is None:
vport_id = 0
cmd = ['connection', '-setport', '-iscsi']
cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
cmd += int_var('-portid', port_id)
cmd += int_var('-vportid', vport_id)
cmd += int_var('-vlanid', vlan_id)
cmd += text_var('-address', ip)
cmd += text_var('-subnetmask', netmask)
cmd += text_var('-gateway', gateway)
cmd.append('-o')
return cmd
示例10: ping_node
def ping_node(self, address, sp, port_id, vport_id=None, packet_size=None,
count=None, timeout=None, delay=None):
if vport_id is None:
vport_id = 0
cmd = ['connection', '-pingnode']
sp = VNXSPEnum.get_sp_index(sp)
cmd += text_var('-sp', sp)
cmd += int_var('-portid', port_id)
cmd += int_var('-vportid', vport_id)
cmd += text_var('-address', address)
cmd += int_var('-packetSize', packet_size)
cmd += int_var('-count', count)
cmd += int_var('-timeout', timeout)
cmd += int_var('-delay', delay)
return cmd
示例11: modify_storage_pool
def modify_storage_pool(self, name=None, pool_id=None,
new_name=None):
cmd = ['storagepool', '-modify']
cmd += self._get_id_name_opt(pool_id, name)
cmd += text_var('-newName', new_name)
cmd.append('-o')
return cmd
示例12: create_pool
def create_pool(self, name, disks, raid_type=None):
cmd = ['storagepool', '-create', '-disks']
cmd += disks
cmd += enum_var('-rtype', raid_type, VNXPoolRaidType)
cmd += text_var('-name', name)
cmd.append('-skiprules')
return cmd
示例13: sg_add_hlu
def sg_add_hlu(self, sg_name, hlu_id, alu_id):
cmd = ['storagegroup', '-addhlu']
cmd += int_var('-hlu', hlu_id)
cmd += int_var('-alu', alu_id)
cmd += text_var('-gname', sg_name)
cmd.append('-o')
return cmd
示例14: _get_id_name_opt
def _get_id_name_opt(cls, _id, name, allow_empty=False):
try:
ret = cls._select_one(
[int_var('-id', _id), text_var('-name', name)],
allow_empty)
except OptionMissingError:
raise ValueError('id or name need to be specified.')
return ret
示例15: _get_pool_opt
def _get_pool_opt(cls, pool_id, pool_name, allow_empty=False):
try:
ret = cls._select_one([int_var('-poolId', pool_id),
text_var('-poolName', pool_name)],
allow_empty=allow_empty)
except OptionMissingError:
raise ValueError('pool_id or pool_name need to be specified.')
return ret