@@ -5047,22 +5047,44 @@ def service_get_by_compute_host(self, context, host_name):
5047
5047
"""Get service entry for the given compute hostname."""
5048
5048
return objects .Service .get_by_compute_host (context , host_name )
5049
5049
5050
- def _service_update (self , context , host_name , binary , params_to_update ):
5051
- """Performs the actual service update operation."""
5052
- service = objects .Service .get_by_args (context , host_name , binary )
5053
- service .update (params_to_update )
5050
+ def service_update (self , context , service ):
5051
+ """Performs the actual service update operation.
5052
+
5053
+ :param context: nova auth RequestContext
5054
+ :param service: nova.objects.Service object with changes already
5055
+ set on the object
5056
+ """
5054
5057
service .save ()
5058
+ # TODO(mriedem): Reflect COMPUTE_STATUS_DISABLED trait changes to the
5059
+ # associated compute node resource providers if the service's disabled
5060
+ # status changed.
5055
5061
return service
5056
5062
5057
5063
@target_host_cell
5058
- def service_update (self , context , host_name , binary , params_to_update ):
5064
+ def service_update_by_host_and_binary (self , context , host_name , binary ,
5065
+ params_to_update ):
5059
5066
"""Enable / Disable a service.
5060
5067
5068
+ Determines the cell that the service is in using the HostMapping.
5069
+
5061
5070
For compute services, this stops new builds and migrations going to
5062
5071
the host.
5072
+
5073
+ See also ``service_update``.
5074
+
5075
+ :param context: nova auth RequestContext
5076
+ :param host_name: hostname of the service
5077
+ :param binary: service binary (really only supports "nova-compute")
5078
+ :param params_to_update: dict of changes to make to the Service object
5079
+ :raises: HostMappingNotFound if the host is not mapped to a cell
5080
+ :raises: HostBinaryNotFound if a services table record is not found
5081
+ with the given host_name and binary
5063
5082
"""
5064
- return self ._service_update (context , host_name , binary ,
5065
- params_to_update )
5083
+ # TODO(mriedem): Service.get_by_args is deprecated; we should use
5084
+ # get_by_compute_host here (remember to update the "raises" docstring).
5085
+ service = objects .Service .get_by_args (context , host_name , binary )
5086
+ service .update (params_to_update )
5087
+ return self .service_update (context , service )
5066
5088
5067
5089
def _service_delete (self , context , service_id ):
5068
5090
"""Performs the actual Service deletion operation."""
0 commit comments