Skip to content

Commit f59b1f2

Browse files
authored
Add vpmem mount capability to uvmboot (#1455)
Signed-off-by: Maksim An <[email protected]>
1 parent 873b8e1 commit f59b1f2

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

internal/tools/uvmboot/lcow.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const (
3030
rootFSTypeArgName = "root-fs-type"
3131
vpMemMaxCountArgName = "vpmem-max-count"
3232
vpMemMaxSizeArgName = "vpmem-max-size"
33-
scsiMountsArgName = "mount"
33+
scsiMountsArgName = "mount-scsi"
34+
vpmemMountsArgName = "mount-vpmem"
3435
shareFilesArgName = "share"
3536
securityPolicyArgName = "security-policy"
3637
securityHardwareFlag = "security-hardware"
@@ -124,6 +125,10 @@ var lcowCommand = cli.Command{
124125
"Value is of the form `'host,guest[,w]' where 'host' is path to the VHD, " +
125126
`'guest' is the mount path inside the UVM, and 'w' sets the shared files to writeable`,
126127
},
128+
cli.StringSliceFlag{
129+
Name: vpmemMountsArgName,
130+
Usage: "List of VHDs to VPMem mount into the UVM. Use repeat instances to add multiple. ",
131+
},
127132
},
128133
Action: func(c *cli.Context) error {
129134
runMany(c, func(id string) error {
@@ -275,6 +280,10 @@ func runLCOW(ctx context.Context, options *uvm.OptionsLCOW, c *cli.Context) erro
275280
return err
276281
}
277282

283+
if err := mountVPMem(ctx, c, vm); err != nil {
284+
return err
285+
}
286+
278287
if options.UseGuestConnection {
279288
if err := execViaGcs(vm, c); err != nil {
280289
return err

internal/tools/uvmboot/mounts.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ func shareFilesLCOW(ctx context.Context, c *cli.Context, vm *uvm.UtilityVM) erro
6565
return nil
6666
}
6767

68+
func mountVPMem(ctx context.Context, c *cli.Context, vm *uvm.UtilityVM) error {
69+
if !c.IsSet(vpmemMountsArgName) {
70+
return nil
71+
}
72+
for _, p := range c.StringSlice(vpmemMountsArgName) {
73+
if _, err := vm.AddVPMem(ctx, p); err != nil {
74+
return fmt.Errorf("could not mount VPMem device: %w", err)
75+
}
76+
}
77+
return nil
78+
}
79+
6880
type mount struct {
6981
host string
7082
guest string

0 commit comments

Comments
 (0)