Skip to content

Commit

Permalink
PR: scsi mount, security policy, typo
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
  • Loading branch information
helsaawy committed Apr 19, 2022
1 parent 368e644 commit c2984f8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ bin/*
rootfs/*
rootfs-conv/*
*.o
/build/
build
protobuf

deps/*
out/*
tmp

# test results
test/results
Expand All @@ -46,3 +49,7 @@ build.ninja
# go workspaces
go.work
go.work.sum

# ninja build
.ninja_log
build.ninja
2 changes: 1 addition & 1 deletion internal/guest/runtime/hcsv2/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ type externalProcess struct {
remove func(pid int)
}

var _ Process = &containerProcess{}
var _ Process = &externalProcess{}

func (ep *externalProcess) Kill(ctx context.Context, signal syscall.Signal) error {
if err := syscall.Kill(int(ep.cmd.Process.Pid), signal); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/tools/uvmboot/lcow.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var lcowCommand = cli.Command{
cli.StringSliceFlag{
Name: scsiMountsArgName,
Usage: "List of VHDs to SCSI mount into the UVM. Use repeat instances to add multiple. " +
"Value is of the form `host,guest[,w]`, where `host` is path to the VHD, " +
"Value is of the form `host[,guest[,w]]`, where `host` is path to the VHD, " +
"`guest` is the mount path inside the UVM, and `w` optionally mounts as writeable",
},
cli.StringSliceFlag{
Expand Down Expand Up @@ -221,6 +221,7 @@ func createLCOWOptions(_ context.Context, c *cli.Context, id string) (*uvm.Optio

if c.IsSet(securityPolicyArgName) {
options.SecurityPolicy = c.String(options.SecurityPolicy)
options.SecurityPolicyEnabled = true
}

return options, nil
Expand Down
11 changes: 9 additions & 2 deletions internal/tools/uvmboot/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func shareFiles(ctx context.Context, c *cli.Context, vm *uvm.UtilityVM) error {

func shareFilesLCOW(ctx context.Context, c *cli.Context, vm *uvm.UtilityVM) error {
for _, s := range parseMounts(c, shareFilesArgName) {
if s.guest == "" {
return fmt.Errorf("file shares %q has invalid quest destination: %q", s.host, s.guest)
}

if err := vm.Share(ctx, s.host, s.guest, !s.writable); err != nil {
return fmt.Errorf("could not share file or directory %s: %w", s.host, err)
} else {
Expand Down Expand Up @@ -90,12 +94,15 @@ func parseMounts(c *cli.Context, n string) []mount {
func mountFromString(s string) (m mount, _ error) {
ps := strings.Split(s, ",")

if len(ps) != 2 && len(ps) != 3 {
if len(ps) >= 3 {
return m, errors.New("too many parts")
}

m.host = ps[0]
m.guest = ps[1]

if len(ps) == 2 {
m.guest = ps[1]
}

if len(ps) == 3 && strings.ToLower(ps[2]) == "w" {
m.writable = true
Expand Down
9 changes: 8 additions & 1 deletion test/vendor/github.com/Microsoft/hcsshim/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c2984f8

Please sign in to comment.