-
Notifications
You must be signed in to change notification settings - Fork 275
Rework UVM package to use vm package abstractions #1037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e607aba to
a7af15f
Compare
|
@jstarks After rework galore 😄 There was some recent changes that after rebasing were a pain to handle. Most of the annoyances are in wcow lol. Edit: Ok after consulting with the team, seems like we're all fine with axing the internal connection completely. huzzah, things get prettier. #1038
Here's the biggest thing I want feedback on: https://github.com/microsoft/hcsshim/pull/1037/files#diff-25e9fbfbd912fbf50e566d845edbc79a704c57df49456d8c1c6e2e6c011d8506R8 For the builder (I don't think the same pattern can work for runtime adds) what do you think about building up the document using this pattern of I'd originally made the For instance, instead of: if uvm.scsiControllerCount > 0 {
scsi, ok := uvmb.(vm.SCSIManager)
if !ok {
return nil, errors.Wrap(vm.ErrNotSupported, "stopping SCSI setup")
}
for i := 0; i < int(uvm.scsiControllerCount); i++ {
if err := scsi.AddSCSIController(uint32(i)); err != nil {
return nil, errors.Wrap(err, "failed to add scsi controller")
}
}
}
if uvm.vpmemMaxCount > 0 {
vpmem, ok := uvmb.(vm.VPMemManager)
if !ok {
return nil, errors.Wrap(vm.ErrNotSupported, "stopping VPMem setup")
}
if err := vpmem.AddVPMemController(uvm.vpmemMaxCount, uvm.vpmemMaxSizeBytes); err != nil {
return nil, errors.Wrap(err, "failed to add VPMem controller")
}
}you can have: if uvm.scsiControllerCount > 0 {
for i := 0; i < int(uvm.scsiControllerCount); i++ {
cOpts = append(cOpts, vm.WithSCSIController(uint32(i)))
}
}
if uvm.vpmemMaxCount > 0 {
cOpts = append(cOpts, vm.WithVPMemController(uvm.vpmemMaxCount, uvm.vpmemMaxSizeBytes))
}and the With functions can do the typecasting inside and just call the corresponding method func WithSerialConsole(port uint32, listenerPath string) CreateOpt {
return func(ctx context.Context, uvmb UVMBuilder) error {
serial, ok := uvmb.(SerialManager)
if !ok {
return vm.ErrNotSupported
}
return serial.SetSerialConsole(port, listenerPath)
}
} |
de1f1a2 to
1b9526d
Compare
Rework the UVM package to make use of the abstractions around virtstack interactions. Signed-off-by: Daniel Canter <[email protected]>
|
Just going to draft this, this is so out of date and has fallen off the priority list. |
|
Closing to declutter the PR list view. Will revisit when it's back on the priority list |
Rework the UVM package to make use of the abstractions around virtstack interactions.
Signed-off-by: Daniel Canter [email protected]