Esempio n. 1
0
 def service_name_get(self, context, parameters=None):
     try:
         rpc_body = rpc_data('name_check', context, parameters)
         return self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
     except Exception, e:
         log.error('check the name if used or not error, reason is: %s' % e)
         return request_result(598)
Esempio n. 2
0
    def disk_snapshot_create(self,
                             token,
                             snapshot_name,
                             description,
                             volume_uuid,
                             metadata=None):
        """
        :param snapshot_name:
        :param description:
        :param metadata:
        :param vm_uuid:
        :return:
        """
        context = context_data(token, 'vol_snap_pro_com', 'create',
                               self.local_ip)
        parameters = {
            'volume_uuid': volume_uuid,
            'name': snapshot_name,
            'description': description,
            'metadata': metadata
        }
        try:
            rpc_body = rpc_data("snap_cre", context, parameters)

            self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
        except Exception, e:
            log.error('create volume error., reason is: %s' % e)
            raise Exception(e)
Esempio n. 3
0
 def only_detail_alarm(self, context, parameters=None):
     try:
         rpc_body = rpc_data('only_detail_alarm', context, parameters)
         return self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
     except Exception, e:
         log.error('Rpc client exec error, reason is: %s' % e)
         return request_result(598)
Esempio n. 4
0
    def clouddisk_create(self, context, parameters=None):
        '''
        :param context: {'token':string,
                         'source_ip':source_ip}
        :param parameters: {size=int,
                            name=string,
                            v_type=string,
                            description=string,
                            snapshot_uuid=string,
                            source_volume_uuid=string}
        :return:
        '''
        context = context_data(context.get('token'),
                               'vol_vol_pro_com',
                               'create',
                               context.get('source_ip'))
        try:
            rpc_body = rpc_data("clouddisk_cre", context, parameters)

            return self.rbtmq.rpc_call_client(self.queue,
                                              self.timeout,
                                              rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % e)
            return request_result(598)
Esempio n. 5
0
 def get_all_services(self, context, parameters=None):
     try:
         rpc_body = rpc_data("admin_services_get", context, parameters)
         return self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
     except Exception, e:
         log.error('Rpc client exec error, reason=%s' % e)
         return request_result(598)
Esempio n. 6
0
 def create_certify(self, context, parameters=None):
     try:
         rpc_body = rpc_data("certify_cre", context, parameters)
         return self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
     except Exception, e:
         log.error('Rpc client exec error, reason=%s' % e)
         return request_result(598)
    def create_ingress(self, context, parameters=None):
        try:
            rpc_body = rpc_data('cre_ingress', context, parameters)

            self.rbtmq.rpc_cast_client(self.queue_c, rpc_body)

        except Exception, e:
            log.error('Rpc client exec error when create the default ingress...reason=%s' % e)
    def create_services(self, context, parameters=None):
        try:
            rpc_body = rpc_data('kuber_cre', context, parameters)

            return self.rbtmq.rpc_cast_client(self.queue_c, rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % e)
            return request_result(501)
 def create_service(self, context, parameters=None):
     try:
         rpc_body = rpc_data("svc_cre", context, parameters)
         log.info('rpc client to server data is : %s' % rpc_body)
         return self.rbtmq.rpc_call_client(self.queue2, self.timeout, rpc_body)
     except Exception, e:
         log.error('Rpc client exec error, reason=%s' % e)
         return request_result(598)
    def delete_namespace(self, context, parameters=None):
        try:
            rpc_body = rpc_data('del_ns', context, parameters)

            return self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % e)
            return request_result(503)
    def operation_update(self, context, parameters=None):

        try:
            rpc_body = rpc_data("sec_opr_rcd_udt", context, parameters)
            return self.rbtmq.rpc_cast_client(self.cast_queue, rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % (e))
            return request_result(598)
    def get_ingress(self, context, parameters=None):
        try:
            rpc_body = rpc_data('g_default_ingress', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when get the default ingress message...reason is: %s' % e)
Esempio n. 13
0
    def disk_delete(self, context, parameters=None):

        try:
            rpc_body = rpc_data("stg_ceh_dsk_del", context, parameters)
            return self.rbtmq.rpc_call_client(
                        self.queue, self.timeout, rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % (e))
            return request_result(598)
Esempio n. 14
0
    def cost_accounting(self, context, parameters=None):

        try:
            rpc_body = rpc_data("bil_cst_cst_inf", context, parameters)
            return self.rbtmq.rpc_call_client(self.queue, self.timeout,
                                              rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % (e))
            return request_result(598)
Esempio n. 15
0
    def port_status(self, port_uuid):
        context = dict()
        parameters = {'port_uuid': port_uuid}
        try:
            rpc_body = rpc_data("port_status", context, parameters)

            self.rbtmq.rpc_cast_client(self.queue, rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % e)
    def update_ingress(self, context, parameters=None):

        try:
            rpc_body = rpc_data('up_ingress', context, parameters)
            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when update the ingress...reason is: %s' % e)
Esempio n. 17
0
    def limit_update(self, context, parameters=None):

        try:
            rpc_body = rpc_data("bil_lmt_lmt_udt", context, parameters)
            return self.rbtmq.rpc_call_client(self.queue, self.timeout,
                                              rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % (e))
            return request_result(598)
    def user_list(self, context, parameters=None):

        try:
            rpc_body = rpc_data("uct_usr_usr_lst", context, parameters)
            return self.rbtmq.rpc_call_client(self.queue, self.timeout,
                                              rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % (e))
            return request_result(598)
    def get_account(self, context, parameters=None):
        try:
            rpc_body = rpc_data('account_get', context, parameters)
            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when get secret msg...,reason=%s' % e)
            return request_result(501)
 def show_ns(self, context, parameters=None):
     try:
         rpc_body = rpc_data('ns_show', context, parameters)
         ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
         log.info('the namespace get result is: %s, type is : %s' % (ret, type(ret)))
         return json.loads(ret)
     except Exception, e:
         log.error('Rpc client exec error when get namespace...,reason=%s' % e)
         return request_result(501)
Esempio n. 21
0
    def monitor_message_get(self, context, parameters=None):
        log.info('in rpc api data is:%s' % context)
        try:
            rpc_body = rpc_data('mon_get', context, parameters)

            return self.rbtmq.rpc_call_client(self.queue, self.timeout,
                                              rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % e)
            return request_result(701)
    def get_pod_messages(self, context, parameters=None):

        try:
            rpc_body = rpc_data('pods_get', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when get pods messages...,reason=%s' % e)
    def delete_service_a_rc(self, context, parameters=None):

        try:
            rpc_body = rpc_data('svc_delete', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when delete rc and service...,reason=%s' % e)
    def create_secret(self, context, parameters=None):
        try:
            rpc_body = rpc_data('secret_cre', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
            log.info('secret create result is : %s, type is %s' % (ret, type(ret)))
            return ret
        except Exception, e:
            log.error('Rpc client exec error when create secret...,reason=%s' % e)
            return request_result(501)
    def create_ns(self, context, parameters=None):
        try:
            rpc_body = rpc_data('ns_cre', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when create namespace...,reason=%s' % e)
            return request_result(501)
    def get_one_re(self, context, parameters=None):

        try:
            rpc_body = rpc_data('get_one', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when get one resource...reason=%s' % e)
    def update_certify(self, context, parameters=None):
        try:
            rpc_body = rpc_data('secret_update', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)
            log.info('update the https secret result is: %s' % ret)

            return ret
        except Exception, e:
            log.error('Rpc client exec error when update the certufy secret...reason is: %s' % e)
Esempio n. 28
0
    def clouddisk_info(self, token, volume_uuid):
        context = context_data(token, volume_uuid, "read")
        parameters = {'volume_uuid': volume_uuid}

        try:
            rpc_body = rpc_data("clouddisk_inf", context, parameters)
            result = self.rbtmq.rpc_call_client(self.queue, self.timeout,
                                                rpc_body)
        except Exception, e:
            log.error('RPC client exec error, reason is: %s' % e)
            raise Exception(e)
    def create_account(self, context, parameters=None):
        try:
            rpc_body = rpc_data('account_cre', context, parameters)

            ret = self.rbtmq.rpc_call_client(self.queue, self.timeout, rpc_body)

            log.info('account create result is : %s, type is %s' % (ret, type(ret)))
            if ret.get('kind') != 'ServiceAccount':
                return False
            return True
        except Exception, e:
            log.error('Rpc client exec error when create account...,reason=%s' % e)
Esempio n. 30
0
    def clouddisk_unmount(self, token, volume_uuid):
        """
        :param attachment_uuid:
        :return:
        """
        context = context_data(token, volume_uuid, "delete", self.local_ip)
        parameters = {'volume_uuid': volume_uuid}

        try:
            rpc_body = rpc_data("attach_del", context, parameters)
            result = self.rbtmq.rpc_call_client(self.queue, self.timeout,
                                                rpc_body)
        except Exception, e:
            log.error('Rpc client exec error, reason=%s' % e)
            raise Exception(e)