"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cyborg/objects/ext_arq.py" between
openstack-cyborg-6.0.0.tar.gz and openstack-cyborg-7.0.0.tar.gz

About: OpenStack Cyborg provides a general purpose management framework for acceleration resources.
The "Xena" series (latest release).

ext_arq.py  (openstack-cyborg-6.0.0):ext_arq.py  (openstack-cyborg-7.0.0)
skipping to change at line 132 skipping to change at line 132
if self.arq.state == state: if self.arq.state == state:
LOG.info("ExtARQ(%s) state is %s, no need to update", LOG.info("ExtARQ(%s) state is %s, no need to update",
self.arq.uuid, state) self.arq.uuid, state)
return False return False
old = self.arq.state old = self.arq.state
scope = scope or ARQ_STATES_TRANSFORM_MATRIX[state] scope = scope or ARQ_STATES_TRANSFORM_MATRIX[state]
self.update_state(context, state, scope) self.update_state(context, state, scope)
ea = ExtARQ.get(context, self.arq.uuid, lock=True) ea = ExtARQ.get(context, self.arq.uuid, lock=True)
if not ea: if not ea:
raise exception.ResourceNotFound( raise exception.ResourceNotFound(
"Can not find ExtARQ(%s)" % self.arq.uuid) resources='ExtARQ',
msg="Can not find ExtARQ(%s)" % self.arq.uuid)
current = ea.arq.state current = ea.arq.state
if state != current: if state != current:
msg = ("Failed to change ARQ state from %s to %s, the current " msg = ("Failed to change ARQ state from %s to %s, the current "
"state is %s" % (old, state, current)) "state is %s" % (old, state, current))
LOG.error(msg) LOG.error(msg)
raise exception.ARQBadState( raise exception.ARQBadState(
state=current, uuid=self.arq.uuid, expected=list(state)) state=current, uuid=self.arq.uuid, expected=list(state))
return True return True
def destroy(self, context): def destroy(self, context):
"""Delete an ExtARQ from the DB.""" """Delete an ExtARQ from the DB."""
self.dbapi.extarq_delete(context, self.arq.uuid) self.dbapi.extarq_delete(context, self.arq.uuid)
self.obj_reset_changes() self.obj_reset_changes()
@classmethod @classmethod
def delete_by_uuid(cls, context, arq_uuid_list): def delete_by_uuid(cls, context, arq_uuid_list):
"""Delete a list of ARQs based on their UUIDs. """Delete a list of ARQs based on their UUIDs.
This is not idempotent, i.e., if the first call to delete an This is not idempotent, i.e., if the first call to delete an
ARQ has succeeded, second and later calls to delete the same ARQ ARQ has succeeded, second and later calls to delete the same ARQ
will get errored out. will get errored out, but it will raise the exception only after
all input arq being operated.
""" """
unexisted = []
for uuid in arq_uuid_list: for uuid in arq_uuid_list:
obj_extarq = objects.ExtARQ.get(context, uuid) try:
# TODO() Defer deletion to conductor obj_extarq = objects.ExtARQ.get(context, uuid)
if obj_extarq.arq.state != constants.ARQ_INITIAL: # TODO() Defer deletion to conductor
obj_extarq.unbind(context) if obj_extarq.arq.state != constants.ARQ_INITIAL:
obj_extarq.destroy(context) obj_extarq.unbind(context)
obj_extarq.destroy(context)
except exception.ResourceNotFound:
unexisted.append(uuid)
continue
if unexisted:
LOG.warning('There are unexisted arqs: %s', unexisted)
raise exception.ResourceNotFound(
resource='ARQ',
msg='with uuids %s' % unexisted)
@classmethod @classmethod
def delete_by_instance(cls, context, instance_uuid): def delete_by_instance(cls, context, instance_uuid):
"""Delete all ARQs for given instance. """Delete all ARQs for given instance.
This is idempotent, i.e., it would have the same effect if called This is idempotent, i.e., it would have the same effect if called
repeatedly with the same instance UUID. In other words, it would repeatedly with the same instance UUID. In other words, it would
not raise an error on the second and later attempts even if the not raise an error on the second and later attempts even if the
first one has deleted the ARQs. first one has deleted the ARQs.
""" """
skipping to change at line 250 skipping to change at line 262
db_extarq['attach_handle_type'] = '' db_extarq['attach_handle_type'] = ''
db_extarq['attach_handle_info'] = '' db_extarq['attach_handle_info'] = ''
if db_extarq['state'] == 'Bound': # TODO() Do proper bind if db_extarq['state'] == 'Bound': # TODO() Do proper bind
db_ah = cls.dbapi.attach_handle_get_by_id( db_ah = cls.dbapi.attach_handle_get_by_id(
context, db_extarq['attach_handle_id']) context, db_extarq['attach_handle_id'])
if db_ah is not None: if db_ah is not None:
db_extarq['attach_handle_type'] = db_ah['attach_type'] db_extarq['attach_handle_type'] = db_ah['attach_type']
db_extarq['attach_handle_info'] = db_ah['attach_info'] db_extarq['attach_handle_info'] = db_ah['attach_info']
else: else:
raise exception.ResourceNotFound( raise exception.ResourceNotFound(
resource='attach handle', resource='Attach Handle',
msg='') msg='with uuid=%s' % db_extarq['attach_handle_id'])
if db_extarq['deployable_id']: if db_extarq['deployable_id']:
dep = objects.Deployable.get_by_id(db_extarq['deployable_id']) dep = objects.Deployable.get_by_id(db_extarq['deployable_id'])
db_extarq['deployable_uuid'] = dep.uuid db_extarq['deployable_uuid'] = dep.uuid
else: else:
LOG.debug('Setting deployable UUID to zeroes for db_extarq %s', LOG.debug('Setting deployable UUID to zeroes for db_extarq %s',
db_extarq['uuid']) db_extarq['uuid'])
db_extarq['deployable_uuid'] = ( db_extarq['deployable_uuid'] = (
'00000000-0000-0000-0000-000000000000') '00000000-0000-0000-0000-000000000000')
 End of changes. 5 change blocks. 
9 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)