Ejemplo n.º 1
0
 def update_hosting_device(self, context, id, hosting_device):
     LOG.debug("update_hosting_device() called")
     hd = hosting_device['hosting_device']
     with context.session.begin(subtransactions=True):
         #TODO(bobmel): handle tenant_bound changes
         hd_query = context.session.query(hd_models.HostingDevice)
         if not hd_query.filter_by(id=id).update(hd):
             raise ciscohostingdevicemanager.HostingDeviceNotFound(id=id)
         #TODO(bobmel): notify_agent on changes to credentials,
         # admin_state_up, tenant_bound
     return self.get_hosting_device(context, id)
Ejemplo n.º 2
0
 def delete_hosting_device(self, context, id):
     LOG.debug("delete_hosting_device() called")
     try:
         with context.session.begin(subtransactions=True):
             hd_query = context.session.query(hd_models.HostingDevice)
             if not hd_query.filter_by(id=id).delete():
                 raise ciscohostingdevicemanager.HostingDeviceNotFound(
                     id=id)
     except db_exc.DBError as e:
         with excutils.save_and_reraise_exception() as ctxt:
             if isinstance(e.inner_exception, sql_exc.IntegrityError):
                 ctxt.reraise = False
                 raise ciscohostingdevicemanager.HostingDeviceInUse(id=id)
Ejemplo n.º 3
0
 def _get_hosting_device(self, context, id):
     try:
         return self._get_by_id(context, hd_models.HostingDevice, id)
     except exc.NoResultFound:
         raise ciscohostingdevicemanager.HostingDeviceNotFound(id=id)