# a copy of the License at # # 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. from vsm.api import extensions from vsm.api.openstack import wsgi from vsm.api import xmlutil from vsm import storage authorize = extensions.soft_extension_authorizer('storage', 'storage_tenant_attribute') class HardwareTenantAttributeController(wsgi.Controller): def __init__(self, *args, **kwargs): super(HardwareTenantAttributeController, self).__init__(*args, **kwargs) self.storage_api = storage.API() def _add_storage_tenant_attribute(self, context, resp_storage): try: db_storage = self.storage_api.get(context, resp_storage['id']) except Exception: return else: key = "%s:tenant_id" % Hardware_tenant_attribute.alias resp_storage[key] = db_storage['project_id']
# a copy of the License at # # 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. from vsm.api import extensions from vsm.api.openstack import wsgi from vsm.api import xmlutil from vsm import storage authorize = extensions.soft_extension_authorizer('storage', 'storage_tenant_attribute') class HardwareTenantAttributeController(wsgi.Controller): def __init__(self, *args, **kwargs): super(HardwareTenantAttributeController, self).__init__(*args, **kwargs) self.storage_api = storage.API() def _add_storage_tenant_attribute(self, context, resp_storage): try: db_storage = self.storage_api.get(context, resp_storage['id']) except Exception: return else: key = "%s:tenant_id" % Hardware_tenant_attribute.alias
"""The Extended Snapshot Attributes API extension.""" from webob import exc from vsm.api import extensions from vsm.api.openstack import wsgi from vsm.api import xmlutil from vsm import exception from vsm import flags from vsm.openstack.common import log as logging from vsm import storage FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer( 'storage', 'extended_snapshot_attributes') class ExtendedSnapshotAttributesController(wsgi.Controller): def __init__(self, *args, **kwargs): super(ExtendedSnapshotAttributesController, self).__init__(*args, **kwargs) self.storage_api = storage.API() def _get_snapshots(self, context): snapshots = self.storage_api.get_all_snapshots(context) rval = dict((snapshot['id'], snapshot) for snapshot in snapshots) return rval def _extend_snapshot(self, context, snapshot, data): for attr in ['project_id', 'progress']:
# # 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 Hardware Image Metadata API extension.""" from vsm.api import extensions from vsm.api.openstack import wsgi from vsm.api import xmlutil from vsm import storage authorize = extensions.soft_extension_authorizer('storage', 'storage_image_metadata') class HardwareImageMetadataController(wsgi.Controller): def __init__(self, *args, **kwargs): super(HardwareImageMetadataController, self).__init__(*args, **kwargs) self.storage_api = storage.API() def _add_image_metadata(self, context, resp_storage): try: image_meta = self.storage_api.get_storage_image_metadata( context, resp_storage) except Exception: return else: if image_meta:
# under the License. """The Extended Snapshot Attributes API extension.""" from webob import exc from vsm.api import extensions from vsm.api.openstack import wsgi from vsm.api import xmlutil from vsm import exception from vsm import flags from vsm.openstack.common import log as logging from vsm import storage FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer( 'storage', 'extended_snapshot_attributes') class ExtendedSnapshotAttributesController(wsgi.Controller): def __init__(self, *args, **kwargs): super(ExtendedSnapshotAttributesController, self).__init__(*args, **kwargs) self.storage_api = storage.API() def _get_snapshots(self, context): snapshots = self.storage_api.get_all_snapshots(context) rval = dict((snapshot['id'], snapshot) for snapshot in snapshots) return rval def _extend_snapshot(self, context, snapshot, data): for attr in ['project_id', 'progress']:
# 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 Hardware Image Metadata API extension.""" from vsm.api import extensions from vsm.api.openstack import wsgi from vsm.api import xmlutil from vsm import storage authorize = extensions.soft_extension_authorizer('storage', 'storage_image_metadata') class HardwareImageMetadataController(wsgi.Controller): def __init__(self, *args, **kwargs): super(HardwareImageMetadataController, self).__init__(*args, **kwargs) self.storage_api = storage.API() def _add_image_metadata(self, context, resp_storage): try: image_meta = self.storage_api.get_storage_image_metadata( context, resp_storage) except Exception: return else: if image_meta: resp_storage['storage_image_metadata'] = dict(