예제 #1
0
    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
예제 #2
0
파일: block_cli.py 프로젝트: crook/storops
    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
예제 #3
0
파일: cli.py 프로젝트: optionalg/storops
 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
예제 #4
0
파일: cli.py 프로젝트: optionalg/storops
 def migrate_lun(self, src_id, dst_id, rate=VNXMigrationRate.HIGH):
     cmd = ['migrate', '-start']
     cmd += int_var('-source', src_id)
     cmd += int_var('-dest', dst_id)
     cmd += enum_var('-rate', rate, VNXMigrationRate)
     cmd.append('-o')
     return cmd
예제 #5
0
 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
예제 #6
0
 def migrate_lun(self, src_id, dst_id, rate=VNXMigrationRate.HIGH):
     cmd = ['migrate', '-start']
     cmd += int_var('-source', src_id)
     cmd += int_var('-dest', dst_id)
     cmd += enum_var('-rate', rate, VNXMigrationRate)
     cmd.append('-o')
     return cmd
예제 #7
0
    def delete_user(self, name, scope=None):
        if scope is None:
            scope = VNXUserScopeEnum.GLOBAL

        cmd = ['security', '-rmuser']
        cmd += text_var('-user', name)
        cmd += enum_var('-scope', scope, VNXUserScopeEnum)
        cmd.append('-o')
        return cmd
예제 #8
0
파일: block_cli.py 프로젝트: crook/storops
    def delete_user(self, name, scope=None):
        if scope is None:
            scope = VNXUserScopeEnum.GLOBAL

        cmd = ['security', '-rmuser']
        cmd += text_var('-user', name)
        cmd += enum_var('-scope', scope, VNXUserScopeEnum)
        cmd.append('-o')
        return cmd
예제 #9
0
파일: cli.py 프로젝트: optionalg/storops
 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
예제 #10
0
파일: cli.py 프로젝트: optionalg/storops
 def enable_compression(self, lun_id=None, rate=None, pool_id=None,
                        pool_name=None, ignore_thresholds=False):
     cmd = ['compression', '-on']
     cmd += int_var('-l', lun_id)
     cmd += int_var('-destPoolId', pool_id)
     cmd += text_var('-destPoolName', pool_name)
     cmd += enum_var('-rate', rate, VNXCompressionRate)
     if ignore_thresholds:
         cmd.append('-ignoreThresholds')
     cmd.append('-o')
     return cmd
예제 #11
0
파일: cli.py 프로젝트: optionalg/storops
 def _get_lun_opt(cls, lun_id=None, lun_name=None,
                  lun_type=None, allow_empty=False):
     try:
         ret = cls._select_one([int_var('-l', lun_id),
                                text_var('-name', lun_name),
                                enum_var('-showOnly', lun_type,
                                         VNXLunType)],
                               allow_empty=allow_empty)
     except OptionMissingError:
         raise ValueError(
             'lun_id, lun_name or lun_type need to be specified.')
     return ret
예제 #12
0
파일: cli.py 프로젝트: optionalg/storops
 def create_rg(self, disks=None, rg_id=None, raid_type=None):
     if rg_id is None:
         raise ValueError('RAID group id not specified.')
     if not disks:
         raise ValueError('disks not specified.')
     if raid_type is None:
         raid_type = VNXRaidType.RAID5
     cmd = ['createrg']
     cmd += int_var(None, rg_id)
     cmd += disks
     cmd += enum_var('-raidtype', raid_type, VNXRaidType)
     cmd.append('-o')
     return cmd
예제 #13
0
 def create_rg(self, disks=None, rg_id=None, raid_type=None):
     if rg_id is None:
         raise ValueError('RAID group id not specified.')
     if not disks:
         raise ValueError('disks not specified.')
     if raid_type is None:
         raid_type = VNXRaidType.RAID5
     cmd = ['createrg']
     cmd += int_var(None, rg_id)
     cmd += disks
     cmd += enum_var('-raidtype', raid_type, VNXRaidType)
     cmd.append('-o')
     return cmd
예제 #14
0
 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
예제 #15
0
 def enable_compression(self,
                        lun_id=None,
                        rate=None,
                        pool_id=None,
                        pool_name=None,
                        ignore_thresholds=False):
     cmd = ['compression', '-on']
     cmd += int_var('-l', lun_id)
     cmd += int_var('-destPoolId', pool_id)
     cmd += text_var('-destPoolName', pool_name)
     cmd += enum_var('-rate', rate, VNXCompressionRate)
     if ignore_thresholds:
         cmd.append('-ignoreThresholds')
     cmd.append('-o')
     return cmd
예제 #16
0
 def _get_lun_opt(cls,
                  lun_id=None,
                  lun_name=None,
                  lun_type=None,
                  allow_empty=False):
     try:
         ret = cls._select_one([
             int_var('-l', lun_id),
             text_var('-name', lun_name),
             enum_var('-showOnly', lun_type, VNXLunType)
         ],
                               allow_empty=allow_empty)
     except OptionMissingError:
         raise ValueError(
             'lun_id, lun_name or lun_type need to be specified.')
     return ret
예제 #17
0
 def test_enum_var(self):
     assert_that(enum_var('-a', 'r5', VNXRaidType),
                 only_contains('-a', 'r5'))
     assert_that(enum_var(None, 'r5', VNXRaidType), only_contains('r5'))
     assert_that(enum_var('-a', None, VNXRaidType), equal_to([]))
예제 #18
0
 def test_enum_var(self):
     assert_that(enum_var('-a', 'r5', VNXRaidType),
                 only_contains('-a', 'r5'))
     assert_that(enum_var(None, 'r5', VNXRaidType), only_contains('r5'))
     assert_that(enum_var('-a', None, VNXRaidType), equal_to([]))