ext_arq_job.py (openstack-cyborg-6.0.0) | : | ext_arq_job.py (openstack-cyborg-7.0.0) | ||
---|---|---|---|---|
skipping to change at line 58 | skipping to change at line 58 | |||
"""From the inherit subclass find the suitable ExtARQ.""" | """From the inherit subclass find the suitable ExtARQ.""" | |||
extarq = cls.get(context, uuid) | extarq = cls.get(context, uuid) | |||
typ = extarq.get_resources_from_device_profile_group() | typ = extarq.get_resources_from_device_profile_group() | |||
factory = cls.factory(typ) | factory = cls.factory(typ) | |||
if factory != cls: | if factory != cls: | |||
return factory.get(context, uuid) | return factory.get(context, uuid) | |||
return extarq | return extarq | |||
def start_bind_job(self, context, valid_fields): | def start_bind_job(self, context, valid_fields): | |||
"""Check and start bind jobs for ARQ.""" | """Check and start bind jobs for ARQ.""" | |||
# Check can ARC be bound. | ||||
expected = ARQ_STATES_TRANSFORM_MATRIX[constants.ARQ_BIND_STARTED] | expected = ARQ_STATES_TRANSFORM_MATRIX[constants.ARQ_BIND_STARTED] | |||
# Check whether ARQ can be bound. | ||||
if self.arq.state not in expected: | if self.arq.state not in expected: | |||
raise exception.ARQBadState( | raise exception.ARQBadState( | |||
state=self.arq.state, uuid=self.arq.uuid, expected=expected) | state=self.arq.state, uuid=self.arq.uuid, expected=expected) | |||
hostname = valid_fields[self.arq.uuid]['hostname'] | hostname = valid_fields[self.arq.uuid]['hostname'] | |||
devrp_uuid = valid_fields[self.arq.uuid]['device_rp_uuid'] | devrp_uuid = valid_fields[self.arq.uuid]['device_rp_uuid'] | |||
instance_uuid = valid_fields[self.arq.uuid]['instance_uuid'] | instance_uuid = valid_fields[self.arq.uuid]['instance_uuid'] | |||
project_id = valid_fields[self.arq.uuid].get('project_id') | project_id = valid_fields[self.arq.uuid].get('project_id') | |||
LOG.info('[arqs:objs] bind. hostname: %(hostname)s, ' | LOG.info('[arqs:objs] bind. hostname: %(hostname)s, ' | |||
'devrp_uuid: %(devrp_uuid)s, ' | 'devrp_uuid: %(devrp_uuid)s, ' | |||
skipping to change at line 239 | skipping to change at line 239 | |||
def apply_patch(cls, context, patch_list, valid_fields): | def apply_patch(cls, context, patch_list, valid_fields): | |||
"""Apply JSON patch. See api/controllers/v2/arqs.py.""" | """Apply JSON patch. See api/controllers/v2/arqs.py.""" | |||
arq_binds = {} | arq_binds = {} | |||
for arq_uuid, patch in patch_list.items(): | for arq_uuid, patch in patch_list.items(): | |||
extarq = cls.get_suitable_ext_arq(context, arq_uuid) | extarq = cls.get_suitable_ext_arq(context, arq_uuid) | |||
if patch[0]['op'] == 'add': # All ops are 'add' | if patch[0]['op'] == 'add': # All ops are 'add' | |||
# arq_notify_list.append(arq_uuid) | # arq_notify_list.append(arq_uuid) | |||
job = extarq.start_bind_job(context, valid_fields) | job = extarq.start_bind_job(context, valid_fields) | |||
arq_binds[extarq] = job | arq_binds[extarq] = job | |||
else: | else: | |||
extarq.unbind(context, extarq) | extarq.unbind(context) | |||
if arq_binds: | if arq_binds: | |||
cls.master(context, arq_binds) | cls.master(context, arq_binds) | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |