def disable_subcloud(self, context, subcloud_name):
     try:
         subcloud_engine = self.subcloud_engines[subcloud_name]
         LOG.info('disabling subcloud %(sc)s' % {'sc': subcloud_name})
         subcloud_engine.disable()
     except KeyError:
         raise exceptions.SubcloudNotFound(region_name=subcloud_name)
 def update_subcloud_version(self, context, subcloud_name, sw_version):
     try:
         subcloud_engine = self.subcloud_engines[subcloud_name]
         LOG.info('updating subcloud %(sc)s version to %(ver)s' % {
             'sc': subcloud_name,
             'ver': sw_version
         })
         subcloud_engine.set_version(sw_version)
     except KeyError:
         raise exceptions.SubcloudNotFound(region_name=subcloud_name)
Beispiel #3
0
def subcloud_delete(context, region_name):
    with write_session() as session:
        subclouds = session.query(models.Subcloud). \
            filter_by(deleted=0). \
            filter_by(region_name=region_name). \
            all()
        if subclouds:
            for subcloud_ref in subclouds:
                session.delete(subcloud_ref)
        else:
            raise exception.SubcloudNotFound(region_name=region_name)
Beispiel #4
0
def _subcloud_alarms_get(context, region_id, session=None):
    query = model_query(context, models.SubcloudAlarmSummary, session=session). \
        filter_by(deleted=0)
    query = add_identity_filter(query, region_id, use_region_name=True)

    try:
        return query.one()
    except NoResultFound:
        raise exception.SubcloudNotFound(region_name=region_id)
    except MultipleResultsFound:
        raise exception.InvalidParameterValue(
            err="Multiple entries found for subcloud %s" % region_id)