Example #1
0
 def switch_host_off(self, context, sleep_command, host, controller_topic):
     if controller_topic != CONF.controller_topic:
         return False
     cctxt = self.client.prepare(server = host)
     sleep_command = jsonutils.to_primitive(sleep_command)
     controller_topic = jsonutils.to_primitive(controller_topic)
     cctxt.cast(context, 'switch_host_off', sleep_command=sleep_command, controller_topic=controller_topic)
Example #2
0
 def switch_host_off(self, context, sleep_command, host, controller_topic):
     if controller_topic != CONF.controller_topic:
         return False
     cctxt = self.client.prepare(server=host)
     sleep_command = jsonutils.to_primitive(sleep_command)
     controller_topic = jsonutils.to_primitive(controller_topic)
     cctxt.cast(context,
                'switch_host_off',
                sleep_command=sleep_command,
                controller_topic=controller_topic)
Example #3
0
 def create_vm_select_algorithm(self, context, algorithm_create_values):
     algorithm_create_values = jsonutils.to_primitive(
         algorithm_create_values)
     cctxt = self.client.prepare()
     return cctxt.call(context,
                       'create_vm_select_algorithm',
                       algorithm_create_values=algorithm_create_values)
Example #4
0
 def update_vm_select_algorithm(self, context, id, values):
     values_p = jsonutils.to_primitive(values)
     cctxt = self.client.prepare()
     return cctxt.call(context,
                       'update_vm_select_algorithm',
                       id=id,
                       values=values_p)
Example #5
0
 def update_host_load_states(self, context, id, update_value):
     update_value_p = jsonutils.to_primitive(update_value)
     cctxt = self.client.prepare()
     return cctxt.call(context,
                       'update_host_load_states',
                       id=id,
                       values=update_value_p)
Example #6
0
 def create_vm_metadata(self, context, vm_create_values):
     """
     注:这个方法需要比较细致地来写;
     """
     cctxt = self.client.prepare()
     vm_create_values = jsonutils.to_primitive(vm_create_values)
     return cctxt.call(context, 'create_vm_metadata', vm_create_values=vm_create_values)
Example #7
0
 def update_host_init_data_temp(self, context, host_id, update_values):
     update_values_p = jsonutils.to_primitive(update_values)
     cctxt = self.client.prepare()
     return cctxt.call(context,
                       'update_host_init_data_temp',
                       host_id,
                       values=update_values_p)
Example #8
0
 def update_host_cpu_data_temp_by_id(self, context, update_values,
                                     host_uuid):
     cctxt = self.client.prepare()
     update_value_p = jsonutils.to_primitive(update_values)
     return cctxt.call(context,
                       'update_host_cpu_data_temp_by_id',
                       host_uuid=host_uuid,
                       update_values=update_value_p)
Example #9
0
 def vms_migration(self, context, vms_migration_topic):
     if vms_migration_topic != CONF.vms_migration_topic:
         return False
     vms_migration_topic = jsonutils.to_primitive(vms_migration_topic)
     cctxt = self.client.prepare()
     return cctxt.call(context,
                       'vms_migration',
                       vms_migration_topic=vms_migration_topic)
Example #10
0
 def update_host_cpu_data_temp_by_id(self, context, update_values, host_uuid):
     cctxt = self.client.prepare()
     update_value_p = jsonutils.to_primitive(update_values)
     return cctxt.call(
                context, 
                'update_host_cpu_data_temp_by_id', 
                host_uuid=host_uuid, 
                update_values=update_value_p)
Example #11
0
 def vms_selection(self, context, host_uuid, vms_selection_topic):
     if vms_selection_topic != CONF.vms_selection_topic:
         return False
     load_detection_topic = jsonutils.to_primitive(vms_selection_topic)
     cctxt = self.client.prepare(server=host_uuid)
     return cctxt.call(context,
                       'vms_selection',
                       vms_selection_topic=vms_selection_topic)
Example #12
0
 def create_vm_metadata(self, context, vm_create_values):
     """
     注:这个方法需要比较细致地来写;
     """
     cctxt = self.client.prepare()
     vm_create_values = jsonutils.to_primitive(vm_create_values)
     return cctxt.call(context,
                       'create_vm_metadata',
                       vm_create_values=vm_create_values)
Example #13
0
 def hosts_vms_data_collection(self, context, data_collection_topic):
     if data_collection_topic != CONF.data_collection_topic:
         return False
     data_collection_topic = jsonutils.to_primitive(data_collection_topic)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'hosts_vms_data_collection')
Example #14
0
 def update_host_init_data_temp(self, context, host_id, update_values):
     update_values_p = jsonutils.to_primitive(update_values)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'update_host_init_data_temp', host_id, values=update_values_p)
Example #15
0
 def create_host_init_data(self, context, update_values):
     update_values_p = jsonutils.to_primitive(update_values)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'create_host_init_data', values=update_values_p)
Example #16
0
 def update_host_load_states(self, context, id, update_value):
     update_value_p = jsonutils.to_primitive(update_value)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'update_host_load_states', id=id, values=update_value_p)
Example #17
0
 def update_vm_select_algorithm(self, context, id, values):
     values_p = jsonutils.to_primitive(values)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'update_vm_select_algorithm', id=id, values=values_p)
Example #18
0
 def create_vm_select_algorithm(self, context, algorithm_create_values):
     algorithm_create_values = jsonutils.to_primitive(algorithm_create_values)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'create_vm_select_algorithm', algorithm_create_values=algorithm_create_values)
Example #19
0
 def serialize_entity(context, entity):
     return jsonutils.to_primitive(entity, convert_instances=True)
Example #20
0
 def vms_migration(self, context, vms_migration_topic):
     if vms_migration_topic != CONF.vms_migration_topic:
         return False
     vms_migration_topic = jsonutils.to_primitive(vms_migration_topic)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'vms_migration', vms_migration_topic=vms_migration_topic)
Example #21
0
 def ping(self, context, arg, timeout=None):
     arg_p = jsonutils.to_primitive(arg)
     cctxt = self.client.prepare(timeout=timeout)
     return cctxt.call(context, 'ping', arg=arg_p)
Example #22
0
 def create_host_init_data(self, context, update_values):
     update_values_p = jsonutils.to_primitive(update_values)
     cctxt = self.client.prepare()
     return cctxt.call(context,
                       'create_host_init_data',
                       values=update_values_p)
Example #23
0
 def ping(self, context, arg):
     resp = {'service': self.service_name, 'arg': arg}
     return jsonutils.to_primitive(resp)
Example #24
0
 def hosts_vms_data_collection(self, context, data_collection_topic):
     if data_collection_topic != CONF.data_collection_topic:
         return False
     data_collection_topic = jsonutils.to_primitive(data_collection_topic)
     cctxt = self.client.prepare()
     return cctxt.call(context, 'hosts_vms_data_collection')
Example #25
0
 def vms_selection(self, context, host_uuid, vms_selection_topic):
     if vms_selection_topic != CONF.vms_selection_topic:
         return False
     load_detection_topic = jsonutils.to_primitive(vms_selection_topic)
     cctxt = self.client.prepare(server = host_uuid)
     return cctxt.call(context, 'vms_selection', vms_selection_topic=vms_selection_topic)