def revert_snapshot_based_resize(self, ctxt, instance, migration): version = '1.23' if not self.client.can_send_version(version): raise exception.ServiceTooOld(_('nova-conductor too old')) kw = {'instance': instance, 'migration': migration} cctxt = self.client.prepare(version=version) return cctxt.cast(ctxt, 'revert_snapshot_based_resize', **kw)
def _determine_version_cap(self, target): global LAST_VERSION if LAST_VERSION: return LAST_VERSION service_version = objects.Service.get_minimum_version( context.get_admin_context(), 'nova-compute') history = service_obj.SERVICE_VERSION_HISTORY try: version_cap = history[service_version]['compute_rpc'] except IndexError: LOG.error(_LE('Failed to extract compute RPC version from ' 'service history because I am too ' 'old (minimum version is now %(version)i)'), {'version': service_version}) raise exception.ServiceTooOld(thisver=service_obj.SERVICE_VERSION, minver=service_version) except KeyError: LOG.error(_LE('Failed to extract compute RPC version from ' 'service history for version %(version)i'), {'version': service_version}) return target.version LAST_VERSION = version_cap LOG.info(_LI('Automatically selected compute RPC version %(rpc)s ' 'from minimum service version %(service)i'), {'rpc': version_cap, 'service': service_version}) return version_cap
def confirm_snapshot_based_resize( self, ctxt, instance, migration, do_cast=True): version = '1.22' if not self.client.can_send_version(version): raise exception.ServiceTooOld(_('nova-conductor too old')) kw = {'instance': instance, 'migration': migration} cctxt = self.client.prepare(version=version) if do_cast: return cctxt.cast(ctxt, 'confirm_snapshot_based_resize', **kw) return cctxt.call(ctxt, 'confirm_snapshot_based_resize', **kw)
def _determine_version_cap(self, target): global LAST_VERSION if LAST_VERSION: return LAST_VERSION service_version = objects.Service.get_minimum_version( context.get_admin_context(), 'nova-compute') history = service_obj.SERVICE_VERSION_HISTORY # NOTE(johngarbutt) when there are no nova-compute services running we # get service_version == 0. In that case we do not want to cache # this result, because we will get a better answer next time. # As a sane default, return the current version. if service_version == 0: LOG.debug("Not caching compute RPC version_cap, because min " "service_version is 0. Please ensure a nova-compute " "service has been started. Defaulting to current " "version.") return history[service_obj.SERVICE_VERSION]['compute_rpc'] try: version_cap = history[service_version]['compute_rpc'] except IndexError: LOG.error('Failed to extract compute RPC version from ' 'service history because I am too ' 'old (minimum version is now %(version)i)', {'version': service_version}) raise exception.ServiceTooOld(thisver=service_obj.SERVICE_VERSION, minver=service_version) except KeyError: LOG.error('Failed to extract compute RPC version from ' 'service history for version %(version)i', {'version': service_version}) return target.version LAST_VERSION = version_cap LOG.info('Automatically selected compute RPC version %(rpc)s ' 'from minimum service version %(service)i', {'rpc': version_cap, 'service': service_version}) return version_cap
def _check_minimum_version(self): """Enforce that we are not older that the minimum version. This is a loose check to avoid creating or updating our service record if we would do so with a version that is older that the current minimum of all services. This could happen if we were started with older code by accident, either due to a rollback or an old and un-updated node suddenly coming back onto the network. There is technically a race here between the check and the update, but since the minimum version should always roll forward and never backwards, we don't need to worry about doing it atomically. Further, the consequence for getting this wrong is minor, in that we'll just fail to send messages that other services understand. """ if not self.obj_attr_is_set('version'): return if not self.obj_attr_is_set('binary'): return minver = self.get_minimum_version(self._context, self.binary) if minver > self.version: raise exception.ServiceTooOld(thisver=self.version, minver=minver)
def _check_minimum_version(self): """Enforce that we are not older that the minimum version. This is a loose check to avoid creating or updating our service record if we would do so with a version that is older that the current minimum of all services. This could happen if we were started with older code by accident, either due to a rollback or an old and un-updated node suddenly coming back onto the network. There is technically a race here between the check and the update, but since the minimum version should always roll forward and never backwards, we don't need to worry about doing it atomically. Further, the consequence for getting this wrong is minor, in that we'll just fail to send messages that other services understand. """ if not self.obj_attr_is_set('version'): return if not self.obj_attr_is_set('binary'): return minver = self.get_minimum_version(self._context, self.binary) if minver > self.version: # WRS: CGTS-6904: ignoring ServiceTooOld excep for nova-compute. # This is needed to allow downgrade of compute in a fully-upgraded # system, as well as to work around scenarios where the only # non-upgraded compute is set to 'forced-down' by the VIM if self.binary == 'nova-compute': LOG.warning( 'ServiceTooOld: %(service)s on %(computename)s' ' is older (v%(thisver)i) than the minimum ' '(v%(minver)i) version of the rest of the deployment. ', { 'service': self.binary, 'computename': self.host, 'thisver': self.version, 'minver': minver }) else: raise exception.ServiceTooOld(thisver=self.version, minver=minver)