Skip to content

Commit

Permalink
api: OVF to ConfigSpec
Browse files Browse the repository at this point in the history
This patch provides a utility function for transforming an
OVF envelop into a ConfigSpec.

Signed-off-by: akutz <[email protected]>
  • Loading branch information
akutz committed Dec 5, 2024
1 parent e9f9eb0 commit 8a94715
Show file tree
Hide file tree
Showing 6 changed files with 1,600 additions and 11 deletions.
17 changes: 11 additions & 6 deletions object/virtual_device_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,15 +573,20 @@ func (l VirtualDeviceList) CreateDisk(c types.BaseVirtualController, ds types.Ma
name += ".vmdk"
}

bi := types.VirtualDeviceFileBackingInfo{
FileName: name,
}

if ds.Value != "" {
bi.Datastore = &ds
}

device := &types.VirtualDisk{
VirtualDevice: types.VirtualDevice{
Backing: &types.VirtualDiskFlatVer2BackingInfo{
DiskMode: string(types.VirtualDiskModePersistent),
ThinProvisioned: types.NewBool(true),
VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{
FileName: name,
Datastore: &ds,
},
DiskMode: string(types.VirtualDiskModePersistent),
ThinProvisioned: types.NewBool(true),
VirtualDeviceFileBackingInfo: bi,
},
},
}
Expand Down
Loading

0 comments on commit 8a94715

Please sign in to comment.