-
Notifications
You must be signed in to change notification settings - Fork 264
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
Initial support for creating confidential windows UtilityVMs #2388
base: main
Are you sure you want to change the base?
Conversation
Currently WCOW UVM only support booting with VmbFS and legacy layers. However, we are adding support for booting the UVM with BlockCIM layers. This commit updates the WCOWBootFiles struct to support different boot configurations. Signed-off-by: Amit Barve <ambarve@microsoft.com>
Initial changes to allow creating confidential WCOW UVMs. uvmboot tool is also updated for easier command line testing of confidential UVMs. Signed-off-by: Amit Barve <ambarve@microsoft.com>
@@ -0,0 +1,5 @@ | |||
package hcsschema | |||
|
|||
type FirmwareFile struct { |
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.
can you add a note saying this is experimental?
} else { | ||
return fmt.Errorf("invalid boot type specified") | ||
} | ||
return nil |
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.
} else { | |
return fmt.Errorf("invalid boot type specified") | |
} | |
return nil | |
} | |
return fmt.Errorf("invalid boot type specified: %s", bootFiles.BootType) |
might be cleaner overall as:
switch bootFiles.BootType {
case VmbFSBoot:
// ...
case BlockCIMBoot:
// ...
default:
}
return fmt.Errorf("invalid boot type specified: %s", bootFiles.BootType)
ConsolePipe string // The named pipe path to use for the serial console (COM1). eg \\.\pipe\vmpipe | ||
} | ||
|
||
func verifyWCOWBootFiles(bootFiles *WCOWBootFiles) 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.
maybe make this a method and move it to create_wcow.go
?
func verifyWCOWBootFiles(bootFiles *WCOWBootFiles) error { | |
func (bf *WCOWBootFiles) verify() error { | |
if bf == nil { return nil } | |
// ... |
@@ -156,6 +178,12 @@ func verifyOptions(_ context.Context, options interface{}) error { | |||
if opts.SCSIControllerCount != 1 { | |||
return errors.New("exactly 1 SCSI controller is required for WCOW") | |||
} | |||
if err := verifyWCOWBootFiles(opts.BootFiles); err != nil { |
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.
may also want to have a nil
check here, just in case someone did something funky with the options
// UVM. gcsServiceID can either be the service ID of the default GCS that is present in | ||
// all UtilityVMs or it can be the service ID of the sidecar GCS that is used mostly in | ||
// confidential mode. | ||
func (uvm *UtilityVM) startExternalGcsListener(ctx context.Context, gcsServiceID guid.GUID) error { | ||
log.G(ctx).WithField("vmID", uvm.runtimeID).Debug("Using external GCS bridge") |
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.
log.G(ctx).WithField("vmID", uvm.runtimeID).Debug("Using external GCS bridge") | |
log.G(ctx).WithFields(logrus.Fields{ | |
logfields.UVMID: uvm.id, | |
"gcServiceGUID": gcsServiceID.String(), | |
}).Debug("Using external GCS bridge") |
if opts.SecurityPolicyEnabled { | ||
err = uvm.startExternalGcsListener(ctx, windowsSidecarGcsHvsockServiceID) | ||
} else { | ||
err = uvm.startExternalGcsListener(ctx, gcs.WindowsGcsHvsockServiceID) | ||
} | ||
if err != nil { |
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.
maybe this so we dont duplicate the same function call?
if opts.SecurityPolicyEnabled { | |
err = uvm.startExternalGcsListener(ctx, windowsSidecarGcsHvsockServiceID) | |
} else { | |
err = uvm.startExternalGcsListener(ctx, gcs.WindowsGcsHvsockServiceID) | |
} | |
if err != nil { | |
gcsGUID := gcs.WindowsGcsHvsockServiceID | |
if opts.SecurityPolicyEnabled { | |
gcsGUID = windowsSidecarGcsHvsockServiceID | |
} | |
if err = uvm.startExternalGcsListener(ctx); err != nil { |
This PR brings in changes via 2 different commits:
First commit updates the WCOW boot files struct to allow different kinds of boot configurations for WCOW UtilityVMs.
Second commit builds on top of the first commit to add support for running confidential WCOW UtilityVMs. This involves using Block CIMs to boot the VM and setting other confidential VM specific configurations in the HCS doc of the UtilityVM.