def save(self): updates = self.masakari_obj_get_changes() if 'failover_segment' in updates: raise exception.ObjectActionError(action='save', reason='failover segment ' 'changed') updates.pop('id', None) db_host = db.host_update(self._context, self.uuid, updates) self._from_db_object(self._context, self, db_host)
def save(self): updates = self.masakari_obj_get_changes() if 'failover_segment' in updates: raise exception.ObjectActionError(action='save', reason='failover segment ' 'changed') updates.pop('id', None) db_host = db.host_update(self._context, self.uuid, updates) self._from_db_object(self._context, self, db_host)
def test_host_update(self): update = {'name': 'updated_name', 'type': 'updated_type'} updated = {'uuid': uuidsentinel.fake_uuid, 'name': 'updated_name', 'reserved': True, 'type': 'updated_type', 'control_attributes': 'fake_control_attr', 'failover_segment': self.failover_segment, 'failover_segment_id': uuidsentinel.failover_segment_id, 'on_maintenance': True} ignored_keys = ['deleted', 'created_at', 'updated_at', 'deleted_at', 'id', 'failover_segment'] self._create_host(self._get_fake_values()) db.host_update(self.ctxt, uuidsentinel.fake_uuid, update) host_updated = db.host_get_by_uuid(self.ctxt, uuidsentinel.fake_uuid) self._assertEqualObjects(updated, host_updated, ignored_keys) self.assertEqual(updated['failover_segment'].items(), host_updated['failover_segment'].items())
def save(self): updates = self.masakari_obj_get_changes() if 'failover_segment' in updates: raise exception.ObjectActionError(action='save', reason='failover segment ' 'changed') updates.pop('id', None) api_utils.notify_about_host_api(self._context, self, action=fields.EventNotificationAction.HOST_UPDATE, phase=fields.EventNotificationPhase.START) db_host = db.host_update(self._context, self.uuid, updates) api_utils.notify_about_host_api(self._context, self, action=fields.EventNotificationAction.HOST_UPDATE, phase=fields.EventNotificationPhase.END) self._from_db_object(self._context, self, db_host)
def save(self): updates = self.masakari_obj_get_changes() if 'failover_segment' in updates: raise exception.ObjectActionError(action='save', reason='failover segment ' 'changed') updates.pop('id', None) api_utils.notify_about_host_api( self._context, self, action=fields.EventNotificationAction.HOST_UPDATE, phase=fields.EventNotificationPhase.START) db_host = db.host_update(self._context, self.uuid, updates) api_utils.notify_about_host_api( self._context, self, action=fields.EventNotificationAction.HOST_UPDATE, phase=fields.EventNotificationPhase.END) self._from_db_object(self._context, self, db_host)