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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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')
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)
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)
def serialize_entity(context, entity): return jsonutils.to_primitive(entity, convert_instances=True)
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)
def ping(self, context, arg): resp = {'service': self.service_name, 'arg': arg} return jsonutils.to_primitive(resp)
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)