Exemplo n.º 1
0
    def wait_until_fs_deleted(self, *args, **kwargs):
        banner("PCC.Ceph Wait Until Fs Deleted")
        self._load_kwargs(kwargs)

        if self.id == None:
            return None
        try:
            conn = BuiltIn().get_variable_value("${PCC_CONN}")
        except Exception as e:
            raise e

        Id_found_in_list_of_Fs = True
        timeout = time.time() + PCCSERVER_TIMEOUT

        while Id_found_in_list_of_Fs == True:
            Id_found_in_list_of_Fs = False
            response = pcc.get_ceph_fs(conn)
            for data in get_response_data(response):
                print(data)
                if str(data['id']) == str(self.id):
                    Id_found_in_list_of_Fs = True
                elif re.search("failed",str(data['deploy_status'])):
                    return "Error"
            if time.time() > timeout:
                raise Exception("[PCC.Ceph Wait Until Fs Deleted] Timeout")
            if Id_found_in_list_of_Fs:
                trace("  Waiting until Fs: %s is deleted. Timeout in %.1f seconds." % 
                       (data['name'], timeout-time.time()))
                time.sleep(5)
        return "OK"
Exemplo n.º 2
0
    def delete_ceph_all_fs(self, *args, **kwargs):
        banner("PCC.Ceph Delete All Fs")
        self._load_kwargs(kwargs)

        try:
            conn = BuiltIn().get_variable_value("${PCC_CONN}")
        except Exception as e:
            raise e
            
        response = pcc.get_ceph_fs(conn)
        for data in get_response_data(response):
            print("Response To Look :-"+str(data))
            print("Ceph Fs {} and id {} is deleting....".format(data['name'],data['id']))
            self.id=data['id']
            del_response=pcc.delete_ceph_fs_by_id(conn, str(self.id))
            if del_response['Result']['status']==200:
                del_check=self.wait_until_fs_deleted()
                if del_check=="OK":
                    print("Ceph Fs {} is deleted sucessfully".format(data['name']))
                    return "OK"
                else:
                    print("Ceph Fs {} unable to delete".format(data['name']))
                    return "Error"
            else:
                print("Delete Response:"+str(del_response))
                print("Issue: Not getting 200 response back")
                return "Error"
                        
        return "OK"
Exemplo n.º 3
0
    def wait_until_fs_ready(self, *args, **kwargs):
        banner("PCC.Ceph Wait Until Fs Ready")
        self._load_kwargs(kwargs)

        if self.name == None:
            return None
        try:
            conn = BuiltIn().get_variable_value("${PCC_CONN}")
        except Exception as e:
            raise e

        fs_ready = False
        timeout = time.time() + PCCSERVER_TIMEOUT

        while fs_ready == False:
            response = pcc.get_ceph_fs(conn)
            for data in get_response_data(response):
                if str(data['name']).lower() == str(self.name).lower():
                    print(str(data))
                    trace("  Waiting until Fs : %s is Ready, currently: %s" % (data['name'], data['progressPercentage']))
                    if str(data['deploy_status']) == "completed":
                        fs_ready = True
                    elif re.search("failed",str(data['deploy_status'])):
                        return "Error"
            if time.time() > timeout:
                raise Exception("[PCC.Ceph Wait Until Fs Ready] Timeout")
            time.sleep(5)
        return "OK"
Exemplo n.º 4
0
    def get_ceph_all_fs_data(self,*args,**kwargs):
        self._load_kwargs(kwargs)
        pool_id= None
        banner("PCC.Ceph Get All Fs Data")

        try:
            conn = BuiltIn().get_variable_value("${PCC_CONN}")
        except Exception as e:
            raise e

        response = get_response_data(pcc.get_ceph_fs(conn))
        return response
Exemplo n.º 5
0
def get_ceph_fs_id_by_name(conn: dict, Name: str) -> int:
    """
    Get Id of Ceph Fs with matching Name from PCC
    [Args]
        (dict) conn: Connection dictionary obtained after logging in
        (str) Name: Name of Ceph Fs
    [Returns]
        (int) Id: Id of the matchining Fs, or
            None: if no match found, or
        (dict) Error response: If Exception occured
    """
    try:
        list_of_ceph_fs = pcc.get_ceph_fs(conn)['Result']['Data']
        for ceph_fs in list_of_ceph_fs:
            if str(ceph_fs['name']) == str(Name):
                return ceph_fs['id']
        return None
    except Exception as e:
        return {"Error": str(e)}