Exemplo n.º 1
0
 def get_backup_device(self, ctxt, backup, volume):
     if not self.client.can_send_version('1.38'):
         msg = _('One of cinder-volume services is too old to accept such '
                 'request. Are you running mixed Liberty-Mitaka '
                 'cinder-volumes?')
         raise exception.ServiceTooOld(msg)
     new_host = utils.extract_host(volume.host)
     cctxt = self.client.prepare(server=new_host, version='1.38')
     return cctxt.call(ctxt, 'get_backup_device', backup=backup)
Exemplo n.º 2
0
    def do_cleanup(self, ctxt, cleanup_request):
        """Perform this scheduler's resource cleanup as per cleanup_request."""
        if not self.client.can_send_version('3.4'):
            msg = _('One of cinder-scheduler services is too old to accept '
                    'such request. Are you running mixed Newton-Ocata'
                    'cinder-schedulers?')
            raise exception.ServiceTooOld(msg)

        cctxt = self.client.prepare(version='3.4')
        cctxt.cast(ctxt, 'do_cleanup', cleanup_request=cleanup_request)
Exemplo n.º 3
0
 def notify_service_capabilities(self, ctxt, service_name,
                                 host, capabilities):
     cctxt = self._get_cctxt(version='3.1')
     if not cctxt.can_send_version('3.1'):
         msg = _('notify_service_capabilities requires cinder-scheduler '
                 'RPC API version >= 3.1.')
         raise exception.ServiceTooOld(msg)
     cctxt.cast(ctxt, 'notify_service_capabilities',
                service_name=service_name, host=host,
                capabilities=capabilities)
Exemplo n.º 4
0
 def get_backup_device(self, ctxt, backup, volume):
     if (not self.client.can_send_version('1.38')
             and not self.client.can_send_version('2.0')):
         msg = _('One of cinder-volume services is too old to accept such '
                 'request. Are you running mixed Liberty-Mitaka '
                 'cinder-volumes?')
         raise exception.ServiceTooOld(msg)
     version = self._compat_ver('2.0', '1.38')
     cctxt = self._get_cctxt(volume.host, version)
     return cctxt.call(ctxt, 'get_backup_device', backup=backup)
Exemplo n.º 5
0
 def secure_file_operations_enabled(self, ctxt, volume):
     if not self.client.can_send_version('1.38'):
         msg = _('One of cinder-volume services is too old to accept such '
                 'request. Are you running mixed Liberty-Mitaka '
                 'cinder-volumes?')
         raise exception.ServiceTooOld(msg)
     new_host = utils.extract_host(volume.host)
     cctxt = self.client.prepare(server=new_host, version='1.38')
     return cctxt.call(ctxt,
                       'secure_file_operations_enabled',
                       volume=volume)
Exemplo n.º 6
0
 def secure_file_operations_enabled(self, ctxt, volume):
     if (not self.client.can_send_version('1.38') and
             not self.client.can_send_version('2.0')):
         msg = _('One of cinder-volume services is too old to accept such '
                 'request. Are you running mixed Liberty-Mitaka '
                 'cinder-volumes?')
         raise exception.ServiceTooOld(msg)
     version = self._compat_ver('2.0', '1.38')
     cctxt = self._get_cctxt(volume.host, version)
     return cctxt.call(ctxt, 'secure_file_operations_enabled',
                       volume=volume)
Exemplo n.º 7
0
    def do_cleanup(self, ctxt, cleanup_request):
        """Perform this service/cluster resource cleanup as requested."""
        if not self.client.can_send_version('3.7'):
            msg = _('One of cinder-volume services is too old to accept such '
                    'a request. Are you running mixed Newton-Ocata services?')
            raise exception.ServiceTooOld(msg)

        destination = cleanup_request.service_topic_queue
        cctxt = self._get_cctxt(destination, '3.7')
        # NOTE(geguileo): This call goes to do_cleanup code in
        # cinder.manager.CleanableManager unless in the future we overwrite it
        # in cinder.volume.manager
        cctxt.cast(ctxt, 'do_cleanup', cleanup_request=cleanup_request)
Exemplo n.º 8
0
    def work_cleanup(self, ctxt, cleanup_request):
        """Generate individual service cleanup requests from user request."""
        if not self.client.can_send_version('3.4'):
            msg = _('One of cinder-scheduler services is too old to accept '
                    'such request. Are you running mixed Newton-Ocata'
                    'cinder-schedulers?')
            raise exception.ServiceTooOld(msg)

        cctxt = self.client.prepare(version='3.4')
        # Response will have services that are receiving the cleanup request
        # and services that couldn't receive it since they are down.
        return cctxt.call(ctxt,
                          'work_cleanup',
                          cleanup_request=cleanup_request)
Exemplo n.º 9
0
    def _get_minimum_version(cls, attribute, context, binary):
        services = ServiceList.get_all_by_binary(context, binary)
        min_ver = None
        min_ver_str = None
        for s in services:
            ver_str = getattr(s, attribute)
            if ver_str is None:
                # NOTE(dulek) None in *_current_version means that this
                # service is in Liberty version, which we now don't provide
                # backward compatibility to.
                msg = _('One of the services is in Liberty version. We do not '
                        'provide backward compatibility with Liberty now, you '
                        'need to upgrade to Mitaka first.')
                raise exception.ServiceTooOld(msg)
            ver = versionutils.convert_version_to_int(ver_str)
            if min_ver is None or ver < min_ver:
                min_ver = ver
                min_ver_str = ver_str

        return min_ver_str
Exemplo n.º 10
0
    def _get_minimum_version(cls, attribute, context, binary):
        services = ServiceList.get_all_by_binary(context, binary)
        min_ver = None
        min_ver_str = None
        for s in services:
            ver_str = getattr(s, attribute)
            if ver_str is None:
                # NOTE(dulek) None in *_current_version means that this
                # service is in Liberty version, which we now don't provide
                # backward compatibility to.
                msg = _('Service %s is in Liberty version. We do not provide '
                        'backward compatibility with Liberty now, so you '
                        'need to upgrade it, release by release if live '
                        'upgrade is required. After upgrade you may need to '
                        'remove any stale service records via '
                        '"cinder-manage service remove".') % s.binary
                raise exception.ServiceTooOld(msg)
            ver = versionutils.convert_version_to_int(ver_str)
            if min_ver is None or ver < min_ver:
                min_ver = ver
                min_ver_str = ver_str

        return min_ver_str
Exemplo n.º 11
0
    def extend_volume(self,
                      ctxt,
                      volume,
                      new_size,
                      reservations,
                      request_spec,
                      filter_properties=None):
        cctxt = self._get_cctxt()
        if not cctxt.can_send_version('3.2'):
            msg = _('extend_volume requires cinder-scheduler '
                    'RPC API version >= 3.2.')
            raise exception.ServiceTooOld(msg)

        request_spec_p = jsonutils.to_primitive(request_spec)
        msg_args = {
            'volume': volume,
            'new_size': new_size,
            'reservations': reservations,
            'request_spec': request_spec_p,
            'filter_properties': filter_properties,
        }

        return cctxt.cast(ctxt, 'extend_volume', **msg_args)