"""The volume types encryption extension.""" import webob from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.db import storage as db from jacket.storage import exception from jacket.storage.i18n import _ from jacket import rpc from jacket.storage import utils from jacket.storage.volume import volume_types authorize = extensions.extension_authorizer('volume', 'volume_type_encryption') CONTROL_LOCATION = ['front-end', 'back-end'] class VolumeTypeEncryptionTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.make_flat_dict('encryption', selector='encryption') return xmlutil.MasterTemplate(root, 1) class VolumeTypeEncryptionController(wsgi.Controller): """The volume type encryption API controller for the OpenStack API.""" def _get_volume_type_encryption(self, context, type_id): encryption_ref = db.volume_type_encryption_get(context, type_id)
def authorize(self, context, action_name): # e.g. "snapshot_admin_actions:reset_status" action = '%s_admin_actions:%s' % (self.resource_name, action_name) extensions.extension_authorizer('volume', action)(context)
def authorize(context, action_name): action = 'snapshot_actions:%s' % action_name extensions.extension_authorizer('snapshot', action)(context)
import webob from jacket.api.storage import common from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage.views import qos_specs as view_qos_specs from jacket.api.storage import xmlutil from jacket.storage import exception from jacket.storage.i18n import _, _LI from jacket import rpc from jacket.storage import utils from jacket.storage.volume import qos_specs LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('volume', 'qos_specs_manage') def make_qos_specs(elem): elem.set('id') elem.set('name') elem.set('consumer') elem.append(SpecsTemplate()) def make_associations(elem): elem.set('association_type') elem.set('name') elem.set('id')
def authorize(context, action_name): extensions.extension_authorizer('volume', action_name)(context)
from jacket.db.storage.sqlalchemy import api as sqlalchemy_api from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage import quota from jacket.storage import quota_utils from jacket.storage import utils from oslo_config import cfg from oslo_utils import strutils CONF = cfg.CONF QUOTAS = quota.QUOTAS NON_QUOTA_KEYS = ['tenant_id', 'id'] authorize_update = extensions.extension_authorizer('volume', 'quotas:update') authorize_show = extensions.extension_authorizer('volume', 'quotas:show') authorize_delete = extensions.extension_authorizer('volume', 'quotas:delete') class QuotaTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('quota_set', selector='quota_set') root.set('id') for resource in QUOTAS.resources: elem = xmlutil.SubTemplateElement(root, resource) elem.text = resource return xmlutil.MasterTemplate(root, 1)
from oslo_utils import uuidutils import six import webob from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage.volume import volume_types soft_authorize = extensions.soft_extension_authorizer('volume', 'volume_type_access') authorize = extensions.extension_authorizer('volume', 'volume_type_access') def make_volume_type(elem): elem.set('{%s}is_public' % Volume_type_access.namespace, '%s:is_public' % Volume_type_access.alias) def make_volume_type_access(elem): elem.set('volume_type_id') elem.set('project_id') class VolumeTypeTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('volume_type', selector='volume_type')
def authorize(context, action_name): action = 'volume_actions:%s' % action_name extensions.extension_authorizer('volume', action)(context)
from jacket.db import storage as db from jacket.db.storage.sqlalchemy import api as sqlalchemy_api from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage import quota from jacket.storage import quota_utils from jacket.storage import utils from oslo_config import cfg from oslo_utils import strutils CONF = cfg.CONF QUOTAS = quota.QUOTAS NON_QUOTA_KEYS = ['tenant_id', 'id'] authorize_update = extensions.extension_authorizer('volume', 'quotas:update') authorize_show = extensions.extension_authorizer('volume', 'quotas:show') authorize_delete = extensions.extension_authorizer('volume', 'quotas:delete') class QuotaTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('quota_set', selector='quota_set') root.set('id') for resource in QUOTAS.resources: elem = xmlutil.SubTemplateElement(root, resource) elem.text = resource return xmlutil.MasterTemplate(root, 1)
"""The volume type access extension.""" from oslo_utils import uuidutils import six import webob from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage.volume import volume_types soft_authorize = extensions.soft_extension_authorizer('volume', 'volume_type_access') authorize = extensions.extension_authorizer('volume', 'volume_type_access') def make_volume_type(elem): elem.set('{%s}is_public' % Volume_type_access.namespace, '%s:is_public' % Volume_type_access.alias) def make_volume_type_access(elem): elem.set('volume_type_id') elem.set('project_id') class VolumeTypeTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('volume_type', selector='volume_type')
def authorize(context, action_name): action = 'scheduler_stats:%s' % action_name extensions.extension_authorizer('scheduler', action)(context)
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_log import log as logging import webob from webob import exc from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.storage import exception from jacket.storage.i18n import _LI from jacket.storage import volume LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('volume', 'volume_unmanage') class VolumeUnmanageController(wsgi.Controller): def __init__(self, *args, **kwargs): super(VolumeUnmanageController, self).__init__(*args, **kwargs) self.volume_api = volume.API() @wsgi.response(202) @wsgi.action('os-unmanage') def unmanage(self, req, id, body): """Stop managing a volume. This action is very much like a delete, except that a different method (unmanage) is called on the Cinder driver. This has the effect of removing the volume from Cinder management without actually
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """The volume encryption metadata extension.""" from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.db import storage as db authorize = extensions.extension_authorizer('volume', 'volume_encryption_metadata') class VolumeEncryptionMetadataTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.make_flat_dict('encryption', selector='encryption') return xmlutil.MasterTemplate(root, 1) class VolumeEncryptionMetadataController(wsgi.Controller): """The volume encryption metadata API extension.""" @wsgi.serializers(xml=VolumeEncryptionMetadataTemplate) def index(self, req, volume_id): """Returns the encryption metadata for a given volume.""" context = req.environ['storage.context']
from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.db import storage as db from jacket.storage import exception from jacket.storage.i18n import _, _LI from jacket.objects import storage from jacket import objects from jacket.storage import utils from jacket.storage.volume import api as volume_api CONF = cfg.CONF LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('volume', 'hosts') class HostIndexTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('hosts') elem = xmlutil.SubTemplateElement(root, 'host', selector='hosts') elem.set('service-status') elem.set('service') elem.set('zone') elem.set('service-state') elem.set('host_name') elem.set('last-update') return xmlutil.MasterTemplate(root, 1)
from oslo_log import log as logging from oslo_utils import uuidutils from webob import exc from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage.v2.views import volumes as volume_views from jacket.api.storage.v2 import volumes from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage import utils from jacket.storage import volume as cinder_volume from jacket.storage.volume import volume_types LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('volume', 'volume_manage') class VolumeManageController(wsgi.Controller): """The /os-volume-manage controller for the OpenStack API.""" _view_builder_class = volume_views.ViewBuilder def __init__(self, *args, **kwargs): super(VolumeManageController, self).__init__(*args, **kwargs) self.volume_api = cinder_volume.API() @wsgi.response(202) @wsgi.serializers(xml=volumes.VolumeTemplate) @wsgi.deserializers(xml=volumes.CreateDeserializer) def create(self, req, body):
# under the License. import webob from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.db import storage as db from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage import quota from jacket.storage import utils QUOTAS = quota.QUOTAS authorize = extensions.extension_authorizer('volume', 'quota_classes') class QuotaClassTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('quota_class_set', selector='quota_class_set') root.set('id') for resource in QUOTAS.resources: elem = xmlutil.SubTemplateElement(root, resource) elem.text = resource return xmlutil.MasterTemplate(root, 1)
from oslo_config import cfg from oslo_log import log as logging from webob import exc from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage.v2 import snapshots from jacket.api.storage.views import snapshots as snapshot_views from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage import volume as cinder_volume LOG = logging.getLogger(__name__) CONF = cfg.CONF authorize = extensions.extension_authorizer('snapshot', 'snapshot_manage') class SnapshotManageController(wsgi.Controller): """The /os-snapshot-manage controller for the OpenStack API.""" _view_builder_class = snapshot_views.ViewBuilder def __init__(self, *args, **kwargs): super(SnapshotManageController, self).__init__(*args, **kwargs) self.volume_api = cinder_volume.API() @wsgi.response(202) @wsgi.serializers(xml=snapshots.SnapshotTemplate) def create(self, req, body): """Instruct Cinder to manage a storage snapshot object.
import webob from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.db import storage as db from jacket.storage import exception from jacket.storage.i18n import _ from jacket.storage import quota from jacket.storage import utils QUOTAS = quota.QUOTAS authorize = extensions.extension_authorizer('volume', 'quota_classes') class QuotaClassTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('quota_class_set', selector='quota_class_set') root.set('id') for resource in QUOTAS.resources: elem = xmlutil.SubTemplateElement(root, resource) elem.text = resource return xmlutil.MasterTemplate(root, 1)
"""The volume types manage extension.""" import six import webob from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage.v1 import types from jacket.api.storage.views import types as views_types from jacket.storage import exception from jacket.storage.i18n import _ from jacket import rpc from jacket.storage import utils from jacket.storage.volume import volume_types authorize = extensions.extension_authorizer('volume', 'types_manage') class VolumeTypesManageController(wsgi.Controller): """The volume types API controller for the OpenStack API.""" _view_builder_class = views_types.ViewBuilder def _notify_volume_type_error(self, context, method, err, volume_type=None, id=None, name=None): payload = dict(volume_types=volume_type,
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """The volume encryption metadata extension.""" from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage import xmlutil from jacket.db import storage as db authorize = extensions.extension_authorizer('volume', 'volume_encryption_metadata') class VolumeEncryptionMetadataTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.make_flat_dict('encryption', selector='encryption') return xmlutil.MasterTemplate(root, 1) class VolumeEncryptionMetadataController(wsgi.Controller): """The volume encryption metadata API extension.""" @wsgi.serializers(xml=VolumeEncryptionMetadataTemplate) def index(self, req, volume_id): """Returns the encryption metadata for a given volume.""" context = req.environ['storage.context'] authorize(context)
from jacket.api.storage import common from jacket.api.storage import extensions from jacket.api.storage.openstack import wsgi from jacket.api.storage.views import qos_specs as view_qos_specs from jacket.api.storage import xmlutil from jacket.storage import exception from jacket.storage.i18n import _, _LI from jacket import rpc from jacket.storage import utils from jacket.storage.volume import qos_specs LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('volume', 'qos_specs_manage') def make_qos_specs(elem): elem.set('id') elem.set('name') elem.set('consumer') elem.append(SpecsTemplate()) def make_associations(elem): elem.set('association_type') elem.set('name') elem.set('id')