Ejemplo n.º 1
0
    def volume_context(self):
        # provide basic validation that the volume manager is supported on the
        # given openstack release (nova-volume is only supported for E and F)
        # it is up to release templates to set the correct volume driver.
        if not self.volume_service:
            return {}

        # ensure volume service is supported on specific openstack release.
        if self.volume_service == 'cinder':
            return 'cinder'
        else:
            e = ('Invalid volume service received via cloud-compute: %s' %
                 self.volume_service)
            log(e, level=ERROR)
            raise context.OSContextError(e)
Ejemplo n.º 2
0
    def __call__(self):
        ctxt = {}

        if relation_ids('nova-volume-service'):
            if utils.os_release('nova-common') not in ['essex', 'folsom']:
                e = ('Attempting to relate a nova-volume service to an '
                     'Nova version (%s).  Use cinder.')
                log(e, level=ERROR)

                raise context.OSContextError(e)
            install_pkg = filter_installed_packages(['nova-api-os-volume'])
            if install_pkg:
                apt_install(install_pkg)
            ctxt['volume_service'] = 'nova-volume'
        elif relation_ids('cinder-volume-service'):
            ctxt['volume_service'] = 'cinder'
            # kick all compute nodes to know they should use cinder now.
            [
                relation_set(relation_id=rid, volume_service='cinder')
                for rid in relation_ids('cloud-compute')
            ]
        return ctxt