do not diff stub devices

when driver device is a stub, skip it.

Change-Id: If1d82efaa601875730d30787022ac6c048c33a98
This commit is contained in:
Shaohe Feng 2019-07-04 12:57:43 +00:00
parent 5e7174f8c9
commit f86ab8dd8a
2 changed files with 8 additions and 4 deletions

View File

@ -150,13 +150,16 @@ class ConductorManager(object):
LOG.info("Start differing devices.")
# TODO:The placement report will be implemented here.
# Use cpid.cpid_info to identify whether the device is the same.
stub_cpid_list = [driver_dev_obj.controlpath_id.cpid_info for
driver_dev_obj in new_driver_device_list
if driver_dev_obj.stub]
new_cpid_list = [driver_dev_obj.controlpath_id.cpid_info for
driver_dev_obj in new_driver_device_list]
old_cpid_list = [driver_dev_obj.controlpath_id.cpid_info for
driver_dev_obj in old_driver_device_list]
same = set(new_cpid_list) & set(old_cpid_list)
added = set(new_cpid_list) - same
deleted = set(old_cpid_list) - same
same = set(new_cpid_list) & set(old_cpid_list) - set(stub_cpid_list)
added = set(new_cpid_list) - same - set(stub_cpid_list)
deleted = set(old_cpid_list) - same - set(stub_cpid_list)
for s in same:
# get the driver_dev_obj, diff the driver_device layer
new_driver_dev_obj = new_driver_device_list[new_cpid_list.index(s)]

View File

@ -46,7 +46,8 @@ class DriverDevice(base.DriverObjectBase,
nullable=False),
'deployable_list': object_fields.ListOfObjectsField('DriverDeployable',
default=[],
nullable=False)
nullable=False),
'stub': object_fields.BooleanField(nullable=False, default=False)
}
def create(self, context, host):