# # 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 monitor.api import extensions from monitor.api.openstack import wsgi from monitor.api import xmlutil from monitor.openstack.common import log as logging from monitor import servicemanage LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer('servicemanage', 'servicemanage_host_attribute') class ServiceManageHostAttributeController(wsgi.Controller): def __init__(self, *args, **kwargs): super(ServiceManageHostAttributeController, self).__init__(*args, **kwargs) self.servicemanage_api = servicemanage.API() def _add_servicemanage_host_attribute(self, context, resp_servicemanage): try: db_servicemanage = self.servicemanage_api.get(context, resp_servicemanage['id']) except Exception: return else: key = "%s:host" % ServiceManage_host_attribute.alias resp_servicemanage[key] = db_servicemanage['host']
# 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 monitor.api import extensions from monitor.api.openstack import wsgi from monitor.api import xmlutil from monitor.openstack.common import log as logging from monitor import servicemanage LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer( 'servicemanage', 'servicemanage_host_attribute') class ServiceManageHostAttributeController(wsgi.Controller): def __init__(self, *args, **kwargs): super(ServiceManageHostAttributeController, self).__init__(*args, **kwargs) self.servicemanage_api = servicemanage.API() def _add_servicemanage_host_attribute(self, context, resp_servicemanage): try: db_servicemanage = self.servicemanage_api.get( context, resp_servicemanage['id']) except Exception: return else:
# under the License. """The Extended Snapshot Attributes API extension.""" from webob import exc from monitor.api import extensions from monitor.api.openstack import wsgi from monitor.api import xmlutil from monitor import exception from monitor import flags from monitor.openstack.common import log as logging from monitor import servicemanage FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer( 'servicemanage', 'extended_snapshot_attributes') class ExtendedSnapshotAttributesController(wsgi.Controller): def __init__(self, *args, **kwargs): super(ExtendedSnapshotAttributesController, self).__init__(*args, **kwargs) self.servicemanage_api = servicemanage.API() def _get_snapshots(self, context): snapshots = self.servicemanage_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']:
from webob import exc from monitor.api import extensions from monitor.api.openstack import wsgi from monitor.api import xmlutil from monitor import exception from monitor import flags from monitor.openstack.common import log as logging from monitor import servicemanage FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer( 'servicemanage', 'extended_snapshot_attributes') class ExtendedSnapshotAttributesController(wsgi.Controller): def __init__(self, *args, **kwargs): super(ExtendedSnapshotAttributesController, self).__init__(*args, **kwargs) self.servicemanage_api = servicemanage.API() def _get_snapshots(self, context): snapshots = self.servicemanage_api.get_all_snapshots(context) rval = dict((snapshot['id'], snapshot) for snapshot in snapshots) return rval def _extend_snapshot(self, context, snapshot, data):