コード例 #1
0
    def clone_complete(self, cg_name=None, clone_id=vnx_default_clone_id):
        '''Check status of clone operation, true if done, false if still pending'''
        cmd = self._construct_base_command(get_clone_command(group_name=cg_name, clone_id=clone_id))
        print cmd
        output = run_get_output(cmd)
        status = self._parse_clone_state(output)
        
        if status != None:
            status = status.lower()

        return status in vnx_clone_complete_states  
コード例 #2
0
 def create_lun(self, lun_name=None, lun_size=None):
     ''' Creates lun and returns lun's ID'''        
     if lun_name == None or lun_size == None:
         raise ValueError("Name and size must be specified")
     
     command = self._construct_base_command(create_lun_command(lun_name=lun_name,capacity=lun_size))
     print command
     status = run_get_status(command)
     if status != 0:
         print "Error creating lun"
         return None
     
     get_command = self._construct_base_command(get_lun_by_name_command(lun_name=lun_name))
     lun_output = run_get_output(get_command)
     return self._construct_lun(lun_output)
コード例 #3
0
def host_attach(client=None, target_iqn=None):
    '''
    Attach the lun to the local host, assumes no CHAP authentication.
    Returns the name of the local device that is the attachment
    
    This is VNX specific for our setup, see the iqn and IP
    
    Also assumes only a single lun, so always looks for LUN 1 for device
    '''
    
    add_static_target = ['iscsiadm','-m','node','-T','iqn.1992-04.com.emc:cx.apm00121200804.a6', '-p','192.168.25.182', '-o', 'new']
    scan_sessions = ['iscsiadm','-m','session','-R']    
    iscsi_info = ['iscsiadm','-m','session','-P','3']
    
    processtools.run_get_status(add_static_target)
    processtools.run_get_status(scan_sessions)
    output = processtools.run_get_output(iscsi_info)
    
    parse_device_name(output,lun_id=1, target='iqn.1992-04.com.emc:cx.apm00121200804.a6')
    #TODO: finish this function
    local_device=None
    return local_device
コード例 #4
0
 def migration_complete(self, migration_lun=None):
     cmd = self._construct_base_command(get_migration_state_command(src_lun_id=migration_lun.id))
     print cmd
     output = run_get_output(cmd)
     status = self._parse_migration_status(output)
     return status in ['none','complete']
コード例 #5
0
 def get_clone_id(self, cg_name=None, lun=None):
     cmd = self._construct_base_command(get_clone_id_command(group_name=cg_name))
     print cmd
     output = run_get_output(cmd)
     clone_id = self._parse_clone_id_output(lun_id=lun.id, output=output)
     return clone_id
コード例 #6
0
 def get_lun_by_name(self, lun_name=None):
     command = self._construct_base_command(get_lun_by_name_command(lun_name=lun_name))
     output = run_get_output(command)
     return self._construct_lun(output)    
コード例 #7
0
 def get_lun_by_id(self, lun_id=None):
     '''Gets lun by id lookup'''
     command = self._construct_base_command(get_lun_by_id_command(lun_id=lun_id))
     output = run_get_output(command)
     return self._construct_lun(output)
コード例 #8
0
 def get_all_luns(self):
     '''Gets list of all luns'''
     command = self._construct_base_command(get_all_luns_command())
     output = run_get_output(command)
     return self._parse_lun_list(output)