>>> Cole Robinson <[email protected]> 08/16/14 1:25 AM >>>
......
> I'd like to see this arranged in a bit different way. We already have similar
> code to match a hostdev to its nodedev in details.py:lookup_nodedev. Please
> move that code to a function like nodedev.py NodeDevice.compare_to_nodedev,
> then you can even separate the logic and implement the function in PCIDevice,
> USBDevice, etc. Bonus points for unit tests in tests/nodedev.py. That'll be
> one patch

I'll use NodeDevice.compare_to_nodedev instead of 
VirtualHostDevice.is_conflict_hostdev function.
In compare_to_nodedev function, I'll iterate all of hostdevs of all of vms, 
call lookup_nodedev for every 
hostdev to get the matched nodedev, Compare this nodedev with the passed 
nodedev which representing
the pci/usb device that users picked up while adding hardware.(put the 
comparson logic in PCIDevice 
and USBDevice)

 
> You'll still need details.py:lookup_nodedev to iterate over all the
> nodedevices and compare against the passed hostdev, but the comparison logic
> will be removed.

Do you mean I should use the code of lookup_nodedev function in 
compare_to_nodedev function?
If so, why ? If you want to make the comparson happens between nodedev and 
nodedev, Just calling
lookup_nodedev function to get the matched nodedev and comparing this nodedev 
with passed nodedev, just like what 
I mentioned above.

If you want to make the comparson happens between nodedev and hostdev, Just 
comparing the nodedev attributes with
the hostdev attributes, In this situation, We don't need the code of 
lookup_nodedev or calling lookup_nodedev, 
We don't need to iterate over all the nodedevices, We need to iterate all the 
hostdevices in all the vms, and compare against the 
given/passed nodedev.

What do you think?

Thanks,
Lin


_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to