-
Notifications
You must be signed in to change notification settings - Fork 374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dgibson. This looks much better. A couple of suggestions inline. Also, any way to add some further unit tests for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgibson LGTM. Thanks for the diligent refactoring that clarifies the confusions of PCIAddr
vs PCI path
. As the agent side PR is landed, you should be able to rework the first commit and make the TravisCI happy.
Havent been able to spend time reviewing PR's related to device handling lately, but will like to take a closer look at the changes introduced here. |
@amshinde maybe hold off for a bit, I'm looking at doing some reworks based on @jodh-intel's comments next week. |
/test-ubuntu |
/test-vfio |
/test |
/test-vfio |
Codecov Report
@@ Coverage Diff @@
## master #3003 +/- ##
==========================================
+ Coverage 50.24% 50.27% +0.02%
==========================================
Files 119 120 +1
Lines 15794 15849 +55
==========================================
+ Hits 7936 7968 +32
- Misses 6776 6799 +23
Partials 1082 1082 |
Reworking this completely, it now makes much more thorough use of typing. |
⌨️ 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dgibson. A few comments.
virtcontainers/pkg/types/pcipath.go
Outdated
return PciPath{path: slots}, nil | ||
} | ||
|
||
func MakePciPath(slots ...uint8) (PciPath, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this variadic? It seems we only ever pass two values...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, but I have future plans that will change that. With the agent side changes, it will now accept and work with paths of an arbitrary number of elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Conventionally PRs shouldn't do this as you are spreading a feature across multiple PRs which, is cause for potential confusion. Why not just make the function accept 2 params and then the follow-on PR (when written) can change this function to be a variadic since that change is part of the future work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. (a) that seems unnecessarily bureaucratic. (b) I don't think the division you propose is actually conceptually sounder than this one.
What this series is doing - and the first patch in particular - is introducing a data structure which will handle general pci paths to replace the ad-hoc and limited form of pci paths we deal with now. At present we only use one special case of pci paths, but it doesn't seem sensible to artificially limit the data structure just because we don't need the general variant yet.
/test-clh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dgibson. PR looks good to me. I will send follow-up PRs to remove special code path on handling virtio-blk device w/ cloud-hypervisor.
Note: The failure on |
Update the agent code under vendor/, to pull in kata-containers/agent#855. This is a change to the grpc protocol files, but not an actual protocol change, since it's just renaming a field without changing the field number or structure. Shortlog: Archana Shinde (2): Merge pull request #826 from jodh-intel/actions-for-issue-backlog Merge pull request #830 from keloyang/resolv David Gibson (9): device: Index all devices in spec before updating them device: Check type as well as major:minor when looking up devices device: Rename pciDeviceMap in sandbox struct device: Simplify uevent matching in listenToUdevEvents() Merge pull request #849 from dgibson/bug848 device: Rename and clarify semantics of getDevicePCIAddress device: Introduce PciPath type, name things consistently device: Reorganize TestPciPathToSysfs device: Generalize PCI paths to any number of bridges Eric Ernst (2): release: Kata Containers 1.12.0-alpha1 Merge pull request #822 from egernst/1.12.0-alpha1-branch-bump James O. D. Hunt (6): Merge pull request #798 from bpradipt/hook-fix action: Require PR porting labels action: Add issue to project and move to "In progress" on linked PR Merge pull request #828 from jodh-intel/actions-require-pr-porting-labels action: Improve porting checks Merge pull request #836 from dgibson/bug834and835 Julio Montes (2): Merge pull request #844 from jodh-intel/action-improve-porting-checks Merge pull request #855 from dgibson/pcipath Pradipta Kr. Banerjee (1): oci: Fix running of OCI hooks Shukui Yang (1): network: Fix Could not create destination mount point: /etc/resolv.conf Signed-off-by: David Gibson <[email protected]>
/test |
@jodh-intel I've reorganized how I structured the datatype in a way I think should address some of your comments. As a bonus it should be easier to extend for multifunction devices in future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dgibson - just a query on the copyright but other than that...
lgtm
/test |
Is the |
restarting metrics-ci, there is a bug that is messing up docker |
This is a dedicated data type for representing PCI paths, that is, PCI devices described by the slot numbers of the bridges we need to reach them. There are a number of places that uses strings with that structure for things. The plan is to use this data type to consolidate their handling. Signed-off-by: David Gibson <[email protected]>
There's nothing in there which can fail now, but I'm planning to add something, and it turns out it's pretty easy for the single caller to handle. Signed-off-by: David Gibson <[email protected]>
The "PCI address" returned by Endpoint::PciPath() isn't actually a PCI address (DDDD:BB:DD.F), but rather a PCI path. Rename and use the PciPath type to clean this up and the various parts of the network code connected to it. fixes #3002 Signed-off-by: David Gibson <[email protected]>
BlockDrive::PCIAddr doesn't actually store a PCI address (DDDD:BB:DD.F) but a PCI path. Use the PciPath type and rename things to make that clearer. TestHandleBlockVolume() previously used a bizarre value "0002:01" for the "PCI address" which was neither an actual PCI address, nor a PCI path. Update it to use a PCI path - the actual value appears not to matter in this test, as long as its consistent throughout. fixes #3002 Signed-off-by: David Gibson <[email protected]>
VhostUserDeviceAttrs::PCIAddr didn't actually store a PCI address (DDDD:BB:DD.F), but rather a PCI path. Use the PciPath type and rename things to make that clearer. TestHandleBlockVolume previously used the bizarre value "0001:01" which is neither a PCI address nor a PCI path for this value. Change it to a valid PCI path - it appears the actual value didn't matter for that test, as long as it was consistent. fixes #3002 Signed-off-by: David Gibson <[email protected]>
/test |
/retest-vfio |
/retest-metrics |
/retest-ubuntu-qemu-metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @dgibson - lgtm
Hi @dgibson - It looks like this hasn't been ported to 2.x (https://github.com/kata-containers/kata-containers/tree/2.0-dev/src/runtime) yet. Would you be able to look at doing that? |
This addresses issue #3002