[shimV2] [VM controller] refactor + adds Update + Device controllers#2663
[shimV2] [VM controller] refactor + adds Update + Device controllers#2663rawahars wants to merge 5 commits intomicrosoft:mainfrom
Conversation
| ID string | ||
|
|
||
| // HCSDocument specifies the HCS schema document used to create the VM. | ||
| HCSDocument *hcsschema.ComputeSystem |
There was a problem hiding this comment.
Note to self, I would have imagined the Create call is what makes this. How does the caller have it for create opts?
There was a problem hiding this comment.
So we build the document in the service layer and pass it along to the VM controller.
Ref-
There was a problem hiding this comment.
Hmm. Lets chat on this one. I'm not sure
| // NetworkController returns a new controller for managing network devices on the VM. | ||
| // Since we have a namespace per pod, we create a new controller per call. | ||
| func (c *Controller) NetworkController() *network.Controller { | ||
| return network.New(c.uvm, c.guest, c.guest) |
There was a problem hiding this comment.
New? Why not same one each time?
There was a problem hiding this comment.
So networking is local to each pod i.e. each pod has exactly one network namespace and associated endpoints in them. Therefore, it seemed more natural to have a new controller for each pod which controlled per-pod settings.
Device controllers such as SCSI or Plan9 are different since they need holistic view of the VM for vm-host side allocation as well as guest side mount paths.
There was a problem hiding this comment.
Hmm. Lets chat on this one too
|
|
||
| // Iterate over the well-known controller GUIDs so the slice index gives us | ||
| // the correct controller number directly. | ||
| for ctrlIdx, guid := range guestrequest.ScsiControllerGuids { |
There was a problem hiding this comment.
I dont get this? Are you saying we force all controllers to have the same guid?
There was a problem hiding this comment.
Yes, we can have maximum 4 SCSI controllers and each has a specific GUID.
Reference-
There was a problem hiding this comment.
I still dont get it. Why cant you just do doc.devices.scsi[guid]; !ok thats an empty guid you can allocate
There was a problem hiding this comment.
If we iterated over the map directly, we'd have the GUID but not the controller number. We'd then need to reverse-lookup the index in ScsiControllerGuids for every GUID.
Honestly, this is because we use controller index which is an index into guestrequest.ScsiControllerGuids. We could have used controller GUIDs directly, but then slotting logic would have became complicated.
59b1602 to
50bcc09
Compare
Following the shim V2 standard, we are declaring the interfaces at the place where the APIs are used. Therefore, we are deleting all the interfaces from the existing packages. Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
In this commit, we are refactoring the vm controller to bring it to the same standard as rest of the controllers. Additionally, we are adding- - Update functionality - RuntimeID API - APIs to obtain device controllers Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
c66dd9d to
16ce43e
Compare
16ce43e to
00c98b1
Compare
|
Rebased the PR to mainline which should eliminate PR checks. The added changes are for unblocking CI errors. |
Summary
In this change, we are adding the following changes-
Additionally, we are adding-
RuntimeIDAPI to return the HCS compute IDlcowbuilds