From 59afa1c308903d6ff581129372d45030365455c6 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Mon, 10 Apr 2017 12:04:28 +0300 Subject: [PATCH 001/266] Backup; creating vm --- main.go | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 000000000..20c1b9e9b --- /dev/null +++ b/main.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + "github.com/vmware/govmomi" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/types" + "net/url" + "os" + "strconv" + "fmt" +) + +func main() { + var URL = os.Args[1] + var username = os.Args[2] + var password = os.Args[3] + var vm_name = os.Args[4] + var cpus, err = strconv.Atoi(os.Args[5]) + if err != nil { + panic(err) + } + + // create context + ctx := context.TODO() // an empty, default context (for those, who is unsure) + + // create a client + // (connected to the specified URL, + // logged in with the username-passrowd) + u, err := url.Parse(URL) // create a URL object from string + if err != nil { + panic(err) + } + u.User = url.UserPassword(username, password) // set username and password for automatical authentification + fmt.Println(u.String()) + client, err := govmomi.NewClient(ctx, u,false) // creating a client (logs in with given uname&pswd) + if err != nil { + panic(err) + } + // create a reference to a VM with the specified name... + vm_mor := types.ManagedObjectReference{Type: "VirtualMachine", Value: vm_name} + // ... and the VM itself, using the set up client & reference + vm := object.NewVirtualMachine(client.Client, vm_mor) + + vmConfigSpec := types.VirtualMachineConfigSpec{} + vmConfigSpec.NumCPUs = int32(cpus) + task, err := vm.Reconfigure(ctx, vmConfigSpec) + if err != nil { + panic(err) + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + panic(err) + } +} From f70754e0e1ea924ae57bdff93c273b0e33fa7a47 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Wed, 12 Apr 2017 11:14:27 +0300 Subject: [PATCH 002/266] Basic reconfiguring of the vm --- main.go | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 20c1b9e9b..0187b6d09 100644 --- a/main.go +++ b/main.go @@ -3,18 +3,20 @@ package main import ( "context" "github.com/vmware/govmomi" - "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" "net/url" "os" "strconv" "fmt" + "github.com/vmware/govmomi/find" + "github.com/vmware/govmomi/vim25/mo" ) func main() { var URL = os.Args[1] var username = os.Args[2] var password = os.Args[3] + var dc_name = os.Args[6] var vm_name = os.Args[4] var cpus, err = strconv.Atoi(os.Args[5]) if err != nil { @@ -26,24 +28,50 @@ func main() { // create a client // (connected to the specified URL, - // logged in with the username-passrowd) + // logged in with the username-password) u, err := url.Parse(URL) // create a URL object from string if err != nil { panic(err) } u.User = url.UserPassword(username, password) // set username and password for automatical authentification fmt.Println(u.String()) - client, err := govmomi.NewClient(ctx, u,false) // creating a client (logs in with given uname&pswd) + client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) if err != nil { panic(err) } - // create a reference to a VM with the specified name... - vm_mor := types.ManagedObjectReference{Type: "VirtualMachine", Value: vm_name} - // ... and the VM itself, using the set up client & reference - vm := object.NewVirtualMachine(client.Client, vm_mor) + // Create a finder to search for a vm with the specified name + finder := find.NewFinder(client.Client, false) + // Need to specify the datacenter + if dc_name == "" { + dc, err := finder.DefaultDatacenter(ctx) + if err != nil { + panic(fmt.Errorf("Error reading default datacenter: %s", err)) + } + var dc_mo mo.Datacenter + err = dc.Properties(ctx, dc.Reference(), []string{"name"}, &dc_mo) + if err != nil { + panic(fmt.Errorf("Error reading datacenter name: %s", err)) + } + dc_name = dc_mo.Name + finder.SetDatacenter(dc) + } else { + dc, err := finder.Datacenter(ctx, fmt.Sprintf("/%v", dc_name)) + if err != nil { + panic(err) + } + finder.SetDatacenter(dc) + } + vm, err := finder.VirtualMachine(ctx, vm_name) + if err != nil { + panic(err) + } + + // creating new configuration for vm vmConfigSpec := types.VirtualMachineConfigSpec{} vmConfigSpec.NumCPUs = int32(cpus) + + // finally reconfiguring task, err := vm.Reconfigure(ctx, vmConfigSpec) if err != nil { panic(err) From b77e77168a46a9400306e8986702988980ca11c4 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Wed, 12 Apr 2017 13:51:28 +0300 Subject: [PATCH 003/266] split into functions --- main.go | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 0187b6d09..7dab64071 100644 --- a/main.go +++ b/main.go @@ -12,17 +12,7 @@ import ( "github.com/vmware/govmomi/vim25/mo" ) -func main() { - var URL = os.Args[1] - var username = os.Args[2] - var password = os.Args[3] - var dc_name = os.Args[6] - var vm_name = os.Args[4] - var cpus, err = strconv.Atoi(os.Args[5]) - if err != nil { - panic(err) - } - +func authentificate(URL, username, password string) (*govmomi.Client, context.Context) { // create context ctx := context.TODO() // an empty, default context (for those, who is unsure) @@ -40,6 +30,10 @@ func main() { panic(err) } + return client, ctx +} + +func reconfigureVM(client *govmomi.Client, ctx context.Context, dc_name, vm_name string, cpus int) { // Create a finder to search for a vm with the specified name finder := find.NewFinder(client.Client, false) // Need to specify the datacenter @@ -81,3 +75,18 @@ func main() { panic(err) } } + +func main() { + var URL = os.Args[1] + var username = os.Args[2] + var password = os.Args[3] + var dc_name = os.Args[6] + var vm_name = os.Args[4] + var cpus, err = strconv.Atoi(os.Args[5]) + if err != nil { + panic(err) + } + + client, ctx := authentificate(URL, username, password) + reconfigureVM(client, ctx, dc_name, vm_name, cpus) +} From 63912d7f86be31b68b31bd60d9df8ec2afeba1de Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Wed, 12 Apr 2017 18:16:11 +0300 Subject: [PATCH 004/266] added cloning vm --- main.go | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 7dab64071..279cd9afb 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "fmt" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/object" ) func authentificate(URL, username, password string) (*govmomi.Client, context.Context) { @@ -33,7 +34,7 @@ func authentificate(URL, username, password string) (*govmomi.Client, context.Co return client, ctx } -func reconfigureVM(client *govmomi.Client, ctx context.Context, dc_name, vm_name string, cpus int) { +func createFinder(ctx context.Context, client *govmomi.Client, dc_name string) (*find.Finder, context.Context) { // Create a finder to search for a vm with the specified name finder := find.NewFinder(client.Client, false) // Need to specify the datacenter @@ -56,17 +57,29 @@ func reconfigureVM(client *govmomi.Client, ctx context.Context, dc_name, vm_name } finder.SetDatacenter(dc) } - vm, err := finder.VirtualMachine(ctx, vm_name) + return finder, ctx +} + +func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (*object.VirtualMachine, context.Context) { + vm_o, err := finder.VirtualMachine(ctx, vm_name) if err != nil { panic(err) } + return vm_o, ctx +} + +//func reconfigureVM(ctx context.Context, vm *object.VirtualMachine, cpus int) { +func reconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { + client, ctx := authentificate(URL, username, password) + finder, ctx := createFinder(ctx, client, dc_name) + vm_o, ctx := findVM_by_name(ctx, finder, vm_name) // creating new configuration for vm vmConfigSpec := types.VirtualMachineConfigSpec{} vmConfigSpec.NumCPUs = int32(cpus) // finally reconfiguring - task, err := vm.Reconfigure(ctx, vmConfigSpec) + task, err := vm_o.Reconfigure(ctx, vmConfigSpec) if err != nil { panic(err) } @@ -76,6 +89,52 @@ func reconfigureVM(client *govmomi.Client, ctx context.Context, dc_name, vm_name } } +func cloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { + // Prepare entities: authentification, finder, folder, virtual machine + client, ctx := authentificate(URL, username, password) + finder, ctx := createFinder(ctx, client, dc_name) + folder, err := finder.FolderOrDefault(ctx, "") // folder_name + if err != nil { + panic(err) + } else { + fmt.Printf("expected folder: %v\n", folder_name) + fmt.Printf("folder.Name(): %v\nfolder.InventoryPath(): %v\n", folder.Name(), folder.InventoryPath) + } + vm_src, ctx := findVM_by_name(ctx, finder, source_name) + + // Creating spec's for cloning + var relocateSpec types.VirtualMachineRelocateSpec + var confSpec types.VirtualMachineConfigSpec + if cpus != -1 { + confSpec.NumCPUs = int32(cpus) + } + cloneSpec := types.VirtualMachineCloneSpec{ + Location: relocateSpec, + Config: &confSpec, + PowerOn: false, + } + + // Cloning itself + task, err := vm_src.Clone(ctx, folder, target_name, cloneSpec) + if err != nil { + panic(err) + } + info, err := task.WaitForResult(ctx, nil) + if err != nil { + panic(err) + } + + vm_new_mor := info.Result.(types.ManagedObjectReference) + vm_new := object.NewVirtualMachine(client.Client, vm_new_mor) + var vm_new_mo mo.VirtualMachine + err = vm_new.Properties(ctx, vm_new.Reference(), []string{"summary"}, &vm_new_mo) + cpus_new := vm_new_mo.Summary.Config.NumCpu + var vm_src_mo mo.VirtualMachine + err = vm_src.Properties(ctx, vm_src.Reference(), []string{"summary"}, &vm_src_mo) + cpus_src := vm_src_mo.Summary.Config.NumCpu + fmt.Printf("Num of cpus on the newly created machine %v vs on the initial one %v\n", cpus_new, cpus_src) +} + func main() { var URL = os.Args[1] var username = os.Args[2] @@ -87,6 +146,5 @@ func main() { panic(err) } - client, ctx := authentificate(URL, username, password) - reconfigureVM(client, ctx, dc_name, vm_name, cpus) + cloneVM(URL, username, password, dc_name, "", vm_name, vm_name + "_cloned", cpus) } From fc1edfa23b0f8d0aab5b6eec2f79bbdb77f14991 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Wed, 12 Apr 2017 19:30:45 +0300 Subject: [PATCH 005/266] cosmetics --- main.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 279cd9afb..df2132773 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ import ( "github.com/vmware/govmomi/object" ) -func authentificate(URL, username, password string) (*govmomi.Client, context.Context) { +func createClient(URL, username, password string) (*govmomi.Client, context.Context) { // create context ctx := context.TODO() // an empty, default context (for those, who is unsure) @@ -68,9 +68,8 @@ func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (* return vm_o, ctx } -//func reconfigureVM(ctx context.Context, vm *object.VirtualMachine, cpus int) { -func reconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { - client, ctx := authentificate(URL, username, password) +func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { + client, ctx := createClient(URL, username, password) finder, ctx := createFinder(ctx, client, dc_name) vm_o, ctx := findVM_by_name(ctx, finder, vm_name) @@ -89,9 +88,9 @@ func reconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { } } -func cloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { - // Prepare entities: authentification, finder, folder, virtual machine - client, ctx := authentificate(URL, username, password) +func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { + // Prepare entities: client (authentification), finder, folder, virtual machine + client, ctx := createClient(URL, username, password) finder, ctx := createFinder(ctx, client, dc_name) folder, err := finder.FolderOrDefault(ctx, "") // folder_name if err != nil { @@ -124,6 +123,7 @@ func cloneVM(URL, username, password, dc_name, folder_name, source_name, target_ panic(err) } + // Just to output something for clarity vm_new_mor := info.Result.(types.ManagedObjectReference) vm_new := object.NewVirtualMachine(client.Client, vm_new_mor) var vm_new_mo mo.VirtualMachine @@ -146,5 +146,6 @@ func main() { panic(err) } - cloneVM(URL, username, password, dc_name, "", vm_name, vm_name + "_cloned", cpus) + CloneVM(URL, username, password, dc_name, "", vm_name, vm_name + "_cloned", cpus) + // ReconfigureVM(URL, username, password, dc_name, vm_name, cpus) } From 495a33e664bcdbdbe382d459c9b630579e0e5a23 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sun, 16 Apr 2017 19:05:00 +0300 Subject: [PATCH 006/266] trying thin disk --- main.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/main.go b/main.go index df2132773..98124d9ca 100644 --- a/main.go +++ b/main.go @@ -88,6 +88,29 @@ func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { } } +func createDisk() (object.VirtualDeviceList, error) { + var devices object.VirtualDeviceList + controller, err := devices.FindDiskController("") + if err != nil { + return nil, err + } + + disk := &types.VirtualDisk{ + VirtualDevice: types.VirtualDevice{ + Key: devices.NewKey(), + Backing: &types.VirtualDiskFlatVer2BackingInfo{ + DiskMode: string(types.VirtualDiskModePersistent), + ThinProvisioned: types.NewBool(true), + }, + }, + } + + devices.AssignController(disk, controller) + devices = append(devices, disk) + + return devices, nil +} + func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { // Prepare entities: client (authentification), finder, folder, virtual machine client, ctx := createClient(URL, username, password) @@ -103,10 +126,23 @@ func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_ // Creating spec's for cloning var relocateSpec types.VirtualMachineRelocateSpec + var confSpec types.VirtualMachineConfigSpec + // configure CPUs if cpus != -1 { confSpec.NumCPUs = int32(cpus) } + // make the thin provisioned disk + devices, err := createDisk() + if err != nil { + panic(err) + } + deviceChange, err := devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + if err != nil { + panic(err) + } + confSpec.DeviceChange = deviceChange + cloneSpec := types.VirtualMachineCloneSpec{ Location: relocateSpec, Config: &confSpec, From 3b612373e91ec7fb88040c1d2126768c576f4f63 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sun, 16 Apr 2017 23:04:50 +0300 Subject: [PATCH 007/266] Switched from command line tool to packer post-processor --- artifact.go | 47 +++++++++++ main.go | 183 +--------------------------------------- post-processor.go | 206 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 257 insertions(+), 179 deletions(-) create mode 100644 artifact.go create mode 100644 post-processor.go diff --git a/artifact.go b/artifact.go new file mode 100644 index 000000000..088c31b3e --- /dev/null +++ b/artifact.go @@ -0,0 +1,47 @@ +package main + +import "fmt" + +const BuilderId = "packer.post-processor.vsphere-device" + +type ArtifactFile struct { + Name string `json:"name"` + Size int64 `json:"size"` +} + +type Artifact struct { + BuildName string `json:"name"` + BuilderType string `json:"builder_type"` + BuildTime int64 `json:"build_time"` + ArtifactFiles []ArtifactFile `json:"files"` + ArtifactId string `json:"artifact_id"` + PackerRunUUID string `json:"packer_run_uuid"` +} + +func (a *Artifact) BuilderId() string { + return BuilderId +} + +func (a *Artifact) Files() []string { + var files []string + for _, af := range a.ArtifactFiles { + files = append(files, af.Name) + } + return files +} + +func (a *Artifact) Id() string { + return a.ArtifactId +} + +func (a *Artifact) String() string { + return fmt.Sprintf("%s-%s", a.BuildName, a.ArtifactId) +} + +func (a *Artifact) State(name string) interface{} { + return nil +} + +func (a *Artifact) Destroy() error { + return nil +} diff --git a/main.go b/main.go index 98124d9ca..de5038175 100644 --- a/main.go +++ b/main.go @@ -1,187 +1,12 @@ package main -import ( - "context" - "github.com/vmware/govmomi" - "github.com/vmware/govmomi/vim25/types" - "net/url" - "os" - "strconv" - "fmt" - "github.com/vmware/govmomi/find" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/object" -) - -func createClient(URL, username, password string) (*govmomi.Client, context.Context) { - // create context - ctx := context.TODO() // an empty, default context (for those, who is unsure) - - // create a client - // (connected to the specified URL, - // logged in with the username-password) - u, err := url.Parse(URL) // create a URL object from string - if err != nil { - panic(err) - } - u.User = url.UserPassword(username, password) // set username and password for automatical authentification - fmt.Println(u.String()) - client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) - if err != nil { - panic(err) - } - - return client, ctx -} - -func createFinder(ctx context.Context, client *govmomi.Client, dc_name string) (*find.Finder, context.Context) { - // Create a finder to search for a vm with the specified name - finder := find.NewFinder(client.Client, false) - // Need to specify the datacenter - if dc_name == "" { - dc, err := finder.DefaultDatacenter(ctx) - if err != nil { - panic(fmt.Errorf("Error reading default datacenter: %s", err)) - } - var dc_mo mo.Datacenter - err = dc.Properties(ctx, dc.Reference(), []string{"name"}, &dc_mo) - if err != nil { - panic(fmt.Errorf("Error reading datacenter name: %s", err)) - } - dc_name = dc_mo.Name - finder.SetDatacenter(dc) - } else { - dc, err := finder.Datacenter(ctx, fmt.Sprintf("/%v", dc_name)) - if err != nil { - panic(err) - } - finder.SetDatacenter(dc) - } - return finder, ctx -} - -func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (*object.VirtualMachine, context.Context) { - vm_o, err := finder.VirtualMachine(ctx, vm_name) - if err != nil { - panic(err) - } - return vm_o, ctx -} - -func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { - client, ctx := createClient(URL, username, password) - finder, ctx := createFinder(ctx, client, dc_name) - vm_o, ctx := findVM_by_name(ctx, finder, vm_name) - - // creating new configuration for vm - vmConfigSpec := types.VirtualMachineConfigSpec{} - vmConfigSpec.NumCPUs = int32(cpus) - - // finally reconfiguring - task, err := vm_o.Reconfigure(ctx, vmConfigSpec) - if err != nil { - panic(err) - } - _, err = task.WaitForResult(ctx, nil) - if err != nil { - panic(err) - } -} - -func createDisk() (object.VirtualDeviceList, error) { - var devices object.VirtualDeviceList - controller, err := devices.FindDiskController("") - if err != nil { - return nil, err - } - - disk := &types.VirtualDisk{ - VirtualDevice: types.VirtualDevice{ - Key: devices.NewKey(), - Backing: &types.VirtualDiskFlatVer2BackingInfo{ - DiskMode: string(types.VirtualDiskModePersistent), - ThinProvisioned: types.NewBool(true), - }, - }, - } - - devices.AssignController(disk, controller) - devices = append(devices, disk) - - return devices, nil -} - -func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { - // Prepare entities: client (authentification), finder, folder, virtual machine - client, ctx := createClient(URL, username, password) - finder, ctx := createFinder(ctx, client, dc_name) - folder, err := finder.FolderOrDefault(ctx, "") // folder_name - if err != nil { - panic(err) - } else { - fmt.Printf("expected folder: %v\n", folder_name) - fmt.Printf("folder.Name(): %v\nfolder.InventoryPath(): %v\n", folder.Name(), folder.InventoryPath) - } - vm_src, ctx := findVM_by_name(ctx, finder, source_name) - - // Creating spec's for cloning - var relocateSpec types.VirtualMachineRelocateSpec - - var confSpec types.VirtualMachineConfigSpec - // configure CPUs - if cpus != -1 { - confSpec.NumCPUs = int32(cpus) - } - // make the thin provisioned disk - devices, err := createDisk() - if err != nil { - panic(err) - } - deviceChange, err := devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) - if err != nil { - panic(err) - } - confSpec.DeviceChange = deviceChange - - cloneSpec := types.VirtualMachineCloneSpec{ - Location: relocateSpec, - Config: &confSpec, - PowerOn: false, - } - - // Cloning itself - task, err := vm_src.Clone(ctx, folder, target_name, cloneSpec) - if err != nil { - panic(err) - } - info, err := task.WaitForResult(ctx, nil) - if err != nil { - panic(err) - } - - // Just to output something for clarity - vm_new_mor := info.Result.(types.ManagedObjectReference) - vm_new := object.NewVirtualMachine(client.Client, vm_new_mor) - var vm_new_mo mo.VirtualMachine - err = vm_new.Properties(ctx, vm_new.Reference(), []string{"summary"}, &vm_new_mo) - cpus_new := vm_new_mo.Summary.Config.NumCpu - var vm_src_mo mo.VirtualMachine - err = vm_src.Properties(ctx, vm_src.Reference(), []string{"summary"}, &vm_src_mo) - cpus_src := vm_src_mo.Summary.Config.NumCpu - fmt.Printf("Num of cpus on the newly created machine %v vs on the initial one %v\n", cpus_new, cpus_src) -} +import "github.com/hashicorp/packer/packer/plugin" func main() { - var URL = os.Args[1] - var username = os.Args[2] - var password = os.Args[3] - var dc_name = os.Args[6] - var vm_name = os.Args[4] - var cpus, err = strconv.Atoi(os.Args[5]) + server, err := plugin.Server() if err != nil { panic(err) } - - CloneVM(URL, username, password, dc_name, "", vm_name, vm_name + "_cloned", cpus) - // ReconfigureVM(URL, username, password, dc_name, vm_name, cpus) + server.RegisterPostProcessor(new(PostProcessor)) + server.Serve() } diff --git a/post-processor.go b/post-processor.go new file mode 100644 index 000000000..8a718f009 --- /dev/null +++ b/post-processor.go @@ -0,0 +1,206 @@ +package main + +import ( + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/vmware/govmomi" + "github.com/vmware/govmomi/find" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/types" + "context" + "fmt" + "net/url" + "strconv" +) + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + + Url string `mapstructure:"url"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` + Dc_name string `mapstructure:"dc_name"` + Folder_name string + Vm_source_name string `mapstructure:"vm_source_name"` + Vm_target_name string `mapstructure:"vm_target_name"` + Cpu_sockets string `mapstructure:"cpus"` + + cpus int + ctx interpolate.Context +} + +type PostProcessor struct { + config Config +} + +func (p *PostProcessor) Configure(raws ...interface{}) error { + err := config.Decode(&p.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &p.config.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{}, + }, + }, raws...) + if err != nil { + return err + } + + // Defaults + p.config.Folder_name = "" + if p.config.Vm_target_name == "" { + p.config.Vm_target_name = p.config.Vm_source_name + "_cloned" + } + p.config.cpus = -1 + if p.config.Cpu_sockets != "" { + p.config.cpus, err = strconv.Atoi(p.config.Cpu_sockets) + if err != nil { + panic(err) + } + } + + // Accumulate any errors + errs := new(packer.MultiError) + + // First define all our templatable parameters that are _required_ + templates := map[string]*string{ + "url": &p.config.Url, + "username": &p.config.Username, + "password": &p.config.Password, + "vm_source_name": &p.config.Vm_source_name, + } + for key, ptr := range templates { + if *ptr == "" { + errs = packer.MultiErrorAppend( + errs, fmt.Errorf("%s must be set, %s is present", key, *ptr)) + } + } + + if len(errs.Errors) > 0 { + return errs + } + + return nil +} + +// TODO: replace `cpus` with a more generic hw config structure +func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { + // Prepare entities: client (authentification), finder, folder, virtual machine + client, ctx := createClient(URL, username, password) + finder, ctx := createFinder(ctx, client, dc_name) + folder, err := finder.FolderOrDefault(ctx, "") // folder_name + if err != nil { + panic(err) + } else { + fmt.Printf("expected folder: %v\n", folder_name) + fmt.Printf("folder.Name(): %v\nfolder.InventoryPath(): %v\n", folder.Name(), folder.InventoryPath) + } + vm_src, ctx := findVM_by_name(ctx, finder, source_name) + + // Creating spec's for cloning + var relocateSpec types.VirtualMachineRelocateSpec + + var confSpec types.VirtualMachineConfigSpec + // configure CPUs + if cpus != -1 { + confSpec.NumCPUs = int32(cpus) + } + + cloneSpec := types.VirtualMachineCloneSpec{ + Location: relocateSpec, + Config: &confSpec, + PowerOn: false, + } + + // Cloning itself + task, err := vm_src.Clone(ctx, folder, target_name, cloneSpec) + if err != nil { + panic(err) + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + panic(err) + } +} + +func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, error) { + CloneVM(p.config.Url, p.config.Username, p.config.Password, p.config.Dc_name, p.config.Folder_name, p.config.Vm_source_name, p.config.Vm_target_name, p.config.cpus) + return source, true, nil +} + +func createClient(URL, username, password string) (*govmomi.Client, context.Context) { + // create context + ctx := context.TODO() // an empty, default context (for those, who is unsure) + + // create a client + // (connected to the specified URL, + // logged in with the username-password) + u, err := url.Parse(URL) // create a URL object from string + if err != nil { + panic(err) + } + u.User = url.UserPassword(username, password) // set username and password for automatical authentification + fmt.Println(u.String()) + client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) + if err != nil { + panic(err) + } + + return client, ctx +} + +func createFinder(ctx context.Context, client *govmomi.Client, dc_name string) (*find.Finder, context.Context) { + // Create a finder to search for a vm with the specified name + finder := find.NewFinder(client.Client, false) + // Need to specify the datacenter + if dc_name == "" { + dc, err := finder.DefaultDatacenter(ctx) + if err != nil { + panic(fmt.Errorf("Error reading default datacenter: %s", err)) + } + var dc_mo mo.Datacenter + err = dc.Properties(ctx, dc.Reference(), []string{"name"}, &dc_mo) + if err != nil { + panic(fmt.Errorf("Error reading datacenter name: %s", err)) + } + dc_name = dc_mo.Name + finder.SetDatacenter(dc) + } else { + dc, err := finder.Datacenter(ctx, fmt.Sprintf("/%v", dc_name)) + if err != nil { + panic(err) + } + finder.SetDatacenter(dc) + } + return finder, ctx +} + +func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (*object.VirtualMachine, context.Context) { + vm_o, err := finder.VirtualMachine(ctx, vm_name) + if err != nil { + panic(err) + } + return vm_o, ctx +} + +func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { + client, ctx := createClient(URL, username, password) + finder, ctx := createFinder(ctx, client, dc_name) + vm_o, ctx := findVM_by_name(ctx, finder, vm_name) + + // creating new configuration for vm + vmConfigSpec := types.VirtualMachineConfigSpec{} + vmConfigSpec.NumCPUs = int32(cpus) + + // finally reconfiguring + task, err := vm_o.Reconfigure(ctx, vmConfigSpec) + if err != nil { + panic(err) + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + panic(err) + } +} From 3232c526822a8a9df644dd82446084309d839ad5 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sun, 16 Apr 2017 23:47:01 +0300 Subject: [PATCH 008/266] added RAM ocnfiguration --- post-processor.go | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/post-processor.go b/post-processor.go index 8a718f009..e769953bd 100644 --- a/post-processor.go +++ b/post-processor.go @@ -16,6 +16,11 @@ import ( "strconv" ) +type HwConfig struct { + Cpu_sockets int + Ram int +} + type Config struct { common.PackerConfig `mapstructure:",squash"` @@ -27,8 +32,9 @@ type Config struct { Vm_source_name string `mapstructure:"vm_source_name"` Vm_target_name string `mapstructure:"vm_target_name"` Cpu_sockets string `mapstructure:"cpus"` + Ram string `mapstructure:"RAM"` - cpus int + hwConfig HwConfig ctx interpolate.Context } @@ -53,9 +59,16 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { if p.config.Vm_target_name == "" { p.config.Vm_target_name = p.config.Vm_source_name + "_cloned" } - p.config.cpus = -1 + p.config.hwConfig.Cpu_sockets = -1 if p.config.Cpu_sockets != "" { - p.config.cpus, err = strconv.Atoi(p.config.Cpu_sockets) + p.config.hwConfig.Cpu_sockets, err = strconv.Atoi(p.config.Cpu_sockets) + if err != nil { + panic(err) + } + } + p.config.hwConfig.Ram = -1 + if p.config.Ram != "" { + p.config.hwConfig.Ram, err = strconv.Atoi(p.config.Ram) if err != nil { panic(err) } @@ -85,8 +98,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -// TODO: replace `cpus` with a more generic hw config structure -func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, cpus int) { +func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, hwConfig HwConfig) { // Prepare entities: client (authentification), finder, folder, virtual machine client, ctx := createClient(URL, username, password) finder, ctx := createFinder(ctx, client, dc_name) @@ -103,9 +115,12 @@ func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_ var relocateSpec types.VirtualMachineRelocateSpec var confSpec types.VirtualMachineConfigSpec - // configure CPUs - if cpus != -1 { - confSpec.NumCPUs = int32(cpus) + // configure HW + if hwConfig.Cpu_sockets != -1 { + confSpec.NumCPUs = int32(hwConfig.Cpu_sockets) + } + if hwConfig.Ram != -1 { + confSpec.MemoryMB = int64(hwConfig.Ram) } cloneSpec := types.VirtualMachineCloneSpec{ @@ -126,7 +141,7 @@ func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_ } func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, error) { - CloneVM(p.config.Url, p.config.Username, p.config.Password, p.config.Dc_name, p.config.Folder_name, p.config.Vm_source_name, p.config.Vm_target_name, p.config.cpus) + CloneVM(p.config.Url, p.config.Username, p.config.Password, p.config.Dc_name, p.config.Folder_name, p.config.Vm_source_name, p.config.Vm_target_name, p.config.hwConfig) return source, true, nil } From 1d77b80f6bd0bd97eaee10e34d329b82490cc16b Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sat, 22 Apr 2017 11:36:34 +0300 Subject: [PATCH 009/266] renamed BuilderId --- artifact.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifact.go b/artifact.go index 088c31b3e..ea36d8ff4 100644 --- a/artifact.go +++ b/artifact.go @@ -2,7 +2,7 @@ package main import "fmt" -const BuilderId = "packer.post-processor.vsphere-device" +const BuilderId = "LizaTretyakova.post-processor.vsphere-device" type ArtifactFile struct { Name string `json:"name"` From 9af78aa30dee54194baeb00fbd1bdbd9c82a9898 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sat, 22 Apr 2017 11:48:35 +0300 Subject: [PATCH 010/266] extracted process parameters from packer config to my own variables --- post-processor.go | 99 +++++++++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 38 deletions(-) diff --git a/post-processor.go b/post-processor.go index e769953bd..efb48c11d 100644 --- a/post-processor.go +++ b/post-processor.go @@ -16,11 +16,28 @@ import ( "strconv" ) -type HwConfig struct { +type VMOptionalParams struct { Cpu_sockets int - Ram int + Ram int + // TODO: add more options } +type VMRequiredParams struct { + Url string + Username string + Password string + Dc_name string + Folder_name string + Vm_source_name string + Vm_target_name string +} + +const DefaultFolder = "" +const Unspecified = -1 + +var vm_opt_params VMOptionalParams +var vm_req_params VMRequiredParams + type Config struct { common.PackerConfig `mapstructure:",squash"` @@ -28,14 +45,12 @@ type Config struct { Username string `mapstructure:"username"` Password string `mapstructure:"password"` Dc_name string `mapstructure:"dc_name"` - Folder_name string Vm_source_name string `mapstructure:"vm_source_name"` Vm_target_name string `mapstructure:"vm_target_name"` Cpu_sockets string `mapstructure:"cpus"` Ram string `mapstructure:"RAM"` - hwConfig HwConfig - ctx interpolate.Context + ctx interpolate.Context } type PostProcessor struct { @@ -54,30 +69,10 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return err } - // Defaults - p.config.Folder_name = "" - if p.config.Vm_target_name == "" { - p.config.Vm_target_name = p.config.Vm_source_name + "_cloned" - } - p.config.hwConfig.Cpu_sockets = -1 - if p.config.Cpu_sockets != "" { - p.config.hwConfig.Cpu_sockets, err = strconv.Atoi(p.config.Cpu_sockets) - if err != nil { - panic(err) - } - } - p.config.hwConfig.Ram = -1 - if p.config.Ram != "" { - p.config.hwConfig.Ram, err = strconv.Atoi(p.config.Ram) - if err != nil { - panic(err) - } - } - // Accumulate any errors errs := new(packer.MultiError) - // First define all our templatable parameters that are _required_ + // Check the required params templates := map[string]*string{ "url": &p.config.Url, "username": &p.config.Username, @@ -95,32 +90,60 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return errs } + // Set optional params + vm_req_params.Folder_name = DefaultFolder + vm_opt_params.Cpu_sockets = Unspecified + if p.config.Cpu_sockets != "" { + vm_opt_params.Cpu_sockets, err = strconv.Atoi(p.config.Cpu_sockets) + if err != nil { + panic(err) + } + } + vm_opt_params.Ram = Unspecified + if p.config.Ram != "" { + vm_opt_params.Ram, err = strconv.Atoi(p.config.Ram) + if err != nil { + panic(err) + } + } + + // Set required params + vm_req_params.Url = p.config.Url + vm_req_params.Username = p.config.Username + vm_req_params.Password = p.config.Password + vm_req_params.Dc_name = p.config.Dc_name + vm_req_params.Vm_source_name = p.config.Vm_source_name + vm_req_params.Vm_target_name = vm_req_params.Vm_source_name + "_clone" + if p.config.Vm_target_name != "" { + vm_req_params.Vm_target_name = p.config.Vm_target_name + } + return nil } -func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_name string, hwConfig HwConfig) { +func CloneVM(req_params VMRequiredParams, opt_params VMOptionalParams) { // Prepare entities: client (authentification), finder, folder, virtual machine - client, ctx := createClient(URL, username, password) - finder, ctx := createFinder(ctx, client, dc_name) - folder, err := finder.FolderOrDefault(ctx, "") // folder_name + client, ctx := createClient(req_params.Url, req_params.Username, req_params.Password) + finder, ctx := createFinder(ctx, client, req_params.Dc_name) + folder, err := finder.FolderOrDefault(ctx, req_params.Folder_name) if err != nil { panic(err) } else { - fmt.Printf("expected folder: %v\n", folder_name) + fmt.Printf("expected folder: %v\n", req_params.Folder_name) fmt.Printf("folder.Name(): %v\nfolder.InventoryPath(): %v\n", folder.Name(), folder.InventoryPath) } - vm_src, ctx := findVM_by_name(ctx, finder, source_name) + vm_src, ctx := findVM_by_name(ctx, finder, req_params.Vm_source_name) // Creating spec's for cloning var relocateSpec types.VirtualMachineRelocateSpec var confSpec types.VirtualMachineConfigSpec // configure HW - if hwConfig.Cpu_sockets != -1 { - confSpec.NumCPUs = int32(hwConfig.Cpu_sockets) + if opt_params.Cpu_sockets != Unspecified { + confSpec.NumCPUs = int32(opt_params.Cpu_sockets) } - if hwConfig.Ram != -1 { - confSpec.MemoryMB = int64(hwConfig.Ram) + if opt_params.Ram != Unspecified { + confSpec.MemoryMB = int64(opt_params.Ram) } cloneSpec := types.VirtualMachineCloneSpec{ @@ -130,7 +153,7 @@ func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_ } // Cloning itself - task, err := vm_src.Clone(ctx, folder, target_name, cloneSpec) + task, err := vm_src.Clone(ctx, folder, req_params.Vm_target_name, cloneSpec) if err != nil { panic(err) } @@ -141,7 +164,7 @@ func CloneVM(URL, username, password, dc_name, folder_name, source_name, target_ } func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, error) { - CloneVM(p.config.Url, p.config.Username, p.config.Password, p.config.Dc_name, p.config.Folder_name, p.config.Vm_source_name, p.config.Vm_target_name, p.config.hwConfig) + CloneVM(vm_req_params, vm_opt_params) return source, true, nil } From 5c1ee8cb3dce03ec0193d1d8b3512120547f203b Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sat, 22 Apr 2017 12:20:43 +0300 Subject: [PATCH 011/266] added proper error handling --- post-processor.go | 80 ++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/post-processor.go b/post-processor.go index efb48c11d..e43e5026f 100644 --- a/post-processor.go +++ b/post-processor.go @@ -121,18 +121,24 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func CloneVM(req_params VMRequiredParams, opt_params VMOptionalParams) { +func CloneVM(req_params VMRequiredParams, opt_params VMOptionalParams) error { // Prepare entities: client (authentification), finder, folder, virtual machine - client, ctx := createClient(req_params.Url, req_params.Username, req_params.Password) - finder, ctx := createFinder(ctx, client, req_params.Dc_name) + client, ctx, err := createClient(req_params.Url, req_params.Username, req_params.Password) + if err != nil { + return err + } + finder, ctx, err := createFinder(ctx, client, req_params.Dc_name) + if err != nil { + return err + } folder, err := finder.FolderOrDefault(ctx, req_params.Folder_name) if err != nil { - panic(err) - } else { - fmt.Printf("expected folder: %v\n", req_params.Folder_name) - fmt.Printf("folder.Name(): %v\nfolder.InventoryPath(): %v\n", folder.Name(), folder.InventoryPath) + return err + } + vm_src, ctx, err := findVM_by_name(ctx, finder, req_params.Vm_source_name) + if err != nil { + return err } - vm_src, ctx := findVM_by_name(ctx, finder, req_params.Vm_source_name) // Creating spec's for cloning var relocateSpec types.VirtualMachineRelocateSpec @@ -155,20 +161,25 @@ func CloneVM(req_params VMRequiredParams, opt_params VMOptionalParams) { // Cloning itself task, err := vm_src.Clone(ctx, folder, req_params.Vm_target_name, cloneSpec) if err != nil { - panic(err) + return err } _, err = task.WaitForResult(ctx, nil) if err != nil { - panic(err) + return err } + + return nil } func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, error) { - CloneVM(vm_req_params, vm_opt_params) + err := CloneVM(vm_req_params, vm_opt_params) + if err != nil { + return nil, false, err + } return source, true, nil } -func createClient(URL, username, password string) (*govmomi.Client, context.Context) { +func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { // create context ctx := context.TODO() // an empty, default context (for those, who is unsure) @@ -177,56 +188,65 @@ func createClient(URL, username, password string) (*govmomi.Client, context.Cont // logged in with the username-password) u, err := url.Parse(URL) // create a URL object from string if err != nil { - panic(err) + return nil, nil, err } u.User = url.UserPassword(username, password) // set username and password for automatical authentification fmt.Println(u.String()) client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) if err != nil { - panic(err) + return nil, nil, err } - return client, ctx + return client, ctx, nil } -func createFinder(ctx context.Context, client *govmomi.Client, dc_name string) (*find.Finder, context.Context) { +func createFinder(ctx context.Context, client *govmomi.Client, dc_name string) (*find.Finder, context.Context, error) { // Create a finder to search for a vm with the specified name finder := find.NewFinder(client.Client, false) // Need to specify the datacenter if dc_name == "" { dc, err := finder.DefaultDatacenter(ctx) if err != nil { - panic(fmt.Errorf("Error reading default datacenter: %s", err)) + return nil, nil, err } var dc_mo mo.Datacenter err = dc.Properties(ctx, dc.Reference(), []string{"name"}, &dc_mo) if err != nil { - panic(fmt.Errorf("Error reading datacenter name: %s", err)) + return nil, nil, err } dc_name = dc_mo.Name finder.SetDatacenter(dc) } else { dc, err := finder.Datacenter(ctx, fmt.Sprintf("/%v", dc_name)) if err != nil { - panic(err) + return nil, nil, err } finder.SetDatacenter(dc) } - return finder, ctx + return finder, ctx, nil } -func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (*object.VirtualMachine, context.Context) { +func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (*object.VirtualMachine, context.Context, error) { vm_o, err := finder.VirtualMachine(ctx, vm_name) if err != nil { - panic(err) + return nil, nil, err } - return vm_o, ctx + return vm_o, ctx, nil } -func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { - client, ctx := createClient(URL, username, password) - finder, ctx := createFinder(ctx, client, dc_name) - vm_o, ctx := findVM_by_name(ctx, finder, vm_name) +func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) error { + client, ctx, err := createClient(URL, username, password) + if err != nil { + return err + } + finder, ctx, err := createFinder(ctx, client, dc_name) + if err != nil { + return err + } + vm_o, ctx, err := findVM_by_name(ctx, finder, vm_name) + if err != nil { + return err + } // creating new configuration for vm vmConfigSpec := types.VirtualMachineConfigSpec{} @@ -235,10 +255,12 @@ func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) { // finally reconfiguring task, err := vm_o.Reconfigure(ctx, vmConfigSpec) if err != nil { - panic(err) + return err } _, err = task.WaitForResult(ctx, nil) if err != nil { - panic(err) + return err } + + return nil } From 80a24446c406311ee0ecf8b6db588f209491045b Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sat, 22 Apr 2017 12:26:07 +0300 Subject: [PATCH 012/266] fixed return values in PostProcess method --- post-processor.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/post-processor.go b/post-processor.go index e43e5026f..b40a4b369 100644 --- a/post-processor.go +++ b/post-processor.go @@ -176,7 +176,12 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packe if err != nil { return nil, false, err } - return source, true, nil + + // Return: + // source -- the given artifact -- since we didn't change anything; + // false -- don't force packer to keep the source artifact + // nil -- no error occured here + return source, false, nil } func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { From 8b2a195efdf538cdca08bad5b3a755026ee9d0bf Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Sun, 23 Apr 2017 11:10:39 +0300 Subject: [PATCH 013/266] fixed some remnants of the error swallowing --- post-processor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/post-processor.go b/post-processor.go index b40a4b369..72d75590c 100644 --- a/post-processor.go +++ b/post-processor.go @@ -96,14 +96,14 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { if p.config.Cpu_sockets != "" { vm_opt_params.Cpu_sockets, err = strconv.Atoi(p.config.Cpu_sockets) if err != nil { - panic(err) + return err } } vm_opt_params.Ram = Unspecified if p.config.Ram != "" { vm_opt_params.Ram, err = strconv.Atoi(p.config.Ram) if err != nil { - panic(err) + return err } } From b2c6e44c7060675a15c86610bbbfc0c3100d227f Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Tue, 9 May 2017 17:23:57 +0300 Subject: [PATCH 014/266] Builder (#2) * the very initial builder: just clones the VM * removed post-processor * builder now waits for IP address * more separated steps * clean up * added run and shutdown steps * added step connecting via ssh * changed the BuilderId to a proper one * added shutdown command, only echo works * added cleanup * removed wainting for VM to stop, removed error on the non-zero exit status * removed BuildSuccessFlag * refactored config structures; fixed interpolation of json template * the rest of configuration refactoring * removed duplicated parameters from Config * removed duplicated parameters drom Config * changed BuilderId and Artifact * create a dedicated step for VM hardware configuration * merged StepSetupCloningEnv into StepCloneVM * improved cleanup * added proper handling of 'disconnected' command exit status; added guest os shutdown before halting the machine [in case when no shutdown command is given] * refactored non-conventional variable and field names * removed redundant fields from Artifact * removed the success field at all * removed ArtifactFiles * removed unnecessary warnings * minor change in parameters structure --- artifact.go | 26 +---- builder.go | 99 ++++++++++++++++ config.go | 88 ++++++++++++++ main.go | 2 +- post-processor.go | 271 ------------------------------------------- step_clone_vm.go | 172 +++++++++++++++++++++++++++ step_configure_hw.go | 44 +++++++ step_run.go | 72 ++++++++++++ step_shutdown.go | 83 +++++++++++++ 9 files changed, 564 insertions(+), 293 deletions(-) create mode 100644 builder.go create mode 100644 config.go delete mode 100644 post-processor.go create mode 100644 step_clone_vm.go create mode 100644 step_configure_hw.go create mode 100644 step_run.go create mode 100644 step_shutdown.go diff --git a/artifact.go b/artifact.go index ea36d8ff4..d4ee8c7b3 100644 --- a/artifact.go +++ b/artifact.go @@ -1,21 +1,9 @@ package main -import "fmt" - -const BuilderId = "LizaTretyakova.post-processor.vsphere-device" - -type ArtifactFile struct { - Name string `json:"name"` - Size int64 `json:"size"` -} +const BuilderId = "LizaTretyakova.vsphere" type Artifact struct { - BuildName string `json:"name"` - BuilderType string `json:"builder_type"` - BuildTime int64 `json:"build_time"` - ArtifactFiles []ArtifactFile `json:"files"` - ArtifactId string `json:"artifact_id"` - PackerRunUUID string `json:"packer_run_uuid"` + VMName string `json:"vm_name"` } func (a *Artifact) BuilderId() string { @@ -23,19 +11,15 @@ func (a *Artifact) BuilderId() string { } func (a *Artifact) Files() []string { - var files []string - for _, af := range a.ArtifactFiles { - files = append(files, af.Name) - } - return files + return []string{} } func (a *Artifact) Id() string { - return a.ArtifactId + return a.VMName } func (a *Artifact) String() string { - return fmt.Sprintf("%s-%s", a.BuildName, a.ArtifactId) + return a.VMName } func (a *Artifact) State(name string) interface{} { diff --git a/builder.go b/builder.go new file mode 100644 index 000000000..00ede0f07 --- /dev/null +++ b/builder.go @@ -0,0 +1,99 @@ +package main + +import ( + "errors" + "log" + + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/packer" + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/communicator" + gossh "golang.org/x/crypto/ssh" + "github.com/hashicorp/packer/communicator/ssh" +) + +type Builder struct { + config *Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + c, warnings, errs := NewConfig(raws...) + if errs != nil { + return warnings, errs + } + b.config = c + + return warnings, nil +} + +func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { + // Set up the state. + state := new(multistep.BasicStateBag) + state.Put("hook", hook) + state.Put("ui", ui) + + // Build the steps. + steps := []multistep.Step{ + &StepConfigureHW{ + config: b.config, + }, + &StepCloneVM{ + config: b.config, + }, + &StepRun{}, + &communicator.StepConnect{ + Config: &b.config.Config, + Host: func(state multistep.StateBag) (string, error) { + return state.Get("ip").(string), nil + }, + SSHConfig: func(multistep.StateBag) (*gossh.ClientConfig, error) { + return &gossh.ClientConfig{ + User: b.config.Config.SSHUsername, + Auth: []gossh.AuthMethod{ + gossh.Password(b.config.Config.SSHPassword), + gossh.KeyboardInteractive( + ssh.PasswordKeyboardInteractive(b.config.Config.SSHPassword)), + }, + // TODO: add a proper verification + HostKeyCallback: gossh.InsecureIgnoreHostKey(), + }, nil + }, + }, + &common.StepProvision{}, + &StepShutdown{ + Command: b.config.ShutdownCommand, + }, + } + + // Run! + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(state) + + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) + } + + // If we were interrupted or cancelled, then just exit. + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return nil, errors.New("Build was cancelled.") + } + + if _, ok := state.GetOk(multistep.StateHalted); ok { + return nil, errors.New("Build was halted.") + } + + // No errors, must've worked + artifact := &Artifact{ + VMName: b.config.VMName, + } + return artifact, nil +} + +func (b *Builder) Cancel() { + if b.runner != nil { + log.Println("Cancelling the step runner...") + b.runner.Cancel() + } +} diff --git a/config.go b/config.go new file mode 100644 index 000000000..2dbc13c4a --- /dev/null +++ b/config.go @@ -0,0 +1,88 @@ +package main + +import ( + "fmt" + + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "strconv" +) + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + communicator.Config `mapstructure:",squash"` + + Url string `mapstructure:"url"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` + + Template string `mapstructure:"template"` + VMName string `mapstructure:"vm_name"` + FolderName string `mapstructure:"folder_name"` + DCName string `mapstructure:"dc_name"` + + Cpus string `mapstructure:"cpus"` + ShutdownCommand string `mapstructure:"shutdown_command"` + Ram string `mapstructure:"RAM"` + //TODO: add more options + + ctx interpolate.Context +} + +func NewConfig(raws ...interface{}) (*Config, []string, error) { + c := new(Config) + err := config.Decode(c, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &c.ctx, + }, raws...) + if err != nil { + return nil, nil, err + } + + // Accumulate any errors + errs := new(packer.MultiError) + + // Prepare config(s) + errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...) + + // Check the required params + if c.Url == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("URL required")) + } + if c.Username == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Username required")) + } + if c.Password == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Password required")) + } + if c.Template == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Template VM name required")) + } + if c.VMName == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target VM name required")) + } + + // Verify numeric parameters if present + if c.Cpus != "" { + if _, err = strconv.Atoi(c.Cpus); err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of cpu sockets")) + } + } + if c.Ram != "" { + if _, err = strconv.Atoi(c.Ram); err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number for Ram")) + } + } + + // Warnings + var warnings []string + + if len(errs.Errors) > 0 { + return nil, warnings, errs + } + + return c, warnings, nil +} diff --git a/main.go b/main.go index de5038175..9beb821a0 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,6 @@ func main() { if err != nil { panic(err) } - server.RegisterPostProcessor(new(PostProcessor)) + server.RegisterBuilder(new(Builder)) server.Serve() } diff --git a/post-processor.go b/post-processor.go deleted file mode 100644 index 72d75590c..000000000 --- a/post-processor.go +++ /dev/null @@ -1,271 +0,0 @@ -package main - -import ( - "github.com/hashicorp/packer/common" - "github.com/hashicorp/packer/helper/config" - "github.com/hashicorp/packer/packer" - "github.com/hashicorp/packer/template/interpolate" - "github.com/vmware/govmomi" - "github.com/vmware/govmomi/find" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/types" - "context" - "fmt" - "net/url" - "strconv" -) - -type VMOptionalParams struct { - Cpu_sockets int - Ram int - // TODO: add more options -} - -type VMRequiredParams struct { - Url string - Username string - Password string - Dc_name string - Folder_name string - Vm_source_name string - Vm_target_name string -} - -const DefaultFolder = "" -const Unspecified = -1 - -var vm_opt_params VMOptionalParams -var vm_req_params VMRequiredParams - -type Config struct { - common.PackerConfig `mapstructure:",squash"` - - Url string `mapstructure:"url"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` - Dc_name string `mapstructure:"dc_name"` - Vm_source_name string `mapstructure:"vm_source_name"` - Vm_target_name string `mapstructure:"vm_target_name"` - Cpu_sockets string `mapstructure:"cpus"` - Ram string `mapstructure:"RAM"` - - ctx interpolate.Context -} - -type PostProcessor struct { - config Config -} - -func (p *PostProcessor) Configure(raws ...interface{}) error { - err := config.Decode(&p.config, &config.DecodeOpts{ - Interpolate: true, - InterpolateContext: &p.config.ctx, - InterpolateFilter: &interpolate.RenderFilter{ - Exclude: []string{}, - }, - }, raws...) - if err != nil { - return err - } - - // Accumulate any errors - errs := new(packer.MultiError) - - // Check the required params - templates := map[string]*string{ - "url": &p.config.Url, - "username": &p.config.Username, - "password": &p.config.Password, - "vm_source_name": &p.config.Vm_source_name, - } - for key, ptr := range templates { - if *ptr == "" { - errs = packer.MultiErrorAppend( - errs, fmt.Errorf("%s must be set, %s is present", key, *ptr)) - } - } - - if len(errs.Errors) > 0 { - return errs - } - - // Set optional params - vm_req_params.Folder_name = DefaultFolder - vm_opt_params.Cpu_sockets = Unspecified - if p.config.Cpu_sockets != "" { - vm_opt_params.Cpu_sockets, err = strconv.Atoi(p.config.Cpu_sockets) - if err != nil { - return err - } - } - vm_opt_params.Ram = Unspecified - if p.config.Ram != "" { - vm_opt_params.Ram, err = strconv.Atoi(p.config.Ram) - if err != nil { - return err - } - } - - // Set required params - vm_req_params.Url = p.config.Url - vm_req_params.Username = p.config.Username - vm_req_params.Password = p.config.Password - vm_req_params.Dc_name = p.config.Dc_name - vm_req_params.Vm_source_name = p.config.Vm_source_name - vm_req_params.Vm_target_name = vm_req_params.Vm_source_name + "_clone" - if p.config.Vm_target_name != "" { - vm_req_params.Vm_target_name = p.config.Vm_target_name - } - - return nil -} - -func CloneVM(req_params VMRequiredParams, opt_params VMOptionalParams) error { - // Prepare entities: client (authentification), finder, folder, virtual machine - client, ctx, err := createClient(req_params.Url, req_params.Username, req_params.Password) - if err != nil { - return err - } - finder, ctx, err := createFinder(ctx, client, req_params.Dc_name) - if err != nil { - return err - } - folder, err := finder.FolderOrDefault(ctx, req_params.Folder_name) - if err != nil { - return err - } - vm_src, ctx, err := findVM_by_name(ctx, finder, req_params.Vm_source_name) - if err != nil { - return err - } - - // Creating spec's for cloning - var relocateSpec types.VirtualMachineRelocateSpec - - var confSpec types.VirtualMachineConfigSpec - // configure HW - if opt_params.Cpu_sockets != Unspecified { - confSpec.NumCPUs = int32(opt_params.Cpu_sockets) - } - if opt_params.Ram != Unspecified { - confSpec.MemoryMB = int64(opt_params.Ram) - } - - cloneSpec := types.VirtualMachineCloneSpec{ - Location: relocateSpec, - Config: &confSpec, - PowerOn: false, - } - - // Cloning itself - task, err := vm_src.Clone(ctx, folder, req_params.Vm_target_name, cloneSpec) - if err != nil { - return err - } - _, err = task.WaitForResult(ctx, nil) - if err != nil { - return err - } - - return nil -} - -func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, error) { - err := CloneVM(vm_req_params, vm_opt_params) - if err != nil { - return nil, false, err - } - - // Return: - // source -- the given artifact -- since we didn't change anything; - // false -- don't force packer to keep the source artifact - // nil -- no error occured here - return source, false, nil -} - -func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { - // create context - ctx := context.TODO() // an empty, default context (for those, who is unsure) - - // create a client - // (connected to the specified URL, - // logged in with the username-password) - u, err := url.Parse(URL) // create a URL object from string - if err != nil { - return nil, nil, err - } - u.User = url.UserPassword(username, password) // set username and password for automatical authentification - fmt.Println(u.String()) - client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) - if err != nil { - return nil, nil, err - } - - return client, ctx, nil -} - -func createFinder(ctx context.Context, client *govmomi.Client, dc_name string) (*find.Finder, context.Context, error) { - // Create a finder to search for a vm with the specified name - finder := find.NewFinder(client.Client, false) - // Need to specify the datacenter - if dc_name == "" { - dc, err := finder.DefaultDatacenter(ctx) - if err != nil { - return nil, nil, err - } - var dc_mo mo.Datacenter - err = dc.Properties(ctx, dc.Reference(), []string{"name"}, &dc_mo) - if err != nil { - return nil, nil, err - } - dc_name = dc_mo.Name - finder.SetDatacenter(dc) - } else { - dc, err := finder.Datacenter(ctx, fmt.Sprintf("/%v", dc_name)) - if err != nil { - return nil, nil, err - } - finder.SetDatacenter(dc) - } - return finder, ctx, nil -} - -func findVM_by_name(ctx context.Context, finder *find.Finder, vm_name string) (*object.VirtualMachine, context.Context, error) { - vm_o, err := finder.VirtualMachine(ctx, vm_name) - if err != nil { - return nil, nil, err - } - return vm_o, ctx, nil -} - -func ReconfigureVM(URL, username, password, dc_name, vm_name string, cpus int) error { - client, ctx, err := createClient(URL, username, password) - if err != nil { - return err - } - finder, ctx, err := createFinder(ctx, client, dc_name) - if err != nil { - return err - } - vm_o, ctx, err := findVM_by_name(ctx, finder, vm_name) - if err != nil { - return err - } - - // creating new configuration for vm - vmConfigSpec := types.VirtualMachineConfigSpec{} - vmConfigSpec.NumCPUs = int32(cpus) - - // finally reconfiguring - task, err := vm_o.Reconfigure(ctx, vmConfigSpec) - if err != nil { - return err - } - _, err = task.WaitForResult(ctx, nil) - if err != nil { - return err - } - - return nil -} diff --git a/step_clone_vm.go b/step_clone_vm.go new file mode 100644 index 000000000..9f51972da --- /dev/null +++ b/step_clone_vm.go @@ -0,0 +1,172 @@ +package main + +import ( + "github.com/vmware/govmomi" + "context" + "github.com/mitchellh/multistep" + "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/object" + "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/find" + "fmt" + "net/url" +) + +type CloneParameters struct { + client *govmomi.Client + folder *object.Folder + vmSrc *object.VirtualMachine + ctx context.Context + vmName string + confSpec *types.VirtualMachineConfigSpec +} + +type StepCloneVM struct{ + config *Config + success bool +} + +func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + ui.Say("start cloning...") + + confSpec := state.Get("confSpec").(types.VirtualMachineConfigSpec) + + // Prepare entities: client (authentification), finder, folder, virtual machine + client, ctx, err := createClient(s.config.Url, s.config.Username, s.config.Password) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + finder, ctx, err := createFinder(ctx, client, s.config.DCName) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + folder, err := finder.FolderOrDefault(ctx, s.config.FolderName) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + cloneParameters := CloneParameters{ + client: client, + folder: folder, + vmSrc: vmSrc, + ctx: ctx, + vmName: s.config.VMName, + confSpec: &confSpec, + } + + vm, err := cloneVM(&cloneParameters) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + state.Put("vm", vm) + state.Put("ctx", ctx) + s.success = true + return multistep.ActionContinue +} + +func (s *StepCloneVM) Cleanup(state multistep.StateBag) { + if !s.success { + return + } + + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + + if cancelled || halted { + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) + ui := state.Get("ui").(packer.Ui) + + ui.Say("destroying VM...") + + task, err := vm.Destroy(ctx) + if err != nil { + ui.Error(err.Error()) + return + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + ui.Error(err.Error()) + return + } + } +} + +func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { + vm = nil + err = nil + + // Creating specs for cloning + var relocateSpec types.VirtualMachineRelocateSpec + cloneSpec := types.VirtualMachineCloneSpec{ + Location: relocateSpec, + Config: params.confSpec, + PowerOn: false, + } + + // Cloning itself + task, err := params.vmSrc.Clone(params.ctx, params.folder, params.vmName, cloneSpec) + if err != nil { + return + } + + info, err := task.WaitForResult(params.ctx, nil) + if err != nil { + return + } + + vm = object.NewVirtualMachine(params.client.Client, info.Result.(types.ManagedObjectReference)) + return vm, nil +} + +func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { + // create context + ctx := context.TODO() // an empty, default context (for those, who is unsure) + + // create a client + // (connected to the specified URL, + // logged in with the username-password) + u, err := url.Parse(URL) // create a URL object from string + if err != nil { + return nil, nil, err + } + u.User = url.UserPassword(username, password) // set username and password for automatical authentification + fmt.Println(u.String()) + client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) + if err != nil { + return nil, nil, err + } + + return client, ctx, nil +} + +func createFinder(ctx context.Context, client *govmomi.Client, dcName string) (*find.Finder, context.Context, error) { + // Create a finder to search for a vm with the specified name + finder := find.NewFinder(client.Client, false) + // Need to specify the datacenter + if dcName == "" { + dc, err := finder.DefaultDatacenter(ctx) + if err != nil { + return nil, nil, err + } + finder.SetDatacenter(dc) + } else { + dc, err := finder.Datacenter(ctx, dcName) + if err != nil { + return nil, nil, err + } + finder.SetDatacenter(dc) + } + return finder, ctx, nil +} diff --git a/step_configure_hw.go b/step_configure_hw.go new file mode 100644 index 000000000..d26c4ed11 --- /dev/null +++ b/step_configure_hw.go @@ -0,0 +1,44 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "strconv" + "github.com/vmware/govmomi/vim25/types" +) + +type StepConfigureHW struct{ + config *Config +} + +func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + ui.Say("configuring virtual hardware...") + + var confSpec types.VirtualMachineConfigSpec + // configure HW + if s.config.Cpus != "" { + cpus, err := strconv.Atoi(s.config.Cpus) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + confSpec.NumCPUs = int32(cpus) + } + if s.config.Ram != "" { + ram, err := strconv.Atoi(s.config.Ram) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + confSpec.MemoryMB = int64(ram) + } + + state.Put("confSpec", confSpec) + + return multistep.ActionContinue +} + +func (s *StepConfigureHW) Cleanup(multistep.StateBag) {} diff --git a/step_run.go b/step_run.go new file mode 100644 index 000000000..b603cdd84 --- /dev/null +++ b/step_run.go @@ -0,0 +1,72 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/object" + "context" + "fmt" + "github.com/vmware/govmomi/vim25/types" +) + +type StepRun struct{ + // TODO: add boot time to provide a proper timeout during cleanup +} + +func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) + + ui.Say("VM power on...") + task, err := vm.PowerOn(ctx) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + ui.Say("VM waiting for IP...") + ip, err := vm.WaitForIP(ctx) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + state.Put("ip", ip) + ui.Say(fmt.Sprintf("VM ip %v", ip)) + return multistep.ActionContinue +} + +func (s *StepRun) Cleanup(state multistep.StateBag) { + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + + if cancelled || halted { + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) + ui := state.Get("ui").(packer.Ui) + + if state, err := vm.PowerState(ctx); state != types.VirtualMachinePowerStatePoweredOff && err == nil { + ui.Say("shutting down VM...") + + task, err := vm.PowerOff(ctx) + if err != nil { + ui.Error(err.Error()) + return + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + ui.Error(err.Error()) + return + } + } else if err != nil { + ui.Error(err.Error()) + return + } + } +} diff --git a/step_shutdown.go b/step_shutdown.go new file mode 100644 index 000000000..24bdb7ca7 --- /dev/null +++ b/step_shutdown.go @@ -0,0 +1,83 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/object" + "context" + "fmt" + "log" + "time" + "bytes" +) + +type StepShutdown struct{ + Command string +} + +func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { + // is set during the communicator.StepConnect + comm := state.Get("communicator").(packer.Communicator) + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) + + ui.Say("VM shutdown...") + + if s.Command != "" { + ui.Say("Gracefully halting virtual machine...") + log.Printf("Executing shutdown command: %s", s.Command) + + var stdout, stderr bytes.Buffer + cmd := &packer.RemoteCmd{ + Command: s.Command, + Stdout: &stdout, + Stderr: &stderr, + } + if err := comm.Start(cmd); err != nil { + err := fmt.Errorf("Failed to send shutdown command: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + // TODO: add timeout + for !cmd.Exited { + ui.Say("Waiting for remote cmd to finish...") + time.Sleep(150 * time.Millisecond) + } + if cmd.ExitStatus != 0 && cmd.ExitStatus != packer.CmdDisconnect { + err := fmt.Errorf("Cmd exit status %v, not 0", cmd.ExitStatus) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } else if cmd.ExitStatus == packer.CmdDisconnect { + ui.Say("VM disconnected") + } + } else { + ui.Say("Forcibly halting virtual machine...") + + err := vm.ShutdownGuest(ctx) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + task, err := vm.PowerOff(ctx) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + } + + ui.Say("VM stopped") + return multistep.ActionContinue +} + +func (s *StepShutdown) Cleanup(state multistep.StateBag) {} + From 3643523fd163025ed7b86cdf71d10700638264e3 Mon Sep 17 00:00:00 2001 From: LizaTretyakova Date: Mon, 15 May 2017 00:25:50 +0300 Subject: [PATCH 015/266] Installation scripts --- build.sh | 10 +++++ docker-compose.yml | 6 +++ docker/Dockerfile | 9 ++++ glide.lock | 101 +++++++++++++++++++++++++++++++++++++++++++++ glide.yaml | 20 +++++++++ 5 files changed, 146 insertions(+) create mode 100755 build.sh create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100644 glide.lock create mode 100644 glide.yaml diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..8930f4dfb --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/sh -eux + +glide install -v +export CGO_ENABLED=0 +export GOARCH=amd64 +mkdir -p bin + +GOOS=darwin go build -o bin/packer-builder-vsphere.macos +GOOS=linux go build -o bin/packer-builder-vsphere.linux +GOOS=windows go build -o bin/packer-builder-vsphere.exe diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..230d43d0e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +build: + build: docker/ + volumes: + - .:/go/src/github.com/LizaTretyakova/packer-builder-vsphere + working_dir: /go/src/github.com/LizaTretyakova/packer-builder-vsphere + command: ./build.sh diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..81c9b98b0 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.7.1 +ARG GLIDE_VERSION=0.12.3 + +RUN export DEBIAN_FRONTEND=noninteractive && \ +apt-get -qq update && \ +apt-get -y install zip + +RUN wget -nv https://github.com/Masterminds/glide/releases/download/v$GLIDE_VERSION/glide-v$GLIDE_VERSION-linux-amd64.tar.gz -O- | \ +tar xzf - -C /usr/local/bin/ --strip-components=1 linux-amd64/glide diff --git a/glide.lock b/glide.lock new file mode 100644 index 000000000..dbc7b8cdf --- /dev/null +++ b/glide.lock @@ -0,0 +1,101 @@ +hash: 3573422cb6fc625124a39f2d84a52165fef966ef29dda9ff3842706be1442425 +updated: 2017-05-14T23:15:42.832534791+03:00 +imports: +- name: github.com/Azure/go-ntlmssp + version: 29affced641074a59483ed003b5ef73a8bd3593c +- name: github.com/dylanmei/iso8601 + version: 2075bf119b58e5576c6ed9f867b8f3d17f2e54d4 +- name: github.com/hashicorp/errwrap + version: 7554cd9344cec97297fa6649b055a8c98c2a1e55 +- name: github.com/hashicorp/go-multierror + version: ed905158d87462226a13fe39ddf685ea65f1c11f +- name: github.com/hashicorp/go-version + version: 03c5bf6be031b6dd45afec16b1cf94fc8938bc77 +- name: github.com/hashicorp/packer + version: 45a48132d0c455f777163538002aeb8784b64e50 + subpackages: + - common + - common/ssh + - common/uuid + - communicator/none + - communicator/ssh + - communicator/winrm + - helper/communicator + - helper/config + - packer + - packer/plugin + - packer/rpc + - template + - template/interpolate +- name: github.com/hashicorp/yamux + version: d1caa6c97c9fc1cc9e83bbe34d0603f9ff0ce8bd +- name: github.com/kr/fs + version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b +- name: github.com/masterzen/azure-sdk-for-go + version: ee4f0065d00cd12b542f18f5bc45799e88163b12 + subpackages: + - core/http + - core/tls +- name: github.com/masterzen/simplexml + version: 4572e39b1ab9fe03ee513ce6fc7e289e98482190 + subpackages: + - dom +- name: github.com/masterzen/winrm + version: acf371f6aff113fc0104a61cd72db45a7c27d310 + subpackages: + - soap +- name: github.com/masterzen/xmlpath + version: 13f4951698adc0fa9c1dda3e275d489a24201161 +- name: github.com/mitchellh/go-fs + version: 7bae45d9a684750e82b97ff320c82556614e621b + subpackages: + - fat +- name: github.com/mitchellh/iochan + version: 87b45ffd0e9581375c491fef3d32130bb15c5bd7 +- name: github.com/mitchellh/mapstructure + version: cc8532a8e9a55ea36402aa21efdf403a60d34096 +- name: github.com/mitchellh/multistep + version: 391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d +- name: github.com/mitchellh/reflectwalk + version: 8d802ff4ae93611b807597f639c19f76074df5c6 +- name: github.com/nu7hatch/gouuid + version: 179d4d0c4d8d407a32af483c2354df1d2c91e6c3 +- name: github.com/packer-community/winrmcp + version: c804d432b8b7fa77896f43cc426134348c3fd19e + subpackages: + - winrmcp +- name: github.com/pkg/errors + version: c605e284fe17294bda444b34710735b29d1a9d90 +- name: github.com/pkg/sftp + version: a5f8514e29e90a859e93871b1582e5c81f466f82 +- name: github.com/ugorji/go + version: 708a42d246822952f38190a8d8c4e6b16a0e600c + subpackages: + - codec +- name: github.com/vmware/govmomi + version: 35caa01bfa4cbff15d06382021e2028bdf0a77ad + subpackages: + - find + - list + - object + - property + - session + - task + - vim25 + - vim25/debug + - vim25/methods + - vim25/mo + - vim25/progress + - vim25/soap + - vim25/types + - vim25/xml +- name: golang.org/x/crypto + version: ab89591268e0c8b748cbe4047b00197516011af5 + subpackages: + - curve25519 + - ed25519 + - ed25519/internal/edwards25519 + - md4 + - ssh + - ssh/agent +testImports: [] diff --git a/glide.yaml b/glide.yaml new file mode 100644 index 000000000..f99726467 --- /dev/null +++ b/glide.yaml @@ -0,0 +1,20 @@ +package: github.com/LizaTretyakova/packer-builder-vsphere +import: +- package: github.com/hashicorp/packer + subpackages: + - common + - communicator/ssh + - helper/communicator + - helper/config + - packer + - packer/plugin + - template/interpolate +- package: github.com/mitchellh/multistep +- package: github.com/vmware/govmomi + subpackages: + - find + - object + - vim25/types +- package: golang.org/x/crypto + subpackages: + - ssh From 281baa24597b76c8e2c372f744a586da636e4bee Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Mon, 15 May 2017 01:15:24 +0300 Subject: [PATCH 016/266] Create README.md --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..958c0e6d2 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# packer-builder-vsphere + +## Installation instructions + +0. It is supposed that you already have Go(and [Packer](https://github.com/hashicorp/packer)), [Docker-compose](https://docs.docker.com/compose/install/) and [Glide](https://github.com/Masterminds/glide) set. + +1. Download the sourcces from [github.com/LizaTretyakova/packer-builder-vsphere](github.com/LizaTretyakova/packer-builder-vsphere) + +2. `cd` to `$GOPATH/go/src/github.com/LizaTretyakova/packer-builder-vsphere` (or wherever it was downloaded) + +3. Build the binaries +``` +$ sudo docker-compose up +``` + +4. The template for this builder is like following: +```json +{ + "variables": { + "url": "{{env `YOUR_VSPHERE_URL`}}", + "username": "{{env `YOUR_VSPHERE_USERNAME`}}", + "password": "{{env `YOUR_VSPHERE_PASSWORD`}}", + "ssh_username": "{{env `TEMPLATE_VM_SSH_USERNAME`}}", + "ssh_password": "{{env `TEMPLATE_VM_SSH_PASSWORD`}}", + "dc_name": "{{env `TEMPLATE_VM_DATACENTER`}}", + "template": "{{env `TEMPLATE_VM_NAME`}}" + }, + "builders": [ + { + "type": "vsphere", + "url": "{{user `url`}}", + "username": "{{user `username`}}", + "password": "{{user `password`}}", + "ssh_username": "{{user `ssh_username`}}", + "ssh_password": "{{user `ssh_password`}}", + "dc_name": "{{user `dc_name`}}", + "template": "{{user `template`}}", + "vm_name": "new_vm_name", + "RAM": "1024", + "cpus": "2", + "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S shutdown -P now" + } + ] +} +``` +where `vm_name`, `RAM`, `cpus` and `shutdown_command` are parameters of the new VM. +Parameters `ssh_*`, `dc_name` (datacenter name) and `template` (the name of the base VM) are for the base VM, +on which you are creating the new one (note, that VMWare Tools should be already installed on this template machine). +`url`, `username` and `password` are your vSphere parameters. +You need to set the appropriate values in the `variables` section before proceeding. + +5. Now you can go to the `bin/` directory +``` +$ cd ./bin +``` +and try the builder +``` +$ packer build template.json +``` From 56e713faa0dd3a2226b8ceaf95d802a45da8a09f Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Mon, 15 May 2017 01:27:14 +0300 Subject: [PATCH 017/266] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 958c0e6d2..3aa1fa607 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,12 @@ $ sudo docker-compose up "cpus": "2", "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S shutdown -P now" } + ], + "provisioners": [ + { + "type": "shell", + "inline": ["echo foo"] + } ] } ``` From 0cb041516a71d1e52fff6773a0d05a12dd4af7d9 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Mon, 15 May 2017 16:11:01 +0300 Subject: [PATCH 018/266] Update README.md --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3aa1fa607..3c4c940bb 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,17 @@ 2. `cd` to `$GOPATH/go/src/github.com/LizaTretyakova/packer-builder-vsphere` (or wherever it was downloaded) -3. Build the binaries +3. Get the dependencies +``` +$ glide install +``` + +4. Build the binaries ``` $ sudo docker-compose up ``` -4. The template for this builder is like following: +5. The template for this builder is like following: ```json { "variables": { @@ -55,7 +60,7 @@ on which you are creating the new one (note, that VMWare Tools should be already `url`, `username` and `password` are your vSphere parameters. You need to set the appropriate values in the `variables` section before proceeding. -5. Now you can go to the `bin/` directory +6. Now you can go to the `bin/` directory ``` $ cd ./bin ``` From df40bd8a76c7311f428385e314ea26d775e48b76 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 16 May 2017 08:16:12 +0300 Subject: [PATCH 019/266] Lock govmomi dependency version --- .gitignore | 3 +++ glide.lock | 6 +++--- glide.yaml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e1feff00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/ +vendor/ +packer-builder-vsphere diff --git a/glide.lock b/glide.lock index dbc7b8cdf..d4f6dda26 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 3573422cb6fc625124a39f2d84a52165fef966ef29dda9ff3842706be1442425 -updated: 2017-05-14T23:15:42.832534791+03:00 +hash: 9caf4a309ee0ce30e273ceb77d66b9b49090765e1f0dcbe6e05ce0da88b1435f +updated: 2017-05-16T08:15:30.457888159+03:00 imports: - name: github.com/Azure/go-ntlmssp version: 29affced641074a59483ed003b5ef73a8bd3593c @@ -73,7 +73,7 @@ imports: subpackages: - codec - name: github.com/vmware/govmomi - version: 35caa01bfa4cbff15d06382021e2028bdf0a77ad + version: 9bfdc5ce62c0585b48b154cc460f8664dcd124c3 subpackages: - find - list diff --git a/glide.yaml b/glide.yaml index f99726467..fb45a1760 100644 --- a/glide.yaml +++ b/glide.yaml @@ -11,6 +11,7 @@ import: - template/interpolate - package: github.com/mitchellh/multistep - package: github.com/vmware/govmomi + version: v0.14.0 subpackages: - find - object From 29593bb5093668abed88af2102f51ca710b8cf4e Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 16 May 2017 08:49:32 +0300 Subject: [PATCH 020/266] fix Dockerfile --- .gitignore | 2 ++ README.md | 2 +- docker/Dockerfile | 4 ---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index e1feff00a..22ee9f5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .idea/ +.glide/ vendor/ packer-builder-vsphere +bin/ diff --git a/README.md b/README.md index 3c4c940bb..b69596446 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ $ glide install 4. Build the binaries ``` -$ sudo docker-compose up +$ docker-compose run build ``` 5. The template for this builder is like following: diff --git a/docker/Dockerfile b/docker/Dockerfile index 81c9b98b0..f5a2d777a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,9 +1,5 @@ FROM golang:1.7.1 ARG GLIDE_VERSION=0.12.3 -RUN export DEBIAN_FRONTEND=noninteractive && \ -apt-get -qq update && \ -apt-get -y install zip - RUN wget -nv https://github.com/Masterminds/glide/releases/download/v$GLIDE_VERSION/glide-v$GLIDE_VERSION-linux-amd64.tar.gz -O- | \ tar xzf - -C /usr/local/bin/ --strip-components=1 linux-amd64/glide From b3dcaab8b3b378e388457b4b51ba3088c1df1292 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Fri, 19 May 2017 07:44:27 +0300 Subject: [PATCH 021/266] Hw customization (#13) moved all configuration after cloning --- builder.go | 4 ++-- step_clone_vm.go | 5 ----- step_configure_hw.go | 31 ++++++++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/builder.go b/builder.go index 00ede0f07..6dbb4b476 100644 --- a/builder.go +++ b/builder.go @@ -35,10 +35,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe // Build the steps. steps := []multistep.Step{ - &StepConfigureHW{ + &StepCloneVM{ config: b.config, }, - &StepCloneVM{ + &StepConfigureHW{ config: b.config, }, &StepRun{}, diff --git a/step_clone_vm.go b/step_clone_vm.go index 9f51972da..921b9e696 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -18,7 +18,6 @@ type CloneParameters struct { vmSrc *object.VirtualMachine ctx context.Context vmName string - confSpec *types.VirtualMachineConfigSpec } type StepCloneVM struct{ @@ -30,8 +29,6 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) ui.Say("start cloning...") - confSpec := state.Get("confSpec").(types.VirtualMachineConfigSpec) - // Prepare entities: client (authentification), finder, folder, virtual machine client, ctx, err := createClient(s.config.Url, s.config.Username, s.config.Password) if err != nil { @@ -60,7 +57,6 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { vmSrc: vmSrc, ctx: ctx, vmName: s.config.VMName, - confSpec: &confSpec, } vm, err := cloneVM(&cloneParameters) @@ -111,7 +107,6 @@ func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { var relocateSpec types.VirtualMachineRelocateSpec cloneSpec := types.VirtualMachineCloneSpec{ Location: relocateSpec, - Config: params.confSpec, PowerOn: false, } diff --git a/step_configure_hw.go b/step_configure_hw.go index d26c4ed11..2e6da31e5 100644 --- a/step_configure_hw.go +++ b/step_configure_hw.go @@ -5,17 +5,25 @@ import ( "github.com/hashicorp/packer/packer" "strconv" "github.com/vmware/govmomi/vim25/types" + "context" + "github.com/vmware/govmomi/object" ) type StepConfigureHW struct{ config *Config } +type ConfigParametersFlag struct { + NumCPUsPtr *int32 + MemoryMBPtr *int64 +} + func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - ui.Say("configuring virtual hardware...") + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) var confSpec types.VirtualMachineConfigSpec + parametersFlag := ConfigParametersFlag{} // configure HW if s.config.Cpus != "" { cpus, err := strconv.Atoi(s.config.Cpus) @@ -25,6 +33,7 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { } confSpec.NumCPUs = int32(cpus) + parametersFlag.NumCPUsPtr = &(confSpec.NumCPUs) } if s.config.Ram != "" { ram, err := strconv.Atoi(s.config.Ram) @@ -34,9 +43,25 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { } confSpec.MemoryMB = int64(ram) + parametersFlag.MemoryMBPtr = &(confSpec.MemoryMB) } - state.Put("confSpec", confSpec) + ui := state.Get("ui").(packer.Ui) + if parametersFlag != (ConfigParametersFlag{}) { + ui.Say("configuring virtual hardware...") + task, err := vm.Reconfigure(ctx, confSpec) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + } else { + ui.Say("skipping the virtual hardware configration...") + } return multistep.ActionContinue } From ca41b34285e59827c9967f204649edefaa8e9e97 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Fri, 19 May 2017 08:50:59 +0300 Subject: [PATCH 022/266] Update glide.yaml --- glide.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/glide.yaml b/glide.yaml index fb45a1760..f99726467 100644 --- a/glide.yaml +++ b/glide.yaml @@ -11,7 +11,6 @@ import: - template/interpolate - package: github.com/mitchellh/multistep - package: github.com/vmware/govmomi - version: v0.14.0 subpackages: - find - object From 0b17912c077ab703273f3e4702645e6d31e9be26 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Wed, 31 May 2017 11:38:50 +0300 Subject: [PATCH 023/266] Implemented #4, #5 and #6 (#14) * initial changes: added host and pool parameters * backup * clones only within the same host * added some debug-output * minor fixes * vm experiments * added datastore to realocation spec * added datastore parameter; fixed copying between hosts * removed debug-output * changed dependencies --- config.go | 20 +++++++--- glide.lock | 101 ----------------------------------------------- step_clone_vm.go | 87 +++++++++++++++++++++++----------------- 3 files changed, 66 insertions(+), 142 deletions(-) delete mode 100644 glide.lock diff --git a/config.go b/config.go index 2dbc13c4a..c7cb5f3ed 100644 --- a/config.go +++ b/config.go @@ -19,15 +19,19 @@ type Config struct { Username string `mapstructure:"username"` Password string `mapstructure:"password"` - Template string `mapstructure:"template"` - VMName string `mapstructure:"vm_name"` - FolderName string `mapstructure:"folder_name"` - DCName string `mapstructure:"dc_name"` + // Location + Template string `mapstructure:"template"` + VMName string `mapstructure:"vm_name"` + FolderName string `mapstructure:"folder_name"` + DCName string `mapstructure:"dc_name"` + Host string `mapstructure:"host"` + ResourcePool string `mapstructure:"resource_pool"` + Datastore string `mapstructure:"datastore"` + // Hardware Cpus string `mapstructure:"cpus"` ShutdownCommand string `mapstructure:"shutdown_command"` Ram string `mapstructure:"RAM"` - //TODO: add more options ctx interpolate.Context } @@ -64,6 +68,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { if c.VMName == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target VM name required")) } + if c.Host == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target host required")) + } // Verify numeric parameters if present if c.Cpus != "" { @@ -79,6 +86,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { // Warnings var warnings []string + if c.Datastore == "" { + warnings = append(warnings, "Datastore is not specified, will try to find a default one") + } if len(errs.Errors) > 0 { return nil, warnings, errs diff --git a/glide.lock b/glide.lock deleted file mode 100644 index d4f6dda26..000000000 --- a/glide.lock +++ /dev/null @@ -1,101 +0,0 @@ -hash: 9caf4a309ee0ce30e273ceb77d66b9b49090765e1f0dcbe6e05ce0da88b1435f -updated: 2017-05-16T08:15:30.457888159+03:00 -imports: -- name: github.com/Azure/go-ntlmssp - version: 29affced641074a59483ed003b5ef73a8bd3593c -- name: github.com/dylanmei/iso8601 - version: 2075bf119b58e5576c6ed9f867b8f3d17f2e54d4 -- name: github.com/hashicorp/errwrap - version: 7554cd9344cec97297fa6649b055a8c98c2a1e55 -- name: github.com/hashicorp/go-multierror - version: ed905158d87462226a13fe39ddf685ea65f1c11f -- name: github.com/hashicorp/go-version - version: 03c5bf6be031b6dd45afec16b1cf94fc8938bc77 -- name: github.com/hashicorp/packer - version: 45a48132d0c455f777163538002aeb8784b64e50 - subpackages: - - common - - common/ssh - - common/uuid - - communicator/none - - communicator/ssh - - communicator/winrm - - helper/communicator - - helper/config - - packer - - packer/plugin - - packer/rpc - - template - - template/interpolate -- name: github.com/hashicorp/yamux - version: d1caa6c97c9fc1cc9e83bbe34d0603f9ff0ce8bd -- name: github.com/kr/fs - version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b -- name: github.com/masterzen/azure-sdk-for-go - version: ee4f0065d00cd12b542f18f5bc45799e88163b12 - subpackages: - - core/http - - core/tls -- name: github.com/masterzen/simplexml - version: 4572e39b1ab9fe03ee513ce6fc7e289e98482190 - subpackages: - - dom -- name: github.com/masterzen/winrm - version: acf371f6aff113fc0104a61cd72db45a7c27d310 - subpackages: - - soap -- name: github.com/masterzen/xmlpath - version: 13f4951698adc0fa9c1dda3e275d489a24201161 -- name: github.com/mitchellh/go-fs - version: 7bae45d9a684750e82b97ff320c82556614e621b - subpackages: - - fat -- name: github.com/mitchellh/iochan - version: 87b45ffd0e9581375c491fef3d32130bb15c5bd7 -- name: github.com/mitchellh/mapstructure - version: cc8532a8e9a55ea36402aa21efdf403a60d34096 -- name: github.com/mitchellh/multistep - version: 391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d -- name: github.com/mitchellh/reflectwalk - version: 8d802ff4ae93611b807597f639c19f76074df5c6 -- name: github.com/nu7hatch/gouuid - version: 179d4d0c4d8d407a32af483c2354df1d2c91e6c3 -- name: github.com/packer-community/winrmcp - version: c804d432b8b7fa77896f43cc426134348c3fd19e - subpackages: - - winrmcp -- name: github.com/pkg/errors - version: c605e284fe17294bda444b34710735b29d1a9d90 -- name: github.com/pkg/sftp - version: a5f8514e29e90a859e93871b1582e5c81f466f82 -- name: github.com/ugorji/go - version: 708a42d246822952f38190a8d8c4e6b16a0e600c - subpackages: - - codec -- name: github.com/vmware/govmomi - version: 9bfdc5ce62c0585b48b154cc460f8664dcd124c3 - subpackages: - - find - - list - - object - - property - - session - - task - - vim25 - - vim25/debug - - vim25/methods - - vim25/mo - - vim25/progress - - vim25/soap - - vim25/types - - vim25/xml -- name: golang.org/x/crypto - version: ab89591268e0c8b748cbe4047b00197516011af5 - subpackages: - - curve25519 - - ed25519 - - ed25519/internal/edwards25519 - - md4 - - ssh - - ssh/agent -testImports: [] diff --git a/step_clone_vm.go b/step_clone_vm.go index 921b9e696..e3fc04c1b 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -13,11 +13,13 @@ import ( ) type CloneParameters struct { - client *govmomi.Client - folder *object.Folder - vmSrc *object.VirtualMachine - ctx context.Context - vmName string + client *govmomi.Client + folder *object.Folder + resourcePool *object.ResourcePool + datastore *object.Datastore + vmSrc *object.VirtualMachine + ctx context.Context + vmName string } type StepCloneVM struct{ @@ -35,31 +37,56 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { state.Put("error", err) return multistep.ActionHalt } - finder, ctx, err := createFinder(ctx, client, s.config.DCName) + + // Set up finder + finder := find.NewFinder(client.Client, false) + dc, err := finder.DatacenterOrDefault(ctx, s.config.DCName) if err != nil { state.Put("error", err) return multistep.ActionHalt } + finder.SetDatacenter(dc) + + // Get folder folder, err := finder.FolderOrDefault(ctx, s.config.FolderName) if err != nil { state.Put("error", err) return multistep.ActionHalt } + + // Get resource pool + pool, err := finder.ResourcePoolOrDefault(ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", dc.Name(), s.config.Host, s.config.ResourcePool)) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + // Get datastore + var datastore *object.Datastore = nil + if s.config.Datastore != "" { + datastore, err = finder.Datastore(ctx, s.config.Datastore) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + } + + // Get source VM vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) if err != nil { state.Put("error", err) return multistep.ActionHalt } - cloneParameters := CloneParameters{ - client: client, - folder: folder, - vmSrc: vmSrc, - ctx: ctx, - vmName: s.config.VMName, - } - - vm, err := cloneVM(&cloneParameters) + vm, err := cloneVM(&CloneParameters{ + client: client, + folder: folder, + resourcePool: pool, + datastore: datastore, + vmSrc: vmSrc, + ctx: ctx, + vmName: s.config.VMName, + }) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -102,9 +129,17 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { vm = nil err = nil + poolRef := params.resourcePool.Reference() // Creating specs for cloning - var relocateSpec types.VirtualMachineRelocateSpec + relocateSpec := types.VirtualMachineRelocateSpec{ + Pool: &(poolRef), + } + if params.datastore != nil { + datastoreRef := params.datastore.Reference() + relocateSpec.Datastore = &datastoreRef + } + cloneSpec := types.VirtualMachineCloneSpec{ Location: relocateSpec, PowerOn: false, @@ -145,23 +180,3 @@ func createClient(URL, username, password string) (*govmomi.Client, context.Cont return client, ctx, nil } - -func createFinder(ctx context.Context, client *govmomi.Client, dcName string) (*find.Finder, context.Context, error) { - // Create a finder to search for a vm with the specified name - finder := find.NewFinder(client.Client, false) - // Need to specify the datacenter - if dcName == "" { - dc, err := finder.DefaultDatacenter(ctx) - if err != nil { - return nil, nil, err - } - finder.SetDatacenter(dc) - } else { - dc, err := finder.Datacenter(ctx, dcName) - if err != nil { - return nil, nil, err - } - finder.SetDatacenter(dc) - } - return finder, ctx, nil -} From b77b70829df4245d1a3bd9f2e9271aaed8d4f7a8 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Wed, 31 May 2017 12:40:12 +0300 Subject: [PATCH 024/266] Update README.md --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b69596446..12186a9d2 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,23 @@ ## Installation instructions -0. It is supposed that you already have Go(and [Packer](https://github.com/hashicorp/packer)), [Docker-compose](https://docs.docker.com/compose/install/) and [Glide](https://github.com/Masterminds/glide) set. +1. It is supposed that you already have Go(and [Packer](https://github.com/hashicorp/packer)), [Docker-compose](https://docs.docker.com/compose/install/) and [Glide](https://github.com/Masterminds/glide) set. 1. Download the sourcces from [github.com/LizaTretyakova/packer-builder-vsphere](github.com/LizaTretyakova/packer-builder-vsphere) -2. `cd` to `$GOPATH/go/src/github.com/LizaTretyakova/packer-builder-vsphere` (or wherever it was downloaded) +1. `cd` to `$GOPATH/go/src/github.com/LizaTretyakova/packer-builder-vsphere` (or wherever it was downloaded) -3. Get the dependencies +1. Get the dependencies ``` $ glide install ``` -4. Build the binaries +5. Build the binaries ``` $ docker-compose run build ``` -5. The template for this builder is like following: +6. The template for this builder is like following: ```json { "variables": { @@ -28,7 +28,8 @@ $ docker-compose run build "ssh_username": "{{env `TEMPLATE_VM_SSH_USERNAME`}}", "ssh_password": "{{env `TEMPLATE_VM_SSH_PASSWORD`}}", "dc_name": "{{env `TEMPLATE_VM_DATACENTER`}}", - "template": "{{env `TEMPLATE_VM_NAME`}}" + "template": "{{env `TEMPLATE_VM_NAME`}}", + "host": "{{env `TARGET_HOST`}}" }, "builders": [ { @@ -41,6 +42,9 @@ $ docker-compose run build "dc_name": "{{user `dc_name`}}", "template": "{{user `template`}}", "vm_name": "new_vm_name", + "host": "{{user `host`}}", + "resource_pool": "your_target_resource_pool", + "datastore": "your_target_datastore", "RAM": "1024", "cpus": "2", "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S shutdown -P now" @@ -56,11 +60,12 @@ $ docker-compose run build ``` where `vm_name`, `RAM`, `cpus` and `shutdown_command` are parameters of the new VM. Parameters `ssh_*`, `dc_name` (datacenter name) and `template` (the name of the base VM) are for the base VM, -on which you are creating the new one (note, that VMWare Tools should be already installed on this template machine). +on which you are creating the new one (note that VMWare Tools should be already installed on this template machine). +`vm_name` and `host` (describe the name of the new VM and the name of the host where we want to create it) are required parameters; you can also specify `resource_pool` (if you don't, the builder will try to detect the default one) and `datastore` (**important**: if your target host differs from the initial one, you **have to** specify `datastore`; in case you stay within the same host, this parameter can be omitted). `url`, `username` and `password` are your vSphere parameters. You need to set the appropriate values in the `variables` section before proceeding. -6. Now you can go to the `bin/` directory +7. Now you can go to the `bin/` directory ``` $ cd ./bin ``` @@ -68,3 +73,39 @@ and try the builder ``` $ packer build template.json ``` + +## Builder parameters +I will repeat myself here a bit just to make the things clearer a bit. +### Required parameters: +* `username` +* `password` +* `template` +* `vm_name` +* `host` +### Optional parameters: +* Destination parameters: + * `resource_pool` + * `datastore` (but is required if you move between hosts) +* Hardware configuration: + * `cpus` + * `ram` + * `shutdown_command` +* `ssh_username` +* `ssh_password` +* `dc_name` (source datacenter) + +## Progress bar +You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well. + +- [x] hardware customization of the new VM (cpu, ram) +- [x] clone from template (not only from VM) +- [x] clone to alternate host, resource pool and datastore +- [ ] enable linked clones +- [ ] support Windows guest systems +- [ ] enable VM-to-template conversion +- [ ] tests +- [ ] add a shutdown timeout +- [ ] further hardware customization: + * resize disks + * ram reservation + * cpu reservation From bd6726700791c6fc44a675fc8a722e1b76e3aa9a Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Wed, 31 May 2017 12:41:01 +0300 Subject: [PATCH 025/266] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12186a9d2..d46065700 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ $ packer build template.json ``` ## Builder parameters -I will repeat myself here a bit just to make the things clearer a bit. +I will repeat myself here a bit just to make the things clearer. ### Required parameters: * `username` * `password` From 9b89fde5bb43bda222bdabb70d9fc1c4681033da Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Wed, 31 May 2017 12:49:28 +0300 Subject: [PATCH 026/266] Update README.md --- README.md | 74 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index d46065700..94d05ecc8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,43 @@ # packer-builder-vsphere + +## Builder parameters +### Required parameters: +* `username` +* `password` +* `template` +* `vm_name` +* `host` +### Optional parameters: +* Destination parameters: + * `resource_pool` + * `datastore` (but is required if you move between hosts) +* Hardware configuration: + * `cpus` + * `ram` + * `shutdown_command` +* `ssh_username` +* `ssh_password` +* `dc_name` (source datacenter) + +You will find an example in **Installation instructions** section. + +## Progress bar +You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well. + +- [x] hardware customization of the new VM (cpu, ram) +- [x] clone from template (not only from VM) +- [x] clone to alternate host, resource pool and datastore +- [ ] enable linked clones +- [ ] support Windows guest systems +- [ ] enable VM-to-template conversion +- [ ] tests +- [ ] add a shutdown timeout +- [ ] further hardware customization: + * resize disks + * ram reservation + * cpu reservation + ## Installation instructions 1. It is supposed that you already have Go(and [Packer](https://github.com/hashicorp/packer)), [Docker-compose](https://docs.docker.com/compose/install/) and [Glide](https://github.com/Masterminds/glide) set. @@ -73,39 +111,3 @@ and try the builder ``` $ packer build template.json ``` - -## Builder parameters -I will repeat myself here a bit just to make the things clearer. -### Required parameters: -* `username` -* `password` -* `template` -* `vm_name` -* `host` -### Optional parameters: -* Destination parameters: - * `resource_pool` - * `datastore` (but is required if you move between hosts) -* Hardware configuration: - * `cpus` - * `ram` - * `shutdown_command` -* `ssh_username` -* `ssh_password` -* `dc_name` (source datacenter) - -## Progress bar -You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well. - -- [x] hardware customization of the new VM (cpu, ram) -- [x] clone from template (not only from VM) -- [x] clone to alternate host, resource pool and datastore -- [ ] enable linked clones -- [ ] support Windows guest systems -- [ ] enable VM-to-template conversion -- [ ] tests -- [ ] add a shutdown timeout -- [ ] further hardware customization: - * resize disks - * ram reservation - * cpu reservation From ac139471c84c4696eefa13ff6194b105d2edc7f1 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Sat, 10 Jun 2017 01:44:24 +0300 Subject: [PATCH 027/266] Create README.md --- README.md | 56 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 94d05ecc8..700bc074a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,27 @@ # packer-builder-vsphere +## The minimal working builder +``` json +{ + "builders": [ + { + "type": "vsphere", + + "url": "https://your.lab.addr/", + "username": "username", + "password": "secret", + + "ssh_username": "ssh_username", + "ssh_password": "ssh_secret", + + "template": "source_vm_name", + "vm_name": "clone_name", + "host": "172.16.0.1" + } + ] +} +``` +(`host` is for target host) ## Builder parameters ### Required parameters: @@ -11,7 +33,7 @@ ### Optional parameters: * Destination parameters: * `resource_pool` - * `datastore` (but is required if you move between hosts) + * `datastore` * Hardware configuration: * `cpus` * `ram` @@ -59,33 +81,23 @@ $ docker-compose run build 6. The template for this builder is like following: ```json { - "variables": { - "url": "{{env `YOUR_VSPHERE_URL`}}", - "username": "{{env `YOUR_VSPHERE_USERNAME`}}", - "password": "{{env `YOUR_VSPHERE_PASSWORD`}}", - "ssh_username": "{{env `TEMPLATE_VM_SSH_USERNAME`}}", - "ssh_password": "{{env `TEMPLATE_VM_SSH_PASSWORD`}}", - "dc_name": "{{env `TEMPLATE_VM_DATACENTER`}}", - "template": "{{env `TEMPLATE_VM_NAME`}}", - "host": "{{env `TARGET_HOST`}}" - }, "builders": [ { "type": "vsphere", - "url": "{{user `url`}}", - "username": "{{user `username`}}", - "password": "{{user `password`}}", - "ssh_username": "{{user `ssh_username`}}", - "ssh_password": "{{user `ssh_password`}}", - "dc_name": "{{user `dc_name`}}", - "template": "{{user `template`}}", + "url": "https://your.url/", + "username": "username", + "password": "secret", + "ssh_username": "ssh_username", + "ssh_password": "ssh_secret", + "dc_name": "datacenter1", + "template": "template_vm_name", "vm_name": "new_vm_name", - "host": "{{user `host`}}", - "resource_pool": "your_target_resource_pool", - "datastore": "your_target_datastore", + "host": "172.16.0.1", + "resource_pool": "target_rpool", + "datastore": "target_datastore", "RAM": "1024", "cpus": "2", - "shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S shutdown -P now" + "shutdown_command": "echo 'ssh_secret' | sudo -S shutdown -P now" } ], "provisioners": [ From 66705e4a2674bb1b86d4d48bad1466a8336a64da Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Mon, 12 Jun 2017 01:45:25 +0300 Subject: [PATCH 028/266] Adding linked clones (#17) * Simple linked cloning, just crashing if no snapshots --- config.go | 1 + step_clone_vm.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/config.go b/config.go index c7cb5f3ed..217e0e456 100644 --- a/config.go +++ b/config.go @@ -27,6 +27,7 @@ type Config struct { Host string `mapstructure:"host"` ResourcePool string `mapstructure:"resource_pool"` Datastore string `mapstructure:"datastore"` + LinkedClone bool `mapstructure:"linked_clone"` // Hardware Cpus string `mapstructure:"cpus"` diff --git a/step_clone_vm.go b/step_clone_vm.go index e3fc04c1b..ddbc7c220 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -10,6 +10,8 @@ import ( "github.com/vmware/govmomi/find" "fmt" "net/url" + "github.com/vmware/govmomi/vim25/mo" + "errors" ) type CloneParameters struct { @@ -20,6 +22,7 @@ type CloneParameters struct { vmSrc *object.VirtualMachine ctx context.Context vmName string + linkedClone bool } type StepCloneVM struct{ @@ -86,6 +89,7 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { vmSrc: vmSrc, ctx: ctx, vmName: s.config.VMName, + linkedClone: s.config.LinkedClone, }) if err != nil { state.Put("error", err) @@ -139,11 +143,27 @@ func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { datastoreRef := params.datastore.Reference() relocateSpec.Datastore = &datastoreRef } + if params.linkedClone == true { + relocateSpec.DiskMoveType = "createNewChildDiskBacking" + } cloneSpec := types.VirtualMachineCloneSpec{ Location: relocateSpec, PowerOn: false, } + if params.linkedClone == true { + var vmImage mo.VirtualMachine + err = params.vmSrc.Properties(params.ctx, params.vmSrc.Reference(), []string{"snapshot"}, &vmImage) + if err != nil { + err = fmt.Errorf("Error reading base VM properties: %s", err) + return + } + if vmImage.Snapshot == nil { + err = errors.New("`linked_clone=true`, but image VM has no snapshots") + return + } + cloneSpec.Snapshot = vmImage.Snapshot.CurrentSnapshot + } // Cloning itself task, err := params.vmSrc.Clone(params.ctx, params.folder, params.vmName, cloneSpec) From 39099ad3af9e2d418bb30c07958cc6e0a48eaba8 Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Tue, 13 Jun 2017 14:11:41 +0300 Subject: [PATCH 029/266] Added template conversion (#18) * Added conversion to template without timeout * Added timeout * Extracted converting to template to a separate step --- builder.go | 6 +++++- config.go | 16 +++++++++++++++- step_configure_hw.go | 1 + step_post_process.go | 33 ++++++++++++++++++++++++++++++++ step_shutdown.go | 45 ++++++++++++++++++++++---------------------- 5 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 step_post_process.go diff --git a/builder.go b/builder.go index 6dbb4b476..91e80927a 100644 --- a/builder.go +++ b/builder.go @@ -62,7 +62,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &common.StepProvision{}, &StepShutdown{ - Command: b.config.ShutdownCommand, + Command: b.config.ShutdownCommand, + ShutdownTimeout: b.config.ShutdownTimeout, + }, + &StepPostProcess{ + ToTemplate: b.config.ToTemplate, }, } diff --git a/config.go b/config.go index 217e0e456..c704e2a55 100644 --- a/config.go +++ b/config.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "strconv" + "time" ) type Config struct { @@ -27,7 +28,12 @@ type Config struct { Host string `mapstructure:"host"` ResourcePool string `mapstructure:"resource_pool"` Datastore string `mapstructure:"datastore"` + + // Settings LinkedClone bool `mapstructure:"linked_clone"` + ToTemplate bool `mapstructure:"to_template"` + RawShutdownTimeout string `mapstructure:"shutdown_timeout"` + ShutdownTimeout time.Duration `` // Hardware Cpus string `mapstructure:"cpus"` @@ -84,11 +90,19 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number for Ram")) } } + if c.RawShutdownTimeout == "" { + c.RawShutdownTimeout = "5m" + } + c.ShutdownTimeout, err = time.ParseDuration(c.RawShutdownTimeout) + if err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) + } + // Warnings var warnings []string if c.Datastore == "" { - warnings = append(warnings, "Datastore is not specified, will try to find a default one") + warnings = append(warnings, "Datastore is not specified, will try to find the default one") } if len(errs.Errors) > 0 { diff --git a/step_configure_hw.go b/step_configure_hw.go index 2e6da31e5..3f2b235e9 100644 --- a/step_configure_hw.go +++ b/step_configure_hw.go @@ -49,6 +49,7 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) if parametersFlag != (ConfigParametersFlag{}) { ui.Say("configuring virtual hardware...") + // Reconfigure hardware task, err := vm.Reconfigure(ctx, confSpec) if err != nil { state.Put("error", err) diff --git a/step_post_process.go b/step_post_process.go new file mode 100644 index 000000000..3c4c074a5 --- /dev/null +++ b/step_post_process.go @@ -0,0 +1,33 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/object" + "context" +) + +type StepPostProcess struct{ + ToTemplate bool +} + +func (s *StepPostProcess) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) + + // Turning into template if needed + if s.ToTemplate { + ui.Say("turning into template...") + err := vm.MarkAsTemplate(ctx) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + ui.Say("done") + } + + return multistep.ActionContinue +} + +func (s *StepPostProcess) Cleanup(state multistep.StateBag) {} diff --git a/step_shutdown.go b/step_shutdown.go index 24bdb7ca7..5e9eaf1f3 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -9,10 +9,12 @@ import ( "log" "time" "bytes" + "errors" ) type StepShutdown struct{ - Command string + Command string + ShutdownTimeout time.Duration } func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { @@ -40,38 +42,37 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { ui.Error(err.Error()) return multistep.ActionHalt } - - // TODO: add timeout - for !cmd.Exited { - ui.Say("Waiting for remote cmd to finish...") - time.Sleep(150 * time.Millisecond) - } - if cmd.ExitStatus != 0 && cmd.ExitStatus != packer.CmdDisconnect { - err := fmt.Errorf("Cmd exit status %v, not 0", cmd.ExitStatus) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } else if cmd.ExitStatus == packer.CmdDisconnect { - ui.Say("VM disconnected") - } } else { ui.Say("Forcibly halting virtual machine...") err := vm.ShutdownGuest(ctx) + if err != nil { + state.Put("error", fmt.Errorf("Could not shutdown guest: %v", err)) + return multistep.ActionHalt + } + } + + // Wait for the machine to actually shut down + log.Printf("Waiting max %s for shutdown to complete", s.ShutdownTimeout) + shutdownTimer := time.After(s.ShutdownTimeout) + for { + powerState, err := vm.PowerState(ctx) if err != nil { state.Put("error", err) return multistep.ActionHalt } + if powerState == "poweredOff" { + break + } - task, err := vm.PowerOff(ctx) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - _, err = task.WaitForResult(ctx, nil) - if err != nil { + select { + case <-shutdownTimer: + err := errors.New("Timeout while waiting for machine to shut down.") state.Put("error", err) + ui.Error(err.Error()) return multistep.ActionHalt + default: + time.Sleep(150 * time.Millisecond) } } From e394b27a21c5d20d67e7ce86d115b4646aecf21d Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Sat, 24 Jun 2017 02:19:44 +0300 Subject: [PATCH 030/266] Update README.md --- README.md | 93 +++++++++++++++++++++++-------------------------------- 1 file changed, 39 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 700bc074a..f6253e82c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # packer-builder-vsphere -## The minimal working builder +## Usage +* Download the plugin from the [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page +* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply save it into the working directory together with a configuration file; you may create your own configuration file or take the one given below (remember to put your real values for names, passwords, `url` and `host`) ``` json +template.json + { "builders": [ { @@ -22,6 +26,10 @@ } ``` (`host` is for target host) +* Run: +``` +$ packer build template.json +``` ## Builder parameters ### Required parameters: @@ -41,60 +49,30 @@ * `ssh_username` * `ssh_password` * `dc_name` (source datacenter) +* Post-processing: + * `linked_clone` + * `to_template` -You will find an example in **Installation instructions** section. - -## Progress bar -You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well. - -- [x] hardware customization of the new VM (cpu, ram) -- [x] clone from template (not only from VM) -- [x] clone to alternate host, resource pool and datastore -- [ ] enable linked clones -- [ ] support Windows guest systems -- [ ] enable VM-to-template conversion -- [ ] tests -- [ ] add a shutdown timeout -- [ ] further hardware customization: - * resize disks - * ram reservation - * cpu reservation - -## Installation instructions - -1. It is supposed that you already have Go(and [Packer](https://github.com/hashicorp/packer)), [Docker-compose](https://docs.docker.com/compose/install/) and [Glide](https://github.com/Masterminds/glide) set. - -1. Download the sourcces from [github.com/LizaTretyakova/packer-builder-vsphere](github.com/LizaTretyakova/packer-builder-vsphere) - -1. `cd` to `$GOPATH/go/src/github.com/LizaTretyakova/packer-builder-vsphere` (or wherever it was downloaded) - -1. Get the dependencies -``` -$ glide install -``` - -5. Build the binaries -``` -$ docker-compose run build -``` - -6. The template for this builder is like following: +See an example below: ```json { "builders": [ { "type": "vsphere", - "url": "https://your.url/", + + "url": "https://your.lab.addr/", "username": "username", "password": "secret", + "ssh_username": "ssh_username", "ssh_password": "ssh_secret", - "dc_name": "datacenter1", - "template": "template_vm_name", - "vm_name": "new_vm_name", + + "template": "template_name", + "vm_name": "clone_name", "host": "172.16.0.1", - "resource_pool": "target_rpool", - "datastore": "target_datastore", + "linked_clone": true, + "to_template": true, + "RAM": "1024", "cpus": "2", "shutdown_command": "echo 'ssh_secret' | sudo -S shutdown -P now" @@ -111,15 +89,22 @@ $ docker-compose run build where `vm_name`, `RAM`, `cpus` and `shutdown_command` are parameters of the new VM. Parameters `ssh_*`, `dc_name` (datacenter name) and `template` (the name of the base VM) are for the base VM, on which you are creating the new one (note that VMWare Tools should be already installed on this template machine). -`vm_name` and `host` (describe the name of the new VM and the name of the host where we want to create it) are required parameters; you can also specify `resource_pool` (if you don't, the builder will try to detect the default one) and `datastore` (**important**: if your target host differs from the initial one, you **have to** specify `datastore`; in case you stay within the same host, this parameter can be omitted). +`vm_name` and `host` (describe the name of the new VM and the name of the host where we want to create it) are required parameters; you can also specify `resource_pool` (if you don't, the builder will try to detect the default one) and `datastore`. `url`, `username` and `password` are your vSphere parameters. -You need to set the appropriate values in the `variables` section before proceeding. -7. Now you can go to the `bin/` directory -``` -$ cd ./bin -``` -and try the builder -``` -$ packer build template.json -``` + +## Progress bar +You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well. + +- [x] hardware customization of the new VM (cpu, ram) +- [x] clone from template (not only from VM) +- [x] clone to alternate host, resource pool and datastore +- [x] enable linked clones +- [ ] support Windows guest systems +- [x] enable VM-to-template conversion +- [ ] tests +- [x] add a shutdown timeout +- [ ] further hardware customization: + * resize disks + * ram reservation + * cpu reservation From fbe2065ec2e1414f60341086925cbe8816783c2b Mon Sep 17 00:00:00 2001 From: Elizaveta Tretyakova Date: Tue, 27 Jun 2017 10:32:59 +0300 Subject: [PATCH 031/266] Add a snapshot (#22) --- README.md | 6 +- builder.go | 10 +++- config.go | 10 ++-- step_clone_vm.go | 51 ++--------------- step_create_snapshot.go | 33 +++++++++++ step_setup.go | 73 ++++++++++++++++++++++++ step_post_process.go => step_template.go | 10 ++-- 7 files changed, 135 insertions(+), 58 deletions(-) create mode 100644 step_create_snapshot.go create mode 100644 step_setup.go rename step_post_process.go => step_template.go (68%) diff --git a/README.md b/README.md index f6253e82c..f0b9b3af3 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ $ packer build template.json * `dc_name` (source datacenter) * Post-processing: * `linked_clone` - * `to_template` + * `create_snapshot` + * `convert_to_template` See an example below: ```json @@ -71,7 +72,8 @@ See an example below: "vm_name": "clone_name", "host": "172.16.0.1", "linked_clone": true, - "to_template": true, + "create_snapshot": true, + "convert_to_template": true, "RAM": "1024", "cpus": "2", diff --git a/builder.go b/builder.go index 91e80927a..1239e4903 100644 --- a/builder.go +++ b/builder.go @@ -35,6 +35,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe // Build the steps. steps := []multistep.Step{ + &StepSetup{ + config: b.config, + }, &StepCloneVM{ config: b.config, }, @@ -65,8 +68,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Command: b.config.ShutdownCommand, ShutdownTimeout: b.config.ShutdownTimeout, }, - &StepPostProcess{ - ToTemplate: b.config.ToTemplate, + &StepCreateSnapshot{ + createSnapshot: b.config.CreateSnapshot, + }, + &StepConvertToTemplate{ + ConvertToTemplate: b.config.ConvertToTemplate, }, } diff --git a/config.go b/config.go index c704e2a55..b98ff9b94 100644 --- a/config.go +++ b/config.go @@ -30,15 +30,17 @@ type Config struct { Datastore string `mapstructure:"datastore"` // Settings - LinkedClone bool `mapstructure:"linked_clone"` - ToTemplate bool `mapstructure:"to_template"` + LinkedClone bool `mapstructure:"linked_clone"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` - ShutdownTimeout time.Duration `` + ShutdownTimeout time.Duration `` - // Hardware + // Customization Cpus string `mapstructure:"cpus"` ShutdownCommand string `mapstructure:"shutdown_command"` Ram string `mapstructure:"RAM"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ctx interpolate.Context } diff --git a/step_clone_vm.go b/step_clone_vm.go index ddbc7c220..35e4043b9 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/find" "fmt" - "net/url" "github.com/vmware/govmomi/vim25/mo" "errors" ) @@ -31,25 +30,15 @@ type StepCloneVM struct{ } func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { + client := state.Get("client").(*govmomi.Client) + ctx := state.Get("ctx").(context.Context) + finder := state.Get("finder").(*find.Finder) + dc := state.Get("dc").(*object.Datacenter) + vmSrc := state.Get("vmSrc").(*object.VirtualMachine) + ui := state.Get("ui").(packer.Ui) ui.Say("start cloning...") - // Prepare entities: client (authentification), finder, folder, virtual machine - client, ctx, err := createClient(s.config.Url, s.config.Username, s.config.Password) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - // Set up finder - finder := find.NewFinder(client.Client, false) - dc, err := finder.DatacenterOrDefault(ctx, s.config.DCName) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - finder.SetDatacenter(dc) - // Get folder folder, err := finder.FolderOrDefault(ctx, s.config.FolderName) if err != nil { @@ -74,13 +63,6 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { } } - // Get source VM - vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - vm, err := cloneVM(&CloneParameters{ client: client, folder: folder, @@ -179,24 +161,3 @@ func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { vm = object.NewVirtualMachine(params.client.Client, info.Result.(types.ManagedObjectReference)) return vm, nil } - -func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { - // create context - ctx := context.TODO() // an empty, default context (for those, who is unsure) - - // create a client - // (connected to the specified URL, - // logged in with the username-password) - u, err := url.Parse(URL) // create a URL object from string - if err != nil { - return nil, nil, err - } - u.User = url.UserPassword(username, password) // set username and password for automatical authentification - fmt.Println(u.String()) - client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) - if err != nil { - return nil, nil, err - } - - return client, ctx, nil -} diff --git a/step_create_snapshot.go b/step_create_snapshot.go new file mode 100644 index 000000000..81a07acee --- /dev/null +++ b/step_create_snapshot.go @@ -0,0 +1,33 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "context" + "github.com/vmware/govmomi/object" +) + +type StepCreateSnapshot struct{ + createSnapshot bool +} + +func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*object.VirtualMachine) + ctx := state.Get("ctx").(context.Context) + + if s.createSnapshot { + ui.Say("creating snapshot...") + + _, err := vm.CreateSnapshot(ctx, "packer_snapshot", "", true, true) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + ui.Say("done") + } + + return multistep.ActionContinue +} + +func (s *StepCreateSnapshot) Cleanup(state multistep.StateBag) {} diff --git a/step_setup.go b/step_setup.go new file mode 100644 index 000000000..2b5327c29 --- /dev/null +++ b/step_setup.go @@ -0,0 +1,73 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/find" + "fmt" + "github.com/vmware/govmomi" + "context" + "net/url" +) + +type StepSetup struct{ + config *Config +} + +func (s *StepSetup) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + ui.Say("setup...") + + // Prepare entities: client (authentification), finder, folder, virtual machine + client, ctx, err := createClient(s.config.Url, s.config.Username, s.config.Password) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + // Set up finder + finder := find.NewFinder(client.Client, false) + dc, err := finder.DatacenterOrDefault(ctx, s.config.DCName) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + finder.SetDatacenter(dc) + + // Get source VM + vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + state.Put("client", client) + state.Put("ctx", ctx) + state.Put("finder", finder) + state.Put("dc", dc) + state.Put("vmSrc", vmSrc) + return multistep.ActionContinue +} + +func (s *StepSetup) Cleanup(state multistep.StateBag) {} + +func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { + // create context + ctx := context.TODO() // an empty, default context (for those, who is unsure) + + // create a client + // (connected to the specified URL, + // logged in with the username-password) + u, err := url.Parse(URL) // create a URL object from string + if err != nil { + return nil, nil, err + } + u.User = url.UserPassword(username, password) // set username and password for automatical authentification + fmt.Println(u.String()) + client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) + if err != nil { + return nil, nil, err + } + + return client, ctx, nil +} diff --git a/step_post_process.go b/step_template.go similarity index 68% rename from step_post_process.go rename to step_template.go index 3c4c074a5..3b64985bc 100644 --- a/step_post_process.go +++ b/step_template.go @@ -7,17 +7,17 @@ import ( "context" ) -type StepPostProcess struct{ - ToTemplate bool +type StepConvertToTemplate struct{ + ConvertToTemplate bool } -func (s *StepPostProcess) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*object.VirtualMachine) ctx := state.Get("ctx").(context.Context) // Turning into template if needed - if s.ToTemplate { + if s.ConvertToTemplate { ui.Say("turning into template...") err := vm.MarkAsTemplate(ctx) if err != nil { @@ -30,4 +30,4 @@ func (s *StepPostProcess) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } -func (s *StepPostProcess) Cleanup(state multistep.StateBag) {} +func (s *StepConvertToTemplate) Cleanup(state multistep.StateBag) {} From f1444b6a20a2024ae28d6ae4ab9ff4377570f3d1 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 27 Jun 2017 10:44:38 +0300 Subject: [PATCH 032/266] Lock dependencies --- glide.lock | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ glide.yaml | 18 ++------- 2 files changed, 111 insertions(+), 15 deletions(-) create mode 100644 glide.lock diff --git a/glide.lock b/glide.lock new file mode 100644 index 000000000..5354d3cd5 --- /dev/null +++ b/glide.lock @@ -0,0 +1,108 @@ +hash: 709325293541fff31ae48288c6f5873f67f90ae6ab69d9ae4465fcdf0626d843 +updated: 2017-06-27T10:42:45.867528732+03:00 +imports: +- name: github.com/Azure/go-ntlmssp + version: 29affced641074a59483ed003b5ef73a8bd3593c +- name: github.com/dylanmei/iso8601 + version: 2075bf119b58e5576c6ed9f867b8f3d17f2e54d4 +- name: github.com/hashicorp/errwrap + version: 7554cd9344cec97297fa6649b055a8c98c2a1e55 +- name: github.com/hashicorp/go-checkpoint + version: a8d0786e7fa88adb6b3bcaa341a99af7f9740671 +- name: github.com/hashicorp/go-cleanhttp + version: 3573b8b52aa7b37b9358d966a898feb387f62437 +- name: github.com/hashicorp/go-multierror + version: ed905158d87462226a13fe39ddf685ea65f1c11f +- name: github.com/hashicorp/go-uuid + version: 64130c7a86d732268a38cb04cfbaf0cc987fda98 +- name: github.com/hashicorp/go-version + version: 03c5bf6be031b6dd45afec16b1cf94fc8938bc77 +- name: github.com/hashicorp/packer + version: 6a8ae4b258d1bb0beece05c9fc3bbc1c186a0480 + subpackages: + - common + - common/ssh + - common/uuid + - communicator/none + - communicator/ssh + - communicator/winrm + - helper/communicator + - helper/config + - packer + - packer/plugin + - packer/rpc + - template + - template/interpolate + - version +- name: github.com/hashicorp/yamux + version: d1caa6c97c9fc1cc9e83bbe34d0603f9ff0ce8bd +- name: github.com/kr/fs + version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b +- name: github.com/masterzen/azure-sdk-for-go + version: ee4f0065d00cd12b542f18f5bc45799e88163b12 + subpackages: + - core/http + - core/tls +- name: github.com/masterzen/simplexml + version: 4572e39b1ab9fe03ee513ce6fc7e289e98482190 + subpackages: + - dom +- name: github.com/masterzen/winrm + version: acf371f6aff113fc0104a61cd72db45a7c27d310 + subpackages: + - soap +- name: github.com/masterzen/xmlpath + version: 13f4951698adc0fa9c1dda3e275d489a24201161 +- name: github.com/mitchellh/go-fs + version: 7bae45d9a684750e82b97ff320c82556614e621b + subpackages: + - fat +- name: github.com/mitchellh/iochan + version: 87b45ffd0e9581375c491fef3d32130bb15c5bd7 +- name: github.com/mitchellh/mapstructure + version: cc8532a8e9a55ea36402aa21efdf403a60d34096 +- name: github.com/mitchellh/multistep + version: 391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d +- name: github.com/mitchellh/reflectwalk + version: 8d802ff4ae93611b807597f639c19f76074df5c6 +- name: github.com/nu7hatch/gouuid + version: 179d4d0c4d8d407a32af483c2354df1d2c91e6c3 +- name: github.com/packer-community/winrmcp + version: c804d432b8b7fa77896f43cc426134348c3fd19e + subpackages: + - winrmcp +- name: github.com/pkg/errors + version: c605e284fe17294bda444b34710735b29d1a9d90 +- name: github.com/pkg/sftp + version: a5f8514e29e90a859e93871b1582e5c81f466f82 +- name: github.com/ugorji/go + version: 708a42d246822952f38190a8d8c4e6b16a0e600c + subpackages: + - codec +- name: github.com/vmware/govmomi + version: b63044e5f833781eb7b305bc035392480ee06a82 + subpackages: + - find + - list + - object + - property + - session + - task + - vim25 + - vim25/debug + - vim25/methods + - vim25/mo + - vim25/progress + - vim25/soap + - vim25/types + - vim25/xml +- name: golang.org/x/crypto + version: ab89591268e0c8b748cbe4047b00197516011af5 + subpackages: + - curve25519 + - ed25519 + - ed25519/internal/edwards25519 + - md4 + - ssh + - ssh/agent +testImports: [] diff --git a/glide.yaml b/glide.yaml index f99726467..a95b811d0 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,20 +1,8 @@ -package: github.com/LizaTretyakova/packer-builder-vsphere +package: github.com/jetbrains-infra/packer-builder-vsphere import: - package: github.com/hashicorp/packer - subpackages: - - common - - communicator/ssh - - helper/communicator - - helper/config - - packer - - packer/plugin - - template/interpolate + version: v1.0.2 - package: github.com/mitchellh/multistep - package: github.com/vmware/govmomi - subpackages: - - find - - object - - vim25/types + version: v0.15.0 - package: golang.org/x/crypto - subpackages: - - ssh From 28efdd4acca62cec31aa78f246e3a553910989eb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 27 Jun 2017 10:55:49 +0300 Subject: [PATCH 033/266] Rename artifacts --- artifact.go | 4 ++-- docker-compose.yml | 4 ++-- docker/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artifact.go b/artifact.go index d4ee8c7b3..53aef4206 100644 --- a/artifact.go +++ b/artifact.go @@ -1,9 +1,9 @@ package main -const BuilderId = "LizaTretyakova.vsphere" +const BuilderId = "jetbrains.vsphere" type Artifact struct { - VMName string `json:"vm_name"` + VMName string `json:"vm_name"` } func (a *Artifact) BuilderId() string { diff --git a/docker-compose.yml b/docker-compose.yml index 230d43d0e..42740643f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ build: build: docker/ volumes: - - .:/go/src/github.com/LizaTretyakova/packer-builder-vsphere - working_dir: /go/src/github.com/LizaTretyakova/packer-builder-vsphere + - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere + working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere command: ./build.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index f5a2d777a..64c776491 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.7.1 +FROM golang:1.8.3 ARG GLIDE_VERSION=0.12.3 RUN wget -nv https://github.com/Masterminds/glide/releases/download/v$GLIDE_VERSION/glide-v$GLIDE_VERSION-linux-amd64.tar.gz -O- | \ From 12e7a3f42b8c891afe798693c73151bc002cb711 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 27 Jun 2017 12:07:10 +0300 Subject: [PATCH 034/266] update Readme --- README.md | 113 ++++++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index f0b9b3af3..2edd362b4 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,72 @@ -# packer-builder-vsphere +# Packer Builder for VMware vSphere + +This builder uses native vSphere API, and creates virtual machines remotely. + +- VMware Player is not required +- Builds are incremental, VMs are not created from scratch but cloned from base templates - similar to [amazon-ebs](https://www.packer.io/docs/builders/amazon-ebs.html) builder +- Official vCenter API is used, no ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) is required ## Usage -* Download the plugin from the [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page -* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply save it into the working directory together with a configuration file; you may create your own configuration file or take the one given below (remember to put your real values for names, passwords, `url` and `host`) -``` json -template.json +* Download the plugin from [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page +* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply put it into the same directory with configuration files +## Minimal Example + +```json { - "builders": [ - { - "type": "vsphere", - - "url": "https://your.lab.addr/", - "username": "username", - "password": "secret", - - "ssh_username": "ssh_username", - "ssh_password": "ssh_secret", - - "template": "source_vm_name", - "vm_name": "clone_name", - "host": "172.16.0.1" - } - ] + "builders": [ + { + "type": "vsphere", + + "url": "https://vcenter.domain.com/sdk", + "username": "root", + "password": "secret", + + "template": "ubuntu", + "vm_name": "vm-1", + "host": "esxi-1.domain.com", + + "ssh_username": "root", + "ssh_password": "secret" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ "echo hello" ] + } + ] } ``` -(`host` is for target host) -* Run: -``` -$ packer build template.json -``` -## Builder parameters -### Required parameters: +## Parameters +### Required +* `url` * `username` * `password` * `template` * `vm_name` * `host` -### Optional parameters: -* Destination parameters: - * `resource_pool` - * `datastore` -* Hardware configuration: - * `cpus` - * `ram` - * `shutdown_command` * `ssh_username` * `ssh_password` -* `dc_name` (source datacenter) -* Post-processing: - * `linked_clone` - * `create_snapshot` - * `convert_to_template` -See an example below: +### Optional +Destination: +* `dc_name` (source datacenter) +* `resource_pool` +* `datastore` +* `linked_clone` + +Hardware customization: +* `cpus` +* `ram` +* `shutdown_command` + +Post-processing: +* `create_snapshot` +* `convert_to_template` + +## Complete Example ```json { "builders": [ @@ -93,20 +105,3 @@ Parameters `ssh_*`, `dc_name` (datacenter name) and `template` (the name of the on which you are creating the new one (note that VMWare Tools should be already installed on this template machine). `vm_name` and `host` (describe the name of the new VM and the name of the host where we want to create it) are required parameters; you can also specify `resource_pool` (if you don't, the builder will try to detect the default one) and `datastore`. `url`, `username` and `password` are your vSphere parameters. - - -## Progress bar -You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well. - -- [x] hardware customization of the new VM (cpu, ram) -- [x] clone from template (not only from VM) -- [x] clone to alternate host, resource pool and datastore -- [x] enable linked clones -- [ ] support Windows guest systems -- [x] enable VM-to-template conversion -- [ ] tests -- [x] add a shutdown timeout -- [ ] further hardware customization: - * resize disks - * ram reservation - * cpu reservation From 0e594a5d31718c500eb0ba6beaf679b9279bbfb3 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 28 Jun 2017 12:19:46 +0300 Subject: [PATCH 035/266] Update README.md --- README.md | 107 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 2edd362b4..f7f5c2014 100644 --- a/README.md +++ b/README.md @@ -41,67 +41,80 @@ This builder uses native vSphere API, and creates virtual machines remotely. ## Parameters ### Required -* `url` -* `username` -* `password` -* `template` -* `vm_name` -* `host` -* `ssh_username` -* `ssh_password` +* `url` - URL of vCenter API enpoint. +* `username` - vSphere username. +* `password` - vSphere password. +* `template` - name of source VM. +* `vm_name` - name of target VM. +* `host` - vSphere host where target VM is created. +* `ssh_username` - username in guest OS. +* `ssh_password` - password in guest OS. ### Optional Destination: -* `dc_name` (source datacenter) -* `resource_pool` -* `datastore` -* `linked_clone` +* `dc_name` - required if there are several datacenters. +* `folder_name` - VM folder where target VM is created. +* `resource_pool` - by default a root of vSphere host. +* `datastore` - required if vSphere host has multiple datastores attached. +* `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. Hardware customization: -* `cpus` -* `ram` -* `shutdown_command` +* `cpus` - number of CPU sockets. Inherited from source VM by default. +* `ram` - Amount of RAM in megabytes. Inherited from source VM by default. Post-processing: -* `create_snapshot` -* `convert_to_template` +* `shutdown_command` - VMware guest tools are used by default. +* `create_snapshot` - add a snapshot, so VM can be used as a base for linked clones. `false` by default. +* `convert_to_template` - convert VM to a template. `false` by default. ## Complete Example ```json { - "builders": [ - { - "type": "vsphere", + "variables": { + "vsphere_password": "secret", + "guest_password": "secret" + }, - "url": "https://your.lab.addr/", - "username": "username", - "password": "secret", + "builders": [ + { + "type": "vsphere", - "ssh_username": "ssh_username", - "ssh_password": "ssh_secret", + "url": "https://vcenter.domain.com/sdk", + "dc_name": "dc1", + "username": "root", + "password": "{{user `vsphere_password`}}", - "template": "template_name", - "vm_name": "clone_name", - "host": "172.16.0.1", - "linked_clone": true, - "create_snapshot": true, - "convert_to_template": true, + "template": "ubuntu", + "folder_name": "folder", + "vm_name": "vm-1", + "host": "esxi-1.domain.com", + "resource_pool": "pool1/pool2", + "datastore": "datastore1", + "linked_clone": true, - "RAM": "1024", - "cpus": "2", - "shutdown_command": "echo 'ssh_secret' | sudo -S shutdown -P now" - } - ], - "provisioners": [ - { - "type": "shell", - "inline": ["echo foo"] - } - ] + "cpus": 2, + "ram": 8192, + + "ssh_username": "root", + "ssh_password": "{{user `guest_password`}}", + + "shutdown_command": "echo '{{user `guest_password`}}' | sudo -S shutdown -P now", + "create_snapshot": true, + "convert_to_template": true + } + ], + + "provisioners": [ + { + "type": "shell", + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "echo '{{user `guest_password`}}' | {{.Vars}} sudo -ES bash -eux '{{.Path}}'", + "inline": [ + "apt-get install -y zip" + ] + } + ] } ``` -where `vm_name`, `RAM`, `cpus` and `shutdown_command` are parameters of the new VM. -Parameters `ssh_*`, `dc_name` (datacenter name) and `template` (the name of the base VM) are for the base VM, -on which you are creating the new one (note that VMWare Tools should be already installed on this template machine). -`vm_name` and `host` (describe the name of the new VM and the name of the host where we want to create it) are required parameters; you can also specify `resource_pool` (if you don't, the builder will try to detect the default one) and `datastore`. -`url`, `username` and `password` are your vSphere parameters. From a12ff09f0a7a1ca3361220b59d8e78d88290a026 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 28 Jun 2017 06:04:25 +0300 Subject: [PATCH 036/266] move setup back into builder --- builder.go | 37 ++++++++++++++++++++---- step_clone_vm.go | 28 ++++++++----------- step_setup.go | 73 ------------------------------------------------ 3 files changed, 43 insertions(+), 95 deletions(-) delete mode 100644 step_setup.go diff --git a/builder.go b/builder.go index 1239e4903..64e26c744 100644 --- a/builder.go +++ b/builder.go @@ -10,6 +10,10 @@ import ( "github.com/hashicorp/packer/helper/communicator" gossh "golang.org/x/crypto/ssh" "github.com/hashicorp/packer/communicator/ssh" + "github.com/vmware/govmomi" + "context" + "net/url" + "github.com/vmware/govmomi/find" ) type Builder struct { @@ -28,16 +32,39 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { - // Set up the state. state := new(multistep.BasicStateBag) state.Put("hook", hook) state.Put("ui", ui) + ctx := context.TODO() + state.Put("ctx", ctx) + + vcenter_url, err := url.Parse(b.config.Url) + if err != nil { + return nil, err + } + vcenter_url.User = url.UserPassword(b.config.Username, b.config.Password) + client, err := govmomi.NewClient(ctx, vcenter_url,true) + if err != nil { + return nil, err + } + state.Put("client", client) + + finder := find.NewFinder(client.Client, false) + dc, err := finder.DatacenterOrDefault(ctx, b.config.DCName) + if err != nil { + return nil, err + } + finder.SetDatacenter(dc) + state.Put("finder", finder) + state.Put("dc", dc) + + vmSrc, err := finder.VirtualMachine(ctx, b.config.Template) + if err != nil { + return nil, err + } + state.Put("vmSrc", vmSrc) - // Build the steps. steps := []multistep.Step{ - &StepSetup{ - config: b.config, - }, &StepCloneVM{ config: b.config, }, diff --git a/step_clone_vm.go b/step_clone_vm.go index 35e4043b9..be2e2bb53 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -1,7 +1,6 @@ package main import ( - "github.com/vmware/govmomi" "context" "github.com/mitchellh/multistep" "github.com/vmware/govmomi/vim25/types" @@ -14,28 +13,25 @@ import ( ) type CloneParameters struct { - client *govmomi.Client - folder *object.Folder + ctx context.Context + vmSrc *object.VirtualMachine + vmName string + folder *object.Folder resourcePool *object.ResourcePool datastore *object.Datastore - vmSrc *object.VirtualMachine - ctx context.Context - vmName string linkedClone bool } -type StepCloneVM struct{ - config *Config +type StepCloneVM struct { + config *Config success bool } func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { - client := state.Get("client").(*govmomi.Client) ctx := state.Get("ctx").(context.Context) finder := state.Get("finder").(*find.Finder) dc := state.Get("dc").(*object.Datacenter) vmSrc := state.Get("vmSrc").(*object.VirtualMachine) - ui := state.Get("ui").(packer.Ui) ui.Say("start cloning...") @@ -64,13 +60,12 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { } vm, err := cloneVM(&CloneParameters{ - client: client, - folder: folder, + ctx: ctx, + vmSrc: vmSrc, + vmName: s.config.VMName, + folder: folder, resourcePool: pool, datastore: datastore, - vmSrc: vmSrc, - ctx: ctx, - vmName: s.config.VMName, linkedClone: s.config.LinkedClone, }) if err != nil { @@ -79,7 +74,6 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { } state.Put("vm", vm) - state.Put("ctx", ctx) s.success = true return multistep.ActionContinue } @@ -158,6 +152,6 @@ func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { return } - vm = object.NewVirtualMachine(params.client.Client, info.Result.(types.ManagedObjectReference)) + vm = object.NewVirtualMachine(params.vmSrc.Client(), info.Result.(types.ManagedObjectReference)) return vm, nil } diff --git a/step_setup.go b/step_setup.go deleted file mode 100644 index 2b5327c29..000000000 --- a/step_setup.go +++ /dev/null @@ -1,73 +0,0 @@ -package main - -import ( - "github.com/mitchellh/multistep" - "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/find" - "fmt" - "github.com/vmware/govmomi" - "context" - "net/url" -) - -type StepSetup struct{ - config *Config -} - -func (s *StepSetup) Run(state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - ui.Say("setup...") - - // Prepare entities: client (authentification), finder, folder, virtual machine - client, ctx, err := createClient(s.config.Url, s.config.Username, s.config.Password) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - // Set up finder - finder := find.NewFinder(client.Client, false) - dc, err := finder.DatacenterOrDefault(ctx, s.config.DCName) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - finder.SetDatacenter(dc) - - // Get source VM - vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - state.Put("client", client) - state.Put("ctx", ctx) - state.Put("finder", finder) - state.Put("dc", dc) - state.Put("vmSrc", vmSrc) - return multistep.ActionContinue -} - -func (s *StepSetup) Cleanup(state multistep.StateBag) {} - -func createClient(URL, username, password string) (*govmomi.Client, context.Context, error) { - // create context - ctx := context.TODO() // an empty, default context (for those, who is unsure) - - // create a client - // (connected to the specified URL, - // logged in with the username-password) - u, err := url.Parse(URL) // create a URL object from string - if err != nil { - return nil, nil, err - } - u.User = url.UserPassword(username, password) // set username and password for automatical authentification - fmt.Println(u.String()) - client, err := govmomi.NewClient(ctx, u,true) // creating a client (logs in with given uname&pswd) - if err != nil { - return nil, nil, err - } - - return client, ctx, nil -} From f42df93e8d338bfb2e5ed3c1996946a0c684014e Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Fri, 30 Jun 2017 01:08:49 +0300 Subject: [PATCH 037/266] destroy artifact --- artifact.go | 18 +++++++++++++++++- builder.go | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/artifact.go b/artifact.go index 53aef4206..8094bf1dc 100644 --- a/artifact.go +++ b/artifact.go @@ -1,9 +1,15 @@ package main +import ( + "github.com/vmware/govmomi/object" + "context" +) + const BuilderId = "jetbrains.vsphere" type Artifact struct { - VMName string `json:"vm_name"` + VMName string + Conn *object.VirtualMachine } func (a *Artifact) BuilderId() string { @@ -27,5 +33,15 @@ func (a *Artifact) State(name string) interface{} { } func (a *Artifact) Destroy() error { + ctx := context.TODO() + task, err := a.Conn.Destroy(ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(ctx, nil) + if err != nil { + return err + } + return nil } diff --git a/builder.go b/builder.go index 64e26c744..97f9b1167 100644 --- a/builder.go +++ b/builder.go @@ -14,6 +14,7 @@ import ( "context" "net/url" "github.com/vmware/govmomi/find" + "github.com/vmware/govmomi/object" ) type Builder struct { @@ -121,9 +122,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe return nil, errors.New("Build was halted.") } - // No errors, must've worked artifact := &Artifact{ VMName: b.config.VMName, + Conn: state.Get("vm").(*object.VirtualMachine), } return artifact, nil } From 95ca846a08edc1fa9484f479dbebb2e2f396b96d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Mon, 12 Jun 2017 21:08:25 +0300 Subject: [PATCH 038/266] Unit tests --- builder_test.go | 14 +++++++++++ config.go | 10 +++----- config_test.go | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 builder_test.go create mode 100644 config_test.go diff --git a/builder_test.go b/builder_test.go new file mode 100644 index 000000000..20243b659 --- /dev/null +++ b/builder_test.go @@ -0,0 +1,14 @@ +package main + +import ( + "github.com/hashicorp/packer/packer" + "testing" +) + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.Builder); !ok { + t.Fatalf("Builder should be a builder") + } +} diff --git a/config.go b/config.go index b98ff9b94..9d11afa80 100644 --- a/config.go +++ b/config.go @@ -57,6 +57,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { // Accumulate any errors errs := new(packer.MultiError) + var warnings []string // Prepare config(s) errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...) @@ -100,12 +101,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) } - - // Warnings - var warnings []string - if c.Datastore == "" { - warnings = append(warnings, "Datastore is not specified, will try to find the default one") - } + //if c.Datastore == "" { + // warnings = append(warnings, "Datastore is not specified, will try to find the default one") + //} if len(errs.Errors) > 0 { return nil, warnings, errs diff --git a/config_test.go b/config_test.go new file mode 100644 index 000000000..f6bed1613 --- /dev/null +++ b/config_test.go @@ -0,0 +1,67 @@ +package main + +import ( + "testing" + "time" +) + +func TestMinimalConfig(t *testing.T) { + _, warns, errs := NewConfig(minimalConfig()) + + testConfigOk(t, warns, errs) +} + +func TestInvalidCpu(t *testing.T) { + raw := minimalConfig() + raw["cpus"] = "string" + _, warns, errs := NewConfig(raw) + testConfigErr(t, warns, errs) +} + +func TestInvalidRam(t *testing.T) { + raw := minimalConfig() + raw["RAM"] = "string" + _, warns, errs := NewConfig(raw) + testConfigErr(t, warns, errs) +} + +func TestTimeout(t *testing.T) { + raw := minimalConfig() + raw["shutdown_timeout"] = "3m" + conf, warns, err := NewConfig(raw) + testConfigOk(t, warns, err) + if conf.ShutdownTimeout != 3 * time.Minute { + t.Fatalf("shutdown_timeout sourld equal 3 minutes") + } +} + +func minimalConfig() map[string]interface{} { + return map[string]interface{}{ + "url": "https://vcenter.domain.local/sdk", + "username": "root", + "password": "vmware", + "template": "ubuntu", + "vm_name": "vm1", + "host": "esxi1.domain.local", + "ssh_username": "root", + "ssh_password": "secret", + } +} + +func testConfigOk(t *testing.T, warns []string, err error) { + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("bad: %s", err) + } +} + +func testConfigErr(t *testing.T, warns []string, err error) { + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err == nil { + t.Fatal("should error") + } +} From 07cbbd1d0b1ee1c1a82d04f006c8c2f015655b44 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 14 Jun 2017 21:16:57 +0300 Subject: [PATCH 039/266] integration test --- builder_acc_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 builder_acc_test.go diff --git a/builder_acc_test.go b/builder_acc_test.go new file mode 100644 index 000000000..fc24f92bc --- /dev/null +++ b/builder_acc_test.go @@ -0,0 +1,32 @@ +package main + +import ( + "testing" + builderT "github.com/hashicorp/packer/helper/builder/testing" +) + +func TestBuilderAcc_basic(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: testBuilderAccBasic, + }) +} + +const testBuilderAccBasic = ` +{ + "builders": [{ + "type": "test", + + "url": "https://vcenter.vsphere5.test/sdk", + "username": "root", + "password": "jetbrains", + + "template": "basic", + "vm_name": "test1", + "host": "esxi-1.vsphere5.test", + + "ssh_username": "jetbrains", + "ssh_password": "jetbrains" + }] +} +` From de58c87878f61397f7f37efd3b36c48d6b3f34b3 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 16:18:54 +0300 Subject: [PATCH 040/266] Support nested VM folders --- .gitignore | 2 ++ README.md | 2 +- step_clone_vm.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 22ee9f5b3..e0169f27b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ .glide/ vendor/ packer-builder-vsphere +packer-builder-vsphere.exe bin/ +test*.json diff --git a/README.md b/README.md index f7f5c2014..523384c53 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Post-processing: "password": "{{user `vsphere_password`}}", "template": "ubuntu", - "folder_name": "folder", + "folder_name": "folder1/folder2", "vm_name": "vm-1", "host": "esxi-1.domain.com", "resource_pool": "pool1/pool2", diff --git a/step_clone_vm.go b/step_clone_vm.go index be2e2bb53..8aa425de0 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -36,7 +36,7 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { ui.Say("start cloning...") // Get folder - folder, err := finder.FolderOrDefault(ctx, s.config.FolderName) + folder, err := finder.FolderOrDefault(ctx, fmt.Sprintf("/%v/vm/%v", dc.Name(), s.config.FolderName)) if err != nil { state.Put("error", err) return multistep.ActionHalt From b9cac9d68129ebdbaedb6acdb38364b042e2dfde Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 17:18:54 +0300 Subject: [PATCH 041/266] rename 'url' to 'vcenter_host' --- README.md | 6 +++--- builder.go | 3 ++- builder_acc_test.go | 2 +- config.go | 12 ++++++------ config_test.go | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 523384c53..d31f55c0d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. { "type": "vsphere", - "url": "https://vcenter.domain.com/sdk", + "vcenter_host": "vcenter.domain.com", "username": "root", "password": "secret", @@ -41,7 +41,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. ## Parameters ### Required -* `url` - URL of vCenter API enpoint. +* `vcenter_host` - vCenter hostname. * `username` - vSphere username. * `password` - vSphere password. * `template` - name of source VM. @@ -79,7 +79,7 @@ Post-processing: { "type": "vsphere", - "url": "https://vcenter.domain.com/sdk", + "vcenter_host": "vcenter.domain.com", "dc_name": "dc1", "username": "root", "password": "{{user `vsphere_password`}}", diff --git a/builder.go b/builder.go index 97f9b1167..14f601a30 100644 --- a/builder.go +++ b/builder.go @@ -15,6 +15,7 @@ import ( "net/url" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" + "fmt" ) type Builder struct { @@ -39,7 +40,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ctx := context.TODO() state.Put("ctx", ctx) - vcenter_url, err := url.Parse(b.config.Url) + vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", b.config.VCenterHost)) if err != nil { return nil, err } diff --git a/builder_acc_test.go b/builder_acc_test.go index fc24f92bc..6bc29bebe 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -17,7 +17,7 @@ const testBuilderAccBasic = ` "builders": [{ "type": "test", - "url": "https://vcenter.vsphere5.test/sdk", + "vcenter_host": "vcenter.vsphere5.test", "username": "root", "password": "jetbrains", diff --git a/config.go b/config.go index 9d11afa80..fa7b91143 100644 --- a/config.go +++ b/config.go @@ -16,9 +16,9 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` communicator.Config `mapstructure:",squash"` - Url string `mapstructure:"url"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` + VCenterHost string `mapstructure:"vcenter_host"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` // Location Template string `mapstructure:"template"` @@ -33,7 +33,7 @@ type Config struct { LinkedClone bool `mapstructure:"linked_clone"` ConvertToTemplate bool `mapstructure:"convert_to_template"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` - ShutdownTimeout time.Duration `` + ShutdownTimeout time.Duration // Customization Cpus string `mapstructure:"cpus"` @@ -63,8 +63,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...) // Check the required params - if c.Url == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("URL required")) + if c.VCenterHost == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("vCenter host required")) } if c.Username == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Username required")) diff --git a/config_test.go b/config_test.go index f6bed1613..0e2de650c 100644 --- a/config_test.go +++ b/config_test.go @@ -31,13 +31,13 @@ func TestTimeout(t *testing.T) { conf, warns, err := NewConfig(raw) testConfigOk(t, warns, err) if conf.ShutdownTimeout != 3 * time.Minute { - t.Fatalf("shutdown_timeout sourld equal 3 minutes") + t.Fatalf("shutdown_timeout sould be equal 3 minutes") } } func minimalConfig() map[string]interface{} { return map[string]interface{}{ - "url": "https://vcenter.domain.local/sdk", + "vcenter_host": "vcenter.domain.local", "username": "root", "password": "vmware", "template": "ubuntu", From b549e21e0117b59f2f32671b22a2cc9547f0eeff Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 17:38:50 +0300 Subject: [PATCH 042/266] rename 'folder_name' to 'folder' --- README.md | 4 ++-- config.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d31f55c0d..5bc48338d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. ### Optional Destination: * `dc_name` - required if there are several datacenters. -* `folder_name` - VM folder where target VM is created. +* `folder` - VM folder where target VM is created. * `resource_pool` - by default a root of vSphere host. * `datastore` - required if vSphere host has multiple datastores attached. * `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. @@ -85,7 +85,7 @@ Post-processing: "password": "{{user `vsphere_password`}}", "template": "ubuntu", - "folder_name": "folder1/folder2", + "folder": "folder1/folder2", "vm_name": "vm-1", "host": "esxi-1.domain.com", "resource_pool": "pool1/pool2", diff --git a/config.go b/config.go index fa7b91143..1029afd52 100644 --- a/config.go +++ b/config.go @@ -23,7 +23,7 @@ type Config struct { // Location Template string `mapstructure:"template"` VMName string `mapstructure:"vm_name"` - FolderName string `mapstructure:"folder_name"` + FolderName string `mapstructure:"folder"` DCName string `mapstructure:"dc_name"` Host string `mapstructure:"host"` ResourcePool string `mapstructure:"resource_pool"` From 172118bbe53a9dde80bcea65aa96b916785f3808 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 17:45:13 +0300 Subject: [PATCH 043/266] rename 'dc_name' to 'datacenter' --- README.md | 4 ++-- builder.go | 6 +++--- config.go | 2 +- step_clone_vm.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5bc48338d..ca241908e 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. ### Optional Destination: -* `dc_name` - required if there are several datacenters. +* `datacenter` - required if there are several datacenters. * `folder` - VM folder where target VM is created. * `resource_pool` - by default a root of vSphere host. * `datastore` - required if vSphere host has multiple datastores attached. @@ -80,7 +80,7 @@ Post-processing: "type": "vsphere", "vcenter_host": "vcenter.domain.com", - "dc_name": "dc1", + "datacenter": "dc1", "username": "root", "password": "{{user `vsphere_password`}}", diff --git a/builder.go b/builder.go index 14f601a30..8d98ee03d 100644 --- a/builder.go +++ b/builder.go @@ -52,13 +52,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("client", client) finder := find.NewFinder(client.Client, false) - dc, err := finder.DatacenterOrDefault(ctx, b.config.DCName) + datacenter, err := finder.DatacenterOrDefault(ctx, b.config.Datacenter) if err != nil { return nil, err } - finder.SetDatacenter(dc) + finder.SetDatacenter(datacenter) state.Put("finder", finder) - state.Put("dc", dc) + state.Put("datacenter", datacenter) vmSrc, err := finder.VirtualMachine(ctx, b.config.Template) if err != nil { diff --git a/config.go b/config.go index 1029afd52..d3ed61457 100644 --- a/config.go +++ b/config.go @@ -24,7 +24,7 @@ type Config struct { Template string `mapstructure:"template"` VMName string `mapstructure:"vm_name"` FolderName string `mapstructure:"folder"` - DCName string `mapstructure:"dc_name"` + Datacenter string `mapstructure:"datacenter"` Host string `mapstructure:"host"` ResourcePool string `mapstructure:"resource_pool"` Datastore string `mapstructure:"datastore"` diff --git a/step_clone_vm.go b/step_clone_vm.go index 8aa425de0..bd0714e9b 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -30,20 +30,20 @@ type StepCloneVM struct { func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { ctx := state.Get("ctx").(context.Context) finder := state.Get("finder").(*find.Finder) - dc := state.Get("dc").(*object.Datacenter) + datacenter := state.Get("datacenter").(*object.Datacenter) vmSrc := state.Get("vmSrc").(*object.VirtualMachine) ui := state.Get("ui").(packer.Ui) ui.Say("start cloning...") // Get folder - folder, err := finder.FolderOrDefault(ctx, fmt.Sprintf("/%v/vm/%v", dc.Name(), s.config.FolderName)) + folder, err := finder.FolderOrDefault(ctx, fmt.Sprintf("/%v/vm/%v", datacenter.Name(), s.config.FolderName)) if err != nil { state.Put("error", err) return multistep.ActionHalt } // Get resource pool - pool, err := finder.ResourcePoolOrDefault(ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", dc.Name(), s.config.Host, s.config.ResourcePool)) + pool, err := finder.ResourcePoolOrDefault(ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", datacenter.Name(), s.config.Host, s.config.ResourcePool)) if err != nil { state.Put("error", err) return multistep.ActionHalt From 2a43e5039eef7204ae53cd2574cbb3d897f87222 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 18:03:52 +0300 Subject: [PATCH 044/266] rename 'cpus' to 'CPUs' --- README.md | 4 ++-- config.go | 8 ++++---- config_test.go | 2 +- step_configure_hw.go | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ca241908e..eb250de0a 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Destination: * `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. Hardware customization: -* `cpus` - number of CPU sockets. Inherited from source VM by default. +* `CPUs` - number of CPU sockets. Inherited from source VM by default. * `ram` - Amount of RAM in megabytes. Inherited from source VM by default. Post-processing: @@ -92,7 +92,7 @@ Post-processing: "datastore": "datastore1", "linked_clone": true, - "cpus": 2, + "CPUs": 2, "ram": 8192, "ssh_username": "root", diff --git a/config.go b/config.go index d3ed61457..641b97810 100644 --- a/config.go +++ b/config.go @@ -36,7 +36,7 @@ type Config struct { ShutdownTimeout time.Duration // Customization - Cpus string `mapstructure:"cpus"` + CPUs string `mapstructure:"CPUs"` ShutdownCommand string `mapstructure:"shutdown_command"` Ram string `mapstructure:"RAM"` CreateSnapshot bool `mapstructure:"create_snapshot"` @@ -83,9 +83,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } // Verify numeric parameters if present - if c.Cpus != "" { - if _, err = strconv.Atoi(c.Cpus); err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of cpu sockets")) + if c.CPUs != "" { + if _, err = strconv.Atoi(c.CPUs); err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of CPU sockets")) } } if c.Ram != "" { diff --git a/config_test.go b/config_test.go index 0e2de650c..63ff36b82 100644 --- a/config_test.go +++ b/config_test.go @@ -13,7 +13,7 @@ func TestMinimalConfig(t *testing.T) { func TestInvalidCpu(t *testing.T) { raw := minimalConfig() - raw["cpus"] = "string" + raw["CPUs"] = "string" _, warns, errs := NewConfig(raw) testConfigErr(t, warns, errs) } diff --git a/step_configure_hw.go b/step_configure_hw.go index 3f2b235e9..de91d7e4f 100644 --- a/step_configure_hw.go +++ b/step_configure_hw.go @@ -25,14 +25,14 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { var confSpec types.VirtualMachineConfigSpec parametersFlag := ConfigParametersFlag{} // configure HW - if s.config.Cpus != "" { - cpus, err := strconv.Atoi(s.config.Cpus) + if s.config.CPUs != "" { + CPUs, err := strconv.Atoi(s.config.CPUs) if err != nil { state.Put("error", err) return multistep.ActionHalt } - confSpec.NumCPUs = int32(cpus) + confSpec.NumCPUs = int32(CPUs) parametersFlag.NumCPUsPtr = &(confSpec.NumCPUs) } if s.config.Ram != "" { From 84af7f5583e997182598d97adcf176c2e3975d90 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 18:32:16 +0300 Subject: [PATCH 045/266] code cleanup --- README.md | 6 ++-- config.go | 70 +++++++++++++++++++++++--------------------- step_configure_hw.go | 4 +-- 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index eb250de0a..cbf11f0c0 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,11 @@ Destination: Hardware customization: * `CPUs` - number of CPU sockets. Inherited from source VM by default. -* `ram` - Amount of RAM in megabytes. Inherited from source VM by default. +* `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. Post-processing: * `shutdown_command` - VMware guest tools are used by default. +* `shutdown_timeout` - [Duration](https://golang.org/pkg/time/#ParseDuration) how long to wait for a graceful shutdown. 5 minutes by default. * `create_snapshot` - add a snapshot, so VM can be used as a base for linked clones. `false` by default. * `convert_to_template` - convert VM to a template. `false` by default. @@ -93,12 +94,13 @@ Post-processing: "linked_clone": true, "CPUs": 2, - "ram": 8192, + "RAM": 8192, "ssh_username": "root", "ssh_password": "{{user `guest_password`}}", "shutdown_command": "echo '{{user `guest_password`}}' | sudo -S shutdown -P now", + "shutdown_timeout": "5m", "create_snapshot": true, "convert_to_template": true } diff --git a/config.go b/config.go index 641b97810..fc07447f8 100644 --- a/config.go +++ b/config.go @@ -14,45 +14,49 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` - communicator.Config `mapstructure:",squash"` + // Connection VCenterHost string `mapstructure:"vcenter_host"` + Datacenter string `mapstructure:"datacenter"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` // Location Template string `mapstructure:"template"` - VMName string `mapstructure:"vm_name"` FolderName string `mapstructure:"folder"` - Datacenter string `mapstructure:"datacenter"` + VMName string `mapstructure:"vm_name"` Host string `mapstructure:"host"` ResourcePool string `mapstructure:"resource_pool"` Datastore string `mapstructure:"datastore"` - - // Settings - LinkedClone bool `mapstructure:"linked_clone"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` - RawShutdownTimeout string `mapstructure:"shutdown_timeout"` - ShutdownTimeout time.Duration + LinkedClone bool `mapstructure:"linked_clone"` // Customization - CPUs string `mapstructure:"CPUs"` - ShutdownCommand string `mapstructure:"shutdown_command"` - Ram string `mapstructure:"RAM"` - CreateSnapshot bool `mapstructure:"create_snapshot"` + CPUs string `mapstructure:"CPUs"` + RAM string `mapstructure:"RAM"` + // Provisioning + communicator.Config `mapstructure:",squash"` - ctx interpolate.Context + // Post-processing + ShutdownCommand string `mapstructure:"shutdown_command"` + RawShutdownTimeout string `mapstructure:"shutdown_timeout"` + ShutdownTimeout time.Duration + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` + + ctx interpolate.Context } func NewConfig(raws ...interface{}) (*Config, []string, error) { c := new(Config) - err := config.Decode(c, &config.DecodeOpts{ - Interpolate: true, - InterpolateContext: &c.ctx, - }, raws...) - if err != nil { - return nil, nil, err + { + err := config.Decode(c, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &c.ctx, + }, raws...) + if err != nil { + return nil, nil, err + } } // Accumulate any errors @@ -84,26 +88,24 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { // Verify numeric parameters if present if c.CPUs != "" { - if _, err = strconv.Atoi(c.CPUs); err != nil { + if _, err := strconv.Atoi(c.CPUs); err != nil { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of CPU sockets")) } } - if c.Ram != "" { - if _, err = strconv.Atoi(c.Ram); err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number for Ram")) + if c.RAM != "" { + if _, err := strconv.Atoi(c.RAM); err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number for RAM")) } } - if c.RawShutdownTimeout == "" { - c.RawShutdownTimeout = "5m" + if c.RawShutdownTimeout != "" { + timeout, err := time.ParseDuration(c.RawShutdownTimeout) + if err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) + } + c.ShutdownTimeout = timeout + } else { + c.ShutdownTimeout = 5 * time.Minute } - c.ShutdownTimeout, err = time.ParseDuration(c.RawShutdownTimeout) - if err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) - } - - //if c.Datastore == "" { - // warnings = append(warnings, "Datastore is not specified, will try to find the default one") - //} if len(errs.Errors) > 0 { return nil, warnings, errs diff --git a/step_configure_hw.go b/step_configure_hw.go index de91d7e4f..4b5f7d2e2 100644 --- a/step_configure_hw.go +++ b/step_configure_hw.go @@ -35,8 +35,8 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { confSpec.NumCPUs = int32(CPUs) parametersFlag.NumCPUsPtr = &(confSpec.NumCPUs) } - if s.config.Ram != "" { - ram, err := strconv.Atoi(s.config.Ram) + if s.config.RAM != "" { + ram, err := strconv.Atoi(s.config.RAM) if err != nil { state.Put("error", err) return multistep.ActionHalt From d12fbcb700534b4dd82c92dee80acc0df3ae6f01 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 18:54:10 +0300 Subject: [PATCH 046/266] rename 'vcenter_host' to 'vcenter_server' --- README.md | 6 +++--- builder.go | 2 +- builder_acc_test.go | 2 +- config.go | 27 +++++++++++---------------- config_test.go | 2 +- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index cbf11f0c0..c09acf77d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. { "type": "vsphere", - "vcenter_host": "vcenter.domain.com", + "vcenter_server": "vcenter.domain.com", "username": "root", "password": "secret", @@ -41,7 +41,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. ## Parameters ### Required -* `vcenter_host` - vCenter hostname. +* `vcenter_server` - vCenter server hostname. * `username` - vSphere username. * `password` - vSphere password. * `template` - name of source VM. @@ -80,7 +80,7 @@ Post-processing: { "type": "vsphere", - "vcenter_host": "vcenter.domain.com", + "vcenter_server": "vcenter.domain.com", "datacenter": "dc1", "username": "root", "password": "{{user `vsphere_password`}}", diff --git a/builder.go b/builder.go index 8d98ee03d..1e28a47a5 100644 --- a/builder.go +++ b/builder.go @@ -40,7 +40,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ctx := context.TODO() state.Put("ctx", ctx) - vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", b.config.VCenterHost)) + vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", b.config.VCenterServer)) if err != nil { return nil, err } diff --git a/builder_acc_test.go b/builder_acc_test.go index 6bc29bebe..a0759bd49 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -17,7 +17,7 @@ const testBuilderAccBasic = ` "builders": [{ "type": "test", - "vcenter_host": "vcenter.vsphere5.test", + "vcenter_server": "vcenter.vsphere5.test", "username": "root", "password": "jetbrains", diff --git a/config.go b/config.go index fc07447f8..1efcf71b8 100644 --- a/config.go +++ b/config.go @@ -16,10 +16,10 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` // Connection - VCenterHost string `mapstructure:"vcenter_host"` - Datacenter string `mapstructure:"datacenter"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` + VCenterServer string `mapstructure:"vcenter_server"` + Datacenter string `mapstructure:"datacenter"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` // Location Template string `mapstructure:"template"` @@ -59,34 +59,29 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } } - // Accumulate any errors errs := new(packer.MultiError) var warnings []string - - // Prepare config(s) errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...) - // Check the required params - if c.VCenterHost == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("vCenter host required")) + if c.VCenterServer == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("vCenter hostname is required")) } if c.Username == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Username required")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Username is required")) } if c.Password == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Password required")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Password is required")) } if c.Template == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Template VM name required")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Template name is required")) } if c.VMName == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target VM name required")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target VM name is required")) } if c.Host == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target host required")) + errs = packer.MultiErrorAppend(errs, fmt.Errorf("vSphere host is required")) } - // Verify numeric parameters if present if c.CPUs != "" { if _, err := strconv.Atoi(c.CPUs); err != nil { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of CPU sockets")) diff --git a/config_test.go b/config_test.go index 63ff36b82..3188dfadf 100644 --- a/config_test.go +++ b/config_test.go @@ -37,7 +37,7 @@ func TestTimeout(t *testing.T) { func minimalConfig() map[string]interface{} { return map[string]interface{}{ - "vcenter_host": "vcenter.domain.local", + "vcenter_server": "vcenter.domain.local", "username": "root", "password": "vmware", "template": "ubuntu", From b218d42895ecbc535251f7c1ae54fca9400c3cca Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 18:59:36 +0300 Subject: [PATCH 047/266] Add `insecure_connection` parameter --- README.md | 1 + builder.go | 2 +- builder_acc_test.go | 1 + config.go | 9 +++++---- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c09acf77d..ddbeb5a7c 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ This builder uses native vSphere API, and creates virtual machines remotely. * `host` - vSphere host where target VM is created. * `ssh_username` - username in guest OS. * `ssh_password` - password in guest OS. +* `insecure_connection` - do not validate server's TLS certificate. `false` by default. ### Optional Destination: diff --git a/builder.go b/builder.go index 1e28a47a5..479c4c2f0 100644 --- a/builder.go +++ b/builder.go @@ -45,7 +45,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe return nil, err } vcenter_url.User = url.UserPassword(b.config.Username, b.config.Password) - client, err := govmomi.NewClient(ctx, vcenter_url,true) + client, err := govmomi.NewClient(ctx, vcenter_url, b.config.InsecureConnection) if err != nil { return nil, err } diff --git a/builder_acc_test.go b/builder_acc_test.go index a0759bd49..58d0fad1a 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -20,6 +20,7 @@ const testBuilderAccBasic = ` "vcenter_server": "vcenter.vsphere5.test", "username": "root", "password": "jetbrains", + "insecure_connection": true, "template": "basic", "vm_name": "test1", diff --git a/config.go b/config.go index 1efcf71b8..246447d30 100644 --- a/config.go +++ b/config.go @@ -16,10 +16,11 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` // Connection - VCenterServer string `mapstructure:"vcenter_server"` - Datacenter string `mapstructure:"datacenter"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` + VCenterServer string `mapstructure:"vcenter_server"` + Datacenter string `mapstructure:"datacenter"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` + InsecureConnection bool `mapstructure:"insecure_connection"` // Location Template string `mapstructure:"template"` From 4343ca292a1f0a6c41aeac94e54ff05a01ba377d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 19:16:22 +0300 Subject: [PATCH 048/266] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ddbeb5a7c..8f1ad6928 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Packer Builder for VMware vSphere -This builder uses native vSphere API, and creates virtual machines remotely. +This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSphere API, and creates virtual machines remotely. - VMware Player is not required - Builds are incremental, VMs are not created from scratch but cloned from base templates - similar to [amazon-ebs](https://www.packer.io/docs/builders/amazon-ebs.html) builder @@ -44,12 +44,14 @@ This builder uses native vSphere API, and creates virtual machines remotely. * `vcenter_server` - vCenter server hostname. * `username` - vSphere username. * `password` - vSphere password. +* `insecure_connection` - do not validate server's TLS certificate. `false` by default. + * `template` - name of source VM. * `vm_name` - name of target VM. + * `host` - vSphere host where target VM is created. * `ssh_username` - username in guest OS. * `ssh_password` - password in guest OS. -* `insecure_connection` - do not validate server's TLS certificate. `false` by default. ### Optional Destination: @@ -82,9 +84,10 @@ Post-processing: "type": "vsphere", "vcenter_server": "vcenter.domain.com", - "datacenter": "dc1", "username": "root", "password": "{{user `vsphere_password`}}", + "insecure_connection": true, + "datacenter": "dc1", "template": "ubuntu", "folder": "folder1/folder2", From 44ce709581ae6bfe34e2dddb5b51afe27737e833 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 19:27:09 +0300 Subject: [PATCH 049/266] Update README --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8f1ad6928..bc51a0807 100644 --- a/README.md +++ b/README.md @@ -40,23 +40,19 @@ This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSp ``` ## Parameters -### Required -* `vcenter_server` - vCenter server hostname. -* `username` - vSphere username. -* `password` - vSphere password. + +Connection: +* `vcenter_server` - [**mandatory**] vCenter server hostname. +* `username` - [**mandatory**] vSphere username. +* `password` - [**mandatory**] vSphere password. * `insecure_connection` - do not validate server's TLS certificate. `false` by default. - -* `template` - name of source VM. -* `vm_name` - name of target VM. - -* `host` - vSphere host where target VM is created. -* `ssh_username` - username in guest OS. -* `ssh_password` - password in guest OS. - -### Optional -Destination: * `datacenter` - required if there are several datacenters. + +Destination: +* `template` - [**mandatory**] name of source VM. +* `vm_name` - [**mandatory**] name of target VM. * `folder` - VM folder where target VM is created. +* `host` - [**mandatory**] vSphere host where target VM is created. * `resource_pool` - by default a root of vSphere host. * `datastore` - required if vSphere host has multiple datastores attached. * `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. @@ -65,6 +61,10 @@ Hardware customization: * `CPUs` - number of CPU sockets. Inherited from source VM by default. * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. +Provisioning: +* `ssh_username` - [**mandatory**] username in guest OS. +* `ssh_password` - [**mandatory**] password in guest OS. + Post-processing: * `shutdown_command` - VMware guest tools are used by default. * `shutdown_timeout` - [Duration](https://golang.org/pkg/time/#ParseDuration) how long to wait for a graceful shutdown. 5 minutes by default. From 22d4b7e7330a6d1fb56c5118fab2e396e8631a02 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 01:34:29 +0300 Subject: [PATCH 050/266] rename file --- step_configure_hw.go => step_hardware.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename step_configure_hw.go => step_hardware.go (100%) diff --git a/step_configure_hw.go b/step_hardware.go similarity index 100% rename from step_configure_hw.go rename to step_hardware.go From a03c91e73a7b3449a10203037eedeb952ace7963 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 01:34:50 +0300 Subject: [PATCH 051/266] Refactor hardware customization --- builder.go | 4 ++-- config.go | 14 +------------ config_test.go | 14 ------------- step_hardware.go | 53 ++++++++++++++---------------------------------- 4 files changed, 18 insertions(+), 67 deletions(-) diff --git a/builder.go b/builder.go index 479c4c2f0..f3404f1ba 100644 --- a/builder.go +++ b/builder.go @@ -70,8 +70,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCloneVM{ config: b.config, }, - &StepConfigureHW{ - config: b.config, + &StepConfigureHardware{ + config: &b.config.HardwareConfig, }, &StepRun{}, &communicator.StepConnect{ diff --git a/config.go b/config.go index 246447d30..80405a5c5 100644 --- a/config.go +++ b/config.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "strconv" "time" ) @@ -32,8 +31,7 @@ type Config struct { LinkedClone bool `mapstructure:"linked_clone"` // Customization - CPUs string `mapstructure:"CPUs"` - RAM string `mapstructure:"RAM"` + HardwareConfig `mapstructure:",squash"` // Provisioning communicator.Config `mapstructure:",squash"` @@ -83,16 +81,6 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, fmt.Errorf("vSphere host is required")) } - if c.CPUs != "" { - if _, err := strconv.Atoi(c.CPUs); err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of CPU sockets")) - } - } - if c.RAM != "" { - if _, err := strconv.Atoi(c.RAM); err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number for RAM")) - } - } if c.RawShutdownTimeout != "" { timeout, err := time.ParseDuration(c.RawShutdownTimeout) if err != nil { diff --git a/config_test.go b/config_test.go index 3188dfadf..46f80662b 100644 --- a/config_test.go +++ b/config_test.go @@ -11,20 +11,6 @@ func TestMinimalConfig(t *testing.T) { testConfigOk(t, warns, errs) } -func TestInvalidCpu(t *testing.T) { - raw := minimalConfig() - raw["CPUs"] = "string" - _, warns, errs := NewConfig(raw) - testConfigErr(t, warns, errs) -} - -func TestInvalidRam(t *testing.T) { - raw := minimalConfig() - raw["RAM"] = "string" - _, warns, errs := NewConfig(raw) - testConfigErr(t, warns, errs) -} - func TestTimeout(t *testing.T) { raw := minimalConfig() raw["shutdown_timeout"] = "3m" diff --git a/step_hardware.go b/step_hardware.go index 4b5f7d2e2..38771c332 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -3,53 +3,32 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "strconv" "github.com/vmware/govmomi/vim25/types" "context" "github.com/vmware/govmomi/object" ) -type StepConfigureHW struct{ - config *Config +type HardwareConfig struct { + CPUs int32 `mapstructure:"CPUs"` + RAM int64 `mapstructure:"RAM"` } -type ConfigParametersFlag struct { - NumCPUsPtr *int32 - MemoryMBPtr *int64 +type StepConfigureHardware struct { + config *HardwareConfig } -func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { vm := state.Get("vm").(*object.VirtualMachine) ctx := state.Get("ctx").(context.Context) - - var confSpec types.VirtualMachineConfigSpec - parametersFlag := ConfigParametersFlag{} - // configure HW - if s.config.CPUs != "" { - CPUs, err := strconv.Atoi(s.config.CPUs) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - confSpec.NumCPUs = int32(CPUs) - parametersFlag.NumCPUsPtr = &(confSpec.NumCPUs) - } - if s.config.RAM != "" { - ram, err := strconv.Atoi(s.config.RAM) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - confSpec.MemoryMB = int64(ram) - parametersFlag.MemoryMBPtr = &(confSpec.MemoryMB) - } - ui := state.Get("ui").(packer.Ui) - if parametersFlag != (ConfigParametersFlag{}) { - ui.Say("configuring virtual hardware...") - // Reconfigure hardware + + if *s.config != (HardwareConfig{}) { + ui.Say("Customizing hardware parameters...") + + var confSpec types.VirtualMachineConfigSpec + confSpec.NumCPUs = s.config.CPUs + confSpec.MemoryMB = s.config.RAM + task, err := vm.Reconfigure(ctx, confSpec) if err != nil { state.Put("error", err) @@ -60,11 +39,9 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { state.Put("error", err) return multistep.ActionHalt } - } else { - ui.Say("skipping the virtual hardware configration...") } return multistep.ActionContinue } -func (s *StepConfigureHW) Cleanup(multistep.StateBag) {} +func (s *StepConfigureHardware) Cleanup(multistep.StateBag) {} From 3991b0e95cb786803c0ca836a8f1e444f2114631 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 23:43:40 +0300 Subject: [PATCH 052/266] Add 'CPU_reservation' parameter --- README.md | 2 ++ step_hardware.go | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc51a0807..3fd9f9ec0 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Destination: Hardware customization: * `CPUs` - number of CPU sockets. Inherited from source VM by default. +* `CPU_reservation` - Amount of reserved CPU resources in MHz. Inherited from source VM by default. * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. Provisioning: @@ -98,6 +99,7 @@ Post-processing: "linked_clone": true, "CPUs": 2, + "CPU_reservation": 1000, "RAM": 8192, "ssh_username": "root", diff --git a/step_hardware.go b/step_hardware.go index 38771c332..2a1ea04af 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -9,8 +9,9 @@ import ( ) type HardwareConfig struct { - CPUs int32 `mapstructure:"CPUs"` - RAM int64 `mapstructure:"RAM"` + CPUs int32 `mapstructure:"CPUs"` + CPUReservation int64 `mapstructure:"CPU_reservation"` + RAM int64 `mapstructure:"RAM"` } type StepConfigureHardware struct { @@ -29,6 +30,10 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi confSpec.NumCPUs = s.config.CPUs confSpec.MemoryMB = s.config.RAM + var cpuSpec types.ResourceAllocationInfo + cpuSpec.Reservation = s.config.CPUReservation + confSpec.CpuAllocation = &cpuSpec + task, err := vm.Reconfigure(ctx, confSpec) if err != nil { state.Put("error", err) From d2dacfbc6b1cafe25abc8e917cbe9eb7edc5f317 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 1 Jul 2017 23:52:35 +0300 Subject: [PATCH 053/266] Add 'CPU_limit' parameter --- README.md | 2 ++ step_hardware.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 3fd9f9ec0..7071f9b51 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Destination: Hardware customization: * `CPUs` - number of CPU sockets. Inherited from source VM by default. * `CPU_reservation` - Amount of reserved CPU resources in MHz. Inherited from source VM by default. +* `CPU_limit` - Upper limit of available CPU resources in MHz. Inherited from source VM by default, set to `-1` for reset. * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. Provisioning: @@ -100,6 +101,7 @@ Post-processing: "CPUs": 2, "CPU_reservation": 1000, + "CPU_limit": 2000, "RAM": 8192, "ssh_username": "root", diff --git a/step_hardware.go b/step_hardware.go index 2a1ea04af..a420f122e 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -11,6 +11,7 @@ import ( type HardwareConfig struct { CPUs int32 `mapstructure:"CPUs"` CPUReservation int64 `mapstructure:"CPU_reservation"` + CPULimit int64 `mapstructure:"CPU_limit"` RAM int64 `mapstructure:"RAM"` } @@ -32,6 +33,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi var cpuSpec types.ResourceAllocationInfo cpuSpec.Reservation = s.config.CPUReservation + cpuSpec.Limit = s.config.CPULimit confSpec.CpuAllocation = &cpuSpec task, err := vm.Reconfigure(ctx, confSpec) From 71c211fa0979cbeae0c4ab9550612aa099ff7c1b Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 00:02:49 +0300 Subject: [PATCH 054/266] Add 'RAM_reservation' parameter --- README.md | 2 ++ step_hardware.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 7071f9b51..417b658e9 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ Hardware customization: * `CPU_reservation` - Amount of reserved CPU resources in MHz. Inherited from source VM by default. * `CPU_limit` - Upper limit of available CPU resources in MHz. Inherited from source VM by default, set to `-1` for reset. * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. +* `RAM_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default. Provisioning: * `ssh_username` - [**mandatory**] username in guest OS. @@ -103,6 +104,7 @@ Post-processing: "CPU_reservation": 1000, "CPU_limit": 2000, "RAM": 8192, + "RAM_reservation": 2048, "ssh_username": "root", "ssh_password": "{{user `guest_password`}}", diff --git a/step_hardware.go b/step_hardware.go index a420f122e..5675ab4f5 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -13,6 +13,7 @@ type HardwareConfig struct { CPUReservation int64 `mapstructure:"CPU_reservation"` CPULimit int64 `mapstructure:"CPU_limit"` RAM int64 `mapstructure:"RAM"` + RAMReservation int64 `mapstructure:"RAM_reservation"` } type StepConfigureHardware struct { @@ -36,6 +37,10 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi cpuSpec.Limit = s.config.CPULimit confSpec.CpuAllocation = &cpuSpec + var ramSpec types.ResourceAllocationInfo + ramSpec.Reservation = s.config.RAMReservation + confSpec.MemoryAllocation = &ramSpec + task, err := vm.Reconfigure(ctx, confSpec) if err != nil { state.Put("error", err) From 5987795a23aa94dfc9151e457ff0b3f3188dab5d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 00:50:01 +0300 Subject: [PATCH 055/266] Add 'RAM_reserve_all' parameter --- README.md | 1 + config.go | 2 ++ config_test.go | 16 ++++++++++++---- step_hardware.go | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 417b658e9..9362a2797 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Hardware customization: * `CPU_limit` - Upper limit of available CPU resources in MHz. Inherited from source VM by default, set to `-1` for reset. * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. * `RAM_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default. +* `RAM_reserve_all` - Reserve all available RAM (bool). `false` by default. Cannot be used together with `RAM_reservation`. Provisioning: * `ssh_username` - [**mandatory**] username in guest OS. diff --git a/config.go b/config.go index 80405a5c5..4f1c22968 100644 --- a/config.go +++ b/config.go @@ -81,6 +81,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, fmt.Errorf("vSphere host is required")) } + errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + if c.RawShutdownTimeout != "" { timeout, err := time.ParseDuration(c.RawShutdownTimeout) if err != nil { diff --git a/config_test.go b/config_test.go index 46f80662b..4281ef086 100644 --- a/config_test.go +++ b/config_test.go @@ -21,6 +21,14 @@ func TestTimeout(t *testing.T) { } } +func TestRAMReservation(t *testing.T) { + raw := minimalConfig() + raw["RAM_reservation"] = 1000 + raw["RAM_reserve_all"] = true + _, warns, err := NewConfig(raw) + testConfigErr(t, warns, err) +} + func minimalConfig() map[string]interface{} { return map[string]interface{}{ "vcenter_server": "vcenter.domain.local", @@ -36,18 +44,18 @@ func minimalConfig() map[string]interface{} { func testConfigOk(t *testing.T, warns []string, err error) { if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) + t.Fatalf("Should be no warnings: %#v", warns) } if err != nil { - t.Fatalf("bad: %s", err) + t.Fatalf("Unexpected error: %s", err) } } func testConfigErr(t *testing.T, warns []string, err error) { if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) + t.Fatalf("Should be no warnings: %#v", warns) } if err == nil { - t.Fatal("should error") + t.Fatal("An error is not raised") } } diff --git a/step_hardware.go b/step_hardware.go index 5675ab4f5..076fa1c73 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -6,6 +6,7 @@ import ( "github.com/vmware/govmomi/vim25/types" "context" "github.com/vmware/govmomi/object" + "fmt" ) type HardwareConfig struct { @@ -14,6 +15,17 @@ type HardwareConfig struct { CPULimit int64 `mapstructure:"CPU_limit"` RAM int64 `mapstructure:"RAM"` RAMReservation int64 `mapstructure:"RAM_reservation"` + RAMReserveAll bool `mapstructure:"RAM_reserve_all"` +} + +func (c *HardwareConfig) Prepare() []error { + var errs []error + + if c.RAMReservation > 0 && c.RAMReserveAll != false { + errs = append(errs, fmt.Errorf("'RAM_reservation' and 'RAM_reserve_all' cannot be used together")) + } + + return errs } type StepConfigureHardware struct { @@ -41,6 +53,8 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi ramSpec.Reservation = s.config.RAMReservation confSpec.MemoryAllocation = &ramSpec + confSpec.MemoryReservationLockedToMax = &s.config.RAMReserveAll + task, err := vm.Reconfigure(ctx, confSpec) if err != nil { state.Put("error", err) From 228ac1236630d4d7aab93920af0a53fa67e6d42e Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 03:06:02 +0300 Subject: [PATCH 056/266] Separate config for shutdown step --- builder.go | 3 +-- config.go | 20 ++++---------------- config_test.go | 4 ++-- step_shutdown.go | 47 +++++++++++++++++++++++++++++++++-------------- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/builder.go b/builder.go index f3404f1ba..490bae80b 100644 --- a/builder.go +++ b/builder.go @@ -94,8 +94,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &common.StepProvision{}, &StepShutdown{ - Command: b.config.ShutdownCommand, - ShutdownTimeout: b.config.ShutdownTimeout, + config: &b.config.ShutdownConfig, }, &StepCreateSnapshot{ createSnapshot: b.config.CreateSnapshot, diff --git a/config.go b/config.go index 4f1c22968..96f0fe051 100644 --- a/config.go +++ b/config.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "time" ) type Config struct { @@ -37,11 +36,9 @@ type Config struct { communicator.Config `mapstructure:",squash"` // Post-processing - ShutdownCommand string `mapstructure:"shutdown_command"` - RawShutdownTimeout string `mapstructure:"shutdown_timeout"` - ShutdownTimeout time.Duration - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` + ShutdownConfig `mapstructure:",squash"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` ctx interpolate.Context } @@ -82,16 +79,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) - - if c.RawShutdownTimeout != "" { - timeout, err := time.ParseDuration(c.RawShutdownTimeout) - if err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) - } - c.ShutdownTimeout = timeout - } else { - c.ShutdownTimeout = 5 * time.Minute - } + errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) if len(errs.Errors) > 0 { return nil, warnings, errs diff --git a/config_test.go b/config_test.go index 4281ef086..0d7faec38 100644 --- a/config_test.go +++ b/config_test.go @@ -16,8 +16,8 @@ func TestTimeout(t *testing.T) { raw["shutdown_timeout"] = "3m" conf, warns, err := NewConfig(raw) testConfigOk(t, warns, err) - if conf.ShutdownTimeout != 3 * time.Minute { - t.Fatalf("shutdown_timeout sould be equal 3 minutes") + if conf.ShutdownConfig.Timeout != 3 * time.Minute { + t.Fatalf("shutdown_timeout sould be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout) } } diff --git a/step_shutdown.go b/step_shutdown.go index 5e9eaf1f3..47e23259a 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -12,9 +12,31 @@ import ( "errors" ) -type StepShutdown struct{ - Command string - ShutdownTimeout time.Duration +type ShutdownConfig struct { + Command string `mapstructure:"shutdown_command"` + RawTimeout string `mapstructure:"shutdown_timeout"` + Timeout time.Duration +} + +func (c *ShutdownConfig) Prepare() []error { + var errs []error + + if c.RawTimeout != "" { + timeout, err := time.ParseDuration(c.RawTimeout) + if err != nil { + errs = append(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) + return errs + } + c.Timeout = timeout + } else { + c.Timeout = 5 * time.Minute + } + + return nil +} + +type StepShutdown struct { + config *ShutdownConfig } func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { @@ -24,22 +46,20 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { vm := state.Get("vm").(*object.VirtualMachine) ctx := state.Get("ctx").(context.Context) - ui.Say("VM shutdown...") + ui.Say("Shut down VM...") - if s.Command != "" { + if s.config.Command != "" { ui.Say("Gracefully halting virtual machine...") - log.Printf("Executing shutdown command: %s", s.Command) + log.Printf("Executing shutdown command: %s", s.config.Command) var stdout, stderr bytes.Buffer cmd := &packer.RemoteCmd{ - Command: s.Command, + Command: s.config.Command, Stdout: &stdout, Stderr: &stderr, } if err := comm.Start(cmd); err != nil { - err := fmt.Errorf("Failed to send shutdown command: %s", err) - state.Put("error", err) - ui.Error(err.Error()) + state.Put("error", fmt.Errorf("Failed to send shutdown command: %s", err)) return multistep.ActionHalt } } else { @@ -47,14 +67,14 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { err := vm.ShutdownGuest(ctx) if err != nil { - state.Put("error", fmt.Errorf("Could not shutdown guest: %v", err)) + state.Put("error", fmt.Errorf("Cannot shut down VM: %v", err)) return multistep.ActionHalt } } // Wait for the machine to actually shut down - log.Printf("Waiting max %s for shutdown to complete", s.ShutdownTimeout) - shutdownTimer := time.After(s.ShutdownTimeout) + log.Printf("Waiting max %s for shutdown to complete", s.config.Timeout) + shutdownTimer := time.After(s.config.Timeout) for { powerState, err := vm.PowerState(ctx) if err != nil { @@ -81,4 +101,3 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { } func (s *StepShutdown) Cleanup(state multistep.StateBag) {} - From 22d7851e1f1ec5b7b90d12d62979f0c72243144c Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 03:52:10 +0300 Subject: [PATCH 057/266] Separate configs for connection & cloning --- .gitignore | 1 + builder.go | 38 ++++---------------------- config.go | 65 +++++++++------------------------------------ step_clone_vm.go | 56 ++++++++++++++++++++++++++++----------- step_connect.go | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 128 insertions(+), 101 deletions(-) create mode 100644 step_connect.go diff --git a/.gitignore b/.gitignore index e0169f27b..5aee28a7e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ packer-builder-vsphere packer-builder-vsphere.exe bin/ test*.json +crash.log diff --git a/builder.go b/builder.go index 490bae80b..5487cd39b 100644 --- a/builder.go +++ b/builder.go @@ -10,12 +10,8 @@ import ( "github.com/hashicorp/packer/helper/communicator" gossh "golang.org/x/crypto/ssh" "github.com/hashicorp/packer/communicator/ssh" - "github.com/vmware/govmomi" "context" - "net/url" - "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" - "fmt" ) type Builder struct { @@ -37,38 +33,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state := new(multistep.BasicStateBag) state.Put("hook", hook) state.Put("ui", ui) - ctx := context.TODO() - state.Put("ctx", ctx) - - vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", b.config.VCenterServer)) - if err != nil { - return nil, err - } - vcenter_url.User = url.UserPassword(b.config.Username, b.config.Password) - client, err := govmomi.NewClient(ctx, vcenter_url, b.config.InsecureConnection) - if err != nil { - return nil, err - } - state.Put("client", client) - - finder := find.NewFinder(client.Client, false) - datacenter, err := finder.DatacenterOrDefault(ctx, b.config.Datacenter) - if err != nil { - return nil, err - } - finder.SetDatacenter(datacenter) - state.Put("finder", finder) - state.Put("datacenter", datacenter) - - vmSrc, err := finder.VirtualMachine(ctx, b.config.Template) - if err != nil { - return nil, err - } - state.Put("vmSrc", vmSrc) + state.Put("ctx", context.TODO()) steps := []multistep.Step{ + &StepConnect{ + config: &b.config.ConnectConfig, + }, &StepCloneVM{ - config: b.config, + config: &b.config.CloneConfig, }, &StepConfigureHardware{ config: &b.config.HardwareConfig, diff --git a/config.go b/config.go index 96f0fe051..d68ee51aa 100644 --- a/config.go +++ b/config.go @@ -1,8 +1,6 @@ package main import ( - "fmt" - "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/config" @@ -11,34 +9,14 @@ import ( ) type Config struct { - common.PackerConfig `mapstructure:",squash"` - - // Connection - VCenterServer string `mapstructure:"vcenter_server"` - Datacenter string `mapstructure:"datacenter"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` - InsecureConnection bool `mapstructure:"insecure_connection"` - - // Location - Template string `mapstructure:"template"` - FolderName string `mapstructure:"folder"` - VMName string `mapstructure:"vm_name"` - Host string `mapstructure:"host"` - ResourcePool string `mapstructure:"resource_pool"` - Datastore string `mapstructure:"datastore"` - LinkedClone bool `mapstructure:"linked_clone"` - - // Customization - HardwareConfig `mapstructure:",squash"` - - // Provisioning - communicator.Config `mapstructure:",squash"` - - // Post-processing - ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` + common.PackerConfig `mapstructure:",squash"` + ConnectConfig `mapstructure:",squash"` + CloneConfig `mapstructure:",squash"` + HardwareConfig `mapstructure:",squash"` + communicator.Config `mapstructure:",squash"` + ShutdownConfig `mapstructure:",squash"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` ctx interpolate.Context } @@ -56,34 +34,15 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } errs := new(packer.MultiError) - var warnings []string errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...) - - if c.VCenterServer == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("vCenter hostname is required")) - } - if c.Username == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Username is required")) - } - if c.Password == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Password is required")) - } - if c.Template == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Template name is required")) - } - if c.VMName == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Target VM name is required")) - } - if c.Host == "" { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("vSphere host is required")) - } - + errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.CloneConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) if len(errs.Errors) > 0 { - return nil, warnings, errs + return nil, nil, errs } - return c, warnings, nil + return c, nil, nil } diff --git a/step_clone_vm.go b/step_clone_vm.go index bd0714e9b..519adb6b4 100644 --- a/step_clone_vm.go +++ b/step_clone_vm.go @@ -12,6 +12,32 @@ import ( "errors" ) +type CloneConfig struct { + Template string `mapstructure:"template"` + FolderName string `mapstructure:"folder"` + VMName string `mapstructure:"vm_name"` + Host string `mapstructure:"host"` + ResourcePool string `mapstructure:"resource_pool"` + Datastore string `mapstructure:"datastore"` + LinkedClone bool `mapstructure:"linked_clone"` +} + +func (c *CloneConfig) Prepare() []error { + var errs []error + + if c.Template == "" { + errs = append(errs, fmt.Errorf("Template name is required")) + } + if c.VMName == "" { + errs = append(errs, fmt.Errorf("Target VM name is required")) + } + if c.Host == "" { + errs = append(errs, fmt.Errorf("vSphere host is required")) + } + + return errs +} + type CloneParameters struct { ctx context.Context vmSrc *object.VirtualMachine @@ -23,33 +49,36 @@ type CloneParameters struct { } type StepCloneVM struct { - config *Config - success bool + config *CloneConfig } func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { ctx := state.Get("ctx").(context.Context) finder := state.Get("finder").(*find.Finder) datacenter := state.Get("datacenter").(*object.Datacenter) - vmSrc := state.Get("vmSrc").(*object.VirtualMachine) ui := state.Get("ui").(packer.Ui) + + vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + state.Put("vmSrc", vmSrc) + ui.Say("start cloning...") - // Get folder folder, err := finder.FolderOrDefault(ctx, fmt.Sprintf("/%v/vm/%v", datacenter.Name(), s.config.FolderName)) if err != nil { state.Put("error", err) return multistep.ActionHalt } - // Get resource pool pool, err := finder.ResourcePoolOrDefault(ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", datacenter.Name(), s.config.Host, s.config.ResourcePool)) if err != nil { state.Put("error", err) return multistep.ActionHalt } - // Get datastore var datastore *object.Datastore = nil if s.config.Datastore != "" { datastore, err = finder.Datastore(ctx, s.config.Datastore) @@ -74,26 +103,23 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { } state.Put("vm", vm) - s.success = true return multistep.ActionContinue } func (s *StepCloneVM) Cleanup(state multistep.StateBag) { - if !s.success { + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { return } - _, cancelled := state.GetOk(multistep.StateCancelled) - _, halted := state.GetOk(multistep.StateHalted) - - if cancelled || halted { - vm := state.Get("vm").(*object.VirtualMachine) + if vm, ok := state.GetOk("vm"); ok { ctx := state.Get("ctx").(context.Context) ui := state.Get("ui").(packer.Ui) - ui.Say("destroying VM...") + ui.Say("Destroying VM...") - task, err := vm.Destroy(ctx) + task, err := vm.(*object.VirtualMachine).Destroy(ctx) if err != nil { ui.Error(err.Error()) return diff --git a/step_connect.go b/step_connect.go new file mode 100644 index 000000000..a42a5d166 --- /dev/null +++ b/step_connect.go @@ -0,0 +1,69 @@ +package main + +import ( + "github.com/mitchellh/multistep" + "context" + "fmt" + "net/url" + "github.com/vmware/govmomi" + "github.com/vmware/govmomi/find" +) + +type ConnectConfig struct { + VCenterServer string `mapstructure:"vcenter_server"` + Datacenter string `mapstructure:"datacenter"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` + InsecureConnection bool `mapstructure:"insecure_connection"` +} + +func (c *ConnectConfig) Prepare() []error { + var errs []error + + if c.VCenterServer == "" { + errs = append(errs, fmt.Errorf("vCenter hostname is required")) + } + if c.Username == "" { + errs = append(errs, fmt.Errorf("Username is required")) + } + if c.Password == "" { + errs = append(errs, fmt.Errorf("Password is required")) + } + + return errs +} + +type StepConnect struct { + config *ConnectConfig +} + +func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { + ctx := state.Get("ctx").(context.Context) + + vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", s.config.VCenterServer)) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + vcenter_url.User = url.UserPassword(s.config.Username, s.config.Password) + client, err := govmomi.NewClient(ctx, vcenter_url, s.config.InsecureConnection) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + state.Put("client", client) + + finder := find.NewFinder(client.Client, false) + datacenter, err := finder.DatacenterOrDefault(ctx, s.config.Datacenter) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + finder.SetDatacenter(datacenter) + state.Put("finder", finder) + state.Put("datacenter", datacenter) + + return multistep.ActionContinue +} + +func (s *StepConnect) Cleanup(multistep.StateBag) {} From 830bb65562715028eecce1afa212afdb95b96f30 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 03:52:44 +0300 Subject: [PATCH 058/266] Rename files --- step_clone_vm.go => step_clone.go | 0 step_create_snapshot.go => step_snapshot.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename step_clone_vm.go => step_clone.go (100%) rename step_create_snapshot.go => step_snapshot.go (100%) diff --git a/step_clone_vm.go b/step_clone.go similarity index 100% rename from step_clone_vm.go rename to step_clone.go diff --git a/step_create_snapshot.go b/step_snapshot.go similarity index 100% rename from step_create_snapshot.go rename to step_snapshot.go From 9f93e93c92b0008ca11e4f164a30d6a4937ff19a Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 04:18:46 +0300 Subject: [PATCH 059/266] Add test for mandatory parameters --- config_test.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/config_test.go b/config_test.go index 0d7faec38..c716a65ec 100644 --- a/config_test.go +++ b/config_test.go @@ -11,6 +11,17 @@ func TestMinimalConfig(t *testing.T) { testConfigOk(t, warns, errs) } +func TestMandatoryParameters(t *testing.T) { + + params := []string{"vcenter_server", "username", "password", "template", "vm_name", "host"} + for _, param := range params { + raw := minimalConfig() + raw[param] = "" + _, warns, err := NewConfig(raw) + testConfigErr(t, param, warns, err) + } +} + func TestTimeout(t *testing.T) { raw := minimalConfig() raw["shutdown_timeout"] = "3m" @@ -26,7 +37,7 @@ func TestRAMReservation(t *testing.T) { raw["RAM_reservation"] = 1000 raw["RAM_reserve_all"] = true _, warns, err := NewConfig(raw) - testConfigErr(t, warns, err) + testConfigErr(t, "RAM_reservation", warns, err) } func minimalConfig() map[string]interface{} { @@ -44,18 +55,18 @@ func minimalConfig() map[string]interface{} { func testConfigOk(t *testing.T, warns []string, err error) { if len(warns) > 0 { - t.Fatalf("Should be no warnings: %#v", warns) + t.Error("Should be no warnings: %#v", warns) } if err != nil { - t.Fatalf("Unexpected error: %s", err) + t.Error("Unexpected error: %s", err) } } -func testConfigErr(t *testing.T, warns []string, err error) { +func testConfigErr(t *testing.T, context string, warns []string, err error) { if len(warns) > 0 { - t.Fatalf("Should be no warnings: %#v", warns) + t.Error("Should be no warnings: %#v", warns) } if err == nil { - t.Fatal("An error is not raised") + t.Error("An error is not raised for", context) } } From 1e747c8c9383d1d58964e579a56334eb2d8c14cd Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 06:46:38 +0300 Subject: [PATCH 060/266] extract vSphere driver --- builder.go | 2 -- driver.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ step_clone.go | 27 ++++++++++++--------------- step_connect.go | 26 ++------------------------ step_hardware.go | 7 +++---- step_run.go | 17 ++++++++--------- step_shutdown.go | 7 +++---- step_snapshot.go | 5 ++--- step_template.go | 5 ++--- 9 files changed, 78 insertions(+), 64 deletions(-) create mode 100644 driver.go diff --git a/builder.go b/builder.go index 5487cd39b..360cb58f3 100644 --- a/builder.go +++ b/builder.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/packer/helper/communicator" gossh "golang.org/x/crypto/ssh" "github.com/hashicorp/packer/communicator/ssh" - "context" "github.com/vmware/govmomi/object" ) @@ -33,7 +32,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state := new(multistep.BasicStateBag) state.Put("hook", hook) state.Put("ui", ui) - state.Put("ctx", context.TODO()) steps := []multistep.Step{ &StepConnect{ diff --git a/driver.go b/driver.go new file mode 100644 index 000000000..65437722f --- /dev/null +++ b/driver.go @@ -0,0 +1,46 @@ +package main + +import ( + "github.com/vmware/govmomi" + "github.com/vmware/govmomi/find" + "context" + "net/url" + "fmt" + "github.com/vmware/govmomi/object" +) + +type Driver struct { + ctx context.Context + client *govmomi.Client + datacenter *object.Datacenter + finder *find.Finder +} + +func NewDriverVSphere(config *ConnectConfig) (Driver, error) { + ctx := context.TODO() + + vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) + if err != nil { + return Driver{}, err + } + vcenter_url.User = url.UserPassword(config.Username, config.Password) + client, err := govmomi.NewClient(ctx, vcenter_url, config.InsecureConnection) + if err != nil { + return Driver{}, err + } + + finder := find.NewFinder(client.Client, false) + datacenter, err := finder.DatacenterOrDefault(ctx, config.Datacenter) + if err != nil { + return Driver{}, err + } + finder.SetDatacenter(datacenter) + + d := Driver{ + ctx: ctx, + client: client, + datacenter: datacenter, + finder: finder, + } + return d, nil +} diff --git a/step_clone.go b/step_clone.go index 519adb6b4..faf4041be 100644 --- a/step_clone.go +++ b/step_clone.go @@ -6,7 +6,6 @@ import ( "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/object" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/find" "fmt" "github.com/vmware/govmomi/vim25/mo" "errors" @@ -49,39 +48,37 @@ type CloneParameters struct { } type StepCloneVM struct { - config *CloneConfig + config *CloneConfig } func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { - ctx := state.Get("ctx").(context.Context) - finder := state.Get("finder").(*find.Finder) - datacenter := state.Get("datacenter").(*object.Datacenter) + d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) - vmSrc, err := finder.VirtualMachine(ctx, s.config.Template) + vmSrc, err := d.finder.VirtualMachine(d.ctx, s.config.Template) if err != nil { state.Put("error", err) return multistep.ActionHalt } state.Put("vmSrc", vmSrc) - ui.Say("start cloning...") + ui.Say("Cloning VM...") - folder, err := finder.FolderOrDefault(ctx, fmt.Sprintf("/%v/vm/%v", datacenter.Name(), s.config.FolderName)) + folder, err := d.finder.FolderOrDefault(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), s.config.FolderName)) if err != nil { state.Put("error", err) return multistep.ActionHalt } - pool, err := finder.ResourcePoolOrDefault(ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", datacenter.Name(), s.config.Host, s.config.ResourcePool)) + pool, err := d.finder.ResourcePoolOrDefault(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), s.config.Host, s.config.ResourcePool)) if err != nil { state.Put("error", err) return multistep.ActionHalt } - var datastore *object.Datastore = nil + var datastore *object.Datastore if s.config.Datastore != "" { - datastore, err = finder.Datastore(ctx, s.config.Datastore) + datastore, err = d.finder.Datastore(d.ctx, s.config.Datastore) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -89,7 +86,7 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { } vm, err := cloneVM(&CloneParameters{ - ctx: ctx, + ctx: d.ctx, vmSrc: vmSrc, vmName: s.config.VMName, folder: folder, @@ -114,17 +111,17 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { } if vm, ok := state.GetOk("vm"); ok { - ctx := state.Get("ctx").(context.Context) + d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) ui.Say("Destroying VM...") - task, err := vm.(*object.VirtualMachine).Destroy(ctx) + task, err := vm.(*object.VirtualMachine).Destroy(d.ctx) if err != nil { ui.Error(err.Error()) return } - _, err = task.WaitForResult(ctx, nil) + _, err = task.WaitForResult(d.ctx, nil) if err != nil { ui.Error(err.Error()) return diff --git a/step_connect.go b/step_connect.go index a42a5d166..1d3063f58 100644 --- a/step_connect.go +++ b/step_connect.go @@ -2,11 +2,7 @@ package main import ( "github.com/mitchellh/multistep" - "context" "fmt" - "net/url" - "github.com/vmware/govmomi" - "github.com/vmware/govmomi/find" ) type ConnectConfig struct { @@ -38,30 +34,12 @@ type StepConnect struct { } func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { - ctx := state.Get("ctx").(context.Context) - - vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", s.config.VCenterServer)) + driver, err := NewDriverVSphere(s.config) if err != nil { state.Put("error", err) return multistep.ActionHalt } - vcenter_url.User = url.UserPassword(s.config.Username, s.config.Password) - client, err := govmomi.NewClient(ctx, vcenter_url, s.config.InsecureConnection) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - state.Put("client", client) - - finder := find.NewFinder(client.Client, false) - datacenter, err := finder.DatacenterOrDefault(ctx, s.config.Datacenter) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - finder.SetDatacenter(datacenter) - state.Put("finder", finder) - state.Put("datacenter", datacenter) + state.Put("driver", driver) return multistep.ActionContinue } diff --git a/step_hardware.go b/step_hardware.go index 076fa1c73..9da092ef6 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -4,7 +4,6 @@ import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/vim25/types" - "context" "github.com/vmware/govmomi/object" "fmt" ) @@ -33,8 +32,8 @@ type StepConfigureHardware struct { } func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { + d := state.Get("driver").(Driver) vm := state.Get("vm").(*object.VirtualMachine) - ctx := state.Get("ctx").(context.Context) ui := state.Get("ui").(packer.Ui) if *s.config != (HardwareConfig{}) { @@ -55,12 +54,12 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi confSpec.MemoryReservationLockedToMax = &s.config.RAMReserveAll - task, err := vm.Reconfigure(ctx, confSpec) + task, err := vm.Reconfigure(d.ctx, confSpec) if err != nil { state.Put("error", err) return multistep.ActionHalt } - _, err = task.WaitForResult(ctx, nil) + _, err = task.WaitForResult(d.ctx, nil) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_run.go b/step_run.go index b603cdd84..f0d20e23a 100644 --- a/step_run.go +++ b/step_run.go @@ -4,7 +4,6 @@ import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" - "context" "fmt" "github.com/vmware/govmomi/vim25/types" ) @@ -16,22 +15,22 @@ type StepRun struct{ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*object.VirtualMachine) - ctx := state.Get("ctx").(context.Context) + d := state.Get("driver").(Driver) ui.Say("VM power on...") - task, err := vm.PowerOn(ctx) + task, err := vm.PowerOn(d.ctx) if err != nil { state.Put("error", err) return multistep.ActionHalt } - _, err = task.WaitForResult(ctx, nil) + _, err = task.WaitForResult(d.ctx, nil) if err != nil { state.Put("error", err) return multistep.ActionHalt } ui.Say("VM waiting for IP...") - ip, err := vm.WaitForIP(ctx) + ip, err := vm.WaitForIP(d.ctx) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -48,18 +47,18 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { if cancelled || halted { vm := state.Get("vm").(*object.VirtualMachine) - ctx := state.Get("ctx").(context.Context) + d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) - if state, err := vm.PowerState(ctx); state != types.VirtualMachinePowerStatePoweredOff && err == nil { + if state, err := vm.PowerState(d.ctx); state != types.VirtualMachinePowerStatePoweredOff && err == nil { ui.Say("shutting down VM...") - task, err := vm.PowerOff(ctx) + task, err := vm.PowerOff(d.ctx) if err != nil { ui.Error(err.Error()) return } - _, err = task.WaitForResult(ctx, nil) + _, err = task.WaitForResult(d.ctx, nil) if err != nil { ui.Error(err.Error()) return diff --git a/step_shutdown.go b/step_shutdown.go index 47e23259a..82e10b415 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -4,7 +4,6 @@ import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" - "context" "fmt" "log" "time" @@ -44,7 +43,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*object.VirtualMachine) - ctx := state.Get("ctx").(context.Context) + d := state.Get("driver").(Driver) ui.Say("Shut down VM...") @@ -65,7 +64,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { } else { ui.Say("Forcibly halting virtual machine...") - err := vm.ShutdownGuest(ctx) + err := vm.ShutdownGuest(d.ctx) if err != nil { state.Put("error", fmt.Errorf("Cannot shut down VM: %v", err)) return multistep.ActionHalt @@ -76,7 +75,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { log.Printf("Waiting max %s for shutdown to complete", s.config.Timeout) shutdownTimer := time.After(s.config.Timeout) for { - powerState, err := vm.PowerState(ctx) + powerState, err := vm.PowerState(d.ctx) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_snapshot.go b/step_snapshot.go index 81a07acee..61ba9af03 100644 --- a/step_snapshot.go +++ b/step_snapshot.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "context" "github.com/vmware/govmomi/object" ) @@ -14,12 +13,12 @@ type StepCreateSnapshot struct{ func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*object.VirtualMachine) - ctx := state.Get("ctx").(context.Context) + d := state.Get("driver").(Driver) if s.createSnapshot { ui.Say("creating snapshot...") - _, err := vm.CreateSnapshot(ctx, "packer_snapshot", "", true, true) + _, err := vm.CreateSnapshot(d.ctx, "packer_snapshot", "", true, true) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_template.go b/step_template.go index 3b64985bc..2a5519a41 100644 --- a/step_template.go +++ b/step_template.go @@ -4,7 +4,6 @@ import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" - "context" ) type StepConvertToTemplate struct{ @@ -14,12 +13,12 @@ type StepConvertToTemplate struct{ func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*object.VirtualMachine) - ctx := state.Get("ctx").(context.Context) + d := state.Get("driver").(Driver) // Turning into template if needed if s.ConvertToTemplate { ui.Say("turning into template...") - err := vm.MarkAsTemplate(ctx) + err := vm.MarkAsTemplate(d.ctx) if err != nil { state.Put("error", err) return multistep.ActionHalt From b7d58590a78fc99b4754955b6e07d2d92916c432 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 07:37:44 +0300 Subject: [PATCH 061/266] cloning step uses vSphere driver --- driver.go | 85 ++++++++++++++++++++++++++++++++++++++ step_clone.go | 110 +------------------------------------------------- 2 files changed, 87 insertions(+), 108 deletions(-) diff --git a/driver.go b/driver.go index 65437722f..ce5f26eda 100644 --- a/driver.go +++ b/driver.go @@ -7,6 +7,9 @@ import ( "net/url" "fmt" "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/mo" + "errors" ) type Driver struct { @@ -44,3 +47,85 @@ func NewDriverVSphere(config *ConnectConfig) (Driver, error) { } return d, nil } + +func (d *Driver) cloneVM(config *CloneConfig) (*object.VirtualMachine, error) { + vmSrc, err := d.finder.VirtualMachine(d.ctx, config.Template) + if err != nil { + return nil, err + } + + folder, err := d.finder.FolderOrDefault(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), config.FolderName)) + if err != nil { + return nil, err + } + + pool, err := d.finder.ResourcePoolOrDefault(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), config.Host, config.ResourcePool)) + if err != nil { + return nil, err + } + poolRef := pool.Reference() + + var datastore *object.Datastore + if config.Datastore != "" { + datastore, err = d.finder.Datastore(d.ctx, config.Datastore) + if err != nil { + return nil, err + } + } + + // Creating specs for cloning + relocateSpec := types.VirtualMachineRelocateSpec{ + Pool: &(poolRef), + } + if datastore != nil { + datastoreRef := datastore.Reference() + relocateSpec.Datastore = &datastoreRef + } + if config.LinkedClone == true { + relocateSpec.DiskMoveType = "createNewChildDiskBacking" + } + + cloneSpec := types.VirtualMachineCloneSpec{ + Location: relocateSpec, + PowerOn: false, + } + if config.LinkedClone == true { + var vmImage mo.VirtualMachine + err = vmSrc.Properties(d.ctx, vmSrc.Reference(), []string{"snapshot"}, &vmImage) + if err != nil { + err = fmt.Errorf("Error reading base VM properties: %s", err) + return nil, err + } + if vmImage.Snapshot == nil { + err = errors.New("`linked_clone=true`, but image VM has no snapshots") + return nil, err + } + cloneSpec.Snapshot = vmImage.Snapshot.CurrentSnapshot + } + + // Cloning itself + task, err := vmSrc.Clone(d.ctx, folder, config.VMName, cloneSpec) + if err != nil { + return nil, err + } + + info, err := task.WaitForResult(d.ctx, nil) + if err != nil { + return nil, err + } + + vm := object.NewVirtualMachine(vmSrc.Client(), info.Result.(types.ManagedObjectReference)) + return vm, nil +} + +func (d *Driver) destroyVM(vm *object.VirtualMachine) error { + task, err := vm.Destroy(d.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(d.ctx, nil) + if err != nil { + return err + } + return nil +} diff --git a/step_clone.go b/step_clone.go index faf4041be..d4b6c777e 100644 --- a/step_clone.go +++ b/step_clone.go @@ -1,14 +1,10 @@ package main import ( - "context" "github.com/mitchellh/multistep" - "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/object" "github.com/hashicorp/packer/packer" "fmt" - "github.com/vmware/govmomi/vim25/mo" - "errors" ) type CloneConfig struct { @@ -37,16 +33,6 @@ func (c *CloneConfig) Prepare() []error { return errs } -type CloneParameters struct { - ctx context.Context - vmSrc *object.VirtualMachine - vmName string - folder *object.Folder - resourcePool *object.ResourcePool - datastore *object.Datastore - linkedClone bool -} - type StepCloneVM struct { config *CloneConfig } @@ -55,45 +41,9 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) - vmSrc, err := d.finder.VirtualMachine(d.ctx, s.config.Template) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - state.Put("vmSrc", vmSrc) - ui.Say("Cloning VM...") - folder, err := d.finder.FolderOrDefault(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), s.config.FolderName)) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - pool, err := d.finder.ResourcePoolOrDefault(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), s.config.Host, s.config.ResourcePool)) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - var datastore *object.Datastore - if s.config.Datastore != "" { - datastore, err = d.finder.Datastore(d.ctx, s.config.Datastore) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - } - - vm, err := cloneVM(&CloneParameters{ - ctx: d.ctx, - vmSrc: vmSrc, - vmName: s.config.VMName, - folder: folder, - resourcePool: pool, - datastore: datastore, - linkedClone: s.config.LinkedClone, - }) + vm, err := d.cloneVM(s.config) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -116,65 +66,9 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { ui.Say("Destroying VM...") - task, err := vm.(*object.VirtualMachine).Destroy(d.ctx) + err := d.destroyVM(vm.(*object.VirtualMachine)) if err != nil { ui.Error(err.Error()) - return - } - _, err = task.WaitForResult(d.ctx, nil) - if err != nil { - ui.Error(err.Error()) - return } } } - -func cloneVM(params *CloneParameters) (vm *object.VirtualMachine, err error) { - vm = nil - err = nil - poolRef := params.resourcePool.Reference() - - // Creating specs for cloning - relocateSpec := types.VirtualMachineRelocateSpec{ - Pool: &(poolRef), - } - if params.datastore != nil { - datastoreRef := params.datastore.Reference() - relocateSpec.Datastore = &datastoreRef - } - if params.linkedClone == true { - relocateSpec.DiskMoveType = "createNewChildDiskBacking" - } - - cloneSpec := types.VirtualMachineCloneSpec{ - Location: relocateSpec, - PowerOn: false, - } - if params.linkedClone == true { - var vmImage mo.VirtualMachine - err = params.vmSrc.Properties(params.ctx, params.vmSrc.Reference(), []string{"snapshot"}, &vmImage) - if err != nil { - err = fmt.Errorf("Error reading base VM properties: %s", err) - return - } - if vmImage.Snapshot == nil { - err = errors.New("`linked_clone=true`, but image VM has no snapshots") - return - } - cloneSpec.Snapshot = vmImage.Snapshot.CurrentSnapshot - } - - // Cloning itself - task, err := params.vmSrc.Clone(params.ctx, params.folder, params.vmName, cloneSpec) - if err != nil { - return - } - - info, err := task.WaitForResult(params.ctx, nil) - if err != nil { - return - } - - vm = object.NewVirtualMachine(params.vmSrc.Client(), info.Result.(types.ManagedObjectReference)) - return vm, nil -} From b05ba0a9a21860e05352029eb7aa3d1d91ea5eaa Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 07:49:39 +0300 Subject: [PATCH 062/266] hardware step uses vSphere driver --- driver.go | 28 ++++++++++++++++++++++++++++ step_hardware.go | 23 +---------------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/driver.go b/driver.go index ce5f26eda..79a692750 100644 --- a/driver.go +++ b/driver.go @@ -129,3 +129,31 @@ func (d *Driver) destroyVM(vm *object.VirtualMachine) error { } return nil } + +func (d *Driver) configureVM(vm *object.VirtualMachine, config *HardwareConfig) error { + var confSpec types.VirtualMachineConfigSpec + confSpec.NumCPUs = config.CPUs + confSpec.MemoryMB = config.RAM + + var cpuSpec types.ResourceAllocationInfo + cpuSpec.Reservation = config.CPUReservation + cpuSpec.Limit = config.CPULimit + confSpec.CpuAllocation = &cpuSpec + + var ramSpec types.ResourceAllocationInfo + ramSpec.Reservation = config.RAMReservation + confSpec.MemoryAllocation = &ramSpec + + confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll + + task, err := vm.Reconfigure(d.ctx, confSpec) + if err != nil { + return err + } + _, err = task.WaitForResult(d.ctx, nil) + if err != nil { + return err + } + + return nil +} diff --git a/step_hardware.go b/step_hardware.go index 9da092ef6..11b986c78 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/object" "fmt" ) @@ -39,27 +38,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi if *s.config != (HardwareConfig{}) { ui.Say("Customizing hardware parameters...") - var confSpec types.VirtualMachineConfigSpec - confSpec.NumCPUs = s.config.CPUs - confSpec.MemoryMB = s.config.RAM - - var cpuSpec types.ResourceAllocationInfo - cpuSpec.Reservation = s.config.CPUReservation - cpuSpec.Limit = s.config.CPULimit - confSpec.CpuAllocation = &cpuSpec - - var ramSpec types.ResourceAllocationInfo - ramSpec.Reservation = s.config.RAMReservation - confSpec.MemoryAllocation = &ramSpec - - confSpec.MemoryReservationLockedToMax = &s.config.RAMReserveAll - - task, err := vm.Reconfigure(d.ctx, confSpec) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - _, err = task.WaitForResult(d.ctx, nil) + err := d.configureVM(vm, s.config) if err != nil { state.Put("error", err) return multistep.ActionHalt From 0e20a77e1cb3804dce8f9afca2bdbd32fc17a17c Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 14:44:32 +0300 Subject: [PATCH 063/266] run step uses vSphere driver --- driver.go | 39 +++++++++++++++++++++++++++++++++++++++ step_run.go | 43 +++++++++++++------------------------------ 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/driver.go b/driver.go index 79a692750..464372fc2 100644 --- a/driver.go +++ b/driver.go @@ -157,3 +157,42 @@ func (d *Driver) configureVM(vm *object.VirtualMachine, config *HardwareConfig) return nil } + +func (d *Driver) powerOn(vm *object.VirtualMachine) error { + task, err := vm.PowerOn(d.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(d.ctx, nil) + if err != nil { + return err + } + return nil +} + +func (d *Driver) WaitForIP(vm *object.VirtualMachine) (string, error) { + ip, err := vm.WaitForIP(d.ctx) + if err != nil { + return "", err + } + return ip, nil +} + +func (d *Driver) powerOff(vm *object.VirtualMachine) error { + state, err := vm.PowerState(d.ctx) + if err != nil { + return err + } + + if state != types.VirtualMachinePowerStatePoweredOff { + task, err := vm.PowerOff(d.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(d.ctx, nil) + if err != nil { + return err + } + } + return nil +} diff --git a/step_run.go b/step_run.go index f0d20e23a..8787926b1 100644 --- a/step_run.go +++ b/step_run.go @@ -5,39 +5,33 @@ import ( "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" "fmt" - "github.com/vmware/govmomi/vim25/types" ) -type StepRun struct{ +type StepRun struct { // TODO: add boot time to provide a proper timeout during cleanup } func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*object.VirtualMachine) d := state.Get("driver").(Driver) + vm := state.Get("vm").(*object.VirtualMachine) + ui := state.Get("ui").(packer.Ui) - ui.Say("VM power on...") - task, err := vm.PowerOn(d.ctx) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - _, err = task.WaitForResult(d.ctx, nil) + ui.Say("Power on VM...") + err := d.powerOn(vm) if err != nil { state.Put("error", err) return multistep.ActionHalt } - ui.Say("VM waiting for IP...") - ip, err := vm.WaitForIP(d.ctx) + ui.Say("Waiting for IP...") + ip, err := d.WaitForIP(vm) if err != nil { state.Put("error", err) return multistep.ActionHalt } - state.Put("ip", ip) - ui.Say(fmt.Sprintf("VM ip %v", ip)) + ui.Say(fmt.Sprintf("IP address: %v", ip)) + return multistep.ActionContinue } @@ -46,24 +40,13 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { _, halted := state.GetOk(multistep.StateHalted) if cancelled || halted { - vm := state.Get("vm").(*object.VirtualMachine) d := state.Get("driver").(Driver) + vm := state.Get("vm").(*object.VirtualMachine) ui := state.Get("ui").(packer.Ui) - if state, err := vm.PowerState(d.ctx); state != types.VirtualMachinePowerStatePoweredOff && err == nil { - ui.Say("shutting down VM...") - - task, err := vm.PowerOff(d.ctx) - if err != nil { - ui.Error(err.Error()) - return - } - _, err = task.WaitForResult(d.ctx, nil) - if err != nil { - ui.Error(err.Error()) - return - } - } else if err != nil { + ui.Say("Power off VM...") + err := d.powerOff(vm) + if err != nil { ui.Error(err.Error()) return } From ee4665c12c21f5f6ba4aeffa70cb547109efcb75 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 15:27:52 +0300 Subject: [PATCH 064/266] shutdown step uses vSphere driver --- driver.go | 35 +++++++++++++++++++++++++++++++---- step_shutdown.go | 41 ++++++++++------------------------------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/driver.go b/driver.go index 464372fc2..8b03d3258 100644 --- a/driver.go +++ b/driver.go @@ -10,6 +10,7 @@ import ( "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" "errors" + "time" ) type Driver struct { @@ -184,14 +185,40 @@ func (d *Driver) powerOff(vm *object.VirtualMachine) error { return err } - if state != types.VirtualMachinePowerStatePoweredOff { - task, err := vm.PowerOff(d.ctx) + if state == types.VirtualMachinePowerStatePoweredOff { + return nil + } + + task, err := vm.PowerOff(d.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(d.ctx, nil) + return err +} + +func (d *Driver) StartShutdown(vm *object.VirtualMachine) error { + err := vm.ShutdownGuest(d.ctx) + return err +} + +func (d *Driver) WaitForShutdown(vm *object.VirtualMachine, timeout time.Duration) error { + shutdownTimer := time.After(timeout) + for { + powerState, err := vm.PowerState(d.ctx) if err != nil { return err } - _, err = task.WaitForResult(d.ctx, nil) - if err != nil { + if powerState == "poweredOff" { + break + } + + select { + case <-shutdownTimer: + err := errors.New("Timeout while waiting for machine to shut down.") return err + default: + time.Sleep(1 * time.Second) } } return nil diff --git a/step_shutdown.go b/step_shutdown.go index 82e10b415..3de3d4d36 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -8,7 +8,6 @@ import ( "log" "time" "bytes" - "errors" ) type ShutdownConfig struct { @@ -39,17 +38,14 @@ type StepShutdown struct { } func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { - // is set during the communicator.StepConnect - comm := state.Get("communicator").(packer.Communicator) ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*object.VirtualMachine) + comm := state.Get("communicator").(packer.Communicator) d := state.Get("driver").(Driver) - - ui.Say("Shut down VM...") + vm := state.Get("vm").(*object.VirtualMachine) if s.config.Command != "" { - ui.Say("Gracefully halting virtual machine...") - log.Printf("Executing shutdown command: %s", s.config.Command) + ui.Say("Executing shutdown command...") + log.Printf("Shutdown command: %s", s.config.Command) var stdout, stderr bytes.Buffer cmd := &packer.RemoteCmd{ @@ -62,37 +58,20 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } } else { - ui.Say("Forcibly halting virtual machine...") + ui.Say("Shut down VM...") - err := vm.ShutdownGuest(d.ctx) + err := d.StartShutdown(vm) if err != nil { state.Put("error", fmt.Errorf("Cannot shut down VM: %v", err)) return multistep.ActionHalt } } - // Wait for the machine to actually shut down log.Printf("Waiting max %s for shutdown to complete", s.config.Timeout) - shutdownTimer := time.After(s.config.Timeout) - for { - powerState, err := vm.PowerState(d.ctx) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - if powerState == "poweredOff" { - break - } - - select { - case <-shutdownTimer: - err := errors.New("Timeout while waiting for machine to shut down.") - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - default: - time.Sleep(150 * time.Millisecond) - } + err := d.WaitForShutdown(vm, s.config.Timeout) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt } ui.Say("VM stopped") From 726df3927d4ddd57a66d447c289b65b7e478d974 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 17:53:29 +0300 Subject: [PATCH 065/266] snapshot step uses vSphere driver --- driver.go | 9 +++++++++ step_snapshot.go | 7 +++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/driver.go b/driver.go index 8b03d3258..a626e88be 100644 --- a/driver.go +++ b/driver.go @@ -223,3 +223,12 @@ func (d *Driver) WaitForShutdown(vm *object.VirtualMachine, timeout time.Duratio } return nil } + +func (d *Driver) CreateSnapshot(vm *object.VirtualMachine) error { + task, err := vm.CreateSnapshot(d.ctx, "Created by Packer", "", false,false) + if err != nil { + return err + } + _, err = task.WaitForResult(d.ctx, nil) + return err +} diff --git a/step_snapshot.go b/step_snapshot.go index 61ba9af03..46f83e02c 100644 --- a/step_snapshot.go +++ b/step_snapshot.go @@ -12,18 +12,17 @@ type StepCreateSnapshot struct{ func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*object.VirtualMachine) d := state.Get("driver").(Driver) + vm := state.Get("vm").(*object.VirtualMachine) if s.createSnapshot { - ui.Say("creating snapshot...") + ui.Say("Creating snapshot...") - _, err := vm.CreateSnapshot(d.ctx, "packer_snapshot", "", true, true) + err := d.CreateSnapshot(vm) if err != nil { state.Put("error", err) return multistep.ActionHalt } - ui.Say("done") } return multistep.ActionContinue From cadc320b7212c91cb1cc342cf3f863943a964716 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 18:00:43 +0300 Subject: [PATCH 066/266] template step uses vSphere driver --- driver.go | 7 ++++++- step_template.go | 8 +++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/driver.go b/driver.go index a626e88be..12ed63bf4 100644 --- a/driver.go +++ b/driver.go @@ -225,10 +225,15 @@ func (d *Driver) WaitForShutdown(vm *object.VirtualMachine, timeout time.Duratio } func (d *Driver) CreateSnapshot(vm *object.VirtualMachine) error { - task, err := vm.CreateSnapshot(d.ctx, "Created by Packer", "", false,false) + task, err := vm.CreateSnapshot(d.ctx, "Created by Packer", "", false, false) if err != nil { return err } _, err = task.WaitForResult(d.ctx, nil) return err } + +func (d *Driver) ConvertToTemplate(vm *object.VirtualMachine) error { + err := vm.MarkAsTemplate(d.ctx) + return err +} diff --git a/step_template.go b/step_template.go index 2a5519a41..974f018d1 100644 --- a/step_template.go +++ b/step_template.go @@ -12,18 +12,16 @@ type StepConvertToTemplate struct{ func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*object.VirtualMachine) d := state.Get("driver").(Driver) + vm := state.Get("vm").(*object.VirtualMachine) - // Turning into template if needed if s.ConvertToTemplate { - ui.Say("turning into template...") - err := vm.MarkAsTemplate(d.ctx) + ui.Say("Convert VM into template...") + err := d.ConvertToTemplate(vm) if err != nil { state.Put("error", err) return multistep.ActionHalt } - ui.Say("done") } return multistep.ActionContinue From 41744c3bcc20729a98898a48f781f31b3cad3e2f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 2 Jul 2017 23:29:50 +0300 Subject: [PATCH 067/266] Code cleanup --- README.md | 6 ++-- artifact.go | 16 ++++----- builder.go | 6 ++-- config_test.go | 2 -- driver.go | 84 +++++++++++++++++++----------------------------- step_clone.go | 10 +++--- step_connect.go | 4 +-- step_hardware.go | 6 ++-- step_run.go | 27 ++++++++-------- step_shutdown.go | 5 +-- step_snapshot.go | 2 +- step_template.go | 2 +- 12 files changed, 72 insertions(+), 98 deletions(-) diff --git a/README.md b/README.md index 9362a2797..b61293fbe 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ Connection: * `insecure_connection` - do not validate server's TLS certificate. `false` by default. * `datacenter` - required if there are several datacenters. -Destination: -* `template` - [**mandatory**] name of source VM. +Location: +* `template` - [**mandatory**] name of source VM. Path is optional. * `vm_name` - [**mandatory**] name of target VM. * `folder` - VM folder where target VM is created. * `host` - [**mandatory**] vSphere host where target VM is created. @@ -93,7 +93,7 @@ Post-processing: "insecure_connection": true, "datacenter": "dc1", - "template": "ubuntu", + "template": "folder/ubuntu", "folder": "folder1/folder2", "vm_name": "vm-1", "host": "esxi-1.domain.com", diff --git a/artifact.go b/artifact.go index 8094bf1dc..8b71c55cd 100644 --- a/artifact.go +++ b/artifact.go @@ -8,8 +8,8 @@ import ( const BuilderId = "jetbrains.vsphere" type Artifact struct { - VMName string - Conn *object.VirtualMachine + Name string + VM *object.VirtualMachine } func (a *Artifact) BuilderId() string { @@ -21,11 +21,11 @@ func (a *Artifact) Files() []string { } func (a *Artifact) Id() string { - return a.VMName + return a.Name } func (a *Artifact) String() string { - return a.VMName + return a.Name } func (a *Artifact) State(name string) interface{} { @@ -34,14 +34,10 @@ func (a *Artifact) State(name string) interface{} { func (a *Artifact) Destroy() error { ctx := context.TODO() - task, err := a.Conn.Destroy(ctx) + task, err := a.VM.Destroy(ctx) if err != nil { return err } _, err = task.WaitForResult(ctx, nil) - if err != nil { - return err - } - - return nil + return err } diff --git a/builder.go b/builder.go index 360cb58f3..adb8d6dc2 100644 --- a/builder.go +++ b/builder.go @@ -2,7 +2,6 @@ package main import ( "errors" - "log" "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/packer" @@ -93,15 +92,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } artifact := &Artifact{ - VMName: b.config.VMName, - Conn: state.Get("vm").(*object.VirtualMachine), + Name: b.config.VMName, + VM: state.Get("vm").(*object.VirtualMachine), } return artifact, nil } func (b *Builder) Cancel() { if b.runner != nil { - log.Println("Cancelling the step runner...") b.runner.Cancel() } } diff --git a/config_test.go b/config_test.go index c716a65ec..ecc7677e0 100644 --- a/config_test.go +++ b/config_test.go @@ -7,12 +7,10 @@ import ( func TestMinimalConfig(t *testing.T) { _, warns, errs := NewConfig(minimalConfig()) - testConfigOk(t, warns, errs) } func TestMandatoryParameters(t *testing.T) { - params := []string{"vcenter_server", "username", "password", "template", "vm_name", "host"} for _, param := range params { raw := minimalConfig() diff --git a/driver.go b/driver.go index 12ed63bf4..72892f409 100644 --- a/driver.go +++ b/driver.go @@ -16,27 +16,27 @@ import ( type Driver struct { ctx context.Context client *govmomi.Client - datacenter *object.Datacenter finder *find.Finder + datacenter *object.Datacenter } -func NewDriverVSphere(config *ConnectConfig) (Driver, error) { +func NewDriver(config *ConnectConfig) (*Driver, error) { ctx := context.TODO() vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) if err != nil { - return Driver{}, err + return nil, err } vcenter_url.User = url.UserPassword(config.Username, config.Password) client, err := govmomi.NewClient(ctx, vcenter_url, config.InsecureConnection) if err != nil { - return Driver{}, err + return nil, err } finder := find.NewFinder(client.Client, false) datacenter, err := finder.DatacenterOrDefault(ctx, config.Datacenter) if err != nil { - return Driver{}, err + return nil, err } finder.SetDatacenter(datacenter) @@ -46,66 +46,58 @@ func NewDriverVSphere(config *ConnectConfig) (Driver, error) { datacenter: datacenter, finder: finder, } - return d, nil + return &d, nil } -func (d *Driver) cloneVM(config *CloneConfig) (*object.VirtualMachine, error) { - vmSrc, err := d.finder.VirtualMachine(d.ctx, config.Template) +func (d *Driver) CloneVM(config *CloneConfig) (*object.VirtualMachine, error) { + template, err := d.finder.VirtualMachine(d.ctx, config.Template) if err != nil { return nil, err } - folder, err := d.finder.FolderOrDefault(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), config.FolderName)) + folder, err := d.finder.FolderOrDefault(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), config.Folder)) if err != nil { return nil, err } + var relocateSpec types.VirtualMachineRelocateSpec + pool, err := d.finder.ResourcePoolOrDefault(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), config.Host, config.ResourcePool)) if err != nil { return nil, err } poolRef := pool.Reference() + relocateSpec.Pool = &poolRef - var datastore *object.Datastore if config.Datastore != "" { - datastore, err = d.finder.Datastore(d.ctx, config.Datastore) + datastore, err := d.finder.Datastore(d.ctx, config.Datastore) if err != nil { return nil, err } - } - - // Creating specs for cloning - relocateSpec := types.VirtualMachineRelocateSpec{ - Pool: &(poolRef), - } - if datastore != nil { datastoreRef := datastore.Reference() relocateSpec.Datastore = &datastoreRef } - if config.LinkedClone == true { - relocateSpec.DiskMoveType = "createNewChildDiskBacking" - } - cloneSpec := types.VirtualMachineCloneSpec{ - Location: relocateSpec, - PowerOn: false, - } + var cloneSpec types.VirtualMachineCloneSpec + cloneSpec.Location = relocateSpec + cloneSpec.PowerOn = false + if config.LinkedClone == true { - var vmImage mo.VirtualMachine - err = vmSrc.Properties(d.ctx, vmSrc.Reference(), []string{"snapshot"}, &vmImage) + cloneSpec.Location.DiskMoveType = "createNewChildDiskBacking" + + var tpl mo.VirtualMachine + err = template.Properties(d.ctx, template.Reference(), []string{"snapshot"}, &tpl) if err != nil { - err = fmt.Errorf("Error reading base VM properties: %s", err) return nil, err } - if vmImage.Snapshot == nil { - err = errors.New("`linked_clone=true`, but image VM has no snapshots") + if tpl.Snapshot == nil { + err = errors.New("`linked_clone=true`, but template has no snapshots") return nil, err } - cloneSpec.Snapshot = vmImage.Snapshot.CurrentSnapshot + cloneSpec.Snapshot = tpl.Snapshot.CurrentSnapshot } - // Cloning itself - task, err := vmSrc.Clone(d.ctx, folder, config.VMName, cloneSpec) + task, err := template.Clone(d.ctx, folder, config.VMName, cloneSpec) if err != nil { return nil, err } @@ -115,23 +107,20 @@ func (d *Driver) cloneVM(config *CloneConfig) (*object.VirtualMachine, error) { return nil, err } - vm := object.NewVirtualMachine(vmSrc.Client(), info.Result.(types.ManagedObjectReference)) + vm := object.NewVirtualMachine(d.client.Client, info.Result.(types.ManagedObjectReference)) return vm, nil } -func (d *Driver) destroyVM(vm *object.VirtualMachine) error { +func (d *Driver) DestroyVM(vm *object.VirtualMachine) error { task, err := vm.Destroy(d.ctx) if err != nil { return err } _, err = task.WaitForResult(d.ctx, nil) - if err != nil { - return err - } - return nil + return err } -func (d *Driver) configureVM(vm *object.VirtualMachine, config *HardwareConfig) error { +func (d *Driver) ConfigureVM(vm *object.VirtualMachine, config *HardwareConfig) error { var confSpec types.VirtualMachineConfigSpec confSpec.NumCPUs = config.CPUs confSpec.MemoryMB = config.RAM @@ -152,23 +141,16 @@ func (d *Driver) configureVM(vm *object.VirtualMachine, config *HardwareConfig) return err } _, err = task.WaitForResult(d.ctx, nil) - if err != nil { - return err - } - - return nil + return err } -func (d *Driver) powerOn(vm *object.VirtualMachine) error { +func (d *Driver) PowerOn(vm *object.VirtualMachine) error { task, err := vm.PowerOn(d.ctx) if err != nil { return err } _, err = task.WaitForResult(d.ctx, nil) - if err != nil { - return err - } - return nil + return err } func (d *Driver) WaitForIP(vm *object.VirtualMachine) (string, error) { @@ -179,7 +161,7 @@ func (d *Driver) WaitForIP(vm *object.VirtualMachine) (string, error) { return ip, nil } -func (d *Driver) powerOff(vm *object.VirtualMachine) error { +func (d *Driver) PowerOff(vm *object.VirtualMachine) error { state, err := vm.PowerState(d.ctx) if err != nil { return err diff --git a/step_clone.go b/step_clone.go index d4b6c777e..195e49859 100644 --- a/step_clone.go +++ b/step_clone.go @@ -9,8 +9,8 @@ import ( type CloneConfig struct { Template string `mapstructure:"template"` - FolderName string `mapstructure:"folder"` VMName string `mapstructure:"vm_name"` + Folder string `mapstructure:"folder"` Host string `mapstructure:"host"` ResourcePool string `mapstructure:"resource_pool"` Datastore string `mapstructure:"datastore"` @@ -38,12 +38,12 @@ type StepCloneVM struct { } func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { - d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*Driver) ui.Say("Cloning VM...") - vm, err := d.cloneVM(s.config) + vm, err := d.CloneVM(s.config) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -61,12 +61,12 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { } if vm, ok := state.GetOk("vm"); ok { - d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*Driver) ui.Say("Destroying VM...") - err := d.destroyVM(vm.(*object.VirtualMachine)) + err := d.DestroyVM(vm.(*object.VirtualMachine)) if err != nil { ui.Error(err.Error()) } diff --git a/step_connect.go b/step_connect.go index 1d3063f58..0657fd5ed 100644 --- a/step_connect.go +++ b/step_connect.go @@ -7,10 +7,10 @@ import ( type ConnectConfig struct { VCenterServer string `mapstructure:"vcenter_server"` - Datacenter string `mapstructure:"datacenter"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` InsecureConnection bool `mapstructure:"insecure_connection"` + Datacenter string `mapstructure:"datacenter"` } func (c *ConnectConfig) Prepare() []error { @@ -34,7 +34,7 @@ type StepConnect struct { } func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { - driver, err := NewDriverVSphere(s.config) + driver, err := NewDriver(s.config) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_hardware.go b/step_hardware.go index 11b986c78..4c1e95a39 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -31,14 +31,14 @@ type StepConfigureHardware struct { } func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { - d := state.Get("driver").(Driver) - vm := state.Get("vm").(*object.VirtualMachine) ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*Driver) + vm := state.Get("vm").(*object.VirtualMachine) if *s.config != (HardwareConfig{}) { ui.Say("Customizing hardware parameters...") - err := d.configureVM(vm, s.config) + err := d.ConfigureVM(vm, s.config) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_run.go b/step_run.go index 8787926b1..4d68b0d2b 100644 --- a/step_run.go +++ b/step_run.go @@ -8,16 +8,15 @@ import ( ) type StepRun struct { - // TODO: add boot time to provide a proper timeout during cleanup } func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { - d := state.Get("driver").(Driver) - vm := state.Get("vm").(*object.VirtualMachine) ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*Driver) + vm := state.Get("vm").(*object.VirtualMachine) ui.Say("Power on VM...") - err := d.powerOn(vm) + err := d.PowerOn(vm) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -38,17 +37,17 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { func (s *StepRun) Cleanup(state multistep.StateBag) { _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { + return + } - if cancelled || halted { - d := state.Get("driver").(Driver) - vm := state.Get("vm").(*object.VirtualMachine) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*Driver) + vm := state.Get("vm").(*object.VirtualMachine) - ui.Say("Power off VM...") - err := d.powerOff(vm) - if err != nil { - ui.Error(err.Error()) - return - } + ui.Say("Power off VM...") + err := d.PowerOff(vm) + if err != nil { + ui.Error(err.Error()) } } diff --git a/step_shutdown.go b/step_shutdown.go index 3de3d4d36..2b2e4c1a8 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -40,7 +40,7 @@ type StepShutdown struct { func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) comm := state.Get("communicator").(packer.Communicator) - d := state.Get("driver").(Driver) + d := state.Get("driver").(*Driver) vm := state.Get("vm").(*object.VirtualMachine) if s.config.Command != "" { @@ -53,7 +53,8 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { Stdout: &stdout, Stderr: &stderr, } - if err := comm.Start(cmd); err != nil { + err := comm.Start(cmd) + if err != nil { state.Put("error", fmt.Errorf("Failed to send shutdown command: %s", err)) return multistep.ActionHalt } diff --git a/step_snapshot.go b/step_snapshot.go index 46f83e02c..740d98728 100644 --- a/step_snapshot.go +++ b/step_snapshot.go @@ -12,7 +12,7 @@ type StepCreateSnapshot struct{ func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(Driver) + d := state.Get("driver").(*Driver) vm := state.Get("vm").(*object.VirtualMachine) if s.createSnapshot { diff --git a/step_template.go b/step_template.go index 974f018d1..1b3767015 100644 --- a/step_template.go +++ b/step_template.go @@ -12,7 +12,7 @@ type StepConvertToTemplate struct{ func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(Driver) + d := state.Get("driver").(*Driver) vm := state.Get("vm").(*object.VirtualMachine) if s.ConvertToTemplate { From deec89771849b8c8580232d0ee7b5b299959c172 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 6 Jul 2017 01:23:39 +0300 Subject: [PATCH 068/266] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b61293fbe..781e3f5cf 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,8 @@ Post-processing: "datacenter": "dc1", "template": "folder/ubuntu", - "folder": "folder1/folder2", "vm_name": "vm-1", + "folder": "folder1/folder2", "host": "esxi-1.domain.com", "resource_pool": "pool1/pool2", "datastore": "datastore1", From 566e2131d15dda3a8b45d1dc1488b46c3d278917 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 30 Jul 2017 03:56:10 +0300 Subject: [PATCH 069/266] Update build scripts --- build.sh | 5 ++++- docker-compose.yml | 2 +- docker/Dockerfile | 5 ----- test.sh | 4 ++++ 4 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 docker/Dockerfile create mode 100755 test.sh diff --git a/build.sh b/build.sh index 8930f4dfb..10e213284 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,12 @@ -#!/bin/sh -eux +#!/bin/sh + +set -eux glide install -v export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin +rm bin/* GOOS=darwin go build -o bin/packer-builder-vsphere.macos GOOS=linux go build -o bin/packer-builder-vsphere.linux diff --git a/docker-compose.yml b/docker-compose.yml index 42740643f..5d2c26933 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ build: - build: docker/ + image: jetbrainsinfra/golang:1.8.3 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 64c776491..000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM golang:1.8.3 -ARG GLIDE_VERSION=0.12.3 - -RUN wget -nv https://github.com/Masterminds/glide/releases/download/v$GLIDE_VERSION/glide-v$GLIDE_VERSION-linux-amd64.tar.gz -O- | \ -tar xzf - -C /usr/local/bin/ --strip-components=1 linux-amd64/glide diff --git a/test.sh b/test.sh new file mode 100755 index 000000000..0c7683736 --- /dev/null +++ b/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export PACKER_ACC=1 +go test -v From 543bef448ceaed5b86408e2b11bba6b30fc3deb8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 30 Jul 2017 04:06:50 +0300 Subject: [PATCH 070/266] fix build script --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 10e213284..b64c7ec69 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,7 @@ glide install -v export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin -rm bin/* +rm -f bin/* GOOS=darwin go build -o bin/packer-builder-vsphere.macos GOOS=linux go build -o bin/packer-builder-vsphere.linux From bc2ab11165a4396ab4bd4d95310203fd98f2135d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 16 Aug 2017 00:41:36 +0300 Subject: [PATCH 071/266] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 781e3f5cf..fc36fc580 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,9 @@ Location: * `template` - [**mandatory**] name of source VM. Path is optional. * `vm_name` - [**mandatory**] name of target VM. * `folder` - VM folder where target VM is created. -* `host` - [**mandatory**] vSphere host where target VM is created. +* `host` - [**mandatory**] vSphere host or cluster where target VM is created. If hosts are groupped into folders, full path should be specified: `folder/host`. * `resource_pool` - by default a root of vSphere host. -* `datastore` - required if vSphere host has multiple datastores attached. +* `datastore` - required if target is a cluster, or a host with multiple datastores. * `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. Hardware customization: @@ -96,7 +96,7 @@ Post-processing: "template": "folder/ubuntu", "vm_name": "vm-1", "folder": "folder1/folder2", - "host": "esxi-1.domain.com", + "host": "folder/esxi-1.domain.com", "resource_pool": "pool1/pool2", "datastore": "datastore1", "linked_clone": true, From 3c406175783893cf99beb0e531903d6ff2e41faa Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 16 Aug 2017 02:49:44 +0300 Subject: [PATCH 072/266] Keep vSphere connection alive --- driver.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/driver.go b/driver.go index 72892f409..93ff4fa15 100644 --- a/driver.go +++ b/driver.go @@ -11,6 +11,9 @@ import ( "github.com/vmware/govmomi/vim25/mo" "errors" "time" + "github.com/vmware/govmomi/session" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25" ) type Driver struct { @@ -27,8 +30,22 @@ func NewDriver(config *ConnectConfig) (*Driver, error) { if err != nil { return nil, err } - vcenter_url.User = url.UserPassword(config.Username, config.Password) - client, err := govmomi.NewClient(ctx, vcenter_url, config.InsecureConnection) + credentials := url.UserPassword(config.Username, config.Password) + vcenter_url.User = credentials + + soapClient := soap.NewClient(vcenter_url, config.InsecureConnection) + vimClient, err := vim25.NewClient(ctx, soapClient) + if err != nil { + return nil, err + } + + vimClient.RoundTripper = session.KeepAlive(vimClient.RoundTripper, 10*time.Minute) + client := &govmomi.Client{ + Client: vimClient, + SessionManager: session.NewManager(vimClient), + } + + err = client.SessionManager.Login(ctx, credentials) if err != nil { return nil, err } From 9f9e0e9ae7a8fa0e1cdb48abf66338a69ee7d5b8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 16 Aug 2017 20:38:59 +0300 Subject: [PATCH 073/266] fix test --- builder_acc_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 58d0fad1a..1ec52dd12 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -17,14 +17,14 @@ const testBuilderAccBasic = ` "builders": [{ "type": "test", - "vcenter_server": "vcenter.vsphere5.test", + "vcenter_server": "vcenter.vsphere55.test", "username": "root", "password": "jetbrains", "insecure_connection": true, "template": "basic", "vm_name": "test1", - "host": "esxi-1.vsphere5.test", + "host": "esxi-1.vsphere55.test", "ssh_username": "jetbrains", "ssh_password": "jetbrains" From ae3a1d6f24702ef95a18c2f9df7245c5b78b778f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Fri, 18 Aug 2017 02:24:59 +0300 Subject: [PATCH 074/266] integration tests --- builder_acc_test.go | 209 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 194 insertions(+), 15 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 1ec52dd12..8fc363837 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -3,31 +3,210 @@ package main import ( "testing" builderT "github.com/hashicorp/packer/helper/builder/testing" + "fmt" + "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/vim25/mo" + "encoding/json" + "math/rand" + "github.com/vmware/govmomi/object" ) -func TestBuilderAcc_basic(t *testing.T) { +func TestBuilderAcc_default(t *testing.T) { + config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, - Template: testBuilderAccBasic, + Template: renderConfig(config), + Check: checkDefault(t, config["vm_name"].(string), config["host"].(string)), }) } -const testBuilderAccBasic = ` -{ - "builders": [{ - "type": "test", - - "vcenter_server": "vcenter.vsphere55.test", - "username": "root", - "password": "jetbrains", +func defaultConfig() map[string]interface{} { + config := map[string]interface{}{ + "vcenter_server": "vcenter.vsphere55.test", + "username": "root", + "password": "jetbrains", "insecure_connection": true, "template": "basic", - "vm_name": "test1", - "host": "esxi-1.vsphere55.test", + "host": "esxi-1.vsphere55.test", "ssh_username": "jetbrains", - "ssh_password": "jetbrains" - }] + "ssh_password": "jetbrains", + } + config["vm_name"] = fmt.Sprintf("test-%v", rand.Intn(1000)) + return config +} + +func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + if len(artifacts) > 1 { + t.Fatal("more than 1 artifact") + } + + artifactRaw := artifacts[0] + artifact, ok := artifactRaw.(*Artifact) + if !ok { + t.Fatalf("unknown artifact: %#v", artifactRaw) + } + + conn := testConn(t) + + vm, err := conn.finder.VirtualMachine(conn.ctx, artifact.Name) + if err != nil { + t.Fatal("Cannot find VM: ", err) + } + + var vmInfo mo.VirtualMachine + err = vm.Properties(conn.ctx, vm.Reference(), []string{"name", "runtime.host", "resourcePool", "layoutEx.disk"}, &vmInfo) + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Name != name { + t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) + } + + var hostInfo mo.HostSystem + err = vm.Properties(conn.ctx, vmInfo.Runtime.Host.Reference(), []string{"name"}, &hostInfo) + if err != nil { + t.Fatal("Cannot read VM properties: ", err) + } + + if hostInfo.Name != host { + t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) + } + + var rpInfo = mo.ResourcePool{} + err = vm.Properties(conn.ctx, vmInfo.ResourcePool.Reference(), []string{"owner", "parent"}, &rpInfo) + if err != nil { + t.Fatalf("Cannot read resource pool properties: %v", err) + } + + if rpInfo.Owner != *rpInfo.Parent { + t.Error("Not a root resource pool") + } + + if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { + t.Error("Not a full clone") + } + + return nil + } +} + +func TestBuilderAcc_linkedClone(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: linkedCloneConfig(), + Check: checkLinkedClone(t), + }) +} + +func linkedCloneConfig() string { + config := defaultConfig() + config["linked_clone"] = true + return renderConfig(config) +} + +func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + artifactRaw := artifacts[0] + artifact, _ := artifactRaw.(*Artifact) + + conn := testConn(t) + + vm, err := conn.finder.VirtualMachine(conn.ctx, artifact.Name) + if err != nil { + t.Fatalf("Cannot find VM: %v", err) + } + + var vmInfo mo.VirtualMachine + err = vm.Properties(conn.ctx, vm.Reference(), []string{"layoutEx.disk"}, &vmInfo) + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if len(vmInfo.LayoutEx.Disk[0].Chain) != 3 { + t.Error("Not a linked clone") + } + + return nil + } +} + +func TestBuilderAcc_template(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: templateConfig(), + Check: checkTemplate(t), + }) +} + +func templateConfig() string { + config := defaultConfig() + config["linked_clone"] = true + config["convert_to_template"] = true + return renderConfig(config) +} + +func checkTemplate(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + var vmInfo mo.VirtualMachine + err := vm.Properties(d.ctx, vm.Reference(), []string{"config.template"}, &vmInfo) + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Config.Template != true { + t.Error("Not a template") + } + + return nil + } +} + +func renderConfig(config map[string]interface{}) string { + t := map[string][]map[string]interface{}{ + "builders": { + map[string]interface{}{ + "type": "test", + }, + }, + } + for k, v := range config { + t["builders"][0][k] = v + } + + j, _ := json.Marshal(t) + return string(j) +} + +func testConn(t *testing.T) *Driver { + config := &ConnectConfig{ + VCenterServer: "vcenter.vsphere55.test", + Username: "root", + Password: "jetbrains", + InsecureConnection: true, + } + + d, err := NewDriver(config) + if err != nil { + t.Fatal("Cannot connect: ", err) + } + return d +} + +func getVM(t *testing.T, d *Driver, artifacts []packer.Artifact) *object.VirtualMachine { + artifactRaw := artifacts[0] + artifact, _ := artifactRaw.(*Artifact) + + vm, err := d.finder.VirtualMachine(d.ctx, artifact.Name) + if err != nil { + t.Fatalf("Cannot find VM: %v", err) + } + + return vm } -` From efe2c3c8b360fadfc4d2de5b5859da112605e26a Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 23 Aug 2017 21:40:57 +0200 Subject: [PATCH 075/266] Extract vSphere driver into separate package (#35) --- builder_acc_test.go | 37 +++++++++++++++-------------------- driver.go => driver/driver.go | 29 ++++++++++++++++++++++++++- driver/host.go | 26 ++++++++++++++++++++++++ driver/resource_pool.go | 26 ++++++++++++++++++++++++ driver/vm.go | 25 +++++++++++++++++++++++ step_clone.go | 15 +++++++++++--- step_connect.go | 11 +++++++++-- step_hardware.go | 12 ++++++++++-- step_run.go | 5 +++-- step_shutdown.go | 3 ++- step_snapshot.go | 3 ++- step_template.go | 3 ++- 12 files changed, 161 insertions(+), 34 deletions(-) rename driver.go => driver/driver.go (91%) create mode 100644 driver/host.go create mode 100644 driver/resource_pool.go create mode 100644 driver/vm.go diff --git a/builder_acc_test.go b/builder_acc_test.go index 8fc363837..69dacf6a7 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -5,10 +5,10 @@ import ( builderT "github.com/hashicorp/packer/helper/builder/testing" "fmt" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/vim25/mo" "encoding/json" "math/rand" "github.com/vmware/govmomi/object" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) func TestBuilderAcc_default(t *testing.T) { @@ -51,13 +51,12 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc conn := testConn(t) - vm, err := conn.finder.VirtualMachine(conn.ctx, artifact.Name) + vm, err := conn.FindVM(artifact.Name) if err != nil { t.Fatal("Cannot find VM: ", err) } - var vmInfo mo.VirtualMachine - err = vm.Properties(conn.ctx, vm.Reference(), []string{"name", "runtime.host", "resourcePool", "layoutEx.disk"}, &vmInfo) + vmInfo, err := conn.VMInfo(vm, "name", "runtime.host", "resourcePool", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -66,8 +65,8 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) } - var hostInfo mo.HostSystem - err = vm.Properties(conn.ctx, vmInfo.Runtime.Host.Reference(), []string{"name"}, &hostInfo) + h := conn.NewHost(vmInfo.Runtime.Host) + hostInfo, err := conn.HostInfo(h, "name") if err != nil { t.Fatal("Cannot read VM properties: ", err) } @@ -76,13 +75,13 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) } - var rpInfo = mo.ResourcePool{} - err = vm.Properties(conn.ctx, vmInfo.ResourcePool.Reference(), []string{"owner", "parent"}, &rpInfo) + p := conn.NewResourcePool(vmInfo.ResourcePool) + poolInfo, err := conn.ResourcePoolInfo(p, "owner", "parent") if err != nil { t.Fatalf("Cannot read resource pool properties: %v", err) } - if rpInfo.Owner != *rpInfo.Parent { + if poolInfo.Owner != *poolInfo.Parent { t.Error("Not a root resource pool") } @@ -115,13 +114,12 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { conn := testConn(t) - vm, err := conn.finder.VirtualMachine(conn.ctx, artifact.Name) + vm, err := conn.FindVM(artifact.Name) if err != nil { t.Fatalf("Cannot find VM: %v", err) } - var vmInfo mo.VirtualMachine - err = vm.Properties(conn.ctx, vm.Reference(), []string{"layoutEx.disk"}, &vmInfo) + vmInfo, err := conn.VMInfo(vm, "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -154,8 +152,7 @@ func checkTemplate(t *testing.T) builderT.TestCheckFunc { d := testConn(t) vm := getVM(t, d, artifacts) - var vmInfo mo.VirtualMachine - err := vm.Properties(d.ctx, vm.Reference(), []string{"config.template"}, &vmInfo) + vmInfo, err := d.VMInfo(vm, "config.template") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -184,26 +181,24 @@ func renderConfig(config map[string]interface{}) string { return string(j) } -func testConn(t *testing.T) *Driver { - config := &ConnectConfig{ +func testConn(t *testing.T) *driver.Driver { + d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: "vcenter.vsphere55.test", Username: "root", Password: "jetbrains", InsecureConnection: true, - } - - d, err := NewDriver(config) + }) if err != nil { t.Fatal("Cannot connect: ", err) } return d } -func getVM(t *testing.T, d *Driver, artifacts []packer.Artifact) *object.VirtualMachine { +func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *object.VirtualMachine { artifactRaw := artifacts[0] artifact, _ := artifactRaw.(*Artifact) - vm, err := d.finder.VirtualMachine(d.ctx, artifact.Name) + vm, err := d.FindVM(artifact.Name) if err != nil { t.Fatalf("Cannot find VM: %v", err) } diff --git a/driver.go b/driver/driver.go similarity index 91% rename from driver.go rename to driver/driver.go index 93ff4fa15..13718c226 100644 --- a/driver.go +++ b/driver/driver.go @@ -1,4 +1,4 @@ -package main +package driver import ( "github.com/vmware/govmomi" @@ -23,6 +23,33 @@ type Driver struct { datacenter *object.Datacenter } +type ConnectConfig struct { + VCenterServer string + Username string + Password string + InsecureConnection bool + Datacenter string +} + +type CloneConfig struct { + Template string + VMName string + Folder string + Host string + ResourcePool string + Datastore string + LinkedClone bool +} + +type HardwareConfig struct { + CPUs int32 + CPUReservation int64 + CPULimit int64 + RAM int64 + RAMReservation int64 + RAMReserveAll bool +} + func NewDriver(config *ConnectConfig) (*Driver, error) { ctx := context.TODO() diff --git a/driver/host.go b/driver/host.go new file mode 100644 index 000000000..646c76b2d --- /dev/null +++ b/driver/host.go @@ -0,0 +1,26 @@ +package driver + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +func (d *Driver) NewHost(ref *types.ManagedObjectReference) *object.HostSystem { + return object.NewHostSystem(d.client.Client, *ref) +} + +func (d *Driver) HostInfo(host *object.HostSystem, params ...string) (*mo.HostSystem, error){ + var p []string + if len(params) == 0 { + p = []string{"*"} + } else { + p = params + } + var hostInfo mo.HostSystem + err := host.Properties(d.ctx, host.Reference(), p, &hostInfo) + if err != nil { + return nil, err + } + return &hostInfo, nil +} diff --git a/driver/resource_pool.go b/driver/resource_pool.go new file mode 100644 index 000000000..743528900 --- /dev/null +++ b/driver/resource_pool.go @@ -0,0 +1,26 @@ +package driver + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +func (d *Driver) NewResourcePool(ref *types.ManagedObjectReference) *object.ResourcePool { + return object.NewResourcePool(d.client.Client, *ref) +} + +func (d *Driver) ResourcePoolInfo(host *object.ResourcePool, params ...string) (*mo.ResourcePool, error){ + var p []string + if len(params) == 0 { + p = []string{"*"} + } else { + p = params + } + var poolInfo mo.ResourcePool + err := host.Properties(d.ctx, host.Reference(), p, &poolInfo) + if err != nil { + return nil, err + } + return &poolInfo, nil +} diff --git a/driver/vm.go b/driver/vm.go new file mode 100644 index 000000000..1c6196478 --- /dev/null +++ b/driver/vm.go @@ -0,0 +1,25 @@ +package driver + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" +) + +func (d *Driver) FindVM(name string) (*object.VirtualMachine, error) { + return d.finder.VirtualMachine(d.ctx, name) +} + +func (d *Driver) VMInfo(vm *object.VirtualMachine, params ...string) (*mo.VirtualMachine, error){ + var p []string + if len(params) == 0 { + p = []string{"*"} + } else { + p = params + } + var vmInfo mo.VirtualMachine + err := vm.Properties(d.ctx, vm.Reference(), p, &vmInfo) + if err != nil { + return nil, err + } + return &vmInfo, nil +} diff --git a/step_clone.go b/step_clone.go index 195e49859..b9dbc8c45 100644 --- a/step_clone.go +++ b/step_clone.go @@ -5,6 +5,7 @@ import ( "github.com/vmware/govmomi/object" "github.com/hashicorp/packer/packer" "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type CloneConfig struct { @@ -39,11 +40,19 @@ type StepCloneVM struct { func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) ui.Say("Cloning VM...") - vm, err := d.CloneVM(s.config) + vm, err := d.CloneVM(&driver.CloneConfig{ + Template: s.config.Template, + VMName: s.config.VMName, + Folder: s.config.Folder, + Host: s.config.Host, + ResourcePool: s.config.ResourcePool, + Datastore: s.config.Datastore, + LinkedClone: s.config.LinkedClone, + }) if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -62,7 +71,7 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { if vm, ok := state.GetOk("vm"); ok { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) ui.Say("Destroying VM...") diff --git a/step_connect.go b/step_connect.go index 0657fd5ed..57bce17ba 100644 --- a/step_connect.go +++ b/step_connect.go @@ -3,6 +3,7 @@ package main import ( "github.com/mitchellh/multistep" "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type ConnectConfig struct { @@ -34,12 +35,18 @@ type StepConnect struct { } func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { - driver, err := NewDriver(s.config) + d, err := driver.NewDriver(&driver.ConnectConfig{ + VCenterServer: s.config.VCenterServer, + Username: s.config.Username, + Password: s.config.Password, + InsecureConnection: s.config.InsecureConnection, + Datacenter: s.config.Datacenter, + }) if err != nil { state.Put("error", err) return multistep.ActionHalt } - state.Put("driver", driver) + state.Put("driver", d) return multistep.ActionContinue } diff --git a/step_hardware.go b/step_hardware.go index 4c1e95a39..33045eda1 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type HardwareConfig struct { @@ -32,13 +33,20 @@ type StepConfigureHardware struct { func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) vm := state.Get("vm").(*object.VirtualMachine) if *s.config != (HardwareConfig{}) { ui.Say("Customizing hardware parameters...") - err := d.ConfigureVM(vm, s.config) + err := d.ConfigureVM(vm, &driver.HardwareConfig{ + CPUs: s.config.CPUs, + CPUReservation: s.config.CPUReservation, + CPULimit: s.config.CPULimit, + RAM: s.config.RAM, + RAMReservation: s.config.RAMReservation, + RAMReserveAll: s.config.RAMReserveAll, + }) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_run.go b/step_run.go index 4d68b0d2b..353f3df00 100644 --- a/step_run.go +++ b/step_run.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type StepRun struct { @@ -12,7 +13,7 @@ type StepRun struct { func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) vm := state.Get("vm").(*object.VirtualMachine) ui.Say("Power on VM...") @@ -42,7 +43,7 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { } ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) vm := state.Get("vm").(*object.VirtualMachine) ui.Say("Power off VM...") diff --git a/step_shutdown.go b/step_shutdown.go index 2b2e4c1a8..dc8539a13 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -8,6 +8,7 @@ import ( "log" "time" "bytes" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type ShutdownConfig struct { @@ -40,7 +41,7 @@ type StepShutdown struct { func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) comm := state.Get("communicator").(packer.Communicator) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) vm := state.Get("vm").(*object.VirtualMachine) if s.config.Command != "" { diff --git a/step_snapshot.go b/step_snapshot.go index 740d98728..ad9965445 100644 --- a/step_snapshot.go +++ b/step_snapshot.go @@ -4,6 +4,7 @@ import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type StepCreateSnapshot struct{ @@ -12,7 +13,7 @@ type StepCreateSnapshot struct{ func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) vm := state.Get("vm").(*object.VirtualMachine) if s.createSnapshot { diff --git a/step_template.go b/step_template.go index 1b3767015..2b3d42a6b 100644 --- a/step_template.go +++ b/step_template.go @@ -4,6 +4,7 @@ import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/object" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type StepConvertToTemplate struct{ @@ -12,7 +13,7 @@ type StepConvertToTemplate struct{ func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*Driver) + d := state.Get("driver").(*driver.Driver) vm := state.Get("vm").(*object.VirtualMachine) if s.ConvertToTemplate { From c73f2698227f78060c2ecf0fe7b87d15682580dd Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 23 Aug 2017 23:15:19 +0300 Subject: [PATCH 076/266] test for 'create_snapshot' --- builder_acc_test.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 69dacf6a7..4149fcf00 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -68,7 +68,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc h := conn.NewHost(vmInfo.Runtime.Host) hostInfo, err := conn.HostInfo(h, "name") if err != nil { - t.Fatal("Cannot read VM properties: ", err) + t.Fatal("Cannot read host properties: ", err) } if hostInfo.Name != host { @@ -132,6 +132,39 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { } } +func TestBuilderAcc_snapshot(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: snapshotConfig(), + Check: checkSnapshot(t), + }) +} + +func snapshotConfig() string { + config := defaultConfig() + config["create_snapshot"] = true + return renderConfig(config) +} + +func checkSnapshot(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + vmInfo, err := d.VMInfo(vm, "layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + layers := len(vmInfo.LayoutEx.Disk[0].Chain) + if layers != 2 { + t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) + } + + return nil + } +} + func TestBuilderAcc_template(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, From 6c885f199476ebbec6c92bbaccddf5975a9ca295 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 23 Aug 2017 23:32:45 +0300 Subject: [PATCH 077/266] tests: extract artifact check into separate test --- builder_acc_test.go | 66 ++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 4149fcf00..270524d04 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -39,24 +39,10 @@ func defaultConfig() map[string]interface{} { func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - if len(artifacts) > 1 { - t.Fatal("more than 1 artifact") - } + d := testConn(t) + vm := getVM(t, d, artifacts) - artifactRaw := artifacts[0] - artifact, ok := artifactRaw.(*Artifact) - if !ok { - t.Fatalf("unknown artifact: %#v", artifactRaw) - } - - conn := testConn(t) - - vm, err := conn.FindVM(artifact.Name) - if err != nil { - t.Fatal("Cannot find VM: ", err) - } - - vmInfo, err := conn.VMInfo(vm, "name", "runtime.host", "resourcePool", "layoutEx.disk") + vmInfo, err := d.VMInfo(vm, "name", "runtime.host", "resourcePool", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -65,8 +51,8 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) } - h := conn.NewHost(vmInfo.Runtime.Host) - hostInfo, err := conn.HostInfo(h, "name") + h := d.NewHost(vmInfo.Runtime.Host) + hostInfo, err := d.HostInfo(h, "name") if err != nil { t.Fatal("Cannot read host properties: ", err) } @@ -75,8 +61,8 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) } - p := conn.NewResourcePool(vmInfo.ResourcePool) - poolInfo, err := conn.ResourcePoolInfo(p, "owner", "parent") + p := d.NewResourcePool(vmInfo.ResourcePool) + poolInfo, err := d.ResourcePoolInfo(p, "owner", "parent") if err != nil { t.Fatalf("Cannot read resource pool properties: %v", err) } @@ -93,6 +79,31 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc } } +func TestBuilderAcc_artifact(t *testing.T) { + config := defaultConfig() + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: renderConfig(config), + Check: checkArtifact(t), + }) +} + +func checkArtifact(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + if len(artifacts) > 1 { + t.Fatal("more than 1 artifact") + } + + artifactRaw := artifacts[0] + _, ok := artifactRaw.(*Artifact) + if !ok { + t.Fatalf("unknown artifact: %#v", artifactRaw) + } + + return nil + } +} + func TestBuilderAcc_linkedClone(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -109,17 +120,10 @@ func linkedCloneConfig() string { func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - artifactRaw := artifacts[0] - artifact, _ := artifactRaw.(*Artifact) + d := testConn(t) + vm := getVM(t, d, artifacts) - conn := testConn(t) - - vm, err := conn.FindVM(artifact.Name) - if err != nil { - t.Fatalf("Cannot find VM: %v", err) - } - - vmInfo, err := conn.VMInfo(vm, "layoutEx.disk") + vmInfo, err := d.VMInfo(vm, "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } From 2c184abdef499ab2240973fcc14740ef1e168a0a Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 00:23:29 +0300 Subject: [PATCH 078/266] test for folder --- builder_acc_test.go | 40 +++++++++++++++++++++++++++++++++++++++- driver/folder.go | 14 ++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 driver/folder.go diff --git a/builder_acc_test.go b/builder_acc_test.go index 270524d04..24bc57dfa 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -104,6 +104,44 @@ func checkArtifact(t *testing.T) builderT.TestCheckFunc { } } +func TestBuilderAcc_folder(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: folderConfig(), + Check: checkFolder(t, "folder1"), + }) +} + +func folderConfig() string { + config := defaultConfig() + config["folder"] = "folder1" + config["linked_clone"] = true // speed up + return renderConfig(config) +} + +func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + vm := getVM(t, d, artifacts) + + vmInfo, err := d.VMInfo(vm, "parent") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + f := d.NewFolder(vmInfo.Parent) + path, err := d.GetFolderPath(f) + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if path != folder { + t.Errorf("Wrong folder. expected: %v, got: %v", folder, path) + } + + return nil + } +} + func TestBuilderAcc_linkedClone(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -179,8 +217,8 @@ func TestBuilderAcc_template(t *testing.T) { func templateConfig() string { config := defaultConfig() - config["linked_clone"] = true config["convert_to_template"] = true + config["linked_clone"] = true // speed up return renderConfig(config) } diff --git a/driver/folder.go b/driver/folder.go new file mode 100644 index 000000000..23b9d56d6 --- /dev/null +++ b/driver/folder.go @@ -0,0 +1,14 @@ +package driver + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/types" +) + +func (d *Driver) NewFolder(ref *types.ManagedObjectReference) *object.Folder { + return object.NewFolder(d.client.Client, *ref) +} + +func (d *Driver) GetFolderPath(folder *object.Folder) (string, error) { + return folder.ObjectName(d.ctx) +} From c335dc101576763d271c3601fc30e1ec0d745a39 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 00:54:23 +0300 Subject: [PATCH 079/266] test for subfolders --- builder_acc_test.go | 4 ++-- driver/folder.go | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 24bc57dfa..9d1cf7afc 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -108,13 +108,13 @@ func TestBuilderAcc_folder(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: folderConfig(), - Check: checkFolder(t, "folder1"), + Check: checkFolder(t, "folder1/folder2"), }) } func folderConfig() string { config := defaultConfig() - config["folder"] = "folder1" + config["folder"] = "folder1/folder2" config["linked_clone"] = true // speed up return renderConfig(config) } diff --git a/driver/folder.go b/driver/folder.go index 23b9d56d6..5c90ed4ba 100644 --- a/driver/folder.go +++ b/driver/folder.go @@ -3,12 +3,46 @@ package driver import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/mo" + "fmt" ) func (d *Driver) NewFolder(ref *types.ManagedObjectReference) *object.Folder { return object.NewFolder(d.client.Client, *ref) } -func (d *Driver) GetFolderPath(folder *object.Folder) (string, error) { - return folder.ObjectName(d.ctx) +func (d *Driver) FolderInfo(folder *object.Folder, params ...string) (*mo.Folder, error) { + var p []string + if len(params) == 0 { + p = []string{"*"} + } else { + p = params + } + var folderInfo mo.Folder + err := folder.Properties(d.ctx, folder.Reference(), p, &folderInfo) + if err != nil { + return nil, err + } + return &folderInfo, nil +} + +func (d *Driver) GetFolderPath(folder *object.Folder) (string, error) { + f, err := d.FolderInfo(folder, "name", "parent") + if err != nil { + return "", err + } + if f.Parent.Type == "Datacenter" { + return "", nil + } else { + parent := d.NewFolder(f.Parent) + parentPath, err := d.GetFolderPath(parent) + if err != nil { + return "", err + } + if parentPath == "" { + return f.Name, nil + } else { + return fmt.Sprintf("%v/%v", parentPath, f.Name), nil + } + } } From 3acf445d988b44a4399d004b80bf4a555c114bbb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 01:23:48 +0300 Subject: [PATCH 080/266] test for resource pool --- builder_acc_test.go | 38 ++++++++++++++++++++++++++++++++++++++ driver/resource_pool.go | 22 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/builder_acc_test.go b/builder_acc_test.go index 9d1cf7afc..691463de9 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -142,6 +142,44 @@ func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { } } +func TestBuilderAcc_resourcePool(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: resourcePoolConfig(), + Check: checkResourcePool(t, "pool1/pool2"), + }) +} + +func resourcePoolConfig() string { + config := defaultConfig() + config["resource_pool"] = "pool1/pool2" + config["linked_clone"] = true // speed up + return renderConfig(config) +} + +func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + vm := getVM(t, d, artifacts) + + vmInfo, err := d.VMInfo(vm, "resourcePool") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + p := d.NewResourcePool(vmInfo.ResourcePool) + path, err := d.GetResourcePoolPath(p) + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if path != pool { + t.Errorf("Wrong folder. expected: %v, got: %v", pool, path) + } + + return nil + } +} + func TestBuilderAcc_linkedClone(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/driver/resource_pool.go b/driver/resource_pool.go index 743528900..c5f89921f 100644 --- a/driver/resource_pool.go +++ b/driver/resource_pool.go @@ -4,6 +4,7 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" + "fmt" ) func (d *Driver) NewResourcePool(ref *types.ManagedObjectReference) *object.ResourcePool { @@ -24,3 +25,24 @@ func (d *Driver) ResourcePoolInfo(host *object.ResourcePool, params ...string) ( } return &poolInfo, nil } + +func (d *Driver) GetResourcePoolPath(pool *object.ResourcePool) (string, error) { + f, err := d.ResourcePoolInfo(pool, "name", "parent") + if err != nil { + return "", err + } + if f.Parent.Type == "ComputeResource" { + return "", nil + } else { + parent := d.NewResourcePool(f.Parent) + parentPath, err := d.GetResourcePoolPath(parent) + if err != nil { + return "", err + } + if parentPath == "" { + return f.Name, nil + } else { + return fmt.Sprintf("%v/%v", parentPath, f.Name), nil + } + } +} From 1bf942a2c243f5108fe771752c14e33e9fb7ca2d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 01:39:14 +0300 Subject: [PATCH 081/266] check folder in default test --- builder_acc_test.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 691463de9..6e53f5cf0 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -42,7 +42,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "name", "runtime.host", "resourcePool", "layoutEx.disk") + vmInfo, err := d.VMInfo(vm, "name", "parent", "runtime.host", "resourcePool", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -51,6 +51,15 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) } + f := d.NewFolder(vmInfo.Parent) + folderPath, err := d.GetFolderPath(f) + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + h := d.NewHost(vmInfo.Runtime.Host) hostInfo, err := d.HostInfo(h, "name") if err != nil { @@ -62,13 +71,12 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc } p := d.NewResourcePool(vmInfo.ResourcePool) - poolInfo, err := d.ResourcePoolInfo(p, "owner", "parent") + poolPath, err := d.GetResourcePoolPath(p) if err != nil { - t.Fatalf("Cannot read resource pool properties: %v", err) + t.Fatalf("Cannot read resource pool name: %v", err) } - - if poolInfo.Owner != *poolInfo.Parent { - t.Error("Not a root resource pool") + if poolPath != "" { + t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) } if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { From 8d75c273a93798614ac3df39da27e7658c30832f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 14:03:49 +0300 Subject: [PATCH 082/266] Add Mozilla Public License 2.0 - the same as in Packer itself --- LICENSE.txt | 373 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 000000000..14e2f777f --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. From e8d8fd62058f627c07677a8a95561d0ee816e2e6 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 03:06:50 +0300 Subject: [PATCH 083/266] Refactor vSphere driver --- artifact.go | 11 +- builder.go | 4 +- builder_acc_test.go | 25 +++-- driver/datastore.go | 21 ++++ driver/driver.go | 193 ----------------------------------- driver/folder.go | 47 ++++++--- driver/host.go | 22 ++-- driver/resource_pool.go | 57 +++++++---- driver/vm.go | 218 ++++++++++++++++++++++++++++++++++++++-- step_clone.go | 26 ++--- step_hardware.go | 6 +- step_run.go | 15 ++- step_shutdown.go | 8 +- step_snapshot.go | 6 +- step_template.go | 6 +- 15 files changed, 367 insertions(+), 298 deletions(-) create mode 100644 driver/datastore.go diff --git a/artifact.go b/artifact.go index 8b71c55cd..ec5842b3b 100644 --- a/artifact.go +++ b/artifact.go @@ -1,15 +1,14 @@ package main import ( - "github.com/vmware/govmomi/object" - "context" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) const BuilderId = "jetbrains.vsphere" type Artifact struct { Name string - VM *object.VirtualMachine + VM *driver.VirtualMachine } func (a *Artifact) BuilderId() string { @@ -33,11 +32,9 @@ func (a *Artifact) State(name string) interface{} { } func (a *Artifact) Destroy() error { - ctx := context.TODO() - task, err := a.VM.Destroy(ctx) + err := a.VM.Destroy() if err != nil { return err } - _, err = task.WaitForResult(ctx, nil) - return err + return nil } diff --git a/builder.go b/builder.go index adb8d6dc2..579c2b9c9 100644 --- a/builder.go +++ b/builder.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" gossh "golang.org/x/crypto/ssh" "github.com/hashicorp/packer/communicator/ssh" - "github.com/vmware/govmomi/object" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type Builder struct { @@ -93,7 +93,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe artifact := &Artifact{ Name: b.config.VMName, - VM: state.Get("vm").(*object.VirtualMachine), + VM: state.Get("vm").(*driver.VirtualMachine), } return artifact, nil } diff --git a/builder_acc_test.go b/builder_acc_test.go index 6e53f5cf0..99f15ce3a 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/packer/packer" "encoding/json" "math/rand" - "github.com/vmware/govmomi/object" "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) @@ -42,7 +41,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "name", "parent", "runtime.host", "resourcePool", "layoutEx.disk") + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -52,7 +51,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc } f := d.NewFolder(vmInfo.Parent) - folderPath, err := d.GetFolderPath(f) + folderPath, err := f.Path() if err != nil { t.Fatalf("Cannot read folder name: %v", err) } @@ -61,7 +60,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc } h := d.NewHost(vmInfo.Runtime.Host) - hostInfo, err := d.HostInfo(h, "name") + hostInfo, err := h.Info("name") if err != nil { t.Fatal("Cannot read host properties: ", err) } @@ -71,7 +70,7 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc } p := d.NewResourcePool(vmInfo.ResourcePool) - poolPath, err := d.GetResourcePoolPath(p) + poolPath, err := p.Path() if err != nil { t.Fatalf("Cannot read resource pool name: %v", err) } @@ -132,13 +131,13 @@ func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "parent") + vmInfo, err := vm.Info("parent") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } f := d.NewFolder(vmInfo.Parent) - path, err := d.GetFolderPath(f) + path, err := f.Path() if err != nil { t.Fatalf("Cannot read folder name: %v", err) } @@ -170,13 +169,13 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "resourcePool") + vmInfo, err := vm.Info("resourcePool") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } p := d.NewResourcePool(vmInfo.ResourcePool) - path, err := d.GetResourcePoolPath(p) + path, err := p.Path() if err != nil { t.Fatalf("Cannot read resource pool name: %v", err) } @@ -207,7 +206,7 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "layoutEx.disk") + vmInfo, err := vm.Info("layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -239,7 +238,7 @@ func checkSnapshot(t *testing.T) builderT.TestCheckFunc { d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "layoutEx.disk") + vmInfo, err := vm.Info("layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -273,7 +272,7 @@ func checkTemplate(t *testing.T) builderT.TestCheckFunc { d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := d.VMInfo(vm, "config.template") + vmInfo, err := vm.Info("config.template") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -315,7 +314,7 @@ func testConn(t *testing.T) *driver.Driver { return d } -func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *object.VirtualMachine { +func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.VirtualMachine { artifactRaw := artifacts[0] artifact, _ := artifactRaw.(*Artifact) diff --git a/driver/datastore.go b/driver/datastore.go new file mode 100644 index 000000000..5e6e408cb --- /dev/null +++ b/driver/datastore.go @@ -0,0 +1,21 @@ +package driver + +import ( + "github.com/vmware/govmomi/object" +) + +type Datastore struct { + ds *object.Datastore + driver *Driver +} + +func (d *Driver) FindDatastore(name string) (*Datastore, error) { + ds, err := d.finder.Datastore(d.ctx, name) + if err != nil { + return nil, err + } + return &Datastore{ + ds: ds, + driver: d, + }, nil +} diff --git a/driver/driver.go b/driver/driver.go index 13718c226..30ddcce72 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -7,9 +7,6 @@ import ( "net/url" "fmt" "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/mo" - "errors" "time" "github.com/vmware/govmomi/session" "github.com/vmware/govmomi/vim25/soap" @@ -31,25 +28,6 @@ type ConnectConfig struct { Datacenter string } -type CloneConfig struct { - Template string - VMName string - Folder string - Host string - ResourcePool string - Datastore string - LinkedClone bool -} - -type HardwareConfig struct { - CPUs int32 - CPUReservation int64 - CPULimit int64 - RAM int64 - RAMReservation int64 - RAMReserveAll bool -} - func NewDriver(config *ConnectConfig) (*Driver, error) { ctx := context.TODO() @@ -92,174 +70,3 @@ func NewDriver(config *ConnectConfig) (*Driver, error) { } return &d, nil } - -func (d *Driver) CloneVM(config *CloneConfig) (*object.VirtualMachine, error) { - template, err := d.finder.VirtualMachine(d.ctx, config.Template) - if err != nil { - return nil, err - } - - folder, err := d.finder.FolderOrDefault(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), config.Folder)) - if err != nil { - return nil, err - } - - var relocateSpec types.VirtualMachineRelocateSpec - - pool, err := d.finder.ResourcePoolOrDefault(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), config.Host, config.ResourcePool)) - if err != nil { - return nil, err - } - poolRef := pool.Reference() - relocateSpec.Pool = &poolRef - - if config.Datastore != "" { - datastore, err := d.finder.Datastore(d.ctx, config.Datastore) - if err != nil { - return nil, err - } - datastoreRef := datastore.Reference() - relocateSpec.Datastore = &datastoreRef - } - - var cloneSpec types.VirtualMachineCloneSpec - cloneSpec.Location = relocateSpec - cloneSpec.PowerOn = false - - if config.LinkedClone == true { - cloneSpec.Location.DiskMoveType = "createNewChildDiskBacking" - - var tpl mo.VirtualMachine - err = template.Properties(d.ctx, template.Reference(), []string{"snapshot"}, &tpl) - if err != nil { - return nil, err - } - if tpl.Snapshot == nil { - err = errors.New("`linked_clone=true`, but template has no snapshots") - return nil, err - } - cloneSpec.Snapshot = tpl.Snapshot.CurrentSnapshot - } - - task, err := template.Clone(d.ctx, folder, config.VMName, cloneSpec) - if err != nil { - return nil, err - } - - info, err := task.WaitForResult(d.ctx, nil) - if err != nil { - return nil, err - } - - vm := object.NewVirtualMachine(d.client.Client, info.Result.(types.ManagedObjectReference)) - return vm, nil -} - -func (d *Driver) DestroyVM(vm *object.VirtualMachine) error { - task, err := vm.Destroy(d.ctx) - if err != nil { - return err - } - _, err = task.WaitForResult(d.ctx, nil) - return err -} - -func (d *Driver) ConfigureVM(vm *object.VirtualMachine, config *HardwareConfig) error { - var confSpec types.VirtualMachineConfigSpec - confSpec.NumCPUs = config.CPUs - confSpec.MemoryMB = config.RAM - - var cpuSpec types.ResourceAllocationInfo - cpuSpec.Reservation = config.CPUReservation - cpuSpec.Limit = config.CPULimit - confSpec.CpuAllocation = &cpuSpec - - var ramSpec types.ResourceAllocationInfo - ramSpec.Reservation = config.RAMReservation - confSpec.MemoryAllocation = &ramSpec - - confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll - - task, err := vm.Reconfigure(d.ctx, confSpec) - if err != nil { - return err - } - _, err = task.WaitForResult(d.ctx, nil) - return err -} - -func (d *Driver) PowerOn(vm *object.VirtualMachine) error { - task, err := vm.PowerOn(d.ctx) - if err != nil { - return err - } - _, err = task.WaitForResult(d.ctx, nil) - return err -} - -func (d *Driver) WaitForIP(vm *object.VirtualMachine) (string, error) { - ip, err := vm.WaitForIP(d.ctx) - if err != nil { - return "", err - } - return ip, nil -} - -func (d *Driver) PowerOff(vm *object.VirtualMachine) error { - state, err := vm.PowerState(d.ctx) - if err != nil { - return err - } - - if state == types.VirtualMachinePowerStatePoweredOff { - return nil - } - - task, err := vm.PowerOff(d.ctx) - if err != nil { - return err - } - _, err = task.WaitForResult(d.ctx, nil) - return err -} - -func (d *Driver) StartShutdown(vm *object.VirtualMachine) error { - err := vm.ShutdownGuest(d.ctx) - return err -} - -func (d *Driver) WaitForShutdown(vm *object.VirtualMachine, timeout time.Duration) error { - shutdownTimer := time.After(timeout) - for { - powerState, err := vm.PowerState(d.ctx) - if err != nil { - return err - } - if powerState == "poweredOff" { - break - } - - select { - case <-shutdownTimer: - err := errors.New("Timeout while waiting for machine to shut down.") - return err - default: - time.Sleep(1 * time.Second) - } - } - return nil -} - -func (d *Driver) CreateSnapshot(vm *object.VirtualMachine) error { - task, err := vm.CreateSnapshot(d.ctx, "Created by Packer", "", false, false) - if err != nil { - return err - } - _, err = task.WaitForResult(d.ctx, nil) - return err -} - -func (d *Driver) ConvertToTemplate(vm *object.VirtualMachine) error { - err := vm.MarkAsTemplate(d.ctx) - return err -} diff --git a/driver/folder.go b/driver/folder.go index 5c90ed4ba..5af053007 100644 --- a/driver/folder.go +++ b/driver/folder.go @@ -7,42 +7,61 @@ import ( "fmt" ) -func (d *Driver) NewFolder(ref *types.ManagedObjectReference) *object.Folder { - return object.NewFolder(d.client.Client, *ref) +type Folder struct { + driver *Driver + folder *object.Folder } -func (d *Driver) FolderInfo(folder *object.Folder, params ...string) (*mo.Folder, error) { +func (d *Driver) NewFolder(ref *types.ManagedObjectReference) *Folder { + return &Folder{ + folder: object.NewFolder(d.client.Client, *ref), + driver: d, + } +} + +func (d *Driver) FindFolder(name string) (*Folder, error) { + f, err := d.finder.Folder(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), name)) + if err != nil { + return nil, err + } + return &Folder{ + folder: f, + driver: d, + }, nil +} + +func (f *Folder) Info(params ...string) (*mo.Folder, error) { var p []string if len(params) == 0 { p = []string{"*"} } else { p = params } - var folderInfo mo.Folder - err := folder.Properties(d.ctx, folder.Reference(), p, &folderInfo) + var info mo.Folder + err := f.folder.Properties(f.driver.ctx, f.folder.Reference(), p, &info) if err != nil { return nil, err } - return &folderInfo, nil + return &info, nil } -func (d *Driver) GetFolderPath(folder *object.Folder) (string, error) { - f, err := d.FolderInfo(folder, "name", "parent") +func (f *Folder) Path() (string, error) { + info, err := f.Info("name", "parent") if err != nil { return "", err } - if f.Parent.Type == "Datacenter" { + if info.Parent.Type == "Datacenter" { return "", nil } else { - parent := d.NewFolder(f.Parent) - parentPath, err := d.GetFolderPath(parent) + parent := f.driver.NewFolder(info.Parent) + path, err := parent.Path() if err != nil { return "", err } - if parentPath == "" { - return f.Name, nil + if path == "" { + return info.Name, nil } else { - return fmt.Sprintf("%v/%v", parentPath, f.Name), nil + return fmt.Sprintf("%v/%v", path, info.Name), nil } } } diff --git a/driver/host.go b/driver/host.go index 646c76b2d..084d9d3b2 100644 --- a/driver/host.go +++ b/driver/host.go @@ -2,25 +2,33 @@ package driver import ( "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/mo" ) -func (d *Driver) NewHost(ref *types.ManagedObjectReference) *object.HostSystem { - return object.NewHostSystem(d.client.Client, *ref) +type Host struct { + driver *Driver + host *object.HostSystem } -func (d *Driver) HostInfo(host *object.HostSystem, params ...string) (*mo.HostSystem, error){ +func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host { + return &Host{ + host: object.NewHostSystem(d.client.Client, *ref), + driver: d, + } +} + +func (h *Host) Info(params ...string) (*mo.HostSystem, error){ var p []string if len(params) == 0 { p = []string{"*"} } else { p = params } - var hostInfo mo.HostSystem - err := host.Properties(d.ctx, host.Reference(), p, &hostInfo) + var info mo.HostSystem + err := h.host.Properties(h.driver.ctx, h.host.Reference(), p, &info) if err != nil { return nil, err } - return &hostInfo, nil + return &info, nil } diff --git a/driver/resource_pool.go b/driver/resource_pool.go index c5f89921f..48553f661 100644 --- a/driver/resource_pool.go +++ b/driver/resource_pool.go @@ -2,47 +2,66 @@ package driver import ( "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/mo" "fmt" ) -func (d *Driver) NewResourcePool(ref *types.ManagedObjectReference) *object.ResourcePool { - return object.NewResourcePool(d.client.Client, *ref) +type ResourcePool struct { + pool *object.ResourcePool + driver *Driver } -func (d *Driver) ResourcePoolInfo(host *object.ResourcePool, params ...string) (*mo.ResourcePool, error){ - var p []string - if len(params) == 0 { - p = []string{"*"} - } else { - p = params +func (d *Driver) NewResourcePool(ref *types.ManagedObjectReference) *ResourcePool { + return &ResourcePool{ + pool: object.NewResourcePool(d.client.Client, *ref), + driver: d, } - var poolInfo mo.ResourcePool - err := host.Properties(d.ctx, host.Reference(), p, &poolInfo) +} + +func (d *Driver) FindResourcePool(host string, name string) (*ResourcePool, error) { + p, err := d.finder.ResourcePool(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), host, name)) if err != nil { return nil, err } - return &poolInfo, nil + return &ResourcePool{ + pool: p, + driver: d, + }, nil } -func (d *Driver) GetResourcePoolPath(pool *object.ResourcePool) (string, error) { - f, err := d.ResourcePoolInfo(pool, "name", "parent") +func (p *ResourcePool) Info(params ...string) (*mo.ResourcePool, error) { + var params2 []string + if len(params) == 0 { + params2 = []string{"*"} + } else { + params2 = params + } + var info mo.ResourcePool + err := p.pool.Properties(p.driver.ctx, p.pool.Reference(), params2, &info) + if err != nil { + return nil, err + } + return &info, nil +} + +func (p *ResourcePool) Path() (string, error) { + poolInfo, err := p.Info("name", "parent") if err != nil { return "", err } - if f.Parent.Type == "ComputeResource" { + if poolInfo.Parent.Type == "ComputeResource" { return "", nil } else { - parent := d.NewResourcePool(f.Parent) - parentPath, err := d.GetResourcePoolPath(parent) + parent := p.driver.NewResourcePool(poolInfo.Parent) + parentPath, err := parent.Path() if err != nil { return "", err } if parentPath == "" { - return f.Name, nil + return poolInfo.Name, nil } else { - return fmt.Sprintf("%v/%v", parentPath, f.Name), nil + return fmt.Sprintf("%v/%v", parentPath, poolInfo.Name), nil } } } diff --git a/driver/vm.go b/driver/vm.go index 1c6196478..83c7d7d55 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -3,23 +3,229 @@ package driver import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" + "errors" + "time" ) -func (d *Driver) FindVM(name string) (*object.VirtualMachine, error) { - return d.finder.VirtualMachine(d.ctx, name) +type VirtualMachine struct { + vm *object.VirtualMachine + driver *Driver } -func (d *Driver) VMInfo(vm *object.VirtualMachine, params ...string) (*mo.VirtualMachine, error){ +type CloneConfig struct { + Name string + Folder string + Host string + ResourcePool string + Datastore string + LinkedClone bool +} + +type HardwareConfig struct { + CPUs int32 + CPUReservation int64 + CPULimit int64 + RAM int64 + RAMReservation int64 + RAMReserveAll bool +} + +func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { + return &VirtualMachine{ + vm: object.NewVirtualMachine(d.client.Client, *ref), + driver: d, + } +} + +func (d *Driver) FindVM(name string) (*VirtualMachine, error) { + vm, err := d.finder.VirtualMachine(d.ctx, name) + if err != nil { + return nil, err + } + return &VirtualMachine{ + vm: vm, + driver: d, + }, nil +} + +func (vm *VirtualMachine) Info(params ...string) (*mo.VirtualMachine, error) { var p []string if len(params) == 0 { p = []string{"*"} } else { p = params } - var vmInfo mo.VirtualMachine - err := vm.Properties(d.ctx, vm.Reference(), p, &vmInfo) + var info mo.VirtualMachine + err := vm.vm.Properties(vm.driver.ctx, vm.vm.Reference(), p, &info) if err != nil { return nil, err } - return &vmInfo, nil + return &info, nil +} + +func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, error) { + folder, err := template.driver.FindFolder(config.Folder) + if err != nil { + return nil, err + } + + var relocateSpec types.VirtualMachineRelocateSpec + + pool, err := template.driver.FindResourcePool(config.Host, config.ResourcePool) + if err != nil { + return nil, err + } + poolRef := pool.pool.Reference() + relocateSpec.Pool = &poolRef + + if config.Datastore != "" { + datastore, err := template.driver.FindDatastore(config.Datastore) + if err != nil { + return nil, err + } + datastoreRef := datastore.ds.Reference() + relocateSpec.Datastore = &datastoreRef + } + + var cloneSpec types.VirtualMachineCloneSpec + cloneSpec.Location = relocateSpec + cloneSpec.PowerOn = false + + if config.LinkedClone == true { + cloneSpec.Location.DiskMoveType = "createNewChildDiskBacking" + + tpl, err := template.Info("snapshot") + if err != nil { + return nil, err + } + if tpl.Snapshot == nil { + err = errors.New("`linked_clone=true`, but template has no snapshots") + return nil, err + } + cloneSpec.Snapshot = tpl.Snapshot.CurrentSnapshot + } + + task, err := template.vm.Clone(template.driver.ctx, folder.folder, config.Name, cloneSpec) + if err != nil { + return nil, err + } + + info, err := task.WaitForResult(template.driver.ctx, nil) + if err != nil { + return nil, err + } + + ref := info.Result.(types.ManagedObjectReference) + vm := template.driver.NewVM(&ref) + return vm, nil +} + +func (vm *VirtualMachine) Destroy() error { + task, err := vm.vm.Destroy(vm.driver.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func (vm *VirtualMachine) Configure(config *HardwareConfig) error { + var confSpec types.VirtualMachineConfigSpec + confSpec.NumCPUs = config.CPUs + confSpec.MemoryMB = config.RAM + + var cpuSpec types.ResourceAllocationInfo + cpuSpec.Reservation = config.CPUReservation + cpuSpec.Limit = config.CPULimit + confSpec.CpuAllocation = &cpuSpec + + var ramSpec types.ResourceAllocationInfo + ramSpec.Reservation = config.RAMReservation + confSpec.MemoryAllocation = &ramSpec + + confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll + + task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) + if err != nil { + return err + } + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func (vm *VirtualMachine) PowerOn() error { + task, err := vm.vm.PowerOn(vm.driver.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func (vm *VirtualMachine) WaitForIP() (string, error) { + ip, err := vm.vm.WaitForIP(vm.driver.ctx) + if err != nil { + return "", err + } + return ip, nil +} + +func (vm *VirtualMachine) PowerOff() error { + state, err := vm.vm.PowerState(vm.driver.ctx) + if err != nil { + return err + } + + if state == types.VirtualMachinePowerStatePoweredOff { + return nil + } + + task, err := vm.vm.PowerOff(vm.driver.ctx) + if err != nil { + return err + } + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func (vm *VirtualMachine) StartShutdown() error { + err := vm.vm.ShutdownGuest(vm.driver.ctx) + return err +} + +func (vm *VirtualMachine) WaitForShutdown(timeout time.Duration) error { + shutdownTimer := time.After(timeout) + for { + powerState, err := vm.vm.PowerState(vm.driver.ctx) + if err != nil { + return err + } + if powerState == "poweredOff" { + break + } + + select { + case <-shutdownTimer: + err := errors.New("Timeout while waiting for machine to shut down.") + return err + default: + time.Sleep(1 * time.Second) + } + } + return nil +} + +func (vm *VirtualMachine) CreateSnapshot(name string) error { + task, err := vm.vm.CreateSnapshot(vm.driver.ctx, name, "", false, false) + if err != nil { + return err + } + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func (vm *VirtualMachine) ConvertToTemplate() error { + err := vm.vm.MarkAsTemplate(vm.driver.ctx) + return err } diff --git a/step_clone.go b/step_clone.go index b9dbc8c45..cd27ace68 100644 --- a/step_clone.go +++ b/step_clone.go @@ -2,7 +2,6 @@ package main import ( "github.com/mitchellh/multistep" - "github.com/vmware/govmomi/object" "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" @@ -44,9 +43,14 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Cloning VM...") - vm, err := d.CloneVM(&driver.CloneConfig{ - Template: s.config.Template, - VMName: s.config.VMName, + template, err := d.FindVM(s.config.Template) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + vm, err := template.Clone(&driver.CloneConfig{ + Name: s.config.VMName, Folder: s.config.Folder, Host: s.config.Host, ResourcePool: s.config.ResourcePool, @@ -69,15 +73,13 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { return } - if vm, ok := state.GetOk("vm"); ok { - ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*driver.Driver) + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Destroying VM...") + ui.Say("Destroying VM...") - err := d.DestroyVM(vm.(*object.VirtualMachine)) - if err != nil { - ui.Error(err.Error()) - } + err := vm.Destroy() + if err != nil { + ui.Error(err.Error()) } } diff --git a/step_hardware.go b/step_hardware.go index 33045eda1..f62651045 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/object" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) @@ -33,13 +32,12 @@ type StepConfigureHardware struct { func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*driver.Driver) - vm := state.Get("vm").(*object.VirtualMachine) + vm := state.Get("vm").(*driver.VirtualMachine) if *s.config != (HardwareConfig{}) { ui.Say("Customizing hardware parameters...") - err := d.ConfigureVM(vm, &driver.HardwareConfig{ + err := vm.Configure(&driver.HardwareConfig{ CPUs: s.config.CPUs, CPUReservation: s.config.CPUReservation, CPULimit: s.config.CPULimit, diff --git a/step_run.go b/step_run.go index 353f3df00..5fc98fec5 100644 --- a/step_run.go +++ b/step_run.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/object" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) @@ -13,18 +12,18 @@ type StepRun struct { func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*driver.Driver) - vm := state.Get("vm").(*object.VirtualMachine) + vm := state.Get("vm").(*driver.VirtualMachine) ui.Say("Power on VM...") - err := d.PowerOn(vm) + + err := vm.PowerOn() if err != nil { state.Put("error", err) return multistep.ActionHalt } ui.Say("Waiting for IP...") - ip, err := d.WaitForIP(vm) + ip, err := vm.WaitForIP() if err != nil { state.Put("error", err) return multistep.ActionHalt @@ -43,11 +42,11 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { } ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*driver.Driver) - vm := state.Get("vm").(*object.VirtualMachine) + vm := state.Get("vm").(*driver.VirtualMachine) ui.Say("Power off VM...") - err := d.PowerOff(vm) + + err := vm.PowerOff() if err != nil { ui.Error(err.Error()) } diff --git a/step_shutdown.go b/step_shutdown.go index dc8539a13..78bf2fbe6 100644 --- a/step_shutdown.go +++ b/step_shutdown.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/object" "fmt" "log" "time" @@ -41,8 +40,7 @@ type StepShutdown struct { func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) comm := state.Get("communicator").(packer.Communicator) - d := state.Get("driver").(*driver.Driver) - vm := state.Get("vm").(*object.VirtualMachine) + vm := state.Get("vm").(*driver.VirtualMachine) if s.config.Command != "" { ui.Say("Executing shutdown command...") @@ -62,7 +60,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { } else { ui.Say("Shut down VM...") - err := d.StartShutdown(vm) + err := vm.StartShutdown() if err != nil { state.Put("error", fmt.Errorf("Cannot shut down VM: %v", err)) return multistep.ActionHalt @@ -70,7 +68,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { } log.Printf("Waiting max %s for shutdown to complete", s.config.Timeout) - err := d.WaitForShutdown(vm, s.config.Timeout) + err := vm.WaitForShutdown(s.config.Timeout) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_snapshot.go b/step_snapshot.go index ad9965445..4b2a86355 100644 --- a/step_snapshot.go +++ b/step_snapshot.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/object" "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) @@ -13,13 +12,12 @@ type StepCreateSnapshot struct{ func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*driver.Driver) - vm := state.Get("vm").(*object.VirtualMachine) + vm := state.Get("vm").(*driver.VirtualMachine) if s.createSnapshot { ui.Say("Creating snapshot...") - err := d.CreateSnapshot(vm) + err := vm.CreateSnapshot("Created by Packer") if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_template.go b/step_template.go index 2b3d42a6b..0bed2c062 100644 --- a/step_template.go +++ b/step_template.go @@ -3,7 +3,6 @@ package main import ( "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/object" "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) @@ -13,12 +12,11 @@ type StepConvertToTemplate struct{ func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - d := state.Get("driver").(*driver.Driver) - vm := state.Get("vm").(*object.VirtualMachine) + vm := state.Get("vm").(*driver.VirtualMachine) if s.ConvertToTemplate { ui.Say("Convert VM into template...") - err := d.ConvertToTemplate(vm) + err := vm.ConvertToTemplate() if err != nil { state.Put("error", err) return multistep.ActionHalt From 1046b5ef0983cb01cd15c9155e33a219a6c78f72 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 21:54:01 +0300 Subject: [PATCH 084/266] handle VM clone errors do not try to cleanup failed VM, it it's not created --- step_clone.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/step_clone.go b/step_clone.go index cd27ace68..0c4543ff6 100644 --- a/step_clone.go +++ b/step_clone.go @@ -74,7 +74,12 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { } ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*driver.VirtualMachine) + + st := state.Get("vm") + if st == nil { + return + } + vm := st.(*driver.VirtualMachine) ui.Say("Destroying VM...") From 7cace988e69121a7afd9b207ac9c7aaf6250e76c Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 23:18:14 +0300 Subject: [PATCH 085/266] inherit datastore from target host, not source template --- builder_acc_test.go | 74 ++++++++++++++++++++++++++++++++++++++++++--- driver/datastore.go | 24 +++++++++++++++ driver/host.go | 12 ++++++++ driver/vm.go | 29 +++++++++++++++--- 4 files changed, 130 insertions(+), 9 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 99f15ce3a..93b1ead09 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -15,7 +15,7 @@ func TestBuilderAcc_default(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: renderConfig(config), - Check: checkDefault(t, config["vm_name"].(string), config["host"].(string)), + Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), }) } @@ -36,12 +36,12 @@ func defaultConfig() map[string]interface{} { return config } -func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc { +func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { d := testConn(t) vm := getVM(t, d, artifacts) - vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "layoutEx.disk") + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -64,7 +64,6 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc if err != nil { t.Fatal("Cannot read host properties: ", err) } - if hostInfo.Name != host { t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) } @@ -78,6 +77,16 @@ func checkDefault(t *testing.T, name string, host string) builderT.TestCheckFunc t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) } + dsr := vmInfo.Datastore[0].Reference() + ds := d.NewDatastore(&dsr) + dsInfo, err := ds.Info("name") + if err != nil { + t.Fatal("Cannot read datastore properties: ", err) + } + if dsInfo.Name != datastore { + t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) + } + if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { t.Error("Not a full clone") } @@ -187,6 +196,63 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { } } +func TestBuilderAcc_datastore(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: datastoreConfig(), + Check: checkDatastore(t, "datastore1"), // on esxi-1.vsphere55.test + }) +} + +func datastoreConfig() string { + config := defaultConfig() + config["template"] = "ubuntu-host4" // on esxi-4.vsphere55.test + return renderConfig(config) +} + +func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + vm := getVM(t, d, artifacts) + + vmInfo, err := vm.Info("datastore") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + n := len(vmInfo.Datastore) + if n != 1 { + t.Fatalf("VM should have 1 datastore, got %v", n) + } + + ds := d.NewDatastore(&vmInfo.Datastore[0]) + info, err := ds.Info("name") + if err != nil { + t.Fatalf("Cannot read datastore properties: %v", err) + } + if info.Name != name { + t.Errorf("Wrong datastore. expected: %v, got: %v", name, info.Name) + } + + return nil + } +} + +func TestBuilderAcc_multipleDatastores(t *testing.T) { + t.Skip("test must fail") + + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: multipleDatastoresConfig(), + }) +} + +func multipleDatastoresConfig() string { + config := defaultConfig() + config["host"] = "esxi-4.vsphere55.test" // host with 2 datastores + return renderConfig(config) +} + func TestBuilderAcc_linkedClone(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/driver/datastore.go b/driver/datastore.go index 5e6e408cb..9aa6783c1 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -2,6 +2,8 @@ package driver import ( "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/mo" ) type Datastore struct { @@ -9,6 +11,13 @@ type Datastore struct { driver *Driver } +func (d *Driver) NewDatastore(ref *types.ManagedObjectReference) *Datastore { + return &Datastore{ + ds: object.NewDatastore(d.client.Client, *ref), + driver: d, + } +} + func (d *Driver) FindDatastore(name string) (*Datastore, error) { ds, err := d.finder.Datastore(d.ctx, name) if err != nil { @@ -19,3 +28,18 @@ func (d *Driver) FindDatastore(name string) (*Datastore, error) { driver: d, }, nil } + +func (ds *Datastore) Info(params ...string) (*mo.Datastore, error) { + var p []string + if len(params) == 0 { + p = []string{"*"} + } else { + p = params + } + var info mo.Datastore + err := ds.ds.Properties(ds.driver.ctx, ds.ds.Reference(), p, &info) + if err != nil { + return nil, err + } + return &info, nil +} diff --git a/driver/host.go b/driver/host.go index 084d9d3b2..351a48789 100644 --- a/driver/host.go +++ b/driver/host.go @@ -4,6 +4,7 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" + "fmt" ) type Host struct { @@ -18,6 +19,17 @@ func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host { } } +func (d *Driver) FindHost(name string) (*Host, error) { + h, err := d.finder.HostSystem(d.ctx, fmt.Sprintf("/%v/host/%v", d.datacenter.Name(), name)) + if err != nil { + return nil, err + } + return &Host{ + host: h, + driver: d, + }, nil +} + func (h *Host) Info(params ...string) (*mo.HostSystem, error){ var p []string if len(params) == 0 { diff --git a/driver/vm.go b/driver/vm.go index 83c7d7d55..0457690df 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -6,6 +6,7 @@ import ( "github.com/vmware/govmomi/vim25/types" "errors" "time" + "fmt" ) type VirtualMachine struct { @@ -44,7 +45,7 @@ func (d *Driver) FindVM(name string) (*VirtualMachine, error) { return nil, err } return &VirtualMachine{ - vm: vm, + vm: vm, driver: d, }, nil } @@ -79,13 +80,31 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err poolRef := pool.pool.Reference() relocateSpec.Pool = &poolRef - if config.Datastore != "" { - datastore, err := template.driver.FindDatastore(config.Datastore) + if config.Datastore == "" { + host, err := template.driver.FindHost(config.Host) if err != nil { return nil, err } - datastoreRef := datastore.ds.Reference() - relocateSpec.Datastore = &datastoreRef + + info, err := host.Info("datastore") + if err != nil { + return nil, err + } + + if len(info.Datastore) > 1 { + return nil, fmt.Errorf("Target host has several datastores. Specify 'datastore' parameter explicitly") + } + + ref := info.Datastore[0].Reference() + relocateSpec.Datastore = &ref + } else { + ds, err := template.driver.FindDatastore(config.Datastore) + if err != nil { + return nil, err + } + + ref := ds.ds.Reference() + relocateSpec.Datastore = &ref } var cloneSpec types.VirtualMachineCloneSpec From a12121616df50a6e1d0dfd570620e132048b7771 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 23:50:25 +0300 Subject: [PATCH 086/266] tests for hardware customization --- builder_acc_test.go | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/builder_acc_test.go b/builder_acc_test.go index 93b1ead09..c35011ed1 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -285,6 +285,99 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { } } +func TestBuilderAcc_hardware(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: hardwareConfig(), + Check: checkHardware(t), + }) +} + +func hardwareConfig() string { + config := defaultConfig() + config["CPUs"] = 2 + config["CPU_reservation"] = 1000 + config["CPU_limit"] = 1500 + config["RAM"] = 2048 + config["RAM_reservation"] = 1024 + config["linked_clone"] = true // speed up + + return renderConfig(config) +} + +func checkHardware(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + cpuSockets := vmInfo.Config.Hardware.NumCPU + if cpuSockets != 2 { + t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) + } + + cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + if cpuReservation != 1000 { + t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) + } + + cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + if cpuLimit != 1500 { + t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) + } + + ram := vmInfo.Config.Hardware.MemoryMB + if ram != 2048 { + t.Errorf("VM should have 2048 MB of RAM, got %v", ram) + } + + ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + if ramReservation != 1024 { + t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) + } + + return nil + } +} + +func TestBuilderAcc_RAMReservation(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: RAMReservationConfig(), + Check: checkRAMReservation(t), + }) +} + +func RAMReservationConfig() string { + config := defaultConfig() + config["RAM_reserve_all"] = true + config["linked_clone"] = true // speed up + + return renderConfig(config) +} + +func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if *vmInfo.Config.MemoryReservationLockedToMax != true { + t.Errorf("VM should have all RAM reserved") + } + + return nil + } +} + func TestBuilderAcc_snapshot(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, From d97c3ebaf092e71ac74bcbb3836fdc210c4f9710 Mon Sep 17 00:00:00 2001 From: bugbuilder Date: Fri, 25 Aug 2017 02:08:08 -0300 Subject: [PATCH 087/266] enable ssh key file --- README.md | 3 ++- builder.go | 24 +++++------------------- ssh.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 ssh.go diff --git a/README.md b/README.md index fc36fc580..55b3339e5 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@ Hardware customization: Provisioning: * `ssh_username` - [**mandatory**] username in guest OS. -* `ssh_password` - [**mandatory**] password in guest OS. +* `ssh_password` - [**mandatory if ssh_private_key_file is not present**] password in guest OS. +* `ssh_private_key_file` - [**mandatory if ssh_password is not present**] password in guest OS. Post-processing: * `shutdown_command` - VMware guest tools are used by default. diff --git a/builder.go b/builder.go index 579c2b9c9..a669abd47 100644 --- a/builder.go +++ b/builder.go @@ -4,12 +4,10 @@ import ( "errors" "github.com/hashicorp/packer/common" - "github.com/hashicorp/packer/packer" - "github.com/mitchellh/multistep" "github.com/hashicorp/packer/helper/communicator" - gossh "golang.org/x/crypto/ssh" - "github.com/hashicorp/packer/communicator/ssh" + "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" ) type Builder struct { @@ -29,6 +27,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { state := new(multistep.BasicStateBag) + state.Put("config", b.config) state.Put("hook", hook) state.Put("ui", ui) @@ -45,21 +44,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepRun{}, &communicator.StepConnect{ Config: &b.config.Config, - Host: func(state multistep.StateBag) (string, error) { - return state.Get("ip").(string), nil - }, - SSHConfig: func(multistep.StateBag) (*gossh.ClientConfig, error) { - return &gossh.ClientConfig{ - User: b.config.Config.SSHUsername, - Auth: []gossh.AuthMethod{ - gossh.Password(b.config.Config.SSHPassword), - gossh.KeyboardInteractive( - ssh.PasswordKeyboardInteractive(b.config.Config.SSHPassword)), - }, - // TODO: add a proper verification - HostKeyCallback: gossh.InsecureIgnoreHostKey(), - }, nil - }, + Host: commHost, + SSHConfig: sshConfig, }, &common.StepProvision{}, &StepShutdown{ diff --git a/ssh.go b/ssh.go new file mode 100644 index 000000000..4ffdef905 --- /dev/null +++ b/ssh.go @@ -0,0 +1,44 @@ +package main + +import ( + "fmt" + "io/ioutil" + + packerssh "github.com/hashicorp/packer/communicator/ssh" + "github.com/mitchellh/multistep" + "golang.org/x/crypto/ssh" +) + +func commHost(state multistep.StateBag) (string, error) { + return state.Get("ip").(string), nil +} + +func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { + config := state.Get("config").(*Config) + + clientConfig := &ssh.ClientConfig{ + User: config.Config.SSHUsername, + Auth: []ssh.AuthMethod{ + ssh.Password(config.Config.SSHPassword), + ssh.KeyboardInteractive( + packerssh.PasswordKeyboardInteractive(config.Config.SSHPassword)), + }, + HostKeyCallback: ssh.InsecureIgnoreHostKey(), + } + + if config.Config.SSHPrivateKey != "" { + privateKey, err := ioutil.ReadFile(config.Config.SSHPrivateKey) + if err != nil { + return nil, fmt.Errorf("Error loading configured private key file: %s", err) + } + + signer, err := ssh.ParsePrivateKey(privateKey) + if err != nil { + return nil, fmt.Errorf("Error setting up SSH config: %s", err) + } + + clientConfig.Auth = []ssh.AuthMethod{ssh.PublicKeys(signer)} + } + + return clientConfig, nil +} From ebacc4c2fadc05121046a0b3f66d8eccfed77e53 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 31 Aug 2017 15:05:26 +0300 Subject: [PATCH 088/266] refactor ssh connection --- README.md | 3 +-- builder.go | 2 +- builder_acc_test.go | 17 ++++++++++++++++- config.go | 4 ++-- ssh.go | 28 ++++++++++++++++------------ test-key.pem | 27 +++++++++++++++++++++++++++ test-key.pub | 1 + 7 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 test-key.pem create mode 100755 test-key.pub diff --git a/README.md b/README.md index 55b3339e5..052d07552 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,7 @@ Hardware customization: Provisioning: * `ssh_username` - [**mandatory**] username in guest OS. -* `ssh_password` - [**mandatory if ssh_private_key_file is not present**] password in guest OS. -* `ssh_private_key_file` - [**mandatory if ssh_password is not present**] password in guest OS. +* `ssh_password` or `ssh_private_key_file` - [**mandatory**] password or SSH-key filename to access a guest OS. Post-processing: * `shutdown_command` - VMware guest tools are used by default. diff --git a/builder.go b/builder.go index a669abd47..132bd9383 100644 --- a/builder.go +++ b/builder.go @@ -43,7 +43,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &StepRun{}, &communicator.StepConnect{ - Config: &b.config.Config, + Config: &b.config.Comm, Host: commHost, SSHConfig: sshConfig, }, diff --git a/builder_acc_test.go b/builder_acc_test.go index c35011ed1..431528f6f 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -277,7 +277,7 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { t.Fatalf("Cannot read VM properties: %v", err) } - if len(vmInfo.LayoutEx.Disk[0].Chain) != 3 { + if len(vmInfo.LayoutEx.Disk[0].Chain) != 2 { t.Error("Not a linked clone") } @@ -378,6 +378,21 @@ func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { } } +func TestBuilderAcc_sshKey(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: sshKeyConfig(), + }) +} + +func sshKeyConfig() string { + config := defaultConfig() + config["ssh_password"] = "" + config["ssh_private_key_file"] = "test-key.pem" + config["linked_clone"] = true // speed up + return renderConfig(config) +} + func TestBuilderAcc_snapshot(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/config.go b/config.go index d68ee51aa..5c25da4d1 100644 --- a/config.go +++ b/config.go @@ -13,7 +13,7 @@ type Config struct { ConnectConfig `mapstructure:",squash"` CloneConfig `mapstructure:",squash"` HardwareConfig `mapstructure:",squash"` - communicator.Config `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` ShutdownConfig `mapstructure:",squash"` CreateSnapshot bool `mapstructure:"create_snapshot"` ConvertToTemplate bool `mapstructure:"convert_to_template"` @@ -34,7 +34,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } errs := new(packer.MultiError) - errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CloneConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) diff --git a/ssh.go b/ssh.go index 4ffdef905..863ce4e58 100644 --- a/ssh.go +++ b/ssh.go @@ -16,18 +16,10 @@ func commHost(state multistep.StateBag) (string, error) { func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { config := state.Get("config").(*Config) - clientConfig := &ssh.ClientConfig{ - User: config.Config.SSHUsername, - Auth: []ssh.AuthMethod{ - ssh.Password(config.Config.SSHPassword), - ssh.KeyboardInteractive( - packerssh.PasswordKeyboardInteractive(config.Config.SSHPassword)), - }, - HostKeyCallback: ssh.InsecureIgnoreHostKey(), - } + var auth []ssh.AuthMethod - if config.Config.SSHPrivateKey != "" { - privateKey, err := ioutil.ReadFile(config.Config.SSHPrivateKey) + if config.Comm.SSHPrivateKey != "" { + privateKey, err := ioutil.ReadFile(config.Comm.SSHPrivateKey) if err != nil { return nil, fmt.Errorf("Error loading configured private key file: %s", err) } @@ -37,8 +29,20 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { return nil, fmt.Errorf("Error setting up SSH config: %s", err) } - clientConfig.Auth = []ssh.AuthMethod{ssh.PublicKeys(signer)} + auth = []ssh.AuthMethod{ssh.PublicKeys(signer)} + } else { + auth = []ssh.AuthMethod{ + ssh.Password(config.Comm.SSHPassword), + ssh.KeyboardInteractive( + packerssh.PasswordKeyboardInteractive(config.Comm.SSHPassword)), + } } + clientConfig := &ssh.ClientConfig{ + User: config.Comm.SSHUsername, + HostKeyCallback: ssh.InsecureIgnoreHostKey(), + } + clientConfig.Auth = auth + return clientConfig, nil } diff --git a/test-key.pem b/test-key.pem new file mode 100644 index 000000000..8dad2ecd3 --- /dev/null +++ b/test-key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA2J9w3cbqMJSDTCUtFW3qRHhqgXbSOW32anqEWQYvW48WKXJm +ZmuuSViC0tcAMCnX8pu5YGlAMCi5RBDtdoE9mZzUCfE4Q1Om42S2jKRrSSbhU9Ts +8jTRL0V81Tja64SEt5l1dDHS5sgNJy8C4nWaWob1HT+YloPEllj80ogwoQoL3ufp +r5me/TOrA3ApHXewWm0feBkkkuN6NkL1Z9sILCstLrjD+RVEOvI/wrHZEaLpYJ4P +LgS8LmTNKaFafmqwgcC4VcA4kVbhxw9X385v+mQLqpiOJa+vS51dT2qINEw+80Y+ +HL7k7OIZTLg803wubI3rUZQ/2PX/STBq1zO9RwIDAQABAoIBAAmrDBGJ6Dfk2PtU +CXAUaMlHipFeqUFQ7BeSgkeq5AA1IasV5QYbNjslzSj12ZdMtsuoMZzg9bFwj9w+ +2SpZ2FL70ebjsjwnBqLNguxCBlvMdXAVZ8Hjo5Z1hn3JvNOYJYhAPCLEeoI8WYHv +MjTDRPFXZqc4iGnnVaXUMOyAkZMOV6sMQzvuJad4x7gvQGRhCgcdnFdGbVs+MZQc +WPI6cO6imj27F6rJK3W6s5XcSjDbkpytf2wUuWYgck93Fdm3kYy3ER6B3P/MiM95 +qGRmg6OuEYbXAr4ytamjKUThl83SGvDS89N5SIjS5rgrEBgrOFBgMhjG/ibaxbrh +c84oplECgYEA+vyI4VUYgce8voYmdDijlM/NwPbCpD3SGiyXIYcDN1i/CUdDhBYh +z4982H6I1b2cg+veBWICro9Dp20CpfGtXT6Y3o1yNWkbKlosd+f2Us10fG1gkcyI +TiZCYaJPrtdoTT0vMKbdUbkgn0FLNbW1TCh5FQ7K7RXhDonb9BbsTzkCgYEA3PMu +bv/MgaET654GAItudazJmh4FfR905w59yVNJfe+7iG/f5zzv7vIpaERvBo245hcu +IaO8QbW5OKYuCaNIjGOSd1uxN5ytcOHcf1bmjS+WRQdu/FR5v9BM0BY66NFjqKMb +dZLXVZPnU3EOqCKmi9SI2VOVKrDL5XzMOHhL8H8CgYBFJh5wNomx993AgCVID/LB +pR8C8vldVsrz+yUIT7JLJWA8pi2rzo0yKk4zN2lrufnNPsbEpOQoQ8BX+GiqX5Ns +BTsI1d+JZ5Pcb0uhHX94ALL/NQNOKBPFtDTFwXpCqYZLAXhm5xJC2cZrGgommhGB +EgWKD7FI8KY44zJ+ZXJlwQKBgGvw/eFKZI17tPCp3cLMW2VvyXnaatIK2SC8SqVd +ZAz7XoG0Lg2ZDpqMgcAnlpn8CLWX43iZtjHf5qIPRXR96cZ0KqzXBcfmajE4lnE7 +chzNf7sve4AYgPY9fBk4kwUEroxHSvXwi/SJ8jwogoGPlA/CAC00ES6u+p2dj2OT +GX5fAoGBAM6saTeyjAjLDE/vlPM9OButsoj5CJg7DklRgrRuRyygbyRBudafslnl +8e4+4mlXEBwKDnrDTtXFhX1Ur95/w/4GjyFXO/TB/Tmn+vaEBQTzgViKc2cJ/yay +ttiF6oJh9EjCaFDTz5P11wX7DajRux/2tUcBXX/C3FcGhNEkVb2P +-----END RSA PRIVATE KEY----- diff --git a/test-key.pub b/test-key.pub new file mode 100755 index 000000000..c4c14bb04 --- /dev/null +++ b/test-key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYn3DdxuowlINMJS0VbepEeGqBdtI5bfZqeoRZBi9bjxYpcmZma65JWILS1wAwKdfym7lgaUAwKLlEEO12gT2ZnNQJ8ThDU6bjZLaMpGtJJuFT1OzyNNEvRXzVONrrhIS3mXV0MdLmyA0nLwLidZpahvUdP5iWg8SWWPzSiDChCgve5+mvmZ79M6sDcCkdd7BabR94GSSS43o2QvVn2wgsKy0uuMP5FUQ68j/CsdkRoulgng8uBLwuZM0poVp+arCBwLhVwDiRVuHHD1ffzm/6ZAuqmI4lr69LnV1Paog0TD7zRj4cvuTs4hlMuDzTfC5sjetRlD/Y9f9JMGrXM71H From 04d1820eb3cae9ad8363ea68977b2e629f977db9 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 3 Sep 2017 18:34:12 +0300 Subject: [PATCH 089/266] migrate tests to Alpine template --- builder_acc_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 431528f6f..faa660ade 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -26,10 +26,10 @@ func defaultConfig() map[string]interface{} { "password": "jetbrains", "insecure_connection": true, - "template": "basic", + "template": "alpine", "host": "esxi-1.vsphere55.test", - "ssh_username": "jetbrains", + "ssh_username": "root", "ssh_password": "jetbrains", } config["vm_name"] = fmt.Sprintf("test-%v", rand.Intn(1000)) @@ -206,7 +206,7 @@ func TestBuilderAcc_datastore(t *testing.T) { func datastoreConfig() string { config := defaultConfig() - config["template"] = "ubuntu-host4" // on esxi-4.vsphere55.test + config["template"] = "alpine-host4" // on esxi-4.vsphere55.test return renderConfig(config) } From f05b1e1e4b087ea06e9ac6ae3425ff9d8354e920 Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Thu, 12 Oct 2017 08:19:23 +0300 Subject: [PATCH 090/266] Refactor `driver.NewDriver` `driver.NewDriver` used to construct a govnomi client on its own while the same work can be done by calling `govmomi.NewClient`. --- driver/driver.go | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/driver/driver.go b/driver/driver.go index 30ddcce72..d2bd048e7 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -9,8 +9,6 @@ import ( "github.com/vmware/govmomi/object" "time" "github.com/vmware/govmomi/session" - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25" ) type Driver struct { @@ -35,25 +33,13 @@ func NewDriver(config *ConnectConfig) (*Driver, error) { if err != nil { return nil, err } - credentials := url.UserPassword(config.Username, config.Password) - vcenter_url.User = credentials + vcenter_url.User = url.UserPassword(config.Username, config.Password) - soapClient := soap.NewClient(vcenter_url, config.InsecureConnection) - vimClient, err := vim25.NewClient(ctx, soapClient) - if err != nil { - return nil, err - } - - vimClient.RoundTripper = session.KeepAlive(vimClient.RoundTripper, 10*time.Minute) - client := &govmomi.Client{ - Client: vimClient, - SessionManager: session.NewManager(vimClient), - } - - err = client.SessionManager.Login(ctx, credentials) + client, err := govmomi.NewClient(ctx, vcenter_url, config.InsecureConnection) if err != nil { return nil, err } + client.RoundTripper = session.KeepAlive(client.RoundTripper, 10*time.Minute) finder := find.NewFinder(client.Client, false) datacenter, err := finder.DatacenterOrDefault(ctx, config.Datacenter) From c339fbfb39414a71b44efcdcfe3c5ff3aa84120b Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Wed, 25 Oct 2017 23:20:59 +0300 Subject: [PATCH 091/266] Add some acceptance tests for `VirtualMachine` and `Datastore` --- builder_acc_test.go | 153 +++++---------------------- driver/test.sh | 5 + driver/testing/config.go | 19 ++++ driver/testing/datastore_acc_test.go | 30 ++++++ driver/testing/utility.go | 142 +++++++++++++++++++++++++ driver/testing/vm_acc_test.go | 131 +++++++++++++++++++++++ driver/vm.go | 9 +- test.sh | 2 +- 8 files changed, 356 insertions(+), 135 deletions(-) create mode 100755 driver/test.sh create mode 100644 driver/testing/config.go create mode 100644 driver/testing/datastore_acc_test.go create mode 100644 driver/testing/utility.go create mode 100644 driver/testing/vm_acc_test.go diff --git a/builder_acc_test.go b/builder_acc_test.go index faa660ade..ab51d4ade 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -3,11 +3,10 @@ package main import ( "testing" builderT "github.com/hashicorp/packer/helper/builder/testing" - "fmt" "github.com/hashicorp/packer/packer" "encoding/json" - "math/rand" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + driverT "github.com/jetbrains-infra/packer-builder-vsphere/driver/testing" ) func TestBuilderAcc_default(t *testing.T) { @@ -21,77 +20,26 @@ func TestBuilderAcc_default(t *testing.T) { func defaultConfig() map[string]interface{} { config := map[string]interface{}{ - "vcenter_server": "vcenter.vsphere55.test", - "username": "root", - "password": "jetbrains", + "vcenter_server": driverT.DefaultVCenterServer, + "username": driverT.DefaultVCenterUsername, + "password": driverT.DefaultVCenterPassword, "insecure_connection": true, - "template": "alpine", - "host": "esxi-1.vsphere55.test", + "template": driverT.DefaultTemplate, + "host": driverT.DefaultHost, "ssh_username": "root", "ssh_password": "jetbrains", } - config["vm_name"] = fmt.Sprintf("test-%v", rand.Intn(1000)) + config["vm_name"] = driverT.NewVMName() return config } func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) - - vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - if vmInfo.Name != name { - t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) - } - - f := d.NewFolder(vmInfo.Parent) - folderPath, err := f.Path() - if err != nil { - t.Fatalf("Cannot read folder name: %v", err) - } - if folderPath != "" { - t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) - } - - h := d.NewHost(vmInfo.Runtime.Host) - hostInfo, err := h.Info("name") - if err != nil { - t.Fatal("Cannot read host properties: ", err) - } - if hostInfo.Name != host { - t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) - } - - p := d.NewResourcePool(vmInfo.ResourcePool) - poolPath, err := p.Path() - if err != nil { - t.Fatalf("Cannot read resource pool name: %v", err) - } - if poolPath != "" { - t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) - } - - dsr := vmInfo.Datastore[0].Reference() - ds := d.NewDatastore(&dsr) - dsInfo, err := ds.Info("name") - if err != nil { - t.Fatal("Cannot read datastore properties: ", err) - } - if dsInfo.Name != datastore { - t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) - } - - if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { - t.Error("Not a full clone") - } - - return nil + return driverT.VMCheckDefault(t, d, vm, name, host, datastore) } } @@ -137,7 +85,7 @@ func folderConfig() string { func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("parent") @@ -175,7 +123,7 @@ func resourcePoolConfig() string { func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("resourcePool") @@ -196,6 +144,7 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { } } +// FIXME: why do we need this??? Why don't perform these checks in checkDefault? func TestBuilderAcc_datastore(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -212,7 +161,7 @@ func datastoreConfig() string { func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("datastore") @@ -226,20 +175,14 @@ func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { } ds := d.NewDatastore(&vmInfo.Datastore[0]) - info, err := ds.Info("name") - if err != nil { - t.Fatalf("Cannot read datastore properties: %v", err) - } - if info.Name != name { - t.Errorf("Wrong datastore. expected: %v, got: %v", name, info.Name) - } + driverT.CheckDatastoreName(t, ds, name) return nil } } func TestBuilderAcc_multipleDatastores(t *testing.T) { - t.Skip("test must fail") + t.Skip("test must fail") // FIXME builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -269,7 +212,7 @@ func linkedCloneConfig() string { func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("layoutEx.disk") @@ -295,11 +238,11 @@ func TestBuilderAcc_hardware(t *testing.T) { func hardwareConfig() string { config := defaultConfig() - config["CPUs"] = 2 - config["CPU_reservation"] = 1000 - config["CPU_limit"] = 1500 - config["RAM"] = 2048 - config["RAM_reservation"] = 1024 + config["CPUs"] = driverT.DefaultCPUs + config["CPU_reservation"] = driverT.DefaultCPUReservation + config["CPU_limit"] = driverT.DefaultCPULimit + config["RAM"] = driverT.DefaultRAM + config["RAM_reservation"] = driverT.DefaultRAMReservation config["linked_clone"] = true // speed up return renderConfig(config) @@ -307,40 +250,9 @@ func hardwareConfig() string { func checkHardware(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) - + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) - vmInfo, err := vm.Info("config") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - cpuSockets := vmInfo.Config.Hardware.NumCPU - if cpuSockets != 2 { - t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) - } - - cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation - if cpuReservation != 1000 { - t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) - } - - cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit - if cpuLimit != 1500 { - t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) - } - - ram := vmInfo.Config.Hardware.MemoryMB - if ram != 2048 { - t.Errorf("VM should have 2048 MB of RAM, got %v", ram) - } - - ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation - if ramReservation != 1024 { - t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) - } - - return nil + return driverT.VMCheckHardware(t, d, vm) } } @@ -362,7 +274,7 @@ func RAMReservationConfig() string { func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("config") @@ -409,7 +321,7 @@ func snapshotConfig() string { func checkSnapshot(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("layoutEx.disk") @@ -443,7 +355,7 @@ func templateConfig() string { func checkTemplate(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := driverT.NewTestDriver(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("config.template") @@ -475,19 +387,6 @@ func renderConfig(config map[string]interface{}) string { return string(j) } -func testConn(t *testing.T) *driver.Driver { - d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: "vcenter.vsphere55.test", - Username: "root", - Password: "jetbrains", - InsecureConnection: true, - }) - if err != nil { - t.Fatal("Cannot connect: ", err) - } - return d -} - func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.VirtualMachine { artifactRaw := artifacts[0] artifact, _ := artifactRaw.(*Artifact) diff --git a/driver/test.sh b/driver/test.sh new file mode 100755 index 000000000..a2bf973cb --- /dev/null +++ b/driver/test.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +export VSPHERE_DRIVER_ACC=1 +cd testing +go test -v "$@" diff --git a/driver/testing/config.go b/driver/testing/config.go new file mode 100644 index 000000000..947aeb90e --- /dev/null +++ b/driver/testing/config.go @@ -0,0 +1,19 @@ +package testing + +// Defines whether acceptance tests should be run +const TestEnvVar = "VSPHERE_DRIVER_ACC" + +// Describe the environment to run tests in +const DefaultDatastore = "datastore1" +const DefaultTemplate = "alpine" +const DefaultHost = "esxi-1.vsphere55.test" +const DefaultVCenterServer = "vcenter.vsphere55.test" +const DefaultVCenterUsername = "root" +const DefaultVCenterPassword = "jetbrains" + +// Default hardware settings for +const DefaultCPUs = 2 +const DefaultCPUReservation = 1000 +const DefaultCPULimit = 1500 +const DefaultRAM = 2048 +const DefaultRAMReservation = 1024 diff --git a/driver/testing/datastore_acc_test.go b/driver/testing/datastore_acc_test.go new file mode 100644 index 000000000..5434e3730 --- /dev/null +++ b/driver/testing/datastore_acc_test.go @@ -0,0 +1,30 @@ +package testing + +import ( + "testing" +) + +var infoParams = [][]string { + //{}, // FIXME: Doesn't work + //{"*"}, // FIXME: Doesn't work + {"host", "vm"}, // TODO: choose something more meaningful +} + +func TestDatastore(t *testing.T) { + initDriverAcceptanceTest(t) + + d := NewTestDriver(t) + ds, err := d.FindDatastore(DefaultDatastore) + if err != nil { + t.Fatalf("`FindDatatore` can't find default datastore '%v'. Error: %v", + DefaultDatastore, err) + } + for _, params := range infoParams { + _, err := ds.Info(params...) + if err != nil { + t.Errorf("Cannot read datastore properties with parameters %v: %v", + params, err) + } + } + // TODO: add more checks +} diff --git a/driver/testing/utility.go b/driver/testing/utility.go new file mode 100644 index 000000000..8b2e007e7 --- /dev/null +++ b/driver/testing/utility.go @@ -0,0 +1,142 @@ +package testing + +import ( + "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "math/rand" + "os" + "testing" + "time" +) + +func NewTestDriver(t *testing.T) *driver.Driver { + d, err := driver.NewDriver(&driver.ConnectConfig{ + VCenterServer: DefaultVCenterServer, + Username: DefaultVCenterUsername, + Password: DefaultVCenterPassword, + InsecureConnection: true, + }) + if err != nil { + t.Fatal("Cannot connect: ", err) + } + return d +} + +func NewVMName() string { + rand.Seed(time.Now().UTC().UnixNano()) + return fmt.Sprintf("test-%v", rand.Intn(1000)) +} + +func CheckDatastoreName(t *testing.T, ds *driver.Datastore, name string) { + info, err := ds.Info("name") + if err != nil { + t.Fatalf("Cannot read datastore properties: %v", err) + } + if info.Name != name { + t.Errorf("Wrong datastore. expected: %v, got: %v", name, info.Name) + } +} + +func initDriverAcceptanceTest(t *testing.T) { + // We only run acceptance tests if an env var is set because they're + // slow and require outside configuration. + if os.Getenv(TestEnvVar) == "" { + t.Skip(fmt.Sprintf( + "Acceptance tests skipped unless env '%s' set", + TestEnvVar)) + } + + // We require verbose mode so that the user knows what is going on. + if !testing.Verbose() { + t.Fatal("Acceptance tests must be run with the -v flag on tests") + } +} + +func VMCheckDefault(t *testing.T, d *driver.Driver, vm *driver.VirtualMachine, + name string, host string, datastore string) error { + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Name != name { + t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) + } + + f := d.NewFolder(vmInfo.Parent) + folderPath, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + + h := d.NewHost(vmInfo.Runtime.Host) + hostInfo, err := h.Info("name") + if err != nil { + t.Fatal("Cannot read host properties: ", err) + } + if hostInfo.Name != host { + t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) + } + + p := d.NewResourcePool(vmInfo.ResourcePool) + poolPath, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if poolPath != "" { + t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) + } + + dsr := vmInfo.Datastore[0].Reference() + ds := d.NewDatastore(&dsr) + dsInfo, err := ds.Info("name") + if err != nil { + t.Fatal("Cannot read datastore properties: ", err) + } + if dsInfo.Name != datastore { + t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) + } + + if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { + t.Error("Not a full clone") + } + + return nil +} + +func VMCheckHardware(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) error { + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + cpuSockets := vmInfo.Config.Hardware.NumCPU + if cpuSockets != 2 { + t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) + } + + cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + if cpuReservation != 1000 { + t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) + } + + cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + if cpuLimit != 1500 { + t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) + } + + ram := vmInfo.Config.Hardware.MemoryMB + if ram != 2048 { + t.Errorf("VM should have 2048 MB of RAM, got %v", ram) + } + + ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + if ramReservation != 1024 { + t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) + } + + return nil +} diff --git a/driver/testing/vm_acc_test.go b/driver/testing/vm_acc_test.go new file mode 100644 index 000000000..7f93ce59d --- /dev/null +++ b/driver/testing/vm_acc_test.go @@ -0,0 +1,131 @@ +package testing + +import ( + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "log" + "testing" + "net" + "time" +) + +func initVMAccTest(t *testing.T) (d *driver.Driver, vm *driver.VirtualMachine, vmName string, vmDestructor func()) { + initDriverAcceptanceTest(t) + d = NewTestDriver(t) + + template, err := d.FindVM(DefaultTemplate) // Don't destroy this VM! + if err != nil { + t.Fatalf("Cannot find template vm '%v': %v", DefaultTemplate, err) + } + + log.Printf("[DEBUG] Clonning VM") + vmName = NewVMName() + vm, err = template.Clone(&driver.CloneConfig{ + Name: vmName, + Host: DefaultHost, + }) + if err != nil { + t.Fatalf("Cannot clone vm '%v': %v", DefaultTemplate, err) + } + + vmDestructor = func() { + log.Printf("[DEBUG] Removing the clone") + if err := vm.Destroy(); err != nil { + t.Errorf("!!! ERROR REMOVING VM '%v': %v!!!", vmName, err) + } + + // Check that the clone is no longer exists + if _, err := d.FindVM(vmName); err == nil { + t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", vmName) + } + } + + return +} + +func TestVMAcc_default(t *testing.T) { + d, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + // Check that the clone can be found by its name + if _, err := d.FindVM(vmName); err != nil { + t.Errorf("Cannot find created vm '%v': %v", vmName, err) + } + + // Run checks + log.Printf("[DEBUG] Running check function") + VMCheckDefault(t, d, vm, vmName, DefaultHost, DefaultDatastore) +} + +func TestVMAcc_hardware(t *testing.T) { + d, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + log.Printf("[DEBUG] Configuring the vm") + vm.Configure(&driver.HardwareConfig{ + CPUs: DefaultCPUs, + CPUReservation: DefaultCPUReservation, + CPULimit: DefaultCPULimit, + RAM: DefaultRAM, + RAMReservation: DefaultRAMReservation, + }) + log.Printf("[DEBUG] Running check function") + VMCheckHardware(t, d, vm) +} + +func startVM(t *testing.T, vm *driver.VirtualMachine, vmName string) (stopper func()) { + log.Printf("[DEBUG] Starting the vm") + if err := vm.PowerOn(); err != nil { + t.Fatalf("Cannot start created vm '%v': %v", vmName, err) + } + return func() { + log.Printf("[DEBUG] Powering off the vm") + if err := vm.PowerOff(); err != nil { + t.Errorf("Cannot power off started vm '%v': %v", vmName, err) + } + } +} + +func TestVMAcc_running(t *testing.T) { + _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + stopper := startVM(t, vm, vmName) + defer stopper() + + switch ip, err := vm.WaitForIP(); { + case err != nil: + t.Errorf("Cannot obtain IP address from created vm '%v': %v", vmName, err) + case net.ParseIP(ip) == nil: + t.Errorf("'%v' is not a valid ip address", ip) + } + + vm.StartShutdown() + log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") + // TODO: there is complex logic in WaitForShutdown. It's better to test it well. It might be reasonable to create + // unit tests for it. + vm.WaitForShutdown(1 * time.Minute) +} + +func TestVMAcc_running_snapshot(t *testing.T) { + _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + stopper := startVM(t, vm, vmName) + defer stopper() + + vm.CreateSnapshot("test-snapshot") + // TODO: check +} + +func TestVMAcc_template(t *testing.T) { + _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + vm.ConvertToTemplate() + switch info, err := vm.Info("config"); { + case err != nil: + t.Fatalf("Cannot read VM properties for '%v': %v", vmName, err) + case !info.Config.Template: + t.Fatalf("'%v' seems not to be a template", vmName) + } +} diff --git a/driver/vm.go b/driver/vm.go index 0457690df..967264fc9 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -183,11 +183,7 @@ func (vm *VirtualMachine) PowerOn() error { } func (vm *VirtualMachine) WaitForIP() (string, error) { - ip, err := vm.vm.WaitForIP(vm.driver.ctx) - if err != nil { - return "", err - } - return ip, nil + return vm.vm.WaitForIP(vm.driver.ctx) } func (vm *VirtualMachine) PowerOff() error { @@ -245,6 +241,5 @@ func (vm *VirtualMachine) CreateSnapshot(name string) error { } func (vm *VirtualMachine) ConvertToTemplate() error { - err := vm.vm.MarkAsTemplate(vm.driver.ctx) - return err + return vm.vm.MarkAsTemplate(vm.driver.ctx) } diff --git a/test.sh b/test.sh index 0c7683736..dd91fee3a 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,4 @@ #!/bin/sh export PACKER_ACC=1 -go test -v +go test -v "$@" From d154a0ff32aef69332357cfe038c4afd7f0c939f Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Wed, 25 Oct 2017 23:54:13 +0300 Subject: [PATCH 092/266] Improve `TestVMAcc_running_snapshot` and `TestVMAcc_template` --- builder_acc_test.go | 112 +++++++++------------------------- driver/testing/utility.go | 92 ++++++++++++++++++---------- driver/testing/vm_acc_test.go | 13 ++-- 3 files changed, 93 insertions(+), 124 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index ab51d4ade..b33de8d95 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -1,12 +1,12 @@ package main import ( - "testing" + "encoding/json" builderT "github.com/hashicorp/packer/helper/builder/testing" "github.com/hashicorp/packer/packer" - "encoding/json" "github.com/jetbrains-infra/packer-builder-vsphere/driver" driverT "github.com/jetbrains-infra/packer-builder-vsphere/driver/testing" + "testing" ) func TestBuilderAcc_default(t *testing.T) { @@ -14,7 +14,12 @@ func TestBuilderAcc_default(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: renderConfig(config), - Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), + Check: func(artifacts []packer.Artifact) error { + d := driverT.NewTestDriver(t) + driverT.VMCheckDefault(t, d, getVM(t, d, artifacts), config["vm_name"].(string), + config["host"].(string), driverT.DefaultDatastore) + return nil + }, }) } @@ -35,14 +40,6 @@ func defaultConfig() map[string]interface{} { return config } -func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - vm := getVM(t, d, artifacts) - return driverT.VMCheckDefault(t, d, vm, name, host, datastore) - } -} - func TestBuilderAcc_artifact(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ @@ -149,7 +146,11 @@ func TestBuilderAcc_datastore(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: datastoreConfig(), - Check: checkDatastore(t, "datastore1"), // on esxi-1.vsphere55.test + Check: func(artifacts []packer.Artifact) error { + d := driverT.NewTestDriver(t) + driverT.VMCheckDatastore(t, d, getVM(t, d, artifacts), driverT.DefaultDatastore) + return nil + }, }) } @@ -159,30 +160,8 @@ func datastoreConfig() string { return renderConfig(config) } -func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - vm := getVM(t, d, artifacts) - - vmInfo, err := vm.Info("datastore") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - n := len(vmInfo.Datastore) - if n != 1 { - t.Fatalf("VM should have 1 datastore, got %v", n) - } - - ds := d.NewDatastore(&vmInfo.Datastore[0]) - driverT.CheckDatastoreName(t, ds, name) - - return nil - } -} - func TestBuilderAcc_multipleDatastores(t *testing.T) { - t.Skip("test must fail") // FIXME + t.Skip("test must fail") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -232,7 +211,11 @@ func TestBuilderAcc_hardware(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: hardwareConfig(), - Check: checkHardware(t), + Check: func(artifacts []packer.Artifact) error { + d := driverT.NewTestDriver(t) + driverT.VMCheckHardware(t, d, getVM(t, d, artifacts)) + return nil + }, }) } @@ -248,14 +231,6 @@ func hardwareConfig() string { return renderConfig(config) } -func checkHardware(t *testing.T) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - vm := getVM(t, d, artifacts) - return driverT.VMCheckHardware(t, d, vm) - } -} - func TestBuilderAcc_RAMReservation(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -309,7 +284,11 @@ func TestBuilderAcc_snapshot(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: snapshotConfig(), - Check: checkSnapshot(t), + Check: func(artifacts []packer.Artifact) error { + d := driverT.NewTestDriver(t) + driverT.VMCheckSnapshor(t, d, getVM(t, d, artifacts)) + return nil + }, }) } @@ -319,30 +298,15 @@ func snapshotConfig() string { return renderConfig(config) } -func checkSnapshot(t *testing.T) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - - vm := getVM(t, d, artifacts) - vmInfo, err := vm.Info("layoutEx.disk") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - layers := len(vmInfo.LayoutEx.Disk[0].Chain) - if layers != 2 { - t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) - } - - return nil - } -} - func TestBuilderAcc_template(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: templateConfig(), - Check: checkTemplate(t), + Check: func(artifacts []packer.Artifact) error { + d := driverT.NewTestDriver(t) + driverT.VMCheckTemplate(t, d, getVM(t, d, artifacts)) + return nil + }, }) } @@ -353,24 +317,6 @@ func templateConfig() string { return renderConfig(config) } -func checkTemplate(t *testing.T) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - - vm := getVM(t, d, artifacts) - vmInfo, err := vm.Info("config.template") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - if vmInfo.Config.Template != true { - t.Error("Not a template") - } - - return nil - } -} - func renderConfig(config map[string]interface{}) string { t := map[string][]map[string]interface{}{ "builders": { diff --git a/driver/testing/utility.go b/driver/testing/utility.go index 8b2e007e7..3c1170ebd 100644 --- a/driver/testing/utility.go +++ b/driver/testing/utility.go @@ -17,7 +17,7 @@ func NewTestDriver(t *testing.T) *driver.Driver { InsecureConnection: true, }) if err != nil { - t.Fatal("Cannot connect: ", err) + t.Fatalf("Cannot connect: %v", err) } return d } @@ -28,11 +28,10 @@ func NewVMName() string { } func CheckDatastoreName(t *testing.T, ds *driver.Datastore, name string) { - info, err := ds.Info("name") - if err != nil { - t.Fatalf("Cannot read datastore properties: %v", err) - } - if info.Name != name { + switch info, err := ds.Info("name"); { + case err != nil: + t.Errorf("Cannot read datastore properties: %v", err) + case info.Name != name: t.Errorf("Wrong datastore. expected: %v, got: %v", name, info.Name) } } @@ -53,7 +52,7 @@ func initDriverAcceptanceTest(t *testing.T) { } func VMCheckDefault(t *testing.T, d *driver.Driver, vm *driver.VirtualMachine, - name string, host string, datastore string) error { + name string, host string, datastore string) { vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) @@ -64,50 +63,45 @@ func VMCheckDefault(t *testing.T, d *driver.Driver, vm *driver.VirtualMachine, } f := d.NewFolder(vmInfo.Parent) - folderPath, err := f.Path() - if err != nil { - t.Fatalf("Cannot read folder name: %v", err) - } - if folderPath != "" { + switch folderPath, err := f.Path(); { + case err != nil: + t.Errorf("Cannot read folder name: %v", err) + case folderPath != "": t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) } h := d.NewHost(vmInfo.Runtime.Host) - hostInfo, err := h.Info("name") - if err != nil { - t.Fatal("Cannot read host properties: ", err) - } - if hostInfo.Name != host { + switch hostInfo, err := h.Info("name"); { + case err != nil: + t.Errorf("Cannot read host properties: %v", err) + case hostInfo.Name != host: t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) } p := d.NewResourcePool(vmInfo.ResourcePool) - poolPath, err := p.Path() - if err != nil { - t.Fatalf("Cannot read resource pool name: %v", err) - } - if poolPath != "" { + switch poolPath, err := p.Path(); { + case err != nil: + t.Errorf("Cannot read resource pool name: %v", err) + case poolPath != "": t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) } + dsr := vmInfo.Datastore[0].Reference() ds := d.NewDatastore(&dsr) - dsInfo, err := ds.Info("name") - if err != nil { - t.Fatal("Cannot read datastore properties: ", err) - } - if dsInfo.Name != datastore { + switch dsInfo, err := ds.Info("name"); { + case err != nil: + t.Errorf("Cannot read datastore properties: %v", err) + case dsInfo.Name != datastore: t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) } if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { t.Error("Not a full clone") } - - return nil } -func VMCheckHardware(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) error { +func VMCheckHardware(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { vmInfo, err := vm.Info("config") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) @@ -137,6 +131,40 @@ func VMCheckHardware(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) if ramReservation != 1024 { t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) } - - return nil +} + +func VMCheckTemplate(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { + switch vmInfo, err := vm.Info("config.template"); { + case err != nil: + t.Errorf("Cannot read VM properties: %v", err) + case !vmInfo.Config.Template: + t.Error("Not a template") + } +} + +func VMCheckDatastore(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine, name string) { + vmInfo, err := vm.Info("datastore") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + n := len(vmInfo.Datastore) + if n != 1 { + t.Fatalf("VM should have 1 datastore, got %v", n) + } + + ds := d.NewDatastore(&vmInfo.Datastore[0]) + CheckDatastoreName(t, ds, name) +} + +func VMCheckSnapshor(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { + vmInfo, err := vm.Info("layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + layers := len(vmInfo.LayoutEx.Disk[0].Chain) + if layers != 2 { + t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) + } } diff --git a/driver/testing/vm_acc_test.go b/driver/testing/vm_acc_test.go index 7f93ce59d..b216a7c48 100644 --- a/driver/testing/vm_acc_test.go +++ b/driver/testing/vm_acc_test.go @@ -107,25 +107,20 @@ func TestVMAcc_running(t *testing.T) { } func TestVMAcc_running_snapshot(t *testing.T) { - _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + d, vm, vmName, vmDestructor := initVMAccTest(t) defer vmDestructor() stopper := startVM(t, vm, vmName) defer stopper() vm.CreateSnapshot("test-snapshot") - // TODO: check + VMCheckSnapshor(t, d, vm) } func TestVMAcc_template(t *testing.T) { - _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + d, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) defer vmDestructor() vm.ConvertToTemplate() - switch info, err := vm.Info("config"); { - case err != nil: - t.Fatalf("Cannot read VM properties for '%v': %v", vmName, err) - case !info.Config.Template: - t.Fatalf("'%v' seems not to be a template", vmName) - } + VMCheckTemplate(t, d, vm) } From dc5a2e52cd37eab787a305afd8c9d5f227769458 Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Thu, 26 Oct 2017 00:38:33 +0300 Subject: [PATCH 093/266] Simplify datastore test --- driver/testing/datastore_acc_test.go | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/driver/testing/datastore_acc_test.go b/driver/testing/datastore_acc_test.go index 5434e3730..ca0bcb726 100644 --- a/driver/testing/datastore_acc_test.go +++ b/driver/testing/datastore_acc_test.go @@ -2,29 +2,17 @@ package testing import ( "testing" + "github.com/vmware/govmomi/vim25/mo" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) -var infoParams = [][]string { - //{}, // FIXME: Doesn't work - //{"*"}, // FIXME: Doesn't work - {"host", "vm"}, // TODO: choose something more meaningful -} - -func TestDatastore(t *testing.T) { +func TestDatastoreAcc(t *testing.T) { initDriverAcceptanceTest(t) d := NewTestDriver(t) ds, err := d.FindDatastore(DefaultDatastore) if err != nil { - t.Fatalf("`FindDatatore` can't find default datastore '%v'. Error: %v", - DefaultDatastore, err) + t.Fatalf("Cannot find default datastore '%v': %v", DefaultDatastore, err) } - for _, params := range infoParams { - _, err := ds.Info(params...) - if err != nil { - t.Errorf("Cannot read datastore properties with parameters %v: %v", - params, err) - } - } - // TODO: add more checks + CheckDatastoreName(t, ds, DefaultDatastore) } From d33ffc178d80b860d8f38dfa5c597a76e65f9af9 Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Thu, 26 Oct 2017 00:51:54 +0300 Subject: [PATCH 094/266] Add an acceptance test for `driver.ResourcePool` --- builder_acc_test.go | 43 ++++++++++-------------- driver/testing/config.go | 27 ++++++++------- driver/testing/datastore_acc_test.go | 8 ++--- driver/testing/resource_pool_acc_test.go | 14 ++++++++ driver/testing/utility.go | 18 ++++++++-- driver/testing/vm_acc_test.go | 20 +++++------ 6 files changed, 74 insertions(+), 56 deletions(-) create mode 100644 driver/testing/resource_pool_acc_test.go diff --git a/builder_acc_test.go b/builder_acc_test.go index b33de8d95..0d7e77f6c 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -17,7 +17,7 @@ func TestBuilderAcc_default(t *testing.T) { Check: func(artifacts []packer.Artifact) error { d := driverT.NewTestDriver(t) driverT.VMCheckDefault(t, d, getVM(t, d, artifacts), config["vm_name"].(string), - config["host"].(string), driverT.DefaultDatastore) + config["host"].(string), driverT.TestDatastore) return nil }, }) @@ -25,13 +25,13 @@ func TestBuilderAcc_default(t *testing.T) { func defaultConfig() map[string]interface{} { config := map[string]interface{}{ - "vcenter_server": driverT.DefaultVCenterServer, - "username": driverT.DefaultVCenterUsername, - "password": driverT.DefaultVCenterPassword, + "vcenter_server": driverT.TestVCenterServer, + "username": driverT.TestVCenterUsername, + "password": driverT.TestVCenterPassword, "insecure_connection": true, - "template": driverT.DefaultTemplate, - "host": driverT.DefaultHost, + "template": driverT.TestTemplate, + "host": driverT.TestHost, "ssh_username": "root", "ssh_password": "jetbrains", @@ -69,13 +69,13 @@ func TestBuilderAcc_folder(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: folderConfig(), - Check: checkFolder(t, "folder1/folder2"), + Check: checkFolder(t, driverT.TestFolder), }) } func folderConfig() string { config := defaultConfig() - config["folder"] = "folder1/folder2" + config["folder"] = driverT.TestFolder config["linked_clone"] = true // speed up return renderConfig(config) } @@ -107,13 +107,13 @@ func TestBuilderAcc_resourcePool(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: resourcePoolConfig(), - Check: checkResourcePool(t, "pool1/pool2"), + Check: checkResourcePool(t, driverT.TestResourcePool), }) } func resourcePoolConfig() string { config := defaultConfig() - config["resource_pool"] = "pool1/pool2" + config["resource_pool"] = driverT.TestResourcePool config["linked_clone"] = true // speed up return renderConfig(config) } @@ -128,27 +128,18 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { t.Fatalf("Cannot read VM properties: %v", err) } - p := d.NewResourcePool(vmInfo.ResourcePool) - path, err := p.Path() - if err != nil { - t.Fatalf("Cannot read resource pool name: %v", err) - } - if path != pool { - t.Errorf("Wrong folder. expected: %v, got: %v", pool, path) - } - + driverT.CheckResourcePoolPath(t, d.NewResourcePool(vmInfo.ResourcePool), pool) return nil } } -// FIXME: why do we need this??? Why don't perform these checks in checkDefault? func TestBuilderAcc_datastore(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: datastoreConfig(), Check: func(artifacts []packer.Artifact) error { d := driverT.NewTestDriver(t) - driverT.VMCheckDatastore(t, d, getVM(t, d, artifacts), driverT.DefaultDatastore) + driverT.VMCheckDatastore(t, d, getVM(t, d, artifacts), driverT.TestDatastore) return nil }, }) @@ -221,11 +212,11 @@ func TestBuilderAcc_hardware(t *testing.T) { func hardwareConfig() string { config := defaultConfig() - config["CPUs"] = driverT.DefaultCPUs - config["CPU_reservation"] = driverT.DefaultCPUReservation - config["CPU_limit"] = driverT.DefaultCPULimit - config["RAM"] = driverT.DefaultRAM - config["RAM_reservation"] = driverT.DefaultRAMReservation + config["CPUs"] = driverT.TestCPUs + config["CPU_reservation"] = driverT.TestCPUReservation + config["CPU_limit"] = driverT.TestCPULimit + config["RAM"] = driverT.TestRAM + config["RAM_reservation"] = driverT.TestRAMReservation config["linked_clone"] = true // speed up return renderConfig(config) diff --git a/driver/testing/config.go b/driver/testing/config.go index 947aeb90e..9e085dd6c 100644 --- a/driver/testing/config.go +++ b/driver/testing/config.go @@ -4,16 +4,19 @@ package testing const TestEnvVar = "VSPHERE_DRIVER_ACC" // Describe the environment to run tests in -const DefaultDatastore = "datastore1" -const DefaultTemplate = "alpine" -const DefaultHost = "esxi-1.vsphere55.test" -const DefaultVCenterServer = "vcenter.vsphere55.test" -const DefaultVCenterUsername = "root" -const DefaultVCenterPassword = "jetbrains" +const TestDatastore = "datastore1" +const TestTemplate = "alpine" +const TestHost = "esxi-1.vsphere55.test" +const TestVCenterServer = "vcenter.vsphere55.test" +const TestVCenterUsername = "root" +const TestVCenterPassword = "jetbrains" -// Default hardware settings for -const DefaultCPUs = 2 -const DefaultCPUReservation = 1000 -const DefaultCPULimit = 1500 -const DefaultRAM = 2048 -const DefaultRAMReservation = 1024 +// For test of hardware settings +const TestCPUs = 2 +const TestCPUReservation = 1000 +const TestCPULimit = 1500 +const TestRAM = 2048 +const TestRAMReservation = 1024 + +const TestFolder = "folder1/folder2" +const TestResourcePool = "pool1/pool2" diff --git a/driver/testing/datastore_acc_test.go b/driver/testing/datastore_acc_test.go index ca0bcb726..17eecf1ee 100644 --- a/driver/testing/datastore_acc_test.go +++ b/driver/testing/datastore_acc_test.go @@ -2,17 +2,15 @@ package testing import ( "testing" - "github.com/vmware/govmomi/vim25/mo" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) func TestDatastoreAcc(t *testing.T) { initDriverAcceptanceTest(t) d := NewTestDriver(t) - ds, err := d.FindDatastore(DefaultDatastore) + ds, err := d.FindDatastore(TestDatastore) if err != nil { - t.Fatalf("Cannot find default datastore '%v': %v", DefaultDatastore, err) + t.Fatalf("Cannot find the default datastore '%v': %v", TestDatastore, err) } - CheckDatastoreName(t, ds, DefaultDatastore) + CheckDatastoreName(t, ds, TestDatastore) } diff --git a/driver/testing/resource_pool_acc_test.go b/driver/testing/resource_pool_acc_test.go new file mode 100644 index 000000000..7b6177f90 --- /dev/null +++ b/driver/testing/resource_pool_acc_test.go @@ -0,0 +1,14 @@ +package testing + +import "testing" + +func TestResourcePoolAcc(t *testing.T) { + initDriverAcceptanceTest(t) + + d := NewTestDriver(t) + p, err := d.FindResourcePool(TestHost, TestResourcePool) + if err != nil { + t.Fatalf("Cannot find the default resource pool '%v': %v", TestResourcePool, err) + } + CheckResourcePoolPath(t, p, TestResourcePool) +} diff --git a/driver/testing/utility.go b/driver/testing/utility.go index 3c1170ebd..97ea812e6 100644 --- a/driver/testing/utility.go +++ b/driver/testing/utility.go @@ -7,13 +7,14 @@ import ( "os" "testing" "time" + "github.com/vmware/govmomi/govc/pool" ) func NewTestDriver(t *testing.T) *driver.Driver { d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: DefaultVCenterServer, - Username: DefaultVCenterUsername, - Password: DefaultVCenterPassword, + VCenterServer: TestVCenterServer, + Username: TestVCenterUsername, + Password: TestVCenterPassword, InsecureConnection: true, }) if err != nil { @@ -36,6 +37,15 @@ func CheckDatastoreName(t *testing.T, ds *driver.Datastore, name string) { } } +func CheckResourcePoolPath(t *testing.T, p *driver.ResourcePool, pool string) { + switch path, err := p.Path(); { + case err != nil: + t.Errorf("Cannot read resource pool name: %v", err) + case path != pool: + t.Errorf("Wrong folder. expected: %v, got: %v", pool, path) + } +} + func initDriverAcceptanceTest(t *testing.T) { // We only run acceptance tests if an env var is set because they're // slow and require outside configuration. @@ -168,3 +178,5 @@ func VMCheckSnapshor(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) } } + + diff --git a/driver/testing/vm_acc_test.go b/driver/testing/vm_acc_test.go index b216a7c48..594430ff2 100644 --- a/driver/testing/vm_acc_test.go +++ b/driver/testing/vm_acc_test.go @@ -12,19 +12,19 @@ func initVMAccTest(t *testing.T) (d *driver.Driver, vm *driver.VirtualMachine, v initDriverAcceptanceTest(t) d = NewTestDriver(t) - template, err := d.FindVM(DefaultTemplate) // Don't destroy this VM! + template, err := d.FindVM(TestTemplate) // Don't destroy this VM! if err != nil { - t.Fatalf("Cannot find template vm '%v': %v", DefaultTemplate, err) + t.Fatalf("Cannot find template vm '%v': %v", TestTemplate, err) } log.Printf("[DEBUG] Clonning VM") vmName = NewVMName() vm, err = template.Clone(&driver.CloneConfig{ Name: vmName, - Host: DefaultHost, + Host: TestHost, }) if err != nil { - t.Fatalf("Cannot clone vm '%v': %v", DefaultTemplate, err) + t.Fatalf("Cannot clone vm '%v': %v", TestTemplate, err) } vmDestructor = func() { @@ -53,7 +53,7 @@ func TestVMAcc_default(t *testing.T) { // Run checks log.Printf("[DEBUG] Running check function") - VMCheckDefault(t, d, vm, vmName, DefaultHost, DefaultDatastore) + VMCheckDefault(t, d, vm, vmName, TestHost, TestDatastore) } func TestVMAcc_hardware(t *testing.T) { @@ -62,11 +62,11 @@ func TestVMAcc_hardware(t *testing.T) { log.Printf("[DEBUG] Configuring the vm") vm.Configure(&driver.HardwareConfig{ - CPUs: DefaultCPUs, - CPUReservation: DefaultCPUReservation, - CPULimit: DefaultCPULimit, - RAM: DefaultRAM, - RAMReservation: DefaultRAMReservation, + CPUs: TestCPUs, + CPUReservation: TestCPUReservation, + CPULimit: TestCPULimit, + RAM: TestRAM, + RAMReservation: TestRAMReservation, }) log.Printf("[DEBUG] Running check function") VMCheckHardware(t, d, vm) From 23c6951aa411a8a965a99d7c4e462e8e51e460fd Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Thu, 26 Oct 2017 01:04:44 +0300 Subject: [PATCH 095/266] Add an acceptance test for `driver.Folder` --- builder_acc_test.go | 8 +------- driver/testing/folder_acc_test.go | 14 ++++++++++++++ driver/testing/utility.go | 16 ++++++++++++---- 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 driver/testing/folder_acc_test.go diff --git a/builder_acc_test.go b/builder_acc_test.go index 0d7e77f6c..a18e8d5f0 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -91,13 +91,7 @@ func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { } f := d.NewFolder(vmInfo.Parent) - path, err := f.Path() - if err != nil { - t.Fatalf("Cannot read folder name: %v", err) - } - if path != folder { - t.Errorf("Wrong folder. expected: %v, got: %v", folder, path) - } + driverT.CheckFolderPath(t, f, folder) return nil } diff --git a/driver/testing/folder_acc_test.go b/driver/testing/folder_acc_test.go new file mode 100644 index 000000000..fc436d0a1 --- /dev/null +++ b/driver/testing/folder_acc_test.go @@ -0,0 +1,14 @@ +package testing + +import "testing" + +func TestFolderAcc(t *testing.T) { + initDriverAcceptanceTest(t) + + d := NewTestDriver(t) + f, err := d.FindFolder(TestFolder) + if err != nil { + t.Fatalf("Cannot find the default folder '%v': %v", TestFolder, err) + } + CheckFolderPath(t, f, TestFolder) +} diff --git a/driver/testing/utility.go b/driver/testing/utility.go index 97ea812e6..a9d40e9a3 100644 --- a/driver/testing/utility.go +++ b/driver/testing/utility.go @@ -7,7 +7,6 @@ import ( "os" "testing" "time" - "github.com/vmware/govmomi/govc/pool" ) func NewTestDriver(t *testing.T) *driver.Driver { @@ -28,12 +27,12 @@ func NewVMName() string { return fmt.Sprintf("test-%v", rand.Intn(1000)) } -func CheckDatastoreName(t *testing.T, ds *driver.Datastore, name string) { +func CheckDatastoreName(t *testing.T, ds *driver.Datastore, datastore string) { switch info, err := ds.Info("name"); { case err != nil: t.Errorf("Cannot read datastore properties: %v", err) - case info.Name != name: - t.Errorf("Wrong datastore. expected: %v, got: %v", name, info.Name) + case info.Name != datastore: + t.Errorf("Wrong datastore. expected: %v, got: %v", datastore, info.Name) } } @@ -46,6 +45,15 @@ func CheckResourcePoolPath(t *testing.T, p *driver.ResourcePool, pool string) { } } +func CheckFolderPath(t *testing.T, f *driver.Folder, folder string) { + switch path, err := f.Path(); { + case err != nil: + t.Fatalf("Cannot read folder name: %v", err) + case path != folder: + t.Errorf("Wrong folder. expected: %v, got: %v", folder, path) + } +} + func initDriverAcceptanceTest(t *testing.T) { // We only run acceptance tests if an env var is set because they're // slow and require outside configuration. From 3cb2185c53e6558b17c44627d2957f31f04de641 Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Thu, 26 Oct 2017 01:07:25 +0300 Subject: [PATCH 096/266] Add an acceptance test for `driver.Host` --- driver/testing/host_acc_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 driver/testing/host_acc_test.go diff --git a/driver/testing/host_acc_test.go b/driver/testing/host_acc_test.go new file mode 100644 index 000000000..247d3cdf6 --- /dev/null +++ b/driver/testing/host_acc_test.go @@ -0,0 +1,21 @@ +package testing + +import ( + "testing" +) + +func TestHostAcc(t *testing.T) { + initDriverAcceptanceTest(t) + + d := NewTestDriver(t) + host, err := d.FindHost(TestHost) + if err != nil { + t.Fatalf("Cannot find the default datastore '%v': %v", TestDatastore, err) + } + switch info, err := host.Info("name"); { + case err != nil: + t.Errorf("Cannot read datastore properties: %v", err) + case info.Name != TestHost: + t.Errorf("Wrong datastore. expected: %v, got: %v", TestHost, info.Name) + } +} From c41ee015379747afaa1100c897bcb9af43b5922b Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Thu, 26 Oct 2017 19:15:54 +0300 Subject: [PATCH 097/266] Correct some error messages in tests --- driver/testing/host_acc_test.go | 6 +++--- driver/testing/utility.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/driver/testing/host_acc_test.go b/driver/testing/host_acc_test.go index 247d3cdf6..92b08cf69 100644 --- a/driver/testing/host_acc_test.go +++ b/driver/testing/host_acc_test.go @@ -10,12 +10,12 @@ func TestHostAcc(t *testing.T) { d := NewTestDriver(t) host, err := d.FindHost(TestHost) if err != nil { - t.Fatalf("Cannot find the default datastore '%v': %v", TestDatastore, err) + t.Fatalf("Cannot find the default host '%v': %v", TestDatastore, err) } switch info, err := host.Info("name"); { case err != nil: - t.Errorf("Cannot read datastore properties: %v", err) + t.Errorf("Cannot read host properties: %v", err) case info.Name != TestHost: - t.Errorf("Wrong datastore. expected: %v, got: %v", TestHost, info.Name) + t.Errorf("Wrong host name: expected '%v', got: '%v'", TestHost, info.Name) } } diff --git a/driver/testing/utility.go b/driver/testing/utility.go index a9d40e9a3..96d210370 100644 --- a/driver/testing/utility.go +++ b/driver/testing/utility.go @@ -32,25 +32,25 @@ func CheckDatastoreName(t *testing.T, ds *driver.Datastore, datastore string) { case err != nil: t.Errorf("Cannot read datastore properties: %v", err) case info.Name != datastore: - t.Errorf("Wrong datastore. expected: %v, got: %v", datastore, info.Name) + t.Errorf("Wrong name: expected '%v', got: '%v'", datastore, info.Name) } } func CheckResourcePoolPath(t *testing.T, p *driver.ResourcePool, pool string) { switch path, err := p.Path(); { case err != nil: - t.Errorf("Cannot read resource pool name: %v", err) + t.Errorf("Cannot read resource pool path: %v", err) case path != pool: - t.Errorf("Wrong folder. expected: %v, got: %v", pool, path) + t.Errorf("Wrong name: expected '%v', got: '%v'", pool, path) } } func CheckFolderPath(t *testing.T, f *driver.Folder, folder string) { switch path, err := f.Path(); { case err != nil: - t.Fatalf("Cannot read folder name: %v", err) + t.Fatalf("Cannot read folder path: %v", err) case path != folder: - t.Errorf("Wrong folder. expected: %v, got: %v", folder, path) + t.Errorf("Wrong path: expected '%v', got: '%v'", folder, path) } } From 24805991a6c5ebcd9d7f79bb5b834e11586eae00 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Mon, 6 Nov 2017 17:40:44 +0300 Subject: [PATCH 098/266] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 052d07552..ab029b391 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSp - Official vCenter API is used, no ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) is required ## Usage -* Download the plugin from [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page -* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply put it into the same directory with configuration files +* Download the plugin from [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page. +* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply put it into the same directory with configuration files. On Linux and macOS run `chmod +x` on the plugin binary. ## Minimal Example From 7794c149a13c6aa1691b77056cc41ff98eb10108 Mon Sep 17 00:00:00 2001 From: Andrey Tonkikh Date: Wed, 8 Nov 2017 19:47:29 +0300 Subject: [PATCH 099/266] Inline test config --- builder_acc_test.go | 32 ++++++++++++------------ driver/testing/config.go | 22 ---------------- driver/testing/datastore_acc_test.go | 6 ++--- driver/testing/folder_acc_test.go | 6 ++--- driver/testing/host_acc_test.go | 9 ++++--- driver/testing/resource_pool_acc_test.go | 6 ++--- driver/testing/utility.go | 3 ++- driver/testing/vm_acc_test.go | 22 ++++++++-------- 8 files changed, 44 insertions(+), 62 deletions(-) delete mode 100644 driver/testing/config.go diff --git a/builder_acc_test.go b/builder_acc_test.go index a18e8d5f0..f18caaab0 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -17,7 +17,7 @@ func TestBuilderAcc_default(t *testing.T) { Check: func(artifacts []packer.Artifact) error { d := driverT.NewTestDriver(t) driverT.VMCheckDefault(t, d, getVM(t, d, artifacts), config["vm_name"].(string), - config["host"].(string), driverT.TestDatastore) + config["host"].(string), "datastore1") return nil }, }) @@ -25,13 +25,13 @@ func TestBuilderAcc_default(t *testing.T) { func defaultConfig() map[string]interface{} { config := map[string]interface{}{ - "vcenter_server": driverT.TestVCenterServer, - "username": driverT.TestVCenterUsername, - "password": driverT.TestVCenterPassword, + "vcenter_server": "vcenter.vsphere55.test", + "username": "root", + "password": "jetbrains", "insecure_connection": true, - "template": driverT.TestTemplate, - "host": driverT.TestHost, + "template": "alpine", + "host": "esxi-1.vsphere55.test", "ssh_username": "root", "ssh_password": "jetbrains", @@ -69,13 +69,13 @@ func TestBuilderAcc_folder(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: folderConfig(), - Check: checkFolder(t, driverT.TestFolder), + Check: checkFolder(t, "folder1/folder2"), }) } func folderConfig() string { config := defaultConfig() - config["folder"] = driverT.TestFolder + config["folder"] = "folder1/folder2" config["linked_clone"] = true // speed up return renderConfig(config) } @@ -101,13 +101,13 @@ func TestBuilderAcc_resourcePool(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: resourcePoolConfig(), - Check: checkResourcePool(t, driverT.TestResourcePool), + Check: checkResourcePool(t, "pool1/pool2"), }) } func resourcePoolConfig() string { config := defaultConfig() - config["resource_pool"] = driverT.TestResourcePool + config["resource_pool"] = "pool1/pool2" config["linked_clone"] = true // speed up return renderConfig(config) } @@ -133,7 +133,7 @@ func TestBuilderAcc_datastore(t *testing.T) { Template: datastoreConfig(), Check: func(artifacts []packer.Artifact) error { d := driverT.NewTestDriver(t) - driverT.VMCheckDatastore(t, d, getVM(t, d, artifacts), driverT.TestDatastore) + driverT.VMCheckDatastore(t, d, getVM(t, d, artifacts), "datastore1") return nil }, }) @@ -206,11 +206,11 @@ func TestBuilderAcc_hardware(t *testing.T) { func hardwareConfig() string { config := defaultConfig() - config["CPUs"] = driverT.TestCPUs - config["CPU_reservation"] = driverT.TestCPUReservation - config["CPU_limit"] = driverT.TestCPULimit - config["RAM"] = driverT.TestRAM - config["RAM_reservation"] = driverT.TestRAMReservation + config["CPUs"] = 2 + config["CPU_reservation"] = 1000 + config["CPU_limit"] = 1500 + config["RAM"] = 2048 + config["RAM_reservation"] = 1024 config["linked_clone"] = true // speed up return renderConfig(config) diff --git a/driver/testing/config.go b/driver/testing/config.go deleted file mode 100644 index 9e085dd6c..000000000 --- a/driver/testing/config.go +++ /dev/null @@ -1,22 +0,0 @@ -package testing - -// Defines whether acceptance tests should be run -const TestEnvVar = "VSPHERE_DRIVER_ACC" - -// Describe the environment to run tests in -const TestDatastore = "datastore1" -const TestTemplate = "alpine" -const TestHost = "esxi-1.vsphere55.test" -const TestVCenterServer = "vcenter.vsphere55.test" -const TestVCenterUsername = "root" -const TestVCenterPassword = "jetbrains" - -// For test of hardware settings -const TestCPUs = 2 -const TestCPUReservation = 1000 -const TestCPULimit = 1500 -const TestRAM = 2048 -const TestRAMReservation = 1024 - -const TestFolder = "folder1/folder2" -const TestResourcePool = "pool1/pool2" diff --git a/driver/testing/datastore_acc_test.go b/driver/testing/datastore_acc_test.go index 17eecf1ee..4643c0a5c 100644 --- a/driver/testing/datastore_acc_test.go +++ b/driver/testing/datastore_acc_test.go @@ -8,9 +8,9 @@ func TestDatastoreAcc(t *testing.T) { initDriverAcceptanceTest(t) d := NewTestDriver(t) - ds, err := d.FindDatastore(TestDatastore) + ds, err := d.FindDatastore("datastore1") if err != nil { - t.Fatalf("Cannot find the default datastore '%v': %v", TestDatastore, err) + t.Fatalf("Cannot find the default datastore '%v': %v", "datastore1", err) } - CheckDatastoreName(t, ds, TestDatastore) + CheckDatastoreName(t, ds, "datastore1") } diff --git a/driver/testing/folder_acc_test.go b/driver/testing/folder_acc_test.go index fc436d0a1..8555521fa 100644 --- a/driver/testing/folder_acc_test.go +++ b/driver/testing/folder_acc_test.go @@ -6,9 +6,9 @@ func TestFolderAcc(t *testing.T) { initDriverAcceptanceTest(t) d := NewTestDriver(t) - f, err := d.FindFolder(TestFolder) + f, err := d.FindFolder("folder1/folder2") if err != nil { - t.Fatalf("Cannot find the default folder '%v': %v", TestFolder, err) + t.Fatalf("Cannot find the default folder '%v': %v", "folder1/folder2", err) } - CheckFolderPath(t, f, TestFolder) + CheckFolderPath(t, f, "folder1/folder2") } diff --git a/driver/testing/host_acc_test.go b/driver/testing/host_acc_test.go index 92b08cf69..a9c35af7e 100644 --- a/driver/testing/host_acc_test.go +++ b/driver/testing/host_acc_test.go @@ -6,16 +6,17 @@ import ( func TestHostAcc(t *testing.T) { initDriverAcceptanceTest(t) + hostName := "esxi-1.vsphere55.test" d := NewTestDriver(t) - host, err := d.FindHost(TestHost) + host, err := d.FindHost(hostName) if err != nil { - t.Fatalf("Cannot find the default host '%v': %v", TestDatastore, err) + t.Fatalf("Cannot find the default host '%v': %v", "datastore1", err) } switch info, err := host.Info("name"); { case err != nil: t.Errorf("Cannot read host properties: %v", err) - case info.Name != TestHost: - t.Errorf("Wrong host name: expected '%v', got: '%v'", TestHost, info.Name) + case info.Name != hostName: + t.Errorf("Wrong host name: expected '%v', got: '%v'", hostName, info.Name) } } diff --git a/driver/testing/resource_pool_acc_test.go b/driver/testing/resource_pool_acc_test.go index 7b6177f90..b242e0b08 100644 --- a/driver/testing/resource_pool_acc_test.go +++ b/driver/testing/resource_pool_acc_test.go @@ -6,9 +6,9 @@ func TestResourcePoolAcc(t *testing.T) { initDriverAcceptanceTest(t) d := NewTestDriver(t) - p, err := d.FindResourcePool(TestHost, TestResourcePool) + p, err := d.FindResourcePool("esxi-1.vsphere55.test", "pool1/pool2") if err != nil { - t.Fatalf("Cannot find the default resource pool '%v': %v", TestResourcePool, err) + t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) } - CheckResourcePoolPath(t, p, TestResourcePool) + CheckResourcePoolPath(t, p, "pool1/pool2") } diff --git a/driver/testing/utility.go b/driver/testing/utility.go index 96d210370..707fc4d18 100644 --- a/driver/testing/utility.go +++ b/driver/testing/utility.go @@ -152,7 +152,8 @@ func VMCheckHardware(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) } func VMCheckTemplate(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { - switch vmInfo, err := vm.Info("config.template"); { + vmInfo, err := vm.Info("config.template") + switch { case err != nil: t.Errorf("Cannot read VM properties: %v", err) case !vmInfo.Config.Template: diff --git a/driver/testing/vm_acc_test.go b/driver/testing/vm_acc_test.go index 594430ff2..b360c0dfc 100644 --- a/driver/testing/vm_acc_test.go +++ b/driver/testing/vm_acc_test.go @@ -10,21 +10,23 @@ import ( func initVMAccTest(t *testing.T) (d *driver.Driver, vm *driver.VirtualMachine, vmName string, vmDestructor func()) { initDriverAcceptanceTest(t) + + templateName := "alpine" d = NewTestDriver(t) - template, err := d.FindVM(TestTemplate) // Don't destroy this VM! + template, err := d.FindVM(templateName) // Don't destroy this VM! if err != nil { - t.Fatalf("Cannot find template vm '%v': %v", TestTemplate, err) + t.Fatalf("Cannot find template vm '%v': %v", templateName, err) } log.Printf("[DEBUG] Clonning VM") vmName = NewVMName() vm, err = template.Clone(&driver.CloneConfig{ Name: vmName, - Host: TestHost, + Host: "esxi-1.vsphere55.test", }) if err != nil { - t.Fatalf("Cannot clone vm '%v': %v", TestTemplate, err) + t.Fatalf("Cannot clone vm '%v': %v", templateName, err) } vmDestructor = func() { @@ -53,7 +55,7 @@ func TestVMAcc_default(t *testing.T) { // Run checks log.Printf("[DEBUG] Running check function") - VMCheckDefault(t, d, vm, vmName, TestHost, TestDatastore) + VMCheckDefault(t, d, vm, vmName, "esxi-1.vsphere55.test", "datastore1") } func TestVMAcc_hardware(t *testing.T) { @@ -62,11 +64,11 @@ func TestVMAcc_hardware(t *testing.T) { log.Printf("[DEBUG] Configuring the vm") vm.Configure(&driver.HardwareConfig{ - CPUs: TestCPUs, - CPUReservation: TestCPUReservation, - CPULimit: TestCPULimit, - RAM: TestRAM, - RAMReservation: TestRAMReservation, + CPUs: 2, + CPUReservation: 1000, + CPULimit: 1500, + RAM: 2048, + RAMReservation: 1024, }) log.Printf("[DEBUG] Running check function") VMCheckHardware(t, d, vm) From 6e3e92e356e300391415812675864bb8c70a05e1 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 14 Nov 2017 00:02:46 +0300 Subject: [PATCH 100/266] Remove driver test utility. Move driver tests to the driver folder --- builder_acc_test.go | 253 ++++++++++++++---- driver/datastore_acc_test.go | 22 ++ driver/driver_test.go | 46 ++++ driver/folder_acc_test.go | 20 ++ driver/{testing => }/host_acc_test.go | 15 +- .../{testing => }/resource_pool_acc_test.go | 13 +- driver/testing/datastore_acc_test.go | 16 -- driver/testing/folder_acc_test.go | 14 - driver/testing/utility.go | 191 ------------- driver/testing/vm_acc_test.go | 128 --------- driver/vm_acc_test.go | 221 +++++++++++++++ 11 files changed, 527 insertions(+), 412 deletions(-) create mode 100644 driver/datastore_acc_test.go create mode 100644 driver/driver_test.go create mode 100644 driver/folder_acc_test.go rename driver/{testing => }/host_acc_test.go (57%) rename driver/{testing => }/resource_pool_acc_test.go (52%) delete mode 100644 driver/testing/datastore_acc_test.go delete mode 100644 driver/testing/folder_acc_test.go delete mode 100644 driver/testing/utility.go delete mode 100644 driver/testing/vm_acc_test.go create mode 100644 driver/vm_acc_test.go diff --git a/builder_acc_test.go b/builder_acc_test.go index f18caaab0..8ac8f25bf 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -1,12 +1,13 @@ package main import ( - "encoding/json" - builderT "github.com/hashicorp/packer/helper/builder/testing" - "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - driverT "github.com/jetbrains-infra/packer-builder-vsphere/driver/testing" "testing" + builderT "github.com/hashicorp/packer/helper/builder/testing" + "fmt" + "github.com/hashicorp/packer/packer" + "encoding/json" + "math/rand" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) func TestBuilderAcc_default(t *testing.T) { @@ -14,12 +15,7 @@ func TestBuilderAcc_default(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: renderConfig(config), - Check: func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - driverT.VMCheckDefault(t, d, getVM(t, d, artifacts), config["vm_name"].(string), - config["host"].(string), "datastore1") - return nil - }, + Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), }) } @@ -36,10 +32,69 @@ func defaultConfig() map[string]interface{} { "ssh_username": "root", "ssh_password": "jetbrains", } - config["vm_name"] = driverT.NewVMName() + config["vm_name"] = fmt.Sprintf("test-%v", rand.Intn(1000)) return config } +func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + vm := getVM(t, d, artifacts) + + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Name != name { + t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) + } + + f := d.NewFolder(vmInfo.Parent) + folderPath, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + + h := d.NewHost(vmInfo.Runtime.Host) + hostInfo, err := h.Info("name") + if err != nil { + t.Fatal("Cannot read host properties: ", err) + } + if hostInfo.Name != host { + t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) + } + + p := d.NewResourcePool(vmInfo.ResourcePool) + poolPath, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if poolPath != "" { + t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) + } + + dsr := vmInfo.Datastore[0].Reference() + ds := d.NewDatastore(&dsr) + dsInfo, err := ds.Info("name") + if err != nil { + t.Fatal("Cannot read datastore properties: ", err) + } + if dsInfo.Name != datastore { + t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) + } + + if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { + t.Error("Not a full clone") + } + + return nil + } +} + func TestBuilderAcc_artifact(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ @@ -80,23 +135,6 @@ func folderConfig() string { return renderConfig(config) } -func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - vm := getVM(t, d, artifacts) - - vmInfo, err := vm.Info("parent") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - f := d.NewFolder(vmInfo.Parent) - driverT.CheckFolderPath(t, f, folder) - - return nil - } -} - func TestBuilderAcc_resourcePool(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -114,7 +152,7 @@ func resourcePoolConfig() string { func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) + d := testConn(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("resourcePool") @@ -122,7 +160,15 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { t.Fatalf("Cannot read VM properties: %v", err) } - driverT.CheckResourcePoolPath(t, d.NewResourcePool(vmInfo.ResourcePool), pool) + p := d.NewResourcePool(vmInfo.ResourcePool) + path, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if path != pool { + t.Errorf("Wrong folder. expected: %v, got: %v", pool, path) + } + return nil } } @@ -131,11 +177,7 @@ func TestBuilderAcc_datastore(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: datastoreConfig(), - Check: func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - driverT.VMCheckDatastore(t, d, getVM(t, d, artifacts), "datastore1") - return nil - }, + Check: checkDatastore(t, "datastore1"), // on esxi-1.vsphere55.test }) } @@ -145,6 +187,34 @@ func datastoreConfig() string { return renderConfig(config) } +func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + vm := getVM(t, d, artifacts) + + vmInfo, err := vm.Info("datastore") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + n := len(vmInfo.Datastore) + if n != 1 { + t.Fatalf("VM should have 1 datastore, got %v", n) + } + + ds := d.NewDatastore(&vmInfo.Datastore[0]) + info, err := ds.Info("name") + if err != nil { + t.Fatalf("Cannot read datastore properties: %v", err) + } + if info.Name != name { + t.Errorf("Wrong datastore. expected: %v, got: %v", name, info.Name) + } + + return nil + } +} + func TestBuilderAcc_multipleDatastores(t *testing.T) { t.Skip("test must fail") @@ -176,7 +246,7 @@ func linkedCloneConfig() string { func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) + d := testConn(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("layoutEx.disk") @@ -196,11 +266,7 @@ func TestBuilderAcc_hardware(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: hardwareConfig(), - Check: func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - driverT.VMCheckHardware(t, d, getVM(t, d, artifacts)) - return nil - }, + Check: checkHardware(t), }) } @@ -216,6 +282,45 @@ func hardwareConfig() string { return renderConfig(config) } +func checkHardware(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + cpuSockets := vmInfo.Config.Hardware.NumCPU + if cpuSockets != 2 { + t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) + } + + cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + if cpuReservation != 1000 { + t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) + } + + cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + if cpuLimit != 1500 { + t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) + } + + ram := vmInfo.Config.Hardware.MemoryMB + if ram != 2048 { + t.Errorf("VM should have 2048 MB of RAM, got %v", ram) + } + + ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + if ramReservation != 1024 { + t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) + } + + return nil + } +} + func TestBuilderAcc_RAMReservation(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -234,7 +339,7 @@ func RAMReservationConfig() string { func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) + d := testConn(t) vm := getVM(t, d, artifacts) vmInfo, err := vm.Info("config") @@ -269,11 +374,7 @@ func TestBuilderAcc_snapshot(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: snapshotConfig(), - Check: func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - driverT.VMCheckSnapshor(t, d, getVM(t, d, artifacts)) - return nil - }, + Check: checkSnapshot(t), }) } @@ -283,15 +384,30 @@ func snapshotConfig() string { return renderConfig(config) } +func checkSnapshot(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + vmInfo, err := vm.Info("layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + layers := len(vmInfo.LayoutEx.Disk[0].Chain) + if layers != 2 { + t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) + } + + return nil + } +} + func TestBuilderAcc_template(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: templateConfig(), - Check: func(artifacts []packer.Artifact) error { - d := driverT.NewTestDriver(t) - driverT.VMCheckTemplate(t, d, getVM(t, d, artifacts)) - return nil - }, + Check: checkTemplate(t), }) } @@ -302,6 +418,24 @@ func templateConfig() string { return renderConfig(config) } +func checkTemplate(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + + vm := getVM(t, d, artifacts) + vmInfo, err := vm.Info("config.template") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Config.Template != true { + t.Error("Not a template") + } + + return nil + } +} + func renderConfig(config map[string]interface{}) string { t := map[string][]map[string]interface{}{ "builders": { @@ -318,6 +452,19 @@ func renderConfig(config map[string]interface{}) string { return string(j) } +func testConn(t *testing.T) *driver.Driver { + d, err := driver.NewDriver(&driver.ConnectConfig{ + VCenterServer: "vcenter.vsphere55.test", + Username: "root", + Password: "jetbrains", + InsecureConnection: true, + }) + if err != nil { + t.Fatal("Cannot connect: ", err) + } + return d +} + func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.VirtualMachine { artifactRaw := artifacts[0] artifact, _ := artifactRaw.(*Artifact) diff --git a/driver/datastore_acc_test.go b/driver/datastore_acc_test.go new file mode 100644 index 000000000..290ae3342 --- /dev/null +++ b/driver/datastore_acc_test.go @@ -0,0 +1,22 @@ +package driver + +import ( + "testing" +) + +func TestDatastoreAcc(t *testing.T) { + initDriverAcceptanceTest(t) + + d := newTestDriver(t) + ds, err := d.FindDatastore("datastore1") + if err != nil { + t.Fatalf("Cannot find the default datastore '%v': %v", "datastore1", err) + } + info, err := ds.Info("name") + if err != nil { + t.Fatalf("Cannot read datastore properties: %v", err) + } + if info.Name != "datastore1" { + t.Errorf("Wrong datastore. expected: 'datastore1', got: '%v'", info.Name) + } +} diff --git a/driver/driver_test.go b/driver/driver_test.go new file mode 100644 index 000000000..e7e347e68 --- /dev/null +++ b/driver/driver_test.go @@ -0,0 +1,46 @@ +package driver + +import ( + "os" + "fmt" + "testing" + "time" + "math/rand" +) + +// Defines whether acceptance tests should be run +const TestEnvVar = "VSPHERE_DRIVER_ACC" +const hostName = "esxi-1.vsphere55.test" + +func newTestDriver(t *testing.T) *Driver { + d, err := NewDriver(&ConnectConfig{ + VCenterServer: "vcenter.vsphere55.test", + Username: "root", + Password: "jetbrains", + InsecureConnection: true, + }) + if err != nil { + t.Fatalf("Cannot connect: %v", err) + } + return d +} + +func newVMName() string { + rand.Seed(time.Now().UTC().UnixNano()) + return fmt.Sprintf("test-%v", rand.Intn(1000)) +} + +func initDriverAcceptanceTest(t *testing.T) { + // We only run acceptance tests if an env var is set because they're + // slow and require outside configuration. + if os.Getenv(TestEnvVar) == "" { + t.Skip(fmt.Sprintf( + "Acceptance tests skipped unless env '%s' set", + TestEnvVar)) + } + + // We require verbose mode so that the user knows what is going on. + if !testing.Verbose() { + t.Fatal("Acceptance tests must be run with the -v flag on tests") + } +} diff --git a/driver/folder_acc_test.go b/driver/folder_acc_test.go new file mode 100644 index 000000000..220f1195e --- /dev/null +++ b/driver/folder_acc_test.go @@ -0,0 +1,20 @@ +package driver + +import "testing" + +func TestFolderAcc(t *testing.T) { + initDriverAcceptanceTest(t) + + d := newTestDriver(t) + f, err := d.FindFolder("folder1/folder2") + if err != nil { + t.Fatalf("Cannot find the default folder '%v': %v", "folder1/folder2", err) + } + path, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if path != "folder1/folder2" { + t.Errorf("Wrong folder. expected: 'folder1/folder2', got: '%v'", path) + } +} diff --git a/driver/testing/host_acc_test.go b/driver/host_acc_test.go similarity index 57% rename from driver/testing/host_acc_test.go rename to driver/host_acc_test.go index a9c35af7e..bba4da7cf 100644 --- a/driver/testing/host_acc_test.go +++ b/driver/host_acc_test.go @@ -1,4 +1,4 @@ -package testing +package driver import ( "testing" @@ -6,17 +6,18 @@ import ( func TestHostAcc(t *testing.T) { initDriverAcceptanceTest(t) - hostName := "esxi-1.vsphere55.test" - d := NewTestDriver(t) + d := newTestDriver(t) host, err := d.FindHost(hostName) if err != nil { t.Fatalf("Cannot find the default host '%v': %v", "datastore1", err) } - switch info, err := host.Info("name"); { - case err != nil: - t.Errorf("Cannot read host properties: %v", err) - case info.Name != hostName: + + info, err := host.Info("name") + if err != nil { + t.Fatalf("Cannot read host properties: %v", err) + } + if info.Name != hostName { t.Errorf("Wrong host name: expected '%v', got: '%v'", hostName, info.Name) } } diff --git a/driver/testing/resource_pool_acc_test.go b/driver/resource_pool_acc_test.go similarity index 52% rename from driver/testing/resource_pool_acc_test.go rename to driver/resource_pool_acc_test.go index b242e0b08..a1f2b47bd 100644 --- a/driver/testing/resource_pool_acc_test.go +++ b/driver/resource_pool_acc_test.go @@ -1,14 +1,21 @@ -package testing +package driver import "testing" func TestResourcePoolAcc(t *testing.T) { initDriverAcceptanceTest(t) - d := NewTestDriver(t) + d := newTestDriver(t) p, err := d.FindResourcePool("esxi-1.vsphere55.test", "pool1/pool2") if err != nil { t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) } - CheckResourcePoolPath(t, p, "pool1/pool2") + + path, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if path != "pool1/pool2" { + t.Errorf("Wrong folder. expected: 'pool1/pool2', got: '%v'", path) + } } diff --git a/driver/testing/datastore_acc_test.go b/driver/testing/datastore_acc_test.go deleted file mode 100644 index 4643c0a5c..000000000 --- a/driver/testing/datastore_acc_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package testing - -import ( - "testing" -) - -func TestDatastoreAcc(t *testing.T) { - initDriverAcceptanceTest(t) - - d := NewTestDriver(t) - ds, err := d.FindDatastore("datastore1") - if err != nil { - t.Fatalf("Cannot find the default datastore '%v': %v", "datastore1", err) - } - CheckDatastoreName(t, ds, "datastore1") -} diff --git a/driver/testing/folder_acc_test.go b/driver/testing/folder_acc_test.go deleted file mode 100644 index 8555521fa..000000000 --- a/driver/testing/folder_acc_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package testing - -import "testing" - -func TestFolderAcc(t *testing.T) { - initDriverAcceptanceTest(t) - - d := NewTestDriver(t) - f, err := d.FindFolder("folder1/folder2") - if err != nil { - t.Fatalf("Cannot find the default folder '%v': %v", "folder1/folder2", err) - } - CheckFolderPath(t, f, "folder1/folder2") -} diff --git a/driver/testing/utility.go b/driver/testing/utility.go deleted file mode 100644 index 707fc4d18..000000000 --- a/driver/testing/utility.go +++ /dev/null @@ -1,191 +0,0 @@ -package testing - -import ( - "fmt" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "math/rand" - "os" - "testing" - "time" -) - -func NewTestDriver(t *testing.T) *driver.Driver { - d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: TestVCenterServer, - Username: TestVCenterUsername, - Password: TestVCenterPassword, - InsecureConnection: true, - }) - if err != nil { - t.Fatalf("Cannot connect: %v", err) - } - return d -} - -func NewVMName() string { - rand.Seed(time.Now().UTC().UnixNano()) - return fmt.Sprintf("test-%v", rand.Intn(1000)) -} - -func CheckDatastoreName(t *testing.T, ds *driver.Datastore, datastore string) { - switch info, err := ds.Info("name"); { - case err != nil: - t.Errorf("Cannot read datastore properties: %v", err) - case info.Name != datastore: - t.Errorf("Wrong name: expected '%v', got: '%v'", datastore, info.Name) - } -} - -func CheckResourcePoolPath(t *testing.T, p *driver.ResourcePool, pool string) { - switch path, err := p.Path(); { - case err != nil: - t.Errorf("Cannot read resource pool path: %v", err) - case path != pool: - t.Errorf("Wrong name: expected '%v', got: '%v'", pool, path) - } -} - -func CheckFolderPath(t *testing.T, f *driver.Folder, folder string) { - switch path, err := f.Path(); { - case err != nil: - t.Fatalf("Cannot read folder path: %v", err) - case path != folder: - t.Errorf("Wrong path: expected '%v', got: '%v'", folder, path) - } -} - -func initDriverAcceptanceTest(t *testing.T) { - // We only run acceptance tests if an env var is set because they're - // slow and require outside configuration. - if os.Getenv(TestEnvVar) == "" { - t.Skip(fmt.Sprintf( - "Acceptance tests skipped unless env '%s' set", - TestEnvVar)) - } - - // We require verbose mode so that the user knows what is going on. - if !testing.Verbose() { - t.Fatal("Acceptance tests must be run with the -v flag on tests") - } -} - -func VMCheckDefault(t *testing.T, d *driver.Driver, vm *driver.VirtualMachine, - name string, host string, datastore string) { - vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - if vmInfo.Name != name { - t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) - } - - f := d.NewFolder(vmInfo.Parent) - switch folderPath, err := f.Path(); { - case err != nil: - t.Errorf("Cannot read folder name: %v", err) - case folderPath != "": - t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) - } - - h := d.NewHost(vmInfo.Runtime.Host) - switch hostInfo, err := h.Info("name"); { - case err != nil: - t.Errorf("Cannot read host properties: %v", err) - case hostInfo.Name != host: - t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) - } - - p := d.NewResourcePool(vmInfo.ResourcePool) - switch poolPath, err := p.Path(); { - case err != nil: - t.Errorf("Cannot read resource pool name: %v", err) - case poolPath != "": - t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) - } - - - dsr := vmInfo.Datastore[0].Reference() - ds := d.NewDatastore(&dsr) - switch dsInfo, err := ds.Info("name"); { - case err != nil: - t.Errorf("Cannot read datastore properties: %v", err) - case dsInfo.Name != datastore: - t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) - } - - if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { - t.Error("Not a full clone") - } -} - -func VMCheckHardware(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { - vmInfo, err := vm.Info("config") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - cpuSockets := vmInfo.Config.Hardware.NumCPU - if cpuSockets != 2 { - t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) - } - - cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation - if cpuReservation != 1000 { - t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) - } - - cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit - if cpuLimit != 1500 { - t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) - } - - ram := vmInfo.Config.Hardware.MemoryMB - if ram != 2048 { - t.Errorf("VM should have 2048 MB of RAM, got %v", ram) - } - - ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation - if ramReservation != 1024 { - t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) - } -} - -func VMCheckTemplate(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { - vmInfo, err := vm.Info("config.template") - switch { - case err != nil: - t.Errorf("Cannot read VM properties: %v", err) - case !vmInfo.Config.Template: - t.Error("Not a template") - } -} - -func VMCheckDatastore(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine, name string) { - vmInfo, err := vm.Info("datastore") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - n := len(vmInfo.Datastore) - if n != 1 { - t.Fatalf("VM should have 1 datastore, got %v", n) - } - - ds := d.NewDatastore(&vmInfo.Datastore[0]) - CheckDatastoreName(t, ds, name) -} - -func VMCheckSnapshor(t* testing.T, d *driver.Driver, vm *driver.VirtualMachine) { - vmInfo, err := vm.Info("layoutEx.disk") - if err != nil { - t.Fatalf("Cannot read VM properties: %v", err) - } - - layers := len(vmInfo.LayoutEx.Disk[0].Chain) - if layers != 2 { - t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) - } -} - - diff --git a/driver/testing/vm_acc_test.go b/driver/testing/vm_acc_test.go deleted file mode 100644 index b360c0dfc..000000000 --- a/driver/testing/vm_acc_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package testing - -import ( - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "log" - "testing" - "net" - "time" -) - -func initVMAccTest(t *testing.T) (d *driver.Driver, vm *driver.VirtualMachine, vmName string, vmDestructor func()) { - initDriverAcceptanceTest(t) - - templateName := "alpine" - d = NewTestDriver(t) - - template, err := d.FindVM(templateName) // Don't destroy this VM! - if err != nil { - t.Fatalf("Cannot find template vm '%v': %v", templateName, err) - } - - log.Printf("[DEBUG] Clonning VM") - vmName = NewVMName() - vm, err = template.Clone(&driver.CloneConfig{ - Name: vmName, - Host: "esxi-1.vsphere55.test", - }) - if err != nil { - t.Fatalf("Cannot clone vm '%v': %v", templateName, err) - } - - vmDestructor = func() { - log.Printf("[DEBUG] Removing the clone") - if err := vm.Destroy(); err != nil { - t.Errorf("!!! ERROR REMOVING VM '%v': %v!!!", vmName, err) - } - - // Check that the clone is no longer exists - if _, err := d.FindVM(vmName); err == nil { - t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", vmName) - } - } - - return -} - -func TestVMAcc_default(t *testing.T) { - d, vm, vmName, vmDestructor := initVMAccTest(t) - defer vmDestructor() - - // Check that the clone can be found by its name - if _, err := d.FindVM(vmName); err != nil { - t.Errorf("Cannot find created vm '%v': %v", vmName, err) - } - - // Run checks - log.Printf("[DEBUG] Running check function") - VMCheckDefault(t, d, vm, vmName, "esxi-1.vsphere55.test", "datastore1") -} - -func TestVMAcc_hardware(t *testing.T) { - d, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) - defer vmDestructor() - - log.Printf("[DEBUG] Configuring the vm") - vm.Configure(&driver.HardwareConfig{ - CPUs: 2, - CPUReservation: 1000, - CPULimit: 1500, - RAM: 2048, - RAMReservation: 1024, - }) - log.Printf("[DEBUG] Running check function") - VMCheckHardware(t, d, vm) -} - -func startVM(t *testing.T, vm *driver.VirtualMachine, vmName string) (stopper func()) { - log.Printf("[DEBUG] Starting the vm") - if err := vm.PowerOn(); err != nil { - t.Fatalf("Cannot start created vm '%v': %v", vmName, err) - } - return func() { - log.Printf("[DEBUG] Powering off the vm") - if err := vm.PowerOff(); err != nil { - t.Errorf("Cannot power off started vm '%v': %v", vmName, err) - } - } -} - -func TestVMAcc_running(t *testing.T) { - _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) - defer vmDestructor() - - stopper := startVM(t, vm, vmName) - defer stopper() - - switch ip, err := vm.WaitForIP(); { - case err != nil: - t.Errorf("Cannot obtain IP address from created vm '%v': %v", vmName, err) - case net.ParseIP(ip) == nil: - t.Errorf("'%v' is not a valid ip address", ip) - } - - vm.StartShutdown() - log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") - // TODO: there is complex logic in WaitForShutdown. It's better to test it well. It might be reasonable to create - // unit tests for it. - vm.WaitForShutdown(1 * time.Minute) -} - -func TestVMAcc_running_snapshot(t *testing.T) { - d, vm, vmName, vmDestructor := initVMAccTest(t) - defer vmDestructor() - - stopper := startVM(t, vm, vmName) - defer stopper() - - vm.CreateSnapshot("test-snapshot") - VMCheckSnapshor(t, d, vm) -} - -func TestVMAcc_template(t *testing.T) { - d, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) - defer vmDestructor() - - vm.ConvertToTemplate() - VMCheckTemplate(t, d, vm) -} diff --git a/driver/vm_acc_test.go b/driver/vm_acc_test.go new file mode 100644 index 000000000..921aca22a --- /dev/null +++ b/driver/vm_acc_test.go @@ -0,0 +1,221 @@ +package driver + +import ( + "log" + "testing" + "net" + "time" +) + +func initVMAccTest(t *testing.T) (d *Driver, vm *VirtualMachine, vmName string, vmDestructor func()) { + initDriverAcceptanceTest(t) + + templateName := "alpine" + d = newTestDriver(t) + + template, err := d.FindVM(templateName) // Don't destroy this VM! + if err != nil { + t.Fatalf("Cannot find template vm '%v': %v", templateName, err) + } + + log.Printf("[DEBUG] Clonning VM") + vmName = newVMName() + vm, err = template.Clone(&CloneConfig{ + Name: vmName, + Host: hostName, + }) + if err != nil { + t.Fatalf("Cannot clone vm '%v': %v", templateName, err) + } + + vmDestructor = func() { + log.Printf("[DEBUG] Removing the clone") + if err := vm.Destroy(); err != nil { + t.Errorf("!!! ERROR REMOVING VM '%v': %v!!!", vmName, err) + } + + // Check that the clone is no longer exists + if _, err := d.FindVM(vmName); err == nil { + t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", vmName) + } + } + + return +} + +func TestVMAcc_default(t *testing.T) { + d, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + // Check that the clone can be found by its name + if _, err := d.FindVM(vmName); err != nil { + t.Errorf("Cannot find created vm '%v': %v", vmName, err) + } + + // Run checks + log.Printf("[DEBUG] Running checks") + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Name != vmName { + t.Errorf("Invalid VM name: expected '%v', got '%v'", vmName, vmInfo.Name) + } + + f := d.NewFolder(vmInfo.Parent) + folderPath, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + + h := d.NewHost(vmInfo.Runtime.Host) + hostInfo, err := h.Info("name") + if err != nil { + t.Fatal("Cannot read host properties: ", err) + } + if hostInfo.Name != hostName { + t.Errorf("Invalid host name: expected '%v', got '%v'", hostName, hostInfo.Name) + } + + p := d.NewResourcePool(vmInfo.ResourcePool) + poolPath, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if poolPath != "" { + t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) + } + + dsr := vmInfo.Datastore[0].Reference() + ds := d.NewDatastore(&dsr) + dsInfo, err := ds.Info("name") + if err != nil { + t.Fatal("Cannot read datastore properties: ", err) + } + if dsInfo.Name != "datastore1" { + t.Errorf("Invalid datastore name: expected '%v', got '%v'", "datastore1", dsInfo.Name) + } + + if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { + t.Error("Not a full clone") + } +} + +func TestVMAcc_folder(t *testing.T) { + +} + +func TestVMAcc_hardware(t *testing.T) { + _ /*d*/, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + log.Printf("[DEBUG] Configuring the vm") + config := &HardwareConfig{ + CPUs: 2, + CPUReservation: 1000, + CPULimit: 1500, + RAM: 2048, + RAMReservation: 1024, + } + vm.Configure(config) + + log.Printf("[DEBUG] Running checks") + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + cpuSockets := vmInfo.Config.Hardware.NumCPU + if cpuSockets != config.CPUs { + t.Errorf("VM should have %v CPU sockets, got %v", config.CPUs, cpuSockets) + } + + cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + if cpuReservation != config.CPUReservation { + t.Errorf("VM should have CPU reservation for %v Mhz, got %v", config.CPUReservation, cpuReservation) + } + + cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + if cpuLimit != config.CPULimit { + t.Errorf("VM should have CPU reservation for %v Mhz, got %v", config.CPULimit, cpuLimit) + } + + ram := vmInfo.Config.Hardware.MemoryMB + if int64(ram) != config.RAM { + t.Errorf("VM should have %v MB of RAM, got %v", config.RAM, ram) + } + + ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + if ramReservation != config.RAMReservation { + t.Errorf("VM should have RAM reservation for %v MB, got %v", config.RAMReservation, ramReservation) + } +} + +func startVM(t *testing.T, vm *VirtualMachine, vmName string) (stopper func()) { + log.Printf("[DEBUG] Starting the vm") + if err := vm.PowerOn(); err != nil { + t.Fatalf("Cannot start created vm '%v': %v", vmName, err) + } + return func() { + log.Printf("[DEBUG] Powering off the vm") + if err := vm.PowerOff(); err != nil { + t.Errorf("Cannot power off started vm '%v': %v", vmName, err) + } + } +} + +func TestVMAcc_running(t *testing.T) { + _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + stopper := startVM(t, vm, vmName) + defer stopper() + + switch ip, err := vm.WaitForIP(); { + case err != nil: + t.Errorf("Cannot obtain IP address from created vm '%v': %v", vmName, err) + case net.ParseIP(ip) == nil: + t.Errorf("'%v' is not a valid ip address", ip) + } + + vm.StartShutdown() + log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") + vm.WaitForShutdown(1 * time.Minute) +} + +func TestVMAcc_snapshot(t *testing.T) { + _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + stopper := startVM(t, vm, vmName) + defer stopper() + + vm.CreateSnapshot("test-snapshot") + + vmInfo, err := vm.Info("layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + layers := len(vmInfo.LayoutEx.Disk[0].Chain) + if layers != 2 { + t.Errorf("VM should have a single snapshot. expected 2 disk layers, got %v", layers) + } +} + +func TestVMAcc_template(t *testing.T) { + _ /*d*/, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) + defer vmDestructor() + + vm.ConvertToTemplate() + vmInfo, err := vm.Info("config.template") + if err != nil { + t.Errorf("Cannot read VM properties: %v", err) + } else if !vmInfo.Config.Template { + t.Error("Not a template") + } +} From 991e1f8fdb305718e4cff5acf0ce66a351ec0c34 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 14 Nov 2017 00:08:32 +0300 Subject: [PATCH 101/266] Revert f05b1e1. That commit introcude a regression from #30 --- driver/driver.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/driver/driver.go b/driver/driver.go index d2bd048e7..30ddcce72 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -9,6 +9,8 @@ import ( "github.com/vmware/govmomi/object" "time" "github.com/vmware/govmomi/session" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25" ) type Driver struct { @@ -33,13 +35,25 @@ func NewDriver(config *ConnectConfig) (*Driver, error) { if err != nil { return nil, err } - vcenter_url.User = url.UserPassword(config.Username, config.Password) + credentials := url.UserPassword(config.Username, config.Password) + vcenter_url.User = credentials - client, err := govmomi.NewClient(ctx, vcenter_url, config.InsecureConnection) + soapClient := soap.NewClient(vcenter_url, config.InsecureConnection) + vimClient, err := vim25.NewClient(ctx, soapClient) + if err != nil { + return nil, err + } + + vimClient.RoundTripper = session.KeepAlive(vimClient.RoundTripper, 10*time.Minute) + client := &govmomi.Client{ + Client: vimClient, + SessionManager: session.NewManager(vimClient), + } + + err = client.SessionManager.Login(ctx, credentials) if err != nil { return nil, err } - client.RoundTripper = session.KeepAlive(client.RoundTripper, 10*time.Minute) finder := find.NewFinder(client.Client, false) datacenter, err := finder.DatacenterOrDefault(ctx, config.Datacenter) From d1b2b768435d370a978af7b594cd525cb667574c Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 15 Nov 2017 00:19:32 +0300 Subject: [PATCH 102/266] Add more acceptance tests for VM. Merge them into 1 table-driven test --- builder_acc_test.go | 35 +++++-- driver/test.sh | 1 - driver/vm.go | 6 +- driver/vm_acc_test.go | 225 ++++++++++++++++++++++++++---------------- 4 files changed, 174 insertions(+), 93 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 8ac8f25bf..43b496da8 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -1,13 +1,13 @@ package main import ( - "testing" - builderT "github.com/hashicorp/packer/helper/builder/testing" - "fmt" - "github.com/hashicorp/packer/packer" "encoding/json" - "math/rand" + "fmt" + builderT "github.com/hashicorp/packer/helper/builder/testing" + "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "math/rand" + "testing" ) func TestBuilderAcc_default(t *testing.T) { @@ -74,7 +74,7 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil t.Fatalf("Cannot read resource pool name: %v", err) } if poolPath != "" { - t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) + t.Errorf("Invalid resource pool: expected '/', got '%v'", poolPath) } dsr := vmInfo.Datastore[0].Reference() @@ -135,6 +135,29 @@ func folderConfig() string { return renderConfig(config) } +func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := testConn(t) + vm := getVM(t, d, artifacts) + + vmInfo, err := vm.Info("parent") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + f := d.NewFolder(vmInfo.Parent) + path, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if path != folder { + t.Errorf("Wrong folder. expected: %v, got: %v", folder, path) + } + + return nil + } +} + func TestBuilderAcc_resourcePool(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/driver/test.sh b/driver/test.sh index a2bf973cb..14607e82e 100755 --- a/driver/test.sh +++ b/driver/test.sh @@ -1,5 +1,4 @@ #!/bin/sh export VSPHERE_DRIVER_ACC=1 -cd testing go test -v "$@" diff --git a/driver/vm.go b/driver/vm.go index 967264fc9..e5536836e 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -1,12 +1,12 @@ package driver import ( + "errors" + "fmt" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" - "errors" "time" - "fmt" ) type VirtualMachine struct { @@ -88,7 +88,7 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err info, err := host.Info("datastore") if err != nil { - return nil, err + return nil, err } if len(info.Datastore) > 1 { diff --git a/driver/vm_acc_test.go b/driver/vm_acc_test.go index 921aca22a..ccde75b47 100644 --- a/driver/vm_acc_test.go +++ b/driver/vm_acc_test.go @@ -2,65 +2,82 @@ package driver import ( "log" - "testing" "net" + "testing" "time" ) -func initVMAccTest(t *testing.T) (d *Driver, vm *VirtualMachine, vmName string, vmDestructor func()) { +func TestVMAcc_clone(t *testing.T) { initDriverAcceptanceTest(t) - templateName := "alpine" - d = newTestDriver(t) - - template, err := d.FindVM(templateName) // Don't destroy this VM! - if err != nil { - t.Fatalf("Cannot find template vm '%v': %v", templateName, err) + testCases := []struct { + name string + config *CloneConfig + checkFunction func(*testing.T, *VirtualMachine, *CloneConfig) + }{ + {"Default", &CloneConfig{}, cloneDefaultCheck}, + {"LinkedClone", &CloneConfig{LinkedClone: true}, cloneLinkedCloneCheck}, + {"Folder", &CloneConfig{LinkedClone: true, Folder: "folder1/folder2"}, cloneFolderCheck}, + {"ResourcePool", &CloneConfig{LinkedClone: true, ResourcePool: "pool1/pool2"}, cloneResourcePoolCheck}, + {"Configure", &CloneConfig{LinkedClone: true}, configureCheck}, + {"Configure_RAMReserveAll", &CloneConfig{LinkedClone: true}, configureRAMReserveAllCheck}, + {"StartAndStop", &CloneConfig{LinkedClone: true}, startAndStopCheck}, + {"Template", &CloneConfig{LinkedClone: true}, templateCheck}, + {"Snapshot", &CloneConfig{}, snapshotCheck}, } - log.Printf("[DEBUG] Clonning VM") - vmName = newVMName() - vm, err = template.Clone(&CloneConfig{ - Name: vmName, - Host: hostName, - }) - if err != nil { - t.Fatalf("Cannot clone vm '%v': %v", templateName, err) + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tc.config.Host = hostName + tc.config.Name = newVMName() + + templateName := "alpine" + d := newTestDriver(t) + + template, err := d.FindVM(templateName) // Don't destroy this VM! + if err != nil { + t.Fatalf("Cannot find template vm '%v': %v", templateName, err) + } + + log.Printf("[DEBUG] Clonning VM") + vm, err := template.Clone(tc.config) + if err != nil { + t.Fatalf("Cannot clone vm '%v': %v", templateName, err) + } + + defer func() { + log.Printf("[DEBUG] Removing the clone") + if err := vm.Destroy(); err != nil { + t.Errorf("!!! ERROR REMOVING VM '%v': %v!!!", tc.config.Name, err) + } + + // Check that the clone is no longer exists + if _, err := d.FindVM(tc.config.Name); err == nil { + t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", tc.config.Name) + } + }() + + log.Printf("[DEBUG] Running check function") + tc.checkFunction(t, vm, tc.config) + }) } - - vmDestructor = func() { - log.Printf("[DEBUG] Removing the clone") - if err := vm.Destroy(); err != nil { - t.Errorf("!!! ERROR REMOVING VM '%v': %v!!!", vmName, err) - } - - // Check that the clone is no longer exists - if _, err := d.FindVM(vmName); err == nil { - t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", vmName) - } - } - - return } -func TestVMAcc_default(t *testing.T) { - d, vm, vmName, vmDestructor := initVMAccTest(t) - defer vmDestructor() +func cloneDefaultCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { + d := vm.driver // Check that the clone can be found by its name - if _, err := d.FindVM(vmName); err != nil { - t.Errorf("Cannot find created vm '%v': %v", vmName, err) + if _, err := d.FindVM(config.Name); err != nil { + t.Errorf("Cannot find created vm '%v': %v", config.Name, err) } - // Run checks - log.Printf("[DEBUG] Running checks") vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } - if vmInfo.Name != vmName { - t.Errorf("Invalid VM name: expected '%v', got '%v'", vmName, vmInfo.Name) + if vmInfo.Name != config.Name { + t.Errorf("Invalid VM name: expected '%v', got '%v'", config.Name, vmInfo.Name) } f := d.NewFolder(vmInfo.Parent) @@ -87,7 +104,7 @@ func TestVMAcc_default(t *testing.T) { t.Fatalf("Cannot read resource pool name: %v", err) } if poolPath != "" { - t.Error("Invalid resource pool: expected '/', got '%v'", poolPath) + t.Errorf("Invalid resource pool: expected '/', got '%v'", poolPath) } dsr := vmInfo.Datastore[0].Reference() @@ -105,23 +122,16 @@ func TestVMAcc_default(t *testing.T) { } } -func TestVMAcc_folder(t *testing.T) { - -} - -func TestVMAcc_hardware(t *testing.T) { - _ /*d*/, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) - defer vmDestructor() - +func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { log.Printf("[DEBUG] Configuring the vm") - config := &HardwareConfig{ + hwConfig := &HardwareConfig{ CPUs: 2, CPUReservation: 1000, CPULimit: 1500, RAM: 2048, RAMReservation: 1024, } - vm.Configure(config) + vm.Configure(hwConfig) log.Printf("[DEBUG] Running checks") vmInfo, err := vm.Info("config") @@ -130,54 +140,96 @@ func TestVMAcc_hardware(t *testing.T) { } cpuSockets := vmInfo.Config.Hardware.NumCPU - if cpuSockets != config.CPUs { - t.Errorf("VM should have %v CPU sockets, got %v", config.CPUs, cpuSockets) + if cpuSockets != hwConfig.CPUs { + t.Errorf("VM should have %v CPU sockets, got %v", hwConfig.CPUs, cpuSockets) } cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation - if cpuReservation != config.CPUReservation { - t.Errorf("VM should have CPU reservation for %v Mhz, got %v", config.CPUReservation, cpuReservation) + if cpuReservation != hwConfig.CPUReservation { + t.Errorf("VM should have CPU reservation for %v Mhz, got %v", hwConfig.CPUReservation, cpuReservation) } cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit - if cpuLimit != config.CPULimit { - t.Errorf("VM should have CPU reservation for %v Mhz, got %v", config.CPULimit, cpuLimit) + if cpuLimit != hwConfig.CPULimit { + t.Errorf("VM should have CPU reservation for %v Mhz, got %v", hwConfig.CPULimit, cpuLimit) } ram := vmInfo.Config.Hardware.MemoryMB - if int64(ram) != config.RAM { - t.Errorf("VM should have %v MB of RAM, got %v", config.RAM, ram) + if int64(ram) != hwConfig.RAM { + t.Errorf("VM should have %v MB of RAM, got %v", hwConfig.RAM, ram) } ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation - if ramReservation != config.RAMReservation { - t.Errorf("VM should have RAM reservation for %v MB, got %v", config.RAMReservation, ramReservation) + if ramReservation != hwConfig.RAMReservation { + t.Errorf("VM should have RAM reservation for %v MB, got %v", hwConfig.RAMReservation, ramReservation) } } -func startVM(t *testing.T, vm *VirtualMachine, vmName string) (stopper func()) { - log.Printf("[DEBUG] Starting the vm") - if err := vm.PowerOn(); err != nil { - t.Fatalf("Cannot start created vm '%v': %v", vmName, err) +func configureRAMReserveAllCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { + log.Printf("[DEBUG] Configuring the vm") + vm.Configure(&HardwareConfig{ RAMReserveAll: true }) + + log.Printf("[DEBUG] Running checks") + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) } - return func() { - log.Printf("[DEBUG] Powering off the vm") - if err := vm.PowerOff(); err != nil { - t.Errorf("Cannot power off started vm '%v': %v", vmName, err) - } + + if *vmInfo.Config.MemoryReservationLockedToMax != true { + t.Errorf("VM should have all RAM reserved") } } -func TestVMAcc_running(t *testing.T) { - _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) - defer vmDestructor() +func cloneLinkedCloneCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { + vmInfo, err := vm.Info("layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } - stopper := startVM(t, vm, vmName) + if len(vmInfo.LayoutEx.Disk[0].Chain) != 2 { + t.Error("Not a linked clone") + } +} + +func cloneFolderCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { + vmInfo, err := vm.Info("parent") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + f := vm.driver.NewFolder(vmInfo.Parent) + path, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if path != config.Folder { + t.Errorf("Wrong folder. expected: %v, got: %v", config.Folder, path) + } +} + +func cloneResourcePoolCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { + vmInfo, err := vm.Info("resourcePool") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + p := vm.driver.NewResourcePool(vmInfo.ResourcePool) + path, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if path != config.ResourcePool { + t.Errorf("Wrong folder. expected: %v, got: %v", config.ResourcePool, path) + } +} + +func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { + stopper := startVM(t, vm, config.Name) defer stopper() switch ip, err := vm.WaitForIP(); { case err != nil: - t.Errorf("Cannot obtain IP address from created vm '%v': %v", vmName, err) + t.Errorf("Cannot obtain IP address from created vm '%v': %v", config.Name, err) case net.ParseIP(ip) == nil: t.Errorf("'%v' is not a valid ip address", ip) } @@ -187,11 +239,8 @@ func TestVMAcc_running(t *testing.T) { vm.WaitForShutdown(1 * time.Minute) } -func TestVMAcc_snapshot(t *testing.T) { - _ /*d*/, vm, vmName, vmDestructor := initVMAccTest(t) - defer vmDestructor() - - stopper := startVM(t, vm, vmName) +func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { + stopper := startVM(t, vm, config.Name) defer stopper() vm.CreateSnapshot("test-snapshot") @@ -207,10 +256,7 @@ func TestVMAcc_snapshot(t *testing.T) { } } -func TestVMAcc_template(t *testing.T) { - _ /*d*/, vm, _ /*vmName*/, vmDestructor := initVMAccTest(t) - defer vmDestructor() - +func templateCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { vm.ConvertToTemplate() vmInfo, err := vm.Info("config.template") if err != nil { @@ -219,3 +265,16 @@ func TestVMAcc_template(t *testing.T) { t.Error("Not a template") } } + +func startVM(t *testing.T, vm *VirtualMachine, vmName string) (stopper func()) { + log.Printf("[DEBUG] Starting the vm") + if err := vm.PowerOn(); err != nil { + t.Fatalf("Cannot start vm '%v': %v", vmName, err) + } + return func() { + log.Printf("[DEBUG] Powering off the vm") + if err := vm.PowerOff(); err != nil { + t.Errorf("Cannot power off started vm '%v': %v", vmName, err) + } + } +} From 98b2f9943602a99274524ff858dbede3c1c0ce26 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Fri, 1 Dec 2017 14:09:47 +0300 Subject: [PATCH 103/266] Resize disk --- README.md | 1 + driver/vm.go | 40 ++++++++++++++++++++++++++++++++++++++++ step_hardware.go | 2 ++ 3 files changed, 43 insertions(+) diff --git a/README.md b/README.md index ab029b391..64b93dd49 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Hardware customization: * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. * `RAM_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default. * `RAM_reserve_all` - Reserve all available RAM (bool). `false` by default. Cannot be used together with `RAM_reservation`. +* `disk_size` - Change the disk size (in GB). VM should have a single disk. Cannot be used together with `linked_clone`. Provisioning: * `ssh_username` - [**mandatory**] username in guest OS. diff --git a/driver/vm.go b/driver/vm.go index 0457690df..01eab2cd0 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -30,6 +30,7 @@ type HardwareConfig struct { RAM int64 RAMReservation int64 RAMReserveAll bool + DiskSize int64 } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { @@ -165,6 +166,27 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll + if config.DiskSize > 0 { + devices, err := vm.vm.Device(vm.driver.ctx) + if err != nil { + return err + } + + disk, err := findDisk(devices) + if err != nil { + return err + } + + disk.CapacityInKB = config.DiskSize * 1024 * 1024 // Gb + + confSpec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{ + &types.VirtualDeviceConfigSpec{ + Device: disk, + Operation: types.VirtualDeviceConfigSpecOperationEdit, + }, + } + } + task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) if err != nil { return err @@ -173,6 +195,24 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { return err } +func findDisk(devices object.VirtualDeviceList) (*types.VirtualDisk, error) { + var disks []*types.VirtualDisk + for _, device := range devices { + switch d := device.(type) { + case *types.VirtualDisk: + disks = append(disks, d) + } + } + + switch len(disks) { + case 0: + return nil, errors.New("VM has no disks") + case 1: + return disks[0], nil + } + return nil, errors.New("VM has multiple disks") +} + func (vm *VirtualMachine) PowerOn() error { task, err := vm.vm.PowerOn(vm.driver.ctx) if err != nil { diff --git a/step_hardware.go b/step_hardware.go index f62651045..aaf620b50 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -14,6 +14,7 @@ type HardwareConfig struct { RAM int64 `mapstructure:"RAM"` RAMReservation int64 `mapstructure:"RAM_reservation"` RAMReserveAll bool `mapstructure:"RAM_reserve_all"` + DiskSize int64 `mapstructure:"disk_size"` } func (c *HardwareConfig) Prepare() []error { @@ -44,6 +45,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi RAM: s.config.RAM, RAMReservation: s.config.RAMReservation, RAMReserveAll: s.config.RAMReserveAll, + DiskSize: s.config.DiskSize, }) if err != nil { state.Put("error", err) From ede053f6bc2375aaba79a82a01568f2a698177a4 Mon Sep 17 00:00:00 2001 From: Dmitry Tretyakov Date: Tue, 16 Jan 2018 12:32:22 +0100 Subject: [PATCH 104/266] Add ability to control nested hardware virtualization Issue: #45 --- README.md | 1 + driver/vm.go | 2 ++ step_hardware.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 64b93dd49..ca477d2ba 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ Hardware customization: * `RAM_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default. * `RAM_reserve_all` - Reserve all available RAM (bool). `false` by default. Cannot be used together with `RAM_reservation`. * `disk_size` - Change the disk size (in GB). VM should have a single disk. Cannot be used together with `linked_clone`. +* `NestedHV` - Allows to enable nested hardware virtualization for VM. Provisioning: * `ssh_username` - [**mandatory**] username in guest OS. diff --git a/driver/vm.go b/driver/vm.go index 01eab2cd0..4c23904b0 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -31,6 +31,7 @@ type HardwareConfig struct { RAMReservation int64 RAMReserveAll bool DiskSize int64 + NestedHV bool } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { @@ -165,6 +166,7 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { confSpec.MemoryAllocation = &ramSpec confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll + confSpec.NestedHVEnabled = &config.NestedHV if config.DiskSize > 0 { devices, err := vm.vm.Device(vm.driver.ctx) diff --git a/step_hardware.go b/step_hardware.go index aaf620b50..ed7a01c48 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -15,6 +15,7 @@ type HardwareConfig struct { RAMReservation int64 `mapstructure:"RAM_reservation"` RAMReserveAll bool `mapstructure:"RAM_reserve_all"` DiskSize int64 `mapstructure:"disk_size"` + NestedHV bool `mapstructure:"NestedHV"` } func (c *HardwareConfig) Prepare() []error { @@ -46,6 +47,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi RAMReservation: s.config.RAMReservation, RAMReserveAll: s.config.RAMReserveAll, DiskSize: s.config.DiskSize, + NestedHV: s.config.NestedHV, }) if err != nil { state.Put("error", err) From b667f68c327555625b9bd81b753680f7188bd505 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 16 Jan 2018 16:16:08 +0300 Subject: [PATCH 105/266] 'communicator: none' can be used to clone and customize VMs without provisioning --- builder.go | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/builder.go b/builder.go index 132bd9383..8d6ec8fff 100644 --- a/builder.go +++ b/builder.go @@ -31,7 +31,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("hook", hook) state.Put("ui", ui) - steps := []multistep.Step{ + var steps []multistep.Step + + steps = append(steps, &StepConnect{ config: &b.config.ConnectConfig, }, @@ -41,23 +43,31 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepConfigureHardware{ config: &b.config.HardwareConfig, }, - &StepRun{}, - &communicator.StepConnect{ - Config: &b.config.Comm, - Host: commHost, - SSHConfig: sshConfig, - }, - &common.StepProvision{}, - &StepShutdown{ - config: &b.config.ShutdownConfig, - }, + ) + + if b.config.Comm.Type != "none" { + steps = append(steps, + &StepRun{}, + &communicator.StepConnect{ + Config: &b.config.Comm, + Host: commHost, + SSHConfig: sshConfig, + }, + &common.StepProvision{}, + &StepShutdown{ + config: &b.config.ShutdownConfig, + }, + ) + } + + steps = append(steps, &StepCreateSnapshot{ createSnapshot: b.config.CreateSnapshot, }, &StepConvertToTemplate{ ConvertToTemplate: b.config.ConvertToTemplate, }, - } + ) // Run! b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) From 448809aa1ef221b061a319bf188a1ae962fd3b2d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 23 Jan 2018 22:51:05 +0300 Subject: [PATCH 106/266] switch tests to vSphere 6.5 lab --- builder_acc_test.go | 12 ++++++------ driver/driver_test.go | 4 ++-- driver/resource_pool_acc_test.go | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/builder_acc_test.go b/builder_acc_test.go index 43b496da8..ea4f861f0 100644 --- a/builder_acc_test.go +++ b/builder_acc_test.go @@ -21,13 +21,13 @@ func TestBuilderAcc_default(t *testing.T) { func defaultConfig() map[string]interface{} { config := map[string]interface{}{ - "vcenter_server": "vcenter.vsphere55.test", + "vcenter_server": "vcenter.vsphere65.test", "username": "root", "password": "jetbrains", "insecure_connection": true, "template": "alpine", - "host": "esxi-1.vsphere55.test", + "host": "esxi-1.vsphere65.test", "ssh_username": "root", "ssh_password": "jetbrains", @@ -200,13 +200,13 @@ func TestBuilderAcc_datastore(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: datastoreConfig(), - Check: checkDatastore(t, "datastore1"), // on esxi-1.vsphere55.test + Check: checkDatastore(t, "datastore1"), // on esxi-1.vsphere65.test }) } func datastoreConfig() string { config := defaultConfig() - config["template"] = "alpine-host4" // on esxi-4.vsphere55.test + config["template"] = "alpine-host4" // on esxi-4.vsphere65.test return renderConfig(config) } @@ -249,7 +249,7 @@ func TestBuilderAcc_multipleDatastores(t *testing.T) { func multipleDatastoresConfig() string { config := defaultConfig() - config["host"] = "esxi-4.vsphere55.test" // host with 2 datastores + config["host"] = "esxi-4.vsphere65.test" // host with 2 datastores return renderConfig(config) } @@ -477,7 +477,7 @@ func renderConfig(config map[string]interface{}) string { func testConn(t *testing.T) *driver.Driver { d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: "vcenter.vsphere55.test", + VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", InsecureConnection: true, diff --git a/driver/driver_test.go b/driver/driver_test.go index e7e347e68..f6cd6bee5 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -10,11 +10,11 @@ import ( // Defines whether acceptance tests should be run const TestEnvVar = "VSPHERE_DRIVER_ACC" -const hostName = "esxi-1.vsphere55.test" +const hostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { d, err := NewDriver(&ConnectConfig{ - VCenterServer: "vcenter.vsphere55.test", + VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", InsecureConnection: true, diff --git a/driver/resource_pool_acc_test.go b/driver/resource_pool_acc_test.go index a1f2b47bd..5b43bacf1 100644 --- a/driver/resource_pool_acc_test.go +++ b/driver/resource_pool_acc_test.go @@ -6,7 +6,7 @@ func TestResourcePoolAcc(t *testing.T) { initDriverAcceptanceTest(t) d := newTestDriver(t) - p, err := d.FindResourcePool("esxi-1.vsphere55.test", "pool1/pool2") + p, err := d.FindResourcePool("esxi-1.vsphere65.test", "pool1/pool2") if err != nil { t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) } From e91ac3ef1b4267d336f0734e0f6489f7f5a5d7ae Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 24 Jan 2018 14:04:39 +0300 Subject: [PATCH 107/266] Move clone builder to a separate module --- build.sh | 6 ++-- builder.go => clone/builder.go | 32 ++++++++++--------- .../builder_acc_test.go | 9 +++--- builder_test.go => clone/builder_test.go | 2 +- config.go => clone/config.go | 21 ++++++------ config_test.go => clone/config_test.go | 2 +- main.go => clone/main.go | 2 +- step_clone.go => clone/step_clone.go | 2 +- step_hardware.go => clone/step_hardware.go | 2 +- clone/test.sh | 4 +++ artifact.go => common/artifact.go | 2 +- ssh.go => common/ssh.go | 19 +++++------ step_connect.go => common/step_connect.go | 14 ++++---- step_run.go => common/step_run.go | 2 +- step_shutdown.go => common/step_shutdown.go | 14 ++++---- step_snapshot.go => common/step_snapshot.go | 6 ++-- step_template.go => common/step_template.go | 2 +- test.sh | 4 +-- 18 files changed, 77 insertions(+), 68 deletions(-) rename builder.go => clone/builder.go (73%) rename builder_acc_test.go => clone/builder_acc_test.go (98%) rename builder_test.go => clone/builder_test.go (94%) rename config.go => clone/config.go (61%) rename config_test.go => clone/config_test.go (99%) rename main.go => clone/main.go (93%) rename step_clone.go => clone/step_clone.go (99%) rename step_hardware.go => clone/step_hardware.go (99%) create mode 100755 clone/test.sh rename artifact.go => common/artifact.go (97%) rename ssh.go => common/ssh.go (61%) rename step_connect.go => common/step_connect.go (81%) rename step_run.go => common/step_run.go (98%) rename step_shutdown.go => common/step_shutdown.go (86%) rename step_snapshot.go => common/step_snapshot.go (91%) rename step_template.go => common/step_template.go (97%) diff --git a/build.sh b/build.sh index b64c7ec69..efcf7e2b8 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,6 @@ export GOARCH=amd64 mkdir -p bin rm -f bin/* -GOOS=darwin go build -o bin/packer-builder-vsphere.macos -GOOS=linux go build -o bin/packer-builder-vsphere.linux -GOOS=windows go build -o bin/packer-builder-vsphere.exe +GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./clone +GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./clone +GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./clone diff --git a/builder.go b/clone/builder.go similarity index 73% rename from builder.go rename to clone/builder.go index 8d6ec8fff..53f3a1d4b 100644 --- a/builder.go +++ b/clone/builder.go @@ -1,11 +1,12 @@ -package main +package clone import ( "errors" - "github.com/hashicorp/packer/common" + packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/mitchellh/multistep" ) @@ -28,14 +29,15 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("config", b.config) + state.Put("comm", &b.config.Comm) state.Put("hook", hook) state.Put("ui", ui) var steps []multistep.Step steps = append(steps, - &StepConnect{ - config: &b.config.ConnectConfig, + &common.StepConnect{ + Config: &b.config.ConnectConfig, }, &StepCloneVM{ config: &b.config.CloneConfig, @@ -47,30 +49,30 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.Comm.Type != "none" { steps = append(steps, - &StepRun{}, + &common.StepRun{}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: commHost, - SSHConfig: sshConfig, + Host: common.CommHost, + SSHConfig: common.SshConfig, }, - &common.StepProvision{}, - &StepShutdown{ - config: &b.config.ShutdownConfig, + &packerCommon.StepProvision{}, + &common.StepShutdown{ + Config: &b.config.ShutdownConfig, }, ) } steps = append(steps, - &StepCreateSnapshot{ - createSnapshot: b.config.CreateSnapshot, + &common.StepCreateSnapshot{ + CreateSnapshot: b.config.CreateSnapshot, }, - &StepConvertToTemplate{ + &common.StepConvertToTemplate{ ConvertToTemplate: b.config.ConvertToTemplate, }, ) // Run! - b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) + b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that @@ -87,7 +89,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe return nil, errors.New("Build was halted.") } - artifact := &Artifact{ + artifact := &common.Artifact{ Name: b.config.VMName, VM: state.Get("vm").(*driver.VirtualMachine), } diff --git a/builder_acc_test.go b/clone/builder_acc_test.go similarity index 98% rename from builder_acc_test.go rename to clone/builder_acc_test.go index ea4f861f0..66e4d2a2d 100644 --- a/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -1,10 +1,11 @@ -package main +package clone import ( "encoding/json" "fmt" builderT "github.com/hashicorp/packer/helper/builder/testing" "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "math/rand" "testing" @@ -111,7 +112,7 @@ func checkArtifact(t *testing.T) builderT.TestCheckFunc { } artifactRaw := artifacts[0] - _, ok := artifactRaw.(*Artifact) + _, ok := artifactRaw.(*common.Artifact) if !ok { t.Fatalf("unknown artifact: %#v", artifactRaw) } @@ -388,7 +389,7 @@ func TestBuilderAcc_sshKey(t *testing.T) { func sshKeyConfig() string { config := defaultConfig() config["ssh_password"] = "" - config["ssh_private_key_file"] = "test-key.pem" + config["ssh_private_key_file"] = "../test-key.pem" config["linked_clone"] = true // speed up return renderConfig(config) } @@ -490,7 +491,7 @@ func testConn(t *testing.T) *driver.Driver { func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.VirtualMachine { artifactRaw := artifacts[0] - artifact, _ := artifactRaw.(*Artifact) + artifact, _ := artifactRaw.(*common.Artifact) vm, err := d.FindVM(artifact.Name) if err != nil { diff --git a/builder_test.go b/clone/builder_test.go similarity index 94% rename from builder_test.go rename to clone/builder_test.go index 20243b659..51ebf0a31 100644 --- a/builder_test.go +++ b/clone/builder_test.go @@ -1,4 +1,4 @@ -package main +package clone import ( "github.com/hashicorp/packer/packer" diff --git a/config.go b/clone/config.go similarity index 61% rename from config.go rename to clone/config.go index 5c25da4d1..720672eb4 100644 --- a/config.go +++ b/clone/config.go @@ -1,22 +1,23 @@ -package main +package clone import ( - "github.com/hashicorp/packer/common" + packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" + "github.com/jetbrains-infra/packer-builder-vsphere/common" ) type Config struct { - common.PackerConfig `mapstructure:",squash"` - ConnectConfig `mapstructure:",squash"` - CloneConfig `mapstructure:",squash"` - HardwareConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` + packerCommon.PackerConfig `mapstructure:",squash"` + common.ConnectConfig `mapstructure:",squash"` + CloneConfig `mapstructure:",squash"` + HardwareConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` ctx interpolate.Context } diff --git a/config_test.go b/clone/config_test.go similarity index 99% rename from config_test.go rename to clone/config_test.go index ecc7677e0..21cf5474c 100644 --- a/config_test.go +++ b/clone/config_test.go @@ -1,4 +1,4 @@ -package main +package clone import ( "testing" diff --git a/main.go b/clone/main.go similarity index 93% rename from main.go rename to clone/main.go index 9beb821a0..3a710c3d7 100644 --- a/main.go +++ b/clone/main.go @@ -1,4 +1,4 @@ -package main +package clone import "github.com/hashicorp/packer/packer/plugin" diff --git a/step_clone.go b/clone/step_clone.go similarity index 99% rename from step_clone.go rename to clone/step_clone.go index 0c4543ff6..ca166ba36 100644 --- a/step_clone.go +++ b/clone/step_clone.go @@ -1,4 +1,4 @@ -package main +package clone import ( "github.com/mitchellh/multistep" diff --git a/step_hardware.go b/clone/step_hardware.go similarity index 99% rename from step_hardware.go rename to clone/step_hardware.go index ed7a01c48..b308ba1ab 100644 --- a/step_hardware.go +++ b/clone/step_hardware.go @@ -1,4 +1,4 @@ -package main +package clone import ( "github.com/mitchellh/multistep" diff --git a/clone/test.sh b/clone/test.sh new file mode 100755 index 000000000..dd91fee3a --- /dev/null +++ b/clone/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export PACKER_ACC=1 +go test -v "$@" diff --git a/artifact.go b/common/artifact.go similarity index 97% rename from artifact.go rename to common/artifact.go index ec5842b3b..c9ae1a36d 100644 --- a/artifact.go +++ b/common/artifact.go @@ -1,4 +1,4 @@ -package main +package common import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" diff --git a/ssh.go b/common/ssh.go similarity index 61% rename from ssh.go rename to common/ssh.go index 863ce4e58..5ca854068 100644 --- a/ssh.go +++ b/common/ssh.go @@ -1,4 +1,4 @@ -package main +package common import ( "fmt" @@ -7,19 +7,20 @@ import ( packerssh "github.com/hashicorp/packer/communicator/ssh" "github.com/mitchellh/multistep" "golang.org/x/crypto/ssh" + "github.com/hashicorp/packer/helper/communicator" ) -func commHost(state multistep.StateBag) (string, error) { +func CommHost(state multistep.StateBag) (string, error) { return state.Get("ip").(string), nil } -func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { - config := state.Get("config").(*Config) +func SshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { + comm := state.Get("comm").(*communicator.Config) var auth []ssh.AuthMethod - if config.Comm.SSHPrivateKey != "" { - privateKey, err := ioutil.ReadFile(config.Comm.SSHPrivateKey) + if comm.SSHPrivateKey != "" { + privateKey, err := ioutil.ReadFile(comm.SSHPrivateKey) if err != nil { return nil, fmt.Errorf("Error loading configured private key file: %s", err) } @@ -32,14 +33,14 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { auth = []ssh.AuthMethod{ssh.PublicKeys(signer)} } else { auth = []ssh.AuthMethod{ - ssh.Password(config.Comm.SSHPassword), + ssh.Password(comm.SSHPassword), ssh.KeyboardInteractive( - packerssh.PasswordKeyboardInteractive(config.Comm.SSHPassword)), + packerssh.PasswordKeyboardInteractive(comm.SSHPassword)), } } clientConfig := &ssh.ClientConfig{ - User: config.Comm.SSHUsername, + User: comm.SSHUsername, HostKeyCallback: ssh.InsecureIgnoreHostKey(), } clientConfig.Auth = auth diff --git a/step_connect.go b/common/step_connect.go similarity index 81% rename from step_connect.go rename to common/step_connect.go index 57bce17ba..ae6b8fbbb 100644 --- a/step_connect.go +++ b/common/step_connect.go @@ -1,4 +1,4 @@ -package main +package common import ( "github.com/mitchellh/multistep" @@ -31,16 +31,16 @@ func (c *ConnectConfig) Prepare() []error { } type StepConnect struct { - config *ConnectConfig + Config *ConnectConfig } func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: s.config.VCenterServer, - Username: s.config.Username, - Password: s.config.Password, - InsecureConnection: s.config.InsecureConnection, - Datacenter: s.config.Datacenter, + VCenterServer: s.Config.VCenterServer, + Username: s.Config.Username, + Password: s.Config.Password, + InsecureConnection: s.Config.InsecureConnection, + Datacenter: s.Config.Datacenter, }) if err != nil { state.Put("error", err) diff --git a/step_run.go b/common/step_run.go similarity index 98% rename from step_run.go rename to common/step_run.go index 5fc98fec5..340c226ad 100644 --- a/step_run.go +++ b/common/step_run.go @@ -1,4 +1,4 @@ -package main +package common import ( "github.com/mitchellh/multistep" diff --git a/step_shutdown.go b/common/step_shutdown.go similarity index 86% rename from step_shutdown.go rename to common/step_shutdown.go index 78bf2fbe6..8f9a4f4d2 100644 --- a/step_shutdown.go +++ b/common/step_shutdown.go @@ -1,4 +1,4 @@ -package main +package common import ( "github.com/mitchellh/multistep" @@ -34,7 +34,7 @@ func (c *ShutdownConfig) Prepare() []error { } type StepShutdown struct { - config *ShutdownConfig + Config *ShutdownConfig } func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { @@ -42,13 +42,13 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) vm := state.Get("vm").(*driver.VirtualMachine) - if s.config.Command != "" { + if s.Config.Command != "" { ui.Say("Executing shutdown command...") - log.Printf("Shutdown command: %s", s.config.Command) + log.Printf("Shutdown command: %s", s.Config.Command) var stdout, stderr bytes.Buffer cmd := &packer.RemoteCmd{ - Command: s.config.Command, + Command: s.Config.Command, Stdout: &stdout, Stderr: &stderr, } @@ -67,8 +67,8 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { } } - log.Printf("Waiting max %s for shutdown to complete", s.config.Timeout) - err := vm.WaitForShutdown(s.config.Timeout) + log.Printf("Waiting max %s for shutdown to complete", s.Config.Timeout) + err := vm.WaitForShutdown(s.Config.Timeout) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/step_snapshot.go b/common/step_snapshot.go similarity index 91% rename from step_snapshot.go rename to common/step_snapshot.go index 4b2a86355..fbf69170c 100644 --- a/step_snapshot.go +++ b/common/step_snapshot.go @@ -1,4 +1,4 @@ -package main +package common import ( "github.com/mitchellh/multistep" @@ -7,14 +7,14 @@ import ( ) type StepCreateSnapshot struct{ - createSnapshot bool + CreateSnapshot bool } func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - if s.createSnapshot { + if s.CreateSnapshot { ui.Say("Creating snapshot...") err := vm.CreateSnapshot("Created by Packer") diff --git a/step_template.go b/common/step_template.go similarity index 97% rename from step_template.go rename to common/step_template.go index 0bed2c062..e805ea83d 100644 --- a/step_template.go +++ b/common/step_template.go @@ -1,4 +1,4 @@ -package main +package common import ( "github.com/mitchellh/multistep" diff --git a/test.sh b/test.sh index dd91fee3a..e69b13b42 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,4 @@ #!/bin/sh -export PACKER_ACC=1 -go test -v "$@" +(cd driver && ./test.sh) +(cd clone && ./test.sh) From f909669670986f23c57f5219041177a759d71123 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 24 Jan 2018 16:35:04 +0300 Subject: [PATCH 108/266] Add basic functionality of creating VMs to the driver --- driver/datastore.go | 24 ++ driver/driver_test.go | 2 +- driver/host_acc_test.go | 6 +- driver/vm.go | 257 +++++++++++++++--- .../{vm_acc_test.go => vm_clone_acc_test.go} | 30 +- driver/vm_create_acc_test.go | 96 +++++++ 6 files changed, 355 insertions(+), 60 deletions(-) rename driver/{vm_acc_test.go => vm_clone_acc_test.go} (92%) create mode 100644 driver/vm_create_acc_test.go diff --git a/driver/datastore.go b/driver/datastore.go index 9aa6783c1..bce5962fb 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -29,6 +29,17 @@ func (d *Driver) FindDatastore(name string) (*Datastore, error) { }, nil } +func (d *Driver) FindDatastoreOrDefault(name string) (*Datastore, error) { + ds, err := d.finder.DatastoreOrDefault(d.ctx, name) + if err != nil { + return nil, err + } + return &Datastore{ + ds: ds, + driver: d, + }, nil +} + func (ds *Datastore) Info(params ...string) (*mo.Datastore, error) { var p []string if len(params) == 0 { @@ -43,3 +54,16 @@ func (ds *Datastore) Info(params ...string) (*mo.Datastore, error) { } return &info, nil } + +func (ds *Datastore) FileExists(path string) bool { + _, err := ds.ds.Stat(ds.driver.ctx, path) + return err == nil +} + +func (ds *Datastore) Name() string { + return ds.ds.Name() +} + +func (ds *Datastore) ResolvePath(path string) string { + return ds.ds.Path(path) +} diff --git a/driver/driver_test.go b/driver/driver_test.go index f6cd6bee5..5a9747b3d 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -10,7 +10,7 @@ import ( // Defines whether acceptance tests should be run const TestEnvVar = "VSPHERE_DRIVER_ACC" -const hostName = "esxi-1.vsphere65.test" +const TestHostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { d, err := NewDriver(&ConnectConfig{ diff --git a/driver/host_acc_test.go b/driver/host_acc_test.go index bba4da7cf..037987bb4 100644 --- a/driver/host_acc_test.go +++ b/driver/host_acc_test.go @@ -8,7 +8,7 @@ func TestHostAcc(t *testing.T) { initDriverAcceptanceTest(t) d := newTestDriver(t) - host, err := d.FindHost(hostName) + host, err := d.FindHost(TestHostName) if err != nil { t.Fatalf("Cannot find the default host '%v': %v", "datastore1", err) } @@ -17,7 +17,7 @@ func TestHostAcc(t *testing.T) { if err != nil { t.Fatalf("Cannot read host properties: %v", err) } - if info.Name != hostName { - t.Errorf("Wrong host name: expected '%v', got: '%v'", hostName, info.Name) + if info.Name != TestHostName { + t.Errorf("Wrong host name: expected '%v', got: '%v'", TestHostName, info.Name) } } diff --git a/driver/vm.go b/driver/vm.go index a4d6734cf..0244cf04d 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -34,6 +34,22 @@ type HardwareConfig struct { NestedHV bool } +type CreateConfig struct { + HardwareConfig + + DiskThinProvisioned bool + DiskControllerType string // example: "scsi", "pvscsi" + + Annotation string + Name string + Folder string + Host string + ResourcePool string + Datastore string + GuestOS string // example: otherGuest + Overwrite bool +} + func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { return &VirtualMachine{ vm: object.NewVirtualMachine(d.client.Client, *ref), @@ -52,6 +68,75 @@ func (d *Driver) FindVM(name string) (*VirtualMachine, error) { }, nil } +func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { + createSpec := config.toConfigSpec() + + folder, err := d.FindFolder(config.Folder) + if err != nil { + return nil, err + } + + resourcePool, err := d.FindResourcePool(config.Host, config.ResourcePool) + if err != nil { + return nil, err + } + + host, err := d.FindHost(config.Host) + if err != nil { + return nil, err + } + + datastore, err := d.FindDatastoreOrDefault(config.Datastore) + if err != nil { + return nil, err + } + + if !config.Overwrite { + vmxPath := fmt.Sprintf("%s/%s.vmx", config.Name, config.Name) + if datastore.FileExists(vmxPath) { + dsPath := datastore.ResolvePath(vmxPath) + return nil, fmt.Errorf("File '%s' already exists", dsPath) + } + } + + devices := object.VirtualDeviceList{} + + devices, err = addIDE(devices) + if err != nil { + return nil, err + } + devices, err = addDisk(d, devices, config) + if err != nil { + return nil, err + } + devices, err = addNetwork(d, devices) + if err != nil { + return nil, err + } + + createSpec.DeviceChange, err = devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + if err != nil { + return nil, err + } + + createSpec.Files = &types.VirtualMachineFileInfo{ + VmPathName: fmt.Sprintf("[%s]", datastore.Name()), + } + + task, err := folder.folder.CreateVM(d.ctx, createSpec, resourcePool.pool, host.host) + if err != nil { + return nil, err + } + taskInfo, err := task.WaitForResult(d.ctx, nil) + if err != nil { + return nil, err + } + + vmRef := taskInfo.Result.(types.ManagedObjectReference) + + return d.NewVM(&vmRef), nil +} + func (vm *VirtualMachine) Info(params ...string) (*mo.VirtualMachine, error) { var p []string if len(params) == 0 { @@ -82,32 +167,12 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err poolRef := pool.pool.Reference() relocateSpec.Pool = &poolRef - if config.Datastore == "" { - host, err := template.driver.FindHost(config.Host) - if err != nil { - return nil, err - } - - info, err := host.Info("datastore") - if err != nil { + datastore, err := template.driver.FindDatastoreOrDefault(config.Datastore) + if err != nil { return nil, err - } - - if len(info.Datastore) > 1 { - return nil, fmt.Errorf("Target host has several datastores. Specify 'datastore' parameter explicitly") - } - - ref := info.Datastore[0].Reference() - relocateSpec.Datastore = &ref - } else { - ds, err := template.driver.FindDatastore(config.Datastore) - if err != nil { - return nil, err - } - - ref := ds.ds.Reference() - relocateSpec.Datastore = &ref } + datastoreRef := datastore.ds.Reference() + relocateSpec.Datastore = &datastoreRef var cloneSpec types.VirtualMachineCloneSpec cloneSpec.Location = relocateSpec @@ -137,8 +202,8 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err return nil, err } - ref := info.Result.(types.ManagedObjectReference) - vm := template.driver.NewVM(&ref) + vmRef := info.Result.(types.ManagedObjectReference) + vm := template.driver.NewVM(&vmRef) return vm, nil } @@ -152,21 +217,7 @@ func (vm *VirtualMachine) Destroy() error { } func (vm *VirtualMachine) Configure(config *HardwareConfig) error { - var confSpec types.VirtualMachineConfigSpec - confSpec.NumCPUs = config.CPUs - confSpec.MemoryMB = config.RAM - - var cpuSpec types.ResourceAllocationInfo - cpuSpec.Reservation = config.CPUReservation - cpuSpec.Limit = config.CPULimit - confSpec.CpuAllocation = &cpuSpec - - var ramSpec types.ResourceAllocationInfo - ramSpec.Reservation = config.RAMReservation - confSpec.MemoryAllocation = &ramSpec - - confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll - confSpec.NestedHVEnabled = &config.NestedHV + confSpec := config.toConfigSpec() if config.DiskSize > 0 { devices, err := vm.vm.Device(vm.driver.ctx) @@ -179,7 +230,7 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { return err } - disk.CapacityInKB = config.DiskSize * 1024 * 1024 // Gb + disk.CapacityInKB = convertGiBToKiB(config.DiskSize) confSpec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{ &types.VirtualDeviceConfigSpec{ @@ -193,6 +244,7 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { if err != nil { return err } + _, err = task.WaitForResult(vm.driver.ctx, nil) return err } @@ -285,3 +337,124 @@ func (vm *VirtualMachine) CreateSnapshot(name string) error { func (vm *VirtualMachine) ConvertToTemplate() error { return vm.vm.MarkAsTemplate(vm.driver.ctx) } + +func (config HardwareConfig) toConfigSpec() types.VirtualMachineConfigSpec { + var confSpec types.VirtualMachineConfigSpec + confSpec.NumCPUs = config.CPUs + confSpec.MemoryMB = config.RAM + + var cpuSpec types.ResourceAllocationInfo + cpuSpec.Reservation = config.CPUReservation + cpuSpec.Limit = config.CPULimit + confSpec.CpuAllocation = &cpuSpec + + var ramSpec types.ResourceAllocationInfo + ramSpec.Reservation = config.RAMReservation + confSpec.MemoryAllocation = &ramSpec + + confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll + confSpec.NestedHVEnabled = &config.NestedHV + + return confSpec +} + +func (config CreateConfig) toConfigSpec() types.VirtualMachineConfigSpec { + confSpec := config.HardwareConfig.toConfigSpec() + confSpec.Name = config.Name + confSpec.Annotation = config.Annotation + confSpec.GuestId = config.GuestOS + return confSpec +} + +func addDisk(d *Driver, devices object.VirtualDeviceList, config *CreateConfig) (object.VirtualDeviceList, error) { + device, err := devices.CreateSCSIController(config.DiskControllerType) + if err != nil { + return nil, err + } + devices = append(devices, device) + controller, err := devices.FindDiskController(devices.Name(device)) + if err != nil { + return nil, err + } + + disk := &types.VirtualDisk{ + VirtualDevice: types.VirtualDevice{ + Key: devices.NewKey(), + Backing: &types.VirtualDiskFlatVer2BackingInfo{ + DiskMode: string(types.VirtualDiskModePersistent), + ThinProvisioned: types.NewBool(config.DiskThinProvisioned), + }, + }, + CapacityInKB: convertGiBToKiB(config.DiskSize), + } + + devices.AssignController(disk, controller) + devices = append(devices, disk) + + return devices, nil +} + +func addNetwork(d *Driver, devices object.VirtualDeviceList) (object.VirtualDeviceList, error) { + network, err := d.finder.DefaultNetwork(d.ctx) + if err != nil { + return nil, err + } + + backing, err := network.EthernetCardBackingInfo(d.ctx) + if err != nil { + return nil, err + } + + device, err := object.EthernetCardTypes().CreateEthernetCard("", backing) + if err != nil { + return nil, err + } + + return append(devices, device), nil +} + +func addIDE(devices object.VirtualDeviceList) (object.VirtualDeviceList, error) { + ideDevice, err := devices.CreateIDEController() + if err != nil { + return nil, err + } + devices = append(devices, ideDevice) + + return devices, nil +} + +func (vm *VirtualMachine) AddCdrom(isoPath string) error { + devices, err := vm.vm.Device(vm.driver.ctx) + if err != nil { + return err + } + ide, err := devices.FindIDEController("") + if err != nil { + return err + } + + cdrom, err := devices.CreateCdrom(ide) + if err != nil { + return err + } + + if isoPath != "" { + cdrom = devices.InsertIso(cdrom, isoPath) + } + + newDevices := object.VirtualDeviceList{cdrom} + confSpec := types.VirtualMachineConfigSpec{} + confSpec.DeviceChange, err = newDevices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + + task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) + if err != nil { + return err + } + + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func convertGiBToKiB(gib int64) int64 { + return gib * 1024 * 1024 +} diff --git a/driver/vm_acc_test.go b/driver/vm_clone_acc_test.go similarity index 92% rename from driver/vm_acc_test.go rename to driver/vm_clone_acc_test.go index ccde75b47..0f1ed17ce 100644 --- a/driver/vm_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -28,7 +28,7 @@ func TestVMAcc_clone(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - tc.config.Host = hostName + tc.config.Host = TestHostName tc.config.Name = newVMName() templateName := "alpine" @@ -45,17 +45,7 @@ func TestVMAcc_clone(t *testing.T) { t.Fatalf("Cannot clone vm '%v': %v", templateName, err) } - defer func() { - log.Printf("[DEBUG] Removing the clone") - if err := vm.Destroy(); err != nil { - t.Errorf("!!! ERROR REMOVING VM '%v': %v!!!", tc.config.Name, err) - } - - // Check that the clone is no longer exists - if _, err := d.FindVM(tc.config.Name); err == nil { - t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", tc.config.Name) - } - }() + defer destroyVM(t, vm, tc.config.Name) log.Printf("[DEBUG] Running check function") tc.checkFunction(t, vm, tc.config) @@ -94,8 +84,8 @@ func cloneDefaultCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { if err != nil { t.Fatal("Cannot read host properties: ", err) } - if hostInfo.Name != hostName { - t.Errorf("Invalid host name: expected '%v', got '%v'", hostName, hostInfo.Name) + if hostInfo.Name != TestHostName { + t.Errorf("Invalid host name: expected '%v', got '%v'", TestHostName, hostInfo.Name) } p := d.NewResourcePool(vmInfo.ResourcePool) @@ -278,3 +268,15 @@ func startVM(t *testing.T, vm *VirtualMachine, vmName string) (stopper func()) { } } } + +func destroyVM(t *testing.T, vm *VirtualMachine, vmName string) { + log.Printf("[DEBUG] Deleting the VM") + if err := vm.Destroy(); err != nil { + t.Errorf("!!! ERROR DELETING VM '%v': %v!!!", vmName, err) + } + + // Check that the clone is no longer exists + if _, err := vm.driver.FindVM(vmName); err == nil { + t.Errorf("!!! STILL CAN FIND VM '%v'. IT MIGHT NOT HAVE BEEN DELETED !!!", vmName) + } +} diff --git a/driver/vm_create_acc_test.go b/driver/vm_create_acc_test.go new file mode 100644 index 000000000..5084d3737 --- /dev/null +++ b/driver/vm_create_acc_test.go @@ -0,0 +1,96 @@ +package driver + +import ( + "log" + "testing" +) + +func TestVMAcc_create(t *testing.T) { + initDriverAcceptanceTest(t) + + testCases := []struct { + name string + config *CreateConfig + checkFunction func(*testing.T, *VirtualMachine, *CreateConfig) + }{ + {"MinimalConfiguration", &CreateConfig{}, createDefaultCheck}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tc.config.Host = TestHostName + tc.config.Name = newVMName() + + d := newTestDriver(t) + + log.Printf("[DEBUG] Creating VM") + vm, err := d.CreateVM(tc.config) + if err != nil { + t.Fatalf("Cannot create VM: %v", err) + } + + defer destroyVM(t, vm, tc.config.Name) + + log.Printf("[DEBUG] Adding CDRom to the created VM") + vm.AddCdrom("[datastore1] ISO/alpine-standard-3.6.2-x86_64.iso") + + log.Printf("[DEBUG] Running check function") + tc.checkFunction(t, vm, tc.config) + }) + } +} + +func createDefaultCheck(t *testing.T, vm *VirtualMachine, config *CreateConfig) { + d := vm.driver + + // Check that the clone can be found by its name + if _, err := d.FindVM(config.Name); err != nil { + t.Errorf("Cannot find created vm '%v': %v", config.Name, err) + } + + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Name != config.Name { + t.Errorf("Invalid VM name: expected '%v', got '%v'", config.Name, vmInfo.Name) + } + + f := d.NewFolder(vmInfo.Parent) + folderPath, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + + h := d.NewHost(vmInfo.Runtime.Host) + hostInfo, err := h.Info("name") + if err != nil { + t.Fatal("Cannot read host properties: ", err) + } + if hostInfo.Name != TestHostName { + t.Errorf("Invalid host name: expected '%v', got '%v'", TestHostName, hostInfo.Name) + } + + p := d.NewResourcePool(vmInfo.ResourcePool) + poolPath, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if poolPath != "" { + t.Errorf("Invalid resource pool: expected '/', got '%v'", poolPath) + } + + dsr := vmInfo.Datastore[0].Reference() + ds := d.NewDatastore(&dsr) + dsInfo, err := ds.Info("name") + if err != nil { + t.Fatal("Cannot read datastore properties: ", err) + } + if dsInfo.Name != "datastore1" { + t.Errorf("Invalid datastore name: expected 'datastore1', got '%v'", dsInfo.Name) + } +} From df40ffbe8d1a5049614c863c20014e7cb30f419f Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 24 Jan 2018 17:56:14 +0300 Subject: [PATCH 109/266] Add ISO builder which creates an empty VM --- build.sh | 4 ++ clone/builder.go | 16 +----- clone/builder_acc_test.go | 49 ++++++----------- clone/config.go | 13 +---- clone/step_hardware.go | 29 ++-------- common/check_run_status.go | 24 ++++++++ common/decode_config.go | 14 +++++ common/hardware_config.go | 39 +++++++++++++ common/testing/utility.go | 29 ++++++++++ iso/builder.go | 70 +++++++++++++++++++++++ iso/builder_acc_test.go | 33 +++++++++++ iso/config.go | 43 +++++++++++++++ iso/step_add_cdrom.go | 40 ++++++++++++++ iso/step_create.go | 110 +++++++++++++++++++++++++++++++++++++ iso/test.sh | 4 ++ test.sh | 1 + 16 files changed, 436 insertions(+), 82 deletions(-) create mode 100644 common/check_run_status.go create mode 100644 common/decode_config.go create mode 100644 common/hardware_config.go create mode 100644 common/testing/utility.go create mode 100644 iso/builder.go create mode 100644 iso/builder_acc_test.go create mode 100644 iso/config.go create mode 100644 iso/step_add_cdrom.go create mode 100644 iso/step_create.go create mode 100755 iso/test.sh diff --git a/build.sh b/build.sh index efcf7e2b8..e652100c3 100755 --- a/build.sh +++ b/build.sh @@ -11,3 +11,7 @@ rm -f bin/* GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./clone GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./clone GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./clone + +GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./iso +GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./iso +GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./iso diff --git a/clone/builder.go b/clone/builder.go index 53f3a1d4b..334484a38 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -1,8 +1,6 @@ package clone import ( - "errors" - packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" @@ -75,18 +73,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) - // If there was an error, return that - if rawErr, ok := state.GetOk("error"); ok { - return nil, rawErr.(error) - } - - // If we were interrupted or cancelled, then just exit. - if _, ok := state.GetOk(multistep.StateCancelled); ok { - return nil, errors.New("Build was cancelled.") - } - - if _, ok := state.GetOk(multistep.StateHalted); ok { - return nil, errors.New("Build was halted.") + if err := common.CheckRunStatus(state); err != nil { + return nil, err } artifact := &common.Artifact{ diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 66e4d2a2d..fbd4d94dc 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -1,21 +1,20 @@ package clone import ( - "encoding/json" - "fmt" builderT "github.com/hashicorp/packer/helper/builder/testing" + commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" + "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "math/rand" "testing" + "github.com/jetbrains-infra/packer-builder-vsphere/common" ) func TestBuilderAcc_default(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, - Template: renderConfig(config), + Template: commonT.RenderConfig(config), Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), }) } @@ -33,7 +32,7 @@ func defaultConfig() map[string]interface{} { "ssh_username": "root", "ssh_password": "jetbrains", } - config["vm_name"] = fmt.Sprintf("test-%v", rand.Intn(1000)) + config["vm_name"] = commonT.NewVMName() return config } @@ -100,7 +99,7 @@ func TestBuilderAcc_artifact(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, - Template: renderConfig(config), + Template: commonT.RenderConfig(config), Check: checkArtifact(t), }) } @@ -133,7 +132,7 @@ func folderConfig() string { config := defaultConfig() config["folder"] = "folder1/folder2" config["linked_clone"] = true // speed up - return renderConfig(config) + return commonT.RenderConfig(config) } func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { @@ -171,7 +170,7 @@ func resourcePoolConfig() string { config := defaultConfig() config["resource_pool"] = "pool1/pool2" config["linked_clone"] = true // speed up - return renderConfig(config) + return commonT.RenderConfig(config) } func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { @@ -208,7 +207,7 @@ func TestBuilderAcc_datastore(t *testing.T) { func datastoreConfig() string { config := defaultConfig() config["template"] = "alpine-host4" // on esxi-4.vsphere65.test - return renderConfig(config) + return commonT.RenderConfig(config) } func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { @@ -251,7 +250,7 @@ func TestBuilderAcc_multipleDatastores(t *testing.T) { func multipleDatastoresConfig() string { config := defaultConfig() config["host"] = "esxi-4.vsphere65.test" // host with 2 datastores - return renderConfig(config) + return commonT.RenderConfig(config) } func TestBuilderAcc_linkedClone(t *testing.T) { @@ -265,7 +264,7 @@ func TestBuilderAcc_linkedClone(t *testing.T) { func linkedCloneConfig() string { config := defaultConfig() config["linked_clone"] = true - return renderConfig(config) + return commonT.RenderConfig(config) } func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { @@ -303,7 +302,7 @@ func hardwareConfig() string { config["RAM_reservation"] = 1024 config["linked_clone"] = true // speed up - return renderConfig(config) + return commonT.RenderConfig(config) } func checkHardware(t *testing.T) builderT.TestCheckFunc { @@ -358,7 +357,7 @@ func RAMReservationConfig() string { config["RAM_reserve_all"] = true config["linked_clone"] = true // speed up - return renderConfig(config) + return commonT.RenderConfig(config) } func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { @@ -391,7 +390,7 @@ func sshKeyConfig() string { config["ssh_password"] = "" config["ssh_private_key_file"] = "../test-key.pem" config["linked_clone"] = true // speed up - return renderConfig(config) + return commonT.RenderConfig(config) } func TestBuilderAcc_snapshot(t *testing.T) { @@ -405,7 +404,7 @@ func TestBuilderAcc_snapshot(t *testing.T) { func snapshotConfig() string { config := defaultConfig() config["create_snapshot"] = true - return renderConfig(config) + return commonT.RenderConfig(config) } func checkSnapshot(t *testing.T) builderT.TestCheckFunc { @@ -439,7 +438,7 @@ func templateConfig() string { config := defaultConfig() config["convert_to_template"] = true config["linked_clone"] = true // speed up - return renderConfig(config) + return commonT.RenderConfig(config) } func checkTemplate(t *testing.T) builderT.TestCheckFunc { @@ -460,22 +459,6 @@ func checkTemplate(t *testing.T) builderT.TestCheckFunc { } } -func renderConfig(config map[string]interface{}) string { - t := map[string][]map[string]interface{}{ - "builders": { - map[string]interface{}{ - "type": "test", - }, - }, - } - for k, v := range config { - t["builders"][0][k] = v - } - - j, _ := json.Marshal(t) - return string(j) -} - func testConn(t *testing.T) *driver.Driver { d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", diff --git a/clone/config.go b/clone/config.go index 720672eb4..950769215 100644 --- a/clone/config.go +++ b/clone/config.go @@ -3,7 +3,6 @@ package clone import ( packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" @@ -13,7 +12,7 @@ type Config struct { packerCommon.PackerConfig `mapstructure:",squash"` common.ConnectConfig `mapstructure:",squash"` CloneConfig `mapstructure:",squash"` - HardwareConfig `mapstructure:",squash"` + common.HardwareConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` CreateSnapshot bool `mapstructure:"create_snapshot"` @@ -24,14 +23,8 @@ type Config struct { func NewConfig(raws ...interface{}) (*Config, []string, error) { c := new(Config) - { - err := config.Decode(c, &config.DecodeOpts{ - Interpolate: true, - InterpolateContext: &c.ctx, - }, raws...) - if err != nil { - return nil, nil, err - } + if err := common.DecodeConfig(c, &c.ctx, raws...); err != nil { + return nil, nil, err } errs := new(packer.MultiError) diff --git a/clone/step_hardware.go b/clone/step_hardware.go index b308ba1ab..94c384405 100644 --- a/clone/step_hardware.go +++ b/clone/step_hardware.go @@ -1,42 +1,21 @@ package clone import ( - "github.com/mitchellh/multistep" "github.com/hashicorp/packer/packer" - "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" ) -type HardwareConfig struct { - CPUs int32 `mapstructure:"CPUs"` - CPUReservation int64 `mapstructure:"CPU_reservation"` - CPULimit int64 `mapstructure:"CPU_limit"` - RAM int64 `mapstructure:"RAM"` - RAMReservation int64 `mapstructure:"RAM_reservation"` - RAMReserveAll bool `mapstructure:"RAM_reserve_all"` - DiskSize int64 `mapstructure:"disk_size"` - NestedHV bool `mapstructure:"NestedHV"` -} - -func (c *HardwareConfig) Prepare() []error { - var errs []error - - if c.RAMReservation > 0 && c.RAMReserveAll != false { - errs = append(errs, fmt.Errorf("'RAM_reservation' and 'RAM_reserve_all' cannot be used together")) - } - - return errs -} - type StepConfigureHardware struct { - config *HardwareConfig + config *common.HardwareConfig } func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - if *s.config != (HardwareConfig{}) { + if *s.config != (common.HardwareConfig{}) { ui.Say("Customizing hardware parameters...") err := vm.Configure(&driver.HardwareConfig{ diff --git a/common/check_run_status.go b/common/check_run_status.go new file mode 100644 index 000000000..3d383d9fe --- /dev/null +++ b/common/check_run_status.go @@ -0,0 +1,24 @@ +package common + +import ( + "github.com/mitchellh/multistep" + "errors" +) + +func CheckRunStatus(state *multistep.BasicStateBag) error { + // If there was an error, return that + if rawErr, ok := state.GetOk("error"); ok { + return rawErr.(error) + } + + // If we were interrupted or cancelled, then just exit. + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return errors.New("Build was cancelled.") + } + + if _, ok := state.GetOk(multistep.StateHalted); ok { + return errors.New("Build was halted.") + } + + return nil +} diff --git a/common/decode_config.go b/common/decode_config.go new file mode 100644 index 000000000..575a81cb4 --- /dev/null +++ b/common/decode_config.go @@ -0,0 +1,14 @@ +package common + +import ( + "github.com/hashicorp/packer/helper/config" + "github.com/hashicorp/packer/template/interpolate" +) + +func DecodeConfig(cfg interface{}, ctx *interpolate.Context, raws ...interface{}) error { + err := config.Decode(cfg, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: ctx, + }, raws...) + return err +} diff --git a/common/hardware_config.go b/common/hardware_config.go new file mode 100644 index 000000000..90df9a99a --- /dev/null +++ b/common/hardware_config.go @@ -0,0 +1,39 @@ +package common + +import ( + "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" +) + +type HardwareConfig struct { + CPUs int32 `mapstructure:"CPUs"` + CPUReservation int64 `mapstructure:"CPU_reservation"` + CPULimit int64 `mapstructure:"CPU_limit"` + RAM int64 `mapstructure:"RAM"` + RAMReservation int64 `mapstructure:"RAM_reservation"` + RAMReserveAll bool `mapstructure:"RAM_reserve_all"` + DiskSize int64 `mapstructure:"disk_size"` + NestedHV bool `mapstructure:"NestedHV"` +} + +func (c *HardwareConfig) Prepare() []error { + var errs []error + + if c.RAMReservation > 0 && c.RAMReserveAll != false { + errs = append(errs, fmt.Errorf("'RAM_reservation' and 'RAM_reserve_all' cannot be used together")) + } + + return errs +} + +func (c *HardwareConfig) ToDriverHardwareConfig() driver.HardwareConfig { + return driver.HardwareConfig{ + CPUs: c.CPUs, + CPUReservation: c.CPUReservation, + CPULimit: c.CPULimit, + RAM: c.RAM, + RAMReservation: c.RAMReservation, + RAMReserveAll: c.RAMReserveAll, + DiskSize: c.DiskSize, + } +} diff --git a/common/testing/utility.go b/common/testing/utility.go new file mode 100644 index 000000000..8a26b6d56 --- /dev/null +++ b/common/testing/utility.go @@ -0,0 +1,29 @@ +package testing + +import ( + "fmt" + "math/rand" + "time" + "encoding/json" +) + +func NewVMName() string { + rand.Seed(time.Now().UnixNano()) + return fmt.Sprintf("test-%v", rand.Intn(1000)) +} + +func RenderConfig(config map[string]interface{}) string { + t := map[string][]map[string]interface{}{ + "builders": { + map[string]interface{}{ + "type": "test", + }, + }, + } + for k, v := range config { + t["builders"][0][k] = v + } + + j, _ := json.Marshal(t) + return string(j) +} diff --git a/iso/builder.go b/iso/builder.go new file mode 100644 index 000000000..18bd4e450 --- /dev/null +++ b/iso/builder.go @@ -0,0 +1,70 @@ +package iso + +import ( + packerCommon "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/common" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" +) + +type Builder struct { + config *Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + c, warnings, errs := NewConfig(raws...) + if errs != nil { + return warnings, errs + } + b.config = c + + return warnings, nil +} + +func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { + state := new(multistep.BasicStateBag) + state.Put("comm", &b.config.Comm) + state.Put("hook", hook) + state.Put("ui", ui) + + steps := []multistep.Step{} + + steps = append(steps, + &common.StepConnect{ + Config: &b.config.ConnectConfig, + }, + &StepCreateVM{ + config: &b.config.CreateConfig, + }, + ) + + if b.config.CDRomConfig.ISOPath != "" { + steps = append(steps, + &StepAddCDRom{ + config: &b.config.CDRomConfig, + }, + ) + } + + // Run! + b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) + b.runner.Run(state) + + if err := common.CheckRunStatus(state); err != nil { + return nil, err + } + + artifact := &common.Artifact{ + Name: b.config.VMName, + VM: state.Get("vm").(*driver.VirtualMachine), + } + return artifact, nil +} + +func (b *Builder) Cancel() { + if b.runner != nil { + b.runner.Cancel() + } +} diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go new file mode 100644 index 000000000..8269761d2 --- /dev/null +++ b/iso/builder_acc_test.go @@ -0,0 +1,33 @@ +package iso + +import ( + builderT "github.com/hashicorp/packer/helper/builder/testing" + commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" + "testing" +) + +func TestBuilderAcc_default(t *testing.T) { + config := defaultConfig() + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: commonT.RenderConfig(config), + }) +} + +func defaultConfig() map[string]interface{} { + config := map[string]interface{}{ + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": true, + + "host": "esxi-1.vsphere65.test", + + "ssh_username": "root", + "ssh_password": "jetbrains", + + "vm_name": commonT.NewVMName(), + } + + return config +} diff --git a/iso/config.go b/iso/config.go new file mode 100644 index 000000000..aec7c90fb --- /dev/null +++ b/iso/config.go @@ -0,0 +1,43 @@ +package iso + +import ( + packerCommon "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" + "github.com/jetbrains-infra/packer-builder-vsphere/common" +) + +type Config struct { + packerCommon.PackerConfig `mapstructure:",squash"` + common.ConnectConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` + + CreateConfig `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + + ctx interpolate.Context +} + +func NewConfig(raws ...interface{}) (*Config, []string, error) { + c := new(Config) + if err := common.DecodeConfig(c, &c.ctx, raws...); err != nil { + return nil, nil, err + } + + errs := new(packer.MultiError) + errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) + + if len(errs.Errors) > 0 { + return nil, nil, errs + } + + return c, nil, nil +} diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go new file mode 100644 index 000000000..136bc6ab5 --- /dev/null +++ b/iso/step_add_cdrom.go @@ -0,0 +1,40 @@ +package iso + +import ( + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" +) + +type CDRomConfig struct { + ISOPath string `mapstructure:"iso_path"` +} + +func (c *CDRomConfig) Prepare() []error { + var errs []error + + return errs +} + +type StepAddCDRom struct { + config *CDRomConfig +} + +func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + ui.Say("Adding CDRom ...") + + vm := state.Get("vm").(*driver.VirtualMachine) + err := vm.AddCdrom(s.config.ISOPath) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepAddCDRom) Cleanup(state multistep.StateBag) { + // nothing +} diff --git a/iso/step_create.go b/iso/step_create.go new file mode 100644 index 000000000..c47e9fb8d --- /dev/null +++ b/iso/step_create.go @@ -0,0 +1,110 @@ +package iso + +import ( + "fmt" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/common" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" +) + +type CreateConfig struct { + common.HardwareConfig `mapstructure:",squash"` + + DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` + DiskControllerType string `mapstructure:"disk_controller_type"` + + VMName string `mapstructure:"vm_name"` + Folder string `mapstructure:"folder"` + Host string `mapstructure:"host"` + ResourcePool string `mapstructure:"resource_pool"` + Datastore string `mapstructure:"datastore"` + GuestOSType string `mapstructure:"guest_os_type"` +} + +func (c *CreateConfig) Prepare() []error { + var errs []error + + // needed to avoid changing the original config in case of errors + tmp := *c + + // do recursive calls + errs = append(errs, tmp.HardwareConfig.Prepare()...) + + // check for errors + if tmp.VMName == "" { + errs = append(errs, fmt.Errorf("Target VM name is required")) + } + if tmp.Host == "" { + errs = append(errs, fmt.Errorf("vSphere host is required")) + } + + if len(errs) > 0 { + return errs + } + + // set default values + if tmp.GuestOSType == "" { + tmp.GuestOSType = "otherGuest" + } + + // change the original config + *c = tmp + + return []error{} +} + +type StepCreateVM struct { + config *CreateConfig +} + +func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*driver.Driver) + + ui.Say("Creating VM...") + + vm, err := d.CreateVM(&driver.CreateConfig{ + HardwareConfig: s.config.HardwareConfig.ToDriverHardwareConfig(), + + DiskThinProvisioned: s.config.DiskThinProvisioned, + DiskControllerType: s.config.DiskControllerType, + Name: s.config.VMName, + Folder: s.config.Folder, + Host: s.config.Host, + ResourcePool: s.config.ResourcePool, + Datastore: s.config.Datastore, + GuestOS: s.config.GuestOSType, + }) + + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + state.Put("vm", vm) + return multistep.ActionContinue +} + +func (s *StepCreateVM) Cleanup(state multistep.StateBag) { + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { + return + } + + ui := state.Get("ui").(packer.Ui) + + st := state.Get("vm") + if st == nil { + return + } + vm := st.(*driver.VirtualMachine) + + ui.Say("Destroying VM...") + + err := vm.Destroy() + if err != nil { + ui.Error(err.Error()) + } +} diff --git a/iso/test.sh b/iso/test.sh new file mode 100755 index 000000000..dd91fee3a --- /dev/null +++ b/iso/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export PACKER_ACC=1 +go test -v "$@" diff --git a/test.sh b/test.sh index e69b13b42..34da1fcb7 100755 --- a/test.sh +++ b/test.sh @@ -2,3 +2,4 @@ (cd driver && ./test.sh) (cd clone && ./test.sh) +(cd iso && ./test.sh) \ No newline at end of file From 230bfa774c190ef784664a9d2e62f8375396ef3f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 24 Jan 2018 21:01:04 +0300 Subject: [PATCH 110/266] Build two independent plugins --- .gitignore | 3 +-- build.sh | 14 +++++++------- cmd/clone/main.go | 13 +++++++++++++ {clone => cmd/iso}/main.go | 5 +++-- docker-compose.yml | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 cmd/clone/main.go rename {clone => cmd/iso}/main.go (55%) diff --git a/.gitignore b/.gitignore index 5aee28a7e..5582d6763 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ .idea/ .glide/ vendor/ -packer-builder-vsphere -packer-builder-vsphere.exe +packer-builder-vsphere* bin/ test*.json crash.log diff --git a/build.sh b/build.sh index e652100c3..9651be5bd 100755 --- a/build.sh +++ b/build.sh @@ -2,16 +2,16 @@ set -eux -glide install -v +# glide install -v export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin rm -f bin/* -GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./clone -GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./clone -GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./clone +GOOS=darwin go build -o bin/packer-builder-vsphere.macos ./cmd/clone +GOOS=linux go build -o bin/packer-builder-vsphere.linux ./cmd/clone +GOOS=windows go build -o bin/packer-builder-vsphere.exe ./cmd/clone -GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./iso -GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./iso -GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./iso +GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso +GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso +GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso diff --git a/cmd/clone/main.go b/cmd/clone/main.go new file mode 100644 index 000000000..0ac47b4a6 --- /dev/null +++ b/cmd/clone/main.go @@ -0,0 +1,13 @@ +package main + +import "github.com/hashicorp/packer/packer/plugin" +import "github.com/jetbrains-infra/packer-builder-vsphere/clone" + +func main() { + server, err := plugin.Server() + if err != nil { + panic(err) + } + server.RegisterBuilder(new(clone.Builder)) + server.Serve() +} diff --git a/clone/main.go b/cmd/iso/main.go similarity index 55% rename from clone/main.go rename to cmd/iso/main.go index 3a710c3d7..f64cc1720 100644 --- a/clone/main.go +++ b/cmd/iso/main.go @@ -1,12 +1,13 @@ -package clone +package main import "github.com/hashicorp/packer/packer/plugin" +import "github.com/jetbrains-infra/packer-builder-vsphere/iso" func main() { server, err := plugin.Server() if err != nil { panic(err) } - server.RegisterBuilder(new(Builder)) + server.RegisterBuilder(new(iso.Builder)) server.Serve() } diff --git a/docker-compose.yml b/docker-compose.yml index 5d2c26933..ea924c80a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ build: - image: jetbrainsinfra/golang:1.8.3 + image: jetbrainsinfra/golang:1.9.2 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere From 7424078a43aca63b23f47165b7b855562ba92e99 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 24 Jan 2018 21:52:29 +0300 Subject: [PATCH 111/266] Rename tests --- clone/builder_acc_test.go | 24 ++++++++++++------------ clone/builder_test.go | 2 +- clone/config_test.go | 8 ++++---- iso/builder_acc_test.go | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index fbd4d94dc..27802e407 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -10,7 +10,7 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/common" ) -func TestBuilderAcc_default(t *testing.T) { +func TestCloneBuilderAcc_default(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -95,7 +95,7 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil } } -func TestBuilderAcc_artifact(t *testing.T) { +func TestCloneBuilderAcc_artifact(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -120,7 +120,7 @@ func checkArtifact(t *testing.T) builderT.TestCheckFunc { } } -func TestBuilderAcc_folder(t *testing.T) { +func TestCloneBuilderAcc_folder(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: folderConfig(), @@ -158,7 +158,7 @@ func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { } } -func TestBuilderAcc_resourcePool(t *testing.T) { +func TestCloneBuilderAcc_resourcePool(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: resourcePoolConfig(), @@ -196,7 +196,7 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { } } -func TestBuilderAcc_datastore(t *testing.T) { +func TestCloneBuilderAcc_datastore(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: datastoreConfig(), @@ -238,7 +238,7 @@ func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { } } -func TestBuilderAcc_multipleDatastores(t *testing.T) { +func TestCloneBuilderAcc_multipleDatastores(t *testing.T) { t.Skip("test must fail") builderT.Test(t, builderT.TestCase{ @@ -253,7 +253,7 @@ func multipleDatastoresConfig() string { return commonT.RenderConfig(config) } -func TestBuilderAcc_linkedClone(t *testing.T) { +func TestCloneBuilderAcc_linkedClone(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: linkedCloneConfig(), @@ -285,7 +285,7 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { } } -func TestBuilderAcc_hardware(t *testing.T) { +func TestCloneBuilderAcc_hardware(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: hardwareConfig(), @@ -344,7 +344,7 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { } } -func TestBuilderAcc_RAMReservation(t *testing.T) { +func TestCloneBuilderAcc_RAMReservation(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: RAMReservationConfig(), @@ -378,7 +378,7 @@ func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { } } -func TestBuilderAcc_sshKey(t *testing.T) { +func TestCloneBuilderAcc_sshKey(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: sshKeyConfig(), @@ -393,7 +393,7 @@ func sshKeyConfig() string { return commonT.RenderConfig(config) } -func TestBuilderAcc_snapshot(t *testing.T) { +func TestCloneBuilderAcc_snapshot(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: snapshotConfig(), @@ -426,7 +426,7 @@ func checkSnapshot(t *testing.T) builderT.TestCheckFunc { } } -func TestBuilderAcc_template(t *testing.T) { +func TestCloneBuilderAcc_template(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: templateConfig(), diff --git a/clone/builder_test.go b/clone/builder_test.go index 51ebf0a31..788e0e245 100644 --- a/clone/builder_test.go +++ b/clone/builder_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func TestBuilder_ImplementsBuilder(t *testing.T) { +func TestCloneBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} if _, ok := raw.(packer.Builder); !ok { diff --git a/clone/config_test.go b/clone/config_test.go index 21cf5474c..7e4829210 100644 --- a/clone/config_test.go +++ b/clone/config_test.go @@ -5,12 +5,12 @@ import ( "time" ) -func TestMinimalConfig(t *testing.T) { +func TestCloneConfig_MinimalConfig(t *testing.T) { _, warns, errs := NewConfig(minimalConfig()) testConfigOk(t, warns, errs) } -func TestMandatoryParameters(t *testing.T) { +func TestCloneConfig_MandatoryParameters(t *testing.T) { params := []string{"vcenter_server", "username", "password", "template", "vm_name", "host"} for _, param := range params { raw := minimalConfig() @@ -20,7 +20,7 @@ func TestMandatoryParameters(t *testing.T) { } } -func TestTimeout(t *testing.T) { +func TestCloneConfig_Timeout(t *testing.T) { raw := minimalConfig() raw["shutdown_timeout"] = "3m" conf, warns, err := NewConfig(raw) @@ -30,7 +30,7 @@ func TestTimeout(t *testing.T) { } } -func TestRAMReservation(t *testing.T) { +func TestCloneConfig_RAMReservation(t *testing.T) { raw := minimalConfig() raw["RAM_reservation"] = 1000 raw["RAM_reserve_all"] = true diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 8269761d2..42e8282ff 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestBuilderAcc_default(t *testing.T) { +func TestISOBuilderAcc_default(t *testing.T) { config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -26,7 +26,7 @@ func defaultConfig() map[string]interface{} { "ssh_username": "root", "ssh_password": "jetbrains", - "vm_name": commonT.NewVMName(), + "vm_name": commonT.NewVMName(), } return config From 6d9933d804985eddd5e02fcb68f98b8dbcf1b553 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 24 Jan 2018 21:53:49 +0300 Subject: [PATCH 112/266] Uncomment accidentally commented `glide install` --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 9651be5bd..63089a1d8 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ set -eux -# glide install -v +glide install -v export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin From 50625ddcadffb0fc290fd7b36d6eceb330da2ac3 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 30 Jan 2018 19:45:56 +0300 Subject: [PATCH 113/266] Add inserting floppy image to iso builder --- driver/vm.go | 28 +++++++++++++++- driver/vm_create_acc_test.go | 3 -- iso/builder.go | 15 ++++----- iso/config.go | 1 + iso/step_add_cdrom.go | 6 ++-- iso/step_add_floppy.go | 63 ++++++++++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 16 deletions(-) create mode 100644 iso/step_add_floppy.go diff --git a/driver/vm.go b/driver/vm.go index 0244cf04d..74f076370 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -442,9 +442,35 @@ func (vm *VirtualMachine) AddCdrom(isoPath string) error { cdrom = devices.InsertIso(cdrom, isoPath) } - newDevices := object.VirtualDeviceList{cdrom} + return vm.addDevice(cdrom) +} + +func (vm *VirtualMachine) AddFloppy(imgPath string) error { + devices, err := vm.vm.Device(vm.driver.ctx) + if err != nil { + return err + } + + floppy, err := devices.CreateFloppy() + if err != nil { + return err + } + + if imgPath != "" { + floppy = devices.InsertImg(floppy, imgPath) + } + + return vm.addDevice(floppy) +} + +func (vm *VirtualMachine) addDevice(device types.BaseVirtualDevice) error { + newDevices := object.VirtualDeviceList{device} confSpec := types.VirtualMachineConfigSpec{} + var err error confSpec.DeviceChange, err = newDevices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) + if err != nil { + return err + } task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) if err != nil { diff --git a/driver/vm_create_acc_test.go b/driver/vm_create_acc_test.go index 5084d3737..cc8dcb051 100644 --- a/driver/vm_create_acc_test.go +++ b/driver/vm_create_acc_test.go @@ -31,9 +31,6 @@ func TestVMAcc_create(t *testing.T) { defer destroyVM(t, vm, tc.config.Name) - log.Printf("[DEBUG] Adding CDRom to the created VM") - vm.AddCdrom("[datastore1] ISO/alpine-standard-3.6.2-x86_64.iso") - log.Printf("[DEBUG] Running check function") tc.checkFunction(t, vm, tc.config) }) diff --git a/iso/builder.go b/iso/builder.go index 18bd4e450..6ebdf8b42 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -6,6 +6,7 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { @@ -38,16 +39,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCreateVM{ config: &b.config.CreateConfig, }, + &StepAddCDRom{ + config: &b.config.CDRomConfig, + }, + &StepAddFloppy{ + config: &b.config.FloppyConfig, + }, ) - if b.config.CDRomConfig.ISOPath != "" { - steps = append(steps, - &StepAddCDRom{ - config: &b.config.CDRomConfig, - }, - ) - } - // Run! b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) diff --git a/iso/config.go b/iso/config.go index aec7c90fb..c3ca72d5d 100644 --- a/iso/config.go +++ b/iso/config.go @@ -18,6 +18,7 @@ type Config struct { CreateConfig `mapstructure:",squash"` CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` ctx interpolate.Context } diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 136bc6ab5..668055e30 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -11,9 +11,7 @@ type CDRomConfig struct { } func (c *CDRomConfig) Prepare() []error { - var errs []error - - return errs + return nil } type StepAddCDRom struct { @@ -23,7 +21,7 @@ type StepAddCDRom struct { func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - ui.Say("Adding CDRom ...") + ui.Say("Adding CDRom...") vm := state.Get("vm").(*driver.VirtualMachine) err := vm.AddCdrom(s.config.ISOPath) diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go new file mode 100644 index 000000000..e8c8e2fd0 --- /dev/null +++ b/iso/step_add_floppy.go @@ -0,0 +1,63 @@ +package iso + +import ( + "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "fmt" +) + +type FloppyConfig struct { + FloppyIMGPath string `mapstructure:"floppy_img_path"` + FloppyFiles []string `mapstructure:"floppy_files"` + FloppyDirectories []string `mapstructure:"floppy_dirs"` +} + +func (c *FloppyConfig) Prepare() []error { + var errs []error + + if c.FloppyIMGPath != "" && (c.FloppyFiles != nil || c.FloppyDirectories != nil) { + errs = append(errs, + fmt.Errorf("'floppy_img_path' cannot be used together with 'floppy_files' and 'floppy_dirs'"), + ) + } + + return errs +} + +type StepAddFloppy struct { + config *FloppyConfig +} + +func (s *StepAddFloppy) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + + ui.Say("Adding Floppy...") + + floppyIMGPath := s.config.FloppyIMGPath + if s.config.FloppyFiles != nil || s.config.FloppyDirectories != nil { + var err error + floppyIMGPath, err = s.createFloppy() + if err != nil { + state.Put("error", fmt.Errorf("Error creating floppy image: %v", err)) + } + } + + vm := state.Get("vm").(*driver.VirtualMachine) + err := vm.AddFloppy(floppyIMGPath) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { + // nothing +} + +func (s *StepAddFloppy) createFloppy() (string, error) { + return "", fmt.Errorf("Not implemented") + // TODO +} From 76a09d206ef4cde2efc8d551d5ff41100a00cf78 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 30 Jan 2018 19:47:38 +0300 Subject: [PATCH 114/266] Add common steps (provision, snapshot, template) to iso builder --- iso/builder.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/iso/builder.go b/iso/builder.go index 6ebdf8b42..e55bc1d73 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -47,6 +47,30 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, ) + if b.config.Comm.Type != "none" { + steps = append(steps, + &common.StepRun{}, + &communicator.StepConnect{ + Config: &b.config.Comm, + Host: common.CommHost, + SSHConfig: common.SshConfig, + }, + &packerCommon.StepProvision{}, + &common.StepShutdown{ + Config: &b.config.ShutdownConfig, + }, + ) + } + + steps = append(steps, + &common.StepCreateSnapshot{ + CreateSnapshot: b.config.CreateSnapshot, + }, + &common.StepConvertToTemplate{ + ConvertToTemplate: b.config.ConvertToTemplate, + }, + ) + // Run! b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) From ee6192f1c17cd6457ec623b1b5b1ff20321468aa Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 30 Jan 2018 19:48:32 +0300 Subject: [PATCH 115/266] Add some acceptance tests for iso builder --- clone/builder_acc_test.go | 62 ++++++------------ common/testing/utility.go | 31 +++++++++ iso/builder_acc_test.go | 128 ++++++++++++++++++++++++++++++++++++++ test.sh | 8 +-- 4 files changed, 181 insertions(+), 48 deletions(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 27802e407..8c07648ec 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -5,7 +5,6 @@ import ( commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "testing" "github.com/jetbrains-infra/packer-builder-vsphere/common" ) @@ -38,8 +37,8 @@ func defaultConfig() map[string]interface{} { func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) - vm := getVM(t, d, artifacts) + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") if err != nil { @@ -137,8 +136,8 @@ func folderConfig() string { func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) - vm := getVM(t, d, artifacts) + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("parent") if err != nil { @@ -175,8 +174,8 @@ func resourcePoolConfig() string { func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) - vm := getVM(t, d, artifacts) + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("resourcePool") if err != nil { @@ -212,8 +211,8 @@ func datastoreConfig() string { func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) - vm := getVM(t, d, artifacts) + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("datastore") if err != nil { @@ -269,8 +268,8 @@ func linkedCloneConfig() string { func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) - vm := getVM(t, d, artifacts) + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("layoutEx.disk") if err != nil { @@ -307,9 +306,9 @@ func hardwareConfig() string { func checkHardware(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := commonT.TestConn(t) - vm := getVM(t, d, artifacts) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("config") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) @@ -362,9 +361,9 @@ func RAMReservationConfig() string { func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := commonT.TestConn(t) - vm := getVM(t, d, artifacts) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("config") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) @@ -409,9 +408,9 @@ func snapshotConfig() string { func checkSnapshot(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := commonT.TestConn(t) - vm := getVM(t, d, artifacts) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("layoutEx.disk") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) @@ -443,9 +442,9 @@ func templateConfig() string { func checkTemplate(t *testing.T) builderT.TestCheckFunc { return func(artifacts []packer.Artifact) error { - d := testConn(t) + d := commonT.TestConn(t) - vm := getVM(t, d, artifacts) + vm := commonT.GetVM(t, d, artifacts) vmInfo, err := vm.Info("config.template") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) @@ -458,28 +457,3 @@ func checkTemplate(t *testing.T) builderT.TestCheckFunc { return nil } } - -func testConn(t *testing.T) *driver.Driver { - d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: "vcenter.vsphere65.test", - Username: "root", - Password: "jetbrains", - InsecureConnection: true, - }) - if err != nil { - t.Fatal("Cannot connect: ", err) - } - return d -} - -func getVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.VirtualMachine { - artifactRaw := artifacts[0] - artifact, _ := artifactRaw.(*common.Artifact) - - vm, err := d.FindVM(artifact.Name) - if err != nil { - t.Fatalf("Cannot find VM: %v", err) - } - - return vm -} diff --git a/common/testing/utility.go b/common/testing/utility.go index 8a26b6d56..8a13bf883 100644 --- a/common/testing/utility.go +++ b/common/testing/utility.go @@ -5,6 +5,10 @@ import ( "math/rand" "time" "encoding/json" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "testing" + "github.com/jetbrains-infra/packer-builder-vsphere/common" ) func NewVMName() string { @@ -27,3 +31,30 @@ func RenderConfig(config map[string]interface{}) string { j, _ := json.Marshal(t) return string(j) } + + +func TestConn(t *testing.T) *driver.Driver { + d, err := driver.NewDriver(&driver.ConnectConfig{ + VCenterServer: "vcenter.vsphere65.test", + Username: "root", + Password: "jetbrains", + InsecureConnection: true, + }) + if err != nil { + t.Fatal("Cannot connect: ", err) + } + return d +} + +func GetVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.VirtualMachine { + artifactRaw := artifacts[0] + artifact, _ := artifactRaw.(*common.Artifact) + + vm, err := d.FindVM(artifact.Name) + if err != nil { + t.Fatalf("Cannot find VM: %v", err) + } + + return vm +} + diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 42e8282ff..da45a1d2b 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -4,6 +4,7 @@ import ( builderT "github.com/hashicorp/packer/helper/builder/testing" commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "testing" + "github.com/hashicorp/packer/packer" ) func TestISOBuilderAcc_default(t *testing.T) { @@ -11,6 +12,7 @@ func TestISOBuilderAcc_default(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: commonT.RenderConfig(config), + Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), }) } @@ -31,3 +33,129 @@ func defaultConfig() map[string]interface{} { return config } + +func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if vmInfo.Name != name { + t.Errorf("Invalid VM name: expected '%v', got '%v'", name, vmInfo.Name) + } + + f := d.NewFolder(vmInfo.Parent) + folderPath, err := f.Path() + if err != nil { + t.Fatalf("Cannot read folder name: %v", err) + } + if folderPath != "" { + t.Errorf("Invalid folder: expected '/', got '%v'", folderPath) + } + + h := d.NewHost(vmInfo.Runtime.Host) + hostInfo, err := h.Info("name") + if err != nil { + t.Fatal("Cannot read host properties: ", err) + } + if hostInfo.Name != host { + t.Errorf("Invalid host name: expected '%v', got '%v'", host, hostInfo.Name) + } + + p := d.NewResourcePool(vmInfo.ResourcePool) + poolPath, err := p.Path() + if err != nil { + t.Fatalf("Cannot read resource pool name: %v", err) + } + if poolPath != "" { + t.Errorf("Invalid resource pool: expected '/', got '%v'", poolPath) + } + + dsr := vmInfo.Datastore[0].Reference() + ds := d.NewDatastore(&dsr) + dsInfo, err := ds.Info("name") + if err != nil { + t.Fatal("Cannot read datastore properties: ", err) + } + if dsInfo.Name != datastore { + t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) + } + + return nil + } +} + +func TestISOBuilderAcc_hardware(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: hardwareConfig(), + Check: checkHardware(t), + }) +} + +func hardwareConfig() string { + config := defaultConfig() + config["CPUs"] = 2 + config["CPU_reservation"] = 1000 + config["CPU_limit"] = 1500 + config["RAM"] = 2048 + config["RAM_reservation"] = 1024 + + return commonT.RenderConfig(config) +} + +func checkHardware(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + + vm := commonT.GetVM(t, d, artifacts) + vmInfo, err := vm.Info("config") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + cpuSockets := vmInfo.Config.Hardware.NumCPU + if cpuSockets != 2 { + t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) + } + + cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + if cpuReservation != 1000 { + t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) + } + + cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + if cpuLimit != 1500 { + t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) + } + + ram := vmInfo.Config.Hardware.MemoryMB + if ram != 2048 { + t.Errorf("VM should have 2048 MB of RAM, got %v", ram) + } + + ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + if ramReservation != 1024 { + t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) + } + + return nil + } +} + +func TestISOBuilderAcc_cdrom(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: cdromConfig(), + }) +} + +func cdromConfig() string { + config := defaultConfig() + config["iso_path"] = "[datastore1] alpine-standard-3.6.2-x86_64.iso" + return commonT.RenderConfig(config) +} diff --git a/test.sh b/test.sh index 34da1fcb7..a1db6c2ff 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,5 @@ -#!/bin/sh +#!/bin/sh -e -(cd driver && ./test.sh) -(cd clone && ./test.sh) -(cd iso && ./test.sh) \ No newline at end of file +(cd driver && ./test.sh "$@") +(cd clone && ./test.sh "$@") +(cd iso && ./test.sh "$@") \ No newline at end of file From 19713ca20d93ad5e4227a66488f4436e2ba6d056 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 30 Jan 2018 20:25:05 +0300 Subject: [PATCH 116/266] Add support of customizing boot order --- clone/builder.go | 4 +++- clone/config.go | 18 ++++++++++-------- common/step_run.go | 19 ++++++++++++++++++- driver/vm.go | 13 +++++++++++++ iso/builder.go | 4 +++- iso/config.go | 14 ++++++++------ 6 files changed, 55 insertions(+), 17 deletions(-) diff --git a/clone/builder.go b/clone/builder.go index 334484a38..c4838efdf 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -47,7 +47,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.Comm.Type != "none" { steps = append(steps, - &common.StepRun{}, + &common.StepRun{ + Config: &b.config.RunConfig, + }, &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost, diff --git a/clone/config.go b/clone/config.go index 950769215..93f680e3f 100644 --- a/clone/config.go +++ b/clone/config.go @@ -9,14 +9,15 @@ import ( ) type Config struct { - packerCommon.PackerConfig `mapstructure:",squash"` - common.ConnectConfig `mapstructure:",squash"` - CloneConfig `mapstructure:",squash"` - common.HardwareConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - common.ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` + packerCommon.PackerConfig `mapstructure:",squash"` + common.ConnectConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + CloneConfig `mapstructure:",squash"` + common.HardwareConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` ctx interpolate.Context } @@ -29,6 +30,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs := new(packer.MultiError) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CloneConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) diff --git a/common/step_run.go b/common/step_run.go index 340c226ad..e4210b2ce 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -5,9 +5,19 @@ import ( "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "strings" ) +type RunConfig struct { + BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" +} + +func (c *RunConfig) Prepare() []error { + return nil +} + type StepRun struct { + Config *RunConfig } func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { @@ -16,9 +26,16 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Power on VM...") + if s.Config.BootOrder != "" { + if err := vm.SetBootOrder(strings.Split(s.Config.BootOrder, ",")); err != nil { + state.Put("error", fmt.Errorf("error selecting boot order: %v", err)) + return multistep.ActionHalt + } + } + err := vm.PowerOn() if err != nil { - state.Put("error", err) + state.Put("error", fmt.Errorf("error powering on VM: %v", err)) return multistep.ActionHalt } diff --git a/driver/vm.go b/driver/vm.go index 74f076370..5a307a0ee 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -463,6 +463,19 @@ func (vm *VirtualMachine) AddFloppy(imgPath string) error { return vm.addDevice(floppy) } +func (vm *VirtualMachine) SetBootOrder(order []string) error { + devices, err := vm.vm.Device(vm.driver.ctx) + if err != nil { + return err + } + + bootOptions := types.VirtualMachineBootOptions{ + BootOrder: devices.BootOrder(order), + } + + return vm.vm.SetBootOptions(vm.driver.ctx, &bootOptions) +} + func (vm *VirtualMachine) addDevice(device types.BaseVirtualDevice) error { newDevices := object.VirtualDeviceList{device} confSpec := types.VirtualMachineConfigSpec{} diff --git a/iso/builder.go b/iso/builder.go index e55bc1d73..99869c393 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -49,7 +49,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.Comm.Type != "none" { steps = append(steps, - &common.StepRun{}, + &common.StepRun{ + Config: &b.config.RunConfig, + }, &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost, diff --git a/iso/config.go b/iso/config.go index c3ca72d5d..6646d3235 100644 --- a/iso/config.go +++ b/iso/config.go @@ -9,12 +9,13 @@ import ( ) type Config struct { - packerCommon.PackerConfig `mapstructure:",squash"` - common.ConnectConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - common.ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` + packerCommon.PackerConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + common.ConnectConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` CreateConfig `mapstructure:",squash"` CDRomConfig `mapstructure:",squash"` @@ -31,6 +32,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs := new(packer.MultiError) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) From 65b98a57cf49df6f73cefbccbf944ccdfbfe1983 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Tue, 30 Jan 2018 23:15:30 +0300 Subject: [PATCH 117/266] Add support for custom networks --- driver/vm.go | 7 ++++--- iso/step_create.go | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 5a307a0ee..28d8a3c0d 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -47,6 +47,7 @@ type CreateConfig struct { ResourcePool string Datastore string GuestOS string // example: otherGuest + Network string // "" for default network Overwrite bool } @@ -109,7 +110,7 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { if err != nil { return nil, err } - devices, err = addNetwork(d, devices) + devices, err = addNetwork(d, devices, config) if err != nil { return nil, err } @@ -394,8 +395,8 @@ func addDisk(d *Driver, devices object.VirtualDeviceList, config *CreateConfig) return devices, nil } -func addNetwork(d *Driver, devices object.VirtualDeviceList) (object.VirtualDeviceList, error) { - network, err := d.finder.DefaultNetwork(d.ctx) +func addNetwork(d *Driver, devices object.VirtualDeviceList, config *CreateConfig) (object.VirtualDeviceList, error) { + network, err := d.finder.NetworkOrDefault(d.ctx, config.Network) if err != nil { return nil, err } diff --git a/iso/step_create.go b/iso/step_create.go index c47e9fb8d..b1d5232c6 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -20,6 +20,7 @@ type CreateConfig struct { ResourcePool string `mapstructure:"resource_pool"` Datastore string `mapstructure:"datastore"` GuestOSType string `mapstructure:"guest_os_type"` + Network string `mapstructure:"network"` } func (c *CreateConfig) Prepare() []error { @@ -75,6 +76,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { ResourcePool: s.config.ResourcePool, Datastore: s.config.Datastore, GuestOS: s.config.GuestOSType, + Network: s.config.Network, }) if err != nil { From 6235ecc129d40bd57849d498fc2cf7487266abc3 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 31 Jan 2018 14:31:11 +0300 Subject: [PATCH 118/266] Add network card customization and fix iso builder acceptance tests --- driver/vm.go | 12 +++++++++++- iso/builder_acc_test.go | 37 ++++++++++++++++++++++++++++++++++++- iso/step_create.go | 2 ++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 28d8a3c0d..9609e8c90 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -49,6 +49,7 @@ type CreateConfig struct { GuestOS string // example: otherGuest Network string // "" for default network Overwrite bool + NetworkCard string // example: vmxnet3 } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { @@ -153,6 +154,15 @@ func (vm *VirtualMachine) Info(params ...string) (*mo.VirtualMachine, error) { return &info, nil } +func (vm *VirtualMachine) Devices() (object.VirtualDeviceList, error) { + vmInfo, err := vm.Info("config.hardware.device") + if err != nil { + return nil, err + } + + return vmInfo.Config.Hardware.Device, nil +} + func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, error) { folder, err := template.driver.FindFolder(config.Folder) if err != nil { @@ -406,7 +416,7 @@ func addNetwork(d *Driver, devices object.VirtualDeviceList, config *CreateConfi return nil, err } - device, err := object.EthernetCardTypes().CreateEthernetCard("", backing) + device, err := object.EthernetCardTypes().CreateEthernetCard(config.NetworkCard, backing) if err != nil { return nil, err } diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index da45a1d2b..7f07e85f2 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -12,7 +12,7 @@ func TestISOBuilderAcc_default(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: commonT.RenderConfig(config), - Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), + Check: checkDefault(t, config["vm_name"].(string), config["host"].(string), "datastore1"), }) } @@ -29,6 +29,7 @@ func defaultConfig() map[string]interface{} { "ssh_password": "jetbrains", "vm_name": commonT.NewVMName(), + "communicator": "none", // do not start the VM without any bootable devices } return config @@ -159,3 +160,37 @@ func cdromConfig() string { config["iso_path"] = "[datastore1] alpine-standard-3.6.2-x86_64.iso" return commonT.RenderConfig(config) } + +func TestISOBuilderAcc_networkCard(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: networkCardConfig(), + Check: checkNetworkCard(t), + }) +} + +func networkCardConfig() string { + config := defaultConfig() + config["network_card"] = "vmxnet3" + return commonT.RenderConfig(config) +} + +func checkNetworkCard(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + + vm := commonT.GetVM(t, d, artifacts) + devices, err := vm.Devices() + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + for _, device := range devices { + if devices.TypeName(device) == "VirtualVmxnet3" { + return nil + } + } + t.Errorf("Cannot find selected network card") + + return nil + } +} diff --git a/iso/step_create.go b/iso/step_create.go index b1d5232c6..819ff7d36 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -21,6 +21,7 @@ type CreateConfig struct { Datastore string `mapstructure:"datastore"` GuestOSType string `mapstructure:"guest_os_type"` Network string `mapstructure:"network"` + NetworkCard string `mapstructure:"network_card"` } func (c *CreateConfig) Prepare() []error { @@ -77,6 +78,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { Datastore: s.config.Datastore, GuestOS: s.config.GuestOSType, Network: s.config.Network, + NetworkCard: s.config.NetworkCard, }) if err != nil { From 0861dbc2839733fb03c62ea9fd19087b09223972 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 31 Jan 2018 18:15:26 +0300 Subject: [PATCH 119/266] Add cdrom test for iso builder --- iso/builder_acc_test.go | 46 +++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 7f07e85f2..f7c9d4b06 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -5,6 +5,7 @@ import ( commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "testing" "github.com/hashicorp/packer/packer" + "github.com/vmware/govmomi/vim25/types" ) func TestISOBuilderAcc_default(t *testing.T) { @@ -28,7 +29,7 @@ func defaultConfig() map[string]interface{} { "ssh_username": "root", "ssh_password": "jetbrains", - "vm_name": commonT.NewVMName(), + "vm_name": commonT.NewVMName(), "communicator": "none", // do not start the VM without any bootable devices } @@ -152,6 +153,7 @@ func TestISOBuilderAcc_cdrom(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: cdromConfig(), + Check: checkCDRom(t), }) } @@ -161,6 +163,33 @@ func cdromConfig() string { return commonT.RenderConfig(config) } +func checkCDRom(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + + vm := commonT.GetVM(t, d, artifacts) + devices, err := vm.Devices() + if err != nil { + t.Fatalf("cannot read VM properties: %v", err) + } + + cdrom, err := devices.FindCdrom("") + if err != nil { + t.Fatalf("cannot find cdrom: %v", err) + } + iso, ok := cdrom.Backing.(*types.VirtualCdromIsoBackingInfo) + if !ok { + t.Fatalf("the iso is not connected") + } + expectedFileName := "[datastore1] alpine-standard-3.6.2-x86_64.iso" + if iso.FileName != expectedFileName { + t.Fatalf("invalid iso filename: expected '%v', got '%v'", expectedFileName, iso.FileName) + } + + return nil + } +} + func TestISOBuilderAcc_networkCard(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -184,12 +213,17 @@ func checkNetworkCard(t *testing.T) builderT.TestCheckFunc { if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } - for _, device := range devices { - if devices.TypeName(device) == "VirtualVmxnet3" { - return nil - } + + netCards := devices.SelectByType((*types.VirtualEthernetCard)(nil)) + if len(netCards) == 0 { + t.Fatalf("Cannot find the network card") + } + if len(netCards) > 1 { + t.Fatalf("Found several network catds") + } + if _, ok := netCards[0].(*types.VirtualVmxnet3); !ok { + t.Errorf("The network card type is not the expected one (vmxnet3)") } - t.Errorf("Cannot find selected network card") return nil } From 9139a6029b22c510ee1dad6db127e696cb8e5d10 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Wed, 31 Jan 2018 20:29:03 +0300 Subject: [PATCH 120/266] Add support for multiple cdroms for iso builder --- iso/builder_acc_test.go | 28 +++++++++++++++++----------- iso/step_add_cdrom.go | 14 ++++++++------ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index f7c9d4b06..b0f1d78ad 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/vim25/types" + "fmt" ) func TestISOBuilderAcc_default(t *testing.T) { @@ -159,7 +160,10 @@ func TestISOBuilderAcc_cdrom(t *testing.T) { func cdromConfig() string { config := defaultConfig() - config["iso_path"] = "[datastore1] alpine-standard-3.6.2-x86_64.iso" + config["iso_paths"] = []string{ + "[datastore1] test0.iso", + "[datastore1] test1.iso", + } return commonT.RenderConfig(config) } @@ -173,17 +177,19 @@ func checkCDRom(t *testing.T) builderT.TestCheckFunc { t.Fatalf("cannot read VM properties: %v", err) } - cdrom, err := devices.FindCdrom("") - if err != nil { - t.Fatalf("cannot find cdrom: %v", err) + cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) + if len(cdroms) != 2 { + t.Fatalf("expected 2 cdroms, found %v", len(cdroms)) } - iso, ok := cdrom.Backing.(*types.VirtualCdromIsoBackingInfo) - if !ok { - t.Fatalf("the iso is not connected") - } - expectedFileName := "[datastore1] alpine-standard-3.6.2-x86_64.iso" - if iso.FileName != expectedFileName { - t.Fatalf("invalid iso filename: expected '%v', got '%v'", expectedFileName, iso.FileName) + for i := range cdroms { + iso, ok := cdroms[i].(*types.VirtualCdrom).Backing.(*types.VirtualCdromIsoBackingInfo) + if !ok { + t.Fatalf("the iso 'test%v.iso' is not connected", i) + } + expectedFileName := fmt.Sprintf("[datastore1] test%v.iso", i) + if iso.FileName != expectedFileName { + t.Fatalf("invalid iso filename: expected '%v', got '%v'", expectedFileName, iso.FileName) + } } return nil diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 668055e30..a6716b76a 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -4,10 +4,11 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/mitchellh/multistep" + "fmt" ) type CDRomConfig struct { - ISOPath string `mapstructure:"iso_path"` + ISOPaths []string `mapstructure:"iso_paths"` } func (c *CDRomConfig) Prepare() []error { @@ -21,13 +22,14 @@ type StepAddCDRom struct { func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) - ui.Say("Adding CDRom...") + ui.Say("Adding CDRoms...") vm := state.Get("vm").(*driver.VirtualMachine) - err := vm.AddCdrom(s.config.ISOPath) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt + for _, path := range s.config.ISOPaths { + if err := vm.AddCdrom(path); err != nil { + state.Put("error", fmt.Errorf("error adding a cdrom: %v", err)) + return multistep.ActionHalt + } } return multistep.ActionContinue From cf198539e8a195925a7e0b49ef535e89b148a1c3 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Thu, 1 Feb 2018 14:47:09 +0300 Subject: [PATCH 121/266] Add support for dynamically create floppy images --- driver/datastore.go | 42 +++++++++++++------ driver/vm.go | 31 ++++++++------ iso/builder.go | 13 ++++-- iso/builder_acc_test.go | 36 ++++++++++++++++ iso/step_add_cdrom.go | 4 +- iso/step_add_floppy.go | 91 ++++++++++++++++++++++++++++++----------- iso/step_create.go | 26 ++++++------ 7 files changed, 176 insertions(+), 67 deletions(-) diff --git a/driver/datastore.go b/driver/datastore.go index bce5962fb..a0569457e 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -4,32 +4,23 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" ) type Datastore struct { - ds *object.Datastore + ds *object.Datastore driver *Driver } func (d *Driver) NewDatastore(ref *types.ManagedObjectReference) *Datastore { return &Datastore{ - ds: object.NewDatastore(d.client.Client, *ref), + ds: object.NewDatastore(d.client.Client, *ref), driver: d, } } +// If name is an empty string, returns the default datastore (is exists) func (d *Driver) FindDatastore(name string) (*Datastore, error) { - ds, err := d.finder.Datastore(d.ctx, name) - if err != nil { - return nil, err - } - return &Datastore{ - ds: ds, - driver: d, - }, nil -} - -func (d *Driver) FindDatastoreOrDefault(name string) (*Datastore, error) { ds, err := d.finder.DatastoreOrDefault(d.ctx, name) if err != nil { return nil, err @@ -67,3 +58,28 @@ func (ds *Datastore) Name() string { func (ds *Datastore) ResolvePath(path string) string { return ds.ds.Path(path) } + +func (ds *Datastore) UploadFile(src, dst string) error { + p := soap.DefaultUpload + return ds.ds.UploadFile(ds.driver.ctx, src, dst, &p) +} + +func (ds *Datastore) Delete(path string) error { + dc, err := ds.driver.finder.Datacenter(ds.driver.ctx, ds.ds.DatacenterPath) + if err != nil { + return err + } + fm := ds.ds.NewFileManager(dc, false) + return fm.Delete(ds.driver.ctx, path) +} + +// Cuts out the datastore prefix +// Example: "[datastore1] file.ext" --> "file.ext" +func RemoveDatastorePrefix(path string) string { + res := object.DatastorePath{} + if hadPrefix := res.FromString(path); hadPrefix { + return res.Path + } else { + return path + } +} diff --git a/driver/vm.go b/driver/vm.go index 9609e8c90..edd79dbb4 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -7,6 +7,7 @@ import ( "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" "time" + "strings" ) type VirtualMachine struct { @@ -48,7 +49,6 @@ type CreateConfig struct { Datastore string GuestOS string // example: otherGuest Network string // "" for default network - Overwrite bool NetworkCard string // example: vmxnet3 } @@ -88,19 +88,11 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { return nil, err } - datastore, err := d.FindDatastoreOrDefault(config.Datastore) + datastore, err := d.FindDatastore(config.Datastore) if err != nil { return nil, err } - if !config.Overwrite { - vmxPath := fmt.Sprintf("%s/%s.vmx", config.Name, config.Name) - if datastore.FileExists(vmxPath) { - dsPath := datastore.ResolvePath(vmxPath) - return nil, fmt.Errorf("File '%s' already exists", dsPath) - } - } - devices := object.VirtualDeviceList{} devices, err = addIDE(devices) @@ -178,7 +170,7 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err poolRef := pool.pool.Reference() relocateSpec.Pool = &poolRef - datastore, err := template.driver.FindDatastoreOrDefault(config.Datastore) + datastore, err := template.driver.FindDatastore(config.Datastore) if err != nil { return nil, err } @@ -349,6 +341,21 @@ func (vm *VirtualMachine) ConvertToTemplate() error { return vm.vm.MarkAsTemplate(vm.driver.ctx) } +func (vm *VirtualMachine) GetDir() (string, error) { + vmInfo, err := vm.Info("name", "layoutEx.file") + if err != nil { + return "", err + } + + vmxName := fmt.Sprintf("/%s.vmx", vmInfo.Name) + for _, file := range vmInfo.LayoutEx.File { + if strings.HasSuffix(file.Name, vmxName) { + return file.Name[:len(file.Name)-len(vmxName)], nil + } + } + return "", fmt.Errorf("cannot find '%s'", vmxName) +} + func (config HardwareConfig) toConfigSpec() types.VirtualMachineConfigSpec { var confSpec types.VirtualMachineConfigSpec confSpec.NumCPUs = config.CPUs @@ -377,7 +384,7 @@ func (config CreateConfig) toConfigSpec() types.VirtualMachineConfigSpec { return confSpec } -func addDisk(d *Driver, devices object.VirtualDeviceList, config *CreateConfig) (object.VirtualDeviceList, error) { +func addDisk(_ *Driver, devices object.VirtualDeviceList, config *CreateConfig) (object.VirtualDeviceList, error) { device, err := devices.CreateSCSIController(config.DiskControllerType) if err != nil { return nil, err diff --git a/iso/builder.go b/iso/builder.go index 99869c393..b726b57a5 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -30,20 +30,25 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("hook", hook) state.Put("ui", ui) - steps := []multistep.Step{} + var steps []multistep.Step steps = append(steps, &common.StepConnect{ Config: &b.config.ConnectConfig, }, &StepCreateVM{ - config: &b.config.CreateConfig, + Config: &b.config.CreateConfig, }, &StepAddCDRom{ - config: &b.config.CDRomConfig, + Config: &b.config.CDRomConfig, + }, + &packerCommon.StepCreateFloppy{ + Files: b.config.FloppyFiles, + Directories: b.config.FloppyDirectories, }, &StepAddFloppy{ - config: &b.config.FloppyConfig, + Config: &b.config.FloppyConfig, + Datastore: b.config.Datastore, }, ) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index b0f1d78ad..57a09a482 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/vmware/govmomi/vim25/types" "fmt" + "io/ioutil" ) func TestISOBuilderAcc_default(t *testing.T) { @@ -234,3 +235,38 @@ func checkNetworkCard(t *testing.T) builderT.TestCheckFunc { return nil } } + +func TestISOBuilderAcc_createFloppy(t *testing.T) { + tmpFile, err := ioutil.TempFile("", "packer-vsphere-iso-test") + if err != nil { + t.Fatalf("Error creating temp file ") + } + content := "Hello, World!" + fmt.Fprint(tmpFile, content) + tmpFile.Close() + + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: createFloppyConfig(tmpFile.Name()), + Check: checkCreateFloppy(t, content), + }) +} + +func createFloppyConfig(filePath string) string { + config := defaultConfig() + config["floppy_files"] = []string{filePath} + return commonT.RenderConfig(config) +} + +func checkCreateFloppy(t *testing.T, content string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + + vm := commonT.GetVM(t, d, artifacts) + _, err := vm.GetDir() + if err != nil { + t.Fatalf(err.Error()) + } + return nil + } +} diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index a6716b76a..ebe94a90d 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -16,7 +16,7 @@ func (c *CDRomConfig) Prepare() []error { } type StepAddCDRom struct { - config *CDRomConfig + Config *CDRomConfig } func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { @@ -25,7 +25,7 @@ func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Adding CDRoms...") vm := state.Get("vm").(*driver.VirtualMachine) - for _, path := range s.config.ISOPaths { + for _, path := range s.Config.ISOPaths { if err := vm.AddCdrom(path); err != nil { state.Put("error", fmt.Errorf("error adding a cdrom: %v", err)) return multistep.ActionHalt diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index e8c8e2fd0..f9efa5f20 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -26,38 +26,83 @@ func (c *FloppyConfig) Prepare() []error { } type StepAddFloppy struct { - config *FloppyConfig + Config *FloppyConfig + Datastore string + + uploadedFloppyPath string } func (s *StepAddFloppy) Run(state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - - ui.Say("Adding Floppy...") - - floppyIMGPath := s.config.FloppyIMGPath - if s.config.FloppyFiles != nil || s.config.FloppyDirectories != nil { - var err error - floppyIMGPath, err = s.createFloppy() - if err != nil { - state.Put("error", fmt.Errorf("Error creating floppy image: %v", err)) - } - } - - vm := state.Get("vm").(*driver.VirtualMachine) - err := vm.AddFloppy(floppyIMGPath) + err := s.runImpl(state) if err != nil { - state.Put("error", err) + state.Put("error", fmt.Errorf("error adding floppy: %v", err)) return multistep.ActionHalt } - return multistep.ActionContinue } -func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { - // nothing +func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + d := state.Get("driver").(*driver.Driver) + + tmpFloppy := state.Get("floppy_path") + if s.Config.FloppyIMGPath != "" && tmpFloppy != nil { + return fmt.Errorf("'floppy_img_path' cannot be used together with 'floppy_files' and 'floppy_dirs'") + } + + var floppyIMGPath string + if tmpFloppy != nil { + ui.Say("Uploading created floppy image") + + ds, err := d.FindDatastore(s.Datastore) + if err != nil { + return err + } + vmDir, err := vm.GetDir() + if err != nil { + return err + } + vmDir = driver.RemoveDatastorePrefix(vmDir) + + uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.img", vmDir) + if err := ds.UploadFile(tmpFloppy.(string), uploadPath); err != nil { + return fmt.Errorf("error uploading floppy image: %v", err) + } + + // remember the path to the temporary floppy image to remove it after the build is finished + s.uploadedFloppyPath = uploadPath + floppyIMGPath = ds.ResolvePath(uploadPath) + } else { + floppyIMGPath = s.Config.FloppyIMGPath + } + + ui.Say("Adding Floppy...") + err := vm.AddFloppy(floppyIMGPath) + if err != nil { + return err + } + + return nil } -func (s *StepAddFloppy) createFloppy() (string, error) { - return "", fmt.Errorf("Not implemented") - // TODO +func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { + if s.uploadedFloppyPath == "" { + return + } + + ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*driver.Driver) + + ds, err := d.FindDatastore(s.Datastore) + if err != nil { + ui.Error(err.Error()) + return + } + if err := ds.Delete(s.uploadedFloppyPath); err != nil { + ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", s.uploadedFloppyPath, err.Error())) + return + } + + // TODO: remove Floppy device, or eject the img } diff --git a/iso/step_create.go b/iso/step_create.go index 819ff7d36..91c7a5b26 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -57,7 +57,7 @@ func (c *CreateConfig) Prepare() []error { } type StepCreateVM struct { - config *CreateConfig + Config *CreateConfig } func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { @@ -67,22 +67,22 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Creating VM...") vm, err := d.CreateVM(&driver.CreateConfig{ - HardwareConfig: s.config.HardwareConfig.ToDriverHardwareConfig(), + HardwareConfig: s.Config.HardwareConfig.ToDriverHardwareConfig(), - DiskThinProvisioned: s.config.DiskThinProvisioned, - DiskControllerType: s.config.DiskControllerType, - Name: s.config.VMName, - Folder: s.config.Folder, - Host: s.config.Host, - ResourcePool: s.config.ResourcePool, - Datastore: s.config.Datastore, - GuestOS: s.config.GuestOSType, - Network: s.config.Network, - NetworkCard: s.config.NetworkCard, + DiskThinProvisioned: s.Config.DiskThinProvisioned, + DiskControllerType: s.Config.DiskControllerType, + Name: s.Config.VMName, + Folder: s.Config.Folder, + Host: s.Config.Host, + ResourcePool: s.Config.ResourcePool, + Datastore: s.Config.Datastore, + GuestOS: s.Config.GuestOSType, + Network: s.Config.Network, + NetworkCard: s.Config.NetworkCard, }) if err != nil { - state.Put("error", err) + state.Put("error", fmt.Errorf("error creating vm: %v", err)) return multistep.ActionHalt } From 9c4d5c6c59f1e26588080282858c0da4705f36f3 Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Thu, 1 Feb 2018 15:48:30 +0300 Subject: [PATCH 122/266] Cleanup after cf198539e8a195925a7e0b49ef535e89b148a1c3 --- driver/vm.go | 2 +- iso/builder_acc_test.go | 17 +---------------- iso/step_add_floppy.go | 3 +-- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index edd79dbb4..e9a3d0727 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -350,7 +350,7 @@ func (vm *VirtualMachine) GetDir() (string, error) { vmxName := fmt.Sprintf("/%s.vmx", vmInfo.Name) for _, file := range vmInfo.LayoutEx.File { if strings.HasSuffix(file.Name, vmxName) { - return file.Name[:len(file.Name)-len(vmxName)], nil + return RemoveDatastorePrefix(file.Name[:len(file.Name)-len(vmxName)]), nil } } return "", fmt.Errorf("cannot find '%s'", vmxName) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 57a09a482..d1c94c67c 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -241,14 +241,12 @@ func TestISOBuilderAcc_createFloppy(t *testing.T) { if err != nil { t.Fatalf("Error creating temp file ") } - content := "Hello, World!" - fmt.Fprint(tmpFile, content) + fmt.Fprint(tmpFile, "Hello, World!") tmpFile.Close() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: createFloppyConfig(tmpFile.Name()), - Check: checkCreateFloppy(t, content), }) } @@ -257,16 +255,3 @@ func createFloppyConfig(filePath string) string { config["floppy_files"] = []string{filePath} return commonT.RenderConfig(config) } - -func checkCreateFloppy(t *testing.T, content string) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := commonT.TestConn(t) - - vm := commonT.GetVM(t, d, artifacts) - _, err := vm.GetDir() - if err != nil { - t.Fatalf(err.Error()) - } - return nil - } -} diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index f9efa5f20..a43eeb54e 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -63,7 +63,6 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { if err != nil { return err } - vmDir = driver.RemoveDatastorePrefix(vmDir) uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.img", vmDir) if err := ds.UploadFile(tmpFloppy.(string), uploadPath); err != nil { @@ -104,5 +103,5 @@ func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { return } - // TODO: remove Floppy device, or eject the img + // the img will be automatically ejected } From 1851223ad24c35ecaf8f8145e34ec49d04b5c98c Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Thu, 1 Feb 2018 15:50:12 +0300 Subject: [PATCH 123/266] Make disk_size mandatory parameter for iso builder --- iso/builder_acc_test.go | 4 +++- iso/config.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index d1c94c67c..14cc6a6cc 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -31,7 +31,9 @@ func defaultConfig() map[string]interface{} { "ssh_username": "root", "ssh_password": "jetbrains", - "vm_name": commonT.NewVMName(), + "vm_name": commonT.NewVMName(), + "disk_size": 2, + "communicator": "none", // do not start the VM without any bootable devices } diff --git a/iso/config.go b/iso/config.go index 6646d3235..2b29c67ba 100644 --- a/iso/config.go +++ b/iso/config.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "fmt" ) type Config struct { @@ -35,6 +36,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + if c.DiskSize <= 0 { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("'disk_size' must be provided")) + } errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) From 78d53c81ce0c88e08bb8942e2b1f115c4dff707a Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Fri, 2 Feb 2018 21:04:32 +0300 Subject: [PATCH 124/266] Remove cdroms and floppy in the cleanup stage of iso builder --- driver/vm.go | 4 ++++ iso/builder_acc_test.go | 30 ------------------------------ iso/step_add_cdrom.go | 16 +++++++++++++--- iso/step_add_floppy.go | 29 ++++++++++++++++++----------- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index e9a3d0727..bfa642b1a 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -494,6 +494,10 @@ func (vm *VirtualMachine) SetBootOrder(order []string) error { return vm.vm.SetBootOptions(vm.driver.ctx, &bootOptions) } +func (vm *VirtualMachine) RemoveDevice(keepFiles bool, device ...types.BaseVirtualDevice) error { + return vm.vm.RemoveDevice(vm.driver.ctx, keepFiles, device...) +} + func (vm *VirtualMachine) addDevice(device types.BaseVirtualDevice) error { newDevices := object.VirtualDeviceList{device} confSpec := types.VirtualMachineConfigSpec{} diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 14cc6a6cc..5e05d4c0e 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -157,7 +157,6 @@ func TestISOBuilderAcc_cdrom(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: cdromConfig(), - Check: checkCDRom(t), }) } @@ -170,35 +169,6 @@ func cdromConfig() string { return commonT.RenderConfig(config) } -func checkCDRom(t *testing.T) builderT.TestCheckFunc { - return func(artifacts []packer.Artifact) error { - d := commonT.TestConn(t) - - vm := commonT.GetVM(t, d, artifacts) - devices, err := vm.Devices() - if err != nil { - t.Fatalf("cannot read VM properties: %v", err) - } - - cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) - if len(cdroms) != 2 { - t.Fatalf("expected 2 cdroms, found %v", len(cdroms)) - } - for i := range cdroms { - iso, ok := cdroms[i].(*types.VirtualCdrom).Backing.(*types.VirtualCdromIsoBackingInfo) - if !ok { - t.Fatalf("the iso 'test%v.iso' is not connected", i) - } - expectedFileName := fmt.Sprintf("[datastore1] test%v.iso", i) - if iso.FileName != expectedFileName { - t.Fatalf("invalid iso filename: expected '%v', got '%v'", expectedFileName, iso.FileName) - } - } - - return nil - } -} - func TestISOBuilderAcc_networkCard(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index ebe94a90d..1dd7f6e17 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -5,6 +5,7 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/mitchellh/multistep" "fmt" + "github.com/vmware/govmomi/vim25/types" ) type CDRomConfig struct { @@ -21,10 +22,9 @@ type StepAddCDRom struct { func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) ui.Say("Adding CDRoms...") - - vm := state.Get("vm").(*driver.VirtualMachine) for _, path := range s.Config.ISOPaths { if err := vm.AddCdrom(path); err != nil { state.Put("error", fmt.Errorf("error adding a cdrom: %v", err)) @@ -36,5 +36,15 @@ func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { } func (s *StepAddCDRom) Cleanup(state multistep.StateBag) { - // nothing + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + devices, err := vm.Devices() + if err != nil { + ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) + } + cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) + if err = vm.RemoveDevice(false, cdroms...); err != nil { + ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) + } } diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index a43eeb54e..3b996458f 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "fmt" + "github.com/vmware/govmomi/vim25/types" ) type FloppyConfig struct { @@ -86,22 +87,28 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { } func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { - if s.uploadedFloppyPath == "" { - return - } - ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver) - ds, err := d.FindDatastore(s.Datastore) + devices, err := vm.Devices() if err != nil { - ui.Error(err.Error()) - return + ui.Error(fmt.Sprintf("error removing floppy: %v", err)) } - if err := ds.Delete(s.uploadedFloppyPath); err != nil { - ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", s.uploadedFloppyPath, err.Error())) - return + cdroms := devices.SelectByType((*types.VirtualFloppy)(nil)) + if err = vm.RemoveDevice(false, cdroms...); err != nil { + ui.Error(fmt.Sprintf("error removing floppy: %v", err)) } - // the img will be automatically ejected + if s.uploadedFloppyPath != "" { + ds, err := d.FindDatastore(s.Datastore) + if err != nil { + ui.Error(err.Error()) + return + } + if err := ds.Delete(s.uploadedFloppyPath); err != nil { + ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", s.uploadedFloppyPath, err.Error())) + return + } + } } From 4875b82d12f3f82452a80645c56992a53c506dfc Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Mon, 12 Feb 2018 15:56:29 +0300 Subject: [PATCH 125/266] Make waiting for IP address interruptible fixes #24 --- clone/builder.go | 1 + common/step_run.go | 9 ------- common/step_wait_for_ip.go | 49 ++++++++++++++++++++++++++++++++++++++ iso/builder.go | 1 + 4 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 common/step_wait_for_ip.go diff --git a/clone/builder.go b/clone/builder.go index c4838efdf..51b54d3e5 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -50,6 +50,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepRun{ Config: &b.config.RunConfig, }, + &common.StepWaitForIp{}, &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost, diff --git a/common/step_run.go b/common/step_run.go index e4210b2ce..305acdc05 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -39,15 +39,6 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - ui.Say("Waiting for IP...") - ip, err := vm.WaitForIP() - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - state.Put("ip", ip) - ui.Say(fmt.Sprintf("IP address: %v", ip)) - return multistep.ActionContinue } diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go new file mode 100644 index 000000000..da33b0b91 --- /dev/null +++ b/common/step_wait_for_ip.go @@ -0,0 +1,49 @@ +package common + +import ( + "github.com/mitchellh/multistep" + "fmt" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "time" +) + +type StepWaitForIp struct{} + +func (s *StepWaitForIp) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + ui.Say("Waiting for IP...") + + ipChan := make(chan string) + errChan := make(chan error) + go func() { + ip, err := vm.WaitForIP() + if err != nil { + errChan <- err + } else { + ipChan <- ip + } + }() + + for { + select { + case err := <-errChan: + state.Put("error", err) + return multistep.ActionHalt + case ip := <-ipChan: + state.Put("ip", ip) + ui.Say(fmt.Sprintf("IP address: %v", ip)) + return multistep.ActionContinue + case <-time.After(1 * time.Second): + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return multistep.ActionHalt + } + } + } +} + +func (s *StepWaitForIp) Cleanup(state multistep.StateBag) { + // nothing +} diff --git a/iso/builder.go b/iso/builder.go index b726b57a5..2e9307190 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -57,6 +57,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepRun{ Config: &b.config.RunConfig, }, + &common.StepWaitForIp{}, &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost, From 47cccb4e0231d856cae31a809e90e4f40a089bcb Mon Sep 17 00:00:00 2001 From: Andrei Tonkikh Date: Mon, 12 Feb 2018 16:07:43 +0300 Subject: [PATCH 126/266] Add "boot_wait" parameter --- common/step_run.go | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/common/step_run.go b/common/step_run.go index 305acdc05..e9ff7c2ee 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -6,14 +6,29 @@ import ( "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" + "time" ) type RunConfig struct { - BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" + BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" + RawBootWait string `mapstructure:"boot_wait"` // example: "1m30s"; default: "10s" + bootWait time.Duration `` } func (c *RunConfig) Prepare() []error { - return nil + var errs []error + + if c.RawBootWait == "" { + c.RawBootWait = "10s" + } + + var err error + c.bootWait, err = time.ParseDuration(c.RawBootWait) + if err != nil { + errs = append(errs, fmt.Errorf("failed parsing boot_wait: %s", err)) + } + + return errs } type StepRun struct { @@ -39,6 +54,22 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } + if int64(s.Config.bootWait) > 0 { + ui.Say(fmt.Sprintf("Waiting %s for boot...", s.Config.bootWait)) + wait := time.After(s.Config.bootWait) + WAITLOOP: + for { + select { + case <-wait: + break WAITLOOP + case <-time.After(1 * time.Second): + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return multistep.ActionHalt + } + } + } + } + return multistep.ActionContinue } From bc3810f5c0e25ca75e6ba878ebc0570dcb19f471 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 14 Feb 2018 11:01:41 +0300 Subject: [PATCH 127/266] 'floppy_files' and 'floppy_files' create two separate drives --- iso/step_add_floppy.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 3b996458f..b645265e2 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -48,11 +48,6 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { d := state.Get("driver").(*driver.Driver) tmpFloppy := state.Get("floppy_path") - if s.Config.FloppyIMGPath != "" && tmpFloppy != nil { - return fmt.Errorf("'floppy_img_path' cannot be used together with 'floppy_files' and 'floppy_dirs'") - } - - var floppyIMGPath string if tmpFloppy != nil { ui.Say("Uploading created floppy image") @@ -72,15 +67,21 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { // remember the path to the temporary floppy image to remove it after the build is finished s.uploadedFloppyPath = uploadPath - floppyIMGPath = ds.ResolvePath(uploadPath) - } else { - floppyIMGPath = s.Config.FloppyIMGPath + floppyIMGPath := ds.ResolvePath(uploadPath) + ui.Say("Adding generated Floppy...") + err = vm.AddFloppy(floppyIMGPath) + if err != nil { + return err + } } - ui.Say("Adding Floppy...") - err := vm.AddFloppy(floppyIMGPath) - if err != nil { - return err + if s.Config.FloppyIMGPath != "" { + floppyIMGPath := s.Config.FloppyIMGPath + ui.Say("Adding Floppy image...") + err := vm.AddFloppy(floppyIMGPath) + if err != nil { + return err + } } return nil From 03d9501673e0fa7a5bb093b53db72357a075cf1b Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sun, 18 Feb 2018 02:59:51 +0300 Subject: [PATCH 128/266] Windows build example (#52) --- examples/windows/.gitattributes | 2 + examples/windows/setup/Autounattend.xml | 122 ++++++++++++++++++++++++ examples/windows/setup/setup.ps1 | 15 +++ examples/windows/setup/vmtools.cmd | 2 + examples/windows/windows-10.json | 49 ++++++++++ 5 files changed, 190 insertions(+) create mode 100644 examples/windows/.gitattributes create mode 100644 examples/windows/setup/Autounattend.xml create mode 100644 examples/windows/setup/setup.ps1 create mode 100644 examples/windows/setup/vmtools.cmd create mode 100644 examples/windows/windows-10.json diff --git a/examples/windows/.gitattributes b/examples/windows/.gitattributes new file mode 100644 index 000000000..da5ccf8df --- /dev/null +++ b/examples/windows/.gitattributes @@ -0,0 +1,2 @@ +*.cmd text eol=crlf +*.ps1 text eol=crlf diff --git a/examples/windows/setup/Autounattend.xml b/examples/windows/setup/Autounattend.xml new file mode 100644 index 000000000..9c3d30416 --- /dev/null +++ b/examples/windows/setup/Autounattend.xml @@ -0,0 +1,122 @@ + + + + + en-US + + + + + + + B:\ + + + + + + + true + + + + + + + + + /IMAGE/NAME + Windows 10 Pro + + + true + + + + + + 0 + + + 1 + true + Primary + + + + + + + + + + + false + + + + + + + + 1 + + a:\vmtools.cmd + Always + + + + + + + + en-US + + + + + + 3 + + + + + + + + jetbrains + + jetbrains + true</PlainText> + </Password> + <Group>Administrators</Group> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + + <AutoLogon> + <Enabled>true</Enabled> + <Username>jetbrains</Username> + <Password> + <Value>jetbrains</Value> + <PlainText>true</PlainText> + </Password> + <LogonCount>1</LogonCount> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <Order>1</Order> + <!-- Enable WinRM service --> + <CommandLine>powershell -ExecutionPolicy Bypass -File a:\setup.ps1</CommandLine> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> +</unattend> diff --git a/examples/windows/setup/setup.ps1 b/examples/windows/setup/setup.ps1 new file mode 100644 index 000000000..27e65a55e --- /dev/null +++ b/examples/windows/setup/setup.ps1 @@ -0,0 +1,15 @@ +$ErrorActionPreference = "Stop" + +# Switch network connection to private mode +# Required for WinRM firewall rules +$profile = Get-NetConnectionProfile +Set-NetConnectionProfile -Name $profile.Name -NetworkCategory Private + +# Enable WinRM service +winrm quickconfig -quiet +winrm set winrm/config/service '@{AllowUnencrypted="true"}' +winrm set winrm/config/service/auth '@{Basic="true"}' + +# Reset auto logon count +# https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount#logoncount-known-issue +Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoLogonCount -Value 0 diff --git a/examples/windows/setup/vmtools.cmd b/examples/windows/setup/vmtools.cmd new file mode 100644 index 000000000..c6256cc05 --- /dev/null +++ b/examples/windows/setup/vmtools.cmd @@ -0,0 +1,2 @@ +rem Silent mode, basic UI, no reboot +e:\setup64 /s /v "/qb REBOOT=R" diff --git a/examples/windows/windows-10.json b/examples/windows/windows-10.json new file mode 100644 index 000000000..18288dd86 --- /dev/null +++ b/examples/windows/windows-10.json @@ -0,0 +1,49 @@ +{ + "builders": [ + { + "type": "vsphere-iso", + + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": "true", + + "vm_name": "example-windows", + "host": "esxi-1.vsphere65.test", + + "guest_os_type": "windows9_64Guest", + + "communicator": "winrm", + "winrm_username": "jetbrains", + "winrm_password": "jetbrains", + + "CPUs": 1, + "RAM": 4096, + "RAM_reserve_all": true, + + "disk_controller_type": "pvscsi", + "disk_size": 32, + "disk_thin_provisioned": true, + + "network_card": "vmxnet3", + + "iso_paths": [ + "[datastore1] ISO/en_windows_10_multi-edition_vl_version_1709_updated_dec_2017_x64_dvd_100406172.iso", + "[datastore1] ISO/VMware Tools/10.2.0/windows.iso" + ], + + "floppy_files": [ + "setup/" + ], + "floppy_img_path": "[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp", + "boot_order": "disk,cdrom" + } + ], + + "provisioners": [ + { + "type": "windows-shell", + "inline": ["dir c:\\"] + } + ] +} From b636eb2bf18f525de540ec38684090a8a99fa2f7 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 18 Feb 2018 05:13:56 +0300 Subject: [PATCH 129/266] Boot command (#53) --- driver/vm_keyboard.go | 82 ++++++++++++++ examples/ubuntu/preseed.cfg | 16 +++ examples/ubuntu/ubuntu-16.04.json | 63 +++++++++++ glide.lock | 9 +- glide.yaml | 1 + iso/builder.go | 3 + iso/config.go | 1 + iso/step_boot_command.go | 173 ++++++++++++++++++++++++++++++ 8 files changed, 346 insertions(+), 2 deletions(-) create mode 100644 driver/vm_keyboard.go create mode 100644 examples/ubuntu/preseed.cfg create mode 100644 examples/ubuntu/ubuntu-16.04.json create mode 100644 iso/step_boot_command.go diff --git a/driver/vm_keyboard.go b/driver/vm_keyboard.go new file mode 100644 index 000000000..02b86a197 --- /dev/null +++ b/driver/vm_keyboard.go @@ -0,0 +1,82 @@ +package driver + +import ( + "strings" + "unicode" + "github.com/vmware/govmomi/vim25/types" + "github.com/vmware/govmomi/vim25/methods" + "golang.org/x/mobile/event/key" +) + +type KeyInput struct { + Message string + Scancode key.Code + Alt bool + Ctrl bool + Shift bool +} + +var scancodeMap = make(map[rune]key.Code) + +func init() { + scancodeIndex := make(map[string]key.Code) + scancodeIndex["abcdefghijklmnopqrstuvwxyz"] = key.CodeA + scancodeIndex["ABCDEFGHIJKLMNOPQRSTUVWXYZ"] = key.CodeA + scancodeIndex["1234567890"] = key.Code1 + scancodeIndex["!@#$%^&*()"] = key.Code1 + scancodeIndex[" "] = key.CodeSpacebar + scancodeIndex["-=[]\\"] = key.CodeHyphenMinus + scancodeIndex["_+{}|" ] = key.CodeHyphenMinus + scancodeIndex[ ";'`,./" ] = key.CodeSemicolon + scancodeIndex[":\"~<>?" ] = key.CodeSemicolon + + for chars, start := range scancodeIndex { + for i, r := range chars { + scancodeMap[r] = start + key.Code(i) + } + } +} + +const shiftedChars = "!@#$%^&*()_+{}|:\"~<>?" + +func (vm *VirtualMachine) TypeOnKeyboard(input KeyInput) (int32, error) { + var spec types.UsbScanCodeSpec + + for _, r := range input.Message { + scancode := scancodeMap[r] + shift := input.Shift || unicode.IsUpper(r) || strings.ContainsRune(shiftedChars, r) + + spec.KeyEvents = append(spec.KeyEvents, types.UsbScanCodeSpecKeyEvent{ + // https://github.com/lamw/vghetto-scripts/blob/f74bc8ba20064f46592bcce5a873b161a7fa3d72/powershell/VMKeystrokes.ps1#L130 + UsbHidCode: int32(scancode)<<16 | 7, + Modifiers: &types.UsbScanCodeSpecModifierType{ + LeftControl: &input.Ctrl, + LeftAlt: &input.Alt, + LeftShift: &shift, + }, + }) + } + + if input.Scancode != 0 { + spec.KeyEvents = append(spec.KeyEvents, types.UsbScanCodeSpecKeyEvent{ + UsbHidCode: int32(input.Scancode)<<16 | 7, + Modifiers: &types.UsbScanCodeSpecModifierType{ + LeftControl: &input.Ctrl, + LeftAlt: &input.Alt, + LeftShift: &input.Shift, + }, + }) + } + + req := &types.PutUsbScanCodes{ + This: vm.vm.Reference(), + Spec: spec, + } + + resp, err := methods.PutUsbScanCodes(vm.driver.ctx, vm.driver.client.RoundTripper, req) + if err != nil { + return 0, err + } + + return resp.Returnval, nil +} diff --git a/examples/ubuntu/preseed.cfg b/examples/ubuntu/preseed.cfg new file mode 100644 index 000000000..ec963b6b2 --- /dev/null +++ b/examples/ubuntu/preseed.cfg @@ -0,0 +1,16 @@ +d-i passwd/user-fullname string jetbrains +d-i passwd/username string jetbrains +d-i passwd/user-password password jetbrains +d-i passwd/user-password-again password jetbrains +d-i user-setup/allow-password-weak boolean true + +d-i partman-auto/disk string /dev/sda +d-i partman-auto/method string regular +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i pkgsel/include string open-vm-tools openssh-server + +d-i finish-install/reboot_in_progress note diff --git a/examples/ubuntu/ubuntu-16.04.json b/examples/ubuntu/ubuntu-16.04.json new file mode 100644 index 000000000..00d3d8227 --- /dev/null +++ b/examples/ubuntu/ubuntu-16.04.json @@ -0,0 +1,63 @@ +{ + "builders": [ + { + "type": "vsphere-iso", + + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": "true", + + "vm_name": "example-ubuntu", + "host": "esxi-1.vsphere65.test", + + "guest_os_type": "ubuntu64Guest", + + "ssh_username": "jetbrains", + "ssh_password": "jetbrains", + + "CPUs": 1, + "RAM": 1024, + "RAM_reserve_all": true, + + "disk_controller_type": "pvscsi", + "disk_size": 32, + "disk_thin_provisioned": true, + + "network_card": "vmxnet3", + + "iso_paths": [ + "[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso" + ], + "floppy_files": [ + "{{template_dir}}/preseed.cfg" + ], + "boot_command": [ + "<enter><wait><f6><esc><wait>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs>", + "/install/vmlinuz", + " initrd=/install/initrd.gz", + " priority=critical", + " locale=en_US", + " file=/media/preseed.cfg", + "<enter>" + ], + "boot_order": "disk,cdrom" + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": ["ls /"] + } + ] +} diff --git a/glide.lock b/glide.lock index 5354d3cd5..8d0be2549 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 709325293541fff31ae48288c6f5873f67f90ae6ab69d9ae4465fcdf0626d843 -updated: 2017-06-27T10:42:45.867528732+03:00 +hash: 9dff375b5720b1ffb1164694bb6aba1f546c9e2a93509000eb9919e5241610f1 +updated: 2018-02-17T22:26:59.87828+03:00 imports: - name: github.com/Azure/go-ntlmssp version: 29affced641074a59483ed003b5ef73a8bd3593c @@ -26,6 +26,7 @@ imports: - communicator/none - communicator/ssh - communicator/winrm + - helper/builder/testing - helper/communicator - helper/config - packer @@ -105,4 +106,8 @@ imports: - md4 - ssh - ssh/agent +- name: golang.org/x/mobile + version: 4bfed40defcb2fed54d60707c13cec9d7888a483 + subpackages: + - event/key testImports: [] diff --git a/glide.yaml b/glide.yaml index a95b811d0..e84e824fd 100644 --- a/glide.yaml +++ b/glide.yaml @@ -6,3 +6,4 @@ import: - package: github.com/vmware/govmomi version: v0.15.0 - package: golang.org/x/crypto +- package: golang.org/x/mobile diff --git a/iso/builder.go b/iso/builder.go index 2e9307190..822506149 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -57,6 +57,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepRun{ Config: &b.config.RunConfig, }, + &StepBootCommand{ + Config: &b.config.BootConfig, + }, &common.StepWaitForIp{}, &communicator.StepConnect{ Config: &b.config.Comm, diff --git a/iso/config.go b/iso/config.go index 2b29c67ba..516a6d279 100644 --- a/iso/config.go +++ b/iso/config.go @@ -12,6 +12,7 @@ import ( type Config struct { packerCommon.PackerConfig `mapstructure:",squash"` common.RunConfig `mapstructure:",squash"` + BootConfig `mapstructure:",squash"` common.ConnectConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go new file mode 100644 index 000000000..715a8d94d --- /dev/null +++ b/iso/step_boot_command.go @@ -0,0 +1,173 @@ +package iso + +import ( + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" + "fmt" + "time" + "strings" + "golang.org/x/mobile/event/key" + "unicode/utf8" + "github.com/hashicorp/packer/common" + "os" + "log" +) + +type BootConfig struct { + BootCommand []string `mapstructure:"boot_command"` +} + +func (c *BootConfig) Prepare() []error { + return nil +} + +type StepBootCommand struct { + Config *BootConfig +} + +var special = map[string]key.Code{ + "<enter>": key.CodeReturnEnter, + "<esc>": key.CodeEscape, + "<bs>": key.CodeDeleteBackspace, + "<del>": key.CodeDeleteForward, + "<tab>": key.CodeTab, + "<f1>": key.CodeF1, + "<f2>": key.CodeF2, + "<f3>": key.CodeF3, + "<f4>": key.CodeF4, + "<f5>": key.CodeF5, + "<f6>": key.CodeF6, + "<f7>": key.CodeF7, + "<f8>": key.CodeF8, + "<f9>": key.CodeF9, + "<f10>": key.CodeF10, + "<f11>": key.CodeF11, + "<f12>": key.CodeF12, + "<insert>": key.CodeInsert, + "<home>": key.CodeHome, + "<end>": key.CodeEnd, + "<pageUp>": key.CodePageUp, + "<pageDown>": key.CodePageDown, + "<left>": key.CodeLeftArrow, + "<right>": key.CodeRightArrow, + "<up>": key.CodeUpArrow, + "<down>": key.CodeDownArrow, +} + +var keyInterval = common.PackerKeyDefault + +func init() { + if delay, err := time.ParseDuration(os.Getenv(common.PackerKeyEnv)); err == nil { + keyInterval = delay + } +} + +func (s *StepBootCommand) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + ui.Say("Typing boot command...") + + var keyAlt bool + var keyCtrl bool + var keyShift bool + + for _, message := range s.Config.BootCommand { + for len(message) > 0 { + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return multistep.ActionHalt + } + + if strings.HasPrefix(message, "<wait>") { + log.Printf("Waiting 1 second") + time.Sleep(1 * time.Second) + message = message[len("<wait>"):] + continue + } + + if strings.HasPrefix(message, "<wait5>") { + log.Printf("Waiting 5 seconds") + time.Sleep(5 * time.Second) + message = message[len("<wait5>"):] + continue + } + + if strings.HasPrefix(message, "<wait10>") { + log.Printf("Waiting 10 seconds") + time.Sleep(10 * time.Second) + message = message[len("<wait10>"):] + continue + } + + if strings.HasPrefix(message, "<leftAltOn>") { + keyAlt = true + message = message[len("<leftAltOn>"):] + continue + } + + if strings.HasPrefix(message, "<leftAltOff>") { + keyAlt = false + message = message[len("<leftAltOff>"):] + continue + } + + if strings.HasPrefix(message, "<leftCtrlOn>") { + keyCtrl = true + message = message[len("<leftCtrlOn>"):] + continue + } + + if strings.HasPrefix(message, "<leftCtrlOff>") { + keyCtrl = false + message = message[len("<leftCtrlOff>"):] + continue + } + + if strings.HasPrefix(message, "<leftShiftOn>") { + keyShift = true + message = message[len("<leftShiftOn>"):] + continue + } + + if strings.HasPrefix(message, "<leftShiftOff>") { + keyShift = false + message = message[len("<leftShiftOff>"):] + continue + } + + var scancode key.Code + for specialCode, specialValue := range special { + if strings.HasPrefix(message, specialCode) { + scancode = specialValue + log.Printf("Special code '%s' found, replacing with: %s", specialCode, specialValue) + message = message[len(specialCode):] + } + } + + var char rune + if scancode == 0 { + var size int + char, size = utf8.DecodeRuneInString(message) + message = message[size:] + } + + _, err := vm.TypeOnKeyboard(driver.KeyInput{ + Message: string(char), + Scancode: scancode, + Ctrl: keyCtrl, + Alt: keyAlt, + Shift: keyShift, + }) + if err != nil { + state.Put("error", fmt.Errorf("error typing a boot command: %v", err)) + return multistep.ActionHalt + } + time.Sleep(keyInterval) + } + } + + return multistep.ActionContinue +} + +func (s *StepBootCommand) Cleanup(state multistep.StateBag) {} From 90b95e423cc7c099606a624121d449160d27f325 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 18 Feb 2018 05:23:12 +0300 Subject: [PATCH 130/266] use golang 1.9.4 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index ea924c80a..b31739c80 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ build: - image: jetbrainsinfra/golang:1.9.2 + image: jetbrainsinfra/golang:1.9.4 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere From 611d51310cf94fe569a2d30ec3ae768a10af090b Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 18 Feb 2018 05:30:42 +0300 Subject: [PATCH 131/266] Rename incremental builder from 'vsphere' to 'vsphere-clone' --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 63089a1d8..36542c420 100755 --- a/build.sh +++ b/build.sh @@ -8,10 +8,10 @@ export GOARCH=amd64 mkdir -p bin rm -f bin/* -GOOS=darwin go build -o bin/packer-builder-vsphere.macos ./cmd/clone -GOOS=linux go build -o bin/packer-builder-vsphere.linux ./cmd/clone -GOOS=windows go build -o bin/packer-builder-vsphere.exe ./cmd/clone - GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso + +GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./cmd/clone +GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./cmd/clone +GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./cmd/clone From 099215cebc6d1c769a0661cefc7cda2c172785dc Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 27 Feb 2018 00:17:48 +0300 Subject: [PATCH 132/266] CD-ROM devices use SATA controller instead of IDE --- driver/vm.go | 4 ++-- driver/vm_cdrom.go | 48 +++++++++++++++++++++++++++++++++++++++++++ iso/step_add_cdrom.go | 5 +++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 driver/vm_cdrom.go diff --git a/driver/vm.go b/driver/vm.go index bfa642b1a..3b43069e9 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -446,12 +446,12 @@ func (vm *VirtualMachine) AddCdrom(isoPath string) error { if err != nil { return err } - ide, err := devices.FindIDEController("") + sata, err := vm.FindSATAController() if err != nil { return err } - cdrom, err := devices.CreateCdrom(ide) + cdrom, err := vm.CreateCdrom(sata) if err != nil { return err } diff --git a/driver/vm_cdrom.go b/driver/vm_cdrom.go new file mode 100644 index 000000000..0ce45a34c --- /dev/null +++ b/driver/vm_cdrom.go @@ -0,0 +1,48 @@ +package driver + +import ( + "github.com/vmware/govmomi/vim25/types" + "errors" +) + +func (vm *VirtualMachine) AddSATAController() error { + sata := &types.VirtualAHCIController{} + return vm.addDevice(sata) +} + +func (vm *VirtualMachine) FindSATAController() (*types.VirtualAHCIController, error) { + l, err := vm.Devices() + if err != nil { + return nil, err + } + + c := l.PickController((*types.VirtualAHCIController)(nil)) + if c == nil { + return nil, errors.New("no available SATA controller") + } + + return c.(*types.VirtualAHCIController), nil +} + +func (vm *VirtualMachine) CreateCdrom(c *types.VirtualAHCIController) (*types.VirtualCdrom, error) { + l, err := vm.Devices() + if err != nil { + return nil, err + } + + device := &types.VirtualCdrom{} + + l.AssignController(device, c) + + device.Backing = &types.VirtualCdromAtapiBackingInfo{ + VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{}, + } + + device.Connectable = &types.VirtualDeviceConnectInfo{ + AllowGuestControl: true, + Connected: true, + StartConnected: true, + } + + return device, nil +} diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 1dd7f6e17..387e76a3f 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -25,6 +25,11 @@ func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { vm := state.Get("vm").(*driver.VirtualMachine) ui.Say("Adding CDRoms...") + if err := vm.AddSATAController(); err != nil { + state.Put("error", fmt.Errorf("error adding SATA controller: %v", err)) + return multistep.ActionHalt + } + for _, path := range s.Config.ISOPaths { if err := vm.AddCdrom(path); err != nil { state.Put("error", fmt.Errorf("error adding a cdrom: %v", err)) From 39f1e4a3944c27ff42dd86cc13393604e57cf67a Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 27 Feb 2018 00:18:06 +0300 Subject: [PATCH 133/266] Add 'configuration_parameters' option --- driver/vm.go | 22 ++++++++++++++++++++++ iso/builder.go | 3 +++ iso/config.go | 1 + iso/step_config_params.go | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 iso/step_config_params.go diff --git a/driver/vm.go b/driver/vm.go index 3b43069e9..118bdfb77 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -519,3 +519,25 @@ func (vm *VirtualMachine) addDevice(device types.BaseVirtualDevice) error { func convertGiBToKiB(gib int64) int64 { return gib * 1024 * 1024 } + +func (vm *VirtualMachine) AddConfigParams(params map[string]string) error { + var confSpec types.VirtualMachineConfigSpec + + var ov []types.BaseOptionValue + for k, v := range params { + o := types.OptionValue{ + Key: k, + Value: v, + } + ov = append(ov, &o) + } + confSpec.ExtraConfig = ov + + task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) + if err != nil { + return err + } + + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} diff --git a/iso/builder.go b/iso/builder.go index 822506149..6730ec969 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -50,6 +50,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Config: &b.config.FloppyConfig, Datastore: b.config.Datastore, }, + &StepConfigParams{ + Config: &b.config.ConfigParamsConfig, + }, ) if b.config.Comm.Type != "none" { diff --git a/iso/config.go b/iso/config.go index 516a6d279..73777d571 100644 --- a/iso/config.go +++ b/iso/config.go @@ -22,6 +22,7 @@ type Config struct { CreateConfig `mapstructure:",squash"` CDRomConfig `mapstructure:",squash"` FloppyConfig `mapstructure:",squash"` + ConfigParamsConfig `mapstructure:",squash"` ctx interpolate.Context } diff --git a/iso/step_config_params.go b/iso/step_config_params.go new file mode 100644 index 000000000..15449fa70 --- /dev/null +++ b/iso/step_config_params.go @@ -0,0 +1,36 @@ +package iso + +import ( + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" + "fmt" +) + +type ConfigParamsConfig struct { + ConfigParams map[string]string `mapstructure:"configuration_parameters"` +} + +func (c *ConfigParamsConfig) Prepare() []error { + return nil +} + +type StepConfigParams struct { + Config *ConfigParamsConfig +} + +func (s *StepConfigParams) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + ui.Say("Adding configuration parameters...") + + if err := vm.AddConfigParams(s.Config.ConfigParams); err != nil { + state.Put("error", fmt.Errorf("error adding configuration parameters: %v", err)) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepConfigParams) Cleanup(state multistep.StateBag) {} From ba06b00e70d1c705835ea4894ec101e19f18b11b Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 27 Feb 2018 03:22:52 +0300 Subject: [PATCH 134/266] Add 'usb_controller' option --- driver/vm.go | 27 ++++++++++++++++++--------- iso/step_create.go | 18 ++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 118bdfb77..9668c1a2b 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -41,15 +41,16 @@ type CreateConfig struct { DiskThinProvisioned bool DiskControllerType string // example: "scsi", "pvscsi" - Annotation string - Name string - Folder string - Host string - ResourcePool string - Datastore string - GuestOS string // example: otherGuest - Network string // "" for default network - NetworkCard string // example: vmxnet3 + Annotation string + Name string + Folder string + Host string + ResourcePool string + Datastore string + GuestOS string // example: otherGuest + Network string // "" for default network + NetworkCard string // example: vmxnet3 + USBController bool } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { @@ -108,6 +109,14 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { return nil, err } + if config.USBController { + t := true + usb := &types.VirtualUSBController{ + EhciEnabled: &t, + } + devices = append(devices, usb) + } + createSpec.DeviceChange, err = devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) if err != nil { return nil, err diff --git a/iso/step_create.go b/iso/step_create.go index 91c7a5b26..1bbd3b6f1 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -14,14 +14,15 @@ type CreateConfig struct { DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` DiskControllerType string `mapstructure:"disk_controller_type"` - VMName string `mapstructure:"vm_name"` - Folder string `mapstructure:"folder"` - Host string `mapstructure:"host"` - ResourcePool string `mapstructure:"resource_pool"` - Datastore string `mapstructure:"datastore"` - GuestOSType string `mapstructure:"guest_os_type"` - Network string `mapstructure:"network"` - NetworkCard string `mapstructure:"network_card"` + VMName string `mapstructure:"vm_name"` + Folder string `mapstructure:"folder"` + Host string `mapstructure:"host"` + ResourcePool string `mapstructure:"resource_pool"` + Datastore string `mapstructure:"datastore"` + GuestOSType string `mapstructure:"guest_os_type"` + Network string `mapstructure:"network"` + NetworkCard string `mapstructure:"network_card"` + USBController bool `mapstructure:"usb_controller"` } func (c *CreateConfig) Prepare() []error { @@ -79,6 +80,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { GuestOS: s.Config.GuestOSType, Network: s.Config.Network, NetworkCard: s.Config.NetworkCard, + USBController: s.Config.USBController, }) if err != nil { From 548cc3ce16edf1803da94fd75c3e8d4dd94f9cbd Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 4 Mar 2018 14:24:36 +0300 Subject: [PATCH 135/266] macOS example --- examples/macos/macos-10.13.json | 49 +++++++++++++++++++++++++++++++ examples/macos/setup/.gitignore | 1 + examples/macos/setup/iso-macos.sh | 15 ++++++++++ examples/macos/setup/iso-setup.sh | 23 +++++++++++++++ examples/macos/setup/postinstall | 24 +++++++++++++++ examples/macos/setup/setup.sh | 12 ++++++++ 6 files changed, 124 insertions(+) create mode 100644 examples/macos/macos-10.13.json create mode 100644 examples/macos/setup/.gitignore create mode 100755 examples/macos/setup/iso-macos.sh create mode 100755 examples/macos/setup/iso-setup.sh create mode 100755 examples/macos/setup/postinstall create mode 100755 examples/macos/setup/setup.sh diff --git a/examples/macos/macos-10.13.json b/examples/macos/macos-10.13.json new file mode 100644 index 000000000..6e36c439c --- /dev/null +++ b/examples/macos/macos-10.13.json @@ -0,0 +1,49 @@ +{ + "builders": [ + { + "type": "vsphere-iso", + + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": "true", + + "vm_name": "macos-packer", + "host": "esxi-mac.vsphere65.test", + + "guest_os_type": "darwin16_64Guest", + + "CPUs": 1, + "RAM": 4096, + + "disk_size": 32, + "disk_thin_provisioned": true, + + "network_card": "e1000e", + "usb_controller": true, + + "configuration_parameters": { + "ich7m.present": "TRUE", + "smc.present": "TRUE" + }, + + "iso_paths": [ + "[datastore-mac] ISO/macOS 10.13.3.iso", + "[datastore-mac] ISO/setup.iso", + "[datastore-mac] ISO/VMware Tools/10.2.0/darwin.iso" + ], + + "boot_order": "disk,cdrom", + + "boot_wait": "4m", + "boot_command": [ + "<enter><wait5>", + "<leftCtrlOn><f2><leftCtrlOff>u<enter>t<enter><wait5>", + "/Volumes/setup/setup.sh<enter>" + ], + + "ssh_username": "jetbrains", + "ssh_password": "jetbrains" + } + ] +} diff --git a/examples/macos/setup/.gitignore b/examples/macos/setup/.gitignore new file mode 100644 index 000000000..89f9ac04a --- /dev/null +++ b/examples/macos/setup/.gitignore @@ -0,0 +1 @@ +out/ diff --git a/examples/macos/setup/iso-macos.sh b/examples/macos/setup/iso-macos.sh new file mode 100755 index 000000000..fa24728f4 --- /dev/null +++ b/examples/macos/setup/iso-macos.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eux + +# Based on +# https://gist.github.com/agentsim/00cc38c693e7d0e1b36a2080870d955b#gistcomment-2304505 + +mkdir -p out + +hdiutil create -o out/HighSierra.cdr -size 5530m -layout SPUD -fs HFS+J +hdiutil attach out/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build +sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction +hdiutil detach /Volumes/Install\ macOS\ High\ Sierra +hdiutil convert out/HighSierra.cdr.dmg -format UDTO -o out/HighSierra.iso +mv out/HighSierra.iso.cdr out/HighSierra.iso +rm out/HighSierra.cdr.dmg diff --git a/examples/macos/setup/iso-setup.sh b/examples/macos/setup/iso-setup.sh new file mode 100755 index 000000000..ede079b75 --- /dev/null +++ b/examples/macos/setup/iso-setup.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eux + +mkdir -p out/pkgroot +rm -rf /out/pkgroot/* + +mkdir -p out/scripts +rm -rf /out/scripts/* +cp postinstall out/scripts/ + +pkgbuild \ + --identifier io.packer.install \ + --root out/pkgroot \ + --scripts out/scripts \ + out/postinstall.pkg + +mkdir -p out/iso +rm -rf out/iso/* +cp setup.sh out/iso/ +productbuild --package out/postinstall.pkg out/iso/postinstall.pkg + +rm out/setup.iso +hdiutil makehybrid -iso -joliet -default-volume-name setup -o out/setup.iso out/iso diff --git a/examples/macos/setup/postinstall b/examples/macos/setup/postinstall new file mode 100755 index 000000000..819c21922 --- /dev/null +++ b/examples/macos/setup/postinstall @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +# Create user account +USERNAME=jetbrains +PASSWORD=jetbrains +dscl . -create "/Users/${USERNAME}" +dscl . -create "/Users/${USERNAME}" UserShell /bin/bash +dscl . -create "/Users/${USERNAME}" RealName "${USERNAME}" +dscl . -create "/Users/${USERNAME}" UniqueID 510 +dscl . -create "/Users/${USERNAME}" PrimaryGroupID 20 +dscl . -create "/Users/${USERNAME}" NFSHomeDirectory "/Users/${USERNAME}" +dscl . -passwd "/Users/${USERNAME}" "${PASSWORD}" +dscl . -append /Groups/admin GroupMembership "${USERNAME}" +createhomedir -c + +# Start VMware Tools daemon explicitly +launchctl load /Library/LaunchDaemons/com.vmware.launchd.tools.plist + +# Enable SSH +systemsetup -setremotelogin on + +# Disable the welcome screen +touch "$3/private/var/db/.AppleSetupDone" diff --git a/examples/macos/setup/setup.sh b/examples/macos/setup/setup.sh new file mode 100755 index 000000000..6f28af424 --- /dev/null +++ b/examples/macos/setup/setup.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Format partition +diskutil eraseDisk JHFS+ Disk disk0 + +# Packages are installed in reversed order - why? +"/Volumes/Image Volume/Install macOS High Sierra.app/Contents/Resources/startosinstall" \ + --volume /Volumes/Disk \ + --converttoapfs no \ + --agreetolicense \ + --installpackage "/Volumes/setup/postinstall.pkg" \ + --installpackage "/Volumes/VMware Tools/Install VMware Tools.app/Contents/Resources/VMware Tools.pkg" From 3b58d3d63d2b3bf01d29b6d9707536bbc095bbf8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Mon, 12 Mar 2018 21:41:38 +0300 Subject: [PATCH 136/266] fix tests datacenter has multiple datastores, so target must be specified explicitly (#57) --- clone/builder_acc_test.go | 1 + driver/vm_clone_acc_test.go | 1 + driver/vm_create_acc_test.go | 1 + iso/builder_acc_test.go | 1 + 4 files changed, 4 insertions(+) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 8c07648ec..e788dcf60 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -27,6 +27,7 @@ func defaultConfig() map[string]interface{} { "template": "alpine", "host": "esxi-1.vsphere65.test", + "datastore": "datastore1", "ssh_username": "root", "ssh_password": "jetbrains", diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index 0f1ed17ce..ef4a474c3 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -29,6 +29,7 @@ func TestVMAcc_clone(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.config.Host = TestHostName + tc.config.Datastore = "datastore1" tc.config.Name = newVMName() templateName := "alpine" diff --git a/driver/vm_create_acc_test.go b/driver/vm_create_acc_test.go index cc8dcb051..15ebb3640 100644 --- a/driver/vm_create_acc_test.go +++ b/driver/vm_create_acc_test.go @@ -19,6 +19,7 @@ func TestVMAcc_create(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.config.Host = TestHostName + tc.config.Datastore = "datastore1" tc.config.Name = newVMName() d := newTestDriver(t) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 5e05d4c0e..2ba34862e 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -27,6 +27,7 @@ func defaultConfig() map[string]interface{} { "insecure_connection": true, "host": "esxi-1.vsphere65.test", + "datastore": "datastore1", "ssh_username": "root", "ssh_password": "jetbrains", From cb782c223a5952eb838edd73037a53ed0cf37905 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 16 Mar 2018 00:53:25 +0300 Subject: [PATCH 137/266] Cluster support (#61) --- clone/step_clone.go | 16 ++++------------ common/vm_config.go | 25 +++++++++++++++++++++++++ driver/host.go | 3 +-- driver/resource_pool.go | 11 +++++++++-- driver/resource_pool_acc_test.go | 2 +- driver/vm.go | 18 ++++++++++++------ iso/step_create.go | 16 +++------------- 7 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 common/vm_config.go diff --git a/clone/step_clone.go b/clone/step_clone.go index ca166ba36..8f216a1fa 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -5,30 +5,21 @@ import ( "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/jetbrains-infra/packer-builder-vsphere/common" ) type CloneConfig struct { Template string `mapstructure:"template"` - VMName string `mapstructure:"vm_name"` - Folder string `mapstructure:"folder"` - Host string `mapstructure:"host"` - ResourcePool string `mapstructure:"resource_pool"` - Datastore string `mapstructure:"datastore"` + common.VMConfig `mapstructure:",squash"` LinkedClone bool `mapstructure:"linked_clone"` } func (c *CloneConfig) Prepare() []error { - var errs []error + errs := c.VMConfig.Prepare() if c.Template == "" { errs = append(errs, fmt.Errorf("Template name is required")) } - if c.VMName == "" { - errs = append(errs, fmt.Errorf("Target VM name is required")) - } - if c.Host == "" { - errs = append(errs, fmt.Errorf("vSphere host is required")) - } return errs } @@ -52,6 +43,7 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { vm, err := template.Clone(&driver.CloneConfig{ Name: s.config.VMName, Folder: s.config.Folder, + Cluster: s.config.Cluster, Host: s.config.Host, ResourcePool: s.config.ResourcePool, Datastore: s.config.Datastore, diff --git a/common/vm_config.go b/common/vm_config.go new file mode 100644 index 000000000..fb6a8996d --- /dev/null +++ b/common/vm_config.go @@ -0,0 +1,25 @@ +package common + +import "fmt" + +type VMConfig struct { + VMName string `mapstructure:"vm_name"` + Folder string `mapstructure:"folder"` + Cluster string `mapstructure:"cluster"` + Host string `mapstructure:"host"` + ResourcePool string `mapstructure:"resource_pool"` + Datastore string `mapstructure:"datastore"` +} + +func (c *VMConfig) Prepare() []error { + var errs []error + + if c.VMName == "" { + errs = append(errs, fmt.Errorf("Target VM name is required")) + } + if c.Cluster == "" && c.Host == "" { + errs = append(errs, fmt.Errorf("vSphere host or cluster is required")) + } + + return errs +} diff --git a/driver/host.go b/driver/host.go index 351a48789..234c72349 100644 --- a/driver/host.go +++ b/driver/host.go @@ -4,7 +4,6 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" - "fmt" ) type Host struct { @@ -20,7 +19,7 @@ func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host { } func (d *Driver) FindHost(name string) (*Host, error) { - h, err := d.finder.HostSystem(d.ctx, fmt.Sprintf("/%v/host/%v", d.datacenter.Name(), name)) + h, err := d.finder.HostSystem(d.ctx, name) if err != nil { return nil, err } diff --git a/driver/resource_pool.go b/driver/resource_pool.go index 48553f661..7f869dbce 100644 --- a/driver/resource_pool.go +++ b/driver/resource_pool.go @@ -19,8 +19,15 @@ func (d *Driver) NewResourcePool(ref *types.ManagedObjectReference) *ResourcePoo } } -func (d *Driver) FindResourcePool(host string, name string) (*ResourcePool, error) { - p, err := d.finder.ResourcePool(d.ctx, fmt.Sprintf("/%v/host/%v/Resources/%v", d.datacenter.Name(), host, name)) +func (d *Driver) FindResourcePool(cluster string, host string, name string) (*ResourcePool, error) { + var res string + if cluster != "" { + res = cluster + } else { + res = host + } + + p, err := d.finder.ResourcePool(d.ctx, fmt.Sprintf("%v/Resources/%v", res, name)) if err != nil { return nil, err } diff --git a/driver/resource_pool_acc_test.go b/driver/resource_pool_acc_test.go index 5b43bacf1..af4cba868 100644 --- a/driver/resource_pool_acc_test.go +++ b/driver/resource_pool_acc_test.go @@ -6,7 +6,7 @@ func TestResourcePoolAcc(t *testing.T) { initDriverAcceptanceTest(t) d := newTestDriver(t) - p, err := d.FindResourcePool("esxi-1.vsphere65.test", "pool1/pool2") + p, err := d.FindResourcePool("","esxi-1.vsphere65.test", "pool1/pool2") if err != nil { t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) } diff --git a/driver/vm.go b/driver/vm.go index 9668c1a2b..6f60bab67 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -18,6 +18,7 @@ type VirtualMachine struct { type CloneConfig struct { Name string Folder string + Cluster string Host string ResourcePool string Datastore string @@ -44,6 +45,7 @@ type CreateConfig struct { Annotation string Name string Folder string + Cluster string Host string ResourcePool string Datastore string @@ -79,14 +81,18 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { return nil, err } - resourcePool, err := d.FindResourcePool(config.Host, config.ResourcePool) + resourcePool, err := d.FindResourcePool(config.Cluster, config.Host, config.ResourcePool) if err != nil { return nil, err } - host, err := d.FindHost(config.Host) - if err != nil { - return nil, err + var host *object.HostSystem + if config.Host != "" { + h, err := d.FindHost(config.Host) + if err != nil { + return nil, err + } + host = h.host } datastore, err := d.FindDatastore(config.Datastore) @@ -126,7 +132,7 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { VmPathName: fmt.Sprintf("[%s]", datastore.Name()), } - task, err := folder.folder.CreateVM(d.ctx, createSpec, resourcePool.pool, host.host) + task, err := folder.folder.CreateVM(d.ctx, createSpec, resourcePool.pool, host) if err != nil { return nil, err } @@ -172,7 +178,7 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err var relocateSpec types.VirtualMachineRelocateSpec - pool, err := template.driver.FindResourcePool(config.Host, config.ResourcePool) + pool, err := template.driver.FindResourcePool(config.Cluster, config.Host, config.ResourcePool) if err != nil { return nil, err } diff --git a/iso/step_create.go b/iso/step_create.go index 1bbd3b6f1..849779d77 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -9,16 +9,12 @@ import ( ) type CreateConfig struct { + common.VMConfig `mapstructure:",squash"` common.HardwareConfig `mapstructure:",squash"` DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` DiskControllerType string `mapstructure:"disk_controller_type"` - VMName string `mapstructure:"vm_name"` - Folder string `mapstructure:"folder"` - Host string `mapstructure:"host"` - ResourcePool string `mapstructure:"resource_pool"` - Datastore string `mapstructure:"datastore"` GuestOSType string `mapstructure:"guest_os_type"` Network string `mapstructure:"network"` NetworkCard string `mapstructure:"network_card"` @@ -32,16 +28,9 @@ func (c *CreateConfig) Prepare() []error { tmp := *c // do recursive calls + errs = append(errs, tmp.VMConfig.Prepare()...) errs = append(errs, tmp.HardwareConfig.Prepare()...) - // check for errors - if tmp.VMName == "" { - errs = append(errs, fmt.Errorf("Target VM name is required")) - } - if tmp.Host == "" { - errs = append(errs, fmt.Errorf("vSphere host is required")) - } - if len(errs) > 0 { return errs } @@ -74,6 +63,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { DiskControllerType: s.Config.DiskControllerType, Name: s.Config.VMName, Folder: s.Config.Folder, + Cluster: s.Config.Cluster, Host: s.Config.Host, ResourcePool: s.Config.ResourcePool, Datastore: s.Config.Datastore, From 9612ec5b5e0339b77354e955463d778f78550c08 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 18 Mar 2018 14:36:30 +0300 Subject: [PATCH 138/266] fix Ubuntu example --- examples/ubuntu/ubuntu-16.04.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ubuntu/ubuntu-16.04.json b/examples/ubuntu/ubuntu-16.04.json index 00d3d8227..b2af62b47 100644 --- a/examples/ubuntu/ubuntu-16.04.json +++ b/examples/ubuntu/ubuntu-16.04.json @@ -33,7 +33,7 @@ "{{template_dir}}/preseed.cfg" ], "boot_command": [ - "<enter><wait><f6><esc><wait>", + "<enter><wait><f6><wait><esc><wait>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", From 40ec9efdfd96273115cff2f369c1bf416d03ebe4 Mon Sep 17 00:00:00 2001 From: Sean Malloy <seanmalloy@users.noreply.github.com> Date: Tue, 20 Mar 2018 04:09:36 -0500 Subject: [PATCH 139/266] Add new config option to allow setting virtual machine hardware version (#65) * Add new config option to allow setting virtual machine hardware version The vsphere-iso builder gets a new configuration option named vm_version. It allows setting the VMWare virtual machine hardware version to a non-default value. The default behavior remains unchanged. Use the latest supported hardware version that ESXi/vCenter allows. VMWare KB for supported virtual machine hardware versions. https://kb.vmware.com/s/article/1003746 * Change vm_version from string to int --- driver/vm.go | 4 ++++ iso/step_create.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/driver/vm.go b/driver/vm.go index 6f60bab67..cda16a314 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -53,6 +53,7 @@ type CreateConfig struct { Network string // "" for default network NetworkCard string // example: vmxnet3 USBController bool + Version int // example: 10 } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { @@ -396,6 +397,9 @@ func (config CreateConfig) toConfigSpec() types.VirtualMachineConfigSpec { confSpec.Name = config.Name confSpec.Annotation = config.Annotation confSpec.GuestId = config.GuestOS + if config.Version != 0 { + confSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version) + } return confSpec } diff --git a/iso/step_create.go b/iso/step_create.go index 849779d77..0d0bbcf3a 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -19,6 +19,7 @@ type CreateConfig struct { Network string `mapstructure:"network"` NetworkCard string `mapstructure:"network_card"` USBController bool `mapstructure:"usb_controller"` + Version int `mapstructure:"vm_version"` } func (c *CreateConfig) Prepare() []error { @@ -31,6 +32,10 @@ func (c *CreateConfig) Prepare() []error { errs = append(errs, tmp.VMConfig.Prepare()...) errs = append(errs, tmp.HardwareConfig.Prepare()...) + if tmp.Version < 0 { + errs = append(errs, fmt.Errorf("'vm_version' cannot be a negative number")) + } + if len(errs) > 0 { return errs } @@ -71,6 +76,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { Network: s.Config.Network, NetworkCard: s.Config.NetworkCard, USBController: s.Config.USBController, + Version: s.Config.Version, }) if err != nil { From 707039eb267bd7dae8ff76a63ebb869ee0c90a35 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 21 Mar 2018 02:03:47 +0300 Subject: [PATCH 140/266] Detect datastore automatically (#69) --- clone/builder_acc_test.go | 1 - driver/datastore.go | 28 +++++++++++++++++++++++++--- driver/datastore_acc_test.go | 2 +- driver/vm.go | 4 ++-- driver/vm_clone_acc_test.go | 1 - driver/vm_create_acc_test.go | 1 - examples/driver/main.go | 25 +++++++++++++++++++++++++ iso/builder.go | 1 + iso/builder_acc_test.go | 1 - iso/step_add_floppy.go | 5 +++-- 10 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 examples/driver/main.go diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index e788dcf60..8c07648ec 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -27,7 +27,6 @@ func defaultConfig() map[string]interface{} { "template": "alpine", "host": "esxi-1.vsphere65.test", - "datastore": "datastore1", "ssh_username": "root", "ssh_password": "jetbrains", diff --git a/driver/datastore.go b/driver/datastore.go index a0569457e..ef37b416c 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -5,6 +5,7 @@ import ( "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/soap" + "fmt" ) type Datastore struct { @@ -19,12 +20,33 @@ func (d *Driver) NewDatastore(ref *types.ManagedObjectReference) *Datastore { } } -// If name is an empty string, returns the default datastore (is exists) -func (d *Driver) FindDatastore(name string) (*Datastore, error) { - ds, err := d.finder.DatastoreOrDefault(d.ctx, name) +// If name is an empty string, then resolve host's one +func (d *Driver) FindDatastore(name string, host string) (*Datastore, error) { + if name == "" { + h, err := d.FindHost(host) + if err != nil { + return nil, err + } + + i, err := h.Info("datastore") + if err != nil { + return nil, err + } + + if len(i.Datastore) > 1 { + return nil, fmt.Errorf("Host has multiple datastores. Specify it explicitly") + } + + ds := d.NewDatastore(&i.Datastore[0]) + inf, err := ds.Info("name") + name = inf.Name + } + + ds, err := d.finder.Datastore(d.ctx, name) if err != nil { return nil, err } + return &Datastore{ ds: ds, driver: d, diff --git a/driver/datastore_acc_test.go b/driver/datastore_acc_test.go index 290ae3342..0b2686fe5 100644 --- a/driver/datastore_acc_test.go +++ b/driver/datastore_acc_test.go @@ -8,7 +8,7 @@ func TestDatastoreAcc(t *testing.T) { initDriverAcceptanceTest(t) d := newTestDriver(t) - ds, err := d.FindDatastore("datastore1") + ds, err := d.FindDatastore("datastore1", "") if err != nil { t.Fatalf("Cannot find the default datastore '%v': %v", "datastore1", err) } diff --git a/driver/vm.go b/driver/vm.go index cda16a314..a506645ea 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -96,7 +96,7 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { host = h.host } - datastore, err := d.FindDatastore(config.Datastore) + datastore, err := d.FindDatastore(config.Datastore, config.Host) if err != nil { return nil, err } @@ -186,7 +186,7 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err poolRef := pool.pool.Reference() relocateSpec.Pool = &poolRef - datastore, err := template.driver.FindDatastore(config.Datastore) + datastore, err := template.driver.FindDatastore(config.Datastore, config.Host) if err != nil { return nil, err } diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index ef4a474c3..0f1ed17ce 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -29,7 +29,6 @@ func TestVMAcc_clone(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.config.Host = TestHostName - tc.config.Datastore = "datastore1" tc.config.Name = newVMName() templateName := "alpine" diff --git a/driver/vm_create_acc_test.go b/driver/vm_create_acc_test.go index 15ebb3640..cc8dcb051 100644 --- a/driver/vm_create_acc_test.go +++ b/driver/vm_create_acc_test.go @@ -19,7 +19,6 @@ func TestVMAcc_create(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.config.Host = TestHostName - tc.config.Datastore = "datastore1" tc.config.Name = newVMName() d := newTestDriver(t) diff --git a/examples/driver/main.go b/examples/driver/main.go new file mode 100644 index 000000000..8136ff3e3 --- /dev/null +++ b/examples/driver/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "fmt" +) + +func main() { + d, err := driver.NewDriver(&driver.ConnectConfig{ + VCenterServer: "vcenter.vsphere65.test", + Username: "root", + Password: "jetbrains", + InsecureConnection: true, + }) + if err != nil { + panic(err) + } + + ds, err := d.FindDatastore("", "esxi-1.vsphere65.test") + if err != nil { + panic(err) + } + + fmt.Println(ds.Name()) +} diff --git a/iso/builder.go b/iso/builder.go index 6730ec969..5e00117df 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -49,6 +49,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepAddFloppy{ Config: &b.config.FloppyConfig, Datastore: b.config.Datastore, + Host: b.config.Host, }, &StepConfigParams{ Config: &b.config.ConfigParamsConfig, diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 2ba34862e..5e05d4c0e 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -27,7 +27,6 @@ func defaultConfig() map[string]interface{} { "insecure_connection": true, "host": "esxi-1.vsphere65.test", - "datastore": "datastore1", "ssh_username": "root", "ssh_password": "jetbrains", diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index b645265e2..04d337716 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -29,6 +29,7 @@ func (c *FloppyConfig) Prepare() []error { type StepAddFloppy struct { Config *FloppyConfig Datastore string + Host string uploadedFloppyPath string } @@ -51,7 +52,7 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { if tmpFloppy != nil { ui.Say("Uploading created floppy image") - ds, err := d.FindDatastore(s.Datastore) + ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { return err } @@ -102,7 +103,7 @@ func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { } if s.uploadedFloppyPath != "" { - ds, err := d.FindDatastore(s.Datastore) + ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { ui.Error(err.Error()) return From e202ad41660313e4fff97b017face7550265dbda Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 12 Dec 2017 13:33:16 +0300 Subject: [PATCH 141/266] VPN connection to vSphere lab --- .gitignore | 1 + docker-compose.yml | 14 ++++++++++++-- teamcity-services.yml | 13 +++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 teamcity-services.yml diff --git a/.gitignore b/.gitignore index 5582d6763..02e6fcbb1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ packer-builder-vsphere* bin/ test*.json crash.log +vpn/ diff --git a/docker-compose.yml b/docker-compose.yml index b31739c80..0da375c32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,16 @@ -build: +version: '2' +services: + build: image: jetbrainsinfra/golang:1.9.4 volumes: - - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere + - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere command: ./build.sh + + test: + image: jetbrainsinfra/golang:1.9.4 + volumes: + - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere + working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere +# network_mode: "container:vpn" + command: ./test.sh diff --git a/teamcity-services.yml b/teamcity-services.yml new file mode 100644 index 000000000..ab018745f --- /dev/null +++ b/teamcity-services.yml @@ -0,0 +1,13 @@ +version: '2' +services: + vpn: + container_name: vpn + image: jetbrainsinfra/openvpn + volumes: + - ./vpn:/vpn:ro + cap_add: + - NET_ADMIN + devices: + - /dev/net/tun:/dev/net/tun + dns: 10.0.0.1 + command: --config /vpn/jetbrains-vsphere-lab.ovpn --script-security 2 --auth-user-pass /vpn/creds.txt From 778f32da890c73363ee4600d9e9e81cc9b70bded Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 23 Mar 2018 01:21:04 +0300 Subject: [PATCH 142/266] Speed up clone tests --- clone/builder_acc_test.go | 69 +++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 8c07648ec..bc4bde74f 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -28,8 +28,8 @@ func defaultConfig() map[string]interface{} { "template": "alpine", "host": "esxi-1.vsphere65.test", - "ssh_username": "root", - "ssh_password": "jetbrains", + "linked_clone": true, // speed up + "communicator": "none", } config["vm_name"] = commonT.NewVMName() return config @@ -40,7 +40,7 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil d := commonT.TestConn(t) vm := commonT.GetVM(t, d, artifacts) - vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -86,10 +86,6 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) } - if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { - t.Error("Not a full clone") - } - return nil } } @@ -130,7 +126,6 @@ func TestCloneBuilderAcc_folder(t *testing.T) { func folderConfig() string { config := defaultConfig() config["folder"] = "folder1/folder2" - config["linked_clone"] = true // speed up return commonT.RenderConfig(config) } @@ -168,7 +163,6 @@ func TestCloneBuilderAcc_resourcePool(t *testing.T) { func resourcePoolConfig() string { config := defaultConfig() config["resource_pool"] = "pool1/pool2" - config["linked_clone"] = true // speed up return commonT.RenderConfig(config) } @@ -206,6 +200,7 @@ func TestCloneBuilderAcc_datastore(t *testing.T) { func datastoreConfig() string { config := defaultConfig() config["template"] = "alpine-host4" // on esxi-4.vsphere65.test + config["linked_clone"] = false return commonT.RenderConfig(config) } @@ -249,9 +244,42 @@ func TestCloneBuilderAcc_multipleDatastores(t *testing.T) { func multipleDatastoresConfig() string { config := defaultConfig() config["host"] = "esxi-4.vsphere65.test" // host with 2 datastores + config["linked_clone"] = false return commonT.RenderConfig(config) } +func TestCloneBuilderAcc_fullClone(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: fullCloneConfig(), + Check: checkFullClone(t), + }) +} + +func fullCloneConfig() string { + config := defaultConfig() + config["linked_clone"] = false + return commonT.RenderConfig(config) +} + +func checkFullClone(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("layoutEx.disk") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + if len(vmInfo.LayoutEx.Disk[0].Chain) != 1 { + t.Error("Not a full clone") + } + + return nil + } +} + func TestCloneBuilderAcc_linkedClone(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -299,7 +327,6 @@ func hardwareConfig() string { config["CPU_limit"] = 1500 config["RAM"] = 2048 config["RAM_reservation"] = 1024 - config["linked_clone"] = true // speed up return commonT.RenderConfig(config) } @@ -354,7 +381,6 @@ func TestCloneBuilderAcc_RAMReservation(t *testing.T) { func RAMReservationConfig() string { config := defaultConfig() config["RAM_reserve_all"] = true - config["linked_clone"] = true // speed up return commonT.RenderConfig(config) } @@ -377,6 +403,21 @@ func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { } } +func TestCloneBuilderAcc_sshPassword(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: sshPasswordConfig(), + }) +} + +func sshPasswordConfig() string { + config := defaultConfig() + config["communicator"] = "ssh" + config["ssh_username"] = "root" + config["ssh_password"] = "jetbrains" + return commonT.RenderConfig(config) +} + func TestCloneBuilderAcc_sshKey(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -386,9 +427,9 @@ func TestCloneBuilderAcc_sshKey(t *testing.T) { func sshKeyConfig() string { config := defaultConfig() - config["ssh_password"] = "" + config["communicator"] = "ssh" + config["ssh_username"] = "root" config["ssh_private_key_file"] = "../test-key.pem" - config["linked_clone"] = true // speed up return commonT.RenderConfig(config) } @@ -402,6 +443,7 @@ func TestCloneBuilderAcc_snapshot(t *testing.T) { func snapshotConfig() string { config := defaultConfig() + config["linked_clone"] = false config["create_snapshot"] = true return commonT.RenderConfig(config) } @@ -436,7 +478,6 @@ func TestCloneBuilderAcc_template(t *testing.T) { func templateConfig() string { config := defaultConfig() config["convert_to_template"] = true - config["linked_clone"] = true // speed up return commonT.RenderConfig(config) } From 13a6aa2c3cd901f8916d2bd0ec01ebb817febff7 Mon Sep 17 00:00:00 2001 From: Sean Malloy <seanmalloy@users.noreply.github.com> Date: Fri, 23 Mar 2018 03:56:03 -0500 Subject: [PATCH 143/266] Add new config options for setting CPU and Memory Hot Add (#71) --- clone/builder_acc_test.go | 12 ++++++++++++ clone/step_hardware.go | 18 ++++++++++-------- common/hardware_config.go | 34 +++++++++++++++++++--------------- driver/vm.go | 21 +++++++++++++-------- driver/vm_clone_acc_test.go | 22 +++++++++++++++++----- 5 files changed, 71 insertions(+), 36 deletions(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index bc4bde74f..6b2015c8f 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -327,6 +327,8 @@ func hardwareConfig() string { config["CPU_limit"] = 1500 config["RAM"] = 2048 config["RAM_reservation"] = 1024 + config["CPU_hot_plug"] = true + config["RAM_hot_plug"] = true return commonT.RenderConfig(config) } @@ -366,6 +368,16 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) } + cpuHotAdd := vmInfo.Config.CpuHotAddEnabled + if !*cpuHotAdd { + t.Errorf("VM should have CPU hot add enabled, got %v", cpuHotAdd) + } + + memoryHotAdd := vmInfo.Config.MemoryHotAddEnabled + if !*memoryHotAdd { + t.Errorf("VM should have Memory hot add enabled, got %v", memoryHotAdd) + } + return nil } } diff --git a/clone/step_hardware.go b/clone/step_hardware.go index 94c384405..9f61fdf5f 100644 --- a/clone/step_hardware.go +++ b/clone/step_hardware.go @@ -19,14 +19,16 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi ui.Say("Customizing hardware parameters...") err := vm.Configure(&driver.HardwareConfig{ - CPUs: s.config.CPUs, - CPUReservation: s.config.CPUReservation, - CPULimit: s.config.CPULimit, - RAM: s.config.RAM, - RAMReservation: s.config.RAMReservation, - RAMReserveAll: s.config.RAMReserveAll, - DiskSize: s.config.DiskSize, - NestedHV: s.config.NestedHV, + CPUs: s.config.CPUs, + CPUReservation: s.config.CPUReservation, + CPULimit: s.config.CPULimit, + RAM: s.config.RAM, + RAMReservation: s.config.RAMReservation, + RAMReserveAll: s.config.RAMReserveAll, + DiskSize: s.config.DiskSize, + NestedHV: s.config.NestedHV, + CpuHotAddEnabled: s.config.CpuHotAddEnabled, + MemoryHotAddEnabled: s.config.MemoryHotAddEnabled, }) if err != nil { state.Put("error", err) diff --git a/common/hardware_config.go b/common/hardware_config.go index 90df9a99a..f3f20ef13 100644 --- a/common/hardware_config.go +++ b/common/hardware_config.go @@ -6,14 +6,16 @@ import ( ) type HardwareConfig struct { - CPUs int32 `mapstructure:"CPUs"` - CPUReservation int64 `mapstructure:"CPU_reservation"` - CPULimit int64 `mapstructure:"CPU_limit"` - RAM int64 `mapstructure:"RAM"` - RAMReservation int64 `mapstructure:"RAM_reservation"` - RAMReserveAll bool `mapstructure:"RAM_reserve_all"` - DiskSize int64 `mapstructure:"disk_size"` - NestedHV bool `mapstructure:"NestedHV"` + CPUs int32 `mapstructure:"CPUs"` + CPUReservation int64 `mapstructure:"CPU_reservation"` + CPULimit int64 `mapstructure:"CPU_limit"` + RAM int64 `mapstructure:"RAM"` + RAMReservation int64 `mapstructure:"RAM_reservation"` + RAMReserveAll bool `mapstructure:"RAM_reserve_all"` + DiskSize int64 `mapstructure:"disk_size"` + NestedHV bool `mapstructure:"NestedHV"` + CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` + MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` } func (c *HardwareConfig) Prepare() []error { @@ -28,12 +30,14 @@ func (c *HardwareConfig) Prepare() []error { func (c *HardwareConfig) ToDriverHardwareConfig() driver.HardwareConfig { return driver.HardwareConfig{ - CPUs: c.CPUs, - CPUReservation: c.CPUReservation, - CPULimit: c.CPULimit, - RAM: c.RAM, - RAMReservation: c.RAMReservation, - RAMReserveAll: c.RAMReserveAll, - DiskSize: c.DiskSize, + CPUs: c.CPUs, + CPUReservation: c.CPUReservation, + CPULimit: c.CPULimit, + RAM: c.RAM, + RAMReservation: c.RAMReservation, + RAMReserveAll: c.RAMReserveAll, + DiskSize: c.DiskSize, + CpuHotAddEnabled: c.CpuHotAddEnabled, + MemoryHotAddEnabled: c.MemoryHotAddEnabled, } } diff --git a/driver/vm.go b/driver/vm.go index a506645ea..9e7bb6fc0 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -26,14 +26,16 @@ type CloneConfig struct { } type HardwareConfig struct { - CPUs int32 - CPUReservation int64 - CPULimit int64 - RAM int64 - RAMReservation int64 - RAMReserveAll bool - DiskSize int64 - NestedHV bool + CPUs int32 + CPUReservation int64 + CPULimit int64 + RAM int64 + RAMReservation int64 + RAMReserveAll bool + DiskSize int64 + NestedHV bool + CpuHotAddEnabled bool + MemoryHotAddEnabled bool } type CreateConfig struct { @@ -389,6 +391,9 @@ func (config HardwareConfig) toConfigSpec() types.VirtualMachineConfigSpec { confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll confSpec.NestedHVEnabled = &config.NestedHV + confSpec.CpuHotAddEnabled = &config.CpuHotAddEnabled + confSpec.MemoryHotAddEnabled = &config.MemoryHotAddEnabled + return confSpec } diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index 0f1ed17ce..3fb7df639 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -115,11 +115,13 @@ func cloneDefaultCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { log.Printf("[DEBUG] Configuring the vm") hwConfig := &HardwareConfig{ - CPUs: 2, - CPUReservation: 1000, - CPULimit: 1500, - RAM: 2048, - RAMReservation: 1024, + CPUs: 2, + CPUReservation: 1000, + CPULimit: 1500, + RAM: 2048, + RAMReservation: 1024, + MemoryHotAddEnabled: true, + CpuHotAddEnabled: true, } vm.Configure(hwConfig) @@ -153,6 +155,16 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { if ramReservation != hwConfig.RAMReservation { t.Errorf("VM should have RAM reservation for %v MB, got %v", hwConfig.RAMReservation, ramReservation) } + + cpuHotAdd := vmInfo.Config.CpuHotAddEnabled + if *cpuHotAdd != hwConfig.CpuHotAddEnabled { + t.Errorf("VM should have CPU hot add set to %v, got %v", hwConfig.CpuHotAddEnabled, cpuHotAdd) + } + + memoryHotAdd := vmInfo.Config.MemoryHotAddEnabled + if *memoryHotAdd != hwConfig.MemoryHotAddEnabled { + t.Errorf("VM should have Memroy hot add set to %v, got %v", hwConfig.MemoryHotAddEnabled, memoryHotAdd) + } } func configureRAMReserveAllCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { From a89ea71c4acb31aa24aabcfcf5d0ec84008bfc34 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 23 Mar 2018 23:54:20 +0300 Subject: [PATCH 144/266] Fix 'go vet' errors --- clone/config_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clone/config_test.go b/clone/config_test.go index 7e4829210..d0517f900 100644 --- a/clone/config_test.go +++ b/clone/config_test.go @@ -53,16 +53,16 @@ func minimalConfig() map[string]interface{} { func testConfigOk(t *testing.T, warns []string, err error) { if len(warns) > 0 { - t.Error("Should be no warnings: %#v", warns) + t.Errorf("Should be no warnings: %#v", warns) } if err != nil { - t.Error("Unexpected error: %s", err) + t.Errorf("Unexpected error: %s", err) } } func testConfigErr(t *testing.T, context string, warns []string, err error) { if len(warns) > 0 { - t.Error("Should be no warnings: %#v", warns) + t.Errorf("Should be no warnings: %#v", warns) } if err == nil { t.Error("An error is not raised for", context) From 8ee5ff018987b17ec84282b41391662ff8705098 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 24 Mar 2018 00:15:13 +0300 Subject: [PATCH 145/266] Build by Go 1.10 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0da375c32..791a97113 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: '2' services: build: - image: jetbrainsinfra/golang:1.9.4 + image: jetbrainsinfra/golang:1.10.0 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere command: ./build.sh test: - image: jetbrainsinfra/golang:1.9.4 + image: jetbrainsinfra/golang:1.10.0 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere From 6d2225f9def7a680ed09b01dcd9dbdabf16236aa Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 24 Mar 2018 00:53:38 +0300 Subject: [PATCH 146/266] Remove checks of test launching parameters --- driver/datastore_acc_test.go | 2 -- driver/driver_test.go | 17 ----------------- driver/folder_acc_test.go | 2 -- driver/host_acc_test.go | 2 -- driver/resource_pool_acc_test.go | 2 -- driver/vm_clone_acc_test.go | 2 -- driver/vm_create_acc_test.go | 2 -- 7 files changed, 29 deletions(-) diff --git a/driver/datastore_acc_test.go b/driver/datastore_acc_test.go index 0b2686fe5..3b13535af 100644 --- a/driver/datastore_acc_test.go +++ b/driver/datastore_acc_test.go @@ -5,8 +5,6 @@ import ( ) func TestDatastoreAcc(t *testing.T) { - initDriverAcceptanceTest(t) - d := newTestDriver(t) ds, err := d.FindDatastore("datastore1", "") if err != nil { diff --git a/driver/driver_test.go b/driver/driver_test.go index 5a9747b3d..e46729ad4 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -1,7 +1,6 @@ package driver import ( - "os" "fmt" "testing" "time" @@ -9,7 +8,6 @@ import ( ) // Defines whether acceptance tests should be run -const TestEnvVar = "VSPHERE_DRIVER_ACC" const TestHostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { @@ -29,18 +27,3 @@ func newVMName() string { rand.Seed(time.Now().UTC().UnixNano()) return fmt.Sprintf("test-%v", rand.Intn(1000)) } - -func initDriverAcceptanceTest(t *testing.T) { - // We only run acceptance tests if an env var is set because they're - // slow and require outside configuration. - if os.Getenv(TestEnvVar) == "" { - t.Skip(fmt.Sprintf( - "Acceptance tests skipped unless env '%s' set", - TestEnvVar)) - } - - // We require verbose mode so that the user knows what is going on. - if !testing.Verbose() { - t.Fatal("Acceptance tests must be run with the -v flag on tests") - } -} diff --git a/driver/folder_acc_test.go b/driver/folder_acc_test.go index 220f1195e..29d1364e0 100644 --- a/driver/folder_acc_test.go +++ b/driver/folder_acc_test.go @@ -3,8 +3,6 @@ package driver import "testing" func TestFolderAcc(t *testing.T) { - initDriverAcceptanceTest(t) - d := newTestDriver(t) f, err := d.FindFolder("folder1/folder2") if err != nil { diff --git a/driver/host_acc_test.go b/driver/host_acc_test.go index 037987bb4..765550551 100644 --- a/driver/host_acc_test.go +++ b/driver/host_acc_test.go @@ -5,8 +5,6 @@ import ( ) func TestHostAcc(t *testing.T) { - initDriverAcceptanceTest(t) - d := newTestDriver(t) host, err := d.FindHost(TestHostName) if err != nil { diff --git a/driver/resource_pool_acc_test.go b/driver/resource_pool_acc_test.go index af4cba868..3d49282b2 100644 --- a/driver/resource_pool_acc_test.go +++ b/driver/resource_pool_acc_test.go @@ -3,8 +3,6 @@ package driver import "testing" func TestResourcePoolAcc(t *testing.T) { - initDriverAcceptanceTest(t) - d := newTestDriver(t) p, err := d.FindResourcePool("","esxi-1.vsphere65.test", "pool1/pool2") if err != nil { diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index 3fb7df639..629e5f6b2 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -8,8 +8,6 @@ import ( ) func TestVMAcc_clone(t *testing.T) { - initDriverAcceptanceTest(t) - testCases := []struct { name string config *CloneConfig diff --git a/driver/vm_create_acc_test.go b/driver/vm_create_acc_test.go index cc8dcb051..5b53dbcca 100644 --- a/driver/vm_create_acc_test.go +++ b/driver/vm_create_acc_test.go @@ -6,8 +6,6 @@ import ( ) func TestVMAcc_create(t *testing.T) { - initDriverAcceptanceTest(t) - testCases := []struct { name string config *CreateConfig From bc673e1b2dbaa84c517fb9d90969563f6b253c07 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 24 Mar 2018 00:54:08 +0300 Subject: [PATCH 147/266] Simplify test launch --- clone/test.sh | 4 ---- driver/test.sh | 4 ---- iso/test.sh | 4 ---- test.sh | 10 ++++++---- 4 files changed, 6 insertions(+), 16 deletions(-) delete mode 100755 clone/test.sh delete mode 100755 driver/test.sh delete mode 100755 iso/test.sh diff --git a/clone/test.sh b/clone/test.sh deleted file mode 100755 index dd91fee3a..000000000 --- a/clone/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export PACKER_ACC=1 -go test -v "$@" diff --git a/driver/test.sh b/driver/test.sh deleted file mode 100755 index 14607e82e..000000000 --- a/driver/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export VSPHERE_DRIVER_ACC=1 -go test -v "$@" diff --git a/iso/test.sh b/iso/test.sh deleted file mode 100755 index dd91fee3a..000000000 --- a/iso/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export PACKER_ACC=1 -go test -v "$@" diff --git a/test.sh b/test.sh index a1db6c2ff..48d55a97c 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,7 @@ -#!/bin/sh -e +#!/bin/sh -(cd driver && ./test.sh "$@") -(cd clone && ./test.sh "$@") -(cd iso && ./test.sh "$@") \ No newline at end of file +set -eux + +export PACKER_ACC=1 + +go test -v ./driver ./iso ./clone From fce740bd1c23254b36f1c49ba3e285ce317ac2b5 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 24 Mar 2018 02:32:10 +0300 Subject: [PATCH 148/266] Switch from Glide to dep --- .gitignore | 1 - Gopkg.lock | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Gopkg.toml | 15 +++ build.sh | 2 +- glide.lock | 113 ---------------------- glide.yaml | 9 -- 6 files changed, 292 insertions(+), 124 deletions(-) create mode 100644 Gopkg.lock create mode 100644 Gopkg.toml delete mode 100644 glide.lock delete mode 100644 glide.yaml diff --git a/.gitignore b/.gitignore index 02e6fcbb1..95ba90c78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .idea/ -.glide/ vendor/ packer-builder-vsphere* bin/ diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 000000000..eec8d0251 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,276 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/Azure/go-ntlmssp" + packages = ["."] + revision = "c92175d540060095c69ced311f76aea56c83ecdb" + +[[projects]] + name = "github.com/ChrisTrenkamp/goxpath" + packages = [ + ".", + "internal/execxp", + "internal/lexer", + "internal/parser", + "internal/parser/findutil", + "internal/parser/intfns", + "internal/parser/pathexpr", + "internal/xconst", + "internal/xsort", + "tree", + "tree/xmltree", + "tree/xmltree/xmlbuilder", + "tree/xmltree/xmlele", + "tree/xmltree/xmlnode" + ] + revision = "2ad3b31cf4a21db70fc0cacd0e0120eaae566f98" + version = "v1.0-alpha3" + +[[projects]] + name = "github.com/dylanmei/iso8601" + packages = ["."] + revision = "2075bf119b58e5576c6ed9f867b8f3d17f2e54d4" + version = "v0.1.0" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/errwrap" + packages = ["."] + revision = "7554cd9344cec97297fa6649b055a8c98c2a1e55" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-checkpoint" + packages = ["."] + revision = "1545e56e46dec3bba264e41fde2c1e2aa65b5dd4" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-cleanhttp" + packages = ["."] + revision = "d5fe4b57a186c716b0e00b8c301cbd9b4182694d" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-multierror" + packages = ["."] + revision = "b7773ae218740a7be65057fc60b366a49b538a44" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-uuid" + packages = ["."] + revision = "27454136f0364f2d44b1276c552d69105cf8c498" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-version" + packages = ["."] + revision = "23480c0665776210b5fbbac6eaaee40e3e6a96b7" + +[[projects]] + name = "github.com/hashicorp/packer" + packages = [ + "common", + "common/ssh", + "common/uuid", + "communicator/none", + "communicator/ssh", + "communicator/winrm", + "helper/builder/testing", + "helper/communicator", + "helper/config", + "packer", + "packer/plugin", + "packer/rpc", + "template", + "template/interpolate", + "version" + ] + revision = "6a8ae4b258d1bb0beece05c9fc3bbc1c186a0480" + version = "v1.0.2" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/yamux" + packages = ["."] + revision = "2658be15c5f05e76244154714161f17e3e77de2e" + +[[projects]] + branch = "master" + name = "github.com/kr/fs" + packages = ["."] + revision = "2788f0dbd16903de03cb8186e5c7d97b69ad387b" + +[[projects]] + branch = "master" + name = "github.com/masterzen/azure-sdk-for-go" + packages = [ + "core/http", + "core/tls" + ] + revision = "ee4f0065d00cd12b542f18f5bc45799e88163b12" + +[[projects]] + branch = "master" + name = "github.com/masterzen/simplexml" + packages = ["dom"] + revision = "4572e39b1ab9fe03ee513ce6fc7e289e98482190" + +[[projects]] + branch = "master" + name = "github.com/masterzen/winrm" + packages = [ + ".", + "soap" + ] + revision = "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb" + +[[projects]] + branch = "master" + name = "github.com/mitchellh/go-fs" + packages = [ + ".", + "fat" + ] + revision = "7bae45d9a684750e82b97ff320c82556614e621b" + +[[projects]] + branch = "master" + name = "github.com/mitchellh/iochan" + packages = ["."] + revision = "87b45ffd0e9581375c491fef3d32130bb15c5bd7" + +[[projects]] + branch = "master" + name = "github.com/mitchellh/mapstructure" + packages = ["."] + revision = "00c29f56e2386353d58c599509e8dc3801b0d716" + +[[projects]] + branch = "master" + name = "github.com/mitchellh/multistep" + packages = ["."] + revision = "391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d" + +[[projects]] + branch = "master" + name = "github.com/mitchellh/reflectwalk" + packages = ["."] + revision = "63d60e9d0dbc60cf9164e6510889b0db6683d98c" + +[[projects]] + branch = "master" + name = "github.com/nu7hatch/gouuid" + packages = ["."] + revision = "179d4d0c4d8d407a32af483c2354df1d2c91e6c3" + +[[projects]] + branch = "master" + name = "github.com/packer-community/winrmcp" + packages = ["winrmcp"] + revision = "81144009af586de8e7729b829266f09dd0d59701" + +[[projects]] + name = "github.com/pkg/errors" + packages = ["."] + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" + +[[projects]] + name = "github.com/pkg/sftp" + packages = ["."] + revision = "49488377fa2f14143ba3067cf7555f60f6c7b550" + version = "1.5.0" + +[[projects]] + name = "github.com/ugorji/go" + packages = ["codec"] + revision = "9831f2c3ac1068a78f50999a30db84270f647af6" + version = "v1.1" + +[[projects]] + name = "github.com/vmware/govmomi" + packages = [ + ".", + "find", + "list", + "object", + "property", + "session", + "task", + "vim25", + "vim25/debug", + "vim25/methods", + "vim25/mo", + "vim25/progress", + "vim25/soap", + "vim25/types", + "vim25/xml" + ] + revision = "b63044e5f833781eb7b305bc035392480ee06a82" + version = "v0.15.0" + +[[projects]] + branch = "master" + name = "golang.org/x/crypto" + packages = [ + "curve25519", + "ed25519", + "ed25519/internal/edwards25519", + "internal/chacha20", + "md4", + "poly1305", + "ssh", + "ssh/agent" + ] + revision = "88942b9c40a4c9d203b82b3731787b672d6e809b" + +[[projects]] + branch = "master" + name = "golang.org/x/mobile" + packages = ["event/key"] + revision = "598bfe4b20d39a660581f014b68e60c5ad425336" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = [ + "html", + "html/atom", + "html/charset" + ] + revision = "6078986fec03a1dcc236c34816c71b0e05018fda" + +[[projects]] + name = "golang.org/x/text" + packages = [ + "encoding", + "encoding/charmap", + "encoding/htmlindex", + "encoding/internal", + "encoding/internal/identifier", + "encoding/japanese", + "encoding/korean", + "encoding/simplifiedchinese", + "encoding/traditionalchinese", + "encoding/unicode", + "internal/gen", + "internal/tag", + "internal/utf8internal", + "language", + "runes", + "transform", + "unicode/cldr" + ] + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "edb4fc0cd7c29895ef0cb47e8323311bacdba397dd57f12217ac8ea9dce6a31d" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 000000000..188fbe86d --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,15 @@ +[[constraint]] + name = "github.com/hashicorp/packer" + version = "=1.0.2" + +[[override]] + name = "github.com/masterzen/azure-sdk-for-go" + branch = "master" + +[[constraint]] + name = "github.com/vmware/govmomi" + version = "=0.15.0" + +[prune] + go-tests = true + unused-packages = true diff --git a/build.sh b/build.sh index 36542c420..0dbd69148 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ set -eux -glide install -v +dep ensure export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin diff --git a/glide.lock b/glide.lock deleted file mode 100644 index 8d0be2549..000000000 --- a/glide.lock +++ /dev/null @@ -1,113 +0,0 @@ -hash: 9dff375b5720b1ffb1164694bb6aba1f546c9e2a93509000eb9919e5241610f1 -updated: 2018-02-17T22:26:59.87828+03:00 -imports: -- name: github.com/Azure/go-ntlmssp - version: 29affced641074a59483ed003b5ef73a8bd3593c -- name: github.com/dylanmei/iso8601 - version: 2075bf119b58e5576c6ed9f867b8f3d17f2e54d4 -- name: github.com/hashicorp/errwrap - version: 7554cd9344cec97297fa6649b055a8c98c2a1e55 -- name: github.com/hashicorp/go-checkpoint - version: a8d0786e7fa88adb6b3bcaa341a99af7f9740671 -- name: github.com/hashicorp/go-cleanhttp - version: 3573b8b52aa7b37b9358d966a898feb387f62437 -- name: github.com/hashicorp/go-multierror - version: ed905158d87462226a13fe39ddf685ea65f1c11f -- name: github.com/hashicorp/go-uuid - version: 64130c7a86d732268a38cb04cfbaf0cc987fda98 -- name: github.com/hashicorp/go-version - version: 03c5bf6be031b6dd45afec16b1cf94fc8938bc77 -- name: github.com/hashicorp/packer - version: 6a8ae4b258d1bb0beece05c9fc3bbc1c186a0480 - subpackages: - - common - - common/ssh - - common/uuid - - communicator/none - - communicator/ssh - - communicator/winrm - - helper/builder/testing - - helper/communicator - - helper/config - - packer - - packer/plugin - - packer/rpc - - template - - template/interpolate - - version -- name: github.com/hashicorp/yamux - version: d1caa6c97c9fc1cc9e83bbe34d0603f9ff0ce8bd -- name: github.com/kr/fs - version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b -- name: github.com/masterzen/azure-sdk-for-go - version: ee4f0065d00cd12b542f18f5bc45799e88163b12 - subpackages: - - core/http - - core/tls -- name: github.com/masterzen/simplexml - version: 4572e39b1ab9fe03ee513ce6fc7e289e98482190 - subpackages: - - dom -- name: github.com/masterzen/winrm - version: acf371f6aff113fc0104a61cd72db45a7c27d310 - subpackages: - - soap -- name: github.com/masterzen/xmlpath - version: 13f4951698adc0fa9c1dda3e275d489a24201161 -- name: github.com/mitchellh/go-fs - version: 7bae45d9a684750e82b97ff320c82556614e621b - subpackages: - - fat -- name: github.com/mitchellh/iochan - version: 87b45ffd0e9581375c491fef3d32130bb15c5bd7 -- name: github.com/mitchellh/mapstructure - version: cc8532a8e9a55ea36402aa21efdf403a60d34096 -- name: github.com/mitchellh/multistep - version: 391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d -- name: github.com/mitchellh/reflectwalk - version: 8d802ff4ae93611b807597f639c19f76074df5c6 -- name: github.com/nu7hatch/gouuid - version: 179d4d0c4d8d407a32af483c2354df1d2c91e6c3 -- name: github.com/packer-community/winrmcp - version: c804d432b8b7fa77896f43cc426134348c3fd19e - subpackages: - - winrmcp -- name: github.com/pkg/errors - version: c605e284fe17294bda444b34710735b29d1a9d90 -- name: github.com/pkg/sftp - version: a5f8514e29e90a859e93871b1582e5c81f466f82 -- name: github.com/ugorji/go - version: 708a42d246822952f38190a8d8c4e6b16a0e600c - subpackages: - - codec -- name: github.com/vmware/govmomi - version: b63044e5f833781eb7b305bc035392480ee06a82 - subpackages: - - find - - list - - object - - property - - session - - task - - vim25 - - vim25/debug - - vim25/methods - - vim25/mo - - vim25/progress - - vim25/soap - - vim25/types - - vim25/xml -- name: golang.org/x/crypto - version: ab89591268e0c8b748cbe4047b00197516011af5 - subpackages: - - curve25519 - - ed25519 - - ed25519/internal/edwards25519 - - md4 - - ssh - - ssh/agent -- name: golang.org/x/mobile - version: 4bfed40defcb2fed54d60707c13cec9d7888a483 - subpackages: - - event/key -testImports: [] diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index e84e824fd..000000000 --- a/glide.yaml +++ /dev/null @@ -1,9 +0,0 @@ -package: github.com/jetbrains-infra/packer-builder-vsphere -import: -- package: github.com/hashicorp/packer - version: v1.0.2 -- package: github.com/mitchellh/multistep -- package: github.com/vmware/govmomi - version: v0.15.0 -- package: golang.org/x/crypto -- package: golang.org/x/mobile From c2a8d0c91ed7bee87f986a8f5700af174ba237a6 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 24 Apr 2018 22:11:33 +0300 Subject: [PATCH 149/266] VPN to the test lab --- .gitignore | 1 - clone/builder_acc_test.go | 2 +- teamcity-services.yml | 4 ++-- test/lab.ovpn | 38 ++++++++++++++++++++++++++++++ test/lab.p12 | Bin 0 -> 4141 bytes test-key.pem => test/test-key.pem | 0 test-key.pub => test/test-key.pub | 0 7 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 test/lab.ovpn create mode 100644 test/lab.p12 rename test-key.pem => test/test-key.pem (100%) rename test-key.pub => test/test-key.pub (100%) diff --git a/.gitignore b/.gitignore index 95ba90c78..ecf9eb819 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ packer-builder-vsphere* bin/ test*.json crash.log -vpn/ diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 6b2015c8f..dfece3151 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -441,7 +441,7 @@ func sshKeyConfig() string { config := defaultConfig() config["communicator"] = "ssh" config["ssh_username"] = "root" - config["ssh_private_key_file"] = "../test-key.pem" + config["ssh_private_key_file"] = "../test/test-key.pem" return commonT.RenderConfig(config) } diff --git a/teamcity-services.yml b/teamcity-services.yml index ab018745f..dfdc70f83 100644 --- a/teamcity-services.yml +++ b/teamcity-services.yml @@ -4,10 +4,10 @@ services: container_name: vpn image: jetbrainsinfra/openvpn volumes: - - ./vpn:/vpn:ro + - ./test:/vpn:ro cap_add: - NET_ADMIN devices: - /dev/net/tun:/dev/net/tun dns: 10.0.0.1 - command: --config /vpn/jetbrains-vsphere-lab.ovpn --script-security 2 --auth-user-pass /vpn/creds.txt + entrypoint: "sh -c 'echo ${VPN_PASSWORD} | openvpn --cd /vpn/ --config lab.ovpn --askpass /dev/stdin'" diff --git a/test/lab.ovpn b/test/lab.ovpn new file mode 100644 index 000000000..313d027f5 --- /dev/null +++ b/test/lab.ovpn @@ -0,0 +1,38 @@ +dev tun +persist-tun +persist-key +cipher AES-256-CBC +ncp-ciphers AES-256-GCM:AES-128-GCM +auth SHA1 +tls-client +client +resolv-retry infinite +remote 81.3.129.9 2000 tcp-client +remote-cert-tls server + +pkcs12 lab.p12 + +<tls-auth> +# +# 2048 bit OpenVPN static key +# +-----BEGIN OpenVPN Static key V1----- +6c9efab783fc2ee1a558bcedeaf92f8d +85322bc05432fbb00745fcd00bb48857 +77cbf0c82462726a848657c56b62f6fd +b9b1622c633188e848ce78c1b4476e9f +938338532c79784f36d80156e3b29bcf +493e64c393ee216b776c7a5d62c03aa8 +5fc5fea73990612f07660988da133b61 +34c847e67f65b8af407ae0b2761de402 +49ede990747659a878acaaf8fa1a6201 +1aa8ec5aeb01ccf50d1dc6e675dea291 +8d4c199c1c126fee9c112ce16c736159 +3234d5eaea167f5e60d01ad618fd33bb +c262fb3d5227933d6149e45ab0246d58 +5f5d66d835fbfc8e8d51e0462194d835 +8f66f166ccef5616abba26dd38046a87 +9476359e2dc7a5b4dc045e3fbe39d6e6 +-----END OpenVPN Static key V1----- +</tls-auth> +key-direction 1 diff --git a/test/lab.p12 b/test/lab.p12 new file mode 100644 index 0000000000000000000000000000000000000000..e628d471c1566966c8d66deadfa728888015faa6 GIT binary patch literal 4141 zcmY+GXD}R!yN4}yb<S#G_1;<H=px#xQ6fUrV2R#^V<T9-trjh6bkVKeqeqPvT{aR{ z^d)+`IWza(|GgjHd1s#A%scO=-#k#{Ujq050w|K|5JVyvsTp}r0U!btAgM5fNUGI8 zcoB*uP5e&;DnOEk{6TN<0eF9w-+vMSlo>?&-xtUMASfjvv75f3hPq__Pkel0ybvU* zrhdePU;}`9{#T!3#&oK)7T&z^(xaluj26y5kDkijX*4k~6rjN`3D&yZZp!V@G9?Xh zIVc%-yJhu%JF}`J7iD{_w&}Fy<-GWkA}e8=R2{~qn(m&aBC0D8mzp36uz#c;&I<g! zd8V@Z1lGIXBjc`#v94n-0A-wP3wAz+^i5cCKa-+6+g>_rZeXm9!MhHvmUvONG-Ns& z3?3eC9*$8f2K`p1>+2Vr+xi5Nx3f2y(B#xsfOA&oVcfHDANv2k<{uDg-5|{UD@A6S ze<d0nO`x!G8qDW!=9t~N3K$_<6OArMIcez71bb>>Ps5p3PWTs#UbRxK{UFVn0VjRt zcn->rxZAwG_4gU48;c$MF5&PE;vyW)+Aw=~8^Uga|4OKAy(6AIrAFduV2TiyAjh9C zZNndCd#WjSi4W|pEGTV~S*3BM;_T$Ha@8zVr)wKC9^G4Pn9wPeo}=3ZD5HI_w`8py zv&4;IpWg<H{d&-}pj~IcBp9qTqD=el_NsKoT*Ti?Qd@EVLbN*%z-40^)7k}E0r>UG ziE~M*F#V)UEbhfnlBWJLSywj%VK30<^5lSLTCG-t496r0Vp2O_S-cM%V9`ZA0C(A5 z)xk9{NX(m3PTNn+(A9W)Ovnngb1t~I8Q@2-(?6#96g)4u2kGYP>vV%(IE+PW$lWzx zDiJY_{XPV|;l3WGGSg2#(B=KsGa^k=acviCu=!bZfo$r=#_A%@PUMRc>_^+q#-4*F zeWamY7;WFHfjAobk37aY#*!IhMygf>1ef&q!<Up_1~2!gCkbUpxOnyGk~Y-PCAde^ z5(}2ldAMCzJfXyTdoX_Wws9`Y(<Q73s_tAQ&i|+P<}ZL2Ikuk98JselKZUErh{g`8 zw|`b~33;Uxo(nH!_lyN*8oaIGI*}tbUVPr}3F-DqZGcpUF;vbvRlQHAIq23nS7hk2 zUwLihXTdTiRX6XnER(G3e<Y=lyNN+&;tt|cly(vx#U|8>jt9AaL_`ciRwp>38eR^x zRVN~lWBF2745eXB998RLiXAL7Fy#ow+HLcFZd-v0^Xmg9oGiBq#U%)Euc#NhJd1NX z;FS#Ia9pgUFlS2hS&ud*_+&h2cB(`o^G4vl^&ge~9<A(->9Z#rU#C-f2-iK4PnXey zClfEeCquKePyLooxxL(}-zb=H6f&eADXVK9%2U&Pf27`7OQBP8b4C(Fcu~4$5C!9x z_AcD^ux$C5b5}?c72WLdWV14FW%_&0C#b%COtUmH<-qXM`WkMNhYA#Dq{XU`xy-L_ zpz%@GE{+U%BgKuUfwSYf=4J~s!7$RC*`^)x^dK&^CASKr>v(WGuxNm>{K1jA;51@% zd=i&rS8Q>WnfT#UG}Wh^2MeQmw|+Jl$cpoD2x<$cHEb1+-3otJXGoomi>E<SN`mO> z;s#81*Pt3^&V1e6=+o=1;nFvX_gl8R(&~88#ZypI6&r_RVRksR*Q|}Wuhye{GpF<0 zc8{+Dc|vfJ_sUZcbN~v@NEsEzPnkvq7L|*P?{f05&5)HHKWn!RBhc+}7_|iTq`QF; zu8d+_<X%ZO<#MdZawqL;NAqjhAG0pqD3`sd+L}AfpQ^qbvZrZofjp_^Ktmuans);3 z&Se|G_hd*(uAw6>vh3|fV~seMHK#-2a?ZOz!|&}Y=}xR=MIwa?zJHg<3n<|W0~jCI z{BCf1oc?T&S_Xrw|G98eMYJ~o`tw<C$yt^?&Tm7F%cNl^+M0}bnyH^7uq&rxi67i6 zo8SStyNF-%rlNvk;5%mS8Uj6dv@&bSl!>z#;OU$@&ojzaV#9rkcIOX+Mqb%Tx4ubq z1Wx)bWmUoU_IX2z4|Ebo#_tR&f%^-uA`I!kH4|+$A{-kmR1+^pakE}yIY?2A|IN3d zs`K?<n}m{38&Rdi&TpOiFC5q*ccFdNuc4MO8gDUuyh~jajKY8z^o~Z>Kx$v2CM8yz zGS@husnYKSWFbp9uQ`$YXp{7iYp|2T8O*)OA8MVpoUrjcy7yvj2j8I`Vq~B`ihpK# zX!w538{GmTLJVUpb;}%AUc#jnZ&p9r7PrC<tEj6gMtnLq;obC}%1h9t$nxR=-tJOb zF8#y1AQ^O}LWdhcTQ%*{$dq-r-T9dLKVSKAL#iIp(s`Mh!D%F2`$}}kspa3-5;C8_ zVZ>1NbVvItoF|>6s%j(h@awVYdTn3a5h@H8m5^hMzCIo;PEAYlU##-sT<65sTD&Va zCnaqRwN7Yy>Y`bV?w%IDH#Vou%C%0MLKUR#RIxV#E0X4J&l(oWX9j{lHGlm(@Ju`R zW5sg5iBE$Wn_wC1MqZ|M&fFlNsKvcR?-<+5_bGJd#=B#Pu`*h%zC*~*=mDL`gU&c@ z?rPYF`o``Q;|<%`wB>r7)@&6fi?C(iA;C&FK83?Z`!vzQTH&>aSJ`e)(8PDD%f3@4 zlG3lX=kJsZ4V@W=t!C8Zay0$vO*$K@MqNrVQDVn!59TR_9?!ktaE_yM-%6IB`9%Yb z1Y1OnMqVM}gnJYcr8zb8GOiqjdQRiv#C#Eh&IALYdlo|zVxHU?3z(oI=r3P*G5E_t zQZiu^bJO0dP#T|<<kBqWCCRw)iS*r!id{+%3F&K;yis-L^$*Kx58>pA6XyN3Z;au% zxIC+&Y*d1idTx6_ZU_0n*INNvR`eCc7v^U-Ly^#YdN<PLP5*!`#;(!Bk5GK{7f2t2 zR5f=BkMv*6N4k#~-<pn2wOzi_6P6p0oJTP%8y%mpI;FT4^$BF{yu_K$*1{%1Hyn9~ zQb)~^IYK)iM<pf2Q}xxH;m3-3=#J0(tLIyTGFvuRW5YYP^p;!X;WdK}vKO*+9P-b) z7MG34dS)+=%&KuhdXA!IiQ=S%c;}6QUU(DpHM`GuaMSm-)-xQQwqvU+b3aaRmoM_( zFPlr4w~&ZrVMQFGbP*>qjdX~0<JUqj*6Lj&<QSQaUHII&B-p*j6&U@Ig&|6P#C`Fz z?;m3HG^lpJ2MYw(-CmY=9pQNz1=tG$@f!|+a-9Q968JwBP}j$AV?Jw?Sj=gJF;BYQ z3RwyApN>(P<JELP#E`#d9<HfXO{q68zI=wcbH68eCQZ)&6yje7avMo$dfPpH6(7Zl zG!gnnx7zS#MJ0lIFFSoTrSDDPHWdggw%M{gE(nHnG&@?nc#av((`8Dypl2`Q|7|L# zY){M!Y4SBFxW`?KoOpvPGE7R$qD0I#90RRj4s_ybNQzKh@Ym3dEt1Aij>6mKAXYb4 z&dBI`s+`@yKt+m-dF?}=osYCnJ|%6iefc&8-5tr%-BmSqK%;aV<|nx;=eC(tTfZj} zu{tE(#2kO~O|F2acCvR`FR0l+#!LL$#g@TNjh?r+3yl<l;KB#2u&adOSuhcj&B>p! z=XtWR<tp!0l2;JYDsZc*`f3sCYzw3F(mggP5~%!t#IpbilpsU`MgL&IKf?<m`yUM@ z1>hGT2@jx1!kzzTrv(4n>Bfw6k7rwT*S~g3h$I~8FYb?0Rt5H#NadbY$j;&SWHQH? zJ`GwkZ0H*it;rXs)ec)g;g`s<Lf`@wHj3^U2o}!EDd+9<XQ;E`wALhjmY?t?8Y0a7 zX9It`>j$0z<K5{9bFYi)vZ4g_4d+VhuU32`$T$Av{@-aL_M{L$OwILw#>TsqP?zA* z>PpNdWuE)<VqX@QC;KtlQorD5*6g;L|CJp*WC)AlGt6eG_Wtk*#2y|+7W^!irby9I z3s<y}mW(1J%8X3N(xthu71}{m5S51<(QpNYFFqwW7DIVj`Q3bv)BoUHS1AxZN!(7! zZ?Tu(5l6+vme~)%e$i4V&5}fT+}xDGSJ(IemlT-%1aaAE_$_lwcd1FsT_n?W=LFhH ziLfvLtfYldcRz44L6r4~u-y1=XIxKKBIZ$^(Kwrjn(>B-S_Khp2vtt`c{Bp%m|n|V z#kN52W+oVR_@Ek9{1f}iRy5AdS*Pp`f$95Oh2os&R*?%i-(p+%7EQ@wf{N>zVl;z% zL7cT-A9t`@jpFDZby}L~gQaTHHe`u*Gc^ztQbv!i7CGGk)?(4G2En@%glPw<^R)2R zt$E?TnIZx&Uc>ss1@p4HmVGAv%8OhU%nL0QuiZVR?vIt*wk1uY4DG$r&eW0KRwCLi z!hVJlvhAl-4}f7e2~pb&9SL6g2{DS=F3OdiA#-@CRg7x}Ch*1~JquBSH8%%lSkvJ4 zD_-QLZh8_>PA<Gtf^}lmmlQcsVeoaTGv7y0X^2aCVlpvtoVlT(FRa{|$gN|4_(`J> z_bH29MB1Gb=9b;PGRAoO<E4U|ZHDp`K-rZiuEq5Vrq8$0DCCA_U}LGgYs*i{lrDKO zi9b9~dsMvxcI&Hmvb1{c_5S+P%(i5eP+b<rftBcSeSQy`1;AKhysL*pV3`c4l#W%* z={M{<8X7j`@rKJmF6<SeDFM_9ObmsB*n1r+4beMO>((GHwkD<YF8h>%;ihnFj-!O_ zndGkfe+mSOq)PA>nROv0p+JhA>9)m3x5DG3@}pFTJYzA9510h9Eqjuis{Td{LZA8( zRr|RAE_DxikV68H$x-G6T<UpveZFVcue_Z4V3~UPjhvjQ+((!+5bNx7pVgz9z9L-M zH&kL_lNvmF-t5gr5VBUjPc2g{i%MZmq->*U`p|dAKQ;C+xcT^gDy`PG<s;a$ur*sb zqQKNbioAMNKa&uDA$2!U5xz;lQu_rLdSHYiTJ2?e6_&XN#1fI(`&&veJ7!!Bsd48E z1daRRPTn$67bkqk?#34lX0M1j8z|{KS?z|Ayn@p`Fr-I>myi4f(z)V@EQ<0sDYPAS z=fzeKSg{bi&WKyVackG#%f5^CcGkgT5)Tqi|4<kA({{O44cqua?w6dC9yOMgXT8xj zD49CN6)ImMm&i6=+?K4-FdJb{A#j*{d?ZAhMW_p;4P$5T&-zWApShTzJiEUp5z&F1 zd<&xv`5FpQ;oA`$e;+|j62=~RaqD!I3{36N81US`I|-Lg=7};EN<?OhcFo(2I`TfI z$6ys7O4h0kJ_PO#IK)b2&b&Ukpw0y>II8-8ITFDWd^lgixG>x+&$Iphr}c9Gyz3J> zlK|fEE^!_x*Z;O737t4SAuX#d%Tm|*Y5Q5Z;UJ2p^nfLGMII^+<$#iafI^f6_z)l- nA#J|)!OE23(Ua}T!MlHm;~}uz(myQ;uh8C`^y9()+minU{|(y8 literal 0 HcmV?d00001 diff --git a/test-key.pem b/test/test-key.pem similarity index 100% rename from test-key.pem rename to test/test-key.pem diff --git a/test-key.pub b/test/test-key.pub similarity index 100% rename from test-key.pub rename to test/test-key.pub From 74f89f484ddead6a078ff8fa9a622c6496f060f8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 25 Apr 2018 08:58:24 +0300 Subject: [PATCH 150/266] Fix VPN --- teamcity-services.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teamcity-services.yml b/teamcity-services.yml index dfdc70f83..eb7033146 100644 --- a/teamcity-services.yml +++ b/teamcity-services.yml @@ -10,4 +10,6 @@ services: devices: - /dev/net/tun:/dev/net/tun dns: 10.0.0.1 - entrypoint: "sh -c 'echo ${VPN_PASSWORD} | openvpn --cd /vpn/ --config lab.ovpn --askpass /dev/stdin'" + environment: + - VPN_PASSWORD + entrypoint: "sh -c 'echo $$VPN_PASSWORD | openvpn --cd /vpn/ --config lab.ovpn --askpass /dev/stdin'" From 6029bfe9e3888e1a804fbbdfdc6b647b10e7e798 Mon Sep 17 00:00:00 2001 From: Sean Malloy <seanmalloy@users.noreply.github.com> Date: Wed, 25 Apr 2018 01:45:02 -0500 Subject: [PATCH 151/266] Add NestedHV config option for vsphere-iso builder (#79) --- common/hardware_config.go | 1 + iso/builder_acc_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/common/hardware_config.go b/common/hardware_config.go index f3f20ef13..88531fcb4 100644 --- a/common/hardware_config.go +++ b/common/hardware_config.go @@ -37,6 +37,7 @@ func (c *HardwareConfig) ToDriverHardwareConfig() driver.HardwareConfig { RAMReservation: c.RAMReservation, RAMReserveAll: c.RAMReserveAll, DiskSize: c.DiskSize, + NestedHV: c.NestedHV, CpuHotAddEnabled: c.CpuHotAddEnabled, MemoryHotAddEnabled: c.MemoryHotAddEnabled, } diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 5e05d4c0e..265d5364a 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -110,6 +110,7 @@ func hardwareConfig() string { config["CPU_limit"] = 1500 config["RAM"] = 2048 config["RAM_reservation"] = 1024 + config["NestedHV"] = true return commonT.RenderConfig(config) } @@ -149,6 +150,11 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) } + nestedHV := vmInfo.Config.NestedHVEnabled + if !*nestedHV { + t.Errorf("VM should have NestedHV enabled, got %v", nestedHV) + } + return nil } } From 115811d410a2e12814ba77f7aa15552728022236 Mon Sep 17 00:00:00 2001 From: Asier Marruedo <asiermarruedo@gmail.com> Date: Wed, 25 Apr 2018 11:23:37 +0200 Subject: [PATCH 152/266] fix cdrom and floppy drive unmounting issue when creating templates (#82) --- iso/builder.go | 22 ++++++++++++------ iso/step_add_cdrom.go | 18 +++----------- iso/step_add_floppy.go | 35 ++++------------------------ iso/step_remove_cdrom.go | 32 +++++++++++++++++++++++++ iso/step_remove_floppy.go | 49 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+), 52 deletions(-) create mode 100644 iso/step_remove_cdrom.go create mode 100644 iso/step_remove_floppy.go diff --git a/iso/builder.go b/iso/builder.go index 5e00117df..e92a0c548 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -2,11 +2,11 @@ package iso import ( packerCommon "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/mitchellh/multistep" - "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { @@ -32,6 +32,12 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe var steps []multistep.Step + var stepAddFloppy = &StepAddFloppy{ + Config: &b.config.FloppyConfig, + Datastore: b.config.Datastore, + Host: b.config.Host, + } + steps = append(steps, &common.StepConnect{ Config: &b.config.ConnectConfig, @@ -46,13 +52,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Files: b.config.FloppyFiles, Directories: b.config.FloppyDirectories, }, - &StepAddFloppy{ - Config: &b.config.FloppyConfig, - Datastore: b.config.Datastore, - Host: b.config.Host, - }, + stepAddFloppy, &StepConfigParams{ - Config: &b.config.ConfigParamsConfig, + Config: &b.config.ConfigParamsConfig, }, ) @@ -78,6 +80,12 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } steps = append(steps, + &StepRemoveCDRom{}, + &StepRemoveFloppy{ + Datastore: b.config.Datastore, + Host: b.config.Host, + UploadedFloppyPath: stepAddFloppy.uploadedFloppyPath, + }, &common.StepCreateSnapshot{ CreateSnapshot: b.config.CreateSnapshot, }, diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 387e76a3f..91fefb0dd 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -1,11 +1,11 @@ package iso import ( + "fmt" + "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/mitchellh/multistep" - "fmt" - "github.com/vmware/govmomi/vim25/types" ) type CDRomConfig struct { @@ -40,16 +40,4 @@ func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } -func (s *StepAddCDRom) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*driver.VirtualMachine) - - devices, err := vm.Devices() - if err != nil { - ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) - } - cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) - if err = vm.RemoveDevice(false, cdroms...); err != nil { - ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) - } -} +func (s *StepAddCDRom) Cleanup(state multistep.StateBag) {} diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 04d337716..cde7c630e 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -1,11 +1,11 @@ package iso import ( - "github.com/mitchellh/multistep" + "fmt" + "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "fmt" - "github.com/vmware/govmomi/vim25/types" + "github.com/mitchellh/multistep" ) type FloppyConfig struct { @@ -29,7 +29,7 @@ func (c *FloppyConfig) Prepare() []error { type StepAddFloppy struct { Config *FloppyConfig Datastore string - Host string + Host string uploadedFloppyPath string } @@ -88,29 +88,4 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { return nil } -func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*driver.VirtualMachine) - d := state.Get("driver").(*driver.Driver) - - devices, err := vm.Devices() - if err != nil { - ui.Error(fmt.Sprintf("error removing floppy: %v", err)) - } - cdroms := devices.SelectByType((*types.VirtualFloppy)(nil)) - if err = vm.RemoveDevice(false, cdroms...); err != nil { - ui.Error(fmt.Sprintf("error removing floppy: %v", err)) - } - - if s.uploadedFloppyPath != "" { - ds, err := d.FindDatastore(s.Datastore, s.Host) - if err != nil { - ui.Error(err.Error()) - return - } - if err := ds.Delete(s.uploadedFloppyPath); err != nil { - ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", s.uploadedFloppyPath, err.Error())) - return - } - } -} +func (s *StepAddFloppy) Cleanup(state multistep.StateBag) {} diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go new file mode 100644 index 000000000..43b57b3ca --- /dev/null +++ b/iso/step_remove_cdrom.go @@ -0,0 +1,32 @@ +package iso + +import ( + "fmt" + + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" + "github.com/vmware/govmomi/vim25/types" +) + +type StepRemoveCDRom struct{} + +func (s *StepRemoveCDRom) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + devices, err := vm.Devices() + if err != nil { + ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) + return multistep.ActionHalt + } + cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) + if err = vm.RemoveDevice(false, cdroms...); err != nil { + ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) + return multistep.ActionHalt + } + + return multistep.ActionContinue +} + +func (s *StepRemoveCDRom) Cleanup(state multistep.StateBag) {} diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go new file mode 100644 index 000000000..9018d3a5f --- /dev/null +++ b/iso/step_remove_floppy.go @@ -0,0 +1,49 @@ +package iso + +import ( + "fmt" + + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/mitchellh/multistep" + "github.com/vmware/govmomi/vim25/types" +) + +type StepRemoveFloppy struct { + Datastore string + Host string + UploadedFloppyPath string +} + +func (s *StepRemoveFloppy) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + d := state.Get("driver").(*driver.Driver) + + devices, err := vm.Devices() + if err != nil { + ui.Error(fmt.Sprintf("error removing floppy: %v", err)) + return multistep.ActionHalt + } + cdroms := devices.SelectByType((*types.VirtualFloppy)(nil)) + if err = vm.RemoveDevice(false, cdroms...); err != nil { + ui.Error(fmt.Sprintf("error removing floppy: %v", err)) + return multistep.ActionHalt + } + + if s.UploadedFloppyPath != "" { + ds, err := d.FindDatastore(s.Datastore, s.Host) + if err != nil { + ui.Error(err.Error()) + return multistep.ActionHalt + } + if err := ds.Delete(s.UploadedFloppyPath); err != nil { + ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", s.UploadedFloppyPath, err.Error())) + return multistep.ActionHalt + } + } + + return multistep.ActionContinue +} + +func (s *StepRemoveFloppy) Cleanup(state multistep.StateBag) {} From 775d0007fa59b5399724c1b767439b3a47697cdb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 25 Apr 2018 11:43:47 +0300 Subject: [PATCH 153/266] Pass floppy path via state bag --- iso/builder.go | 17 +++++++---------- iso/step_add_floppy.go | 5 +---- iso/step_remove_cdrom.go | 1 + iso/step_remove_floppy.go | 25 +++++++++++++++++-------- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/iso/builder.go b/iso/builder.go index e92a0c548..412b7035f 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -32,12 +32,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe var steps []multistep.Step - var stepAddFloppy = &StepAddFloppy{ - Config: &b.config.FloppyConfig, - Datastore: b.config.Datastore, - Host: b.config.Host, - } - steps = append(steps, &common.StepConnect{ Config: &b.config.ConnectConfig, @@ -52,7 +46,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Files: b.config.FloppyFiles, Directories: b.config.FloppyDirectories, }, - stepAddFloppy, + &StepAddFloppy{ + Config: &b.config.FloppyConfig, + Datastore: b.config.Datastore, + Host: b.config.Host, + }, &StepConfigParams{ Config: &b.config.ConfigParamsConfig, }, @@ -82,9 +80,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe steps = append(steps, &StepRemoveCDRom{}, &StepRemoveFloppy{ - Datastore: b.config.Datastore, - Host: b.config.Host, - UploadedFloppyPath: stepAddFloppy.uploadedFloppyPath, + Datastore: b.config.Datastore, + Host: b.config.Host, }, &common.StepCreateSnapshot{ CreateSnapshot: b.config.CreateSnapshot, diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index cde7c630e..92a9c002d 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -30,8 +30,6 @@ type StepAddFloppy struct { Config *FloppyConfig Datastore string Host string - - uploadedFloppyPath string } func (s *StepAddFloppy) Run(state multistep.StateBag) multistep.StepAction { @@ -65,9 +63,8 @@ func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { if err := ds.UploadFile(tmpFloppy.(string), uploadPath); err != nil { return fmt.Errorf("error uploading floppy image: %v", err) } + state.Put("uploaded_floppy_path", uploadPath) - // remember the path to the temporary floppy image to remove it after the build is finished - s.uploadedFloppyPath = uploadPath floppyIMGPath := ds.ResolvePath(uploadPath) ui.Say("Adding generated Floppy...") err = vm.AddFloppy(floppyIMGPath) diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index 43b57b3ca..74f1dba91 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -15,6 +15,7 @@ func (s *StepRemoveCDRom) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) + ui.Say("Deleting CD-ROM drives...") devices, err := vm.Devices() if err != nil { ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go index 9018d3a5f..1fc4f07fb 100644 --- a/iso/step_remove_floppy.go +++ b/iso/step_remove_floppy.go @@ -10,9 +10,8 @@ import ( ) type StepRemoveFloppy struct { - Datastore string - Host string - UploadedFloppyPath string + Datastore string + Host string } func (s *StepRemoveFloppy) Run(state multistep.StateBag) multistep.StepAction { @@ -20,25 +19,35 @@ func (s *StepRemoveFloppy) Run(state multistep.StateBag) multistep.StepAction { vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver) + var UploadedFloppyPath string + switch s := state.Get("uploaded_floppy_path").(type) { + case string: + UploadedFloppyPath = s + case nil: + UploadedFloppyPath = "" + } + + ui.Say("Deleting Floppy drives...") devices, err := vm.Devices() if err != nil { ui.Error(fmt.Sprintf("error removing floppy: %v", err)) return multistep.ActionHalt } - cdroms := devices.SelectByType((*types.VirtualFloppy)(nil)) - if err = vm.RemoveDevice(false, cdroms...); err != nil { + floppies := devices.SelectByType((*types.VirtualFloppy)(nil)) + if err = vm.RemoveDevice(false, floppies...); err != nil { ui.Error(fmt.Sprintf("error removing floppy: %v", err)) return multistep.ActionHalt } - if s.UploadedFloppyPath != "" { + if UploadedFloppyPath != "" { + ui.Say("Deleting Floppy image...") ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { ui.Error(err.Error()) return multistep.ActionHalt } - if err := ds.Delete(s.UploadedFloppyPath); err != nil { - ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", s.UploadedFloppyPath, err.Error())) + if err := ds.Delete(UploadedFloppyPath); err != nil { + ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", UploadedFloppyPath, err.Error())) return multistep.ActionHalt } } From 808a7ce57d77ecc4e988d11049e52efe17b5e4d0 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladrassokhin@gmail.com> Date: Wed, 25 Apr 2018 14:22:38 +0300 Subject: [PATCH 154/266] Use Packer 1.2 (#84) --- Gopkg.lock | 34 ++++++++++++++++------------------ Gopkg.toml | 2 +- clone/builder.go | 2 +- clone/step_clone.go | 5 +++-- clone/step_hardware.go | 5 +++-- common/check_run_status.go | 2 +- common/ssh.go | 2 +- common/step_connect.go | 7 ++++--- common/step_run.go | 5 +++-- common/step_shutdown.go | 5 +++-- common/step_snapshot.go | 5 +++-- common/step_template.go | 5 +++-- common/step_wait_for_ip.go | 5 +++-- common/testing/utility.go | 3 ++- driver/driver.go | 3 +-- driver/driver_test.go | 3 ++- examples/driver/main.go | 3 ++- iso/builder.go | 4 ++-- iso/step_add_cdrom.go | 8 ++++---- iso/step_add_floppy.go | 8 ++++---- iso/step_boot_command.go | 5 +++-- iso/step_config_params.go | 5 +++-- iso/step_create.go | 5 +++-- iso/step_remove_cdrom.go | 5 +++-- iso/step_remove_floppy.go | 5 +++-- 25 files changed, 77 insertions(+), 64 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index eec8d0251..4be470e7d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -80,8 +80,10 @@ "communicator/ssh", "communicator/winrm", "helper/builder/testing", + "helper/common", "helper/communicator", "helper/config", + "helper/multistep", "packer", "packer/plugin", "packer/rpc", @@ -89,8 +91,8 @@ "template/interpolate", "version" ] - revision = "6a8ae4b258d1bb0beece05c9fc3bbc1c186a0480" - version = "v1.0.2" + revision = "ab8811dca8f375344f36dfc32710b9790b2ec03e" + version = "v1.2.2" [[projects]] branch = "master" @@ -135,7 +137,7 @@ ".", "fat" ] - revision = "7bae45d9a684750e82b97ff320c82556614e621b" + revision = "b7b9ca407ffff465de12fc37ccbb81ea8b428c43" [[projects]] branch = "master" @@ -149,12 +151,6 @@ packages = ["."] revision = "00c29f56e2386353d58c599509e8dc3801b0d716" -[[projects]] - branch = "master" - name = "github.com/mitchellh/multistep" - packages = ["."] - revision = "391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d" - [[projects]] branch = "master" name = "github.com/mitchellh/reflectwalk" @@ -182,14 +178,14 @@ [[projects]] name = "github.com/pkg/sftp" packages = ["."] - revision = "49488377fa2f14143ba3067cf7555f60f6c7b550" - version = "1.5.0" + revision = "43ec6c679d353f6e077d3965dc74f6d996eb4a09" + version = "1.5.1" [[projects]] name = "github.com/ugorji/go" packages = ["codec"] - revision = "9831f2c3ac1068a78f50999a30db84270f647af6" - version = "v1.1" + revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab" + version = "v1.1.1" [[projects]] name = "github.com/vmware/govmomi" @@ -226,13 +222,13 @@ "ssh", "ssh/agent" ] - revision = "88942b9c40a4c9d203b82b3731787b672d6e809b" + revision = "d6449816ce06963d9d136eee5a56fca5b0616e7e" [[projects]] branch = "master" name = "golang.org/x/mobile" packages = ["event/key"] - revision = "598bfe4b20d39a660581f014b68e60c5ad425336" + revision = "1f177cbe4ddf911017472e9532c6ca3a99949d53" [[projects]] branch = "master" @@ -240,9 +236,11 @@ packages = [ "html", "html/atom", - "html/charset" + "html/charset", + "internal/socks", + "proxy" ] - revision = "6078986fec03a1dcc236c34816c71b0e05018fda" + revision = "500e7a4f953ddaf55d316b4d3adc516aa0379622" [[projects]] name = "golang.org/x/text" @@ -271,6 +269,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "edb4fc0cd7c29895ef0cb47e8323311bacdba397dd57f12217ac8ea9dce6a31d" + inputs-digest = "20177d3d587549d23b3ddea4eefc1fc03aa3436c372843bc76f98052b25432b7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 188fbe86d..02206ea46 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,6 +1,6 @@ [[constraint]] name = "github.com/hashicorp/packer" - version = "=1.0.2" + version = "=1.2.2" [[override]] name = "github.com/masterzen/azure-sdk-for-go" diff --git a/clone/builder.go b/clone/builder.go index 51b54d3e5..2df7a39f0 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" ) type Builder struct { diff --git a/clone/step_clone.go b/clone/step_clone.go index 8f216a1fa..303ea93af 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -1,11 +1,12 @@ package clone import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "context" ) type CloneConfig struct { @@ -28,7 +29,7 @@ type StepCloneVM struct { config *CloneConfig } -func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) diff --git a/clone/step_hardware.go b/clone/step_hardware.go index 9f61fdf5f..9283a6436 100644 --- a/clone/step_hardware.go +++ b/clone/step_hardware.go @@ -4,14 +4,15 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "context" ) type StepConfigureHardware struct { config *common.HardwareConfig } -func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/check_run_status.go b/common/check_run_status.go index 3d383d9fe..0a00b14ad 100644 --- a/common/check_run_status.go +++ b/common/check_run_status.go @@ -1,7 +1,7 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "errors" ) diff --git a/common/ssh.go b/common/ssh.go index 5ca854068..0eec1f126 100644 --- a/common/ssh.go +++ b/common/ssh.go @@ -5,7 +5,7 @@ import ( "io/ioutil" packerssh "github.com/hashicorp/packer/communicator/ssh" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "golang.org/x/crypto/ssh" "github.com/hashicorp/packer/helper/communicator" ) diff --git a/common/step_connect.go b/common/step_connect.go index ae6b8fbbb..f688eab62 100644 --- a/common/step_connect.go +++ b/common/step_connect.go @@ -1,9 +1,10 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type ConnectConfig struct { @@ -34,8 +35,8 @@ type StepConnect struct { Config *ConnectConfig } -func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { - d, err := driver.NewDriver(&driver.ConnectConfig{ +func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + d, err := driver.NewDriver(ctx, &driver.ConnectConfig{ VCenterServer: s.Config.VCenterServer, Username: s.Config.Username, Password: s.Config.Password, diff --git a/common/step_run.go b/common/step_run.go index e9ff7c2ee..c7f3bedfa 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -1,12 +1,13 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" "time" + "context" ) type RunConfig struct { @@ -35,7 +36,7 @@ type StepRun struct { Config *RunConfig } -func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_shutdown.go b/common/step_shutdown.go index 8f9a4f4d2..cc3945c88 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -1,13 +1,14 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "fmt" "log" "time" "bytes" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type ShutdownConfig struct { @@ -37,7 +38,7 @@ type StepShutdown struct { Config *ShutdownConfig } -func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepShutdown) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) comm := state.Get("communicator").(packer.Communicator) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_snapshot.go b/common/step_snapshot.go index fbf69170c..b69d8a46f 100644 --- a/common/step_snapshot.go +++ b/common/step_snapshot.go @@ -1,16 +1,17 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type StepCreateSnapshot struct{ CreateSnapshot bool } -func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_template.go b/common/step_template.go index e805ea83d..bb2379b44 100644 --- a/common/step_template.go +++ b/common/step_template.go @@ -1,16 +1,17 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type StepConvertToTemplate struct{ ConvertToTemplate bool } -func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConvertToTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index da33b0b91..a8b0cbfc1 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -1,16 +1,17 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "time" + "context" ) type StepWaitForIp struct{} -func (s *StepWaitForIp) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/testing/utility.go b/common/testing/utility.go index 8a13bf883..7c72e14a9 100644 --- a/common/testing/utility.go +++ b/common/testing/utility.go @@ -9,6 +9,7 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" "testing" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "context" ) func NewVMName() string { @@ -34,7 +35,7 @@ func RenderConfig(config map[string]interface{}) string { func TestConn(t *testing.T) *driver.Driver { - d, err := driver.NewDriver(&driver.ConnectConfig{ + d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/driver/driver.go b/driver/driver.go index 30ddcce72..324bcc148 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -28,8 +28,7 @@ type ConnectConfig struct { Datacenter string } -func NewDriver(config *ConnectConfig) (*Driver, error) { - ctx := context.TODO() +func NewDriver(ctx context.Context, config *ConnectConfig) (*Driver, error) { vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) if err != nil { diff --git a/driver/driver_test.go b/driver/driver_test.go index e46729ad4..54590f389 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -5,13 +5,14 @@ import ( "testing" "time" "math/rand" + "context" ) // Defines whether acceptance tests should be run const TestHostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { - d, err := NewDriver(&ConnectConfig{ + d, err := NewDriver(context.TODO(), &ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/examples/driver/main.go b/examples/driver/main.go index 8136ff3e3..e4d15ec95 100644 --- a/examples/driver/main.go +++ b/examples/driver/main.go @@ -3,10 +3,11 @@ package main import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" "fmt" + "context" ) func main() { - d, err := driver.NewDriver(&driver.ConnectConfig{ + d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/iso/builder.go b/iso/builder.go index 412b7035f..7ee7e062d 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -2,11 +2,11 @@ package iso import ( packerCommon "github.com/hashicorp/packer/common" - "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 91fefb0dd..9593046cc 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -1,11 +1,11 @@ package iso import ( - "fmt" - "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "fmt" + "context" ) type CDRomConfig struct { @@ -20,7 +20,7 @@ type StepAddCDRom struct { Config *CDRomConfig } -func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 92a9c002d..c492907f4 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -1,11 +1,11 @@ package iso import ( - "fmt" - + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "fmt" + "context" ) type FloppyConfig struct { @@ -32,7 +32,7 @@ type StepAddFloppy struct { Host string } -func (s *StepAddFloppy) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { err := s.runImpl(state) if err != nil { state.Put("error", fmt.Errorf("error adding floppy: %v", err)) diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 715a8d94d..2e86f954b 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -3,7 +3,7 @@ package iso import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" "time" "strings" @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/common" "os" "log" + "context" ) type BootConfig struct { @@ -63,7 +64,7 @@ func init() { } } -func (s *StepBootCommand) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepBootCommand) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_config_params.go b/iso/step_config_params.go index 15449fa70..4bb18ab94 100644 --- a/iso/step_config_params.go +++ b/iso/step_config_params.go @@ -3,8 +3,9 @@ package iso import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" + "context" ) type ConfigParamsConfig struct { @@ -19,7 +20,7 @@ type StepConfigParams struct { Config *ConfigParamsConfig } -func (s *StepConfigParams) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConfigParams) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_create.go b/iso/step_create.go index 0d0bbcf3a..6c0eed5fa 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -5,7 +5,8 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "context" ) type CreateConfig struct { @@ -55,7 +56,7 @@ type StepCreateVM struct { Config *CreateConfig } -func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index 74f1dba91..a8144eb75 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -5,13 +5,14 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/vmware/govmomi/vim25/types" + "context" ) type StepRemoveCDRom struct{} -func (s *StepRemoveCDRom) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go index 1fc4f07fb..7c32fe6dc 100644 --- a/iso/step_remove_floppy.go +++ b/iso/step_remove_floppy.go @@ -5,8 +5,9 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/vmware/govmomi/vim25/types" + "context" ) type StepRemoveFloppy struct { @@ -14,7 +15,7 @@ type StepRemoveFloppy struct { Host string } -func (s *StepRemoveFloppy) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver) From 1d61fa430b67693b97f10f25ad7edca0d57028c5 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 25 Apr 2018 14:47:42 +0300 Subject: [PATCH 155/266] Add Readme badges --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ca477d2ba..8a782fa6c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +[![Team project](http://jb.gg/badges/team.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) +[![Github All Releases](https://img.shields.io/github/downloads/jetbrains-infra/packer-builder-vsphere/total.svg)](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) +[![TeamCity build status](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/PackerVSphere_Build.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=PackerVSphere_Build&guest=1) + + # Packer Builder for VMware vSphere This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSphere API, and creates virtual machines remotely. From d1a681d7aa9ddf4897cc06c76be3ae448984243d Mon Sep 17 00:00:00 2001 From: Rui Lopes <rgl@ruilopes.com> Date: Fri, 27 Apr 2018 12:11:02 +0300 Subject: [PATCH 156/266] change the disk_size unit to MB (cherry picked from commit 8866411) --- driver/vm.go | 8 ++++---- iso/builder_acc_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 9e7bb6fc0..8fbd6d874 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -251,7 +251,7 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { return err } - disk.CapacityInKB = convertGiBToKiB(config.DiskSize) + disk.CapacityInKB = convertMiBToKiB(config.DiskSize) confSpec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{ &types.VirtualDeviceConfigSpec{ @@ -427,7 +427,7 @@ func addDisk(_ *Driver, devices object.VirtualDeviceList, config *CreateConfig) ThinProvisioned: types.NewBool(config.DiskThinProvisioned), }, }, - CapacityInKB: convertGiBToKiB(config.DiskSize), + CapacityInKB: convertMiBToKiB(config.DiskSize), } devices.AssignController(disk, controller) @@ -540,8 +540,8 @@ func (vm *VirtualMachine) addDevice(device types.BaseVirtualDevice) error { return err } -func convertGiBToKiB(gib int64) int64 { - return gib * 1024 * 1024 +func convertMiBToKiB(mib int64) int64 { + return mib * 1024 } func (vm *VirtualMachine) AddConfigParams(params map[string]string) error { diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 265d5364a..a1d0ef82a 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -32,7 +32,7 @@ func defaultConfig() map[string]interface{} { "ssh_password": "jetbrains", "vm_name": commonT.NewVMName(), - "disk_size": 2, + "disk_size": 2048, "communicator": "none", // do not start the VM without any bootable devices } From 21cbec414ae03ba4e24ad683d6a2946bcc235a8d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Thu, 3 May 2018 05:45:41 +0300 Subject: [PATCH 157/266] code cleanup --- driver/vm.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 8fbd6d874..e1f752dff 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -251,7 +251,7 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { return err } - disk.CapacityInKB = convertMiBToKiB(config.DiskSize) + disk.CapacityInKB = config.DiskSize * 1024 confSpec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{ &types.VirtualDeviceConfigSpec{ @@ -427,7 +427,7 @@ func addDisk(_ *Driver, devices object.VirtualDeviceList, config *CreateConfig) ThinProvisioned: types.NewBool(config.DiskThinProvisioned), }, }, - CapacityInKB: convertMiBToKiB(config.DiskSize), + CapacityInKB: config.DiskSize * 1024, } devices.AssignController(disk, controller) @@ -540,10 +540,6 @@ func (vm *VirtualMachine) addDevice(device types.BaseVirtualDevice) error { return err } -func convertMiBToKiB(mib int64) int64 { - return mib * 1024 -} - func (vm *VirtualMachine) AddConfigParams(params map[string]string) error { var confSpec types.VirtualMachineConfigSpec From 9ea58800b6372a5060a8a696b247c0bf2a93f717 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 4 May 2018 04:40:35 +0300 Subject: [PATCH 158/266] fix winrm connectivity issue (#92) --- Gopkg.lock | 7 ++++--- Gopkg.toml | 13 +++++++++---- examples/windows/setup/vmtools.cmd | 2 +- examples/windows/windows-10.json | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 4be470e7d..f5f7aad19 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -122,13 +122,14 @@ revision = "4572e39b1ab9fe03ee513ce6fc7e289e98482190" [[projects]] - branch = "master" + branch = "non-strict" name = "github.com/masterzen/winrm" packages = [ ".", "soap" ] - revision = "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb" + revision = "d179cf2678135ef005309663bceee2058384917c" + source = "github.com/mkuzmin/winrm" [[projects]] branch = "master" @@ -269,6 +270,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "20177d3d587549d23b3ddea4eefc1fc03aa3436c372843bc76f98052b25432b7" + inputs-digest = "e6e9304a6bd19a02a4b36af24d1e3195e19d459012ecb863bc685a90aab9f2ed" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 02206ea46..9e7324d6b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -2,14 +2,19 @@ name = "github.com/hashicorp/packer" version = "=1.2.2" -[[override]] - name = "github.com/masterzen/azure-sdk-for-go" - branch = "master" - [[constraint]] name = "github.com/vmware/govmomi" version = "=0.15.0" +[[override]] + name = "github.com/masterzen/winrm" + source = "github.com/mkuzmin/winrm" + branch = "non-strict" + +[[override]] + name = "github.com/masterzen/azure-sdk-for-go" + branch = "master" + [prune] go-tests = true unused-packages = true diff --git a/examples/windows/setup/vmtools.cmd b/examples/windows/setup/vmtools.cmd index c6256cc05..19a942d80 100644 --- a/examples/windows/setup/vmtools.cmd +++ b/examples/windows/setup/vmtools.cmd @@ -1,2 +1,2 @@ -rem Silent mode, basic UI, no reboot +@rem Silent mode, basic UI, no reboot e:\setup64 /s /v "/qb REBOOT=R" diff --git a/examples/windows/windows-10.json b/examples/windows/windows-10.json index 18288dd86..5dcd0e679 100644 --- a/examples/windows/windows-10.json +++ b/examples/windows/windows-10.json @@ -33,7 +33,7 @@ ], "floppy_files": [ - "setup/" + "{{template_dir}}/setup/" ], "floppy_img_path": "[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp", "boot_order": "disk,cdrom" From a981a426bc8c43655697280b69b825c422a89a3e Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 4 May 2018 19:19:53 +0300 Subject: [PATCH 159/266] Fix #92: WinRM connection fails due to XML parsing Windows sends XML documents without `<?xml ?>` header. goxpath library supported it in https://github.com/ChrisTrenkamp/goxpath/commit/e2e5bcefc4e07f4a0c587a1200c22665dd39bd0e --- Gopkg.lock | 25 ++++++++++++------------- Gopkg.toml | 10 +++++----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index f5f7aad19..1b505ca40 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -8,25 +8,25 @@ revision = "c92175d540060095c69ced311f76aea56c83ecdb" [[projects]] + branch = "master" name = "github.com/ChrisTrenkamp/goxpath" packages = [ ".", "internal/execxp", - "internal/lexer", - "internal/parser", - "internal/parser/findutil", - "internal/parser/intfns", - "internal/parser/pathexpr", - "internal/xconst", + "internal/execxp/findutil", + "internal/execxp/intfns", "internal/xsort", + "lexer", + "parser", + "parser/pathexpr", "tree", "tree/xmltree", "tree/xmltree/xmlbuilder", "tree/xmltree/xmlele", - "tree/xmltree/xmlnode" + "tree/xmltree/xmlnode", + "xconst" ] - revision = "2ad3b31cf4a21db70fc0cacd0e0120eaae566f98" - version = "v1.0-alpha3" + revision = "c385f95c6022e7756e91beac5f5510872f7dcb7d" [[projects]] name = "github.com/dylanmei/iso8601" @@ -122,14 +122,13 @@ revision = "4572e39b1ab9fe03ee513ce6fc7e289e98482190" [[projects]] - branch = "non-strict" + branch = "master" name = "github.com/masterzen/winrm" packages = [ ".", "soap" ] - revision = "d179cf2678135ef005309663bceee2058384917c" - source = "github.com/mkuzmin/winrm" + revision = "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb" [[projects]] branch = "master" @@ -270,6 +269,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e6e9304a6bd19a02a4b36af24d1e3195e19d459012ecb863bc685a90aab9f2ed" + inputs-digest = "8a4e7f25a3386ca66a780d534df46b4d94a4a369e8c1784ce07bd2075c529a4a" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 9e7324d6b..121c46274 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -6,15 +6,15 @@ name = "github.com/vmware/govmomi" version = "=0.15.0" -[[override]] - name = "github.com/masterzen/winrm" - source = "github.com/mkuzmin/winrm" - branch = "non-strict" - [[override]] name = "github.com/masterzen/azure-sdk-for-go" branch = "master" +# need commit https://github.com/ChrisTrenkamp/goxpath/commit/e2e5bcefc4e07f4a0c587a1200c22665dd39bd0e +[[override]] + name = "github.com/ChrisTrenkamp/goxpath" + branch = "master" + [prune] go-tests = true unused-packages = true From aedfab264f33d717ac952e0116b79faf11a1944b Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 5 May 2018 00:10:43 +0300 Subject: [PATCH 160/266] add/remove cdrom & floppy only if vm is started --- iso/builder.go | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/iso/builder.go b/iso/builder.go index 7ee7e062d..bacc83c68 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -39,18 +39,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCreateVM{ Config: &b.config.CreateConfig, }, - &StepAddCDRom{ - Config: &b.config.CDRomConfig, - }, - &packerCommon.StepCreateFloppy{ - Files: b.config.FloppyFiles, - Directories: b.config.FloppyDirectories, - }, - &StepAddFloppy{ - Config: &b.config.FloppyConfig, - Datastore: b.config.Datastore, - Host: b.config.Host, - }, &StepConfigParams{ Config: &b.config.ConfigParamsConfig, }, @@ -58,6 +46,18 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.Comm.Type != "none" { steps = append(steps, + &StepAddCDRom{ + Config: &b.config.CDRomConfig, + }, + &packerCommon.StepCreateFloppy{ + Files: b.config.FloppyFiles, + Directories: b.config.FloppyDirectories, + }, + &StepAddFloppy{ + Config: &b.config.FloppyConfig, + Datastore: b.config.Datastore, + Host: b.config.Host, + }, &common.StepRun{ Config: &b.config.RunConfig, }, @@ -74,15 +74,15 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepShutdown{ Config: &b.config.ShutdownConfig, }, + &StepRemoveCDRom{}, + &StepRemoveFloppy{ + Datastore: b.config.Datastore, + Host: b.config.Host, + }, ) } steps = append(steps, - &StepRemoveCDRom{}, - &StepRemoveFloppy{ - Datastore: b.config.Datastore, - Host: b.config.Host, - }, &common.StepCreateSnapshot{ CreateSnapshot: b.config.CreateSnapshot, }, @@ -91,7 +91,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, ) - // Run! b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) From 0b4729c9e42616f6eb45fdc91e789010ead2e1eb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 5 May 2018 01:48:16 +0300 Subject: [PATCH 161/266] 'configuration_parameters' in clone builder --- clone/builder.go | 7 ++++--- clone/config.go | 1 + {iso => common}/step_config_params.go | 2 +- iso/builder.go | 2 +- iso/config.go | 8 ++++---- 5 files changed, 11 insertions(+), 9 deletions(-) rename {iso => common}/step_config_params.go (98%) diff --git a/clone/builder.go b/clone/builder.go index 2df7a39f0..343677c89 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -2,11 +2,11 @@ package clone import ( packerCommon "github.com/hashicorp/packer/common" - "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { @@ -26,7 +26,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { state := new(multistep.BasicStateBag) - state.Put("config", b.config) state.Put("comm", &b.config.Comm) state.Put("hook", hook) state.Put("ui", ui) @@ -43,6 +42,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepConfigureHardware{ config: &b.config.HardwareConfig, }, + &common.StepConfigParams{ + Config: &b.config.ConfigParamsConfig, + }, ) if b.config.Comm.Type != "none" { @@ -72,7 +74,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, ) - // Run! b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) diff --git a/clone/config.go b/clone/config.go index 93f680e3f..d4839163d 100644 --- a/clone/config.go +++ b/clone/config.go @@ -18,6 +18,7 @@ type Config struct { common.ShutdownConfig `mapstructure:",squash"` CreateSnapshot bool `mapstructure:"create_snapshot"` ConvertToTemplate bool `mapstructure:"convert_to_template"` + common.ConfigParamsConfig `mapstructure:",squash"` ctx interpolate.Context } diff --git a/iso/step_config_params.go b/common/step_config_params.go similarity index 98% rename from iso/step_config_params.go rename to common/step_config_params.go index 4bb18ab94..7a85a9068 100644 --- a/iso/step_config_params.go +++ b/common/step_config_params.go @@ -1,4 +1,4 @@ -package iso +package common import ( "github.com/hashicorp/packer/packer" diff --git a/iso/builder.go b/iso/builder.go index bacc83c68..bb12aa4dd 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -39,7 +39,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCreateVM{ Config: &b.config.CreateConfig, }, - &StepConfigParams{ + &common.StepConfigParams{ Config: &b.config.ConfigParamsConfig, }, ) diff --git a/iso/config.go b/iso/config.go index 73777d571..d415aa527 100644 --- a/iso/config.go +++ b/iso/config.go @@ -19,10 +19,10 @@ type Config struct { CreateSnapshot bool `mapstructure:"create_snapshot"` ConvertToTemplate bool `mapstructure:"convert_to_template"` - CreateConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` - ConfigParamsConfig `mapstructure:",squash"` + CreateConfig `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.ConfigParamsConfig `mapstructure:",squash"` ctx interpolate.Context } From c44221a800c10251112d7b3b7dacc7caa4f0e7fc Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 6 May 2018 00:41:14 +0300 Subject: [PATCH 162/266] share hardware customization step --- clone/builder.go | 4 +- clone/step_clone.go | 19 +++++-- clone/step_hardware.go | 43 --------------- common/hardware_config.go | 44 --------------- common/step_hardware.go | 64 ++++++++++++++++++++++ driver/vm.go | 112 +++++++++++++++++++------------------- iso/builder.go | 3 + iso/config.go | 5 +- iso/step_create.go | 11 ++-- 9 files changed, 146 insertions(+), 159 deletions(-) delete mode 100644 clone/step_hardware.go delete mode 100644 common/hardware_config.go create mode 100644 common/step_hardware.go diff --git a/clone/builder.go b/clone/builder.go index 343677c89..2ab34f99b 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -39,8 +39,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCloneVM{ config: &b.config.CloneConfig, }, - &StepConfigureHardware{ - config: &b.config.HardwareConfig, + &common.StepConfigureHardware{ + Config: &b.config.HardwareConfig, }, &common.StepConfigParams{ Config: &b.config.ConfigParamsConfig, diff --git a/clone/step_clone.go b/clone/step_clone.go index 303ea93af..2f1e6adcb 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -10,9 +10,10 @@ import ( ) type CloneConfig struct { - Template string `mapstructure:"template"` - common.VMConfig `mapstructure:",squash"` - LinkedClone bool `mapstructure:"linked_clone"` + Template string `mapstructure:"template"` + common.VMConfig `mapstructure:",squash"` + LinkedClone bool `mapstructure:"linked_clone"` + DiskSize int64 `mapstructure:"disk_size"` } func (c *CloneConfig) Prepare() []error { @@ -44,7 +45,7 @@ func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep vm, err := template.Clone(&driver.CloneConfig{ Name: s.config.VMName, Folder: s.config.Folder, - Cluster: s.config.Cluster, + Cluster: s.config.Cluster, Host: s.config.Host, ResourcePool: s.config.ResourcePool, Datastore: s.config.Datastore, @@ -54,8 +55,16 @@ func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep state.Put("error", err) return multistep.ActionHalt } - state.Put("vm", vm) + + if s.config.DiskSize > 0 { + err = vm.ResizeDisk(s.config.DiskSize) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + } + return multistep.ActionContinue } diff --git a/clone/step_hardware.go b/clone/step_hardware.go deleted file mode 100644 index 9283a6436..000000000 --- a/clone/step_hardware.go +++ /dev/null @@ -1,43 +0,0 @@ -package clone - -import ( - "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "context" -) - -type StepConfigureHardware struct { - config *common.HardwareConfig -} - -func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*driver.VirtualMachine) - - if *s.config != (common.HardwareConfig{}) { - ui.Say("Customizing hardware parameters...") - - err := vm.Configure(&driver.HardwareConfig{ - CPUs: s.config.CPUs, - CPUReservation: s.config.CPUReservation, - CPULimit: s.config.CPULimit, - RAM: s.config.RAM, - RAMReservation: s.config.RAMReservation, - RAMReserveAll: s.config.RAMReserveAll, - DiskSize: s.config.DiskSize, - NestedHV: s.config.NestedHV, - CpuHotAddEnabled: s.config.CpuHotAddEnabled, - MemoryHotAddEnabled: s.config.MemoryHotAddEnabled, - }) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - } - - return multistep.ActionContinue -} - -func (s *StepConfigureHardware) Cleanup(multistep.StateBag) {} diff --git a/common/hardware_config.go b/common/hardware_config.go deleted file mode 100644 index 88531fcb4..000000000 --- a/common/hardware_config.go +++ /dev/null @@ -1,44 +0,0 @@ -package common - -import ( - "fmt" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" -) - -type HardwareConfig struct { - CPUs int32 `mapstructure:"CPUs"` - CPUReservation int64 `mapstructure:"CPU_reservation"` - CPULimit int64 `mapstructure:"CPU_limit"` - RAM int64 `mapstructure:"RAM"` - RAMReservation int64 `mapstructure:"RAM_reservation"` - RAMReserveAll bool `mapstructure:"RAM_reserve_all"` - DiskSize int64 `mapstructure:"disk_size"` - NestedHV bool `mapstructure:"NestedHV"` - CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` - MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` -} - -func (c *HardwareConfig) Prepare() []error { - var errs []error - - if c.RAMReservation > 0 && c.RAMReserveAll != false { - errs = append(errs, fmt.Errorf("'RAM_reservation' and 'RAM_reserve_all' cannot be used together")) - } - - return errs -} - -func (c *HardwareConfig) ToDriverHardwareConfig() driver.HardwareConfig { - return driver.HardwareConfig{ - CPUs: c.CPUs, - CPUReservation: c.CPUReservation, - CPULimit: c.CPULimit, - RAM: c.RAM, - RAMReservation: c.RAMReservation, - RAMReserveAll: c.RAMReserveAll, - DiskSize: c.DiskSize, - NestedHV: c.NestedHV, - CpuHotAddEnabled: c.CpuHotAddEnabled, - MemoryHotAddEnabled: c.MemoryHotAddEnabled, - } -} diff --git a/common/step_hardware.go b/common/step_hardware.go new file mode 100644 index 000000000..e96a4c96d --- /dev/null +++ b/common/step_hardware.go @@ -0,0 +1,64 @@ +package common + +import ( + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/hashicorp/packer/helper/multistep" + "context" + "fmt" +) + +type HardwareConfig struct { + CPUs int32 `mapstructure:"CPUs"` + CPUReservation int64 `mapstructure:"CPU_reservation"` + CPULimit int64 `mapstructure:"CPU_limit"` + RAM int64 `mapstructure:"RAM"` + RAMReservation int64 `mapstructure:"RAM_reservation"` + RAMReserveAll bool `mapstructure:"RAM_reserve_all"` + NestedHV bool `mapstructure:"NestedHV"` + CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` + MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` +} + +func (c *HardwareConfig) Prepare() []error { + var errs []error + + if c.RAMReservation > 0 && c.RAMReserveAll != false { + errs = append(errs, fmt.Errorf("'RAM_reservation' and 'RAM_reserve_all' cannot be used together")) + } + + return errs +} + +type StepConfigureHardware struct { + Config *HardwareConfig +} + +func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + if *s.Config != (HardwareConfig{}) { + ui.Say("Customizing hardware parameters...") + + err := vm.Configure(&driver.HardwareConfig{ + CPUs: s.Config.CPUs, + CPUReservation: s.Config.CPUReservation, + CPULimit: s.Config.CPULimit, + RAM: s.Config.RAM, + RAMReservation: s.Config.RAMReservation, + RAMReserveAll: s.Config.RAMReserveAll, + NestedHV: s.Config.NestedHV, + CpuHotAddEnabled: s.Config.CpuHotAddEnabled, + MemoryHotAddEnabled: s.Config.MemoryHotAddEnabled, + }) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + } + + return multistep.ActionContinue +} + +func (s *StepConfigureHardware) Cleanup(multistep.StateBag) {} diff --git a/driver/vm.go b/driver/vm.go index e1f752dff..8c50c2daf 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -18,7 +18,7 @@ type VirtualMachine struct { type CloneConfig struct { Name string Folder string - Cluster string + Cluster string Host string ResourcePool string Datastore string @@ -32,22 +32,20 @@ type HardwareConfig struct { RAM int64 RAMReservation int64 RAMReserveAll bool - DiskSize int64 NestedHV bool CpuHotAddEnabled bool MemoryHotAddEnabled bool } type CreateConfig struct { - HardwareConfig - DiskThinProvisioned bool DiskControllerType string // example: "scsi", "pvscsi" + DiskSize int64 Annotation string Name string Folder string - Cluster string + Cluster string Host string ResourcePool string Datastore string @@ -77,7 +75,14 @@ func (d *Driver) FindVM(name string) (*VirtualMachine, error) { } func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { - createSpec := config.toConfigSpec() + createSpec := types.VirtualMachineConfigSpec{ + Name: config.Name, + Annotation: config.Annotation, + GuestId: config.GuestOS, + } + if config.Version != 0 { + createSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version) + } folder, err := d.FindFolder(config.Folder) if err != nil { @@ -238,27 +243,54 @@ func (vm *VirtualMachine) Destroy() error { } func (vm *VirtualMachine) Configure(config *HardwareConfig) error { - confSpec := config.toConfigSpec() + var confSpec types.VirtualMachineConfigSpec + confSpec.NumCPUs = config.CPUs + confSpec.MemoryMB = config.RAM - if config.DiskSize > 0 { - devices, err := vm.vm.Device(vm.driver.ctx) - if err != nil { - return err - } + var cpuSpec types.ResourceAllocationInfo + cpuSpec.Reservation = config.CPUReservation + cpuSpec.Limit = config.CPULimit + confSpec.CpuAllocation = &cpuSpec - disk, err := findDisk(devices) - if err != nil { - return err - } + var ramSpec types.ResourceAllocationInfo + ramSpec.Reservation = config.RAMReservation + confSpec.MemoryAllocation = &ramSpec - disk.CapacityInKB = config.DiskSize * 1024 + confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll + confSpec.NestedHVEnabled = &config.NestedHV - confSpec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{ - &types.VirtualDeviceConfigSpec{ - Device: disk, - Operation: types.VirtualDeviceConfigSpecOperationEdit, - }, - } + confSpec.CpuHotAddEnabled = &config.CpuHotAddEnabled + confSpec.MemoryHotAddEnabled = &config.MemoryHotAddEnabled + + task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) + if err != nil { + return err + } + + _, err = task.WaitForResult(vm.driver.ctx, nil) + return err +} + +func (vm *VirtualMachine) ResizeDisk(diskSize int64) error { + var confSpec types.VirtualMachineConfigSpec + + devices, err := vm.vm.Device(vm.driver.ctx) + if err != nil { + return err + } + + disk, err := findDisk(devices) + if err != nil { + return err + } + + disk.CapacityInKB = diskSize * 1024 + + confSpec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{ + &types.VirtualDeviceConfigSpec{ + Device: disk, + Operation: types.VirtualDeviceConfigSpecOperationEdit, + }, } task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) @@ -374,40 +406,6 @@ func (vm *VirtualMachine) GetDir() (string, error) { return "", fmt.Errorf("cannot find '%s'", vmxName) } -func (config HardwareConfig) toConfigSpec() types.VirtualMachineConfigSpec { - var confSpec types.VirtualMachineConfigSpec - confSpec.NumCPUs = config.CPUs - confSpec.MemoryMB = config.RAM - - var cpuSpec types.ResourceAllocationInfo - cpuSpec.Reservation = config.CPUReservation - cpuSpec.Limit = config.CPULimit - confSpec.CpuAllocation = &cpuSpec - - var ramSpec types.ResourceAllocationInfo - ramSpec.Reservation = config.RAMReservation - confSpec.MemoryAllocation = &ramSpec - - confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll - confSpec.NestedHVEnabled = &config.NestedHV - - confSpec.CpuHotAddEnabled = &config.CpuHotAddEnabled - confSpec.MemoryHotAddEnabled = &config.MemoryHotAddEnabled - - return confSpec -} - -func (config CreateConfig) toConfigSpec() types.VirtualMachineConfigSpec { - confSpec := config.HardwareConfig.toConfigSpec() - confSpec.Name = config.Name - confSpec.Annotation = config.Annotation - confSpec.GuestId = config.GuestOS - if config.Version != 0 { - confSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version) - } - return confSpec -} - func addDisk(_ *Driver, devices object.VirtualDeviceList, config *CreateConfig) (object.VirtualDeviceList, error) { device, err := devices.CreateSCSIController(config.DiskControllerType) if err != nil { diff --git a/iso/builder.go b/iso/builder.go index bb12aa4dd..086906b39 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -39,6 +39,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCreateVM{ Config: &b.config.CreateConfig, }, + &common.StepConfigureHardware{ + Config: &b.config.HardwareConfig, + }, &common.StepConfigParams{ Config: &b.config.ConfigParamsConfig, }, diff --git a/iso/config.go b/iso/config.go index d415aa527..31bdc7357 100644 --- a/iso/config.go +++ b/iso/config.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" - "fmt" ) type Config struct { @@ -20,6 +19,7 @@ type Config struct { ConvertToTemplate bool `mapstructure:"convert_to_template"` CreateConfig `mapstructure:",squash"` + common.HardwareConfig `mapstructure:",squash"` CDRomConfig `mapstructure:",squash"` FloppyConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"` @@ -38,9 +38,6 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) - if c.DiskSize <= 0 { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("'disk_size' must be provided")) - } errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) diff --git a/iso/step_create.go b/iso/step_create.go index 6c0eed5fa..87d8dfcd4 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -11,10 +11,10 @@ import ( type CreateConfig struct { common.VMConfig `mapstructure:",squash"` - common.HardwareConfig `mapstructure:",squash"` DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` DiskControllerType string `mapstructure:"disk_controller_type"` + DiskSize int64 `mapstructure:"disk_size"` GuestOSType string `mapstructure:"guest_os_type"` Network string `mapstructure:"network"` @@ -31,12 +31,16 @@ func (c *CreateConfig) Prepare() []error { // do recursive calls errs = append(errs, tmp.VMConfig.Prepare()...) - errs = append(errs, tmp.HardwareConfig.Prepare()...) if tmp.Version < 0 { errs = append(errs, fmt.Errorf("'vm_version' cannot be a negative number")) } + if tmp.DiskSize == 0 { + errs = append(errs, fmt.Errorf("'disk_size' must be provided")) + } + + if len(errs) > 0 { return errs } @@ -63,10 +67,9 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste ui.Say("Creating VM...") vm, err := d.CreateVM(&driver.CreateConfig{ - HardwareConfig: s.Config.HardwareConfig.ToDriverHardwareConfig(), - DiskThinProvisioned: s.Config.DiskThinProvisioned, DiskControllerType: s.Config.DiskControllerType, + DiskSize: s.Config.DiskSize, Name: s.Config.VMName, Folder: s.Config.Folder, Cluster: s.Config.Cluster, From 0be06451ccdae7f48b61ddac45a3ea09e11877d8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 6 May 2018 17:46:40 +0300 Subject: [PATCH 163/266] move `boot_wait` into `boot_command` --- common/step_run.go | 33 ++------------------------------- iso/config.go | 1 + iso/step_boot_command.go | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/common/step_run.go b/common/step_run.go index c7f3bedfa..8da3663d0 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -6,29 +6,16 @@ import ( "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" - "time" "context" ) type RunConfig struct { BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" - RawBootWait string `mapstructure:"boot_wait"` // example: "1m30s"; default: "10s" - bootWait time.Duration `` } func (c *RunConfig) Prepare() []error { var errs []error - if c.RawBootWait == "" { - c.RawBootWait = "10s" - } - - var err error - c.bootWait, err = time.ParseDuration(c.RawBootWait) - if err != nil { - errs = append(errs, fmt.Errorf("failed parsing boot_wait: %s", err)) - } - return errs } @@ -40,8 +27,7 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Power on VM...") - + ui.Say("Set boot order...") if s.Config.BootOrder != "" { if err := vm.SetBootOrder(strings.Split(s.Config.BootOrder, ",")); err != nil { state.Put("error", fmt.Errorf("error selecting boot order: %v", err)) @@ -49,28 +35,13 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste } } + ui.Say("Power on VM...") err := vm.PowerOn() if err != nil { state.Put("error", fmt.Errorf("error powering on VM: %v", err)) return multistep.ActionHalt } - if int64(s.Config.bootWait) > 0 { - ui.Say(fmt.Sprintf("Waiting %s for boot...", s.Config.bootWait)) - wait := time.After(s.Config.bootWait) - WAITLOOP: - for { - select { - case <-wait: - break WAITLOOP - case <-time.After(1 * time.Second): - if _, ok := state.GetOk(multistep.StateCancelled); ok { - return multistep.ActionHalt - } - } - } - } - return multistep.ActionContinue } diff --git a/iso/config.go b/iso/config.go index 31bdc7357..d5caf61b5 100644 --- a/iso/config.go +++ b/iso/config.go @@ -36,6 +36,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs := new(packer.MultiError) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 2e86f954b..7ece87075 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -17,10 +17,25 @@ import ( type BootConfig struct { BootCommand []string `mapstructure:"boot_command"` + RawBootWait string `mapstructure:"boot_wait"` // example: "1m30s"; default: "10s" + + bootWait time.Duration } func (c *BootConfig) Prepare() []error { - return nil + var errs []error + + if c.RawBootWait == "" { + c.RawBootWait = "10s" + } + + var err error + c.bootWait, err = time.ParseDuration(c.RawBootWait) + if err != nil { + errs = append(errs, fmt.Errorf("failed parsing boot_wait: %s", err)) + } + + return errs } type StepBootCommand struct { @@ -68,6 +83,24 @@ func (s *StepBootCommand) Run(_ context.Context, state multistep.StateBag) multi ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) + if s.Config.BootCommand == nil { + return multistep.ActionContinue + } + + ui.Say(fmt.Sprintf("Waiting %s for boot...", s.Config.bootWait)) + wait := time.After(s.Config.bootWait) +WAITLOOP: + for { + select { + case <-wait: + break WAITLOOP + case <-time.After(1 * time.Second): + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return multistep.ActionHalt + } + } + } + ui.Say("Typing boot command...") var keyAlt bool From e59c1326f96aa49976a63a70f1252c59ab093cf0 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 6 May 2018 19:04:51 +0300 Subject: [PATCH 164/266] default value for 'boot_order' in iso builder --- clone/config.go | 1 - common/step_run.go | 8 +++++--- examples/macos/macos-10.13.json | 2 -- examples/ubuntu/ubuntu-16.04.json | 3 +-- examples/windows/windows-10.json | 3 +-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/clone/config.go b/clone/config.go index d4839163d..a2a230503 100644 --- a/clone/config.go +++ b/clone/config.go @@ -31,7 +31,6 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs := new(packer.MultiError) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) - errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CloneConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) diff --git a/common/step_run.go b/common/step_run.go index 8da3663d0..46f7bba5b 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -10,13 +10,15 @@ import ( ) type RunConfig struct { - BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" + BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" } func (c *RunConfig) Prepare() []error { - var errs []error + if c.BootOrder == "" { + c.BootOrder = "disk,cdrom" + } - return errs + return nil } type StepRun struct { diff --git a/examples/macos/macos-10.13.json b/examples/macos/macos-10.13.json index 6e36c439c..1f6fdbbcc 100644 --- a/examples/macos/macos-10.13.json +++ b/examples/macos/macos-10.13.json @@ -33,8 +33,6 @@ "[datastore-mac] ISO/VMware Tools/10.2.0/darwin.iso" ], - "boot_order": "disk,cdrom", - "boot_wait": "4m", "boot_command": [ "<enter><wait5>", diff --git a/examples/ubuntu/ubuntu-16.04.json b/examples/ubuntu/ubuntu-16.04.json index b2af62b47..d7ea5e89f 100644 --- a/examples/ubuntu/ubuntu-16.04.json +++ b/examples/ubuntu/ubuntu-16.04.json @@ -49,8 +49,7 @@ " locale=en_US", " file=/media/preseed.cfg", "<enter>" - ], - "boot_order": "disk,cdrom" + ] } ], diff --git a/examples/windows/windows-10.json b/examples/windows/windows-10.json index 5dcd0e679..4a0eef8fc 100644 --- a/examples/windows/windows-10.json +++ b/examples/windows/windows-10.json @@ -35,8 +35,7 @@ "floppy_files": [ "{{template_dir}}/setup/" ], - "floppy_img_path": "[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp", - "boot_order": "disk,cdrom" + "floppy_img_path": "[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp" } ], From f46f373e3a19a7bd3a5d459c48d2284ac3b4d0a1 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Mon, 7 May 2018 00:26:04 +0300 Subject: [PATCH 165/266] Code cleanup --- clone/builder.go | 10 ++++-- clone/config.go | 35 +++++++++++++------- clone/step_clone.go | 34 ++++++++++--------- common/artifact.go | 6 +--- common/check_run_status.go | 24 -------------- common/config_location.go | 25 ++++++++++++++ common/{ssh.go => config_ssh.go} | 0 common/decode_config.go | 14 -------- common/step_config_params.go | 15 ++++----- common/step_connect.go | 6 ++-- common/step_hardware.go | 8 +++-- common/step_run.go | 10 +++--- common/step_shutdown.go | 2 +- common/step_wait_for_ip.go | 4 +-- common/vm_config.go | 25 -------------- driver/vm.go | 2 +- iso/builder.go | 10 ++++-- iso/config.go | 40 ++++++++++++++--------- iso/step_add_cdrom.go | 6 +--- iso/step_add_floppy.go | 51 ++++++++++------------------- iso/step_create.go | 56 ++++++++++---------------------- iso/step_remove_cdrom.go | 8 ++--- iso/step_remove_floppy.go | 21 ++++-------- 23 files changed, 173 insertions(+), 239 deletions(-) delete mode 100644 common/check_run_status.go create mode 100644 common/config_location.go rename common/{ssh.go => config_ssh.go} (100%) delete mode 100644 common/decode_config.go delete mode 100644 common/vm_config.go diff --git a/clone/builder.go b/clone/builder.go index 2ab34f99b..2d2c1b585 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -37,7 +37,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Config: &b.config.ConnectConfig, }, &StepCloneVM{ - config: &b.config.CloneConfig, + Config: &b.config.CloneConfig, + Location: &b.config.LocationConfig, }, &common.StepConfigureHardware{ Config: &b.config.HardwareConfig, @@ -77,10 +78,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) - if err := common.CheckRunStatus(state); err != nil { - return nil, err + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) } + if _, ok := state.GetOk("vm"); !ok { + return nil, nil + } artifact := &common.Artifact{ Name: b.config.VMName, VM: state.Get("vm").(*driver.VirtualMachine), diff --git a/clone/config.go b/clone/config.go index a2a230503..d982928aa 100644 --- a/clone/config.go +++ b/clone/config.go @@ -6,34 +6,45 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "github.com/hashicorp/packer/helper/config" ) type Config struct { - packerCommon.PackerConfig `mapstructure:",squash"` - common.ConnectConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - CloneConfig `mapstructure:",squash"` - common.HardwareConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - common.ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` - common.ConfigParamsConfig `mapstructure:",squash"` + packerCommon.PackerConfig `mapstructure:",squash"` + + common.ConnectConfig `mapstructure:",squash"` + CloneConfig `mapstructure:",squash"` + common.LocationConfig `mapstructure:",squash"` + common.HardwareConfig `mapstructure:",squash"` + common.ConfigParamsConfig `mapstructure:",squash"` + + common.RunConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` + + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` ctx interpolate.Context } func NewConfig(raws ...interface{}) (*Config, []string, error) { c := new(Config) - if err := common.DecodeConfig(c, &c.ctx, raws...); err != nil { + err := config.Decode(c, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &c.ctx, + }, raws...) + if err != nil { return nil, nil, err } errs := new(packer.MultiError) - errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CloneConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + + errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) if len(errs.Errors) > 0 { diff --git a/clone/step_clone.go b/clone/step_clone.go index 2f1e6adcb..f8a28dd42 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -11,23 +11,27 @@ import ( type CloneConfig struct { Template string `mapstructure:"template"` - common.VMConfig `mapstructure:",squash"` - LinkedClone bool `mapstructure:"linked_clone"` DiskSize int64 `mapstructure:"disk_size"` + LinkedClone bool `mapstructure:"linked_clone"` } func (c *CloneConfig) Prepare() []error { - errs := c.VMConfig.Prepare() + var errs []error if c.Template == "" { - errs = append(errs, fmt.Errorf("Template name is required")) + errs = append(errs, fmt.Errorf("'template' is required")) + } + + if c.LinkedClone == true && c.DiskSize != 0 { + errs = append(errs, fmt.Errorf("'linked_clone' and 'disk_size' cannot be used together")) } return errs } type StepCloneVM struct { - config *CloneConfig + Config *CloneConfig + Location *common.LocationConfig } func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { @@ -36,20 +40,20 @@ func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep ui.Say("Cloning VM...") - template, err := d.FindVM(s.config.Template) + template, err := d.FindVM(s.Config.Template) if err != nil { state.Put("error", err) return multistep.ActionHalt } vm, err := template.Clone(&driver.CloneConfig{ - Name: s.config.VMName, - Folder: s.config.Folder, - Cluster: s.config.Cluster, - Host: s.config.Host, - ResourcePool: s.config.ResourcePool, - Datastore: s.config.Datastore, - LinkedClone: s.config.LinkedClone, + Name: s.Location.VMName, + Folder: s.Location.Folder, + Cluster: s.Location.Cluster, + Host: s.Location.Host, + ResourcePool: s.Location.ResourcePool, + Datastore: s.Location.Datastore, + LinkedClone: s.Config.LinkedClone, }) if err != nil { state.Put("error", err) @@ -57,8 +61,8 @@ func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep } state.Put("vm", vm) - if s.config.DiskSize > 0 { - err = vm.ResizeDisk(s.config.DiskSize) + if s.Config.DiskSize > 0 { + err = vm.ResizeDisk(s.Config.DiskSize) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/common/artifact.go b/common/artifact.go index c9ae1a36d..ac25ea4f6 100644 --- a/common/artifact.go +++ b/common/artifact.go @@ -32,9 +32,5 @@ func (a *Artifact) State(name string) interface{} { } func (a *Artifact) Destroy() error { - err := a.VM.Destroy() - if err != nil { - return err - } - return nil + return a.VM.Destroy() } diff --git a/common/check_run_status.go b/common/check_run_status.go deleted file mode 100644 index 0a00b14ad..000000000 --- a/common/check_run_status.go +++ /dev/null @@ -1,24 +0,0 @@ -package common - -import ( - "github.com/hashicorp/packer/helper/multistep" - "errors" -) - -func CheckRunStatus(state *multistep.BasicStateBag) error { - // If there was an error, return that - if rawErr, ok := state.GetOk("error"); ok { - return rawErr.(error) - } - - // If we were interrupted or cancelled, then just exit. - if _, ok := state.GetOk(multistep.StateCancelled); ok { - return errors.New("Build was cancelled.") - } - - if _, ok := state.GetOk(multistep.StateHalted); ok { - return errors.New("Build was halted.") - } - - return nil -} diff --git a/common/config_location.go b/common/config_location.go new file mode 100644 index 000000000..027b5d4dc --- /dev/null +++ b/common/config_location.go @@ -0,0 +1,25 @@ +package common + +import "fmt" + +type LocationConfig struct { + VMName string `mapstructure:"vm_name"` + Folder string `mapstructure:"folder"` + Cluster string `mapstructure:"cluster"` + Host string `mapstructure:"host"` + ResourcePool string `mapstructure:"resource_pool"` + Datastore string `mapstructure:"datastore"` +} + +func (c *LocationConfig) Prepare() []error { + var errs []error + + if c.VMName == "" { + errs = append(errs, fmt.Errorf("'vm_name' is required")) + } + if c.Cluster == "" && c.Host == "" { + errs = append(errs, fmt.Errorf("'host' or 'cluster' is required")) + } + + return errs +} diff --git a/common/ssh.go b/common/config_ssh.go similarity index 100% rename from common/ssh.go rename to common/config_ssh.go diff --git a/common/decode_config.go b/common/decode_config.go deleted file mode 100644 index 575a81cb4..000000000 --- a/common/decode_config.go +++ /dev/null @@ -1,14 +0,0 @@ -package common - -import ( - "github.com/hashicorp/packer/helper/config" - "github.com/hashicorp/packer/template/interpolate" -) - -func DecodeConfig(cfg interface{}, ctx *interpolate.Context, raws ...interface{}) error { - err := config.Decode(cfg, &config.DecodeOpts{ - Interpolate: true, - InterpolateContext: ctx, - }, raws...) - return err -} diff --git a/common/step_config_params.go b/common/step_config_params.go index 7a85a9068..b5cefc812 100644 --- a/common/step_config_params.go +++ b/common/step_config_params.go @@ -12,10 +12,6 @@ type ConfigParamsConfig struct { ConfigParams map[string]string `mapstructure:"configuration_parameters"` } -func (c *ConfigParamsConfig) Prepare() []error { - return nil -} - type StepConfigParams struct { Config *ConfigParamsConfig } @@ -24,11 +20,12 @@ func (s *StepConfigParams) Run(_ context.Context, state multistep.StateBag) mult ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Adding configuration parameters...") - - if err := vm.AddConfigParams(s.Config.ConfigParams); err != nil { - state.Put("error", fmt.Errorf("error adding configuration parameters: %v", err)) - return multistep.ActionHalt + if s.Config.ConfigParams != nil { + ui.Say("Adding configuration parameters...") + if err := vm.AddConfigParams(s.Config.ConfigParams); err != nil { + state.Put("error", fmt.Errorf("error adding configuration parameters: %v", err)) + return multistep.ActionHalt + } } return multistep.ActionContinue diff --git a/common/step_connect.go b/common/step_connect.go index f688eab62..774df9d74 100644 --- a/common/step_connect.go +++ b/common/step_connect.go @@ -19,13 +19,13 @@ func (c *ConnectConfig) Prepare() []error { var errs []error if c.VCenterServer == "" { - errs = append(errs, fmt.Errorf("vCenter hostname is required")) + errs = append(errs, fmt.Errorf("'vcenter_server' is required")) } if c.Username == "" { - errs = append(errs, fmt.Errorf("Username is required")) + errs = append(errs, fmt.Errorf("'username' is required")) } if c.Password == "" { - errs = append(errs, fmt.Errorf("Password is required")) + errs = append(errs, fmt.Errorf("'password' is required")) } return errs diff --git a/common/step_hardware.go b/common/step_hardware.go index e96a4c96d..d0fcb6ee7 100644 --- a/common/step_hardware.go +++ b/common/step_hardware.go @@ -12,12 +12,14 @@ type HardwareConfig struct { CPUs int32 `mapstructure:"CPUs"` CPUReservation int64 `mapstructure:"CPU_reservation"` CPULimit int64 `mapstructure:"CPU_limit"` + CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` + RAM int64 `mapstructure:"RAM"` RAMReservation int64 `mapstructure:"RAM_reservation"` RAMReserveAll bool `mapstructure:"RAM_reserve_all"` - NestedHV bool `mapstructure:"NestedHV"` - CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` + + NestedHV bool `mapstructure:"NestedHV"` } func (c *HardwareConfig) Prepare() []error { @@ -39,7 +41,7 @@ func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) vm := state.Get("vm").(*driver.VirtualMachine) if *s.Config != (HardwareConfig{}) { - ui.Say("Customizing hardware parameters...") + ui.Say("Customizing hardware...") err := vm.Configure(&driver.HardwareConfig{ CPUs: s.Config.CPUs, diff --git a/common/step_run.go b/common/step_run.go index 46f7bba5b..82ba99f37 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -3,7 +3,6 @@ package common import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" "context" @@ -29,10 +28,11 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Set boot order...") if s.Config.BootOrder != "" { - if err := vm.SetBootOrder(strings.Split(s.Config.BootOrder, ",")); err != nil { - state.Put("error", fmt.Errorf("error selecting boot order: %v", err)) + ui.Say("Set boot order...") + order := strings.Split(s.Config.BootOrder, ",") + if err := vm.SetBootOrder(order); err != nil { + state.Put("error", err) return multistep.ActionHalt } } @@ -40,7 +40,7 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste ui.Say("Power on VM...") err := vm.PowerOn() if err != nil { - state.Put("error", fmt.Errorf("error powering on VM: %v", err)) + state.Put("error",err) return multistep.ActionHalt } diff --git a/common/step_shutdown.go b/common/step_shutdown.go index cc3945c88..0c51da084 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -14,6 +14,7 @@ import ( type ShutdownConfig struct { Command string `mapstructure:"shutdown_command"` RawTimeout string `mapstructure:"shutdown_timeout"` + Timeout time.Duration } @@ -75,7 +76,6 @@ func (s *StepShutdown) Run(_ context.Context, state multistep.StateBag) multiste return multistep.ActionHalt } - ui.Say("VM stopped") return multistep.ActionContinue } diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index a8b0cbfc1..400d03559 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -45,6 +45,4 @@ func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multist } } -func (s *StepWaitForIp) Cleanup(state multistep.StateBag) { - // nothing -} +func (s *StepWaitForIp) Cleanup(state multistep.StateBag) {} diff --git a/common/vm_config.go b/common/vm_config.go deleted file mode 100644 index fb6a8996d..000000000 --- a/common/vm_config.go +++ /dev/null @@ -1,25 +0,0 @@ -package common - -import "fmt" - -type VMConfig struct { - VMName string `mapstructure:"vm_name"` - Folder string `mapstructure:"folder"` - Cluster string `mapstructure:"cluster"` - Host string `mapstructure:"host"` - ResourcePool string `mapstructure:"resource_pool"` - Datastore string `mapstructure:"datastore"` -} - -func (c *VMConfig) Prepare() []error { - var errs []error - - if c.VMName == "" { - errs = append(errs, fmt.Errorf("Target VM name is required")) - } - if c.Cluster == "" && c.Host == "" { - errs = append(errs, fmt.Errorf("vSphere host or cluster is required")) - } - - return errs -} diff --git a/driver/vm.go b/driver/vm.go index 8c50c2daf..520f1f3ff 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -53,7 +53,7 @@ type CreateConfig struct { Network string // "" for default network NetworkCard string // example: vmxnet3 USBController bool - Version int // example: 10 + Version uint // example: 10 } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { diff --git a/iso/builder.go b/iso/builder.go index 086906b39..04e253534 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -37,7 +37,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Config: &b.config.ConnectConfig, }, &StepCreateVM{ - Config: &b.config.CreateConfig, + Config: &b.config.CreateConfig, + Location: &b.config.LocationConfig, }, &common.StepConfigureHardware{ Config: &b.config.HardwareConfig, @@ -97,10 +98,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) - if err := common.CheckRunStatus(state); err != nil { - return nil, err + if rawErr, ok := state.GetOk("error"); ok { + return nil, rawErr.(error) } + if _, ok := state.GetOk("vm"); !ok { + return nil, nil + } artifact := &common.Artifact{ Name: b.config.VMName, VM: state.Get("vm").(*driver.VirtualMachine), diff --git a/iso/config.go b/iso/config.go index d5caf61b5..ec522bb2b 100644 --- a/iso/config.go +++ b/iso/config.go @@ -6,41 +6,51 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "github.com/hashicorp/packer/helper/config" ) type Config struct { - packerCommon.PackerConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - BootConfig `mapstructure:",squash"` - common.ConnectConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - common.ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` - ConvertToTemplate bool `mapstructure:"convert_to_template"` + packerCommon.PackerConfig `mapstructure:",squash"` + common.ConnectConfig `mapstructure:",squash"` CreateConfig `mapstructure:",squash"` + common.LocationConfig `mapstructure:",squash"` common.HardwareConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + BootConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` + + CreateSnapshot bool `mapstructure:"create_snapshot"` + ConvertToTemplate bool `mapstructure:"convert_to_template"` + ctx interpolate.Context } func NewConfig(raws ...interface{}) (*Config, []string, error) { c := new(Config) - if err := common.DecodeConfig(c, &c.ctx, raws...); err != nil { + err := config.Decode(c, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &c.ctx, + }, raws...) + if err != nil { return nil, nil, err } errs := new(packer.MultiError) - errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare()...) - errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) - errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) - errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) if len(errs.Errors) > 0 { return nil, nil, errs diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 9593046cc..60819a198 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -12,10 +12,6 @@ type CDRomConfig struct { ISOPaths []string `mapstructure:"iso_paths"` } -func (c *CDRomConfig) Prepare() []error { - return nil -} - type StepAddCDRom struct { Config *CDRomConfig } @@ -24,7 +20,7 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Adding CDRoms...") + ui.Say("Adding CD-ROM drives...") if err := vm.AddSATAController(); err != nil { state.Put("error", fmt.Errorf("error adding SATA controller: %v", err)) return multistep.ActionHalt diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index c492907f4..f11fa5e83 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -14,18 +14,6 @@ type FloppyConfig struct { FloppyDirectories []string `mapstructure:"floppy_dirs"` } -func (c *FloppyConfig) Prepare() []error { - var errs []error - - if c.FloppyIMGPath != "" && (c.FloppyFiles != nil || c.FloppyDirectories != nil) { - errs = append(errs, - fmt.Errorf("'floppy_img_path' cannot be used together with 'floppy_files' and 'floppy_dirs'"), - ) - } - - return errs -} - type StepAddFloppy struct { Config *FloppyConfig Datastore string @@ -33,56 +21,51 @@ type StepAddFloppy struct { } func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - err := s.runImpl(state) - if err != nil { - state.Put("error", fmt.Errorf("error adding floppy: %v", err)) - return multistep.ActionHalt - } - return multistep.ActionContinue -} - -func (s *StepAddFloppy) runImpl(state multistep.StateBag) error { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver) - tmpFloppy := state.Get("floppy_path") - if tmpFloppy != nil { + tmpFloppy := state.Get("floppy_path").(string) + if tmpFloppy != "" { ui.Say("Uploading created floppy image") ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { - return err + state.Put("error", err) + return multistep.ActionHalt } vmDir, err := vm.GetDir() if err != nil { - return err + state.Put("error", err) + return multistep.ActionHalt } - uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.img", vmDir) - if err := ds.UploadFile(tmpFloppy.(string), uploadPath); err != nil { - return fmt.Errorf("error uploading floppy image: %v", err) + uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.flp", vmDir) + if err := ds.UploadFile(tmpFloppy, uploadPath); err != nil { + state.Put("error", err) + return multistep.ActionHalt } state.Put("uploaded_floppy_path", uploadPath) - floppyIMGPath := ds.ResolvePath(uploadPath) ui.Say("Adding generated Floppy...") + floppyIMGPath := ds.ResolvePath(uploadPath) err = vm.AddFloppy(floppyIMGPath) if err != nil { - return err + state.Put("error", err) + return multistep.ActionHalt } } if s.Config.FloppyIMGPath != "" { - floppyIMGPath := s.Config.FloppyIMGPath ui.Say("Adding Floppy image...") - err := vm.AddFloppy(floppyIMGPath) + err := vm.AddFloppy(s.Config.FloppyIMGPath) if err != nil { - return err + state.Put("error", err) + return multistep.ActionHalt } } - return nil + return multistep.ActionContinue } func (s *StepAddFloppy) Cleanup(state multistep.StateBag) {} diff --git a/iso/step_create.go b/iso/step_create.go index 87d8dfcd4..f9e2f9207 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -10,54 +10,35 @@ import ( ) type CreateConfig struct { - common.VMConfig `mapstructure:",squash"` + Version uint `mapstructure:"vm_version"` + GuestOSType string `mapstructure:"guest_os_type"` - DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` DiskControllerType string `mapstructure:"disk_controller_type"` DiskSize int64 `mapstructure:"disk_size"` + DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` - GuestOSType string `mapstructure:"guest_os_type"` Network string `mapstructure:"network"` NetworkCard string `mapstructure:"network_card"` USBController bool `mapstructure:"usb_controller"` - Version int `mapstructure:"vm_version"` } func (c *CreateConfig) Prepare() []error { var errs []error - // needed to avoid changing the original config in case of errors - tmp := *c - - // do recursive calls - errs = append(errs, tmp.VMConfig.Prepare()...) - - if tmp.Version < 0 { - errs = append(errs, fmt.Errorf("'vm_version' cannot be a negative number")) + if c.DiskSize == 0 { + errs = append(errs, fmt.Errorf("'disk_size' is required")) } - if tmp.DiskSize == 0 { - errs = append(errs, fmt.Errorf("'disk_size' must be provided")) + if c.GuestOSType == "" { + c.GuestOSType = "otherGuest" } - - if len(errs) > 0 { - return errs - } - - // set default values - if tmp.GuestOSType == "" { - tmp.GuestOSType = "otherGuest" - } - - // change the original config - *c = tmp - - return []error{} + return errs } type StepCreateVM struct { - Config *CreateConfig + Config *CreateConfig + Location *common.LocationConfig } func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { @@ -65,30 +46,28 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste d := state.Get("driver").(*driver.Driver) ui.Say("Creating VM...") - vm, err := d.CreateVM(&driver.CreateConfig{ DiskThinProvisioned: s.Config.DiskThinProvisioned, DiskControllerType: s.Config.DiskControllerType, DiskSize: s.Config.DiskSize, - Name: s.Config.VMName, - Folder: s.Config.Folder, - Cluster: s.Config.Cluster, - Host: s.Config.Host, - ResourcePool: s.Config.ResourcePool, - Datastore: s.Config.Datastore, + Name: s.Location.VMName, + Folder: s.Location.Folder, + Cluster: s.Location.Cluster, + Host: s.Location.Host, + ResourcePool: s.Location.ResourcePool, + Datastore: s.Location.Datastore, GuestOS: s.Config.GuestOSType, Network: s.Config.Network, NetworkCard: s.Config.NetworkCard, USBController: s.Config.USBController, Version: s.Config.Version, }) - if err != nil { state.Put("error", fmt.Errorf("error creating vm: %v", err)) return multistep.ActionHalt } - state.Put("vm", vm) + return multistep.ActionContinue } @@ -108,7 +87,6 @@ func (s *StepCreateVM) Cleanup(state multistep.StateBag) { vm := st.(*driver.VirtualMachine) ui.Say("Destroying VM...") - err := vm.Destroy() if err != nil { ui.Error(err.Error()) diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index a8144eb75..b72c714e8 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -1,8 +1,6 @@ package iso import ( - "fmt" - "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/hashicorp/packer/helper/multistep" @@ -19,12 +17,12 @@ func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multi ui.Say("Deleting CD-ROM drives...") devices, err := vm.Devices() if err != nil { - ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) + state.Put("error", err) return multistep.ActionHalt } cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) - if err = vm.RemoveDevice(false, cdroms...); err != nil { - ui.Error(fmt.Sprintf("error removing cdroms: %v", err)) + if err = vm.RemoveDevice(true, cdroms...); err != nil { + state.Put("error", err) return multistep.ActionHalt } diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go index 7c32fe6dc..f9871c48c 100644 --- a/iso/step_remove_floppy.go +++ b/iso/step_remove_floppy.go @@ -1,8 +1,6 @@ package iso import ( - "fmt" - "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/hashicorp/packer/helper/multistep" @@ -20,35 +18,28 @@ func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) mult vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver) - var UploadedFloppyPath string - switch s := state.Get("uploaded_floppy_path").(type) { - case string: - UploadedFloppyPath = s - case nil: - UploadedFloppyPath = "" - } - ui.Say("Deleting Floppy drives...") devices, err := vm.Devices() if err != nil { - ui.Error(fmt.Sprintf("error removing floppy: %v", err)) + state.Put("error", err) return multistep.ActionHalt } floppies := devices.SelectByType((*types.VirtualFloppy)(nil)) - if err = vm.RemoveDevice(false, floppies...); err != nil { - ui.Error(fmt.Sprintf("error removing floppy: %v", err)) + if err = vm.RemoveDevice(true, floppies...); err != nil { + state.Put("error", err) return multistep.ActionHalt } + UploadedFloppyPath := state.Get("uploaded_floppy_path").(string) if UploadedFloppyPath != "" { ui.Say("Deleting Floppy image...") ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { - ui.Error(err.Error()) + state.Put("error", err) return multistep.ActionHalt } if err := ds.Delete(UploadedFloppyPath); err != nil { - ui.Error(fmt.Sprintf("Error deleting floppy image '%v': %v", UploadedFloppyPath, err.Error())) + state.Put("error", err) return multistep.ActionHalt } } From 8bdebe65a4205395a5aea5ec63d9993762171468 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Mon, 7 May 2018 10:20:27 +0300 Subject: [PATCH 166/266] Delete SATA controller --- iso/step_remove_cdrom.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index b72c714e8..4d41811b2 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -26,6 +26,13 @@ func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multi return multistep.ActionHalt } + ui.Say("Deleting SATA controller...") + sata := devices.SelectByType((*types.VirtualAHCIController)(nil)) + if err = vm.RemoveDevice(true, sata...); err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + return multistep.ActionContinue } From c93a4204a8952139cef611eaa5f470cfaf700cff Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 12 May 2018 13:55:52 +0300 Subject: [PATCH 167/266] Update dependencies --- Gopkg.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 1b505ca40..3840a8430 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -5,7 +5,7 @@ branch = "master" name = "github.com/Azure/go-ntlmssp" packages = ["."] - revision = "c92175d540060095c69ced311f76aea56c83ecdb" + revision = "4b934ac9dad38d389d34f0b98d98b2467c422012" [[projects]] branch = "master" @@ -101,10 +101,10 @@ revision = "2658be15c5f05e76244154714161f17e3e77de2e" [[projects]] - branch = "master" name = "github.com/kr/fs" packages = ["."] - revision = "2788f0dbd16903de03cb8186e5c7d97b69ad387b" + revision = "1455def202f6e05b95cc7bfc7e8ae67ae5141eba" + version = "v0.1.0" [[projects]] branch = "master" @@ -149,7 +149,7 @@ branch = "master" name = "github.com/mitchellh/mapstructure" packages = ["."] - revision = "00c29f56e2386353d58c599509e8dc3801b0d716" + revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b" [[projects]] branch = "master" @@ -178,8 +178,8 @@ [[projects]] name = "github.com/pkg/sftp" packages = ["."] - revision = "43ec6c679d353f6e077d3965dc74f6d996eb4a09" - version = "1.5.1" + revision = "d2aa419835609d317c34baae11bc345d1f9971a7" + version = "1.7.0" [[projects]] name = "github.com/ugorji/go" @@ -222,13 +222,13 @@ "ssh", "ssh/agent" ] - revision = "d6449816ce06963d9d136eee5a56fca5b0616e7e" + revision = "2d027ae1dddd4694d54f7a8b6cbe78dca8720226" [[projects]] branch = "master" name = "golang.org/x/mobile" packages = ["event/key"] - revision = "1f177cbe4ddf911017472e9532c6ca3a99949d53" + revision = "274da161099df258cb919e10e9fd0ae401e143a8" [[projects]] branch = "master" @@ -240,7 +240,7 @@ "internal/socks", "proxy" ] - revision = "500e7a4f953ddaf55d316b4d3adc516aa0379622" + revision = "2491c5de3490fced2f6cff376127c667efeed857" [[projects]] name = "golang.org/x/text" From 6d77fea25e790c6b2893eb8b336c03516634d0ce Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 12 May 2018 14:03:06 +0300 Subject: [PATCH 168/266] Update dependency to Packer 1.2.3 --- Gopkg.lock | 7 ++++--- Gopkg.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 3840a8430..a9c04ce89 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -84,6 +84,7 @@ "helper/communicator", "helper/config", "helper/multistep", + "helper/useragent", "packer", "packer/plugin", "packer/rpc", @@ -91,8 +92,8 @@ "template/interpolate", "version" ] - revision = "ab8811dca8f375344f36dfc32710b9790b2ec03e" - version = "v1.2.2" + revision = "b4df69af04373ef28caef3601befcaec1f909216" + version = "v1.2.3" [[projects]] branch = "master" @@ -269,6 +270,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "8a4e7f25a3386ca66a780d534df46b4d94a4a369e8c1784ce07bd2075c529a4a" + inputs-digest = "adae0b19fa6fd48440ded469329ce77fcaf433c61f699d2405d87ad75650f551" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 121c46274..44d5238a7 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,6 +1,6 @@ [[constraint]] name = "github.com/hashicorp/packer" - version = "=1.2.2" + version = "~1.2" [[constraint]] name = "github.com/vmware/govmomi" From 903febc4ea8ab540e7bd4a3d235e32346076c2ca Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 12 May 2018 14:19:17 +0300 Subject: [PATCH 169/266] Update dependency to govmomi 0.17 --- Gopkg.lock | 7 ++++--- Gopkg.toml | 2 +- clone/builder_acc_test.go | 6 +++--- driver/vm.go | 6 +++--- driver/vm_clone_acc_test.go | 6 +++--- iso/builder_acc_test.go | 6 +++--- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index a9c04ce89..e4f7e7023 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -194,6 +194,7 @@ ".", "find", "list", + "nfc", "object", "property", "session", @@ -207,8 +208,8 @@ "vim25/types", "vim25/xml" ] - revision = "b63044e5f833781eb7b305bc035392480ee06a82" - version = "v0.15.0" + revision = "123ed177021588bac57b5c87c1a84270ddf2eca8" + version = "v0.17.1" [[projects]] branch = "master" @@ -270,6 +271,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "adae0b19fa6fd48440ded469329ce77fcaf433c61f699d2405d87ad75650f551" + inputs-digest = "4e43d31e08e37dfb7449ddb1cc361b739f2b65e95d3e560d4e31d40fbabab044" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 44d5238a7..5f33f3bef 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -4,7 +4,7 @@ [[constraint]] name = "github.com/vmware/govmomi" - version = "=0.15.0" + version = "~0.17" [[override]] name = "github.com/masterzen/azure-sdk-for-go" diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index dfece3151..8ce956bd5 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -348,12 +348,12 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) } - cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + cpuReservation := *vmInfo.Config.CpuAllocation.Reservation if cpuReservation != 1000 { t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) } - cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + cpuLimit := *vmInfo.Config.CpuAllocation.Limit if cpuLimit != 1500 { t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) } @@ -363,7 +363,7 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have 2048 MB of RAM, got %v", ram) } - ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + ramReservation := *vmInfo.Config.MemoryAllocation.Reservation if ramReservation != 1024 { t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) } diff --git a/driver/vm.go b/driver/vm.go index 520f1f3ff..db3eb4d66 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -248,12 +248,12 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { confSpec.MemoryMB = config.RAM var cpuSpec types.ResourceAllocationInfo - cpuSpec.Reservation = config.CPUReservation - cpuSpec.Limit = config.CPULimit + cpuSpec.Reservation = &config.CPUReservation + cpuSpec.Limit = &config.CPULimit confSpec.CpuAllocation = &cpuSpec var ramSpec types.ResourceAllocationInfo - ramSpec.Reservation = config.RAMReservation + ramSpec.Reservation = &config.RAMReservation confSpec.MemoryAllocation = &ramSpec confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index 629e5f6b2..8a023a897 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -134,12 +134,12 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { t.Errorf("VM should have %v CPU sockets, got %v", hwConfig.CPUs, cpuSockets) } - cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + cpuReservation := *vmInfo.Config.CpuAllocation.Reservation if cpuReservation != hwConfig.CPUReservation { t.Errorf("VM should have CPU reservation for %v Mhz, got %v", hwConfig.CPUReservation, cpuReservation) } - cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + cpuLimit := *vmInfo.Config.CpuAllocation.Limit if cpuLimit != hwConfig.CPULimit { t.Errorf("VM should have CPU reservation for %v Mhz, got %v", hwConfig.CPULimit, cpuLimit) } @@ -149,7 +149,7 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { t.Errorf("VM should have %v MB of RAM, got %v", hwConfig.RAM, ram) } - ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + ramReservation := *vmInfo.Config.MemoryAllocation.Reservation if ramReservation != hwConfig.RAMReservation { t.Errorf("VM should have RAM reservation for %v MB, got %v", hwConfig.RAMReservation, ramReservation) } diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index a1d0ef82a..288780a09 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -130,12 +130,12 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) } - cpuReservation := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Reservation + cpuReservation := *vmInfo.Config.CpuAllocation.Reservation if cpuReservation != 1000 { t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) } - cpuLimit := vmInfo.Config.CpuAllocation.GetResourceAllocationInfo().Limit + cpuLimit := *vmInfo.Config.CpuAllocation.Limit if cpuLimit != 1500 { t.Errorf("VM should have CPU reservation for 1500 Mhz, got %v", cpuLimit) } @@ -145,7 +145,7 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have 2048 MB of RAM, got %v", ram) } - ramReservation := vmInfo.Config.MemoryAllocation.GetResourceAllocationInfo().Reservation + ramReservation := *vmInfo.Config.MemoryAllocation.Reservation if ramReservation != 1024 { t.Errorf("VM should have RAM reservation for 1024 MB, got %v", ramReservation) } From 689f1789ebcae444b101bb6f10ac9203b3862156 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sun, 13 May 2018 23:06:21 +0300 Subject: [PATCH 170/266] Fix 'Unexpected EOF' in builds without floppies --- iso/step_add_floppy.go | 5 ++--- iso/step_remove_floppy.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index f11fa5e83..f03511452 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -25,8 +25,7 @@ func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multist vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver) - tmpFloppy := state.Get("floppy_path").(string) - if tmpFloppy != "" { + if floppyPath, ok := state.GetOk("floppy_path"); ok { ui.Say("Uploading created floppy image") ds, err := d.FindDatastore(s.Datastore, s.Host) @@ -41,7 +40,7 @@ func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multist } uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.flp", vmDir) - if err := ds.UploadFile(tmpFloppy, uploadPath); err != nil { + if err := ds.UploadFile(floppyPath.(string), uploadPath); err != nil { state.Put("error", err) return multistep.ActionHalt } diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go index f9871c48c..3a1a2d762 100644 --- a/iso/step_remove_floppy.go +++ b/iso/step_remove_floppy.go @@ -30,15 +30,14 @@ func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) mult return multistep.ActionHalt } - UploadedFloppyPath := state.Get("uploaded_floppy_path").(string) - if UploadedFloppyPath != "" { + if UploadedFloppyPath, ok := state.GetOk("uploaded_floppy_path"); ok { ui.Say("Deleting Floppy image...") ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { state.Put("error", err) return multistep.ActionHalt } - if err := ds.Delete(UploadedFloppyPath); err != nil { + if err := ds.Delete(UploadedFloppyPath.(string)); err != nil { state.Put("error", err) return multistep.ActionHalt } From 23c918d00a4fa4aa59e580389169d173143dcc79 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 16 May 2018 16:05:08 +0300 Subject: [PATCH 171/266] Fix build cancellation (#101) --- clone/step_clone.go | 7 +++++-- common/step_connect.go | 4 ++-- common/step_shutdown.go | 4 ++-- common/step_wait_for_ip.go | 6 ++++-- driver/driver.go | 3 ++- driver/vm.go | 18 +++++++++++++----- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/clone/step_clone.go b/clone/step_clone.go index f8a28dd42..b588e17cb 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -34,7 +34,7 @@ type StepCloneVM struct { Location *common.LocationConfig } -func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { +func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) @@ -46,7 +46,7 @@ func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep return multistep.ActionHalt } - vm, err := template.Clone(&driver.CloneConfig{ + vm, err := template.Clone(ctx, &driver.CloneConfig{ Name: s.Location.VMName, Folder: s.Location.Folder, Cluster: s.Location.Cluster, @@ -59,6 +59,9 @@ func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep state.Put("error", err) return multistep.ActionHalt } + if vm == nil { + return multistep.ActionHalt + } state.Put("vm", vm) if s.Config.DiskSize > 0 { diff --git a/common/step_connect.go b/common/step_connect.go index 774df9d74..6891247d7 100644 --- a/common/step_connect.go +++ b/common/step_connect.go @@ -35,8 +35,8 @@ type StepConnect struct { Config *ConnectConfig } -func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - d, err := driver.NewDriver(ctx, &driver.ConnectConfig{ +func (s *StepConnect) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: s.Config.VCenterServer, Username: s.Config.Username, Password: s.Config.Password, diff --git a/common/step_shutdown.go b/common/step_shutdown.go index 0c51da084..5fe9996fc 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -39,7 +39,7 @@ type StepShutdown struct { Config *ShutdownConfig } -func (s *StepShutdown) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { +func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) comm := state.Get("communicator").(packer.Communicator) vm := state.Get("vm").(*driver.VirtualMachine) @@ -70,7 +70,7 @@ func (s *StepShutdown) Run(_ context.Context, state multistep.StateBag) multiste } log.Printf("Waiting max %s for shutdown to complete", s.Config.Timeout) - err := vm.WaitForShutdown(s.Config.Timeout) + err := vm.WaitForShutdown(ctx, s.Config.Timeout) if err != nil { state.Put("error", err) return multistep.ActionHalt diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index 400d03559..a3485bd5d 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -11,7 +11,7 @@ import ( type StepWaitForIp struct{} -func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { +func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) @@ -20,7 +20,7 @@ func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multist ipChan := make(chan string) errChan := make(chan error) go func() { - ip, err := vm.WaitForIP() + ip, err := vm.WaitForIP(ctx) if err != nil { errChan <- err } else { @@ -33,6 +33,8 @@ func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multist case err := <-errChan: state.Put("error", err) return multistep.ActionHalt + case <-ctx.Done(): + return multistep.ActionHalt case ip := <-ipChan: state.Put("ip", ip) ui.Say(fmt.Sprintf("IP address: %v", ip)) diff --git a/driver/driver.go b/driver/driver.go index 324bcc148..30ddcce72 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -28,7 +28,8 @@ type ConnectConfig struct { Datacenter string } -func NewDriver(ctx context.Context, config *ConnectConfig) (*Driver, error) { +func NewDriver(config *ConnectConfig) (*Driver, error) { + ctx := context.TODO() vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) if err != nil { diff --git a/driver/vm.go b/driver/vm.go index db3eb4d66..e896a65cc 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -8,6 +8,7 @@ import ( "github.com/vmware/govmomi/vim25/types" "time" "strings" + "context" ) type VirtualMachine struct { @@ -178,7 +179,7 @@ func (vm *VirtualMachine) Devices() (object.VirtualDeviceList, error) { return vmInfo.Config.Hardware.Device, nil } -func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, error) { +func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) (*VirtualMachine, error) { folder, err := template.driver.FindFolder(config.Folder) if err != nil { return nil, err @@ -223,8 +224,13 @@ func (template *VirtualMachine) Clone(config *CloneConfig) (*VirtualMachine, err return nil, err } - info, err := task.WaitForResult(template.driver.ctx, nil) + info, err := task.WaitForResult(ctx, nil) if err != nil { + if ctx.Err() == context.Canceled { + err = task.Cancel(context.TODO()) + return nil, err + } + return nil, err } @@ -329,8 +335,8 @@ func (vm *VirtualMachine) PowerOn() error { return err } -func (vm *VirtualMachine) WaitForIP() (string, error) { - return vm.vm.WaitForIP(vm.driver.ctx) +func (vm *VirtualMachine) WaitForIP(ctx context.Context) (string, error) { + return vm.vm.WaitForIP(ctx) } func (vm *VirtualMachine) PowerOff() error { @@ -356,7 +362,7 @@ func (vm *VirtualMachine) StartShutdown() error { return err } -func (vm *VirtualMachine) WaitForShutdown(timeout time.Duration) error { +func (vm *VirtualMachine) WaitForShutdown(ctx context.Context, timeout time.Duration) error { shutdownTimer := time.After(timeout) for { powerState, err := vm.vm.PowerState(vm.driver.ctx) @@ -371,6 +377,8 @@ func (vm *VirtualMachine) WaitForShutdown(timeout time.Duration) error { case <-shutdownTimer: err := errors.New("Timeout while waiting for machine to shut down.") return err + case <-ctx.Done(): + return nil default: time.Sleep(1 * time.Second) } From 1eaebb156f3c469e16f2fa8080e3e7a6b5ea992a Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Wed, 16 May 2018 16:36:14 +0300 Subject: [PATCH 172/266] Catch test compilation errors --- test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 48d55a97c..adb01e56f 100755 --- a/test.sh +++ b/test.sh @@ -2,6 +2,9 @@ set -eux -export PACKER_ACC=1 +go test -c ./driver +go test -c ./iso +go test -c ./clone +export PACKER_ACC=1 go test -v ./driver ./iso ./clone From bce47bc1a9831235e35b492cb0785ba2323a87e3 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Wed, 16 May 2018 16:42:49 +0300 Subject: [PATCH 173/266] Revert "Catch test compilation errors" This reverts commit 1eaebb1 --- test.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test.sh b/test.sh index adb01e56f..48d55a97c 100755 --- a/test.sh +++ b/test.sh @@ -2,9 +2,6 @@ set -eux -go test -c ./driver -go test -c ./iso -go test -c ./clone - export PACKER_ACC=1 + go test -v ./driver ./iso ./clone From dae64707a558baa2a562d2134e1ec5fa54770fcb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Wed, 16 May 2018 16:53:32 +0300 Subject: [PATCH 174/266] Fix tests --- common/testing/utility.go | 3 +-- driver/driver_test.go | 3 +-- driver/vm_clone_acc_test.go | 7 ++++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/common/testing/utility.go b/common/testing/utility.go index 7c72e14a9..8a13bf883 100644 --- a/common/testing/utility.go +++ b/common/testing/utility.go @@ -9,7 +9,6 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" "testing" "github.com/jetbrains-infra/packer-builder-vsphere/common" - "context" ) func NewVMName() string { @@ -35,7 +34,7 @@ func RenderConfig(config map[string]interface{}) string { func TestConn(t *testing.T) *driver.Driver { - d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ + d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/driver/driver_test.go b/driver/driver_test.go index 54590f389..e46729ad4 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -5,14 +5,13 @@ import ( "testing" "time" "math/rand" - "context" ) // Defines whether acceptance tests should be run const TestHostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { - d, err := NewDriver(context.TODO(), &ConnectConfig{ + d, err := NewDriver(&ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index 8a023a897..fc5be60a0 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -5,6 +5,7 @@ import ( "net" "testing" "time" + "context" ) func TestVMAcc_clone(t *testing.T) { @@ -38,7 +39,7 @@ func TestVMAcc_clone(t *testing.T) { } log.Printf("[DEBUG] Clonning VM") - vm, err := template.Clone(tc.config) + vm, err := template.Clone(context.TODO(), tc.config) if err != nil { t.Fatalf("Cannot clone vm '%v': %v", templateName, err) } @@ -227,7 +228,7 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { stopper := startVM(t, vm, config.Name) defer stopper() - switch ip, err := vm.WaitForIP(); { + switch ip, err := vm.WaitForIP(context.TODO()); { case err != nil: t.Errorf("Cannot obtain IP address from created vm '%v': %v", config.Name, err) case net.ParseIP(ip) == nil: @@ -236,7 +237,7 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { vm.StartShutdown() log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") - vm.WaitForShutdown(1 * time.Minute) + vm.WaitForShutdown(context.TODO(), 1 * time.Minute) } func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { From 33f640d7388e66f82c0ace8a53426be20aeb9800 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Tue, 22 May 2018 21:58:23 +0300 Subject: [PATCH 175/266] Fix #107 RPC client in the plugin uses incompatible version of a message codec, so Packer core cannot read them --- Gopkg.lock | 5 ++--- Gopkg.toml | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index e4f7e7023..eb3998932 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -185,8 +185,7 @@ [[projects]] name = "github.com/ugorji/go" packages = ["codec"] - revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab" - version = "v1.1.1" + revision = "646ae4a518c1c3be0739df898118d9bccf993858" [[projects]] name = "github.com/vmware/govmomi" @@ -271,6 +270,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "4e43d31e08e37dfb7449ddb1cc361b739f2b65e95d3e560d4e31d40fbabab044" + inputs-digest = "9f89755514c7933bbbdc65648a5a6058d1387bc47aa717bae8772c9f7037a542" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 5f33f3bef..42789372a 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -15,6 +15,11 @@ name = "github.com/ChrisTrenkamp/goxpath" branch = "master" +# Plugin's RPC client uses the same version of a codec as a server in Packer core +[[override]] + name = "github.com/ugorji/go" + revision = "646ae4a518c1c3be0739df898118d9bccf993858" + [prune] go-tests = true unused-packages = true From 8754ddc709902e2f9575cc8e6f213542eda44ff8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 23 May 2018 02:50:53 +0300 Subject: [PATCH 176/266] Update Docs for v2.0 (#96) --- README.md | 225 ++++++++++++++---------------- examples/clone/alpine.json | 18 +++ examples/macos/macos-10.13.json | 2 +- examples/macos/setup/iso-setup.sh | 4 +- examples/macos/setup/postinstall | 3 +- examples/macos/setup/setup.sh | 1 + examples/ubuntu/ubuntu-16.04.json | 2 +- examples/windows/windows-10.json | 2 +- 8 files changed, 130 insertions(+), 127 deletions(-) create mode 100644 examples/clone/alpine.json mode change 100755 => 100644 examples/macos/setup/setup.sh diff --git a/README.md b/README.md index 8a782fa6c..dfa0f614d 100644 --- a/README.md +++ b/README.md @@ -7,134 +7,115 @@ This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSphere API, and creates virtual machines remotely. -- VMware Player is not required -- Builds are incremental, VMs are not created from scratch but cloned from base templates - similar to [amazon-ebs](https://www.packer.io/docs/builders/amazon-ebs.html) builder -- Official vCenter API is used, no ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) is required +`vsphere-iso` builder creates new VMs from scratch. +`vsphere-clone` builder clones VMs from existing templates. -## Usage -* Download the plugin from [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page. -* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply put it into the same directory with configuration files. On Linux and macOS run `chmod +x` on the plugin binary. +- VMware Player is not required. +- Official vCenter API is used, no ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) is required. -## Minimal Example +## Installation +* Download binaries from the [releases page](https://github.com/jetbrains-infra/packer-builder-vsphere/releases). +* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugins, or simply put them into the same directory with JSON templates. On Linux and macOS run `chmod +x` on the files. -```json -{ - "builders": [ - { - "type": "vsphere", +## Examples - "vcenter_server": "vcenter.domain.com", - "username": "root", - "password": "secret", +See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/jetbrains-infra/packer-builder-vsphere/tree/master/examples/). - "template": "ubuntu", - "vm_name": "vm-1", - "host": "esxi-1.domain.com", +## Parameter Reference - "ssh_username": "root", - "ssh_password": "secret" - } - ], - "provisioners": [ - { - "type": "shell", - "inline": [ "echo hello" ] - } - ] -} +### Connection + +* `vcenter_server`(string) - vCenter server hostname. +* `username`(string) - vSphere username. +* `password`(string) - vSphere password. +* `insecure_connection`(boolean) - Do not validate vCenter server's TLS certificate. Defaults to `false`. +* `datacenter`(string) - VMware datacenter name. Required if there is more than one datacenter in vCenter. + +### VM Location + +* `vm_name`(string) - Name of the new VM to create. +* `folder`(string) - VM folder to create the VM in. +* `host`(string) - ESXi host where target VM is created. A full path must be specified if the host is in a folder. For example `folder/host`. See the `Specifying Clusters and Hosts` section above for more details. +* `cluster`(string) - ESXi cluster where target VM is created. See [Working with Clusters](#working-with-clusters) section. +* `resource_pool`(string) - VMWare resource pool. Defaults to the root resource pool of the `host` or `cluster`. +* `datastore`(string) - VMWare datastore. Required if `host` is a cluster, or if `host` has multiple datastores. + +### VM Location (`vsphere-clone` only) + +* `template`(string) - Name of source VM. Path is optional. +* `linked_clone`(boolean) - Create VM as a linked clone from latest snapshot. Defaults to `false`. + +### Hardware + +* `CPUs`(number) - Number of CPU sockets. +* `CPU_limit`(number) - Upper limit of available CPU resources in MHz. +* `CPU_reservation`(number) - Amount of reserved CPU resources in MHz. +* `CPU_hot_plug`(boolean) - Enable CPU hot plug setting for virtual machine. Defaults to `false`. +* `RAM`(number) - Amount of RAM in MB. +* `RAM_reservation`(number) - Amount of reserved RAM in MB. +* `RAM_reserve_all`(boolean) - Reserve all available RAM. Defaults to `false`. Cannot be used together with `RAM_reservation`. +* `RAM_hot_plug`(boolean) - Enable RAM hot plug setting for virtual machine. Defaults to `false`. +* `disk_size`(number) - The size of the disk in MB. +* `NestedHV`(boolean) - Enable nested hardware virtualization for VM. Defaults to `false`. +* `configuration_parameters`(map) - Custom parameters. +* `boot_order`(string) - Priority of boot devices. Defaults to `disk,cdrom` + +### Hardware (`vsphere-iso` only) + +* `vm_version`(number) - Set VM hardware version. Defaults to the most current VM hardware version supported by vCenter. See [VMWare article 1003746](https://kb.vmware.com/s/article/1003746) for the full list of supported VM hardware versions. +* `guest_os_type`(string) - Set VM OS type. Defaults to `otherGuest`. See [here](https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.GuestOsDescriptor.GuestOsIdentifier.html) for a full list of possible values. +* `disk_controller_type`(string) - Set VM disk controller type. Example `pvscsi`. +* `disk_thin_provisioned`(boolean) - Enable VMDK thin provisioning for VM. Defaults to `false`. +* `network`(string) - Set network VM will be connected to. +* `network_card`(string) - Set VM network card type. Example `vmxnet3`. +* `usb_controller`(boolean) - Create US controller for virtual machine. Defaults to `false`. + +### Boot (`vsphere-iso` only) + +* `boot_wait`(string) Amount of time to wait for the VM to boot. Examples 45s and 10m. Defaults to 10 seconds. See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. +* `boot_command`(array of strings) - List of commands to type when the VM is first booted. Used to initalize the operating system installer. +* `floppy_dirs`(array of strings) - Seems to not do anything useful yet. Not implemented. +* `floppy_files`(array of strings) - List of local files to be mounted to the VM floppy drive. Can be used to make Debian preseed or RHEL kickstart files available to the VM. +* `floppy_img_path`(string) - Data store path to a floppy image that will be mounted to the VM. Cannot be used with `floppy_files` or `floppy_dir` options. Example `[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp`. +* `iso_paths`(array of strings) - List of data store paths to ISO files that will be mounted to the VM. Example `"[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso"`. + +### Provision + +* `communicator` - `ssh` (default), `winrm`, or `none`. + +* `ssh_username`(string) - Username in guest OS. +* `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. +* `ssh_private_key_file`(string) - Path to the SSH private key file to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. + +* `winrm_username`(string) - Username in guest OS. +* `winrm_password`(string) - Password to access guest OS. + +* `shutdown_command`(string) - Specify a VM guest shutdown command. VMware guest tools are used by default. +* `shutdown_timeout`(string) - Amount of time to wait for graceful VM shutdown. Examples 45s and 10m. Defaults to 5m(5 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. + +### Postprocessing + +* `create_snapshot`(boolean) - Create a snapshot when set to `true`, so the VM can be used as a base for linked clones. Defaults to `false`. +* `convert_to_template`(boolean) - Convert VM to a template. Defaults to `false`. + +## Working with Clusters +#### Standalone Hosts +Only use the `host` option. Optionally specify a `resource_pool`: +``` +"host": "esxi-1.vsphere65.test", +"resource_pool": "pool1", ``` -## Parameters - -Connection: -* `vcenter_server` - [**mandatory**] vCenter server hostname. -* `username` - [**mandatory**] vSphere username. -* `password` - [**mandatory**] vSphere password. -* `insecure_connection` - do not validate server's TLS certificate. `false` by default. -* `datacenter` - required if there are several datacenters. - -Location: -* `template` - [**mandatory**] name of source VM. Path is optional. -* `vm_name` - [**mandatory**] name of target VM. -* `folder` - VM folder where target VM is created. -* `host` - [**mandatory**] vSphere host or cluster where target VM is created. If hosts are groupped into folders, full path should be specified: `folder/host`. -* `resource_pool` - by default a root of vSphere host. -* `datastore` - required if target is a cluster, or a host with multiple datastores. -* `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. - -Hardware customization: -* `CPUs` - number of CPU sockets. Inherited from source VM by default. -* `CPU_reservation` - Amount of reserved CPU resources in MHz. Inherited from source VM by default. -* `CPU_limit` - Upper limit of available CPU resources in MHz. Inherited from source VM by default, set to `-1` for reset. -* `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. -* `RAM_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default. -* `RAM_reserve_all` - Reserve all available RAM (bool). `false` by default. Cannot be used together with `RAM_reservation`. -* `disk_size` - Change the disk size (in GB). VM should have a single disk. Cannot be used together with `linked_clone`. -* `NestedHV` - Allows to enable nested hardware virtualization for VM. - -Provisioning: -* `ssh_username` - [**mandatory**] username in guest OS. -* `ssh_password` or `ssh_private_key_file` - [**mandatory**] password or SSH-key filename to access a guest OS. - -Post-processing: -* `shutdown_command` - VMware guest tools are used by default. -* `shutdown_timeout` - [Duration](https://golang.org/pkg/time/#ParseDuration) how long to wait for a graceful shutdown. 5 minutes by default. -* `create_snapshot` - add a snapshot, so VM can be used as a base for linked clones. `false` by default. -* `convert_to_template` - convert VM to a template. `false` by default. - -## Complete Example -```json -{ - "variables": { - "vsphere_password": "secret", - "guest_password": "secret" - }, - - "builders": [ - { - "type": "vsphere", - - "vcenter_server": "vcenter.domain.com", - "username": "root", - "password": "{{user `vsphere_password`}}", - "insecure_connection": true, - "datacenter": "dc1", - - "template": "folder/ubuntu", - "vm_name": "vm-1", - "folder": "folder1/folder2", - "host": "folder/esxi-1.domain.com", - "resource_pool": "pool1/pool2", - "datastore": "datastore1", - "linked_clone": true, - - "CPUs": 2, - "CPU_reservation": 1000, - "CPU_limit": 2000, - "RAM": 8192, - "RAM_reservation": 2048, - - "ssh_username": "root", - "ssh_password": "{{user `guest_password`}}", - - "shutdown_command": "echo '{{user `guest_password`}}' | sudo -S shutdown -P now", - "shutdown_timeout": "5m", - "create_snapshot": true, - "convert_to_template": true - } - ], - - "provisioners": [ - { - "type": "shell", - "environment_vars": [ - "DEBIAN_FRONTEND=noninteractive" - ], - "execute_command": "echo '{{user `guest_password`}}' | {{.Vars}} sudo -ES bash -eux '{{.Path}}'", - "inline": [ - "apt-get install -y zip" - ] - } - ] -} +#### Clusters Without DRS +Use the `cluster` and `host `parameters: +``` +"cluster": "cluster1", +"host": "esxi-2.vsphere65.test", +``` + +#### Clusters With DRS +Only use the `cluster` option. Optionally specify a `resource_pool`: +``` +"cluster": "cluster2", +"resource_pool": "pool1", ``` diff --git a/examples/clone/alpine.json b/examples/clone/alpine.json new file mode 100644 index 000000000..8e62d2726 --- /dev/null +++ b/examples/clone/alpine.json @@ -0,0 +1,18 @@ +{ + "builders": [ + { + "type": "vsphere-clone", + + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": "true", + + "template": "alpine", + "vm_name": "alpine-clone-{{timestamp}}", + "host": "esxi-1.vsphere65.test", + + "communicator": "none" + } + ] +} diff --git a/examples/macos/macos-10.13.json b/examples/macos/macos-10.13.json index 1f6fdbbcc..eea54280f 100644 --- a/examples/macos/macos-10.13.json +++ b/examples/macos/macos-10.13.json @@ -16,7 +16,7 @@ "CPUs": 1, "RAM": 4096, - "disk_size": 32, + "disk_size": 32768, "disk_thin_provisioned": true, "network_card": "e1000e", diff --git a/examples/macos/setup/iso-setup.sh b/examples/macos/setup/iso-setup.sh index ede079b75..934f7b205 100755 --- a/examples/macos/setup/iso-setup.sh +++ b/examples/macos/setup/iso-setup.sh @@ -17,7 +17,9 @@ pkgbuild \ mkdir -p out/iso rm -rf out/iso/* cp setup.sh out/iso/ +chmod +x out/iso/setup.sh + productbuild --package out/postinstall.pkg out/iso/postinstall.pkg -rm out/setup.iso +rm -f out/setup.iso hdiutil makehybrid -iso -joliet -default-volume-name setup -o out/setup.iso out/iso diff --git a/examples/macos/setup/postinstall b/examples/macos/setup/postinstall index 819c21922..d9c8c8562 100755 --- a/examples/macos/setup/postinstall +++ b/examples/macos/setup/postinstall @@ -1,5 +1,6 @@ #!/bin/sh -set -eu +set -eux +# debug output in /var/log/install.log # Create user account USERNAME=jetbrains diff --git a/examples/macos/setup/setup.sh b/examples/macos/setup/setup.sh old mode 100755 new mode 100644 index 6f28af424..9fb49a9f5 --- a/examples/macos/setup/setup.sh +++ b/examples/macos/setup/setup.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -eux # Format partition diskutil eraseDisk JHFS+ Disk disk0 diff --git a/examples/ubuntu/ubuntu-16.04.json b/examples/ubuntu/ubuntu-16.04.json index d7ea5e89f..37f5299bd 100644 --- a/examples/ubuntu/ubuntu-16.04.json +++ b/examples/ubuntu/ubuntu-16.04.json @@ -21,7 +21,7 @@ "RAM_reserve_all": true, "disk_controller_type": "pvscsi", - "disk_size": 32, + "disk_size": 32768, "disk_thin_provisioned": true, "network_card": "vmxnet3", diff --git a/examples/windows/windows-10.json b/examples/windows/windows-10.json index 4a0eef8fc..5d494b46f 100644 --- a/examples/windows/windows-10.json +++ b/examples/windows/windows-10.json @@ -22,7 +22,7 @@ "RAM_reserve_all": true, "disk_controller_type": "pvscsi", - "disk_size": 32, + "disk_size": 32768, "disk_thin_provisioned": true, "network_card": "vmxnet3", From a00a2ade14e1f0f5c2ce16b9ea1dd85227f8e8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= <remijouannet@gmail.com> Date: Tue, 4 Sep 2018 11:39:32 +0200 Subject: [PATCH 177/266] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfa0f614d..6ca2579d4 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `disk_thin_provisioned`(boolean) - Enable VMDK thin provisioning for VM. Defaults to `false`. * `network`(string) - Set network VM will be connected to. * `network_card`(string) - Set VM network card type. Example `vmxnet3`. -* `usb_controller`(boolean) - Create US controller for virtual machine. Defaults to `false`. +* `usb_controller`(boolean) - Create USB controller for virtual machine. Defaults to `false`. ### Boot (`vsphere-iso` only) From 94a3563c96d9f68ab17a2a266aa766bf82c3dfa0 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Thu, 11 Oct 2018 19:10:04 +0300 Subject: [PATCH 178/266] changes in dep 0.5 --- Gopkg.lock | 99 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 10 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index eb3998932..0e643fc79 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -3,12 +3,15 @@ [[projects]] branch = "master" + digest = "1:bf641dbf159d010db3c6da01311806f3b85a97cf26da3299bfa690ee4caf9ae4" name = "github.com/Azure/go-ntlmssp" packages = ["."] + pruneopts = "UT" revision = "4b934ac9dad38d389d34f0b98d98b2467c422012" [[projects]] branch = "master" + digest = "1:02fd483ec38dfd1231ff5a3a5ff1389042a5bb825da2b1223af0446bb3c05416" name = "github.com/ChrisTrenkamp/goxpath" packages = [ ".", @@ -24,53 +27,69 @@ "tree/xmltree/xmlbuilder", "tree/xmltree/xmlele", "tree/xmltree/xmlnode", - "xconst" + "xconst", ] + pruneopts = "UT" revision = "c385f95c6022e7756e91beac5f5510872f7dcb7d" [[projects]] + digest = "1:12d4bc32014d9755850a247c43981d4b616f99c94f86247df2d6187511bfad8b" name = "github.com/dylanmei/iso8601" packages = ["."] + pruneopts = "UT" revision = "2075bf119b58e5576c6ed9f867b8f3d17f2e54d4" version = "v0.1.0" [[projects]] branch = "master" + digest = "1:07671f8997086ed115824d1974507d2b147d1e0463675ea5dbf3be89b1c2c563" name = "github.com/hashicorp/errwrap" packages = ["."] + pruneopts = "UT" revision = "7554cd9344cec97297fa6649b055a8c98c2a1e55" [[projects]] branch = "master" + digest = "1:075de3352ee3366e02ab1547a3a6d9149d9fc85419212deb126baee9976a4dc5" name = "github.com/hashicorp/go-checkpoint" packages = ["."] + pruneopts = "UT" revision = "1545e56e46dec3bba264e41fde2c1e2aa65b5dd4" [[projects]] branch = "master" + digest = "1:77cb3be9b21ba7f1a4701e870c84ea8b66e7d74c7c8951c58155fdadae9414ec" name = "github.com/hashicorp/go-cleanhttp" packages = ["."] + pruneopts = "UT" revision = "d5fe4b57a186c716b0e00b8c301cbd9b4182694d" [[projects]] branch = "master" + digest = "1:e5048c5da80697be2fcdecc944e29d2999e01fd7f48b643168443209779f3463" name = "github.com/hashicorp/go-multierror" packages = ["."] + pruneopts = "UT" revision = "b7773ae218740a7be65057fc60b366a49b538a44" [[projects]] branch = "master" + digest = "1:354978aad16c56c27f57e5b152224806d87902e4935da3b03e18263d82ae77aa" name = "github.com/hashicorp/go-uuid" packages = ["."] + pruneopts = "UT" revision = "27454136f0364f2d44b1276c552d69105cf8c498" [[projects]] branch = "master" + digest = "1:e12b92b8bb20af6e299e9829534cfe790857702a988d3f0443e772c9d82a4fd2" name = "github.com/hashicorp/go-version" packages = ["."] + pruneopts = "UT" revision = "23480c0665776210b5fbbac6eaaee40e3e6a96b7" [[projects]] + digest = "1:4d5ecc41a01235e1e6e09b624d755b928095c79cee57c72d17b503b730b7e82a" name = "github.com/hashicorp/packer" packages = [ "common", @@ -90,104 +109,134 @@ "packer/rpc", "template", "template/interpolate", - "version" + "version", ] + pruneopts = "UT" revision = "b4df69af04373ef28caef3601befcaec1f909216" version = "v1.2.3" [[projects]] branch = "master" + digest = "1:6074024c54115955afc83ee5064367523bbc55e4eb0e9cf145e43c9c0371918c" name = "github.com/hashicorp/yamux" packages = ["."] + pruneopts = "UT" revision = "2658be15c5f05e76244154714161f17e3e77de2e" [[projects]] + digest = "1:9cedee824c21326bd26950bd9e1ffe9dc4e7ca03dc8634d0e6f954ee6a383172" name = "github.com/kr/fs" packages = ["."] + pruneopts = "UT" revision = "1455def202f6e05b95cc7bfc7e8ae67ae5141eba" version = "v0.1.0" [[projects]] branch = "master" + digest = "1:2773a3d38a10f76a8ac624d50b8d6d42ab3e50224841e3c225b4aee2dc4921ba" name = "github.com/masterzen/azure-sdk-for-go" packages = [ "core/http", - "core/tls" + "core/tls", ] + pruneopts = "UT" revision = "ee4f0065d00cd12b542f18f5bc45799e88163b12" [[projects]] branch = "master" + digest = "1:a7c1ab68a6cdeffcb148dc0d8b92c897f034aa38f58b69eab9bc6e77645b26fb" name = "github.com/masterzen/simplexml" packages = ["dom"] + pruneopts = "UT" revision = "4572e39b1ab9fe03ee513ce6fc7e289e98482190" [[projects]] branch = "master" + digest = "1:21990ab65086d054855aea2761ff39033a4dc083e4c4b6cb4ba1601fbf3fe91a" name = "github.com/masterzen/winrm" packages = [ ".", - "soap" + "soap", ] + pruneopts = "UT" revision = "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb" [[projects]] branch = "master" + digest = "1:81ffc98d4d2eff80630938db171f5b8936959cd8cefdbf2d22b2f4924aa953dc" name = "github.com/mitchellh/go-fs" packages = [ ".", - "fat" + "fat", ] + pruneopts = "UT" revision = "b7b9ca407ffff465de12fc37ccbb81ea8b428c43" [[projects]] branch = "master" + digest = "1:041bb70411ef6945901c63cab3bfd6a1a1de88352359ad0e6e1e86478a53d0ec" name = "github.com/mitchellh/iochan" packages = ["."] + pruneopts = "UT" revision = "87b45ffd0e9581375c491fef3d32130bb15c5bd7" [[projects]] branch = "master" + digest = "1:e730597b38a4d56e2361e0b6236cb800e52c73cace2ff91396f4ff35792ddfa7" name = "github.com/mitchellh/mapstructure" packages = ["."] + pruneopts = "UT" revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b" [[projects]] branch = "master" + digest = "1:012bcbda750df8b57e302656a0820833eaa98009a7546b22620283c65996743b" name = "github.com/mitchellh/reflectwalk" packages = ["."] + pruneopts = "UT" revision = "63d60e9d0dbc60cf9164e6510889b0db6683d98c" [[projects]] branch = "master" + digest = "1:0e1e5f960c58fdc677212fcc70e55042a0084d367623e51afbdb568963832f5d" name = "github.com/nu7hatch/gouuid" packages = ["."] + pruneopts = "UT" revision = "179d4d0c4d8d407a32af483c2354df1d2c91e6c3" [[projects]] branch = "master" + digest = "1:b001460ea94194a5d9961274289ff5b64af7eeb724c474ce6188a4eb33bd2a0f" name = "github.com/packer-community/winrmcp" packages = ["winrmcp"] + pruneopts = "UT" revision = "81144009af586de8e7729b829266f09dd0d59701" [[projects]] + digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747" name = "github.com/pkg/errors" packages = ["."] + pruneopts = "UT" revision = "645ef00459ed84a119197bfb8d8205042c6df63d" version = "v0.8.0" [[projects]] + digest = "1:c3f75b2d37dbd9173203874d4767ca7241645a74a74d9bb3d0913dc15758a699" name = "github.com/pkg/sftp" packages = ["."] + pruneopts = "UT" revision = "d2aa419835609d317c34baae11bc345d1f9971a7" version = "1.7.0" [[projects]] + digest = "1:48b859865fccf8a7f171535e1b9f4803057697e72aeab7f762b65fabd1ab5aa0" name = "github.com/ugorji/go" packages = ["codec"] + pruneopts = "UT" revision = "646ae4a518c1c3be0739df898118d9bccf993858" [[projects]] + digest = "1:aaab3a195b3d3713097c6e02f2681fea299f9ae6d8fb0e8da095f3983ae6e86b" name = "github.com/vmware/govmomi" packages = [ ".", @@ -205,13 +254,15 @@ "vim25/progress", "vim25/soap", "vim25/types", - "vim25/xml" + "vim25/xml", ] + pruneopts = "UT" revision = "123ed177021588bac57b5c87c1a84270ddf2eca8" version = "v0.17.1" [[projects]] branch = "master" + digest = "1:44a0ce1659d8e5c7f794588d1fe1fe22aad10e0ff1304f5b4c16bba5013efec3" name = "golang.org/x/crypto" packages = [ "curve25519", @@ -221,29 +272,35 @@ "md4", "poly1305", "ssh", - "ssh/agent" + "ssh/agent", ] + pruneopts = "UT" revision = "2d027ae1dddd4694d54f7a8b6cbe78dca8720226" [[projects]] branch = "master" + digest = "1:59d8417bed34c76b8767308835b267be5e2a5fe5b5b497194ef7c9196ce4b7ab" name = "golang.org/x/mobile" packages = ["event/key"] + pruneopts = "UT" revision = "274da161099df258cb919e10e9fd0ae401e143a8" [[projects]] branch = "master" + digest = "1:88726c7424216b880a2c2f715579628ba2a7ea23612109a1d5b0f11cdbce8942" name = "golang.org/x/net" packages = [ "html", "html/atom", "html/charset", "internal/socks", - "proxy" + "proxy", ] + pruneopts = "UT" revision = "2491c5de3490fced2f6cff376127c667efeed857" [[projects]] + digest = "1:aa4d6967a3237f8367b6bf91503964a77183ecf696f1273e8ad3551bb4412b5f" name = "golang.org/x/text" packages = [ "encoding", @@ -262,14 +319,36 @@ "language", "runes", "transform", - "unicode/cldr" + "unicode/cldr", ] + pruneopts = "UT" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" version = "v0.3.0" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "9f89755514c7933bbbdc65648a5a6058d1387bc47aa717bae8772c9f7037a542" + input-imports = [ + "github.com/hashicorp/packer/common", + "github.com/hashicorp/packer/communicator/ssh", + "github.com/hashicorp/packer/helper/builder/testing", + "github.com/hashicorp/packer/helper/communicator", + "github.com/hashicorp/packer/helper/config", + "github.com/hashicorp/packer/helper/multistep", + "github.com/hashicorp/packer/packer", + "github.com/hashicorp/packer/packer/plugin", + "github.com/hashicorp/packer/template/interpolate", + "github.com/vmware/govmomi", + "github.com/vmware/govmomi/find", + "github.com/vmware/govmomi/object", + "github.com/vmware/govmomi/session", + "github.com/vmware/govmomi/vim25", + "github.com/vmware/govmomi/vim25/methods", + "github.com/vmware/govmomi/vim25/mo", + "github.com/vmware/govmomi/vim25/soap", + "github.com/vmware/govmomi/vim25/types", + "golang.org/x/crypto/ssh", + "golang.org/x/mobile/event/key", + ] solver-name = "gps-cdcl" solver-version = 1 From a3002d23bc1365d079c6d09c808836f73e645f6c Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 16 Oct 2018 18:59:51 +0300 Subject: [PATCH 179/266] Fix default CPU limit (#163) --- driver/vm.go | 4 +++- iso/builder_acc_test.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/driver/vm.go b/driver/vm.go index e896a65cc..5e253311f 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -255,7 +255,9 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { var cpuSpec types.ResourceAllocationInfo cpuSpec.Reservation = &config.CPUReservation - cpuSpec.Limit = &config.CPULimit + if config.CPULimit != 0 { + cpuSpec.Limit = &config.CPULimit + } confSpec.CpuAllocation = &cpuSpec var ramSpec types.ResourceAllocationInfo diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 288780a09..5f4c6de89 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -159,6 +159,40 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { } } +func TestISOBuilderAcc_limit(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: limitConfig(), + Check: checkLimit(t), + }) +} + +func limitConfig() string { + config := defaultConfig() + config["CPUs"] = 1 // hardware is customized, but CPU limit is not specified explicitly + + return commonT.RenderConfig(config) +} + +func checkLimit(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + + vm := commonT.GetVM(t, d, artifacts) + vmInfo, err := vm.Info("config.cpuAllocation") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + limit := *vmInfo.Config.CpuAllocation.Limit + if limit != -1 { // must be unlimited + t.Errorf("Invalid CPU limit: expected '%v', got '%v'", -1, limit) + } + + return nil + } +} + func TestISOBuilderAcc_cdrom(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, From 0b5e6d1046f03daa8232862939e702b49b444762 Mon Sep 17 00:00:00 2001 From: John O'Connor <jcoconnor@users.noreply.github.com> Date: Wed, 17 Oct 2018 00:42:02 +0100 Subject: [PATCH 180/266] Add firmware option (#156) Add "firmware" as an option for the hardware section, allowing values of "efi" or "bios" (default "bios") so that the firmware is defined at the machine create stage. --- README.md | 1 + driver/vm.go | 2 ++ iso/step_create.go | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 6ca2579d4..eab8ef553 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `network`(string) - Set network VM will be connected to. * `network_card`(string) - Set VM network card type. Example `vmxnet3`. * `usb_controller`(boolean) - Create USB controller for virtual machine. Defaults to `false`. +* `firmware`(string) - Set the Firmware at machine creation. Example `efi`. Defaults to `bios` ### Boot (`vsphere-iso` only) diff --git a/driver/vm.go b/driver/vm.go index 5e253311f..0171ac606 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -55,6 +55,7 @@ type CreateConfig struct { NetworkCard string // example: vmxnet3 USBController bool Version uint // example: 10 + Firmware string // efi or bios } func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine { @@ -80,6 +81,7 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { Name: config.Name, Annotation: config.Annotation, GuestId: config.GuestOS, + Firmware: config.Firmware, } if config.Version != 0 { createSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version) diff --git a/iso/step_create.go b/iso/step_create.go index f9e2f9207..5a23bd535 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -12,6 +12,7 @@ import ( type CreateConfig struct { Version uint `mapstructure:"vm_version"` GuestOSType string `mapstructure:"guest_os_type"` + Firmware string `mapstructure:"firmware"` DiskControllerType string `mapstructure:"disk_controller_type"` DiskSize int64 `mapstructure:"disk_size"` @@ -33,6 +34,10 @@ func (c *CreateConfig) Prepare() []error { c.GuestOSType = "otherGuest" } + if (c.Firmware == "") { + c.Firmware = "bios" + } + return errs } @@ -61,6 +66,7 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste NetworkCard: s.Config.NetworkCard, USBController: s.Config.USBController, Version: s.Config.Version, + Firmware: s.Config.Firmware, }) if err != nil { state.Put("error", fmt.Errorf("error creating vm: %v", err)) From 9358f4e91a92a330e07a9ef9be204052d51108de Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 17 Oct 2018 02:15:27 +0300 Subject: [PATCH 181/266] firmware: validation & tests --- driver/vm.go | 4 +++- iso/builder_acc_test.go | 13 ++++++++++++- iso/step_create.go | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 0171ac606..690d40869 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -81,11 +81,13 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { Name: config.Name, Annotation: config.Annotation, GuestId: config.GuestOS, - Firmware: config.Firmware, } if config.Version != 0 { createSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version) } + if config.Firmware != "" { + createSpec.Firmware = config.Firmware + } folder, err := d.FindFolder(config.Folder) if err != nil { diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 5f4c6de89..6d2ceec6a 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -45,7 +45,7 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil d := commonT.TestConn(t) vm := commonT.GetVM(t, d, artifacts) - vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk") + vmInfo, err := vm.Info("name", "parent", "runtime.host", "resourcePool", "datastore", "layoutEx.disk", "config.firmware") if err != nil { t.Fatalf("Cannot read VM properties: %v", err) } @@ -91,6 +91,11 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil t.Errorf("Invalid datastore name: expected '%v', got '%v'", datastore, dsInfo.Name) } + fw := vmInfo.Config.Firmware + if fw != "bios" { + t.Errorf("Invalid firmware: expected 'bios', got '%v'", fw) + } + return nil } } @@ -111,6 +116,7 @@ func hardwareConfig() string { config["RAM"] = 2048 config["RAM_reservation"] = 1024 config["NestedHV"] = true + config["firmware"] = "efi" return commonT.RenderConfig(config) } @@ -155,6 +161,11 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have NestedHV enabled, got %v", nestedHV) } + fw := vmInfo.Config.Firmware + if fw != "efi" { + t.Errorf("Invalid firmware: expected 'efi', got '%v'", fw) + } + return nil } } diff --git a/iso/step_create.go b/iso/step_create.go index 5a23bd535..39d448b55 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -34,8 +34,8 @@ func (c *CreateConfig) Prepare() []error { c.GuestOSType = "otherGuest" } - if (c.Firmware == "") { - c.Firmware = "bios" + if (c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi") { + errs = append(errs, fmt.Errorf("'firmware' must be 'bios' or 'efi'")) } return errs From 4e5d2bfcffda28b9331ec31e16ed9f6607523ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= <remijouannet@gmail.com> Date: Wed, 17 Oct 2018 02:15:01 +0200 Subject: [PATCH 182/266] add build instructions (#165) --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index eab8ef553..2e0eec43f 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,19 @@ This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSp * Download binaries from the [releases page](https://github.com/jetbrains-infra/packer-builder-vsphere/releases). * [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugins, or simply put them into the same directory with JSON templates. On Linux and macOS run `chmod +x` on the files. +## Build + +Install Go and [dep](https://github.com/golang/dep/releases), run `build.sh`. + +Or build inside a container by Docker Compose: +``` +docker-compose run build +``` + +The binaries will be in `bin/` directory. + +Artifacts can be also downloaded from [TeamCity builds](https://teamcity.jetbrains.com/viewLog.html?buildTypeId=PackerVSphere_Build&buildId=lastSuccessful&tab=artifacts). + ## Examples See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/jetbrains-infra/packer-builder-vsphere/tree/master/examples/). From b568c5d67a59dd687f3ce1059d106e8ad2a0fdf2 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Tue, 16 Oct 2018 20:05:21 +0300 Subject: [PATCH 183/266] build by Go 1.10.4 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 791a97113..7f428cbed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: '2' services: build: - image: jetbrainsinfra/golang:1.10.0 + image: jetbrainsinfra/golang:1.10.4 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere command: ./build.sh test: - image: jetbrainsinfra/golang:1.10.0 + image: jetbrainsinfra/golang:1.10.4 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere From 844be7e107d2f9d44d09a6ee68b2507fb066f120 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Wed, 17 Oct 2018 15:42:42 +0300 Subject: [PATCH 184/266] Update hashicorp/yamux dependency They deleted a commit in master https://github.com/hashicorp/yamux/issues/65 --- .gitignore | 1 + Gopkg.lock | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ecf9eb819..6e24c349e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ vendor/ +.vendor-new/ packer-builder-vsphere* bin/ test*.json diff --git a/Gopkg.lock b/Gopkg.lock index 0e643fc79..85de2aa8f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -117,11 +117,11 @@ [[projects]] branch = "master" - digest = "1:6074024c54115955afc83ee5064367523bbc55e4eb0e9cf145e43c9c0371918c" + digest = "1:a4826c308e84f5f161b90b54a814f0be7d112b80164b9b884698a6903ea47ab3" name = "github.com/hashicorp/yamux" packages = ["."] pruneopts = "UT" - revision = "2658be15c5f05e76244154714161f17e3e77de2e" + revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" [[projects]] digest = "1:9cedee824c21326bd26950bd9e1ffe9dc4e7ca03dc8634d0e6f954ee6a383172" From e4f6d5d691015be0671c40514bea5241ef8f8600 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Wed, 17 Oct 2018 13:11:37 +0300 Subject: [PATCH 185/266] fix VPN connection --- test/lab.ovpn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/lab.ovpn b/test/lab.ovpn index 313d027f5..d96898ef2 100644 --- a/test/lab.ovpn +++ b/test/lab.ovpn @@ -7,7 +7,8 @@ auth SHA1 tls-client client resolv-retry infinite -remote 81.3.129.9 2000 tcp-client +remote 81.3.129.25 2000 tcp-client +remote 80.76.244.125 2000 tcp-client remote-cert-tls server pkcs12 lab.p12 From af6db0ff2dec9bb3544852b541ab3bd0fd08e1f5 Mon Sep 17 00:00:00 2001 From: Konstantin Toshchev <konst.toshchev@protonmail.com> Date: Thu, 18 Oct 2018 16:43:17 +0300 Subject: [PATCH 186/266] Deleting floppy images on teardown (#159) --- iso/step_add_floppy.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index f03511452..46974a087 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -67,4 +67,30 @@ func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multist return multistep.ActionContinue } -func (s *StepAddFloppy) Cleanup(state multistep.StateBag) {} +func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { + _, cancelled := state.GetOk(multistep.StateCancelled) + _, halted := state.GetOk(multistep.StateHalted) + if !cancelled && !halted { + return + } + + ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*driver.Driver) + + if UploadedFloppyPath, ok := state.GetOk("uploaded_floppy_path"); ok { + ui.Say("Deleting Floppy image ...") + + ds, err := d.FindDatastore(s.Datastore, s.Host) + if err != nil { + state.Put("error", err) + return + } + + err_del := ds.Delete(UploadedFloppyPath.(string)) + if err_del != nil { + state.Put("error", err) + return + } + + } +} From 4eec7df10a51d9955208472b494b2b19ec52cf37 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 19 Oct 2018 13:59:05 +0300 Subject: [PATCH 187/266] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e0eec43f..f7af0703b 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### Provision -* `communicator` - `ssh` (default), `winrm`, or `none`. +* `communicator` - `ssh` (default), `winrm`, or `none` (create/clone, customize hardware, but do not boot). * `ssh_username`(string) - Username in guest OS. * `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. From 912aec563c8c1922404a8075d9a416677f3c3f9a Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 21 Oct 2018 03:57:28 +0300 Subject: [PATCH 188/266] iso builder clears boot order at finish (#172) --- clone/builder.go | 1 + clone/builder_acc_test.go | 58 +++++++++++++++++++ common/step_run.go | 31 ++++++---- iso/builder.go | 1 + iso/builder_acc_test.go | 118 ++++++++++++++++++++++++++++++++++++-- iso/config.go | 1 - iso/preseed.cfg | 16 ++++++ test.sh | 2 +- 8 files changed, 210 insertions(+), 18 deletions(-) create mode 100644 iso/preseed.cfg diff --git a/clone/builder.go b/clone/builder.go index 2d2c1b585..d0daf470f 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -52,6 +52,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe steps = append(steps, &common.StepRun{ Config: &b.config.RunConfig, + SetOrder: false, }, &common.StepWaitForIp{}, &communicator.StepConnect{ diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 8ce956bd5..652f9634a 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -419,6 +419,7 @@ func TestCloneBuilderAcc_sshPassword(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: sshPasswordConfig(), + Check: checkDefaultBootOrder(t), }) } @@ -430,6 +431,25 @@ func sshPasswordConfig() string { return commonT.RenderConfig(config) } +func checkDefaultBootOrder(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("config.bootOptions") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + order := vmInfo.Config.BootOptions.BootOrder + if order != nil { + t.Errorf("Boot order must be empty") + } + + return nil + } +} + func TestCloneBuilderAcc_sshKey(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -510,3 +530,41 @@ func checkTemplate(t *testing.T) builderT.TestCheckFunc { return nil } } + +func TestCloneBuilderAcc_bootOrder(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: bootOrderConfig(), + Check: checkBootOrder(t), + }) +} + +func bootOrderConfig() string { + config := defaultConfig() + config["communicator"] = "ssh" + config["ssh_username"] = "root" + config["ssh_password"] = "jetbrains" + + config["boot_order"] = "disk,cdrom,floppy" + + return commonT.RenderConfig(config) +} + +func checkBootOrder(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("config.bootOptions") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + order := vmInfo.Config.BootOptions.BootOrder + if order == nil { + t.Errorf("Boot order must not be empty") + } + + return nil + } +} diff --git a/common/step_run.go b/common/step_run.go index 82ba99f37..1f1ef57de 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -12,16 +12,9 @@ type RunConfig struct { BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" } -func (c *RunConfig) Prepare() []error { - if c.BootOrder == "" { - c.BootOrder = "disk,cdrom" - } - - return nil -} - type StepRun struct { Config *RunConfig + SetOrder bool } func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { @@ -35,6 +28,14 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste state.Put("error", err) return multistep.ActionHalt } + } else { + if s.SetOrder { + ui.Say("Set boot order temporary...") + if err := vm.SetBootOrder([]string{"disk", "cdrom"}); err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + } } ui.Say("Power on VM...") @@ -48,15 +49,23 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste } func (s *StepRun) Cleanup(state multistep.StateBag) { + ui := state.Get("ui").(packer.Ui) + vm := state.Get("vm").(*driver.VirtualMachine) + + if s.Config.BootOrder == "" && s.SetOrder { + ui.Say("Clear boot order...") + if err := vm.SetBootOrder([]string{"-"}); err != nil { + state.Put("error", err) + return + } + } + _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) if !cancelled && !halted { return } - ui := state.Get("ui").(packer.Ui) - vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Power off VM...") err := vm.PowerOff() diff --git a/iso/builder.go b/iso/builder.go index 04e253534..556c98539 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -64,6 +64,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &common.StepRun{ Config: &b.config.RunConfig, + SetOrder: true, }, &StepBootCommand{ Config: &b.config.BootConfig, diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 6d2ceec6a..1a7b15f7a 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -1,13 +1,13 @@ package iso import ( - builderT "github.com/hashicorp/packer/helper/builder/testing" - commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" - "testing" - "github.com/hashicorp/packer/packer" - "github.com/vmware/govmomi/vim25/types" "fmt" + builderT "github.com/hashicorp/packer/helper/builder/testing" + "github.com/hashicorp/packer/packer" + commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" + "github.com/vmware/govmomi/vim25/types" "io/ioutil" + "testing" ) func TestISOBuilderAcc_default(t *testing.T) { @@ -278,3 +278,111 @@ func createFloppyConfig(filePath string) string { config["floppy_files"] = []string{filePath} return commonT.RenderConfig(config) } + +func TestISOBuilderAcc_full(t *testing.T) { + config := fullConfig() + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: commonT.RenderConfig(config), + Check: checkFull(t), + }) +} + +func fullConfig() map[string]interface{} { + config := map[string]interface{}{ + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": true, + + "vm_name": commonT.NewVMName(), + "host": "esxi-1.vsphere65.test", + + "RAM": 1024, + "disk_controller_type": "pvscsi", + "disk_size": 4096, + "disk_thin_provisioned": true, + "network_card": "vmxnet3", + "guest_os_type": "ubuntu64Guest", + + "iso_paths": []string{ + "[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso", + }, + "floppy_files": []string{ + "preseed.cfg", + }, + + "boot_command": []string{ + "<enter><wait><f6><wait><esc><wait>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", + "<bs><bs><bs>", + "/install/vmlinuz", + " initrd=/install/initrd.gz", + " priority=critical", + " locale=en_US", + " file=/media/preseed.cfg", + "<enter>", + }, + + "ssh_username": "jetbrains", + "ssh_password": "jetbrains", + } + + return config +} + +func checkFull(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("config.bootOptions") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + order := vmInfo.Config.BootOptions.BootOrder + if order != nil { + t.Errorf("Boot order must be empty") + } + + return nil + } +} + +func TestISOBuilderAcc_bootOrder(t *testing.T) { + config := fullConfig() + config["boot_order"] = "disk,cdrom,floppy" + + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: commonT.RenderConfig(config), + Check: checkBootOrder(t), + }) +} + +func checkBootOrder(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("config.bootOptions") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + order := vmInfo.Config.BootOptions.BootOrder + if order == nil { + t.Errorf("Boot order must not be empty") + } + + return nil + } +} diff --git a/iso/config.go b/iso/config.go index ec522bb2b..a995767ff 100644 --- a/iso/config.go +++ b/iso/config.go @@ -47,7 +47,6 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) - errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) diff --git a/iso/preseed.cfg b/iso/preseed.cfg new file mode 100644 index 000000000..ec963b6b2 --- /dev/null +++ b/iso/preseed.cfg @@ -0,0 +1,16 @@ +d-i passwd/user-fullname string jetbrains +d-i passwd/username string jetbrains +d-i passwd/user-password password jetbrains +d-i passwd/user-password-again password jetbrains +d-i user-setup/allow-password-weak boolean true + +d-i partman-auto/disk string /dev/sda +d-i partman-auto/method string regular +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i pkgsel/include string open-vm-tools openssh-server + +d-i finish-install/reboot_in_progress note diff --git a/test.sh b/test.sh index 48d55a97c..4df8d7782 100755 --- a/test.sh +++ b/test.sh @@ -4,4 +4,4 @@ set -eux export PACKER_ACC=1 -go test -v ./driver ./iso ./clone +go test -v -count 1 -timeout 20m ./driver ./iso ./clone From 75cabff27809221b4bc12888e95b92066566e751 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sun, 21 Oct 2018 10:47:35 +0300 Subject: [PATCH 189/266] Eject CD-ROM images, don't delete devices (#173) --- driver/vm_cdrom.go | 19 +++++++++++++++++++ iso/builder_acc_test.go | 12 ++++++++++++ iso/step_remove_cdrom.go | 17 ++--------------- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/driver/vm_cdrom.go b/driver/vm_cdrom.go index 0ce45a34c..e0a155eea 100644 --- a/driver/vm_cdrom.go +++ b/driver/vm_cdrom.go @@ -46,3 +46,22 @@ func (vm *VirtualMachine) CreateCdrom(c *types.VirtualAHCIController) (*types.Vi return device, nil } + +func (vm *VirtualMachine) EjectCdroms() error { + devices, err := vm.Devices() + if err != nil { + return err + } + cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) + for _, cd := range cdroms { + c := cd.(*types.VirtualCdrom) + c.Backing = &types.VirtualCdromRemotePassthroughBackingInfo{} + c.Connectable = &types.VirtualDeviceConnectInfo{} + err := vm.vm.EditDevice(vm.driver.ctx, c) + if err != nil { + return err + } + } + + return nil +} diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 1a7b15f7a..4ba61f658 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -353,6 +353,18 @@ func checkFull(t *testing.T) builderT.TestCheckFunc { t.Errorf("Boot order must be empty") } + devices, err := vm.Devices() + if err != nil { + t.Fatalf("Cannot read devices: %v", err) + } + cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) + for _, cd := range cdroms { + _, ok := cd.(*types.VirtualCdrom).Backing.(*types.VirtualCdromRemotePassthroughBackingInfo) + if !ok { + t.Errorf("wrong cdrom backing") + } + } + return nil } } diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index 4d41811b2..380db9e59 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -4,7 +4,6 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/hashicorp/packer/helper/multistep" - "github.com/vmware/govmomi/vim25/types" "context" ) @@ -14,24 +13,12 @@ func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multi ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Deleting CD-ROM drives...") - devices, err := vm.Devices() + ui.Say("Eject CD-ROM drives...") + err := vm.EjectCdroms() if err != nil { state.Put("error", err) return multistep.ActionHalt } - cdroms := devices.SelectByType((*types.VirtualCdrom)(nil)) - if err = vm.RemoveDevice(true, cdroms...); err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - - ui.Say("Deleting SATA controller...") - sata := devices.SelectByType((*types.VirtualAHCIController)(nil)) - if err = vm.RemoveDevice(true, sata...); err != nil { - state.Put("error", err) - return multistep.ActionHalt - } return multistep.ActionContinue } From ebcd6174d41c953bdb09df4ce069dbd216eaefcd Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 30 Oct 2018 03:18:57 +0300 Subject: [PATCH 190/266] Optionally use SATA controller for CD-ROM devices (#174) --- driver/vm.go | 27 ++++++++++++------- driver/vm_cdrom.go | 2 +- examples/macos/macos-10.13.json | 1 + iso/builder.go | 8 +++--- iso/builder_acc_test.go | 48 +++++++++++++++++++++++++++++++++ iso/config.go | 1 + iso/step_add_cdrom.go | 26 +++++++++++++----- 7 files changed, 92 insertions(+), 21 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 690d40869..5214b6d14 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -115,10 +115,6 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { devices := object.VirtualDeviceList{} - devices, err = addIDE(devices) - if err != nil { - return nil, err - } devices, err = addDisk(d, devices, config) if err != nil { return nil, err @@ -477,23 +473,34 @@ func addIDE(devices object.VirtualDeviceList) (object.VirtualDeviceList, error) return devices, nil } -func (vm *VirtualMachine) AddCdrom(isoPath string) error { +func (vm *VirtualMachine) AddCdrom(controllerType string, isoPath string) error { devices, err := vm.vm.Device(vm.driver.ctx) if err != nil { return err } - sata, err := vm.FindSATAController() - if err != nil { - return err + + var controller *types.VirtualController + if controllerType == "sata" { + c, err := vm.FindSATAController() + if err != nil { + return err + } + controller = c.GetVirtualController() + } else { + c, err := devices.FindIDEController("") + if err != nil { + return err + } + controller = c.GetVirtualController() } - cdrom, err := vm.CreateCdrom(sata) + cdrom, err := vm.CreateCdrom(controller) if err != nil { return err } if isoPath != "" { - cdrom = devices.InsertIso(cdrom, isoPath) + devices.InsertIso(cdrom, isoPath) } return vm.addDevice(cdrom) diff --git a/driver/vm_cdrom.go b/driver/vm_cdrom.go index e0a155eea..2dfc65af1 100644 --- a/driver/vm_cdrom.go +++ b/driver/vm_cdrom.go @@ -24,7 +24,7 @@ func (vm *VirtualMachine) FindSATAController() (*types.VirtualAHCIController, er return c.(*types.VirtualAHCIController), nil } -func (vm *VirtualMachine) CreateCdrom(c *types.VirtualAHCIController) (*types.VirtualCdrom, error) { +func (vm *VirtualMachine) CreateCdrom(c *types.VirtualController) (*types.VirtualCdrom, error) { l, err := vm.Devices() if err != nil { return nil, err diff --git a/examples/macos/macos-10.13.json b/examples/macos/macos-10.13.json index eea54280f..779834a7e 100644 --- a/examples/macos/macos-10.13.json +++ b/examples/macos/macos-10.13.json @@ -26,6 +26,7 @@ "ich7m.present": "TRUE", "smc.present": "TRUE" }, + "cdrom_type": "sata", "iso_paths": [ "[datastore-mac] ISO/macOS 10.13.3.iso", diff --git a/iso/builder.go b/iso/builder.go index 556c98539..9b6aa9fe2 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -43,6 +43,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepConfigureHardware{ Config: &b.config.HardwareConfig, }, + &StepAddCDRom{ + Config: &b.config.CDRomConfig, + }, &common.StepConfigParams{ Config: &b.config.ConfigParamsConfig, }, @@ -50,9 +53,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.Comm.Type != "none" { steps = append(steps, - &StepAddCDRom{ - Config: &b.config.CDRomConfig, - }, &packerCommon.StepCreateFloppy{ Files: b.config.FloppyFiles, Directories: b.config.FloppyDirectories, @@ -79,7 +79,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepShutdown{ Config: &b.config.ShutdownConfig, }, - &StepRemoveCDRom{}, &StepRemoveFloppy{ Datastore: b.config.Datastore, Host: b.config.Host, @@ -88,6 +87,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } steps = append(steps, + &StepRemoveCDRom{}, &common.StepCreateSnapshot{ CreateSnapshot: b.config.CreateSnapshot, }, diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 4ba61f658..eb84e587b 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -166,6 +166,19 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("Invalid firmware: expected 'efi', got '%v'", fw) } + l, err := vm.Devices() + if err != nil { + t.Fatalf("Cannot read VM devices: %v", err) + } + c := l.PickController((*types.VirtualIDEController)(nil)) + if c == nil { + t.Errorf("VM should have IDE controller") + } + s := l.PickController((*types.VirtualAHCIController)(nil)) + if s != nil { + t.Errorf("VM should have no SATA controllers") + } + return nil } } @@ -204,6 +217,41 @@ func checkLimit(t *testing.T) builderT.TestCheckFunc { } } +func TestISOBuilderAcc_sata(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: sataConfig(), + Check: checkSata(t), + }) +} + +func sataConfig() string { + config := defaultConfig() + config["cdrom_type"] = "sata" + + return commonT.RenderConfig(config) +} + +func checkSata(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + + vm := commonT.GetVM(t, d, artifacts) + + l, err := vm.Devices() + if err != nil { + t.Fatalf("Cannot read VM devices: %v", err) + } + + c := l.PickController((*types.VirtualAHCIController)(nil)) + if c == nil { + t.Errorf("VM has no SATA controllers") + } + + return nil + } +} + func TestISOBuilderAcc_cdrom(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/iso/config.go b/iso/config.go index a995767ff..0cc2c3bdf 100644 --- a/iso/config.go +++ b/iso/config.go @@ -47,6 +47,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.CDRomConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 60819a198..97633fd4b 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -9,6 +9,7 @@ import ( ) type CDRomConfig struct { + CdromType string `mapstructure:"cdrom_type"` ISOPaths []string `mapstructure:"iso_paths"` } @@ -16,19 +17,32 @@ type StepAddCDRom struct { Config *CDRomConfig } +func (c *CDRomConfig) Prepare() []error { + var errs []error + + if (c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata") { + errs = append(errs, fmt.Errorf("'cdrom_type' must be 'ide' or 'sata'")) + } + + return errs +} + func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Adding CD-ROM drives...") - if err := vm.AddSATAController(); err != nil { - state.Put("error", fmt.Errorf("error adding SATA controller: %v", err)) - return multistep.ActionHalt + if s.Config.CdromType == "sata" { + ui.Say("Adding SATA controller...") + if err := vm.AddSATAController(); err != nil { + state.Put("error", fmt.Errorf("error adding SATA controller: %v", err)) + return multistep.ActionHalt + } } + ui.Say("Mount ISO images...") for _, path := range s.Config.ISOPaths { - if err := vm.AddCdrom(path); err != nil { - state.Put("error", fmt.Errorf("error adding a cdrom: %v", err)) + if err := vm.AddCdrom(s.Config.CdromType, path); err != nil { + state.Put("error", fmt.Errorf("error mounting an image: %v", err)) return multistep.ActionHalt } } From d7fcff025f13c97db6634f9a15f496361c394d1e Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 31 Oct 2018 23:51:20 +0300 Subject: [PATCH 191/266] detect default network per host (#180) --- driver/vm.go | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 5214b6d14..3923cb081 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -445,9 +445,29 @@ func addDisk(_ *Driver, devices object.VirtualDeviceList, config *CreateConfig) } func addNetwork(d *Driver, devices object.VirtualDeviceList, config *CreateConfig) (object.VirtualDeviceList, error) { - network, err := d.finder.NetworkOrDefault(d.ctx, config.Network) - if err != nil { - return nil, err + var network object.NetworkReference + if config.Network == "" { + h, err := d.FindHost(config.Host) + if err != nil { + return nil, err + } + + i, err := h.Info("network") + if err != nil { + return nil, err + } + + if len(i.Network) > 1 { + return nil, fmt.Errorf("Host has multiple networks. Specify it explicitly") + } + + network = object.NewNetwork(d.client.Client, i.Network[0]) + } else { + var err error + network, err = d.finder.Network(d.ctx, config.Network) + if err != nil { + return nil, err + } } backing, err := network.EthernetCardBackingInfo(d.ctx) From 43ee099ee7576e10613db40a188bd980acb4520f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 31 Oct 2018 01:10:57 +0300 Subject: [PATCH 192/266] pass vSphere credentials to tests --- clone/builder_acc_test.go | 14 ++++++++++++-- driver/driver_test.go | 14 ++++++++++++-- iso/builder_acc_test.go | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 652f9634a..8452692af 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -3,6 +3,7 @@ package clone import ( builderT "github.com/hashicorp/packer/helper/builder/testing" commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" + "os" "github.com/hashicorp/packer/packer" "testing" @@ -19,10 +20,19 @@ func TestCloneBuilderAcc_default(t *testing.T) { } func defaultConfig() map[string]interface{} { + username := os.Getenv("VSPHERE_USERNAME") + if username == "" { + username = "root" + } + password := os.Getenv("VSPHERE_PASSWORD") + if password == "" { + password = "jetbrains" + } + config := map[string]interface{}{ "vcenter_server": "vcenter.vsphere65.test", - "username": "root", - "password": "jetbrains", + "username": username, + "password": password, "insecure_connection": true, "template": "alpine", diff --git a/driver/driver_test.go b/driver/driver_test.go index e46729ad4..fc5007b88 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -2,6 +2,7 @@ package driver import ( "fmt" + "os" "testing" "time" "math/rand" @@ -11,10 +12,19 @@ import ( const TestHostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { + username := os.Getenv("VSPHERE_USERNAME") + if username == "" { + username = "root" + } + password := os.Getenv("VSPHERE_PASSWORD") + if password == "" { + password = "jetbrains" + } + d, err := NewDriver(&ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", - Username: "root", - Password: "jetbrains", + Username: username, + Password: password, InsecureConnection: true, }) if err != nil { diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index eb84e587b..552417883 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -7,6 +7,7 @@ import ( commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "github.com/vmware/govmomi/vim25/types" "io/ioutil" + "os" "testing" ) @@ -20,10 +21,19 @@ func TestISOBuilderAcc_default(t *testing.T) { } func defaultConfig() map[string]interface{} { + username := os.Getenv("VSPHERE_USERNAME") + if username == "" { + username = "root" + } + password := os.Getenv("VSPHERE_PASSWORD") + if password == "" { + password = "jetbrains" + } + config := map[string]interface{}{ "vcenter_server": "vcenter.vsphere65.test", - "username": "root", - "password": "jetbrains", + "username": username, + "password": password, "insecure_connection": true, "host": "esxi-1.vsphere65.test", From 4dcd6c1f9dc84142e88bb5038fac5b0328f8ea80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= <remijouannet@gmail.com> Date: Tue, 30 Oct 2018 21:46:36 +0100 Subject: [PATCH 193/266] add gofmt to test.sh (#167) add gofmt to test.sh, the script exit 1 if one go files doesn't respect gofmt rules --- test.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 4df8d7782..362e56c21 100755 --- a/test.sh +++ b/test.sh @@ -4,4 +4,17 @@ set -eux export PACKER_ACC=1 -go test -v -count 1 -timeout 20m ./driver ./iso ./clone +RETVAL=0 + +for file in $(find ./ -type f ! -path "./vendor/*" -name '*.go' -print) +do + if [[ -n "$(gofmt -l "$file")" ]] + then + echo -e "$file does not conform to gofmt rules. Run: gofmt -s -w $file" + RETVAL=1 + fi +done + +exit $RETVAL + +go test -v -count 1 -timeout 20m ./driver ./iso ./clone \ No newline at end of file From 6bfb34e0abb050370f00745f18d4d2ff70fc8908 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 30 Oct 2018 23:52:54 +0300 Subject: [PATCH 194/266] move gofmt into a separate script --- gofmt.sh | 14 ++++++++++++++ test.sh | 15 +-------------- 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100755 gofmt.sh diff --git a/gofmt.sh b/gofmt.sh new file mode 100755 index 000000000..0f95fe149 --- /dev/null +++ b/gofmt.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +RETVAL=0 + +for file in $(find . -name '*.go' -not -path './vendor/*') +do + if [ -n "$(gofmt -l $file)" ] + then + echo "$file does not conform to gofmt rules. Run: gofmt -s -w $file" >&2 + RETVAL=1 + fi +done + +exit $RETVAL diff --git a/test.sh b/test.sh index 362e56c21..4df8d7782 100755 --- a/test.sh +++ b/test.sh @@ -4,17 +4,4 @@ set -eux export PACKER_ACC=1 -RETVAL=0 - -for file in $(find ./ -type f ! -path "./vendor/*" -name '*.go' -print) -do - if [[ -n "$(gofmt -l "$file")" ]] - then - echo -e "$file does not conform to gofmt rules. Run: gofmt -s -w $file" - RETVAL=1 - fi -done - -exit $RETVAL - -go test -v -count 1 -timeout 20m ./driver ./iso ./clone \ No newline at end of file +go test -v -count 1 -timeout 20m ./driver ./iso ./clone From a3f0f15ffde4b45a82e118f4c5111eb453b8bc3f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Thu, 1 Nov 2018 00:42:24 +0300 Subject: [PATCH 195/266] apply gofmt --- clone/builder.go | 6 +++--- clone/builder_acc_test.go | 7 +++---- clone/config.go | 8 ++++---- clone/config_test.go | 16 ++++++++-------- clone/step_clone.go | 6 +++--- common/config_ssh.go | 5 ++--- common/step_config_params.go | 6 +++--- common/step_connect.go | 6 +++--- common/step_hardware.go | 16 ++++++++-------- common/step_run.go | 6 +++--- common/step_shutdown.go | 10 +++++----- common/step_snapshot.go | 4 ++-- common/step_template.go | 4 ++-- common/step_wait_for_ip.go | 4 ++-- common/testing/utility.go | 12 +++++------- driver/datastore.go | 4 ++-- driver/driver.go | 10 +++++----- driver/driver_test.go | 2 +- driver/folder.go | 6 +++--- driver/host.go | 8 ++++---- driver/resource_pool.go | 8 ++++---- driver/resource_pool_acc_test.go | 2 +- driver/vm.go | 6 +++--- driver/vm_cdrom.go | 2 +- driver/vm_clone_acc_test.go | 6 +++--- driver/vm_keyboard.go | 12 ++++++------ examples/driver/main.go | 5 ++--- iso/builder.go | 6 +++--- iso/config.go | 14 +++++++------- iso/step_add_cdrom.go | 12 ++++++------ iso/step_add_floppy.go | 4 ++-- iso/step_boot_command.go | 16 ++++++++-------- iso/step_create.go | 6 +++--- iso/step_remove_cdrom.go | 4 ++-- iso/step_remove_floppy.go | 4 ++-- 35 files changed, 124 insertions(+), 129 deletions(-) diff --git a/clone/builder.go b/clone/builder.go index d0daf470f..bf3410135 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -2,11 +2,11 @@ package clone import ( packerCommon "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { @@ -51,7 +51,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.Comm.Type != "none" { steps = append(steps, &common.StepRun{ - Config: &b.config.RunConfig, + Config: &b.config.RunConfig, SetOrder: false, }, &common.StepWaitForIp{}, diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 8452692af..95649ca7c 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -2,12 +2,11 @@ package clone import ( builderT "github.com/hashicorp/packer/helper/builder/testing" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/common" commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "os" - - "github.com/hashicorp/packer/packer" "testing" - "github.com/jetbrains-infra/packer-builder-vsphere/common" ) func TestCloneBuilderAcc_default(t *testing.T) { @@ -429,7 +428,7 @@ func TestCloneBuilderAcc_sshPassword(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: sshPasswordConfig(), - Check: checkDefaultBootOrder(t), + Check: checkDefaultBootOrder(t), }) } diff --git a/clone/config.go b/clone/config.go index d982928aa..420d0d495 100644 --- a/clone/config.go +++ b/clone/config.go @@ -3,10 +3,10 @@ package clone import ( packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/hashicorp/packer/helper/config" ) type Config struct { @@ -18,9 +18,9 @@ type Config struct { common.HardwareConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - common.ShutdownConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` CreateSnapshot bool `mapstructure:"create_snapshot"` ConvertToTemplate bool `mapstructure:"convert_to_template"` diff --git a/clone/config_test.go b/clone/config_test.go index d0517f900..a7de982c7 100644 --- a/clone/config_test.go +++ b/clone/config_test.go @@ -25,7 +25,7 @@ func TestCloneConfig_Timeout(t *testing.T) { raw["shutdown_timeout"] = "3m" conf, warns, err := NewConfig(raw) testConfigOk(t, warns, err) - if conf.ShutdownConfig.Timeout != 3 * time.Minute { + if conf.ShutdownConfig.Timeout != 3*time.Minute { t.Fatalf("shutdown_timeout sould be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout) } } @@ -41,13 +41,13 @@ func TestCloneConfig_RAMReservation(t *testing.T) { func minimalConfig() map[string]interface{} { return map[string]interface{}{ "vcenter_server": "vcenter.domain.local", - "username": "root", - "password": "vmware", - "template": "ubuntu", - "vm_name": "vm1", - "host": "esxi1.domain.local", - "ssh_username": "root", - "ssh_password": "secret", + "username": "root", + "password": "vmware", + "template": "ubuntu", + "vm_name": "vm1", + "host": "esxi1.domain.local", + "ssh_username": "root", + "ssh_password": "secret", } } diff --git a/clone/step_clone.go b/clone/step_clone.go index b588e17cb..ecec2eebc 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -1,12 +1,12 @@ package clone import ( + "context" + "fmt" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "fmt" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/common" - "context" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type CloneConfig struct { diff --git a/common/config_ssh.go b/common/config_ssh.go index 0eec1f126..bcb1ef2e0 100644 --- a/common/config_ssh.go +++ b/common/config_ssh.go @@ -2,12 +2,11 @@ package common import ( "fmt" - "io/ioutil" - packerssh "github.com/hashicorp/packer/communicator/ssh" + "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" "golang.org/x/crypto/ssh" - "github.com/hashicorp/packer/helper/communicator" + "io/ioutil" ) func CommHost(state multistep.StateBag) (string, error) { diff --git a/common/step_config_params.go b/common/step_config_params.go index b5cefc812..f8e5606b1 100644 --- a/common/step_config_params.go +++ b/common/step_config_params.go @@ -1,11 +1,11 @@ package common import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "fmt" - "context" ) type ConfigParamsConfig struct { diff --git a/common/step_connect.go b/common/step_connect.go index 6891247d7..258b8d5d7 100644 --- a/common/step_connect.go +++ b/common/step_connect.go @@ -1,10 +1,10 @@ package common import ( - "github.com/hashicorp/packer/helper/multistep" - "fmt" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type ConnectConfig struct { diff --git a/common/step_hardware.go b/common/step_hardware.go index d0fcb6ee7..ea301127a 100644 --- a/common/step_hardware.go +++ b/common/step_hardware.go @@ -1,25 +1,25 @@ package common import ( - "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" "context" "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type HardwareConfig struct { - CPUs int32 `mapstructure:"CPUs"` - CPUReservation int64 `mapstructure:"CPU_reservation"` - CPULimit int64 `mapstructure:"CPU_limit"` - CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` + CPUs int32 `mapstructure:"CPUs"` + CPUReservation int64 `mapstructure:"CPU_reservation"` + CPULimit int64 `mapstructure:"CPU_limit"` + CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` RAM int64 `mapstructure:"RAM"` RAMReservation int64 `mapstructure:"RAM_reservation"` RAMReserveAll bool `mapstructure:"RAM_reserve_all"` MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` - NestedHV bool `mapstructure:"NestedHV"` + NestedHV bool `mapstructure:"NestedHV"` } func (c *HardwareConfig) Prepare() []error { diff --git a/common/step_run.go b/common/step_run.go index 1f1ef57de..92366cf25 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -1,11 +1,11 @@ package common import ( + "context" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" - "context" ) type RunConfig struct { @@ -13,7 +13,7 @@ type RunConfig struct { } type StepRun struct { - Config *RunConfig + Config *RunConfig SetOrder bool } @@ -41,7 +41,7 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste ui.Say("Power on VM...") err := vm.PowerOn() if err != nil { - state.Put("error",err) + state.Put("error", err) return multistep.ActionHalt } diff --git a/common/step_shutdown.go b/common/step_shutdown.go index 5fe9996fc..2909919d9 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -1,21 +1,21 @@ package common import ( + "bytes" + "context" + "fmt" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "fmt" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" "log" "time" - "bytes" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "context" ) type ShutdownConfig struct { Command string `mapstructure:"shutdown_command"` RawTimeout string `mapstructure:"shutdown_timeout"` - Timeout time.Duration + Timeout time.Duration } func (c *ShutdownConfig) Prepare() []error { diff --git a/common/step_snapshot.go b/common/step_snapshot.go index b69d8a46f..1d80a4be3 100644 --- a/common/step_snapshot.go +++ b/common/step_snapshot.go @@ -1,13 +1,13 @@ package common import ( + "context" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "context" ) -type StepCreateSnapshot struct{ +type StepCreateSnapshot struct { CreateSnapshot bool } diff --git a/common/step_template.go b/common/step_template.go index bb2379b44..d42b0b186 100644 --- a/common/step_template.go +++ b/common/step_template.go @@ -1,13 +1,13 @@ package common import ( + "context" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "context" ) -type StepConvertToTemplate struct{ +type StepConvertToTemplate struct { ConvertToTemplate bool } diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index a3485bd5d..3cc1cfae4 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -1,12 +1,12 @@ package common import ( - "github.com/hashicorp/packer/helper/multistep" + "context" "fmt" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "time" - "context" ) type StepWaitForIp struct{} diff --git a/common/testing/utility.go b/common/testing/utility.go index 8a13bf883..4f1e2b358 100644 --- a/common/testing/utility.go +++ b/common/testing/utility.go @@ -1,14 +1,14 @@ package testing import ( - "fmt" - "math/rand" - "time" "encoding/json" + "fmt" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "testing" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "math/rand" + "testing" + "time" ) func NewVMName() string { @@ -32,7 +32,6 @@ func RenderConfig(config map[string]interface{}) string { return string(j) } - func TestConn(t *testing.T) *driver.Driver { d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", @@ -57,4 +56,3 @@ func GetVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver. return vm } - diff --git a/driver/datastore.go b/driver/datastore.go index ef37b416c..36f976fcd 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -1,11 +1,11 @@ package driver import ( + "fmt" "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/soap" - "fmt" + "github.com/vmware/govmomi/vim25/types" ) type Datastore struct { diff --git a/driver/driver.go b/driver/driver.go index 30ddcce72..68e3029ad 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -1,16 +1,16 @@ package driver import ( + "context" + "fmt" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" - "context" - "net/url" - "fmt" "github.com/vmware/govmomi/object" - "time" "github.com/vmware/govmomi/session" - "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/soap" + "net/url" + "time" ) type Driver struct { diff --git a/driver/driver_test.go b/driver/driver_test.go index fc5007b88..65e377724 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -2,10 +2,10 @@ package driver import ( "fmt" + "math/rand" "os" "testing" "time" - "math/rand" ) // Defines whether acceptance tests should be run diff --git a/driver/folder.go b/driver/folder.go index 5af053007..7fdf40ed1 100644 --- a/driver/folder.go +++ b/driver/folder.go @@ -1,10 +1,10 @@ package driver import ( - "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/mo" "fmt" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" ) type Folder struct { diff --git a/driver/host.go b/driver/host.go index 234c72349..7ceaea4ff 100644 --- a/driver/host.go +++ b/driver/host.go @@ -2,18 +2,18 @@ package driver import ( "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" ) type Host struct { driver *Driver - host *object.HostSystem + host *object.HostSystem } func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host { return &Host{ - host: object.NewHostSystem(d.client.Client, *ref), + host: object.NewHostSystem(d.client.Client, *ref), driver: d, } } @@ -29,7 +29,7 @@ func (d *Driver) FindHost(name string) (*Host, error) { }, nil } -func (h *Host) Info(params ...string) (*mo.HostSystem, error){ +func (h *Host) Info(params ...string) (*mo.HostSystem, error) { var p []string if len(params) == 0 { p = []string{"*"} diff --git a/driver/resource_pool.go b/driver/resource_pool.go index 7f869dbce..001e836d7 100644 --- a/driver/resource_pool.go +++ b/driver/resource_pool.go @@ -1,10 +1,10 @@ package driver import ( - "github.com/vmware/govmomi/object" - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/mo" "fmt" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" ) type ResourcePool struct { @@ -32,7 +32,7 @@ func (d *Driver) FindResourcePool(cluster string, host string, name string) (*Re return nil, err } return &ResourcePool{ - pool: p, + pool: p, driver: d, }, nil } diff --git a/driver/resource_pool_acc_test.go b/driver/resource_pool_acc_test.go index 3d49282b2..a2b3a93d4 100644 --- a/driver/resource_pool_acc_test.go +++ b/driver/resource_pool_acc_test.go @@ -4,7 +4,7 @@ import "testing" func TestResourcePoolAcc(t *testing.T) { d := newTestDriver(t) - p, err := d.FindResourcePool("","esxi-1.vsphere65.test", "pool1/pool2") + p, err := d.FindResourcePool("", "esxi-1.vsphere65.test", "pool1/pool2") if err != nil { t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) } diff --git a/driver/vm.go b/driver/vm.go index 3923cb081..90165e8b1 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -1,14 +1,14 @@ package driver import ( + "context" "errors" "fmt" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" - "time" "strings" - "context" + "time" ) type VirtualMachine struct { @@ -54,7 +54,7 @@ type CreateConfig struct { Network string // "" for default network NetworkCard string // example: vmxnet3 USBController bool - Version uint // example: 10 + Version uint // example: 10 Firmware string // efi or bios } diff --git a/driver/vm_cdrom.go b/driver/vm_cdrom.go index 2dfc65af1..80884737e 100644 --- a/driver/vm_cdrom.go +++ b/driver/vm_cdrom.go @@ -1,8 +1,8 @@ package driver import ( - "github.com/vmware/govmomi/vim25/types" "errors" + "github.com/vmware/govmomi/vim25/types" ) func (vm *VirtualMachine) AddSATAController() error { diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index fc5be60a0..81551ab5e 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -1,11 +1,11 @@ package driver import ( + "context" "log" "net" "testing" "time" - "context" ) func TestVMAcc_clone(t *testing.T) { @@ -168,7 +168,7 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { func configureRAMReserveAllCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { log.Printf("[DEBUG] Configuring the vm") - vm.Configure(&HardwareConfig{ RAMReserveAll: true }) + vm.Configure(&HardwareConfig{RAMReserveAll: true}) log.Printf("[DEBUG] Running checks") vmInfo, err := vm.Info("config") @@ -237,7 +237,7 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { vm.StartShutdown() log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") - vm.WaitForShutdown(context.TODO(), 1 * time.Minute) + vm.WaitForShutdown(context.TODO(), 1*time.Minute) } func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { diff --git a/driver/vm_keyboard.go b/driver/vm_keyboard.go index 02b86a197..481639fc1 100644 --- a/driver/vm_keyboard.go +++ b/driver/vm_keyboard.go @@ -1,11 +1,11 @@ package driver import ( + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/types" + "golang.org/x/mobile/event/key" "strings" "unicode" - "github.com/vmware/govmomi/vim25/types" - "github.com/vmware/govmomi/vim25/methods" - "golang.org/x/mobile/event/key" ) type KeyInput struct { @@ -26,9 +26,9 @@ func init() { scancodeIndex["!@#$%^&*()"] = key.Code1 scancodeIndex[" "] = key.CodeSpacebar scancodeIndex["-=[]\\"] = key.CodeHyphenMinus - scancodeIndex["_+{}|" ] = key.CodeHyphenMinus - scancodeIndex[ ";'`,./" ] = key.CodeSemicolon - scancodeIndex[":\"~<>?" ] = key.CodeSemicolon + scancodeIndex["_+{}|"] = key.CodeHyphenMinus + scancodeIndex[";'`,./"] = key.CodeSemicolon + scancodeIndex[":\"~<>?"] = key.CodeSemicolon for chars, start := range scancodeIndex { for i, r := range chars { diff --git a/examples/driver/main.go b/examples/driver/main.go index e4d15ec95..e60c19bb5 100644 --- a/examples/driver/main.go +++ b/examples/driver/main.go @@ -1,13 +1,12 @@ package main import ( - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "fmt" - "context" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) func main() { - d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ + d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/iso/builder.go b/iso/builder.go index 9b6aa9fe2..113cbc3ce 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -2,11 +2,11 @@ package iso import ( packerCommon "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { @@ -63,7 +63,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Host: b.config.Host, }, &common.StepRun{ - Config: &b.config.RunConfig, + Config: &b.config.RunConfig, SetOrder: true, }, &StepBootCommand{ diff --git a/iso/config.go b/iso/config.go index 0cc2c3bdf..f4b486fab 100644 --- a/iso/config.go +++ b/iso/config.go @@ -3,10 +3,10 @@ package iso import ( packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" + "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/hashicorp/packer/helper/config" ) type Config struct { @@ -18,12 +18,12 @@ type Config struct { common.HardwareConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - BootConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` - common.ShutdownConfig `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + BootConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` CreateSnapshot bool `mapstructure:"create_snapshot"` ConvertToTemplate bool `mapstructure:"convert_to_template"` diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 97633fd4b..50a0b9250 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -1,16 +1,16 @@ package iso import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "fmt" - "context" ) type CDRomConfig struct { - CdromType string `mapstructure:"cdrom_type"` - ISOPaths []string `mapstructure:"iso_paths"` + CdromType string `mapstructure:"cdrom_type"` + ISOPaths []string `mapstructure:"iso_paths"` } type StepAddCDRom struct { @@ -20,7 +20,7 @@ type StepAddCDRom struct { func (c *CDRomConfig) Prepare() []error { var errs []error - if (c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata") { + if c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata" { errs = append(errs, fmt.Errorf("'cdrom_type' must be 'ide' or 'sata'")) } diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 46974a087..5c67631a9 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -1,11 +1,11 @@ package iso import ( + "context" + "fmt" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "fmt" - "context" ) type FloppyConfig struct { diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 7ece87075..895df03a1 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -1,18 +1,18 @@ package iso import ( + "context" + "fmt" + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "fmt" - "time" - "strings" "golang.org/x/mobile/event/key" - "unicode/utf8" - "github.com/hashicorp/packer/common" - "os" "log" - "context" + "os" + "strings" + "time" + "unicode/utf8" ) type BootConfig struct { diff --git a/iso/step_create.go b/iso/step_create.go index 39d448b55..1a05a596f 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -1,12 +1,12 @@ package iso import ( + "context" "fmt" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "context" ) type CreateConfig struct { @@ -34,7 +34,7 @@ func (c *CreateConfig) Prepare() []error { c.GuestOSType = "otherGuest" } - if (c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi") { + if c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi" { errs = append(errs, fmt.Errorf("'firmware' must be 'bios' or 'efi'")) } diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index 380db9e59..f9836854a 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -1,10 +1,10 @@ package iso import ( + "context" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" - "context" ) type StepRemoveCDRom struct{} diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go index 3a1a2d762..af5d64846 100644 --- a/iso/step_remove_floppy.go +++ b/iso/step_remove_floppy.go @@ -1,11 +1,11 @@ package iso import ( + "context" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/hashicorp/packer/helper/multistep" "github.com/vmware/govmomi/vim25/types" - "context" ) type StepRemoveFloppy struct { From 10f7b3789547764902e8340b82b6b5edee83d3da Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 2 Nov 2018 00:32:34 +0300 Subject: [PATCH 196/266] Add tests for clusters --- iso/builder_acc_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 552417883..21f9fc5b4 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -456,3 +456,35 @@ func checkBootOrder(t *testing.T) builderT.TestCheckFunc { return nil } } + +func TestISOBuilderAcc_cluster(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: clusterConfig(), + }) +} + +func clusterConfig() string { + config := defaultConfig() + config["cluster"] = "cluster1" + config["host"] = "esxi-2.vsphere65.test" + + return commonT.RenderConfig(config) +} + +func TestISOBuilderAcc_clusterDRS(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: clusterDRSConfig(), + }) +} + +func clusterDRSConfig() string { + config := defaultConfig() + config["cluster"] = "cluster2" + config["host"] = "" + config["datastore"] = "datastore3" // bug #183 + config["network"] = "VM Network" // bug #183 + + return commonT.RenderConfig(config) +} From 26cbcaed46cc4034668110b8b942be4be77689ed Mon Sep 17 00:00:00 2001 From: borlandts <timothy.borland@gmail.com> Date: Sun, 4 Nov 2018 16:49:05 -0500 Subject: [PATCH 197/266] Document minimal permissions (#175) --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index f7af0703b..1c9fd1cc5 100644 --- a/README.md +++ b/README.md @@ -133,3 +133,28 @@ Only use the `cluster` option. Optionally specify a `resource_pool`: "cluster": "cluster2", "resource_pool": "pool1", ``` + +## Required vSphere Permissions +Read only (without propagation) is required for: +``` +vcenter -> datacenter -> cluster +vcenter -> datacenter -> distributed switch +``` +Required for any: resource pool, folder, distributed port group, datastore or storage cluster (with propagation) used in the builder: +``` +Datastore ->Allocate space +Datastore ->Browse datastore +Datastore ->Low level file operations +Datastore ->Remove file +Datastore ->Update virtual machine files +Datastore ->Update virtual machine metadata +Network -> Assign network +Resource -> Assign virtual machine to resource pool +Virtual machine -> Change Configuration +Virtual machine -> Edit Inventory +Virtual machine -> Guest operations +Virtual machine -> Interaction +Virtual machine -> Provisioning +Virtual machine -> Service configuration +Virtual machine -> Snapshot management +``` From d641a78fb31cc0e5eeafe0629c98699834c09b28 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Wed, 31 Oct 2018 15:35:39 +0300 Subject: [PATCH 198/266] don't read host properties if not required --- driver/vm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/vm.go b/driver/vm.go index 90165e8b1..44ac69bb0 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -100,7 +100,7 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) { } var host *object.HostSystem - if config.Host != "" { + if config.Cluster != "" && config.Host != "" { h, err := d.FindHost(config.Host) if err != nil { return nil, err From 436cdc8ac63aaba5ae7a82936a4fd5e24cf2e395 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 6 Nov 2018 01:11:06 +0300 Subject: [PATCH 199/266] Review permissions --- README.md | 65 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 1c9fd1cc5..5203da561 100644 --- a/README.md +++ b/README.md @@ -135,26 +135,45 @@ Only use the `cluster` option. Optionally specify a `resource_pool`: ``` ## Required vSphere Permissions -Read only (without propagation) is required for: -``` -vcenter -> datacenter -> cluster -vcenter -> datacenter -> distributed switch -``` -Required for any: resource pool, folder, distributed port group, datastore or storage cluster (with propagation) used in the builder: -``` -Datastore ->Allocate space -Datastore ->Browse datastore -Datastore ->Low level file operations -Datastore ->Remove file -Datastore ->Update virtual machine files -Datastore ->Update virtual machine metadata -Network -> Assign network -Resource -> Assign virtual machine to resource pool -Virtual machine -> Change Configuration -Virtual machine -> Edit Inventory -Virtual machine -> Guest operations -Virtual machine -> Interaction -Virtual machine -> Provisioning -Virtual machine -> Service configuration -Virtual machine -> Snapshot management -``` + +* VM folder (this object and children): + ``` + Virtual machine -> Inventory + Virtual machine -> Configuration + Virtual machine -> Interaction + Virtual machine -> Snapshot management + Virtual machine -> Provisioning + ``` +* Resource pool, host, or cluster (this object): + ``` + Resource -> Assign virtual machine to resource pool + ``` +* Host in clusters without DRS (this object): + ``` + Read-only + ``` +* Datastore (this object): + ``` + Datastore -> Allocate space + Datastore -> Browse datastore + Datastore -> Low level file operations + ``` +* Network (this object): + ``` + Network -> Assign network + ``` +* Distributed switch (this object): + ``` + Read-only + ``` + +For floppy image upload: + +* Datacenter (this object): + ``` + Datastore -> Low level file operations + ``` +* Host (this object): + ``` + Host -> Configuration -> System Management + ``` From 6f7ec33eb3d262f8c7b8f652689b1e93932b5193 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 6 Nov 2018 01:46:09 +0300 Subject: [PATCH 200/266] List individual privileges --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5203da561..37541082b 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ Only use the `cluster` option. Optionally specify a `resource_pool`: Virtual machine -> Snapshot management Virtual machine -> Provisioning ``` + Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235. * Resource pool, host, or cluster (this object): ``` Resource -> Assign virtual machine to resource pool From e21ff3fe477e4e85d127be782757b1a008c55722 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 7 Nov 2018 00:54:30 +0300 Subject: [PATCH 201/266] Update README.md --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37541082b..a5ce429d3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Team project](http://jb.gg/badges/team.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) -[![Github All Releases](https://img.shields.io/github/downloads/jetbrains-infra/packer-builder-vsphere/total.svg)](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) +[![GitHub latest release](https://img.shields.io/github/release/jetbrains-infra/packer-builder-vsphere.svg)](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) +[![GitHub downloads](https://img.shields.io/github/downloads/jetbrains-infra/packer-builder-vsphere/total.svg)](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) [![TeamCity build status](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/PackerVSphere_Build.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=PackerVSphere_Build&guest=1) @@ -82,7 +83,9 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `network`(string) - Set network VM will be connected to. * `network_card`(string) - Set VM network card type. Example `vmxnet3`. * `usb_controller`(boolean) - Create USB controller for virtual machine. Defaults to `false`. -* `firmware`(string) - Set the Firmware at machine creation. Example `efi`. Defaults to `bios` +* `cdrom_type`(string) - Which controller to use. Example `sata`. Defaults to `ide`. +* `firmware`(string) - Set the Firmware at machine creation. Example `efi`. Defaults to `bios`. + ### Boot (`vsphere-iso` only) From e929b193e0a809ba7d03d650003ff26e81643324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= <remijouannet@gmail.com> Date: Thu, 8 Nov 2018 17:50:52 +0100 Subject: [PATCH 202/266] 'notes' option (#185) --- README.md | 1 + clone/step_clone.go | 2 ++ driver/vm.go | 7 +++++++ iso/step_create.go | 3 +++ 4 files changed, 13 insertions(+) diff --git a/README.md b/README.md index a5ce429d3..ac16d5481 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### VM Location * `vm_name`(string) - Name of the new VM to create. +* `notes`(string) - Add some notes. * `folder`(string) - VM folder to create the VM in. * `host`(string) - ESXi host where target VM is created. A full path must be specified if the host is in a folder. For example `folder/host`. See the `Specifying Clusters and Hosts` section above for more details. * `cluster`(string) - ESXi cluster where target VM is created. See [Working with Clusters](#working-with-clusters) section. diff --git a/clone/step_clone.go b/clone/step_clone.go index ecec2eebc..07f65f224 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -13,6 +13,7 @@ type CloneConfig struct { Template string `mapstructure:"template"` DiskSize int64 `mapstructure:"disk_size"` LinkedClone bool `mapstructure:"linked_clone"` + Notes string `mapstructure:"notes"` } func (c *CloneConfig) Prepare() []error { @@ -54,6 +55,7 @@ func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist ResourcePool: s.Location.ResourcePool, Datastore: s.Location.Datastore, LinkedClone: s.Config.LinkedClone, + Annotation: s.Config.Notes, }) if err != nil { state.Put("error", err) diff --git a/driver/vm.go b/driver/vm.go index 44ac69bb0..286b9518d 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -24,6 +24,7 @@ type CloneConfig struct { ResourcePool string Datastore string LinkedClone bool + Annotation string } type HardwareConfig struct { @@ -219,6 +220,12 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) cloneSpec.Snapshot = tpl.Snapshot.CurrentSnapshot } + if config.Annotation != "" { + var configSpec types.VirtualMachineConfigSpec + configSpec.Annotation = config.Annotation + cloneSpec.Config = &configSpec + } + task, err := template.vm.Clone(template.driver.ctx, folder.folder, config.Name, cloneSpec) if err != nil { return nil, err diff --git a/iso/step_create.go b/iso/step_create.go index 1a05a596f..a58010373 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -21,6 +21,8 @@ type CreateConfig struct { Network string `mapstructure:"network"` NetworkCard string `mapstructure:"network_card"` USBController bool `mapstructure:"usb_controller"` + + Notes string `mapstructure:"notes"` } func (c *CreateConfig) Prepare() []error { @@ -67,6 +69,7 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste USBController: s.Config.USBController, Version: s.Config.Version, Firmware: s.Config.Firmware, + Annotation: s.Config.Notes, }) if err != nil { state.Put("error", fmt.Errorf("error creating vm: %v", err)) From 4f952613d75bf5becb37c6fbe6e7f9eeac7102d9 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 7 Nov 2018 23:58:04 +0300 Subject: [PATCH 203/266] Add 'notes' tests --- clone/builder_acc_test.go | 34 ++++++++++++++++++++++++++++++++++ iso/builder_acc_test.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 95649ca7c..63610233c 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -577,3 +577,37 @@ func checkBootOrder(t *testing.T) builderT.TestCheckFunc { return nil } } + +func TestCloneBuilderAcc_notes(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: notesConfig(), + Check: checkNotes(t), + }) +} + +func notesConfig() string { + config := defaultConfig() + config["notes"] = "test" + + return commonT.RenderConfig(config) +} + +func checkNotes(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("config.annotation") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + notes := vmInfo.Config.Annotation + if notes != "test" { + t.Errorf("notest should be 'test'") + } + + return nil + } +} diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 21f9fc5b4..d893568a6 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -110,6 +110,40 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil } } +func TestISOBuilderAcc_notes(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: notesConfig(), + Check: checkNotes(t), + }) +} + +func notesConfig() string { + config := defaultConfig() + config["notes"] = "test" + + return commonT.RenderConfig(config) +} + +func checkNotes(t *testing.T) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("config.annotation") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + notes := vmInfo.Config.Annotation + if notes != "test" { + t.Errorf("notes should be 'test'") + } + + return nil + } +} + func TestISOBuilderAcc_hardware(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, From e1cdd04f4f19a82b89bc6fe881261dc2c3197921 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Tue, 13 Nov 2018 20:22:19 +0300 Subject: [PATCH 204/266] file upload trough specific host By default a host is selected randomly. Used account may have read-only but no upload permissions there. --- driver/datastore.go | 9 +++++++-- iso/step_add_floppy.go | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/driver/datastore.go b/driver/datastore.go index 36f976fcd..7f4b3b1dc 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -81,9 +81,14 @@ func (ds *Datastore) ResolvePath(path string) string { return ds.ds.Path(path) } -func (ds *Datastore) UploadFile(src, dst string) error { +func (ds *Datastore) UploadFile(src, dst string, host string) error { p := soap.DefaultUpload - return ds.ds.UploadFile(ds.driver.ctx, src, dst, &p) + h, err := ds.driver.FindHost(host) + if err != nil { + return err + } + ctx := ds.ds.HostContext(ds.driver.ctx, h.host) + return ds.ds.UploadFile(ctx, src, dst, &p) } func (ds *Datastore) Delete(path string) error { diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 5c67631a9..fd9f9ac27 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -40,7 +40,7 @@ func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multist } uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.flp", vmDir) - if err := ds.UploadFile(floppyPath.(string), uploadPath); err != nil { + if err := ds.UploadFile(floppyPath.(string), uploadPath, s.Host); err != nil { state.Put("error", err) return multistep.ActionHalt } From 1b1ef09706208c3680e8e90fe4422846a2fc1bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= <remijouannet@gmail.com> Date: Fri, 16 Nov 2018 16:37:54 +0100 Subject: [PATCH 205/266] support '-force': replace existing vm (#186) --- clone/builder.go | 1 + clone/step_clone.go | 15 ++++++++++++++- iso/builder.go | 1 + iso/step_create.go | 14 ++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/clone/builder.go b/clone/builder.go index bf3410135..757e9b2c5 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -39,6 +39,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCloneVM{ Config: &b.config.CloneConfig, Location: &b.config.LocationConfig, + Force: b.config.PackerConfig.PackerForce, }, &common.StepConfigureHardware{ Config: &b.config.HardwareConfig, diff --git a/clone/step_clone.go b/clone/step_clone.go index 07f65f224..3db1010e0 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -33,14 +33,27 @@ func (c *CloneConfig) Prepare() []error { type StepCloneVM struct { Config *CloneConfig Location *common.LocationConfig + Force bool } func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) - ui.Say("Cloning VM...") + find_vm, err := d.FindVM(s.Location.VMName) + if s.Force == false && err == nil { + state.Put("error", fmt.Errorf("%s already exists, you can use -force flag to destroy it: %v", s.Location.VMName, err)) + return multistep.ActionHalt + } else if s.Force == true && err == nil { + ui.Say(fmt.Sprintf("the vm/template %s already exists, but deleting it due to -force flag", s.Location.VMName)) + err := find_vm.Destroy() + if err != nil { + state.Put("error", fmt.Errorf("error destroying %s: %v", s.Location.VMName, err)) + } + } + + ui.Say("Cloning VM...") template, err := d.FindVM(s.Config.Template) if err != nil { state.Put("error", err) diff --git a/iso/builder.go b/iso/builder.go index 113cbc3ce..fb2b424bb 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -39,6 +39,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCreateVM{ Config: &b.config.CreateConfig, Location: &b.config.LocationConfig, + Force: b.config.PackerConfig.PackerForce, }, &common.StepConfigureHardware{ Config: &b.config.HardwareConfig, diff --git a/iso/step_create.go b/iso/step_create.go index a58010373..122e542e8 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -46,12 +46,26 @@ func (c *CreateConfig) Prepare() []error { type StepCreateVM struct { Config *CreateConfig Location *common.LocationConfig + Force bool } func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) + find_vm, err := d.FindVM(s.Location.VMName) + + if s.Force == false && err == nil { + state.Put("error", fmt.Errorf("%s already exists, you can use -force flag to destroy it: %v", s.Location.VMName, err)) + return multistep.ActionHalt + } else if s.Force == true && err == nil { + ui.Say(fmt.Sprintf("the vm/template %s already exists, but deleting it due to -force flag", s.Location.VMName)) + err := find_vm.Destroy() + if err != nil { + state.Put("error", fmt.Errorf("error destroying %s: %v", s.Location.VMName, err)) + } + } + ui.Say("Creating VM...") vm, err := d.CreateVM(&driver.CreateConfig{ DiskThinProvisioned: s.Config.DiskThinProvisioned, From b107245aedf86e65df78e7c2f77587f76af6eda8 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Mon, 3 Dec 2018 20:10:48 +0300 Subject: [PATCH 206/266] use alternate vsphere account in tests --- common/testing/utility.go | 14 ++++++++++++-- iso/builder_acc_test.go | 13 +++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/common/testing/utility.go b/common/testing/utility.go index 4f1e2b358..325b86cfa 100644 --- a/common/testing/utility.go +++ b/common/testing/utility.go @@ -7,6 +7,7 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "math/rand" + "os" "testing" "time" ) @@ -33,10 +34,19 @@ func RenderConfig(config map[string]interface{}) string { } func TestConn(t *testing.T) *driver.Driver { + username := os.Getenv("VSPHERE_USERNAME") + if username == "" { + username = "root" + } + password := os.Getenv("VSPHERE_PASSWORD") + if password == "" { + password = "jetbrains" + } + d, err := driver.NewDriver(&driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", - Username: "root", - Password: "jetbrains", + Username: username, + Password: password, InsecureConnection: true, }) if err != nil { diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index d893568a6..026ec0e3b 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -381,10 +381,19 @@ func TestISOBuilderAcc_full(t *testing.T) { } func fullConfig() map[string]interface{} { + username := os.Getenv("VSPHERE_USERNAME") + if username == "" { + username = "root" + } + password := os.Getenv("VSPHERE_PASSWORD") + if password == "" { + password = "jetbrains" + } + config := map[string]interface{}{ "vcenter_server": "vcenter.vsphere65.test", - "username": "root", - "password": "jetbrains", + "username": username, + "password": password, "insecure_connection": true, "vm_name": commonT.NewVMName(), From 70b6d6a8b33669dc357c8e85692043669b708558 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Mon, 17 Dec 2018 15:49:04 +0300 Subject: [PATCH 207/266] Add 'video_ram' parameter (#197) --- clone/builder_acc_test.go | 14 ++++++++++++++ common/step_hardware.go | 4 +++- driver/vm.go | 21 +++++++++++++++++++++ iso/builder_acc_test.go | 9 +++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 63610233c..9f37fc4e3 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" + "github.com/vmware/govmomi/vim25/types" "os" "testing" ) @@ -338,6 +339,7 @@ func hardwareConfig() string { config["RAM_reservation"] = 1024 config["CPU_hot_plug"] = true config["RAM_hot_plug"] = true + config["video_ram"] = 8192 return commonT.RenderConfig(config) } @@ -387,6 +389,18 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have Memory hot add enabled, got %v", memoryHotAdd) } + l, err := vm.Devices() + if err != nil { + t.Fatalf("Cannot read VM devices: %v", err) + } + v := l.SelectByType((*types.VirtualMachineVideoCard)(nil)) + if len(v) != 1 { + t.Errorf("VM should have one video card") + } + if v[0].(*types.VirtualMachineVideoCard).VideoRamSizeInKB != 8192 { + t.Errorf("Video RAM should be equal 8192") + } + return nil } } diff --git a/common/step_hardware.go b/common/step_hardware.go index ea301127a..e9225a6f6 100644 --- a/common/step_hardware.go +++ b/common/step_hardware.go @@ -19,7 +19,8 @@ type HardwareConfig struct { RAMReserveAll bool `mapstructure:"RAM_reserve_all"` MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` - NestedHV bool `mapstructure:"NestedHV"` + VideoRAM int64 `mapstructure:"video_ram"` + NestedHV bool `mapstructure:"NestedHV"` } func (c *HardwareConfig) Prepare() []error { @@ -53,6 +54,7 @@ func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) NestedHV: s.Config.NestedHV, CpuHotAddEnabled: s.Config.CpuHotAddEnabled, MemoryHotAddEnabled: s.Config.MemoryHotAddEnabled, + VideoRAM: s.Config.VideoRAM, }) if err != nil { state.Put("error", err) diff --git a/driver/vm.go b/driver/vm.go index 286b9518d..f5af74d20 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -37,6 +37,7 @@ type HardwareConfig struct { NestedHV bool CpuHotAddEnabled bool MemoryHotAddEnabled bool + VideoRAM int64 } type CreateConfig struct { @@ -277,6 +278,26 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error { confSpec.CpuHotAddEnabled = &config.CpuHotAddEnabled confSpec.MemoryHotAddEnabled = &config.MemoryHotAddEnabled + if config.VideoRAM != 0 { + devices, err := vm.vm.Device(vm.driver.ctx) + if err != nil { + return err + } + l := devices.SelectByType((*types.VirtualMachineVideoCard)(nil)) + if len(l) != 1 { + return err + } + card := l[0].(*types.VirtualMachineVideoCard) + + card.VideoRamSizeInKB = config.VideoRAM + + spec := &types.VirtualDeviceConfigSpec{ + Device: card, + Operation: types.VirtualDeviceConfigSpecOperationEdit, + } + confSpec.DeviceChange = append(confSpec.DeviceChange, spec) + } + task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec) if err != nil { return err diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 026ec0e3b..40a1a8e0f 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -161,6 +161,7 @@ func hardwareConfig() string { config["RAM_reservation"] = 1024 config["NestedHV"] = true config["firmware"] = "efi" + config["video_ram"] = 8192 return commonT.RenderConfig(config) } @@ -223,6 +224,14 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have no SATA controllers") } + v := l.SelectByType((*types.VirtualMachineVideoCard)(nil)) + if len(v) != 1 { + t.Errorf("VM should have one video card") + } + if v[0].(*types.VirtualMachineVideoCard).VideoRamSizeInKB != 8192 { + t.Errorf("Video RAM should be equal 8192") + } + return nil } } From a809a853b8c00f7523ff14045f7af579ac7752bd Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 18 Dec 2018 18:16:49 +0300 Subject: [PATCH 208/266] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac16d5481..8537ee431 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ docker-compose run build The binaries will be in `bin/` directory. -Artifacts can be also downloaded from [TeamCity builds](https://teamcity.jetbrains.com/viewLog.html?buildTypeId=PackerVSphere_Build&buildId=lastSuccessful&tab=artifacts). +Artifacts can be also downloaded from [TeamCity builds](https://teamcity.jetbrains.com/viewLog.html?buildTypeId=PackerVSphere_Build&buildId=lastSuccessful&tab=artifacts&guest=1). ## Examples From 5014e46b4835fa7acea11fe412638e6d450166fe Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 18 Dec 2018 20:51:56 +0300 Subject: [PATCH 209/266] Add 'cpu_cores' parameter (#198) --- clone/builder_acc_test.go | 6 ++++++ common/step_hardware.go | 2 ++ driver/vm.go | 2 ++ iso/builder_acc_test.go | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 9f37fc4e3..2b7cb8e70 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -333,6 +333,7 @@ func TestCloneBuilderAcc_hardware(t *testing.T) { func hardwareConfig() string { config := defaultConfig() config["CPUs"] = 2 + config["cpu_cores"] = 2 config["CPU_reservation"] = 1000 config["CPU_limit"] = 1500 config["RAM"] = 2048 @@ -359,6 +360,11 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) } + cpuCores := vmInfo.Config.Hardware.NumCoresPerSocket + if cpuCores != 2 { + t.Errorf("VM should have 2 CPU cores per socket, got %v", cpuCores) + } + cpuReservation := *vmInfo.Config.CpuAllocation.Reservation if cpuReservation != 1000 { t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) diff --git a/common/step_hardware.go b/common/step_hardware.go index e9225a6f6..00f1f2fbd 100644 --- a/common/step_hardware.go +++ b/common/step_hardware.go @@ -10,6 +10,7 @@ import ( type HardwareConfig struct { CPUs int32 `mapstructure:"CPUs"` + CpuCores int32 `mapstructure:"cpu_cores"` CPUReservation int64 `mapstructure:"CPU_reservation"` CPULimit int64 `mapstructure:"CPU_limit"` CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` @@ -46,6 +47,7 @@ func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) err := vm.Configure(&driver.HardwareConfig{ CPUs: s.Config.CPUs, + CpuCores: s.Config.CpuCores, CPUReservation: s.Config.CPUReservation, CPULimit: s.Config.CPULimit, RAM: s.Config.RAM, diff --git a/driver/vm.go b/driver/vm.go index f5af74d20..3390621ef 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -29,6 +29,7 @@ type CloneConfig struct { type HardwareConfig struct { CPUs int32 + CpuCores int32 CPUReservation int64 CPULimit int64 RAM int64 @@ -259,6 +260,7 @@ func (vm *VirtualMachine) Destroy() error { func (vm *VirtualMachine) Configure(config *HardwareConfig) error { var confSpec types.VirtualMachineConfigSpec confSpec.NumCPUs = config.CPUs + confSpec.NumCoresPerSocket = config.CpuCores confSpec.MemoryMB = config.RAM var cpuSpec types.ResourceAllocationInfo diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 40a1a8e0f..222a21f79 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -155,6 +155,7 @@ func TestISOBuilderAcc_hardware(t *testing.T) { func hardwareConfig() string { config := defaultConfig() config["CPUs"] = 2 + config["cpu_cores"] = 2 config["CPU_reservation"] = 1000 config["CPU_limit"] = 1500 config["RAM"] = 2048 @@ -181,6 +182,11 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { t.Errorf("VM should have 2 CPU sockets, got %v", cpuSockets) } + cpuCores := vmInfo.Config.Hardware.NumCoresPerSocket + if cpuCores != 2 { + t.Errorf("VM should have 2 CPU cores per socket, got %v", cpuCores) + } + cpuReservation := *vmInfo.Config.CpuAllocation.Reservation if cpuReservation != 1000 { t.Errorf("VM should have CPU reservation for 1000 Mhz, got %v", cpuReservation) From d634c32fd44ed811b4c4fe5b93025fe8ea9faa49 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 19 Dec 2018 22:50:36 +0300 Subject: [PATCH 210/266] Enable TeamCity DSL --- .teamcity/.gitignore | 2 + .teamcity/pom.xml | 104 +++++++++++++++++++++++++++++++ .teamcity/settings.kts | 137 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+) create mode 100644 .teamcity/.gitignore create mode 100644 .teamcity/pom.xml create mode 100644 .teamcity/settings.kts diff --git a/.teamcity/.gitignore b/.teamcity/.gitignore new file mode 100644 index 000000000..7f995f335 --- /dev/null +++ b/.teamcity/.gitignore @@ -0,0 +1,2 @@ +*.iml +target/ diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 000000000..49f9e3cd6 --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0"?> +<project> + <modelVersion>4.0.0</modelVersion> + <name>PackerVSphere Config DSL Script</name> + <groupId>PackerVSphere</groupId> + <artifactId>PackerVSphere_dsl</artifactId> + <version>1.0-SNAPSHOT</version> + + <parent> + <groupId>org.jetbrains.teamcity</groupId> + <artifactId>configs-dsl-kotlin-parent</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <repositories> + <repository> + <id>jetbrains-all</id> + <url>https://download.jetbrains.com/teamcity-repository</url> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + <repository> + <id>teamcity-server</id> + <url>https://teamcity.jetbrains.com/app/dsl-plugins-repository</url> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <id>JetBrains</id> + <url>https://download.jetbrains.com/teamcity-repository</url> + </pluginRepository> + </pluginRepositories> + + <build> + <sourceDirectory>.</sourceDirectory> + <plugins> + <plugin> + <artifactId>kotlin-maven-plugin</artifactId> + <groupId>org.jetbrains.kotlin</groupId> + <version>${kotlin.version}</version> + + <configuration/> + <executions> + <execution> + <id>compile</id> + <phase>process-sources</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>test-compile</id> + <phase>process-test-sources</phase> + <goals> + <goal>test-compile</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jetbrains.teamcity</groupId> + <artifactId>teamcity-configs-maven-plugin</artifactId> + <version>${teamcity.dsl.version}</version> + <configuration> + <format>kotlin</format> + <dstDir>target/generated-configs</dstDir> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.jetbrains.teamcity</groupId> + <artifactId>configs-dsl-kotlin</artifactId> + <version>${teamcity.dsl.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.teamcity</groupId> + <artifactId>configs-dsl-kotlin-plugins</artifactId> + <version>1.0-SNAPSHOT</version> + <type>pom</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-script-runtime</artifactId> + <version>${kotlin.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts new file mode 100644 index 000000000..bd70696cf --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,137 @@ +import jetbrains.buildServer.configs.kotlin.v2018_2.* +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.PullRequests +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.pullRequests +import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.dockerCompose +import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.script +import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs +import jetbrains.buildServer.configs.kotlin.v2018_2.vcs.GitVcsRoot + +version = "2018.2" + +project { + description = "https://github.com/jetbrains-infra/packer-builder-vsphere" + + vcsRoot(GitHub) + + buildType(Build) + + features { + + feature { + type = "IssueTracker" + param("type", "GithubIssues") + param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere") + } + } +} + +object GitHub : GitVcsRoot({ + name = "packer-builder-vsphere" + url = "https://github.com/jetbrains-infra/packer-builder-vsphere" + branch = "master" + branchSpec = "+:refs/heads/(*)" + userNameStyle = GitVcsRoot.UserNameStyle.FULL +}) + +object Build : BuildType({ + val path = "src/github.com/jetbrains-infra/packer-builder-vsphere" + val golangImage = "jetbrainsinfra/golang:1.10.4" + + name = "Build" + + vcs { + root(GitHub, "+:. => $path") + } + + requirements { + equals("docker.server.osType", "linux") + exists("dockerCompose.version") + + doesNotContain("teamcity.agent.name", "ubuntu-single-build") + } + + params { + password("env.VPN_PASSWORD", "credentialsJSON:8c355e81-9a26-4788-8fea-c854cd646c35") + param ("env.VSPHERE_USERNAME", """vsphere65.test\teamcity""") + password("env.VSPHERE_PASSWORD", "credentialsJSON:3e99d6c8-b66f-410a-a865-eaf1b12664ad") + + param("env.GOPATH", "%teamcity.build.checkoutDir%") + param("env.GOCACHE", "%teamcity.build.checkoutDir%/build") + } + + steps { + script { + name = "Build" + workingDir = path + scriptContent = "./build.sh" + dockerImage = golangImage + dockerPull = true + } + + dockerCompose { + name = "Start VPN tunnel" + file = "$path/teamcity-services.yml" + } + + script { + name = "Test" + workingDir = path + scriptContent = """ + set -eux + + go test -c ./driver + go test -c ./iso + go test -c ./clone + + ./test.sh | go-test-teamcity + """.trimIndent() + dockerImage = golangImage + dockerPull = true + dockerRunParameters = "--network=container:vpn" + } + script { + name = "gofmt" + executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE + workingDir = path + scriptContent = "./gofmt.sh" + dockerImage = golangImage + dockerPull = true + } + } + + features { + commitStatusPublisher { + publisher = github { + githubUrl = "https://api.github.com" + authType = personalToken { + token = "credentialsJSON:95bbfc46-3141-4bed-86ec-f8ec751f3e94" + } + } + param("github_oauth_user", "mkuzmin") + } + pullRequests { + provider = github { + authType = token { + token = "credentialsJSON:39727f26-62ed-4152-ab9a-f6845076a979" + } + filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY + } + } + } + + triggers { + vcs { + triggerRules = "-:*.md" + branchFilter = """ + +:* + -:temp-* + -:pull/* + """.trimIndent() + } + } + maxRunningBuilds = 2 + + artifactRules = "$path/bin/* => packer-builder-vsphere-%build.number%.zip" + allowExternalStatus = true +}) From e6462e7b6da102c72dd263232e4e05a2528a352f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 18 Dec 2018 01:35:14 +0300 Subject: [PATCH 211/266] use govmomi 0.19 --- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 85de2aa8f..656c1f72f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -236,7 +236,7 @@ revision = "646ae4a518c1c3be0739df898118d9bccf993858" [[projects]] - digest = "1:aaab3a195b3d3713097c6e02f2681fea299f9ae6d8fb0e8da095f3983ae6e86b" + digest = "1:ee0b246399296b6a34a6e0a482f1ad2db96a3c8a14fe73e34fcfeab3fc547c9d" name = "github.com/vmware/govmomi" packages = [ ".", @@ -257,8 +257,8 @@ "vim25/xml", ] pruneopts = "UT" - revision = "123ed177021588bac57b5c87c1a84270ddf2eca8" - version = "v0.17.1" + revision = "3617f28d167d448f93f282a867870f109516d2a5" + version = "v0.19.0" [[projects]] branch = "master" diff --git a/Gopkg.toml b/Gopkg.toml index 42789372a..8a5a7cb15 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -4,7 +4,7 @@ [[constraint]] name = "github.com/vmware/govmomi" - version = "~0.17" + version = "~0.19" [[override]] name = "github.com/masterzen/azure-sdk-for-go" From 1ca8fdfe083a2589acb72457f88e203cfa73e978 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 18 Dec 2018 02:11:05 +0300 Subject: [PATCH 212/266] use Packer 1.3 Packer broke API compatibility https://github.com/hashicorp/packer/pull/6621 --- Gopkg.lock | 174 +++++++++++++++++++++++++++++++++++++++++-- Gopkg.toml | 6 +- common/config_ssh.go | 4 +- 3 files changed, 175 insertions(+), 9 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 656c1f72f..6c3a5e37f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -32,6 +32,14 @@ pruneopts = "UT" revision = "c385f95c6022e7756e91beac5f5510872f7dcb7d" +[[projects]] + digest = "1:94cad6e2359d57da6652e689189c5b6ef19f99db6304d2c41de54f6632e15143" + name = "github.com/cheggaaa/pb" + packages = ["."] + pruneopts = "UT" + revision = "1cc5bbe20449079337944d56292c7383510c534c" + version = "v1.0.27" + [[projects]] digest = "1:12d4bc32014d9755850a247c43981d4b616f99c94f86247df2d6187511bfad8b" name = "github.com/dylanmei/iso8601" @@ -40,6 +48,22 @@ revision = "2075bf119b58e5576c6ed9f867b8f3d17f2e54d4" version = "v0.1.0" +[[projects]] + branch = "master" + digest = "1:4a0c6bb4805508a6287675fac876be2ac1182539ca8a32468d8128882e9d5009" + name = "github.com/golang/snappy" + packages = ["."] + pruneopts = "UT" + revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a" + +[[projects]] + digest = "1:bfc483a051d3c7185ebeaa41b5bb67a4f76e742217bcaeab5661cc4b1320f392" + name = "github.com/hashicorp/consul" + packages = ["api"] + pruneopts = "UT" + revision = "0bddfa23a2ebe3c0773d917fc104f53d74f7a5ec" + version = "v1.4.0" + [[projects]] branch = "master" digest = "1:07671f8997086ed115824d1974507d2b147d1e0463675ea5dbf3be89b1c2c563" @@ -72,6 +96,30 @@ pruneopts = "UT" revision = "b7773ae218740a7be65057fc60b366a49b538a44" +[[projects]] + digest = "1:4112546e6964796e1c92a9ffdea8fd7ae81ffbf81eda4f946f50937e178f53da" + name = "github.com/hashicorp/go-retryablehttp" + packages = ["."] + pruneopts = "UT" + revision = "4502c0ecdaf0b50d857611af23831260f99be6bf" + version = "v0.5.0" + +[[projects]] + branch = "master" + digest = "1:45aad874d3c7d5e8610427c81870fb54970b981692930ec2a319ce4cb89d7a00" + name = "github.com/hashicorp/go-rootcerts" + packages = ["."] + pruneopts = "UT" + revision = "6bb64b370b90e7ef1fa532be9e591a81c3493e00" + +[[projects]] + branch = "master" + digest = "1:14f2005c31ddf99c4a0f36fc440f8d1ac43224194c7c4a904b3c8f4ba5654d0b" + name = "github.com/hashicorp/go-sockaddr" + packages = ["."] + pruneopts = "UT" + revision = "6d291a969b86c4b633730bfc6b8b9d64c3aafed9" + [[projects]] branch = "master" digest = "1:354978aad16c56c27f57e5b152224806d87902e4935da3b03e18263d82ae77aa" @@ -89,11 +137,28 @@ revision = "23480c0665776210b5fbbac6eaaee40e3e6a96b7" [[projects]] - digest = "1:4d5ecc41a01235e1e6e09b624d755b928095c79cee57c72d17b503b730b7e82a" + digest = "1:ea40c24cdbacd054a6ae9de03e62c5f252479b96c716375aace5c120d68647c8" + name = "github.com/hashicorp/hcl" + packages = [ + ".", + "hcl/ast", + "hcl/parser", + "hcl/scanner", + "hcl/strconv", + "hcl/token", + "json/parser", + "json/scanner", + "json/token", + ] + pruneopts = "UT" + revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" + version = "v1.0.0" + +[[projects]] + digest = "1:fc1a33d56641cb6cc14766a1e7c976aac33f3e18ecf43dfa1cf20b937ed1eb60" name = "github.com/hashicorp/packer" packages = [ "common", - "common/ssh", "common/uuid", "communicator/none", "communicator/ssh", @@ -103,6 +168,7 @@ "helper/communicator", "helper/config", "helper/multistep", + "helper/ssh", "helper/useragent", "packer", "packer/plugin", @@ -112,8 +178,32 @@ "version", ] pruneopts = "UT" - revision = "b4df69af04373ef28caef3601befcaec1f909216" - version = "v1.2.3" + revision = "508b6efb4ababd3efa3614033f9529a30970899d" + version = "v1.3.3" + +[[projects]] + digest = "1:0dd7b7b01769f9df356dc99f9e4144bdbabf6c79041ea7c0892379c5737f3c44" + name = "github.com/hashicorp/serf" + packages = ["coordinate"] + pruneopts = "UT" + revision = "d6574a5bb1226678d7010325fb6c985db20ee458" + version = "v0.8.1" + +[[projects]] + digest = "1:ac52144f192f9c6a37ac9d0abdb9c837da80446a25a881db2b63c04e1259bd8a" + name = "github.com/hashicorp/vault" + packages = [ + "api", + "helper/compressutil", + "helper/consts", + "helper/hclutil", + "helper/jsonutil", + "helper/parseutil", + "helper/strutil", + ] + pruneopts = "UT" + revision = "08df121c8b9adcc2b8fd55fc8506c3f9714c7e61" + version = "v1.0.1" [[projects]] branch = "master" @@ -161,6 +251,14 @@ pruneopts = "UT" revision = "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb" +[[projects]] + digest = "1:0356f3312c9bd1cbeda81505b7fd437501d8e778ab66998ef69f00d7f9b3a0d7" + name = "github.com/mattn/go-runewidth" + packages = ["."] + pruneopts = "UT" + revision = "3ee7d812e62a0804a7d0a324e0249ca2db3476d3" + version = "v0.0.4" + [[projects]] branch = "master" digest = "1:81ffc98d4d2eff80630938db171f5b8936959cd8cefdbf2d22b2f4924aa953dc" @@ -172,6 +270,14 @@ pruneopts = "UT" revision = "b7b9ca407ffff465de12fc37ccbb81ea8b428c43" +[[projects]] + digest = "1:78bbb1ba5b7c3f2ed0ea1eab57bdd3859aec7e177811563edc41198a760b06af" + name = "github.com/mitchellh/go-homedir" + packages = ["."] + pruneopts = "UT" + revision = "ae18d6b8b3205b561c79e8e5f69bff09736185f4" + version = "v1.0.0" + [[projects]] branch = "master" digest = "1:041bb70411ef6945901c63cab3bfd6a1a1de88352359ad0e6e1e86478a53d0ec" @@ -212,6 +318,17 @@ pruneopts = "UT" revision = "81144009af586de8e7729b829266f09dd0d59701" +[[projects]] + digest = "1:e39a5ee8fcbec487f8fc68863ef95f2b025e0739b0e4aa55558a2b4cf8f0ecf0" + name = "github.com/pierrec/lz4" + packages = [ + ".", + "internal/xxh32", + ] + pruneopts = "UT" + revision = "635575b42742856941dbc767b44905bb9ba083f6" + version = "v2.0.7" + [[projects]] digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747" name = "github.com/pkg/errors" @@ -228,6 +345,22 @@ revision = "d2aa419835609d317c34baae11bc345d1f9971a7" version = "1.7.0" +[[projects]] + branch = "master" + digest = "1:454ab66154b169f4ed5a3ea52a7fe63bd6e28700e73748e617f2c66b1f1ed078" + name = "github.com/rwtodd/Go.Sed" + packages = ["sed"] + pruneopts = "UT" + revision = "d6d5d585814e4c3560c684f52e3d8aeed721313d" + +[[projects]] + digest = "1:0e792eea6c96ec55ff302ef33886acbaa5006e900fefe82689e88d96439dcd84" + name = "github.com/ryanuber/go-glob" + packages = ["."] + pruneopts = "UT" + revision = "572520ed46dbddaed19ea3d9541bdd0494163693" + version = "v0.1" + [[projects]] digest = "1:48b859865fccf8a7f171535e1b9f4803057697e72aeab7f762b65fabd1ab5aa0" name = "github.com/ugorji/go" @@ -287,12 +420,16 @@ [[projects]] branch = "master" - digest = "1:88726c7424216b880a2c2f715579628ba2a7ea23612109a1d5b0f11cdbce8942" + digest = "1:0677f6b5581c61d12a5d913ca6a52c3fdb618af050112476b6f4700a6d52c4de" name = "golang.org/x/net" packages = [ "html", "html/atom", "html/charset", + "http/httpguts", + "http2", + "http2/hpack", + "idna", "internal/socks", "proxy", ] @@ -300,9 +437,19 @@ revision = "2491c5de3490fced2f6cff376127c667efeed857" [[projects]] - digest = "1:aa4d6967a3237f8367b6bf91503964a77183ecf696f1273e8ad3551bb4412b5f" + branch = "master" + digest = "1:48a949ee15f5f03524b792547822221b07f828dd26522b5e08688f25a10d14c1" + name = "golang.org/x/sys" + packages = ["unix"] + pruneopts = "UT" + revision = "dcdaa6325bcb8d3c07805583fe12153f08a41e2b" + +[[projects]] + digest = "1:436b24586f8fee329e0dd65fd67c817681420cda1d7f934345c13fe78c212a73" name = "golang.org/x/text" packages = [ + "collate", + "collate/build", "encoding", "encoding/charmap", "encoding/htmlindex", @@ -313,18 +460,33 @@ "encoding/simplifiedchinese", "encoding/traditionalchinese", "encoding/unicode", + "internal/colltab", "internal/gen", "internal/tag", + "internal/triegen", + "internal/ucd", "internal/utf8internal", "language", "runes", + "secure/bidirule", "transform", + "unicode/bidi", "unicode/cldr", + "unicode/norm", + "unicode/rangetable", ] pruneopts = "UT" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" version = "v0.3.0" +[[projects]] + branch = "master" + digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90" + name = "golang.org/x/time" + packages = ["rate"] + pruneopts = "UT" + revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd" + [solve-meta] analyzer-name = "dep" analyzer-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 8a5a7cb15..3ebf29fac 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,6 +1,6 @@ [[constraint]] name = "github.com/hashicorp/packer" - version = "~1.2" + version = "~1.3" [[constraint]] name = "github.com/vmware/govmomi" @@ -20,6 +20,10 @@ name = "github.com/ugorji/go" revision = "646ae4a518c1c3be0739df898118d9bccf993858" +[[override]] + name = "github.com/cheggaaa/pb" + version = "1" + [prune] go-tests = true unused-packages = true diff --git a/common/config_ssh.go b/common/config_ssh.go index bcb1ef2e0..cd9fdba1c 100644 --- a/common/config_ssh.go +++ b/common/config_ssh.go @@ -18,8 +18,8 @@ func SshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { var auth []ssh.AuthMethod - if comm.SSHPrivateKey != "" { - privateKey, err := ioutil.ReadFile(comm.SSHPrivateKey) + if comm.SSHPrivateKeyFile != "" { + privateKey, err := ioutil.ReadFile(comm.SSHPrivateKeyFile) if err != nil { return nil, fmt.Errorf("Error loading configured private key file: %s", err) } From 8a75761898a860739f3423da42aca89b5ea8bbfb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 18 Dec 2018 01:05:31 +0300 Subject: [PATCH 213/266] use golang 1.11 and modules --- .gitignore | 3 +- .teamcity/settings.kts | 20 +- Gopkg.lock | 516 ----------------------------------------- Gopkg.toml | 29 --- build.sh | 1 - docker-compose.yml | 23 +- go.mod | 71 ++++++ go.sum | 431 ++++++++++++++++++++++++++++++++++ 8 files changed, 527 insertions(+), 567 deletions(-) delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.gitignore b/.gitignore index 6e24c349e..da1a8903c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .idea/ -vendor/ -.vendor-new/ packer-builder-vsphere* bin/ +.env test*.json crash.log diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index bd70696cf..aca65efa4 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -13,11 +13,9 @@ project { description = "https://github.com/jetbrains-infra/packer-builder-vsphere" vcsRoot(GitHub) - buildType(Build) features { - feature { type = "IssueTracker" param("type", "GithubIssues") @@ -35,13 +33,12 @@ object GitHub : GitVcsRoot({ }) object Build : BuildType({ - val path = "src/github.com/jetbrains-infra/packer-builder-vsphere" - val golangImage = "jetbrainsinfra/golang:1.10.4" + val golangImage = "jetbrainsinfra/golang:1.11.4" name = "Build" vcs { - root(GitHub, "+:. => $path") + root(GitHub) } requirements { @@ -52,18 +49,17 @@ object Build : BuildType({ } params { + param("env.GOPATH", "%teamcity.build.checkoutDir%/build/modules") + param("env.GOCACHE", "%teamcity.build.checkoutDir%/build/cache") + password("env.VPN_PASSWORD", "credentialsJSON:8c355e81-9a26-4788-8fea-c854cd646c35") param ("env.VSPHERE_USERNAME", """vsphere65.test\teamcity""") password("env.VSPHERE_PASSWORD", "credentialsJSON:3e99d6c8-b66f-410a-a865-eaf1b12664ad") - - param("env.GOPATH", "%teamcity.build.checkoutDir%") - param("env.GOCACHE", "%teamcity.build.checkoutDir%/build") } steps { script { name = "Build" - workingDir = path scriptContent = "./build.sh" dockerImage = golangImage dockerPull = true @@ -71,12 +67,11 @@ object Build : BuildType({ dockerCompose { name = "Start VPN tunnel" - file = "$path/teamcity-services.yml" + file = "teamcity-services.yml" } script { name = "Test" - workingDir = path scriptContent = """ set -eux @@ -93,7 +88,6 @@ object Build : BuildType({ script { name = "gofmt" executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE - workingDir = path scriptContent = "./gofmt.sh" dockerImage = golangImage dockerPull = true @@ -132,6 +126,6 @@ object Build : BuildType({ } maxRunningBuilds = 2 - artifactRules = "$path/bin/* => packer-builder-vsphere-%build.number%.zip" + artifactRules = "bin/* => packer-builder-vsphere-%build.number%.zip" allowExternalStatus = true }) diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 6c3a5e37f..000000000 --- a/Gopkg.lock +++ /dev/null @@ -1,516 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:bf641dbf159d010db3c6da01311806f3b85a97cf26da3299bfa690ee4caf9ae4" - name = "github.com/Azure/go-ntlmssp" - packages = ["."] - pruneopts = "UT" - revision = "4b934ac9dad38d389d34f0b98d98b2467c422012" - -[[projects]] - branch = "master" - digest = "1:02fd483ec38dfd1231ff5a3a5ff1389042a5bb825da2b1223af0446bb3c05416" - name = "github.com/ChrisTrenkamp/goxpath" - packages = [ - ".", - "internal/execxp", - "internal/execxp/findutil", - "internal/execxp/intfns", - "internal/xsort", - "lexer", - "parser", - "parser/pathexpr", - "tree", - "tree/xmltree", - "tree/xmltree/xmlbuilder", - "tree/xmltree/xmlele", - "tree/xmltree/xmlnode", - "xconst", - ] - pruneopts = "UT" - revision = "c385f95c6022e7756e91beac5f5510872f7dcb7d" - -[[projects]] - digest = "1:94cad6e2359d57da6652e689189c5b6ef19f99db6304d2c41de54f6632e15143" - name = "github.com/cheggaaa/pb" - packages = ["."] - pruneopts = "UT" - revision = "1cc5bbe20449079337944d56292c7383510c534c" - version = "v1.0.27" - -[[projects]] - digest = "1:12d4bc32014d9755850a247c43981d4b616f99c94f86247df2d6187511bfad8b" - name = "github.com/dylanmei/iso8601" - packages = ["."] - pruneopts = "UT" - revision = "2075bf119b58e5576c6ed9f867b8f3d17f2e54d4" - version = "v0.1.0" - -[[projects]] - branch = "master" - digest = "1:4a0c6bb4805508a6287675fac876be2ac1182539ca8a32468d8128882e9d5009" - name = "github.com/golang/snappy" - packages = ["."] - pruneopts = "UT" - revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a" - -[[projects]] - digest = "1:bfc483a051d3c7185ebeaa41b5bb67a4f76e742217bcaeab5661cc4b1320f392" - name = "github.com/hashicorp/consul" - packages = ["api"] - pruneopts = "UT" - revision = "0bddfa23a2ebe3c0773d917fc104f53d74f7a5ec" - version = "v1.4.0" - -[[projects]] - branch = "master" - digest = "1:07671f8997086ed115824d1974507d2b147d1e0463675ea5dbf3be89b1c2c563" - name = "github.com/hashicorp/errwrap" - packages = ["."] - pruneopts = "UT" - revision = "7554cd9344cec97297fa6649b055a8c98c2a1e55" - -[[projects]] - branch = "master" - digest = "1:075de3352ee3366e02ab1547a3a6d9149d9fc85419212deb126baee9976a4dc5" - name = "github.com/hashicorp/go-checkpoint" - packages = ["."] - pruneopts = "UT" - revision = "1545e56e46dec3bba264e41fde2c1e2aa65b5dd4" - -[[projects]] - branch = "master" - digest = "1:77cb3be9b21ba7f1a4701e870c84ea8b66e7d74c7c8951c58155fdadae9414ec" - name = "github.com/hashicorp/go-cleanhttp" - packages = ["."] - pruneopts = "UT" - revision = "d5fe4b57a186c716b0e00b8c301cbd9b4182694d" - -[[projects]] - branch = "master" - digest = "1:e5048c5da80697be2fcdecc944e29d2999e01fd7f48b643168443209779f3463" - name = "github.com/hashicorp/go-multierror" - packages = ["."] - pruneopts = "UT" - revision = "b7773ae218740a7be65057fc60b366a49b538a44" - -[[projects]] - digest = "1:4112546e6964796e1c92a9ffdea8fd7ae81ffbf81eda4f946f50937e178f53da" - name = "github.com/hashicorp/go-retryablehttp" - packages = ["."] - pruneopts = "UT" - revision = "4502c0ecdaf0b50d857611af23831260f99be6bf" - version = "v0.5.0" - -[[projects]] - branch = "master" - digest = "1:45aad874d3c7d5e8610427c81870fb54970b981692930ec2a319ce4cb89d7a00" - name = "github.com/hashicorp/go-rootcerts" - packages = ["."] - pruneopts = "UT" - revision = "6bb64b370b90e7ef1fa532be9e591a81c3493e00" - -[[projects]] - branch = "master" - digest = "1:14f2005c31ddf99c4a0f36fc440f8d1ac43224194c7c4a904b3c8f4ba5654d0b" - name = "github.com/hashicorp/go-sockaddr" - packages = ["."] - pruneopts = "UT" - revision = "6d291a969b86c4b633730bfc6b8b9d64c3aafed9" - -[[projects]] - branch = "master" - digest = "1:354978aad16c56c27f57e5b152224806d87902e4935da3b03e18263d82ae77aa" - name = "github.com/hashicorp/go-uuid" - packages = ["."] - pruneopts = "UT" - revision = "27454136f0364f2d44b1276c552d69105cf8c498" - -[[projects]] - branch = "master" - digest = "1:e12b92b8bb20af6e299e9829534cfe790857702a988d3f0443e772c9d82a4fd2" - name = "github.com/hashicorp/go-version" - packages = ["."] - pruneopts = "UT" - revision = "23480c0665776210b5fbbac6eaaee40e3e6a96b7" - -[[projects]] - digest = "1:ea40c24cdbacd054a6ae9de03e62c5f252479b96c716375aace5c120d68647c8" - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token", - ] - pruneopts = "UT" - revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" - version = "v1.0.0" - -[[projects]] - digest = "1:fc1a33d56641cb6cc14766a1e7c976aac33f3e18ecf43dfa1cf20b937ed1eb60" - name = "github.com/hashicorp/packer" - packages = [ - "common", - "common/uuid", - "communicator/none", - "communicator/ssh", - "communicator/winrm", - "helper/builder/testing", - "helper/common", - "helper/communicator", - "helper/config", - "helper/multistep", - "helper/ssh", - "helper/useragent", - "packer", - "packer/plugin", - "packer/rpc", - "template", - "template/interpolate", - "version", - ] - pruneopts = "UT" - revision = "508b6efb4ababd3efa3614033f9529a30970899d" - version = "v1.3.3" - -[[projects]] - digest = "1:0dd7b7b01769f9df356dc99f9e4144bdbabf6c79041ea7c0892379c5737f3c44" - name = "github.com/hashicorp/serf" - packages = ["coordinate"] - pruneopts = "UT" - revision = "d6574a5bb1226678d7010325fb6c985db20ee458" - version = "v0.8.1" - -[[projects]] - digest = "1:ac52144f192f9c6a37ac9d0abdb9c837da80446a25a881db2b63c04e1259bd8a" - name = "github.com/hashicorp/vault" - packages = [ - "api", - "helper/compressutil", - "helper/consts", - "helper/hclutil", - "helper/jsonutil", - "helper/parseutil", - "helper/strutil", - ] - pruneopts = "UT" - revision = "08df121c8b9adcc2b8fd55fc8506c3f9714c7e61" - version = "v1.0.1" - -[[projects]] - branch = "master" - digest = "1:a4826c308e84f5f161b90b54a814f0be7d112b80164b9b884698a6903ea47ab3" - name = "github.com/hashicorp/yamux" - packages = ["."] - pruneopts = "UT" - revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" - -[[projects]] - digest = "1:9cedee824c21326bd26950bd9e1ffe9dc4e7ca03dc8634d0e6f954ee6a383172" - name = "github.com/kr/fs" - packages = ["."] - pruneopts = "UT" - revision = "1455def202f6e05b95cc7bfc7e8ae67ae5141eba" - version = "v0.1.0" - -[[projects]] - branch = "master" - digest = "1:2773a3d38a10f76a8ac624d50b8d6d42ab3e50224841e3c225b4aee2dc4921ba" - name = "github.com/masterzen/azure-sdk-for-go" - packages = [ - "core/http", - "core/tls", - ] - pruneopts = "UT" - revision = "ee4f0065d00cd12b542f18f5bc45799e88163b12" - -[[projects]] - branch = "master" - digest = "1:a7c1ab68a6cdeffcb148dc0d8b92c897f034aa38f58b69eab9bc6e77645b26fb" - name = "github.com/masterzen/simplexml" - packages = ["dom"] - pruneopts = "UT" - revision = "4572e39b1ab9fe03ee513ce6fc7e289e98482190" - -[[projects]] - branch = "master" - digest = "1:21990ab65086d054855aea2761ff39033a4dc083e4c4b6cb4ba1601fbf3fe91a" - name = "github.com/masterzen/winrm" - packages = [ - ".", - "soap", - ] - pruneopts = "UT" - revision = "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb" - -[[projects]] - digest = "1:0356f3312c9bd1cbeda81505b7fd437501d8e778ab66998ef69f00d7f9b3a0d7" - name = "github.com/mattn/go-runewidth" - packages = ["."] - pruneopts = "UT" - revision = "3ee7d812e62a0804a7d0a324e0249ca2db3476d3" - version = "v0.0.4" - -[[projects]] - branch = "master" - digest = "1:81ffc98d4d2eff80630938db171f5b8936959cd8cefdbf2d22b2f4924aa953dc" - name = "github.com/mitchellh/go-fs" - packages = [ - ".", - "fat", - ] - pruneopts = "UT" - revision = "b7b9ca407ffff465de12fc37ccbb81ea8b428c43" - -[[projects]] - digest = "1:78bbb1ba5b7c3f2ed0ea1eab57bdd3859aec7e177811563edc41198a760b06af" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - pruneopts = "UT" - revision = "ae18d6b8b3205b561c79e8e5f69bff09736185f4" - version = "v1.0.0" - -[[projects]] - branch = "master" - digest = "1:041bb70411ef6945901c63cab3bfd6a1a1de88352359ad0e6e1e86478a53d0ec" - name = "github.com/mitchellh/iochan" - packages = ["."] - pruneopts = "UT" - revision = "87b45ffd0e9581375c491fef3d32130bb15c5bd7" - -[[projects]] - branch = "master" - digest = "1:e730597b38a4d56e2361e0b6236cb800e52c73cace2ff91396f4ff35792ddfa7" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - pruneopts = "UT" - revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b" - -[[projects]] - branch = "master" - digest = "1:012bcbda750df8b57e302656a0820833eaa98009a7546b22620283c65996743b" - name = "github.com/mitchellh/reflectwalk" - packages = ["."] - pruneopts = "UT" - revision = "63d60e9d0dbc60cf9164e6510889b0db6683d98c" - -[[projects]] - branch = "master" - digest = "1:0e1e5f960c58fdc677212fcc70e55042a0084d367623e51afbdb568963832f5d" - name = "github.com/nu7hatch/gouuid" - packages = ["."] - pruneopts = "UT" - revision = "179d4d0c4d8d407a32af483c2354df1d2c91e6c3" - -[[projects]] - branch = "master" - digest = "1:b001460ea94194a5d9961274289ff5b64af7eeb724c474ce6188a4eb33bd2a0f" - name = "github.com/packer-community/winrmcp" - packages = ["winrmcp"] - pruneopts = "UT" - revision = "81144009af586de8e7729b829266f09dd0d59701" - -[[projects]] - digest = "1:e39a5ee8fcbec487f8fc68863ef95f2b025e0739b0e4aa55558a2b4cf8f0ecf0" - name = "github.com/pierrec/lz4" - packages = [ - ".", - "internal/xxh32", - ] - pruneopts = "UT" - revision = "635575b42742856941dbc767b44905bb9ba083f6" - version = "v2.0.7" - -[[projects]] - digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "UT" - revision = "645ef00459ed84a119197bfb8d8205042c6df63d" - version = "v0.8.0" - -[[projects]] - digest = "1:c3f75b2d37dbd9173203874d4767ca7241645a74a74d9bb3d0913dc15758a699" - name = "github.com/pkg/sftp" - packages = ["."] - pruneopts = "UT" - revision = "d2aa419835609d317c34baae11bc345d1f9971a7" - version = "1.7.0" - -[[projects]] - branch = "master" - digest = "1:454ab66154b169f4ed5a3ea52a7fe63bd6e28700e73748e617f2c66b1f1ed078" - name = "github.com/rwtodd/Go.Sed" - packages = ["sed"] - pruneopts = "UT" - revision = "d6d5d585814e4c3560c684f52e3d8aeed721313d" - -[[projects]] - digest = "1:0e792eea6c96ec55ff302ef33886acbaa5006e900fefe82689e88d96439dcd84" - name = "github.com/ryanuber/go-glob" - packages = ["."] - pruneopts = "UT" - revision = "572520ed46dbddaed19ea3d9541bdd0494163693" - version = "v0.1" - -[[projects]] - digest = "1:48b859865fccf8a7f171535e1b9f4803057697e72aeab7f762b65fabd1ab5aa0" - name = "github.com/ugorji/go" - packages = ["codec"] - pruneopts = "UT" - revision = "646ae4a518c1c3be0739df898118d9bccf993858" - -[[projects]] - digest = "1:ee0b246399296b6a34a6e0a482f1ad2db96a3c8a14fe73e34fcfeab3fc547c9d" - name = "github.com/vmware/govmomi" - packages = [ - ".", - "find", - "list", - "nfc", - "object", - "property", - "session", - "task", - "vim25", - "vim25/debug", - "vim25/methods", - "vim25/mo", - "vim25/progress", - "vim25/soap", - "vim25/types", - "vim25/xml", - ] - pruneopts = "UT" - revision = "3617f28d167d448f93f282a867870f109516d2a5" - version = "v0.19.0" - -[[projects]] - branch = "master" - digest = "1:44a0ce1659d8e5c7f794588d1fe1fe22aad10e0ff1304f5b4c16bba5013efec3" - name = "golang.org/x/crypto" - packages = [ - "curve25519", - "ed25519", - "ed25519/internal/edwards25519", - "internal/chacha20", - "md4", - "poly1305", - "ssh", - "ssh/agent", - ] - pruneopts = "UT" - revision = "2d027ae1dddd4694d54f7a8b6cbe78dca8720226" - -[[projects]] - branch = "master" - digest = "1:59d8417bed34c76b8767308835b267be5e2a5fe5b5b497194ef7c9196ce4b7ab" - name = "golang.org/x/mobile" - packages = ["event/key"] - pruneopts = "UT" - revision = "274da161099df258cb919e10e9fd0ae401e143a8" - -[[projects]] - branch = "master" - digest = "1:0677f6b5581c61d12a5d913ca6a52c3fdb618af050112476b6f4700a6d52c4de" - name = "golang.org/x/net" - packages = [ - "html", - "html/atom", - "html/charset", - "http/httpguts", - "http2", - "http2/hpack", - "idna", - "internal/socks", - "proxy", - ] - pruneopts = "UT" - revision = "2491c5de3490fced2f6cff376127c667efeed857" - -[[projects]] - branch = "master" - digest = "1:48a949ee15f5f03524b792547822221b07f828dd26522b5e08688f25a10d14c1" - name = "golang.org/x/sys" - packages = ["unix"] - pruneopts = "UT" - revision = "dcdaa6325bcb8d3c07805583fe12153f08a41e2b" - -[[projects]] - digest = "1:436b24586f8fee329e0dd65fd67c817681420cda1d7f934345c13fe78c212a73" - name = "golang.org/x/text" - packages = [ - "collate", - "collate/build", - "encoding", - "encoding/charmap", - "encoding/htmlindex", - "encoding/internal", - "encoding/internal/identifier", - "encoding/japanese", - "encoding/korean", - "encoding/simplifiedchinese", - "encoding/traditionalchinese", - "encoding/unicode", - "internal/colltab", - "internal/gen", - "internal/tag", - "internal/triegen", - "internal/ucd", - "internal/utf8internal", - "language", - "runes", - "secure/bidirule", - "transform", - "unicode/bidi", - "unicode/cldr", - "unicode/norm", - "unicode/rangetable", - ] - pruneopts = "UT" - revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" - version = "v0.3.0" - -[[projects]] - branch = "master" - digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90" - name = "golang.org/x/time" - packages = ["rate"] - pruneopts = "UT" - revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/hashicorp/packer/common", - "github.com/hashicorp/packer/communicator/ssh", - "github.com/hashicorp/packer/helper/builder/testing", - "github.com/hashicorp/packer/helper/communicator", - "github.com/hashicorp/packer/helper/config", - "github.com/hashicorp/packer/helper/multistep", - "github.com/hashicorp/packer/packer", - "github.com/hashicorp/packer/packer/plugin", - "github.com/hashicorp/packer/template/interpolate", - "github.com/vmware/govmomi", - "github.com/vmware/govmomi/find", - "github.com/vmware/govmomi/object", - "github.com/vmware/govmomi/session", - "github.com/vmware/govmomi/vim25", - "github.com/vmware/govmomi/vim25/methods", - "github.com/vmware/govmomi/vim25/mo", - "github.com/vmware/govmomi/vim25/soap", - "github.com/vmware/govmomi/vim25/types", - "golang.org/x/crypto/ssh", - "golang.org/x/mobile/event/key", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 3ebf29fac..000000000 --- a/Gopkg.toml +++ /dev/null @@ -1,29 +0,0 @@ -[[constraint]] - name = "github.com/hashicorp/packer" - version = "~1.3" - -[[constraint]] - name = "github.com/vmware/govmomi" - version = "~0.19" - -[[override]] - name = "github.com/masterzen/azure-sdk-for-go" - branch = "master" - -# need commit https://github.com/ChrisTrenkamp/goxpath/commit/e2e5bcefc4e07f4a0c587a1200c22665dd39bd0e -[[override]] - name = "github.com/ChrisTrenkamp/goxpath" - branch = "master" - -# Plugin's RPC client uses the same version of a codec as a server in Packer core -[[override]] - name = "github.com/ugorji/go" - revision = "646ae4a518c1c3be0739df898118d9bccf993858" - -[[override]] - name = "github.com/cheggaaa/pb" - version = "1" - -[prune] - go-tests = true - unused-packages = true diff --git a/build.sh b/build.sh index 0dbd69148..7b61248e3 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,6 @@ set -eux -dep ensure export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin diff --git a/docker-compose.yml b/docker-compose.yml index 7f428cbed..191ca53cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,27 @@ version: '2' services: build: - image: jetbrainsinfra/golang:1.10.4 + image: jetbrainsinfra/golang:1.11.4 volumes: - - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere - working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere + - .:/work + - modules:/go/pkg/mod + - cache:/root/.cache + working_dir: /work command: ./build.sh test: - image: jetbrainsinfra/golang:1.10.4 + image: jetbrainsinfra/golang:1.11.4 volumes: - - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere - working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere + - .:/work + - modules:/go/pkg/mod + - cache:/root/.cache + working_dir: /work # network_mode: "container:vpn" + environment: + VSPHERE_USERNAME: + VSPHERE_PASSWORD: command: ./test.sh + +volumes: + modules: + cache: diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..07fec712b --- /dev/null +++ b/go.mod @@ -0,0 +1,71 @@ +module github.com/jetbrains-infra/packer-builder-vsphere + +require ( + github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect + github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 // indirect + github.com/Jeffail/gabs v1.1.1 // indirect + github.com/Microsoft/go-winio v0.4.11 // indirect + github.com/NYTimes/gziphandler v1.0.1 // indirect + github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect + github.com/SAP/go-hdb v0.13.1 // indirect + github.com/SermoDigital/jose v0.9.1 // indirect + github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf // indirect + github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect + github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect + github.com/cenkalti/backoff v2.1.0+incompatible // indirect + github.com/circonus-labs/circonus-gometrics v2.2.5+incompatible // indirect + github.com/circonus-labs/circonusllhist v0.1.3 // indirect + github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 // indirect + github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.3.3 // indirect + github.com/duosecurity/duo_api_golang v0.0.0-20181210160733-61e0defebf22 // indirect + github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect + github.com/fatih/color v1.7.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/go-ldap/ldap v2.5.1+incompatible // indirect + github.com/go-sql-driver/mysql v1.4.1 // indirect + github.com/go-test/deep v1.0.1 // indirect + github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b // indirect + github.com/gogo/protobuf v1.2.0 // indirect + github.com/google/go-github v17.0.0+incompatible // indirect + github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect + github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f // indirect + github.com/hashicorp/go-memdb v0.0.0-20181108192425-032f93b25bec // indirect + github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect + github.com/hashicorp/go-plugin v0.0.0-20181212150838-f444068e8f5a // indirect + github.com/hashicorp/memberlist v0.1.0 // indirect + github.com/hashicorp/packer v1.3.3 + github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e // indirect + github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee // indirect + github.com/keybase/go-crypto v0.0.0-20181127160227-255a5089e85a // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/lib/pq v1.0.0 // indirect + github.com/mattn/go-colorable v0.0.9 // indirect + github.com/miekg/dns v1.1.1 // indirect + github.com/mitchellh/copystructure v1.0.0 // indirect + github.com/mitchellh/go-testing-interface v1.0.0 // indirect + github.com/onsi/ginkgo v1.7.0 // indirect + github.com/onsi/gomega v1.4.3 // indirect + github.com/opencontainers/go-digest v1.0.0-rc1 // indirect + github.com/opencontainers/image-spec v1.0.1 // indirect + github.com/opencontainers/runc v0.1.1 // indirect + github.com/ory/dockertest v3.3.2+incompatible // indirect + github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect + github.com/patrickmn/go-cache v2.1.0+incompatible // indirect + github.com/prometheus/client_golang v0.9.2 // indirect + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect + github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect + github.com/vmware/govmomi v0.19.0 + golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4 + golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8 + google.golang.org/grpc v1.17.0 // indirect + gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect + gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect + gopkg.in/cheggaaa/pb.v1 v1.0.27 // indirect + gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect + gopkg.in/ldap.v2 v2.5.1 // indirect + gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect + gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect + gotest.tools v2.2.0+incompatible // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..5d2c15c59 --- /dev/null +++ b/go.sum @@ -0,0 +1,431 @@ +cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1 h1:RMTyvS5bjvSWiUcfqfr/E2pxHEMrALvU+E12n6biymg= +github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1/go.mod h1:61apmbkVJH4kg+38ftT+/l0XxdUCVnHggqcOTqZRSEE= +github.com/Azure/azure-sdk-for-go v17.3.1+incompatible h1:9Nzge8xxnYm5lVRkvTpG1odiDN0fYDorQwVEaVfg1+g= +github.com/Azure/azure-sdk-for-go v17.3.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-autorest v10.12.0+incompatible h1:6YphwUK+oXbzvCc1fd5VrnxCekwzDkpA7gUEbci2MvI= +github.com/Azure/go-autorest v10.12.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA= +github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= +github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290 h1:K9I21XUHNbYD3GNMmJBN0UKJCpdP+glftwNZ7Bo8kqY= +github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= +github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 h1:dmc/C8bpE5VkQn65PNbbyACDC8xw8Hpp/NEurdPmQDQ= +github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= +github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= +github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q= +github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0= +github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591 h1:/P9HCl71+Eh6vDbKNyRu+rpIIR70UCZWNOGexVV3e6k= +github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591/go.mod h1:EHGzQGbwozJBj/4qj3WGrTJ0FqjgOTOxLQ0VNWvPn08= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/SAP/go-hdb v0.13.1 h1:BuZlUZtqbF/oVSQ8Vp+/+wOtcBLh55zwMV7XnvYcz8g= +github.com/SAP/go-hdb v0.13.1/go.mod h1:etBT+FAi1t5k3K3tf5vQTnosgYmhDkRi8jEnQqCnxF0= +github.com/SermoDigital/jose v0.9.1 h1:atYaHPD3lPICcbK1owly3aPm0iaJGSGPi0WD4vLznv8= +github.com/SermoDigital/jose v0.9.1/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA= +github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f h1:jI4DIE5Vf4oRaHfthB0oRhU+yuYuoOTurDzwAlskP00= +github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= +github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd h1:S3Fr6QnkpW9VRjiEY4psQHhhbbahASuNVj52YIce7lI= +github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607 h1:BFFG6KP8ASFBg2ptWsJn8p8RDufBjBDKIxLU7BTYGOM= +github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= +github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43/go.mod h1:S6puKjZ9ZeqUPBv2hEBnMZGcM2J6mOsDRQcmxkMAND0= +github.com/armon/go-metrics v0.0.0-20180713145231-3c58d8115a78 h1:mdRSArcFLfW0VoL34LZAKSz6LkkK4jFxVx2xYavACMg= +github.com/armon/go-metrics v0.0.0-20180713145231-3c58d8115a78/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20160115234725-4239b77079c7 h1:MBXhrxjNkjdqJysfNbKMMPFNXlz6EzpOnPcsoYBeD3E= +github.com/armon/go-radix v0.0.0-20160115234725-4239b77079c7/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/aws/aws-sdk-go v1.15.54 h1:yNFryYgHYlEuNnMM74EZgAaOM2BsJvu77/ev9I9GHlU= +github.com/aws/aws-sdk-go v1.15.54/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/bgentry/speakeasy v0.0.0-20150902231413-36e9cfdd6909 h1:mUVWHQ4tjVv86uJhxSbYqwdz4o+Imcl6HoZtoaqC3zM= +github.com/bgentry/speakeasy v0.0.0-20150902231413-36e9cfdd6909/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3 h1:3b+p838vN4sc37brz9W2HDphtSwZFcXZwFLyzm5Vk28= +github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3/go.mod h1:YOY5xnRf7Jz2SZCLSKgVfyqNzbRgyTznM3HyDqQMxcU= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/cenkalti/backoff v2.1.0+incompatible h1:FIRvWBZrzS4YC7NT5cOuZjexzFvIr+Dbi6aD1cZaNBk= +github.com/cenkalti/backoff v2.1.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cheggaaa/pb v1.0.26 h1:cxVZXxXCTNW7yYwnrTAhJ42LcWrLjp676j+y1AmmLKA= +github.com/cheggaaa/pb v1.0.26/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/circonus-labs/circonus-gometrics v2.2.5+incompatible h1:KsuY3ogbxgVv3FNhbLUoT+SE9znoWEUIuChSIT4HukI= +github.com/circonus-labs/circonus-gometrics v2.2.5+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 h1:4BX8f882bXEDKfWIf0wa8HRvpnBoPszJJXL+TVbBw4M= +github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/creack/goselect v0.0.0-20180210034346-528c74964609 h1:FSxXMd2wCHj6GqgBdo4UtVA9R2aieIDvSniepqyOppU= +github.com/creack/goselect v0.0.0-20180210034346-528c74964609/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/FHysWyE= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f h1:WH0w/R4Yoey+04HhFxqZ6VX6I0d7RMyw5aXQ9UTvQPs= +github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc= +github.com/denverdino/aliyungo v0.0.0-20180417075537-ebad04655e03 h1:NYqwUkb/ypX8OZmBDpPPbZ4npAPjlGFXZ4aSOyRzRL8= +github.com/denverdino/aliyungo v0.0.0-20180417075537-ebad04655e03/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/digitalocean/godo v0.0.0-20170407151542-4c04abe183f4 h1:34XBbvedApvUMZY6E6Q95ksnpl+FtX+KF3ywZzZY6X0= +github.com/digitalocean/godo v0.0.0-20170407151542-4c04abe183f4/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= +github.com/docker/docker v0.0.0-20170406124027-fa3e2d5ab9b5 h1:DwY2bFs8p+xf2WaQewx2hnGdjYR5K4UAaxcNPyKkTek= +github.com/docker/docker v0.0.0-20170406124027-fa3e2d5ab9b5/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/duosecurity/duo_api_golang v0.0.0-20181210160733-61e0defebf22 h1:RqZJa9Ohzpyr5OADCKz/8t0vtdD2vczMdjqCbvTYz7o= +github.com/duosecurity/duo_api_golang v0.0.0-20181210160733-61e0defebf22/go.mod h1:UqXY1lYT/ERa4OEAywUqdok1T4RCRdArkhic1Opuavo= +github.com/dustin/go-humanize v0.0.0-20170228161531-259d2a102b87 h1:uPzP/9GIqYKvZAmz4IayKMMZiWRWNtGynUREBtTXPXA= +github.com/dustin/go-humanize v0.0.0-20170228161531-259d2a102b87/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI= +github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= +github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY= +github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= +github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= +github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-ini/ini v1.25.4 h1:Mujh4R/dH6YL8bxuISne3xX2+qcQ9p0IxKAP6ExWoUo= +github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-ldap/ldap v2.5.1+incompatible h1:Opaoft5zMW8IU/VRULB0eGMBQ9P5buRvCW6sFTRmMn8= +github.com/go-ldap/ldap v2.5.1+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= +github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg= +github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b h1:dnUw9Ih14dCKzbtZxm+pwQRYIb+9ypiwtZgsCQN4zmg= +github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= +github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v0.0.0-20160203230820-b982704f8bb7 h1:rZeVhHkNPzCCDNLr2eGTqph0njsIaj0lSLiuSnMdtrE= +github.com/golang/protobuf v0.0.0-20160203230820-b982704f8bb7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.0.0-20180328201512-5411ab924f9f h1:e7go61E2Xh2l5KtL3Lh6Tjy0/T+eem0bQsDwETI7SMo= +github.com/google/go-cmp v0.0.0-20180328201512-5411ab924f9f/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1 h1:ULA7QZ5KGgwOBeBBCA7Xyv96fmriEfhs0D2KDRslTd8= +github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 h1:JM174NTeGNJ2m/oLH3UOWOvWQQKd+BoL3hcSCUWFLt0= +github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= +github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d h1:rXQlD9GXkjA/PQZhmEaF/8Pj/sJfdZJK7GJG0gkS8I0= +github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gophercloud/gophercloud v0.0.0-20180815020510-83835c772d1a h1:BYGFl3ozKqWP2FnV4hyr8pNvBBLvyoREM4H6Un75wQ4= +github.com/gophercloud/gophercloud v0.0.0-20180815020510-83835c772d1a/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= +github.com/gophercloud/utils v0.0.0-20180806215700-d6e28a8b3199 h1:mmwryCmmFkCxL3t5r6syrbk1eyP6tP9q/whDdAiM9Mw= +github.com/gophercloud/utils v0.0.0-20180806215700-d6e28a8b3199/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= +github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777 h1:JIM+OacoOJRU30xpjMf8sulYqjr0ViA3WDrTX6j/yDI= +github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= +github.com/hashicorp/atlas-go v0.0.0-20170808162531-17522f63497e/go.mod h1:ckHDuH0pxfnmXZkq1niVSguIIV0pA65gifQv3so9llw= +github.com/hashicorp/consul v0.0.0-20180807174550-3e6313bebbf0 h1:vh/G7ew4mi/FcKNrRk4x1N1fWYzYB5/AaSHr9W+wrF4= +github.com/hashicorp/consul v0.0.0-20180807174550-3e6313bebbf0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8= +github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4= +github.com/hashicorp/go-cleanhttp v0.0.0-20160217214820-875fb671b3dd h1:g63OFYSdtNzMg+OszHIUmlRweTB2syHVsZDBKoa1km8= +github.com/hashicorp/go-cleanhttp v0.0.0-20160217214820-875fb671b3dd/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= +github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f h1:Yv9YzBlAETjy6AOX9eLBZ3nshNVRREgerT/3nvxlGho= +github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa h1:0nA8i+6Rwqaq9xlpmVxxTwk6rxiEhX+E6Wh4vPNHiS8= +github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa/go.mod h1:6ij3Z20p+OhOkCSrA0gImAWoHYQRGbnlcuk6XYTiaRw= +github.com/hashicorp/go-memdb v0.0.0-20181108192425-032f93b25bec h1:A1nDk9UOKWPTQh5YcCnbwNbqj23e5pggf4HxGBulhr8= +github.com/hashicorp/go-memdb v0.0.0-20181108192425-032f93b25bec/go.mod h1:kbfItVoBJwCfKXDXN4YoAXjxcFVZ7MRrJzyTX6H4giE= +github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c h1:BTAbnbegUIMB6xmQCwWE8yRzbA4XSpnZY5hvRJC188I= +github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v0.0.0-20150916205742-d30f09973e19 h1:gb61U/o4ZJ6TRYvZqJUKYidIhJOEAvNyVMesryROxAY= +github.com/hashicorp/go-multierror v0.0.0-20150916205742-d30f09973e19/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79 h1:RKu7yAXZTaQsxj1K9GDsh+QVw0+Wu1SWHxtbFN0n+hE= +github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79/go.mod h1:09jT3Y/OIsjTjQ2+3bkVNPDKqWcGIYYvjB2BEKVUdvc= +github.com/hashicorp/go-plugin v0.0.0-20181212150838-f444068e8f5a h1:z9eTtDWoxYrJvtAD+xAepmTEfEmYgouWUytJ84UWAr8= +github.com/hashicorp/go-plugin v0.0.0-20181212150838-f444068e8f5a/go.mod h1:Ft7ju2vWzhO0ETMKUVo12XmXmII6eSUS4rsPTkY/siA= +github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 h1:qCv4319q2q7XKn0MQbi8p37hsJ+9Xo8e6yojA73JVxk= +github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM= +github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 h1:VBj0QYQ0u2MCJzBfeYXGexnAl17GsH1yidnoxCqqD9E= +github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90/go.mod h1:o4zcYY1e0GEZI6eSEr+43QDYmuGglw1qSO6qdHUHCgg= +github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 h1:7YOlAIO2YWnJZkQp7B5eFykaIY7C9JndqAFQyVV5BhM= +github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-uuid v0.0.0-20160329185618-73d19cdc2bf0 h1:YnYV/qHLtjZmhFnWaSsNqVAUhxCuPKRe5wDGpOKYL/U= +github.com/hashicorp/go-uuid v0.0.0-20160329185618-73d19cdc2bf0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v0.0.0-20160119211326-7e3c02b30806 h1:0MKTKHll8VOZ0ciR+yTIEJ8JrT0UUiRDsgtujJT7a8U= +github.com/hashicorp/go-version v0.0.0-20160119211326-7e3c02b30806/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47 h1:UnszMmmmm5vLwWzDjTFVIkfhvWF1NdrmChl8L2NUDCw= +github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno= +github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= +github.com/hashicorp/memberlist v0.1.0 h1:qSsCiC0WYD39lbSitKNt40e30uorm2Ss/d4JGU1hzH8= +github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE= +github.com/hashicorp/packer v1.3.3 h1:LDQT1TT5Dye95RSQKp64bgq2lqjdXawVDjui4KX2hFQ= +github.com/hashicorp/packer v1.3.3/go.mod h1:zcRQ0hJ98C2QTp7ugB1qJb0Ng9zk+L8/o2UyAfWvmzk= +github.com/hashicorp/serf v0.0.0-20180530155958-984a73625de3 h1:NUr1hG6WO9sI1x8ofSimmpqfJ+rEHiHP/PLEA33rcfQ= +github.com/hashicorp/serf v0.0.0-20180530155958-984a73625de3/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= +github.com/hashicorp/vault v0.0.0-20180724215049-b9adaf9c6959 h1:PyVs2CB7Hxgl1kU0tWAVpagLK3N+MC0eeyKmG+L5VPI= +github.com/hashicorp/vault v0.0.0-20180724215049-b9adaf9c6959/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= +github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e h1:2Hwd2Yi0/qjAC6ujOu6WBVXAak9Snuw0LTYdZkqIdKM= +github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e/go.mod h1:VJHHT2SC1tAPrfENQeBhLlb5FbZoKZM+oC/ROmEftz0= +github.com/hashicorp/yamux v0.0.0-20151129044643-df949784da9e h1:R35YxgX/iWqsDjzoNO/7uFf8vjcgBIc02rvaV/Vr15c= +github.com/hashicorp/yamux v0.0.0-20151129044643-df949784da9e/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= +github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hetznercloud/hcloud-go v0.0.0-20181016094819-eaf050e4f370 h1:I1Qmx2XRn+A6wNYJErMKlvC1NQxVlu4D21Dq6F7A1x8= +github.com/hetznercloud/hcloud-go v0.0.0-20181016094819-eaf050e4f370/go.mod h1:g5pff0YNAZywQaivY/CmhUYFVp7oP0nu3MiODC2W4Hw= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee h1:AQ/QmCk6x8ECPpf2pkPtA4lyncEEBbs8VFnVXPYKhIs= +github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee/go.mod h1:N0t2vlmpe8nyZB5ouIbJQPDSR+mH6oe7xHB9VZHSUzM= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564 h1:+HMa2xWQOm+9ebsl0+XsuLaPuFCxExv3sCXo5psVzYI= +github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= +github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro= +github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= +github.com/keybase/go-crypto v0.0.0-20181127160227-255a5089e85a h1:X/UFlwD2/UV0RCy+8ITi4DmxJwk83YUH7bXwkJIHHMo= +github.com/keybase/go-crypto v0.0.0-20181127160227-255a5089e85a/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77 h1:rJnR80lkojFgjdg/oQPhbZoY8t8uM51XMz8DrJrjabk= +github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v0.0.0-20160106104451-349c67577817 h1:/7pPahIC+GoCm/euDCi2Pm29bAj9tc6TcK4Zcc8D3WI= +github.com/klauspost/cpuid v0.0.0-20160106104451-349c67577817/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f h1:UD9YLTi2aBhdOOThzatodQ/pGd9nd5255swS+UzHZj4= +github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= +github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec h1:PYqF3Tiz2W2Ag0ezyDhAobWDWlrFv7U+qct4spLeDBM= +github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= +github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= +github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c h1:FMUOnVGy8nWk1cvlMCAoftRItQGMxI0vzJ3dQjeZTCE= +github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= +github.com/masterzen/simplexml v0.0.0-20140219194429-95ba30457eb1 h1:cLEbk5d4t8CDqmQtCMc2lk91cflxOrj31k9LTIabPoA= +github.com/masterzen/simplexml v0.0.0-20140219194429-95ba30457eb1/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/winrm v0.0.0-20180224160350-7e40f93ae939 h1:cRFHA33ER97Xy5jmjS519OXCS/yE3AT3zdbQAg0Z53g= +github.com/masterzen/winrm v0.0.0-20180224160350-7e40f93ae939/go.mod h1:CfZSN7zwz5gJiFhZJz49Uzk7mEBHIceWmbFmYx7Hf7E= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.0-20151211000621-56b76bdf51f7 h1:owMyzMR4QR+jSdlfkX9jPU3rsby4++j99BfbtgVr6ZY= +github.com/mattn/go-isatty v0.0.0-20151211000621-56b76bdf51f7/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.0-20170510074858-97311d9f7767 h1:Nk2R0tWpD2RdkQ+53zE6kWnSGuhQyDlnOs2MPiqVubE= +github.com/mattn/go-runewidth v0.0.0-20170510074858-97311d9f7767/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.1.1 h1:DVkblRdiScEnEr0LR9nTnEQqHYycjkXW9bOjd+2EL2o= +github.com/miekg/dns v1.1.1/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v0.0.0-20170908181043-65fcae5817c8 h1:ZPmOsqSxGDUqFp0ErYpJDIfaBRBGvQv0qDPr37kZBrk= +github.com/mitchellh/cli v0.0.0-20170908181043-65fcae5817c8/go.mod h1:oGumspjLm2kTyiT1QMGpFqRlmxnKHfCvhZEVnx+5UeE= +github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7 h1:PXPMDtfqV+rZJshQHOiwUFqlqErXaAcuWy+/ZmyRfNc= +github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7/go.mod h1:g7SZj7ABpStq3tM4zqHiVEG5un/DZ1+qJJKO7qx1EvU= +github.com/mitchellh/go-homedir v0.0.0-20151025052427-d682a8f0cf13 h1:VWOqu/UItbEBupQwKkabbfnoEbgAE4IGjZBH2MFx8jY= +github.com/mitchellh/go-homedir v0.0.0-20151025052427-d682a8f0cf13/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed h1:FI2NIv6fpef6BQl2u3IZX/Cj20tfypRF4yd+uaHOMtI= +github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= +github.com/mitchellh/iochan v0.0.0-20150529224432-87b45ffd0e95 h1:aHWVygBsLb+Kls/35B3tevL1hvDxZ0UklPA0BmhqTEk= +github.com/mitchellh/iochan v0.0.0-20150529224432-87b45ffd0e95/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc h1:5T6hzGUO5OrL6MdYXYoLQtRWJDDgjdlOVBn9mIqGY1g= +github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557 h1:w1QuuAA2km2Hax+EPamrq5ZRBeaNv2vsjvgB4an0zoU= +github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557/go.mod h1:QuAqW7/z+iv6aWFJdrA8kCbsF0OOJVKCICqTcYBexuY= +github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784 h1:+DAetXqxv/mSyCkE9KBIYOZs9b68y7SUaDCxQMRjA68= +github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= +github.com/mitchellh/reflectwalk v0.0.0-20150527153153-eecf4c70c626 h1:88u9H4mNODBcQUwlNpl6+jBhdoYT3WSi0w4hpYaYZ/o= +github.com/mitchellh/reflectwalk v0.0.0-20150527153153-eecf4c70c626/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef h1:E/seV1Rtsnr2juBw1Dfz4iDPT3/5s1H/BATx+ePmSyo= +github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef/go.mod h1:LgKrp0Iss/BVwquptq4eIe6HPr0s3t1WHT5x0qOh14U= +github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215 h1:y6FZWUBBt1iPmJyGbGza3ncvVBMKzgd32oFChRZR7Do= +github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215/go.mod h1:CxM/JGtpRrEPve5H04IhxJrGhxgwxMc6jSP2T4YD60w= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b h1:LGItPaClbzopugAomw5VFKnG3h1dUr9QW5KOU+m8gu0= +github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/oracle/oci-go-sdk v1.8.0 h1:4SO45bKV0I3/Mn1os3ANDZmV0eSE5z5CLdSUIkxtyzs= +github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= +github.com/ory/dockertest v3.3.2+incompatible h1:uO+NcwH6GuFof/Uz8yzjNi1g0sGT5SLAJbdBvD8bUYc= +github.com/ory/dockertest v3.3.2+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a h1:A3QMuteviunoaY/8ex+RKFqwhcZJ/Cf3fCW3IwL2wx4= +github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pierrec/lz4 v0.0.0-20160112163551-383c0d87b5dd h1:0EXhZlgCFcAZjhD6f6yqIINBBBym9seHr6AkvAWUgN8= +github.com/pierrec/lz4 v0.0.0-20160112163551-383c0d87b5dd/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/xxHash v0.0.0-20160112165351-5a004441f897 h1:jp3jc/PyyTrTKjJJ6rWnhTbmo7tGgBFyG9AL5FIrO1I= +github.com/pierrec/xxHash v0.0.0-20160112165351-5a004441f897/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e h1:+RHxT/gm0O3UF7nLJbdNzAmULvCFt4XfXHWzh3XI/zs= +github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca h1:k8gsErq3rkcbAyCnpOycQsbw88NjCHk7L3KfBZKhQDQ= +github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v0.0.0-20170908125245-88e59760adad h1:jTlrcNQXxCpT8NU0MG1aiUkfAiTlm+W6KPScysqjvdA= +github.com/posener/complete v0.0.0-20170908125245-88e59760adad/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible h1:ZoVHH6voxW9Onzo6z2yLtocVoN6mBocyDoqoyAMHokE= +github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible/go.mod h1:T3/WrziK7fYH3C8ilAFAHe99R452/IzIG3YYkqaOFeQ= +github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17 h1:4qPms2txLWMLXKzqlnYSulKRS4cS9aYgPtAEpUelQok= +github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17/go.mod h1:SAEjPB4voP88qmWJXI7mA5m15uNlEnuHLx4Eu2mPGpQ= +github.com/rwtodd/Go.Sed v0.0.0-20170507045331-d6d5d585814e h1:lN+IKs+Jb9uwDOMO4VJZzH9vOjjist0THR5s9akp+Ss= +github.com/rwtodd/Go.Sed v0.0.0-20170507045331-d6d5d585814e/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ= +github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 h1:7YvPJVmEeFHR1Tj9sZEYsmarJEQfMVYpd/Vyy/A8dqE= +github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/satori/go.uuid v0.0.0-20170321230731-5bf94b69c6b6 h1:7PFDlUz5/yGp8w21PuZGgEfN7ZF7OXvgAIDjwih82Gs= +github.com/satori/go.uuid v0.0.0-20170321230731-5bf94b69c6b6/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/satori/uuid v0.0.0-20170321230731-5bf94b69c6b6/go.mod h1:B8HLsPLik/YNn6KKWVMDJ8nzCL8RP5WyfsnmvnAEwIU= +github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70 h1:DaqC32ZwOuO4ctgg9qAdKnlQxwFPkKmCOEqwSNwYy7c= +github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70/go.mod h1:XjlXWPd6VONhsRSEuzGkV8mzRpH7ou1cdLV7IKJk96s= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sirupsen/logrus v0.0.0-20180315010703-90150a8ed11b h1:m1cItYkpJSJ3ZKPEV/XKbZTcCaJHY1qF+R9GisLZ4kw= +github.com/sirupsen/logrus v0.0.0-20180315010703-90150a8ed11b/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9 h1:/Bsw4C+DEdqPjt8vAqaC9LAqpAQnaCQQqmolqq3S1T4= +github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 h1:U6ufy3mLDgg9RYupntOvAF7xCmNNquyKaYaaVHo1Nnk= +github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670 h1:HQWT4ta3wW5GZ790GaqLCS+w1dvuA3rMfEQxLi+UOYU= +github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 h1:s5pyxd5S6wRs2WpEE0xRfWUF46Wbz44h203KnbX0ecI= +github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/vmware/govmomi v0.19.0 h1:CR6tEByWCPOnRoRyhLzuHaU+6o2ybF3qufNRWS/MGrY= +github.com/vmware/govmomi v0.19.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/xanzy/go-cloudstack v2.1.4+incompatible h1:5c72sRFakVv8wH/HsQFg+xr37CmNQU2UbJfaBjW5f0c= +github.com/xanzy/go-cloudstack v2.1.4+incompatible/go.mod h1:s3eL3z5pNXF5FVybcT+LIVdId8pYn709yv6v5mrkrQE= +golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4 h1:AJCW0rhPjFKEAoValWpqnRKxX8YV0Xvqfw+dOexCTPc= +golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8 h1:Q/I0fOWMTCcD88KusB5RVd4ziMZD/oEXE0zPgTV43r8= +golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d h1:i6RB+Qz1ug7TvJdY4zieRMpnLAtkHSHTOvApNXfLT4A= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20160121061903-8a57ed94ffd4 h1:9XepZslbsnDusjUYh6+WSErDUzVo/HMQEYzWVxp3Wg4= +golang.org/x/oauth2 v0.0.0-20160121061903-8a57ed94ffd4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20170317231601-5a06fca2c336 h1:wAXSJAibyxWKRVHDNP2Co1zh7bRL9wiIZa+nsM5iLV4= +golang.org/x/sync v0.0.0-20170317231601-5a06fca2c336/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180326154331-13d03a9a82fb h1:w1eDrzbtlRsu1SyjnZZFUBVuhRN2Rn6DlrHCx9s4ud0= +golang.org/x/sys v0.0.0-20180326154331-13d03a9a82fb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.0.0-20180708171225-0605a8320ace h1:3mpprtjg+Ub12Q3O5M02xoGQjF0M93WOKTMkXzYE+f4= +golang.org/x/text v0.0.0-20180708171225-0605a8320ace/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/api v0.0.0-20180818000503-e21acd801f91 h1:MgYYgjaWMS2qQiDwCznfbqNmEOdSULlvjCvSCvIe/Wo= +google.golang.org/api v0.0.0-20180818000503-e21acd801f91/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/appengine v0.0.0-20160118045125-6bde959377a9 h1:N0a1+y6LSCarkW70HtWi8pVKlIA63MtKb+sq9tmkcNg= +google.golang.org/appengine v0.0.0-20160118045125-6bde959377a9/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/cloud v0.0.0-20160202182918-5a3b06f8b5da h1:GqvJK5t3NykRbh1/2caGotUhCjk8d2UWK9zvYwnT7Xs= +google.golang.org/cloud v0.0.0-20160202182918-5a3b06f8b5da/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM= +gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= +gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ldap.v2 v2.5.1 h1:wiu0okdNfjlBzg6UWvd1Hn8Y+Ux17/u/4nlk4CQr6tU= +gopkg.in/ldap.v2 v2.5.1/go.mod h1:oI0cpe/D7HRtBQl8aTg+ZmzFUAvu4lsv3eLXMLGFxWk= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce h1:xcEWjVhvbDy+nHP67nPDDpbYrY+ILlfndk4bRioVHaU= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/vmihailenco/msgpack.v2 v2.9.1 h1:kb0VV7NuIojvRfzwslQeP3yArBqJHW9tOl4t38VS1jM= +gopkg.in/vmihailenco/msgpack.v2 v2.9.1/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8= +gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 15d858734498ade0ddf5ab101544d1fc45ce9d47 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Tue, 18 Dec 2018 01:34:48 +0300 Subject: [PATCH 214/266] a test for windows. WinRM needs a special validation. https://github.com/jetbrains-infra/packer-builder-vsphere/issues/92#issuecomment-386486758 --- clone/builder_acc_test.go | 38 ++++++++++++++++++++++++++++++++++++++ iso/builder_acc_test.go | 4 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 2b7cb8e70..984b4e3df 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -631,3 +631,41 @@ func checkNotes(t *testing.T) builderT.TestCheckFunc { return nil } } + +func TestCloneBuilderAcc_windows(t *testing.T) { + t.Skip("test is too slow") + config := windowsConfig() + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: commonT.RenderConfig(config), + }) +} + +func windowsConfig() map[string]interface{} { + username := os.Getenv("VSPHERE_USERNAME") + if username == "" { + username = "root" + } + password := os.Getenv("VSPHERE_PASSWORD") + if password == "" { + password = "jetbrains" + } + + config := map[string]interface{}{ + "vcenter_server": "vcenter.vsphere65.test", + "username": username, + "password": password, + "insecure_connection": true, + + "vm_name": commonT.NewVMName(), + "template": "windows", + "host": "esxi-1.vsphere65.test", + "linked_clone": true, // speed up + + "communicator": "winrm", + "winrm_username": "jetbrains", + "winrm_password": "jetbrains", + } + + return config +} diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 222a21f79..965a59ed1 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -387,6 +387,7 @@ func createFloppyConfig(filePath string) string { } func TestISOBuilderAcc_full(t *testing.T) { + t.Skip("test is too slow") config := fullConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -414,7 +415,7 @@ func fullConfig() map[string]interface{} { "vm_name": commonT.NewVMName(), "host": "esxi-1.vsphere65.test", - "RAM": 1024, + "RAM": 1024, "disk_controller_type": "pvscsi", "disk_size": 4096, "disk_thin_provisioned": true, @@ -486,6 +487,7 @@ func checkFull(t *testing.T) builderT.TestCheckFunc { } func TestISOBuilderAcc_bootOrder(t *testing.T) { + t.Skip("test is too slow") config := fullConfig() config["boot_order"] = "disk,cdrom,floppy" From b1389db5e061fa3b94b3ad01dcc3b6a2209ff6e7 Mon Sep 17 00:00:00 2001 From: mkuzmin <> Date: Sat, 22 Dec 2018 18:14:15 +0000 Subject: [PATCH 215/266] TeamCity change in 'JetBrains Public Projects / Packer Builder for vSphere' project: Connection added --- .teamcity/patches/projects/_Self.kts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .teamcity/patches/projects/_Self.kts diff --git a/.teamcity/patches/projects/_Self.kts b/.teamcity/patches/projects/_Self.kts new file mode 100644 index 000000000..860a383b7 --- /dev/null +++ b/.teamcity/patches/projects/_Self.kts @@ -0,0 +1,27 @@ +package patches.projects + +import jetbrains.buildServer.configs.kotlin.v2018_2.* +import jetbrains.buildServer.configs.kotlin.v2018_2.Project +import jetbrains.buildServer.configs.kotlin.v2018_2.ui.* + +/* +This patch script was generated by TeamCity on settings change in UI. +To apply the patch, change the root project +accordingly, and delete the patch script. +*/ +changeProject(DslContext.projectId) { + features { + add { + feature { + type = "OAuthProvider" + id = "PROJECT_EXT_114" + param("clientId", "1abfd46417d7795298a1") + param("defaultTokenScope", "public_repo,repo,repo:status,write:repo_hook") + param("secure:clientSecret", "credentialsJSON:5fe99dc3-4d1d-4fd6-9f5c-e87fbcbd9a4e") + param("displayName", "GitHub.com") + param("gitHubUrl", "https://github.com/") + param("providerType", "GitHub") + } + } + } +} From 9a960ae744239a9043761cee1d15519c040ff1bb Mon Sep 17 00:00:00 2001 From: mkuzmin <> Date: Sat, 22 Dec 2018 18:21:31 +0000 Subject: [PATCH 216/266] TeamCity change in 'JetBrains Public Projects / Packer Builder for vSphere' project: triggers of 'Build' build configuration were updated --- .teamcity/patches/buildTypes/Build.kts | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .teamcity/patches/buildTypes/Build.kts diff --git a/.teamcity/patches/buildTypes/Build.kts b/.teamcity/patches/buildTypes/Build.kts new file mode 100644 index 000000000..24f96847d --- /dev/null +++ b/.teamcity/patches/buildTypes/Build.kts @@ -0,0 +1,32 @@ +package patches.buildTypes + +import jetbrains.buildServer.configs.kotlin.v2018_2.* +import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs +import jetbrains.buildServer.configs.kotlin.v2018_2.ui.* + +/* +This patch script was generated by TeamCity on settings change in UI. +To apply the patch, change the buildType with id = 'Build' +accordingly, and delete the patch script. +*/ +changeBuildType(RelativeId("Build")) { + triggers { + val trigger1 = find<VcsTrigger> { + vcs { + triggerRules = "-:*.md" + branchFilter = """ + +:* + -:temp-* + -:pull/* + """.trimIndent() + } + } + trigger1.apply { + triggerRules = """ + -:*.md + -.teamcity/ + """.trimIndent() + } + } +} From 0fcaa7bf36db2498c81ba5056eed31970e4cd804 Mon Sep 17 00:00:00 2001 From: mkuzmin <> Date: Sat, 22 Dec 2018 18:22:46 +0000 Subject: [PATCH 217/266] TeamCity change in 'JetBrains Public Projects / Packer Builder for vSphere' project: build features of 'Build' build configuration were updated --- .teamcity/patches/buildTypes/Build.kts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.teamcity/patches/buildTypes/Build.kts b/.teamcity/patches/buildTypes/Build.kts index 24f96847d..4b249c53f 100644 --- a/.teamcity/patches/buildTypes/Build.kts +++ b/.teamcity/patches/buildTypes/Build.kts @@ -1,6 +1,8 @@ package patches.buildTypes import jetbrains.buildServer.configs.kotlin.v2018_2.* +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.CommitStatusPublisher +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.VcsTrigger import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs import jetbrains.buildServer.configs.kotlin.v2018_2.ui.* @@ -29,4 +31,26 @@ changeBuildType(RelativeId("Build")) { """.trimIndent() } } + + features { + val feature1 = find<CommitStatusPublisher> { + commitStatusPublisher { + publisher = github { + githubUrl = "https://api.github.com" + authType = personalToken { + token = "credentialsJSON:95bbfc46-3141-4bed-86ec-f8ec751f3e94" + } + } + param("github_oauth_user", "mkuzmin") + } + } + feature1.apply { + publisher = github { + githubUrl = "https://api.github.com" + authType = personalToken { + token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" + } + } + } + } } From c13a7cc23f554f51a4427f42e00bb6428ce54dd1 Mon Sep 17 00:00:00 2001 From: mkuzmin <> Date: Sat, 22 Dec 2018 18:25:22 +0000 Subject: [PATCH 218/266] TeamCity change in 'JetBrains Public Projects / Packer Builder for vSphere' project: build features of 'Build' build configuration were updated --- .teamcity/patches/buildTypes/Build.kts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.teamcity/patches/buildTypes/Build.kts b/.teamcity/patches/buildTypes/Build.kts index 4b249c53f..e4ae0d67d 100644 --- a/.teamcity/patches/buildTypes/Build.kts +++ b/.teamcity/patches/buildTypes/Build.kts @@ -2,7 +2,9 @@ package patches.buildTypes import jetbrains.buildServer.configs.kotlin.v2018_2.* import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.CommitStatusPublisher +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.PullRequests import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher +import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.pullRequests import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.VcsTrigger import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs import jetbrains.buildServer.configs.kotlin.v2018_2.ui.* @@ -52,5 +54,24 @@ changeBuildType(RelativeId("Build")) { } } } + val feature2 = find<PullRequests> { + pullRequests { + provider = github { + authType = token { + token = "credentialsJSON:39727f26-62ed-4152-ab9a-f6845076a979" + } + filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY + } + } + } + feature2.apply { + provider = github { + authType = token { + token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" + } + filterTargetBranch = "" + filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY + } + } } } From 60cbf38e2420efb9038afaa9933f3ea470cf6c56 Mon Sep 17 00:00:00 2001 From: mkuzmin <> Date: Sat, 22 Dec 2018 18:32:48 +0000 Subject: [PATCH 219/266] TeamCity change in 'JetBrains Public Projects / Packer Builder for vSphere' project: New GitHub issue tracker with name packer-builder-vsphere was created --- .teamcity/patches/projects/_Self.kts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.teamcity/patches/projects/_Self.kts b/.teamcity/patches/projects/_Self.kts index 860a383b7..ac3e6bf47 100644 --- a/.teamcity/patches/projects/_Self.kts +++ b/.teamcity/patches/projects/_Self.kts @@ -23,5 +23,19 @@ changeProject(DslContext.projectId) { param("providerType", "GitHub") } } + add { + feature { + type = "IssueTracker" + id = "PROJECT_EXT_190" + param("secure:password", "") + param("name", "packer-builder-vsphere") + param("pattern", """#(\d+)""") + param("authType", "anonymous") + param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere") + param("type", "GithubIssues") + param("secure:accessToken", "credentialsJSON:70cd214c-6949-4bb6-931c-e32e9a02edf2") + param("username", "") + } + } } } From 22df3392be8af89a93992b093661fdefd44d7b50 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sat, 22 Dec 2018 21:48:18 +0300 Subject: [PATCH 220/266] fix build --- .gitignore | 1 + .teamcity/patches/buildTypes/Build.kts | 77 -------------------------- .teamcity/patches/projects/_Self.kts | 41 -------------- .teamcity/settings.kts | 21 +++++-- gofmt.sh | 2 +- 5 files changed, 19 insertions(+), 123 deletions(-) delete mode 100644 .teamcity/patches/buildTypes/Build.kts delete mode 100644 .teamcity/patches/projects/_Self.kts diff --git a/.gitignore b/.gitignore index da1a8903c..693c791b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ packer-builder-vsphere* +build/ bin/ .env test*.json diff --git a/.teamcity/patches/buildTypes/Build.kts b/.teamcity/patches/buildTypes/Build.kts deleted file mode 100644 index e4ae0d67d..000000000 --- a/.teamcity/patches/buildTypes/Build.kts +++ /dev/null @@ -1,77 +0,0 @@ -package patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2018_2.* -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.CommitStatusPublisher -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.PullRequests -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.pullRequests -import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.VcsTrigger -import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs -import jetbrains.buildServer.configs.kotlin.v2018_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with id = 'Build' -accordingly, and delete the patch script. -*/ -changeBuildType(RelativeId("Build")) { - triggers { - val trigger1 = find<VcsTrigger> { - vcs { - triggerRules = "-:*.md" - branchFilter = """ - +:* - -:temp-* - -:pull/* - """.trimIndent() - } - } - trigger1.apply { - triggerRules = """ - -:*.md - -.teamcity/ - """.trimIndent() - } - } - - features { - val feature1 = find<CommitStatusPublisher> { - commitStatusPublisher { - publisher = github { - githubUrl = "https://api.github.com" - authType = personalToken { - token = "credentialsJSON:95bbfc46-3141-4bed-86ec-f8ec751f3e94" - } - } - param("github_oauth_user", "mkuzmin") - } - } - feature1.apply { - publisher = github { - githubUrl = "https://api.github.com" - authType = personalToken { - token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" - } - } - } - val feature2 = find<PullRequests> { - pullRequests { - provider = github { - authType = token { - token = "credentialsJSON:39727f26-62ed-4152-ab9a-f6845076a979" - } - filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY - } - } - } - feature2.apply { - provider = github { - authType = token { - token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" - } - filterTargetBranch = "" - filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY - } - } - } -} diff --git a/.teamcity/patches/projects/_Self.kts b/.teamcity/patches/projects/_Self.kts deleted file mode 100644 index ac3e6bf47..000000000 --- a/.teamcity/patches/projects/_Self.kts +++ /dev/null @@ -1,41 +0,0 @@ -package patches.projects - -import jetbrains.buildServer.configs.kotlin.v2018_2.* -import jetbrains.buildServer.configs.kotlin.v2018_2.Project -import jetbrains.buildServer.configs.kotlin.v2018_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the root project -accordingly, and delete the patch script. -*/ -changeProject(DslContext.projectId) { - features { - add { - feature { - type = "OAuthProvider" - id = "PROJECT_EXT_114" - param("clientId", "1abfd46417d7795298a1") - param("defaultTokenScope", "public_repo,repo,repo:status,write:repo_hook") - param("secure:clientSecret", "credentialsJSON:5fe99dc3-4d1d-4fd6-9f5c-e87fbcbd9a4e") - param("displayName", "GitHub.com") - param("gitHubUrl", "https://github.com/") - param("providerType", "GitHub") - } - } - add { - feature { - type = "IssueTracker" - id = "PROJECT_EXT_190" - param("secure:password", "") - param("name", "packer-builder-vsphere") - param("pattern", """#(\d+)""") - param("authType", "anonymous") - param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere") - param("type", "GithubIssues") - param("secure:accessToken", "credentialsJSON:70cd214c-6949-4bb6-931c-e32e9a02edf2") - param("username", "") - } - } - } -} diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index aca65efa4..0770dee44 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -16,10 +16,21 @@ project { buildType(Build) features { + feature { + type = "OAuthProvider" + param("providerType", "GitHub") + param("displayName", "GitHub.com") + param("gitHubUrl", "https://github.com/") + param("clientId", "1abfd46417d7795298a1") + param("secure:clientSecret", "credentialsJSON:5fe99dc3-4d1d-4fd6-9f5c-e87fbcbd9a4e") + param("defaultTokenScope", "public_repo,repo,repo:status,write:repo_hook") + } feature { type = "IssueTracker" + param("name", "packer-builder-vsphere") param("type", "GithubIssues") param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere") + param("authType", "anonymous") } } } @@ -99,15 +110,14 @@ object Build : BuildType({ publisher = github { githubUrl = "https://api.github.com" authType = personalToken { - token = "credentialsJSON:95bbfc46-3141-4bed-86ec-f8ec751f3e94" + token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" } } - param("github_oauth_user", "mkuzmin") } pullRequests { provider = github { authType = token { - token = "credentialsJSON:39727f26-62ed-4152-ab9a-f6845076a979" + token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" } filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY } @@ -116,7 +126,10 @@ object Build : BuildType({ triggers { vcs { - triggerRules = "-:*.md" + triggerRules = """ + -:*.md + -.teamcity/ + """.trimIndent() branchFilter = """ +:* -:temp-* diff --git a/gofmt.sh b/gofmt.sh index 0f95fe149..69f4b43af 100755 --- a/gofmt.sh +++ b/gofmt.sh @@ -2,7 +2,7 @@ RETVAL=0 -for file in $(find . -name '*.go' -not -path './vendor/*') +for file in $(find . -name '*.go' -not -path './build/*') do if [ -n "$(gofmt -l $file)" ] then From 5b8be459eddb83873262441dd0ef0c812d6b5950 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sat, 22 Dec 2018 22:03:19 +0300 Subject: [PATCH 221/266] fix build --- .teamcity/settings.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 0770dee44..e89c7fb8f 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -31,6 +31,7 @@ project { param("type", "GithubIssues") param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere") param("authType", "anonymous") + param("pattern", """#(\d+)""") } } } @@ -128,7 +129,7 @@ object Build : BuildType({ vcs { triggerRules = """ -:*.md - -.teamcity/ + -:.teamcity/ """.trimIndent() branchFilter = """ +:* From 7cafcf5879de796b0ead408b00254ae313bcbdae Mon Sep 17 00:00:00 2001 From: Sander Jans <scbjans@gmail.com> Date: Wed, 30 May 2018 13:59:44 +0200 Subject: [PATCH 222/266] Support for local HTTP server --- iso/builder.go | 5 +++++ iso/config.go | 2 ++ iso/step_create.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/iso/builder.go b/iso/builder.go index fb2b424bb..c42acd0d4 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -63,6 +63,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Datastore: b.config.Datastore, Host: b.config.Host, }, + &packerCommon.StepHTTPServer{ + HTTPDir: b.config.HTTPDir, + HTTPPortMin: b.config.HTTPPortMin, + HTTPPortMax: b.config.HTTPPortMax, + }, &common.StepRun{ Config: &b.config.RunConfig, SetOrder: true, diff --git a/iso/config.go b/iso/config.go index f4b486fab..21daf494e 100644 --- a/iso/config.go +++ b/iso/config.go @@ -11,6 +11,7 @@ import ( type Config struct { packerCommon.PackerConfig `mapstructure:",squash"` + packerCommon.HTTPConfig `mapstructure:",squash"` common.ConnectConfig `mapstructure:",squash"` CreateConfig `mapstructure:",squash"` @@ -46,6 +47,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.HTTPConfig.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.CDRomConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare()...) diff --git a/iso/step_create.go b/iso/step_create.go index 122e542e8..30237ee96 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -3,10 +3,13 @@ package iso import ( "context" "fmt" + packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "net" + "os" ) type CreateConfig struct { @@ -23,6 +26,29 @@ type CreateConfig struct { USBController bool `mapstructure:"usb_controller"` Notes string `mapstructure:"notes"` + + HTTPIP string `mapstructure:"http_ip"` +} + +func getHostIP(s string) string { + if net.ParseIP(s) != nil { + return s + } + + var ipaddr string + addrs, err := net.InterfaceAddrs() + if err != nil { + fmt.Println(err) + os.Exit(2) + } + + for _, a := range addrs { + if ip, ok := a.(*net.IPNet); ok && !ip.IP.IsLoopback() { + ipaddr = ip.IP.String() + break + } + } + return ipaddr } func (c *CreateConfig) Prepare() []error { @@ -66,6 +92,8 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste } } + packerCommon.SetHTTPIP(getHostIP(s.Config.HTTPIP)) + ui.Say("Creating VM...") vm, err := d.CreateVM(&driver.CreateConfig{ DiskThinProvisioned: s.Config.DiskThinProvisioned, From 1474a0b82d421dda287f2f14a1c384c954048fcb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sun, 23 Dec 2018 02:13:31 +0300 Subject: [PATCH 223/266] Interpolate variables in 'boot_command' --- iso/builder.go | 2 ++ iso/config.go | 5 ++++ iso/step_boot_command.go | 58 ++++++++++++++++++++++++++++++++++++---- iso/step_create.go | 28 ------------------- 4 files changed, 60 insertions(+), 33 deletions(-) diff --git a/iso/builder.go b/iso/builder.go index c42acd0d4..cb21ef77d 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -74,6 +74,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &StepBootCommand{ Config: &b.config.BootConfig, + Ctx: b.config.ctx, + VMName: b.config.VMName, }, &common.StepWaitForIp{}, &communicator.StepConnect{ diff --git a/iso/config.go b/iso/config.go index 21daf494e..4f88fafce 100644 --- a/iso/config.go +++ b/iso/config.go @@ -37,6 +37,11 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { err := config.Decode(c, &config.DecodeOpts{ Interpolate: true, InterpolateContext: &c.ctx, + InterpolateFilter: &interpolate.RenderFilter{ + Exclude: []string{ + "boot_command", + }, + }, }, raws...) if err != nil { return nil, nil, err diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 895df03a1..0edec8c53 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -3,12 +3,14 @@ package iso import ( "context" "fmt" - "github.com/hashicorp/packer/common" + packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "golang.org/x/mobile/event/key" "log" + "net" "os" "strings" "time" @@ -18,10 +20,17 @@ import ( type BootConfig struct { BootCommand []string `mapstructure:"boot_command"` RawBootWait string `mapstructure:"boot_wait"` // example: "1m30s"; default: "10s" + HTTPIP string `mapstructure:"http_ip"` bootWait time.Duration } +type bootCommandTemplateData struct { + HTTPIP string + HTTPPort uint + Name string +} + func (c *BootConfig) Prepare() []error { var errs []error @@ -40,6 +49,8 @@ func (c *BootConfig) Prepare() []error { type StepBootCommand struct { Config *BootConfig + VMName string + Ctx interpolate.Context } var special = map[string]key.Code{ @@ -71,10 +82,10 @@ var special = map[string]key.Code{ "<down>": key.CodeDownArrow, } -var keyInterval = common.PackerKeyDefault +var keyInterval = packerCommon.PackerKeyDefault func init() { - if delay, err := time.ParseDuration(os.Getenv(common.PackerKeyEnv)); err == nil { + if delay, err := time.ParseDuration(os.Getenv(packerCommon.PackerKeyEnv)); err == nil { keyInterval = delay } } @@ -101,13 +112,29 @@ WAITLOOP: } } - ui.Say("Typing boot command...") + ip := getHostIP(s.Config.HTTPIP) + err := packerCommon.SetHTTPIP(ip) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + s.Ctx.Data = &bootCommandTemplateData{ + ip, + state.Get("http_port").(uint), + s.VMName, + } + ui.Say("Typing boot command...") var keyAlt bool var keyCtrl bool var keyShift bool + for _, command := range s.Config.BootCommand { + message, err := interpolate.Render(command, &s.Ctx) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } - for _, message := range s.Config.BootCommand { for len(message) > 0 { if _, ok := state.GetOk(multistep.StateCancelled); ok { return multistep.ActionHalt @@ -205,3 +232,24 @@ WAITLOOP: } func (s *StepBootCommand) Cleanup(state multistep.StateBag) {} + +func getHostIP(s string) string { + if net.ParseIP(s) != nil { + return s + } + + var ipaddr string + addrs, err := net.InterfaceAddrs() + if err != nil { + fmt.Println(err) + os.Exit(2) + } + + for _, a := range addrs { + if ip, ok := a.(*net.IPNet); ok && !ip.IP.IsLoopback() { + ipaddr = ip.IP.String() + break + } + } + return ipaddr +} diff --git a/iso/step_create.go b/iso/step_create.go index 30237ee96..122e542e8 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -3,13 +3,10 @@ package iso import ( "context" "fmt" - packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "net" - "os" ) type CreateConfig struct { @@ -26,29 +23,6 @@ type CreateConfig struct { USBController bool `mapstructure:"usb_controller"` Notes string `mapstructure:"notes"` - - HTTPIP string `mapstructure:"http_ip"` -} - -func getHostIP(s string) string { - if net.ParseIP(s) != nil { - return s - } - - var ipaddr string - addrs, err := net.InterfaceAddrs() - if err != nil { - fmt.Println(err) - os.Exit(2) - } - - for _, a := range addrs { - if ip, ok := a.(*net.IPNet); ok && !ip.IP.IsLoopback() { - ipaddr = ip.IP.String() - break - } - } - return ipaddr } func (c *CreateConfig) Prepare() []error { @@ -92,8 +66,6 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste } } - packerCommon.SetHTTPIP(getHostIP(s.Config.HTTPIP)) - ui.Say("Creating VM...") vm, err := d.CreateVM(&driver.CreateConfig{ DiskThinProvisioned: s.Config.DiskThinProvisioned, From d603d9548cb54c2509bb20d5a48a1057364dd52e Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sun, 23 Dec 2018 03:00:30 +0300 Subject: [PATCH 224/266] Fix IP resolution --- iso/step_boot_command.go | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 0edec8c53..3b7845f27 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -112,17 +112,23 @@ WAITLOOP: } } - ip := getHostIP(s.Config.HTTPIP) - err := packerCommon.SetHTTPIP(ip) + ip, err := getHostIP(s.Config.HTTPIP) if err != nil { state.Put("error", err) return multistep.ActionHalt } + err = packerCommon.SetHTTPIP(ip) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + port := state.Get("http_port").(uint) s.Ctx.Data = &bootCommandTemplateData{ ip, - state.Get("http_port").(uint), + port, s.VMName, } + ui.Say(fmt.Sprintf("HTTP server is working at http://%v:%v/", ip, port)) ui.Say("Typing boot command...") var keyAlt bool @@ -233,23 +239,27 @@ WAITLOOP: func (s *StepBootCommand) Cleanup(state multistep.StateBag) {} -func getHostIP(s string) string { - if net.ParseIP(s) != nil { - return s +func getHostIP(s string) (string, error) { + if s != "" { + if net.ParseIP(s) != nil { + return s, nil + } else { + return "", fmt.Errorf("invalid IP address") + } } - var ipaddr string addrs, err := net.InterfaceAddrs() if err != nil { - fmt.Println(err) - os.Exit(2) + return "", err } for _, a := range addrs { - if ip, ok := a.(*net.IPNet); ok && !ip.IP.IsLoopback() { - ipaddr = ip.IP.String() - break + ipnet, ok := a.(*net.IPNet) + if ok && !ipnet.IP.IsLoopback() { + if ipnet.IP.To4() != nil { + return ipnet.IP.String(), nil + } } } - return ipaddr + return "", fmt.Errorf("IP not found") } From 9cad0b7b66037391e16c2d1c9a7a07d0ec50ef92 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sun, 23 Dec 2018 19:49:38 +0300 Subject: [PATCH 225/266] don't detect local IP if `http_directory` is not specified --- iso/step_boot_command.go | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 3b7845f27..4e8006b7c 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -112,23 +112,26 @@ WAITLOOP: } } - ip, err := getHostIP(s.Config.HTTPIP) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } - err = packerCommon.SetHTTPIP(ip) - if err != nil { - state.Put("error", err) - return multistep.ActionHalt - } port := state.Get("http_port").(uint) - s.Ctx.Data = &bootCommandTemplateData{ - ip, - port, - s.VMName, + if port > 0 { + ip, err := getHostIP(s.Config.HTTPIP) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + err = packerCommon.SetHTTPIP(ip) + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + s.Ctx.Data = &bootCommandTemplateData{ + ip, + port, + s.VMName, + } + ui.Say(fmt.Sprintf("HTTP server is working at http://%v:%v/", ip, port)) } - ui.Say(fmt.Sprintf("HTTP server is working at http://%v:%v/", ip, port)) ui.Say("Typing boot command...") var keyAlt bool From be84a39aa0c4c50a89193acec90471ef45c336fb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Sun, 23 Dec 2018 20:16:49 +0300 Subject: [PATCH 226/266] Support 'http_host' parameter (fix #184) --- clone/builder.go | 2 +- common/config_ssh.go | 10 ++++++++-- iso/builder.go | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/clone/builder.go b/clone/builder.go index 757e9b2c5..ec3356709 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -58,7 +58,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepWaitForIp{}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: common.CommHost, + Host: common.CommHost(b.config.Comm.SSHHost), SSHConfig: common.SshConfig, }, &packerCommon.StepProvision{}, diff --git a/common/config_ssh.go b/common/config_ssh.go index cd9fdba1c..e1df13e54 100644 --- a/common/config_ssh.go +++ b/common/config_ssh.go @@ -9,8 +9,14 @@ import ( "io/ioutil" ) -func CommHost(state multistep.StateBag) (string, error) { - return state.Get("ip").(string), nil +func CommHost(host string) func(multistep.StateBag) (string, error) { + return func(state multistep.StateBag) (string, error) { + if host != "" { + return host, nil + } else { + return state.Get("ip").(string), nil + } + } } func SshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { diff --git a/iso/builder.go b/iso/builder.go index cb21ef77d..991ea86ee 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -80,7 +80,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepWaitForIp{}, &communicator.StepConnect{ Config: &b.config.Comm, - Host: common.CommHost, + Host: common.CommHost(b.config.Comm.SSHHost), SSHConfig: common.SshConfig, }, &packerCommon.StepProvision{}, From 0346aa5bac0c7055ee3e248d9670ce7ca9ab4486 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Wed, 26 Dec 2018 01:02:24 +0300 Subject: [PATCH 227/266] update README --- README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8537ee431..cf34877b2 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,12 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### VM Location * `vm_name`(string) - Name of the new VM to create. -* `notes`(string) - Add some notes. * `folder`(string) - VM folder to create the VM in. * `host`(string) - ESXi host where target VM is created. A full path must be specified if the host is in a folder. For example `folder/host`. See the `Specifying Clusters and Hosts` section above for more details. -* `cluster`(string) - ESXi cluster where target VM is created. See [Working with Clusters](#working-with-clusters) section. +* `cluster`(string) - ESXi cluster where target VM is created. See [Working with Clusters](#working-with-clusters). * `resource_pool`(string) - VMWare resource pool. Defaults to the root resource pool of the `host` or `cluster`. * `datastore`(string) - VMWare datastore. Required if `host` is a cluster, or if `host` has multiple datastores. +* `notes`(string) - VM notes. ### VM Location (`vsphere-clone` only) @@ -63,6 +63,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### Hardware * `CPUs`(number) - Number of CPU sockets. +* `cpu_cores`(number) - Number of CPU cores per socket. * `CPU_limit`(number) - Upper limit of available CPU resources in MHz. * `CPU_reservation`(number) - Amount of reserved CPU resources in MHz. * `CPU_hot_plug`(boolean) - Enable CPU hot plug setting for virtual machine. Defaults to `false`. @@ -70,6 +71,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `RAM_reservation`(number) - Amount of reserved RAM in MB. * `RAM_reserve_all`(boolean) - Reserve all available RAM. Defaults to `false`. Cannot be used together with `RAM_reservation`. * `RAM_hot_plug`(boolean) - Enable RAM hot plug setting for virtual machine. Defaults to `false`. +* `video_ram`(number) - Amount of video memory in MB. * `disk_size`(number) - The size of the disk in MB. * `NestedHV`(boolean) - Enable nested hardware virtualization for VM. Defaults to `false`. * `configuration_parameters`(map) - Custom parameters. @@ -90,24 +92,24 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### Boot (`vsphere-iso` only) -* `boot_wait`(string) Amount of time to wait for the VM to boot. Examples 45s and 10m. Defaults to 10 seconds. See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. -* `boot_command`(array of strings) - List of commands to type when the VM is first booted. Used to initalize the operating system installer. -* `floppy_dirs`(array of strings) - Seems to not do anything useful yet. Not implemented. +* `iso_paths`(array of strings) - List of datastore paths to ISO files that will be mounted to the VM. Example `"[datastore1] ISO/ubuntu.iso"`. * `floppy_files`(array of strings) - List of local files to be mounted to the VM floppy drive. Can be used to make Debian preseed or RHEL kickstart files available to the VM. -* `floppy_img_path`(string) - Data store path to a floppy image that will be mounted to the VM. Cannot be used with `floppy_files` or `floppy_dir` options. Example `[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp`. -* `iso_paths`(array of strings) - List of data store paths to ISO files that will be mounted to the VM. Example `"[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso"`. +* `floppy_dirs`(array of strings) - List of directories to copy files from. +* `floppy_img_path`(string) - Datastore path to a floppy image that will be mounted to the VM. Example `[datastore1] ISO/pvscsi-Windows8.flp`. +* `http_directory`(string) - Path to a directory to serve using a local HTTP server. Beware of [limitations](https://github.com/jetbrains-infra/packer-builder-vsphere/issues/108#issuecomment-449634324). +* `http_ip`(string) - Specify IP address on which the HTTP server is started. If not provided the first non-loopback interface is used. +* `http_port_min` and `http_port_max` as in other [builders](https://www.packer.io/docs/builders/virtualbox-iso.html#http_port_min). +* `boot_wait`(string) Amount of time to wait for the VM to boot. Examples 45s and 10m. Defaults to 10 seconds. See [format](https://golang.org/pkg/time/#ParseDuration). +* `boot_command`(array of strings) - List of commands to type when the VM is first booted. Used to initalize the operating system installer. See details in [Packer docs](https://www.packer.io/docs/builders/virtualbox-iso.html#boot-command). ### Provision * `communicator` - `ssh` (default), `winrm`, or `none` (create/clone, customize hardware, but do not boot). - * `ssh_username`(string) - Username in guest OS. * `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. * `ssh_private_key_file`(string) - Path to the SSH private key file to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. - * `winrm_username`(string) - Username in guest OS. * `winrm_password`(string) - Password to access guest OS. - * `shutdown_command`(string) - Specify a VM guest shutdown command. VMware guest tools are used by default. * `shutdown_timeout`(string) - Amount of time to wait for graceful VM shutdown. Examples 45s and 10m. Defaults to 5m(5 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. From 23ce26e82c6efce539c2e3bc0a3448ca761eb6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= <remijouannet@gmail.com> Date: Fri, 4 Jan 2019 15:07:09 +0100 Subject: [PATCH 228/266] add step remote upload for iso builder (#164) --- README.md | 4 +++ driver/datastore.go | 9 +++++++ iso/builder.go | 22 +++++++++++++++ iso/config.go | 21 +++++++++++---- iso/step_add_cdrom.go | 14 +++++++--- iso/step_remote_upload.go | 57 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 iso/step_remote_upload.go diff --git a/README.md b/README.md index cf34877b2..024b91b9b 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,10 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `http_directory`(string) - Path to a directory to serve using a local HTTP server. Beware of [limitations](https://github.com/jetbrains-infra/packer-builder-vsphere/issues/108#issuecomment-449634324). * `http_ip`(string) - Specify IP address on which the HTTP server is started. If not provided the first non-loopback interface is used. * `http_port_min` and `http_port_max` as in other [builders](https://www.packer.io/docs/builders/virtualbox-iso.html#http_port_min). +* `iso_urls`(array of strings) - Multiple URLs for the ISO to download. Packer will try these in order. If anything goes wrong attempting to download or while downloading a single URL, it will move on to the next. All URLs must point to the same file (same checksum). By default this is empty and iso_url is used. Only one of iso_url or iso_urls can be specified. +* `iso_checksum `(string) - The checksum for the OS ISO file. Because ISO files are so large, this is required and Packer will verify it prior to booting a virtual machine with the ISO attached. The type of the checksum is specified with iso_checksum_type, documented below. At least one of iso_checksum and iso_checksum_url must be defined. This has precedence over iso_checksum_url type. +* `iso_checksum_type`(string) - The type of the checksum specified in iso_checksum. Valid values are none, md5, sha1, sha256, or sha512 currently. While none will skip checksumming, this is not recommended since ISO files are generally large and corruption does happen from time to time. +* `iso_checksum_url`(string) - A URL to a GNU or BSD style checksum file containing a checksum for the OS ISO file. At least one of iso_checksum and iso_checksum_url must be defined. This will be ignored if iso_checksum is non empty. * `boot_wait`(string) Amount of time to wait for the VM to boot. Examples 45s and 10m. Defaults to 10 seconds. See [format](https://golang.org/pkg/time/#ParseDuration). * `boot_command`(array of strings) - List of commands to type when the VM is first booted. Used to initalize the operating system installer. See details in [Packer docs](https://www.packer.io/docs/builders/virtualbox-iso.html#boot-command). diff --git a/driver/datastore.go b/driver/datastore.go index 7f4b3b1dc..4e0c191f0 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -100,6 +100,15 @@ func (ds *Datastore) Delete(path string) error { return fm.Delete(ds.driver.ctx, path) } +func (ds *Datastore) MakeDirectory(path string) error { + dc, err := ds.driver.finder.Datacenter(ds.driver.ctx, ds.ds.DatacenterPath) + if err != nil { + return err + } + fm := ds.ds.NewFileManager(dc, false) + return fm.FileManager.MakeDirectory(ds.driver.ctx, path, dc, true) +} + // Cuts out the datastore prefix // Example: "[datastore1] file.ext" --> "file.ext" func RemoveDatastorePrefix(path string) string { diff --git a/iso/builder.go b/iso/builder.go index 991ea86ee..91fc8d630 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -26,6 +26,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { state := new(multistep.BasicStateBag) + state.Put("cache", cache) state.Put("comm", &b.config.Comm) state.Put("hook", hook) state.Put("ui", ui) @@ -36,6 +37,27 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &common.StepConnect{ Config: &b.config.ConnectConfig, }, + ) + + if b.config.ISOUrls != nil { + steps = append(steps, + &packerCommon.StepDownload{ + Checksum: b.config.ISOChecksum, + ChecksumType: b.config.ISOChecksumType, + Description: "ISO", + Extension: b.config.TargetExtension, + ResultKey: "iso_path", + TargetPath: b.config.TargetPath, + Url: b.config.ISOUrls, + }, + &StepRemoteUpload{ + Datastore: b.config.Datastore, + Host: b.config.Host, + }, + ) + } + + steps = append(steps, &StepCreateVM{ Config: &b.config.CreateConfig, Location: &b.config.LocationConfig, diff --git a/iso/config.go b/iso/config.go index 4f88fafce..5e032126f 100644 --- a/iso/config.go +++ b/iso/config.go @@ -19,11 +19,14 @@ type Config struct { common.HardwareConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - BootConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` + packerCommon.ISOConfig `mapstructure:",squash"` + + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + BootConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` + common.ShutdownConfig `mapstructure:",squash"` CreateSnapshot bool `mapstructure:"create_snapshot"` @@ -47,7 +50,15 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { return nil, nil, err } + warnings := make([]string, 0) errs := new(packer.MultiError) + + if c.ISOUrls != nil { + isoWarnings, isoErrs := c.ISOConfig.Prepare(&c.ctx) + warnings = append(warnings, isoWarnings...) + errs = packer.MultiErrorAppend(errs, isoErrs...) + } + errs = packer.MultiErrorAppend(errs, c.ConnectConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.CreateConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 50a0b9250..2969e7551 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -40,13 +40,21 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste } ui.Say("Mount ISO images...") - for _, path := range s.Config.ISOPaths { - if err := vm.AddCdrom(s.Config.CdromType, path); err != nil { + if len(s.Config.ISOPaths) > 0 { + for _, path := range s.Config.ISOPaths { + if err := vm.AddCdrom(s.Config.CdromType, path); err != nil { + state.Put("error", fmt.Errorf("error mounting an image: %v", err)) + return multistep.ActionHalt + } + } + } + + if path, ok := state.GetOk("iso_remote_path"); ok { + if err := vm.AddCdrom(s.Config.CdromType, path.(string)); err != nil { state.Put("error", fmt.Errorf("error mounting an image: %v", err)) return multistep.ActionHalt } } - return multistep.ActionContinue } diff --git a/iso/step_remote_upload.go b/iso/step_remote_upload.go new file mode 100644 index 000000000..53a7317af --- /dev/null +++ b/iso/step_remote_upload.go @@ -0,0 +1,57 @@ +package iso + +import ( + "context" + "fmt" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "path/filepath" +) + +type StepRemoteUpload struct { + Datastore string + Host string +} + +func (s *StepRemoteUpload) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(*driver.Driver) + + if path, ok := state.GetOk("iso_path"); ok { + filename := filepath.Base(path.(string)) + + ds, err := d.FindDatastore(s.Datastore, s.Host) + if err != nil { + state.Put("error", fmt.Errorf("datastore doesn't exist: %v", err)) + return multistep.ActionHalt + } + + remotepath := fmt.Sprintf("packer_cache/%s", filename) + remotedirectory := fmt.Sprintf("[%s] packer_cache/", ds.Name()) + final_remotepath := fmt.Sprintf("%s/%s", remotedirectory, filename) + + ui.Say(fmt.Sprintf("Uploading %s to %s", filename, remotepath)) + + if exists := ds.FileExists(remotepath); exists == true { + ui.Say("File already upload") + state.Put("iso_remote_path", final_remotepath) + return multistep.ActionContinue + } + + if err := ds.MakeDirectory(remotedirectory); err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + + if err := ds.UploadFile(path.(string), remotepath, s.Host); err != nil { + state.Put("error", err) + return multistep.ActionHalt + } + state.Put("iso_remote_path", final_remotepath) + } + + return multistep.ActionContinue +} + +func (s *StepRemoteUpload) Cleanup(state multistep.StateBag) {} From c6e97fe8878a1b3f3ac493777829464ecbd48075 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 4 Jan 2019 17:20:34 +0300 Subject: [PATCH 229/266] build by Make --- .teamcity/settings.kts | 12 ++---------- Makefile | 36 ++++++++++++++++++++++++++++++++++++ build.sh | 16 ---------------- docker-compose.yml | 4 ++-- test.sh | 7 ------- 5 files changed, 40 insertions(+), 35 deletions(-) create mode 100644 Makefile delete mode 100755 build.sh delete mode 100755 test.sh diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index e89c7fb8f..453c1859f 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -72,7 +72,7 @@ object Build : BuildType({ steps { script { name = "Build" - scriptContent = "./build.sh" + scriptContent = "make build -j 3" dockerImage = golangImage dockerPull = true } @@ -84,15 +84,7 @@ object Build : BuildType({ script { name = "Test" - scriptContent = """ - set -eux - - go test -c ./driver - go test -c ./iso - go test -c ./clone - - ./test.sh | go-test-teamcity - """.trimIndent() + scriptContent = "make test | go-test-teamcity" dockerImage = golangImage dockerPull = true dockerRunParameters = "--network=container:vpn" diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..5e32f679e --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +GOOPTS := GOARCH=amd64 CGO_ENABLED=0 + +build: iso clone + +iso: iso-linux iso-windows iso-macos +clone: clone-linux clone-windows clone-macos + +iso-linux: modules bin + $(GOOPTS) GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso + +iso-windows: modules bin + $(GOOPTS) GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso + +iso-macos: modules bin + $(GOOPTS) GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso + +clone-linux: modules bin + $(GOOPTS) GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./cmd/clone + +clone-windows: modules bin + $(GOOPTS) GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./cmd/clone + +clone-macos: modules bin + $(GOOPTS) GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./cmd/clone + +modules: + go mod download + +bin: + mkdir -p bin + rm -f bin/* + +test: + PACKER_ACC=1 go test -v -count 1 ./driver ./iso ./clone + +.PHONY: bin test diff --git a/build.sh b/build.sh deleted file mode 100755 index 7b61248e3..000000000 --- a/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -eux - -export CGO_ENABLED=0 -export GOARCH=amd64 -mkdir -p bin -rm -f bin/* - -GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso -GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso -GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso - -GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./cmd/clone -GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./cmd/clone -GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./cmd/clone diff --git a/docker-compose.yml b/docker-compose.yml index 191ca53cd..8d158b02a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: - modules:/go/pkg/mod - cache:/root/.cache working_dir: /work - command: ./build.sh + command: make build -j 3 test: image: jetbrainsinfra/golang:1.11.4 @@ -20,7 +20,7 @@ services: environment: VSPHERE_USERNAME: VSPHERE_PASSWORD: - command: ./test.sh + command: make test volumes: modules: diff --git a/test.sh b/test.sh deleted file mode 100755 index 4df8d7782..000000000 --- a/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -eux - -export PACKER_ACC=1 - -go test -v -count 1 -timeout 20m ./driver ./iso ./clone From 5bf77f33ca71ca2998a3094c55837fdd266962d3 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 4 Jan 2019 17:21:59 +0300 Subject: [PATCH 230/266] swith tests from Ubuntu to Alpine --- examples/alpine/alpine-3.8.json | 62 +++++++++++++++++++++++++++++++++ examples/alpine/answerfile | 15 ++++++++ examples/alpine/setup.sh | 19 ++++++++++ iso/builder_acc_test.go | 47 ++++++++++++------------- 4 files changed, 119 insertions(+), 24 deletions(-) create mode 100644 examples/alpine/alpine-3.8.json create mode 100644 examples/alpine/answerfile create mode 100644 examples/alpine/setup.sh diff --git a/examples/alpine/alpine-3.8.json b/examples/alpine/alpine-3.8.json new file mode 100644 index 000000000..e2aca3924 --- /dev/null +++ b/examples/alpine/alpine-3.8.json @@ -0,0 +1,62 @@ +{ + "builders": [ + { + "type": "vsphere-iso", + + "vcenter_server": "vcenter.vsphere65.test", + "username": "root", + "password": "jetbrains", + "insecure_connection": true, + + "vm_name": "alpine-{{timestamp}}", + "host": "esxi-1.vsphere65.test", + + "CPUs": 1, + "RAM": 512, + "RAM_reserve_all": true, + "disk_controller_type": "pvscsi", + "disk_size": 1024, + "disk_thin_provisioned": true, + "network_card": "vmxnet3", + + "guest_os_type": "other3xLinux64Guest", + + "iso_paths": [ + "[datastore1] ISO/alpine-standard-3.8.2-x86_64.iso" + ], + "floppy_files": [ + "{{template_dir}}/answerfile", + "{{template_dir}}/setup.sh" + ], + + "boot_wait": "15s", + "boot_command": [ + "root<enter><wait>", + "mount -t vfat /dev/fd0 /media/floppy<enter><wait>", + "setup-alpine -f /media/floppy/answerfile<enter>", + "<wait5>", + "jetbrains<enter>", + "jetbrains<enter>", + "<wait5>", + "y<enter>", + "<wait10><wait10><wait10><wait10>", + "reboot<enter>", + "<wait10><wait10>", + "root<enter>", + "jetbrains<enter><wait>", + "mount -t vfat /dev/fd0 /media/floppy<enter><wait>", + "/media/floppy/SETUP.SH<enter>" + ], + + "ssh_username": "root", + "ssh_password": "jetbrains" + } + ], + + "provisioners": [ + { + "type": "shell", + "inline": ["ls /"] + } + ] +} diff --git a/examples/alpine/answerfile b/examples/alpine/answerfile new file mode 100644 index 000000000..e278b737b --- /dev/null +++ b/examples/alpine/answerfile @@ -0,0 +1,15 @@ +KEYMAPOPTS="us us" +HOSTNAMEOPTS="-n alpine" +INTERFACESOPTS="auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet dhcp + hostname alpine +" +TIMEZONEOPTS="-z UTC" +PROXYOPTS="none" +APKREPOSOPTS="http://mirror.yandex.ru/mirrors/alpine/v3.8/main" +SSHDOPTS="-c openssh" +NTPOPTS="-c none" +DISKOPTS="-m sys /dev/sda" diff --git a/examples/alpine/setup.sh b/examples/alpine/setup.sh new file mode 100644 index 000000000..de9b9179a --- /dev/null +++ b/examples/alpine/setup.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -ex + +apk add libressl +apk add open-vm-tools +rc-update add open-vm-tools +/etc/init.d/open-vm-tools start + +cat >/usr/local/bin/shutdown <<EOF +#!/bin/sh +poweroff +EOF +chmod +x /usr/local/bin/shutdown + +sed -i "/#PermitRootLogin/c\PermitRootLogin yes" /etc/ssh/sshd_config +mkdir ~/.ssh +wget https://raw.githubusercontent.com/jetbrains-infra/packer-builder-vsphere/master/test/test-key.pub -O ~/.ssh/authorized_keys +/etc/init.d/sshd restart diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 965a59ed1..98bc9f594 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -387,7 +387,6 @@ func createFloppyConfig(filePath string) string { } func TestISOBuilderAcc_full(t *testing.T) { - t.Skip("test is too slow") config := fullConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -415,40 +414,41 @@ func fullConfig() map[string]interface{} { "vm_name": commonT.NewVMName(), "host": "esxi-1.vsphere65.test", - "RAM": 1024, + "RAM": 512, "disk_controller_type": "pvscsi", - "disk_size": 4096, + "disk_size": 1024, "disk_thin_provisioned": true, "network_card": "vmxnet3", - "guest_os_type": "ubuntu64Guest", + "guest_os_type": "other3xLinux64Guest", "iso_paths": []string{ - "[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso", + "[datastore1] ISO/alpine-standard-3.8.2-x86_64.iso", }, "floppy_files": []string{ - "preseed.cfg", + "../examples/alpine/answerfile", + "../examples/alpine/setup.sh", }, + "boot_wait": "15s", "boot_command": []string{ - "<enter><wait><f6><wait><esc><wait>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", - "<bs><bs><bs>", - "/install/vmlinuz", - " initrd=/install/initrd.gz", - " priority=critical", - " locale=en_US", - " file=/media/preseed.cfg", - "<enter>", + "root<enter><wait>", + "mount -t vfat /dev/fd0 /media/floppy<enter><wait>", + "setup-alpine -f /media/floppy/answerfile<enter>", + "<wait5>", + "jetbrains<enter>", + "jetbrains<enter>", + "<wait5>", + "y<enter>", + "<wait10><wait10><wait10><wait10>", + "reboot<enter>", + "<wait10><wait10>", + "root<enter>", + "jetbrains<enter><wait>", + "mount -t vfat /dev/fd0 /media/floppy<enter><wait>", + "/media/floppy/SETUP.SH<enter>", }, - "ssh_username": "jetbrains", + "ssh_username": "root", "ssh_password": "jetbrains", } @@ -487,7 +487,6 @@ func checkFull(t *testing.T) builderT.TestCheckFunc { } func TestISOBuilderAcc_bootOrder(t *testing.T) { - t.Skip("test is too slow") config := fullConfig() config["boot_order"] = "disk,cdrom,floppy" From fd2d78c73bcda44d62216d4df33bf9d4d82626b3 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Fri, 4 Jan 2019 18:01:03 +0300 Subject: [PATCH 231/266] fix test --- iso/builder_acc_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 98bc9f594..7e4d87534 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -441,7 +441,7 @@ func fullConfig() map[string]interface{} { "y<enter>", "<wait10><wait10><wait10><wait10>", "reboot<enter>", - "<wait10><wait10>", + "<wait10><wait10><wait10>", "root<enter>", "jetbrains<enter><wait>", "mount -t vfat /dev/fd0 /media/floppy<enter><wait>", From 3c005a9291179fbb9b4c39434fa884325675624d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 5 Jan 2019 00:55:04 +0300 Subject: [PATCH 232/266] File upload to DRS-enabled clusters (fix #202) --- .gitignore | 1 + driver/datastore.go | 13 +++++-- driver/datastore_acc_test.go | 73 ++++++++++++++++++++++++++++++++++++ iso/preseed.cfg | 16 -------- 4 files changed, 83 insertions(+), 20 deletions(-) delete mode 100644 iso/preseed.cfg diff --git a/.gitignore b/.gitignore index 693c791b3..b99b727f8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ bin/ .env test*.json crash.log +packer_cache/ diff --git a/driver/datastore.go b/driver/datastore.go index 4e0c191f0..eed3d4f28 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -83,11 +83,16 @@ func (ds *Datastore) ResolvePath(path string) string { func (ds *Datastore) UploadFile(src, dst string, host string) error { p := soap.DefaultUpload - h, err := ds.driver.FindHost(host) - if err != nil { - return err + ctx := ds.driver.ctx + + if host != "" { + h, err := ds.driver.FindHost(host) + if err != nil { + return err + } + ctx = ds.ds.HostContext(ctx, h.host) } - ctx := ds.ds.HostContext(ds.driver.ctx, h.host) + return ds.ds.UploadFile(ctx, src, dst, &p) } diff --git a/driver/datastore_acc_test.go b/driver/datastore_acc_test.go index 3b13535af..75a522711 100644 --- a/driver/datastore_acc_test.go +++ b/driver/datastore_acc_test.go @@ -1,7 +1,10 @@ package driver import ( + "fmt" + "io/ioutil" "testing" + "time" ) func TestDatastoreAcc(t *testing.T) { @@ -18,3 +21,73 @@ func TestDatastoreAcc(t *testing.T) { t.Errorf("Wrong datastore. expected: 'datastore1', got: '%v'", info.Name) } } + +func TestFileUpload(t *testing.T) { + dsName := "datastore1" + hostName := "esxi-1.vsphere65.test" + + fileName := fmt.Sprintf("test-%v", time.Now().Unix()) + tmpFile, err := ioutil.TempFile("", fileName) + if err != nil { + t.Fatalf("Error creating temp file") + } + err = tmpFile.Close() + if err != nil { + t.Fatalf("Error creating temp file") + } + + d := newTestDriver(t) + ds, err := d.FindDatastore(dsName, hostName) + if err != nil { + t.Fatalf("Cannot find datastore '%v': %v", dsName, err) + } + + err = ds.UploadFile(tmpFile.Name(), fileName, hostName) + if err != nil { + t.Fatalf("Cannot upload file: %v", err) + } + + if ds.FileExists(fileName) != true { + t.Fatalf("Cannot find file") + } + + err = ds.Delete(fileName) + if err != nil { + t.Fatalf("Cannot delete file: %v", err) + } +} + +func TestFileUploadDRS(t *testing.T) { + dsName := "datastore3" + hostName := "" + + fileName := fmt.Sprintf("test-%v", time.Now().Unix()) + tmpFile, err := ioutil.TempFile("", fileName) + if err != nil { + t.Fatalf("Error creating temp file") + } + err = tmpFile.Close() + if err != nil { + t.Fatalf("Error creating temp file") + } + + d := newTestDriver(t) + ds, err := d.FindDatastore(dsName, hostName) + if err != nil { + t.Fatalf("Cannot find datastore '%v': %v", dsName, err) + } + + err = ds.UploadFile(tmpFile.Name(), fileName, hostName) + if err != nil { + t.Fatalf("Cannot upload file: %v", err) + } + + if ds.FileExists(fileName) != true { + t.Fatalf("Cannot find file") + } + + err = ds.Delete(fileName) + if err != nil { + t.Fatalf("Cannot delete file: %v", err) + } +} diff --git a/iso/preseed.cfg b/iso/preseed.cfg deleted file mode 100644 index ec963b6b2..000000000 --- a/iso/preseed.cfg +++ /dev/null @@ -1,16 +0,0 @@ -d-i passwd/user-fullname string jetbrains -d-i passwd/username string jetbrains -d-i passwd/user-password password jetbrains -d-i passwd/user-password-again password jetbrains -d-i user-setup/allow-password-weak boolean true - -d-i partman-auto/disk string /dev/sda -d-i partman-auto/method string regular -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -d-i pkgsel/include string open-vm-tools openssh-server - -d-i finish-install/reboot_in_progress note From acd07e56ec913bbb28fa6ff3e559943b94c2cc7d Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 5 Jan 2019 03:45:45 +0300 Subject: [PATCH 233/266] fix test --- iso/builder_acc_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 7e4d87534..52605d487 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -429,7 +429,7 @@ func fullConfig() map[string]interface{} { "../examples/alpine/setup.sh", }, - "boot_wait": "15s", + "boot_wait": "20s", "boot_command": []string{ "root<enter><wait>", "mount -t vfat /dev/fd0 /media/floppy<enter><wait>", From 4586e8d3b666afad8e00a3355fea6e5828b2c9f9 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <mkuzmin@gmail.com> Date: Sat, 5 Jan 2019 05:50:10 +0300 Subject: [PATCH 234/266] macOS example uses 'iso_urls' to upload "preseed" image dynamically --- examples/macos/macos-10.13.json | 5 ++++- examples/macos/setup/iso-setup.sh | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/macos/macos-10.13.json b/examples/macos/macos-10.13.json index 779834a7e..4c9380726 100644 --- a/examples/macos/macos-10.13.json +++ b/examples/macos/macos-10.13.json @@ -30,10 +30,13 @@ "iso_paths": [ "[datastore-mac] ISO/macOS 10.13.3.iso", - "[datastore-mac] ISO/setup.iso", "[datastore-mac] ISO/VMware Tools/10.2.0/darwin.iso" ], + "iso_urls": ["{{template_dir}}/setup/out/setup.iso"], + "iso_checksum_type": "sha256", + "iso_checksum_url": "file:///{{template_dir}}/setup/out/sha256sums", + "boot_wait": "4m", "boot_command": [ "<enter><wait5>", diff --git a/examples/macos/setup/iso-setup.sh b/examples/macos/setup/iso-setup.sh index 934f7b205..116b9259b 100755 --- a/examples/macos/setup/iso-setup.sh +++ b/examples/macos/setup/iso-setup.sh @@ -23,3 +23,5 @@ productbuild --package out/postinstall.pkg out/iso/postinstall.pkg rm -f out/setup.iso hdiutil makehybrid -iso -joliet -default-volume-name setup -o out/setup.iso out/iso +cd out +shasum -a 256 setup.iso >sha256sums From 0417062d9fcf9721831033861eb5d50e7c968e00 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Mon, 10 Jun 2019 23:08:35 +0300 Subject: [PATCH 235/266] update vSphere lab password --- .teamcity/settings.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 453c1859f..8bf94e4c1 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -66,7 +66,7 @@ object Build : BuildType({ password("env.VPN_PASSWORD", "credentialsJSON:8c355e81-9a26-4788-8fea-c854cd646c35") param ("env.VSPHERE_USERNAME", """vsphere65.test\teamcity""") - password("env.VSPHERE_PASSWORD", "credentialsJSON:3e99d6c8-b66f-410a-a865-eaf1b12664ad") + password("env.VSPHERE_PASSWORD", "credentialsJSON:d5e7ac7f-357b-464a-b2fa-ddd4c433b22b") } steps { From 395ce39611647f1d97576cae79e21765c5882a3f Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Wed, 13 Mar 2019 23:07:30 +0300 Subject: [PATCH 236/266] Support redefining network in vsphere-clone builder Fixes #226 --- clone/step_clone.go | 2 ++ driver/vm.go | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/clone/step_clone.go b/clone/step_clone.go index 3db1010e0..294368b95 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -13,6 +13,7 @@ type CloneConfig struct { Template string `mapstructure:"template"` DiskSize int64 `mapstructure:"disk_size"` LinkedClone bool `mapstructure:"linked_clone"` + Network string `mapstructure:"network"` Notes string `mapstructure:"notes"` } @@ -68,6 +69,7 @@ func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist ResourcePool: s.Location.ResourcePool, Datastore: s.Location.Datastore, LinkedClone: s.Config.LinkedClone, + Network: s.Config.Network, Annotation: s.Config.Notes, }) if err != nil { diff --git a/driver/vm.go b/driver/vm.go index 3390621ef..93c52432e 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -24,6 +24,7 @@ type CloneConfig struct { ResourcePool string Datastore string LinkedClone bool + Network string Annotation string } @@ -222,10 +223,41 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) cloneSpec.Snapshot = tpl.Snapshot.CurrentSnapshot } + var configSpec types.VirtualMachineConfigSpec + cloneSpec.Config = &configSpec + if config.Annotation != "" { - var configSpec types.VirtualMachineConfigSpec configSpec.Annotation = config.Annotation - cloneSpec.Config = &configSpec + } + + if config.Network != "" { + net, err := template.driver.finder.Network(ctx, config.Network) + if err != nil { + return nil, err + } + backing, err := net.EthernetCardBackingInfo(ctx) + if err != nil { + return nil, err + } + + devices, err := template.vm.Device(ctx) + if err != nil { + return nil, err + } + + adapter, err := findNetworkAdapter(devices) + if err != nil { + return nil, err + } + + adapter.GetVirtualEthernetCard().Backing = backing + + config := &types.VirtualDeviceConfigSpec{ + Device: adapter.(types.BaseVirtualDevice), + Operation: types.VirtualDeviceConfigSpecOperationEdit, + } + + configSpec.DeviceChange = append(configSpec.DeviceChange, config) } task, err := template.vm.Clone(template.driver.ctx, folder.folder, config.Name, cloneSpec) @@ -630,3 +662,12 @@ func (vm *VirtualMachine) AddConfigParams(params map[string]string) error { _, err = task.WaitForResult(vm.driver.ctx, nil) return err } + +func findNetworkAdapter(l object.VirtualDeviceList) (types.BaseVirtualEthernetCard, error) { + c := l.SelectByType((*types.VirtualEthernetCard)(nil)) + if len(c) == 0 { + return nil, errors.New("no network adapter device found") + } + + return c[0].(types.BaseVirtualEthernetCard), nil +} From f7151b405809a037802d84718e932b76b0f0faaf Mon Sep 17 00:00:00 2001 From: Michael Kuzmin <michael.kuzmin@jetbrains.com> Date: Thu, 13 Jun 2019 16:56:14 +0300 Subject: [PATCH 237/266] Network selection test --- clone/builder_acc_test.go | 45 +++++++++++++++++++++++++++++++++++++++ driver/network.go | 45 +++++++++++++++++++++++++++++++++++++++ driver/vm.go | 4 ++-- 3 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 driver/network.go diff --git a/clone/builder_acc_test.go b/clone/builder_acc_test.go index 984b4e3df..cb7b12f52 100644 --- a/clone/builder_acc_test.go +++ b/clone/builder_acc_test.go @@ -322,6 +322,51 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { } } +func TestCloneBuilderAcc_network(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + Builder: &Builder{}, + Template: networkConfig(), + Check: checkNetwork(t, "VM Network 2"), + }) +} + +func networkConfig() string { + config := defaultConfig() + config["template"] = "alpine-host4" + config["host"] = "esxi-4.vsphere65.test" + config["datastore"] = "datastore4" + config["network"] = "VM Network 2" + return commonT.RenderConfig(config) +} + +func checkNetwork(t *testing.T, name string) builderT.TestCheckFunc { + return func(artifacts []packer.Artifact) error { + d := commonT.TestConn(t) + vm := commonT.GetVM(t, d, artifacts) + + vmInfo, err := vm.Info("network") + if err != nil { + t.Fatalf("Cannot read VM properties: %v", err) + } + + n := len(vmInfo.Network) + if n != 1 { + t.Fatalf("VM should have 1 network, got %v", n) + } + + ds := d.NewNetwork(&vmInfo.Network[0]) + info, err := ds.Info("name") + if err != nil { + t.Fatalf("Cannot read network properties: %v", err) + } + if info.Name != name { + t.Errorf("Wrong network. expected: %v, got: %v", name, info.Name) + } + + return nil + } +} + func TestCloneBuilderAcc_hardware(t *testing.T) { builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, diff --git a/driver/network.go b/driver/network.go new file mode 100644 index 000000000..de923a01d --- /dev/null +++ b/driver/network.go @@ -0,0 +1,45 @@ +package driver + +import ( + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/types" +) + +type Network struct { + driver *Driver + network *object.Network +} + +func (d *Driver) NewNetwork(ref *types.ManagedObjectReference) *Network { + return &Network{ + network: object.NewNetwork(d.client.Client, *ref), + driver: d, + } +} + +func (d *Driver) FindNetwork(name string) (*Network, error) { + n, err := d.finder.Network(d.ctx, name) + if err != nil { + return nil, err + } + return &Network{ + network: n.(*object.Network), + driver: d, + }, nil +} + +func (n *Network) Info(params ...string) (*mo.Network, error) { + var p []string + if len(params) == 0 { + p = []string{"*"} + } else { + p = params + } + var info mo.Network + err := n.network.Properties(n.driver.ctx, n.network.Reference(), p, &info) + if err != nil { + return nil, err + } + return &info, nil +} diff --git a/driver/vm.go b/driver/vm.go index 93c52432e..8ef1fd580 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -231,11 +231,11 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) } if config.Network != "" { - net, err := template.driver.finder.Network(ctx, config.Network) + net, err := template.driver.FindNetwork(config.Network) if err != nil { return nil, err } - backing, err := net.EthernetCardBackingInfo(ctx) + backing, err := net.network.EthernetCardBackingInfo(ctx) if err != nil { return nil, err } From 1111c7469686abc16e729db5c37087bf531702c5 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Wed, 30 May 2018 14:52:27 +0300 Subject: [PATCH 238/266] Support IP address settle down timeout Sometimes it's possible that Windows VM starts with one address and then changes to another one. For successful communication we need latest one --- README.md | 1 + clone/builder.go | 4 +- clone/config.go | 2 + common/step_wait_for_ip.go | 79 ++++++++++++++++++++++++++++++++++---- iso/builder.go | 4 +- iso/config.go | 12 +++--- 6 files changed, 88 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 024b91b9b..196cb5aa0 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### Provision * `communicator` - `ssh` (default), `winrm`, or `none` (create/clone, customize hardware, but do not boot). +* `ip_settle_timeout`(string) - Amount of time to wait for VM's IP to settle down, sometimes VM may report incorrect IP initially, then its recommended to set that parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to 5s(5 seconds). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. * `ssh_username`(string) - Username in guest OS. * `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. * `ssh_private_key_file`(string) - Path to the SSH private key file to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. diff --git a/clone/builder.go b/clone/builder.go index ec3356709..f7ba7b77c 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -55,7 +55,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Config: &b.config.RunConfig, SetOrder: false, }, - &common.StepWaitForIp{}, + &common.StepWaitForIp{ + &b.config.WaitIpConfig, + }, &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost(b.config.Comm.SSHHost), diff --git a/clone/config.go b/clone/config.go index 420d0d495..bcb8b791b 100644 --- a/clone/config.go +++ b/clone/config.go @@ -19,6 +19,7 @@ type Config struct { common.ConfigParamsConfig `mapstructure:",squash"` common.RunConfig `mapstructure:",squash"` + common.WaitIpConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` @@ -44,6 +45,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.LocationConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.HardwareConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.WaitIpConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index 3cc1cfae4..e81460df5 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -6,10 +6,35 @@ import ( "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "log" "time" ) -type StepWaitForIp struct{} +type WaitIpConfig struct { + SettleTimeout string `mapstructure:"ip_settle_timeout"` + + settleTimeout time.Duration +} + +type StepWaitForIp struct { + Config *WaitIpConfig +} + +func (c *WaitIpConfig) Prepare() []error { + var errs []error + + if c.SettleTimeout == "" { + c.SettleTimeout = "5s" + } + + var err error + c.settleTimeout, err = time.ParseDuration(c.SettleTimeout) + if err != nil { + errs = append(errs, fmt.Errorf("failed parsing ip_settle_timeout: %s", err)) + } + + return errs +} func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) @@ -20,12 +45,7 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi ipChan := make(chan string) errChan := make(chan error) go func() { - ip, err := vm.WaitForIP(ctx) - if err != nil { - errChan <- err - } else { - ipChan <- ip - } + doGetIp(vm, ctx, s.Config, errChan, ipChan) }() for { @@ -47,4 +67,49 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi } } +func doGetIp(vm *driver.VirtualMachine, ctx context.Context, c *WaitIpConfig, errChan chan error, ipChan chan string) { + var prevIp = "" + var stopTime time.Time + var interval time.Duration + if c.settleTimeout.Seconds() >= 120 { + interval = 30 * time.Second + } else if c.settleTimeout.Seconds() >= 60 { + interval = 15 * time.Second + } else if c.settleTimeout.Seconds() >= 10 { + interval = 5 * time.Second + } else { + interval = 1 * time.Second + } +loop: + ip, err := vm.WaitForIP(ctx) + if err != nil { + errChan <- err + return + } + if prevIp == "" || prevIp != ip { + if prevIp == "" { + log.Printf("VM IP aquired: %s", ip) + } else { + log.Printf("VM IP changed from %s to %s", prevIp, ip) + } + prevIp = ip + stopTime = time.Now().Add(c.settleTimeout) + goto loop + } else { + log.Printf("VM IP is still the same: %s", prevIp) + if time.Now().After(stopTime) { + log.Printf("VM IP seems stable enough: %s", ip) + ipChan <- ip + return + } + select { + case <-ctx.Done(): + return + case <-time.After(interval): + goto loop + } + } + +} + func (s *StepWaitForIp) Cleanup(state multistep.StateBag) {} diff --git a/iso/builder.go b/iso/builder.go index 91fc8d630..b8345e86b 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -99,7 +99,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe Ctx: b.config.ctx, VMName: b.config.VMName, }, - &common.StepWaitForIp{}, + &common.StepWaitForIp{ + Config: &b.config.WaitIpConfig, + }, &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost(b.config.Comm.SSHHost), diff --git a/iso/config.go b/iso/config.go index 5e032126f..a6ba2953b 100644 --- a/iso/config.go +++ b/iso/config.go @@ -21,11 +21,12 @@ type Config struct { packerCommon.ISOConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - BootConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + BootConfig `mapstructure:",squash"` + common.WaitIpConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` @@ -67,6 +68,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.CDRomConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare()...) + errs = packer.MultiErrorAppend(errs, c.WaitIpConfig.Prepare()...) errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) From 4196a5323a19437938f48989d59b0a08f7bd7010 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 14:25:40 +0300 Subject: [PATCH 239/266] Update 'network' option documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 196cb5aa0..c1c542df3 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `RAM_hot_plug`(boolean) - Enable RAM hot plug setting for virtual machine. Defaults to `false`. * `video_ram`(number) - Amount of video memory in MB. * `disk_size`(number) - The size of the disk in MB. +* `network`(string) - Set network VM will be connected to. * `NestedHV`(boolean) - Enable nested hardware virtualization for VM. Defaults to `false`. * `configuration_parameters`(map) - Custom parameters. * `boot_order`(string) - Priority of boot devices. Defaults to `disk,cdrom` @@ -83,7 +84,6 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https * `guest_os_type`(string) - Set VM OS type. Defaults to `otherGuest`. See [here](https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.GuestOsDescriptor.GuestOsIdentifier.html) for a full list of possible values. * `disk_controller_type`(string) - Set VM disk controller type. Example `pvscsi`. * `disk_thin_provisioned`(boolean) - Enable VMDK thin provisioning for VM. Defaults to `false`. -* `network`(string) - Set network VM will be connected to. * `network_card`(string) - Set VM network card type. Example `vmxnet3`. * `usb_controller`(boolean) - Create USB controller for virtual machine. Defaults to `false`. * `cdrom_type`(string) - Which controller to use. Example `sata`. Defaults to `ide`. From 3f1c8fd2f78fe7b92b2d2d198854b406db167ed9 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 15:37:08 +0300 Subject: [PATCH 240/266] .gitignore: add vendor directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b99b727f8..274e07ca8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ bin/ test*.json crash.log packer_cache/ +vendor/ From fd608b574f82cb69a320af29e6ae4dc438b1c16b Mon Sep 17 00:00:00 2001 From: Cody Lingle <clingle@users.noreply.github.com> Date: Sat, 25 May 2019 00:45:53 -0500 Subject: [PATCH 241/266] Update plugin to Packer ^1.4 compatibility - Changed "http_port" from uint to int for step_boot_command (https://github.com/hashicorp/packer/pull/7423) - Implemented API changes for context cancellation of builders (https://github.com/hashicorp/packer/pull/7440) - Update packer (1.4.1) and govmomi (0.20.0) go modules - Run `go mod tidy` to clean up unnecessary go.mod and go.sum entries --- clone/builder.go | 11 +- common/step_shutdown.go | 2 +- go.mod | 69 +---- go.sum | 554 ++++++++++++++++++++++----------------- iso/builder.go | 12 +- iso/step_boot_command.go | 4 +- 6 files changed, 330 insertions(+), 322 deletions(-) diff --git a/clone/builder.go b/clone/builder.go index f7ba7b77c..6bee86dd0 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -1,6 +1,7 @@ package clone import ( + "context" packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" @@ -24,7 +25,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { return warnings, nil } -func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("comm", &b.config.Comm) state.Put("hook", hook) @@ -80,7 +81,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ) b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) - b.runner.Run(state) + b.runner.Run(ctx, state) if rawErr, ok := state.GetOk("error"); ok { return nil, rawErr.(error) @@ -95,9 +96,3 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } return artifact, nil } - -func (b *Builder) Cancel() { - if b.runner != nil { - b.runner.Cancel() - } -} diff --git a/common/step_shutdown.go b/common/step_shutdown.go index 2909919d9..86fee82c2 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -54,7 +54,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis Stdout: &stdout, Stderr: &stderr, } - err := comm.Start(cmd) + err := comm.Start(ctx, cmd) if err != nil { state.Put("error", fmt.Errorf("Failed to send shutdown command: %s", err)) return multistep.ActionHalt diff --git a/go.mod b/go.mod index 07fec712b..d137bec2f 100644 --- a/go.mod +++ b/go.mod @@ -1,71 +1,8 @@ module github.com/jetbrains-infra/packer-builder-vsphere require ( - github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect - github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 // indirect - github.com/Jeffail/gabs v1.1.1 // indirect - github.com/Microsoft/go-winio v0.4.11 // indirect - github.com/NYTimes/gziphandler v1.0.1 // indirect - github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect - github.com/SAP/go-hdb v0.13.1 // indirect - github.com/SermoDigital/jose v0.9.1 // indirect - github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf // indirect - github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect - github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect - github.com/cenkalti/backoff v2.1.0+incompatible // indirect - github.com/circonus-labs/circonus-gometrics v2.2.5+incompatible // indirect - github.com/circonus-labs/circonusllhist v0.1.3 // indirect - github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 // indirect - github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f // indirect - github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.3.3 // indirect - github.com/duosecurity/duo_api_golang v0.0.0-20181210160733-61e0defebf22 // indirect - github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect - github.com/fatih/color v1.7.0 // indirect - github.com/fatih/structs v1.1.0 // indirect - github.com/go-ldap/ldap v2.5.1+incompatible // indirect - github.com/go-sql-driver/mysql v1.4.1 // indirect - github.com/go-test/deep v1.0.1 // indirect - github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b // indirect - github.com/gogo/protobuf v1.2.0 // indirect - github.com/google/go-github v17.0.0+incompatible // indirect - github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect - github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f // indirect - github.com/hashicorp/go-memdb v0.0.0-20181108192425-032f93b25bec // indirect - github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect - github.com/hashicorp/go-plugin v0.0.0-20181212150838-f444068e8f5a // indirect - github.com/hashicorp/memberlist v0.1.0 // indirect - github.com/hashicorp/packer v1.3.3 - github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e // indirect - github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee // indirect - github.com/keybase/go-crypto v0.0.0-20181127160227-255a5089e85a // indirect - github.com/kr/pretty v0.1.0 // indirect - github.com/lib/pq v1.0.0 // indirect - github.com/mattn/go-colorable v0.0.9 // indirect - github.com/miekg/dns v1.1.1 // indirect - github.com/mitchellh/copystructure v1.0.0 // indirect - github.com/mitchellh/go-testing-interface v1.0.0 // indirect - github.com/onsi/ginkgo v1.7.0 // indirect - github.com/onsi/gomega v1.4.3 // indirect - github.com/opencontainers/go-digest v1.0.0-rc1 // indirect - github.com/opencontainers/image-spec v1.0.1 // indirect - github.com/opencontainers/runc v0.1.1 // indirect - github.com/ory/dockertest v3.3.2+incompatible // indirect - github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect - github.com/patrickmn/go-cache v2.1.0+incompatible // indirect - github.com/prometheus/client_golang v0.9.2 // indirect - github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect - github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect - github.com/vmware/govmomi v0.19.0 - golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4 + github.com/hashicorp/packer v1.4.1 + github.com/vmware/govmomi v0.20.0 + golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8 - google.golang.org/grpc v1.17.0 // indirect - gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect - gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect - gopkg.in/cheggaaa/pb.v1 v1.0.27 // indirect - gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect - gopkg.in/ldap.v2 v2.5.1 // indirect - gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect - gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect - gotest.tools v2.2.0+incompatible // indirect ) diff --git a/go.sum b/go.sum index 5d2c15c59..2576c669e 100644 --- a/go.sum +++ b/go.sum @@ -1,213 +1,207 @@ cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8= +cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= +contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= +dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= +dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= +dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= +git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1 h1:RMTyvS5bjvSWiUcfqfr/E2pxHEMrALvU+E12n6biymg= github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1/go.mod h1:61apmbkVJH4kg+38ftT+/l0XxdUCVnHggqcOTqZRSEE= -github.com/Azure/azure-sdk-for-go v17.3.1+incompatible h1:9Nzge8xxnYm5lVRkvTpG1odiDN0fYDorQwVEaVfg1+g= -github.com/Azure/azure-sdk-for-go v17.3.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/azure-sdk-for-go v27.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v10.12.0+incompatible h1:6YphwUK+oXbzvCc1fd5VrnxCekwzDkpA7gUEbci2MvI= github.com/Azure/go-autorest v10.12.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290 h1:K9I21XUHNbYD3GNMmJBN0UKJCpdP+glftwNZ7Bo8kqY= github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 h1:dmc/C8bpE5VkQn65PNbbyACDC8xw8Hpp/NEurdPmQDQ= -github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= -github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= -github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0= -github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591 h1:/P9HCl71+Eh6vDbKNyRu+rpIIR70UCZWNOGexVV3e6k= github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591/go.mod h1:EHGzQGbwozJBj/4qj3WGrTJ0FqjgOTOxLQ0VNWvPn08= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/SAP/go-hdb v0.13.1 h1:BuZlUZtqbF/oVSQ8Vp+/+wOtcBLh55zwMV7XnvYcz8g= -github.com/SAP/go-hdb v0.13.1/go.mod h1:etBT+FAi1t5k3K3tf5vQTnosgYmhDkRi8jEnQqCnxF0= -github.com/SermoDigital/jose v0.9.1 h1:atYaHPD3lPICcbK1owly3aPm0iaJGSGPi0WD4vLznv8= -github.com/SermoDigital/jose v0.9.1/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/Telmate/proxmox-api-go v0.0.0-20190410200643-f08824d5082d/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= +github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f h1:jI4DIE5Vf4oRaHfthB0oRhU+yuYuoOTurDzwAlskP00= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd h1:S3Fr6QnkpW9VRjiEY4psQHhhbbahASuNVj52YIce7lI= github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607 h1:BFFG6KP8ASFBg2ptWsJn8p8RDufBjBDKIxLU7BTYGOM= github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43/go.mod h1:S6puKjZ9ZeqUPBv2hEBnMZGcM2J6mOsDRQcmxkMAND0= -github.com/armon/go-metrics v0.0.0-20180713145231-3c58d8115a78 h1:mdRSArcFLfW0VoL34LZAKSz6LkkK4jFxVx2xYavACMg= -github.com/armon/go-metrics v0.0.0-20180713145231-3c58d8115a78/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20160115234725-4239b77079c7 h1:MBXhrxjNkjdqJysfNbKMMPFNXlz6EzpOnPcsoYBeD3E= -github.com/armon/go-radix v0.0.0-20160115234725-4239b77079c7/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.15.54 h1:yNFryYgHYlEuNnMM74EZgAaOM2BsJvu77/ev9I9GHlU= -github.com/aws/aws-sdk-go v1.15.54/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= +github.com/aws/aws-sdk-go v1.16.24 h1:I/A3Hwbgs3IEAP6v1bFpHKXiT7wZDoToX9cb00nxZnM= +github.com/aws/aws-sdk-go v1.16.24/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/bgentry/speakeasy v0.0.0-20150902231413-36e9cfdd6909 h1:mUVWHQ4tjVv86uJhxSbYqwdz4o+Imcl6HoZtoaqC3zM= -github.com/bgentry/speakeasy v0.0.0-20150902231413-36e9cfdd6909/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3 h1:3b+p838vN4sc37brz9W2HDphtSwZFcXZwFLyzm5Vk28= github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3/go.mod h1:YOY5xnRf7Jz2SZCLSKgVfyqNzbRgyTznM3HyDqQMxcU= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/cenkalti/backoff v2.1.0+incompatible h1:FIRvWBZrzS4YC7NT5cOuZjexzFvIr+Dbi6aD1cZaNBk= -github.com/cenkalti/backoff v2.1.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cheggaaa/pb v1.0.26 h1:cxVZXxXCTNW7yYwnrTAhJ42LcWrLjp676j+y1AmmLKA= -github.com/cheggaaa/pb v1.0.26/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/circonus-labs/circonus-gometrics v2.2.5+incompatible h1:KsuY3ogbxgVv3FNhbLUoT+SE9znoWEUIuChSIT4HukI= -github.com/circonus-labs/circonus-gometrics v2.2.5+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= +github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc= +github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 h1:4BX8f882bXEDKfWIf0wa8HRvpnBoPszJJXL+TVbBw4M= -github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/creack/goselect v0.0.0-20180210034346-528c74964609 h1:FSxXMd2wCHj6GqgBdo4UtVA9R2aieIDvSniepqyOppU= -github.com/creack/goselect v0.0.0-20180210034346-528c74964609/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/FHysWyE= +github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/creack/goselect v0.1.0/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/FHysWyE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f h1:WH0w/R4Yoey+04HhFxqZ6VX6I0d7RMyw5aXQ9UTvQPs= -github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc= -github.com/denverdino/aliyungo v0.0.0-20180417075537-ebad04655e03 h1:NYqwUkb/ypX8OZmBDpPPbZ4npAPjlGFXZ4aSOyRzRL8= -github.com/denverdino/aliyungo v0.0.0-20180417075537-ebad04655e03/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/digitalocean/godo v0.0.0-20170407151542-4c04abe183f4 h1:34XBbvedApvUMZY6E6Q95ksnpl+FtX+KF3ywZzZY6X0= -github.com/digitalocean/godo v0.0.0-20170407151542-4c04abe183f4/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= -github.com/docker/docker v0.0.0-20170406124027-fa3e2d5ab9b5 h1:DwY2bFs8p+xf2WaQewx2hnGdjYR5K4UAaxcNPyKkTek= -github.com/docker/docker v0.0.0-20170406124027-fa3e2d5ab9b5/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/duosecurity/duo_api_golang v0.0.0-20181210160733-61e0defebf22 h1:RqZJa9Ohzpyr5OADCKz/8t0vtdD2vczMdjqCbvTYz7o= -github.com/duosecurity/duo_api_golang v0.0.0-20181210160733-61e0defebf22/go.mod h1:UqXY1lYT/ERa4OEAywUqdok1T4RCRdArkhic1Opuavo= -github.com/dustin/go-humanize v0.0.0-20170228161531-259d2a102b87 h1:uPzP/9GIqYKvZAmz4IayKMMZiWRWNtGynUREBtTXPXA= -github.com/dustin/go-humanize v0.0.0-20170228161531-259d2a102b87/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/digitalocean/godo v1.11.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= +github.com/dnaeon/go-vcr v1.0.0/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/docker v0.0.0-20180422163414-57142e89befe/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI= github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY= github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-ini/ini v1.25.4 h1:Mujh4R/dH6YL8bxuISne3xX2+qcQ9p0IxKAP6ExWoUo= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-ldap/ldap v2.5.1+incompatible h1:Opaoft5zMW8IU/VRULB0eGMBQ9P5buRvCW6sFTRmMn8= -github.com/go-ldap/ldap v2.5.1+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= -github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg= -github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b h1:dnUw9Ih14dCKzbtZxm+pwQRYIb+9ypiwtZgsCQN4zmg= -github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gofrs/flock v0.7.1 h1:DP+LD/t0njgoPBvT5MJLeliUIVQR03hiKR6vezdwHlc= +github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v0.0.0-20160203230820-b982704f8bb7 h1:rZeVhHkNPzCCDNLr2eGTqph0njsIaj0lSLiuSnMdtrE= -github.com/golang/protobuf v0.0.0-20160203230820-b982704f8bb7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.0.0-20180328201512-5411ab924f9f h1:e7go61E2Xh2l5KtL3Lh6Tjy0/T+eem0bQsDwETI7SMo= -github.com/google/go-cmp v0.0.0-20180328201512-5411ab924f9f/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1 h1:ULA7QZ5KGgwOBeBBCA7Xyv96fmriEfhs0D2KDRslTd8= -github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 h1:JM174NTeGNJ2m/oLH3UOWOvWQQKd+BoL3hcSCUWFLt0= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= -github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d h1:rXQlD9GXkjA/PQZhmEaF/8Pj/sJfdZJK7GJG0gkS8I0= -github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gophercloud/gophercloud v0.0.0-20180815020510-83835c772d1a h1:BYGFl3ozKqWP2FnV4hyr8pNvBBLvyoREM4H6Un75wQ4= -github.com/gophercloud/gophercloud v0.0.0-20180815020510-83835c772d1a/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= -github.com/gophercloud/utils v0.0.0-20180806215700-d6e28a8b3199 h1:mmwryCmmFkCxL3t5r6syrbk1eyP6tP9q/whDdAiM9Mw= -github.com/gophercloud/utils v0.0.0-20180806215700-d6e28a8b3199/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= +github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= +github.com/googleapis/gax-go/v2 v2.0.3 h1:siORttZ36U2R/WjiJuDz8znElWBiAlO9rVt+mqJt0Cc= +github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/gophercloud/gophercloud v0.0.0-20180903124057-ea7289ebdf06/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= +github.com/gophercloud/utils v0.0.0-20190124192022-a5c25e7a53a6/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777 h1:JIM+OacoOJRU30xpjMf8sulYqjr0ViA3WDrTX6j/yDI= github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= -github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/hashicorp/atlas-go v0.0.0-20170808162531-17522f63497e/go.mod h1:ckHDuH0pxfnmXZkq1niVSguIIV0pA65gifQv3so9llw= -github.com/hashicorp/consul v0.0.0-20180807174550-3e6313bebbf0 h1:vh/G7ew4mi/FcKNrRk4x1N1fWYzYB5/AaSHr9W+wrF4= -github.com/hashicorp/consul v0.0.0-20180807174550-3e6313bebbf0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul v1.4.0 h1:PQTW4xCuAExEiSbhrsFsikzbW5gVBoi74BjUvYFyKHw= +github.com/hashicorp/consul v1.4.0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8= github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4= -github.com/hashicorp/go-cleanhttp v0.0.0-20160217214820-875fb671b3dd h1:g63OFYSdtNzMg+OszHIUmlRweTB2syHVsZDBKoa1km8= -github.com/hashicorp/go-cleanhttp v0.0.0-20160217214820-875fb671b3dd/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f h1:Yv9YzBlAETjy6AOX9eLBZ3nshNVRREgerT/3nvxlGho= -github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa h1:0nA8i+6Rwqaq9xlpmVxxTwk6rxiEhX+E6Wh4vPNHiS8= -github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa/go.mod h1:6ij3Z20p+OhOkCSrA0gImAWoHYQRGbnlcuk6XYTiaRw= -github.com/hashicorp/go-memdb v0.0.0-20181108192425-032f93b25bec h1:A1nDk9UOKWPTQh5YcCnbwNbqj23e5pggf4HxGBulhr8= -github.com/hashicorp/go-memdb v0.0.0-20181108192425-032f93b25bec/go.mod h1:kbfItVoBJwCfKXDXN4YoAXjxcFVZ7MRrJzyTX6H4giE= -github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c h1:BTAbnbegUIMB6xmQCwWE8yRzbA4XSpnZY5hvRJC188I= -github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v0.0.0-20150916205742-d30f09973e19 h1:gb61U/o4ZJ6TRYvZqJUKYidIhJOEAvNyVMesryROxAY= -github.com/hashicorp/go-multierror v0.0.0-20150916205742-d30f09973e19/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-getter v1.2.0 h1:E05bVPilzyh2yXgT6srn7WEkfMZaH+LuX9tDJw/4kaE= +github.com/hashicorp/go-getter v1.2.0/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= +github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79 h1:RKu7yAXZTaQsxj1K9GDsh+QVw0+Wu1SWHxtbFN0n+hE= github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79/go.mod h1:09jT3Y/OIsjTjQ2+3bkVNPDKqWcGIYYvjB2BEKVUdvc= -github.com/hashicorp/go-plugin v0.0.0-20181212150838-f444068e8f5a h1:z9eTtDWoxYrJvtAD+xAepmTEfEmYgouWUytJ84UWAr8= -github.com/hashicorp/go-plugin v0.0.0-20181212150838-f444068e8f5a/go.mod h1:Ft7ju2vWzhO0ETMKUVo12XmXmII6eSUS4rsPTkY/siA= -github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 h1:qCv4319q2q7XKn0MQbi8p37hsJ+9Xo8e6yojA73JVxk= -github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM= +github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4= +github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 h1:VBj0QYQ0u2MCJzBfeYXGexnAl17GsH1yidnoxCqqD9E= github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90/go.mod h1:o4zcYY1e0GEZI6eSEr+43QDYmuGglw1qSO6qdHUHCgg= -github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 h1:7YOlAIO2YWnJZkQp7B5eFykaIY7C9JndqAFQyVV5BhM= -github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-uuid v0.0.0-20160329185618-73d19cdc2bf0 h1:YnYV/qHLtjZmhFnWaSsNqVAUhxCuPKRe5wDGpOKYL/U= -github.com/hashicorp/go-uuid v0.0.0-20160329185618-73d19cdc2bf0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v0.0.0-20160119211326-7e3c02b30806 h1:0MKTKHll8VOZ0ciR+yTIEJ8JrT0UUiRDsgtujJT7a8U= -github.com/hashicorp/go-version v0.0.0-20160119211326-7e3c02b30806/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47 h1:UnszMmmmm5vLwWzDjTFVIkfhvWF1NdrmChl8L2NUDCw= -github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno= -github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= -github.com/hashicorp/memberlist v0.1.0 h1:qSsCiC0WYD39lbSitKNt40e30uorm2Ss/d4JGU1hzH8= -github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE= -github.com/hashicorp/packer v1.3.3 h1:LDQT1TT5Dye95RSQKp64bgq2lqjdXawVDjui4KX2hFQ= -github.com/hashicorp/packer v1.3.3/go.mod h1:zcRQ0hJ98C2QTp7ugB1qJb0Ng9zk+L8/o2UyAfWvmzk= -github.com/hashicorp/serf v0.0.0-20180530155958-984a73625de3 h1:NUr1hG6WO9sI1x8ofSimmpqfJ+rEHiHP/PLEA33rcfQ= -github.com/hashicorp/serf v0.0.0-20180530155958-984a73625de3/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= -github.com/hashicorp/vault v0.0.0-20180724215049-b9adaf9c6959 h1:PyVs2CB7Hxgl1kU0tWAVpagLK3N+MC0eeyKmG+L5VPI= -github.com/hashicorp/vault v0.0.0-20180724215049-b9adaf9c6959/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= -github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e h1:2Hwd2Yi0/qjAC6ujOu6WBVXAak9Snuw0LTYdZkqIdKM= -github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e/go.mod h1:VJHHT2SC1tAPrfENQeBhLlb5FbZoKZM+oC/ROmEftz0= -github.com/hashicorp/yamux v0.0.0-20151129044643-df949784da9e h1:R35YxgX/iWqsDjzoNO/7uFf8vjcgBIc02rvaV/Vr15c= -github.com/hashicorp/yamux v0.0.0-20151129044643-df949784da9e/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hetznercloud/hcloud-go v0.0.0-20181016094819-eaf050e4f370 h1:I1Qmx2XRn+A6wNYJErMKlvC1NQxVlu4D21Dq6F7A1x8= -github.com/hetznercloud/hcloud-go v0.0.0-20181016094819-eaf050e4f370/go.mod h1:g5pff0YNAZywQaivY/CmhUYFVp7oP0nu3MiODC2W4Hw= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/packer v1.4.1 h1:t0lr6GxeNgflSsIeVX3MgOTBvnwbKxMmzcq0dbY+qQM= +github.com/hashicorp/packer v1.4.1/go.mod h1:/phmcGwE+ZASI47vncbyLEqdb8UyiG9uNFBhNU7F65U= +github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/vault v1.1.0 h1:v79NUgO5xCZnXVzUkIqFOXtP8YhpnHAi1fk3eo9cuOE= +github.com/hashicorp/vault v1.1.0/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hetznercloud/hcloud-go v1.12.0/go.mod h1:g5pff0YNAZywQaivY/CmhUYFVp7oP0nu3MiODC2W4Hw= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee h1:AQ/QmCk6x8ECPpf2pkPtA4lyncEEBbs8VFnVXPYKhIs= -github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee/go.mod h1:N0t2vlmpe8nyZB5ouIbJQPDSR+mH6oe7xHB9VZHSUzM= +github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775/go.mod h1:R9rU87RxxmcD3DkspW9JqGBXiJyg5MA+WNCtJrBtnXs= +github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564 h1:+HMa2xWQOm+9ebsl0+XsuLaPuFCxExv3sCXo5psVzYI= github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro= github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= -github.com/keybase/go-crypto v0.0.0-20181127160227-255a5089e85a h1:X/UFlwD2/UV0RCy+8ITi4DmxJwk83YUH7bXwkJIHHMo= -github.com/keybase/go-crypto v0.0.0-20181127160227-255a5089e85a/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77 h1:rJnR80lkojFgjdg/oQPhbZoY8t8uM51XMz8DrJrjabk= github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -217,66 +211,73 @@ github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f h1:UD9YLTi2aBhdOOT github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec h1:PYqF3Tiz2W2Ag0ezyDhAobWDWlrFv7U+qct4spLeDBM= github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c h1:FMUOnVGy8nWk1cvlMCAoftRItQGMxI0vzJ3dQjeZTCE= github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= -github.com/masterzen/simplexml v0.0.0-20140219194429-95ba30457eb1 h1:cLEbk5d4t8CDqmQtCMc2lk91cflxOrj31k9LTIabPoA= -github.com/masterzen/simplexml v0.0.0-20140219194429-95ba30457eb1/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg= +github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= github.com/masterzen/winrm v0.0.0-20180224160350-7e40f93ae939 h1:cRFHA33ER97Xy5jmjS519OXCS/yE3AT3zdbQAg0Z53g= github.com/masterzen/winrm v0.0.0-20180224160350-7e40f93ae939/go.mod h1:CfZSN7zwz5gJiFhZJz49Uzk7mEBHIceWmbFmYx7Hf7E= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.0-20151211000621-56b76bdf51f7 h1:owMyzMR4QR+jSdlfkX9jPU3rsby4++j99BfbtgVr6ZY= -github.com/mattn/go-isatty v0.0.0-20151211000621-56b76bdf51f7/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.0-20170510074858-97311d9f7767 h1:Nk2R0tWpD2RdkQ+53zE6kWnSGuhQyDlnOs2MPiqVubE= -github.com/mattn/go-runewidth v0.0.0-20170510074858-97311d9f7767/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-tty v0.0.0-20190424173100-523744f04859/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.1 h1:DVkblRdiScEnEr0LR9nTnEQqHYycjkXW9bOjd+2EL2o= github.com/miekg/dns v1.1.1/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v0.0.0-20170908181043-65fcae5817c8 h1:ZPmOsqSxGDUqFp0ErYpJDIfaBRBGvQv0qDPr37kZBrk= -github.com/mitchellh/cli v0.0.0-20170908181043-65fcae5817c8/go.mod h1:oGumspjLm2kTyiT1QMGpFqRlmxnKHfCvhZEVnx+5UeE= -github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7 h1:PXPMDtfqV+rZJshQHOiwUFqlqErXaAcuWy+/ZmyRfNc= github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7/go.mod h1:g7SZj7ABpStq3tM4zqHiVEG5un/DZ1+qJJKO7qx1EvU= -github.com/mitchellh/go-homedir v0.0.0-20151025052427-d682a8f0cf13 h1:VWOqu/UItbEBupQwKkabbfnoEbgAE4IGjZBH2MFx8jY= -github.com/mitchellh/go-homedir v0.0.0-20151025052427-d682a8f0cf13/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed h1:FI2NIv6fpef6BQl2u3IZX/Cj20tfypRF4yd+uaHOMtI= github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= -github.com/mitchellh/iochan v0.0.0-20150529224432-87b45ffd0e95 h1:aHWVygBsLb+Kls/35B3tevL1hvDxZ0UklPA0BmhqTEk= -github.com/mitchellh/iochan v0.0.0-20150529224432-87b45ffd0e95/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc h1:5T6hzGUO5OrL6MdYXYoLQtRWJDDgjdlOVBn9mIqGY1g= github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557 h1:w1QuuAA2km2Hax+EPamrq5ZRBeaNv2vsjvgB4an0zoU= github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557/go.mod h1:QuAqW7/z+iv6aWFJdrA8kCbsF0OOJVKCICqTcYBexuY= github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784 h1:+DAetXqxv/mSyCkE9KBIYOZs9b68y7SUaDCxQMRjA68= github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= -github.com/mitchellh/reflectwalk v0.0.0-20150527153153-eecf4c70c626 h1:88u9H4mNODBcQUwlNpl6+jBhdoYT3WSi0w4hpYaYZ/o= -github.com/mitchellh/reflectwalk v0.0.0-20150527153153-eecf4c70c626/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef h1:E/seV1Rtsnr2juBw1Dfz4iDPT3/5s1H/BATx+ePmSyo= github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef/go.mod h1:LgKrp0Iss/BVwquptq4eIe6HPr0s3t1WHT5x0qOh14U= github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215 h1:y6FZWUBBt1iPmJyGbGza3ncvVBMKzgd32oFChRZR7Do= github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215/go.mod h1:CxM/JGtpRrEPve5H04IhxJrGhxgwxMc6jSP2T4YD60w= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b h1:LGItPaClbzopugAomw5VFKnG3h1dUr9QW5KOU+m8gu0= github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -284,148 +285,229 @@ github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/oracle/oci-go-sdk v1.8.0 h1:4SO45bKV0I3/Mn1os3ANDZmV0eSE5z5CLdSUIkxtyzs= github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= -github.com/ory/dockertest v3.3.2+incompatible h1:uO+NcwH6GuFof/Uz8yzjNi1g0sGT5SLAJbdBvD8bUYc= -github.com/ory/dockertest v3.3.2+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a h1:A3QMuteviunoaY/8ex+RKFqwhcZJ/Cf3fCW3IwL2wx4= github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= -github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pierrec/lz4 v0.0.0-20160112163551-383c0d87b5dd h1:0EXhZlgCFcAZjhD6f6yqIINBBBym9seHr6AkvAWUgN8= -github.com/pierrec/lz4 v0.0.0-20160112163551-383c0d87b5dd/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/xxHash v0.0.0-20160112165351-5a004441f897 h1:jp3jc/PyyTrTKjJJ6rWnhTbmo7tGgBFyG9AL5FIrO1I= -github.com/pierrec/xxHash v0.0.0-20160112165351-5a004441f897/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= -github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e h1:+RHxT/gm0O3UF7nLJbdNzAmULvCFt4XfXHWzh3XI/zs= -github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca h1:k8gsErq3rkcbAyCnpOycQsbw88NjCHk7L3KfBZKhQDQ= github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v0.0.0-20170908125245-88e59760adad h1:jTlrcNQXxCpT8NU0MG1aiUkfAiTlm+W6KPScysqjvdA= -github.com/posener/complete v0.0.0-20170908125245-88e59760adad/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible h1:ZoVHH6voxW9Onzo6z2yLtocVoN6mBocyDoqoyAMHokE= github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible/go.mod h1:T3/WrziK7fYH3C8ilAFAHe99R452/IzIG3YYkqaOFeQ= -github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17 h1:4qPms2txLWMLXKzqlnYSulKRS4cS9aYgPtAEpUelQok= github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17/go.mod h1:SAEjPB4voP88qmWJXI7mA5m15uNlEnuHLx4Eu2mPGpQ= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/rwtodd/Go.Sed v0.0.0-20170507045331-d6d5d585814e h1:lN+IKs+Jb9uwDOMO4VJZzH9vOjjist0THR5s9akp+Ss= github.com/rwtodd/Go.Sed v0.0.0-20170507045331-d6d5d585814e/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 h1:7YvPJVmEeFHR1Tj9sZEYsmarJEQfMVYpd/Vyy/A8dqE= github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/satori/go.uuid v0.0.0-20170321230731-5bf94b69c6b6 h1:7PFDlUz5/yGp8w21PuZGgEfN7ZF7OXvgAIDjwih82Gs= -github.com/satori/go.uuid v0.0.0-20170321230731-5bf94b69c6b6/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/satori/uuid v0.0.0-20170321230731-5bf94b69c6b6/go.mod h1:B8HLsPLik/YNn6KKWVMDJ8nzCL8RP5WyfsnmvnAEwIU= +github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70 h1:DaqC32ZwOuO4ctgg9qAdKnlQxwFPkKmCOEqwSNwYy7c= github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70/go.mod h1:XjlXWPd6VONhsRSEuzGkV8mzRpH7ou1cdLV7IKJk96s= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v0.0.0-20180315010703-90150a8ed11b h1:m1cItYkpJSJ3ZKPEV/XKbZTcCaJHY1qF+R9GisLZ4kw= -github.com/sirupsen/logrus v0.0.0-20180315010703-90150a8ed11b/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= +github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= +github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= +github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= +github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= +github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= +github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= +github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= +github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= +github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U= -github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9 h1:/Bsw4C+DEdqPjt8vAqaC9LAqpAQnaCQQqmolqq3S1T4= -github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 h1:U6ufy3mLDgg9RYupntOvAF7xCmNNquyKaYaaVHo1Nnk= github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670 h1:HQWT4ta3wW5GZ790GaqLCS+w1dvuA3rMfEQxLi+UOYU= -github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 h1:s5pyxd5S6wRs2WpEE0xRfWUF46Wbz44h203KnbX0ecI= +github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= +github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/vmware/govmomi v0.19.0 h1:CR6tEByWCPOnRoRyhLzuHaU+6o2ybF3qufNRWS/MGrY= -github.com/vmware/govmomi v0.19.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/xanzy/go-cloudstack v2.1.4+incompatible h1:5c72sRFakVv8wH/HsQFg+xr37CmNQU2UbJfaBjW5f0c= -github.com/xanzy/go-cloudstack v2.1.4+incompatible/go.mod h1:s3eL3z5pNXF5FVybcT+LIVdId8pYn709yv6v5mrkrQE= -golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4 h1:AJCW0rhPjFKEAoValWpqnRKxX8YV0Xvqfw+dOexCTPc= -golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/vmware/govmomi v0.20.0 h1:+1IyhvoVb5JET2Wvgw9J3ZDv6CK4sxzUunpH8LhQqm4= +github.com/vmware/govmomi v0.20.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/xanzy/go-cloudstack v2.4.1+incompatible/go.mod h1:s3eL3z5pNXF5FVybcT+LIVdId8pYn709yv6v5mrkrQE= +github.com/yandex-cloud/go-genproto v0.0.0-20190401174212-1db0ef3dce9b/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE= +github.com/yandex-cloud/go-sdk v0.0.0-20190402114215-3fc1d6947035/go.mod h1:Eml0jFLU4VVHgIN8zPHMuNwZXVzUMILyO6lQZSfz854= +go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2 h1:NAfh7zF0/3/HqtMvJNZ/RFrSlCE6ZTlHmKfhL/Dm1Jk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d h1:adrbvkTDn9rGnXg2IJDKozEpXXLZN89pdIA+Syt4/u0= +golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8 h1:Q/I0fOWMTCcD88KusB5RVd4ziMZD/oEXE0zPgTV43r8= golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d h1:i6RB+Qz1ug7TvJdY4zieRMpnLAtkHSHTOvApNXfLT4A= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/oauth2 v0.0.0-20160121061903-8a57ed94ffd4 h1:9XepZslbsnDusjUYh6+WSErDUzVo/HMQEYzWVxp3Wg4= -golang.org/x/oauth2 v0.0.0-20160121061903-8a57ed94ffd4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 h1:FP8hkuE6yUEaJnK7O2eTuejKWwW+Rhfj80dQ2JcKxCU= +golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20170317231601-5a06fca2c336 h1:wAXSJAibyxWKRVHDNP2Co1zh7bRL9wiIZa+nsM5iLV4= -golang.org/x/sync v0.0.0-20170317231601-5a06fca2c336/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180326154331-13d03a9a82fb h1:w1eDrzbtlRsu1SyjnZZFUBVuhRN2Rn6DlrHCx9s4ud0= -golang.org/x/sys v0.0.0-20180326154331-13d03a9a82fb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.0.0-20180708171225-0605a8320ace h1:3mpprtjg+Ub12Q3O5M02xoGQjF0M93WOKTMkXzYE+f4= -golang.org/x/text v0.0.0-20180708171225-0605a8320ace/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190425145619-16072639606e h1:4ktJgTV34+N3qOZUc5fAaG3Pb11qzMm3PkAoTAgUZ2I= +golang.org/x/sys v0.0.0-20190425145619-16072639606e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1 h1:nsUiJHvm6yOoRozW9Tz0siNk9sHieLzR+w814Ihse3A= +golang.org/x/text v0.3.1/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/api v0.0.0-20180818000503-e21acd801f91 h1:MgYYgjaWMS2qQiDwCznfbqNmEOdSULlvjCvSCvIe/Wo= -google.golang.org/api v0.0.0-20180818000503-e21acd801f91/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/appengine v0.0.0-20160118045125-6bde959377a9 h1:N0a1+y6LSCarkW70HtWi8pVKlIA63MtKb+sq9tmkcNg= -google.golang.org/appengine v0.0.0-20160118045125-6bde959377a9/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= +google.golang.org/api v0.3.1 h1:oJra/lMfmtm13/rgY/8i3MzjFWYXvQIAKjQ3HqofMk8= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/cloud v0.0.0-20160202182918-5a3b06f8b5da h1:GqvJK5t3NykRbh1/2caGotUhCjk8d2UWK9zvYwnT7Xs= -google.golang.org/cloud v0.0.0-20160202182918-5a3b06f8b5da/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1 h1:TrBcJ1yqAl1G++wO39nD/qtgpsW9/1+QGrluyMGEYgM= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/h2non/gock.v1 v1.0.12/go.mod h1:KHI4Z1sxDW6P4N3DfTWSEza07YpkQP7KJBfglRMEjKY= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ldap.v2 v2.5.1 h1:wiu0okdNfjlBzg6UWvd1Hn8Y+Ux17/u/4nlk4CQr6tU= -gopkg.in/ldap.v2 v2.5.1/go.mod h1:oI0cpe/D7HRtBQl8aTg+ZmzFUAvu4lsv3eLXMLGFxWk= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce h1:xcEWjVhvbDy+nHP67nPDDpbYrY+ILlfndk4bRioVHaU= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516/go.mod h1:d3R+NllX3X5e0zlG1Rful3uLvsGC/Q3OHut5464DEQw= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/vmihailenco/msgpack.v2 v2.9.1 h1:kb0VV7NuIojvRfzwslQeP3yArBqJHW9tOl4t38VS1jM= -gopkg.in/vmihailenco/msgpack.v2 v2.9.1/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/iso/builder.go b/iso/builder.go index b8345e86b..c31267c31 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -1,6 +1,7 @@ package iso import ( + "context" packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" @@ -24,9 +25,8 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { return warnings, nil } -func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) - state.Put("cache", cache) state.Put("comm", &b.config.Comm) state.Put("hook", hook) state.Put("ui", ui) @@ -129,7 +129,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ) b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) - b.runner.Run(state) + b.runner.Run(ctx, state) if rawErr, ok := state.GetOk("error"); ok { return nil, rawErr.(error) @@ -144,9 +144,3 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } return artifact, nil } - -func (b *Builder) Cancel() { - if b.runner != nil { - b.runner.Cancel() - } -} diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 4e8006b7c..17a90192c 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -27,7 +27,7 @@ type BootConfig struct { type bootCommandTemplateData struct { HTTPIP string - HTTPPort uint + HTTPPort int Name string } @@ -112,7 +112,7 @@ WAITLOOP: } } - port := state.Get("http_port").(uint) + port := state.Get("http_port").(int) if port > 0 { ip, err := getHostIP(s.Config.HTTPIP) if err != nil { From 11475366465213411f459a28abbcfd88504b4122 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 16:43:06 +0300 Subject: [PATCH 242/266] Update dependencies --- go.mod | 6 ++-- go.sum | 101 +++++++++++++++------------------------------------------ 2 files changed, 30 insertions(+), 77 deletions(-) diff --git a/go.mod b/go.mod index d137bec2f..d00a4a152 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/jetbrains-infra/packer-builder-vsphere require ( - github.com/hashicorp/packer v1.4.1 + github.com/hashicorp/packer v1.4.2 github.com/vmware/govmomi v0.20.0 - golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d - golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8 + golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 + golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 ) diff --git a/go.sum b/go.sum index 2576c669e..37bf74f9a 100644 --- a/go.sum +++ b/go.sum @@ -1,36 +1,30 @@ -cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8= cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= -contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= +contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1 h1:RMTyvS5bjvSWiUcfqfr/E2pxHEMrALvU+E12n6biymg= github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1/go.mod h1:61apmbkVJH4kg+38ftT+/l0XxdUCVnHggqcOTqZRSEE= -github.com/Azure/azure-sdk-for-go v27.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest v10.12.0+incompatible h1:6YphwUK+oXbzvCc1fd5VrnxCekwzDkpA7gUEbci2MvI= -github.com/Azure/go-autorest v10.12.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= +github.com/Azure/azure-sdk-for-go v30.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290 h1:K9I21XUHNbYD3GNMmJBN0UKJCpdP+glftwNZ7Bo8kqY= github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591 h1:/P9HCl71+Eh6vDbKNyRu+rpIIR70UCZWNOGexVV3e6k= github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591/go.mod h1:EHGzQGbwozJBj/4qj3WGrTJ0FqjgOTOxLQ0VNWvPn08= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/Telmate/proxmox-api-go v0.0.0-20190410200643-f08824d5082d/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= +github.com/Telmate/proxmox-api-go v0.0.0-20190614181158-26cd147831a4/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= -github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f h1:jI4DIE5Vf4oRaHfthB0oRhU+yuYuoOTurDzwAlskP00= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd h1:S3Fr6QnkpW9VRjiEY4psQHhhbbahASuNVj52YIce7lI= @@ -48,26 +42,23 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.24 h1:I/A3Hwbgs3IEAP6v1bFpHKXiT7wZDoToX9cb00nxZnM= github.com/aws/aws-sdk-go v1.16.24/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3 h1:3b+p838vN4sc37brz9W2HDphtSwZFcXZwFLyzm5Vk28= github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3/go.mod h1:YOY5xnRf7Jz2SZCLSKgVfyqNzbRgyTznM3HyDqQMxcU= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/creack/goselect v0.1.0/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/FHysWyE= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/digitalocean/godo v1.11.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= github.com/dnaeon/go-vcr v1.0.0/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= @@ -83,11 +74,9 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-ini/ini v1.25.4 h1:Mujh4R/dH6YL8bxuISne3xX2+qcQ9p0IxKAP6ExWoUo= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -95,14 +84,12 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gofrs/flock v0.7.1 h1:DP+LD/t0njgoPBvT5MJLeliUIVQR03hiKR6vezdwHlc= github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -112,13 +99,11 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCy github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 h1:JM174NTeGNJ2m/oLH3UOWOvWQQKd+BoL3hcSCUWFLt0= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= @@ -131,7 +116,6 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777 h1:JIM+OacoOJRU30xpjMf8sulYqjr0ViA3WDrTX6j/yDI= github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= @@ -152,7 +136,6 @@ github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqk github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79 h1:RKu7yAXZTaQsxj1K9GDsh+QVw0+Wu1SWHxtbFN0n+hE= github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79/go.mod h1:09jT3Y/OIsjTjQ2+3bkVNPDKqWcGIYYvjB2BEKVUdvc= github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4= github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= @@ -166,6 +149,7 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -178,8 +162,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/packer v1.4.1 h1:t0lr6GxeNgflSsIeVX3MgOTBvnwbKxMmzcq0dbY+qQM= -github.com/hashicorp/packer v1.4.1/go.mod h1:/phmcGwE+ZASI47vncbyLEqdb8UyiG9uNFBhNU7F65U= +github.com/hashicorp/packer v1.4.2 h1:4WE9HLrht/bNefy7GFR4eyLmd18caM5K4RCvVUxur40= +github.com/hashicorp/packer v1.4.2/go.mod h1:uesgTpUABDx76pwrYvB7sD2zBMxUvCYU04/hmz4pIi8= github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/vault v1.1.0 h1:v79NUgO5xCZnXVzUkIqFOXtP8YhpnHAi1fk3eo9cuOE= @@ -187,29 +171,21 @@ github.com/hashicorp/vault v1.1.0/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAb github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hetznercloud/hcloud-go v1.12.0/go.mod h1:g5pff0YNAZywQaivY/CmhUYFVp7oP0nu3MiODC2W4Hw= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775/go.mod h1:R9rU87RxxmcD3DkspW9JqGBXiJyg5MA+WNCtJrBtnXs= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564 h1:+HMa2xWQOm+9ebsl0+XsuLaPuFCxExv3sCXo5psVzYI= github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro= github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77 h1:rJnR80lkojFgjdg/oQPhbZoY8t8uM51XMz8DrJrjabk= github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/cpuid v0.0.0-20160106104451-349c67577817 h1:/7pPahIC+GoCm/euDCi2Pm29bAj9tc6TcK4Zcc8D3WI= github.com/klauspost/cpuid v0.0.0-20160106104451-349c67577817/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f h1:UD9YLTi2aBhdOOThzatodQ/pGd9nd5255swS+UzHZj4= github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec h1:PYqF3Tiz2W2Ag0ezyDhAobWDWlrFv7U+qct4spLeDBM= github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= @@ -223,7 +199,6 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= -github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY= github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c h1:FMUOnVGy8nWk1cvlMCAoftRItQGMxI0vzJ3dQjeZTCE= github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= @@ -239,7 +214,6 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-tty v0.0.0-20190424173100-523744f04859/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -252,25 +226,22 @@ github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnG github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed h1:FI2NIv6fpef6BQl2u3IZX/Cj20tfypRF4yd+uaHOMtI= github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc h1:5T6hzGUO5OrL6MdYXYoLQtRWJDDgjdlOVBn9mIqGY1g= github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557 h1:w1QuuAA2km2Hax+EPamrq5ZRBeaNv2vsjvgB4an0zoU= github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557/go.mod h1:QuAqW7/z+iv6aWFJdrA8kCbsF0OOJVKCICqTcYBexuY= -github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784 h1:+DAetXqxv/mSyCkE9KBIYOZs9b68y7SUaDCxQMRjA68= github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mna/pigeon v1.0.0/go.mod h1:Iym28+kJVnC1hfQvv5MUtI6AiFFzvQjHcvI4RFTG/04= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef h1:E/seV1Rtsnr2juBw1Dfz4iDPT3/5s1H/BATx+ePmSyo= github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef/go.mod h1:LgKrp0Iss/BVwquptq4eIe6HPr0s3t1WHT5x0qOh14U= -github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215 h1:y6FZWUBBt1iPmJyGbGza3ncvVBMKzgd32oFChRZR7Do= github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215/go.mod h1:CxM/JGtpRrEPve5H04IhxJrGhxgwxMc6jSP2T4YD60w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= @@ -278,16 +249,12 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b h1:LGItPaClbzopugAomw5VFKnG3h1dUr9QW5KOU+m8gu0= github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/oracle/oci-go-sdk v1.8.0 h1:4SO45bKV0I3/Mn1os3ANDZmV0eSE5z5CLdSUIkxtyzs= github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a h1:A3QMuteviunoaY/8ex+RKFqwhcZJ/Cf3fCW3IwL2wx4= github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= @@ -302,12 +269,10 @@ github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca/go.mod h1:NxmoDg/QLVWluQD github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible h1:ZoVHH6voxW9Onzo6z2yLtocVoN6mBocyDoqoyAMHokE= github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible/go.mod h1:T3/WrziK7fYH3C8ilAFAHe99R452/IzIG3YYkqaOFeQ= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= @@ -316,7 +281,6 @@ github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17 h1:4qPms2txLWMLXKzqlnYSulKRS4cS9aYgPtAEpUelQok= github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17/go.mod h1:SAEjPB4voP88qmWJXI7mA5m15uNlEnuHLx4Eu2mPGpQ= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -327,7 +291,6 @@ github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 h1:7YvPJVmEeFHR1T github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70 h1:DaqC32ZwOuO4ctgg9qAdKnlQxwFPkKmCOEqwSNwYy7c= github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70/go.mod h1:XjlXWPd6VONhsRSEuzGkV8mzRpH7ou1cdLV7IKJk96s= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -361,7 +324,6 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -374,28 +336,31 @@ github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4A github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= github.com/vmware/govmomi v0.20.0 h1:+1IyhvoVb5JET2Wvgw9J3ZDv6CK4sxzUunpH8LhQqm4= github.com/vmware/govmomi v0.20.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/xanzy/go-cloudstack v2.4.1+incompatible/go.mod h1:s3eL3z5pNXF5FVybcT+LIVdId8pYn709yv6v5mrkrQE= +github.com/xanzy/go-cloudstack v0.0.0-20190526095453-42f262b63ed0/go.mod h1:sBh287mCRwCz6zyXHMmw7sSZGPohVpnx+o+OY4M+i3A= github.com/yandex-cloud/go-genproto v0.0.0-20190401174212-1db0ef3dce9b/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE= github.com/yandex-cloud/go-sdk v0.0.0-20190402114215-3fc1d6947035/go.mod h1:Eml0jFLU4VVHgIN8zPHMuNwZXVzUMILyO6lQZSfz854= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2 h1:NAfh7zF0/3/HqtMvJNZ/RFrSlCE6ZTlHmKfhL/Dm1Jk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d h1:adrbvkTDn9rGnXg2IJDKozEpXXLZN89pdIA+Syt4/u0= golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8 h1:Q/I0fOWMTCcD88KusB5RVd4ziMZD/oEXE0zPgTV43r8= -golang.org/x/mobile v0.0.0-20181130133120-ca3c58166ed8/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 h1:H6DkDrMSuEE2MQR7DgGwkzbXSY1lvMpEN5MDE1bo/5U= +golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -403,7 +368,6 @@ golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -413,7 +377,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 h1:FP8hkuE6yUEaJnK7O2eTuejKWwW+Rhfj80dQ2JcKxCU= golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -421,17 +384,14 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFM golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -440,15 +400,14 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190425145619-16072639606e h1:4ktJgTV34+N3qOZUc5fAaG3Pb11qzMm3PkAoTAgUZ2I= golang.org/x/sys v0.0.0-20190425145619-16072639606e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1 h1:nsUiJHvm6yOoRozW9Tz0siNk9sHieLzR+w814Ihse3A= golang.org/x/text v0.3.1/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -457,19 +416,19 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190530184349-ce1a3806b557/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/api v0.3.1 h1:oJra/lMfmtm13/rgY/8i3MzjFWYXvQIAKjQ3HqofMk8= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= +google.golang.org/api v0.4.0 h1:KKgc1aqhV8wDPbDzlDtpvyjZFY3vjz85FP7p4wcQUyI= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -479,30 +438,24 @@ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqn google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1 h1:TrBcJ1yqAl1G++wO39nD/qtgpsW9/1+QGrluyMGEYgM= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/h2non/gock.v1 v1.0.12/go.mod h1:KHI4Z1sxDW6P4N3DfTWSEza07YpkQP7KJBfglRMEjKY= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516/go.mod h1:d3R+NllX3X5e0zlG1Rful3uLvsGC/Q3OHut5464DEQw= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= From 94a036038bd569a987d3b52acfd9faf383e07f71 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 17:48:37 +0300 Subject: [PATCH 243/266] Fix inspections --- clone/builder.go | 2 +- clone/step_clone.go | 6 +++--- cmd/clone/main.go | 5 ++++- cmd/iso/main.go | 5 ++++- driver/datastore.go | 3 +++ driver/driver.go | 6 +++--- driver/vm.go | 30 ++++++++++-------------------- iso/step_add_floppy.go | 4 ++-- iso/step_create.go | 6 +++--- iso/step_remote_upload.go | 18 +++++++++--------- 10 files changed, 42 insertions(+), 43 deletions(-) diff --git a/clone/builder.go b/clone/builder.go index 6bee86dd0..ac446733b 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -57,7 +57,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack SetOrder: false, }, &common.StepWaitForIp{ - &b.config.WaitIpConfig, + Config: &b.config.WaitIpConfig, }, &communicator.StepConnect{ Config: &b.config.Comm, diff --git a/clone/step_clone.go b/clone/step_clone.go index 294368b95..ab6abf4b2 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -41,14 +41,14 @@ func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) - find_vm, err := d.FindVM(s.Location.VMName) + vm, err := d.FindVM(s.Location.VMName) if s.Force == false && err == nil { state.Put("error", fmt.Errorf("%s already exists, you can use -force flag to destroy it: %v", s.Location.VMName, err)) return multistep.ActionHalt } else if s.Force == true && err == nil { ui.Say(fmt.Sprintf("the vm/template %s already exists, but deleting it due to -force flag", s.Location.VMName)) - err := find_vm.Destroy() + err := vm.Destroy() if err != nil { state.Put("error", fmt.Errorf("error destroying %s: %v", s.Location.VMName, err)) } @@ -61,7 +61,7 @@ func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist return multistep.ActionHalt } - vm, err := template.Clone(ctx, &driver.CloneConfig{ + vm, err = template.Clone(ctx, &driver.CloneConfig{ Name: s.Location.VMName, Folder: s.Location.Folder, Cluster: s.Location.Cluster, diff --git a/cmd/clone/main.go b/cmd/clone/main.go index 0ac47b4a6..2e60eff06 100644 --- a/cmd/clone/main.go +++ b/cmd/clone/main.go @@ -8,6 +8,9 @@ func main() { if err != nil { panic(err) } - server.RegisterBuilder(new(clone.Builder)) + err = server.RegisterBuilder(new(clone.Builder)) + if err != nil { + panic(err) + } server.Serve() } diff --git a/cmd/iso/main.go b/cmd/iso/main.go index f64cc1720..f28508154 100644 --- a/cmd/iso/main.go +++ b/cmd/iso/main.go @@ -8,6 +8,9 @@ func main() { if err != nil { panic(err) } - server.RegisterBuilder(new(iso.Builder)) + err = server.RegisterBuilder(new(iso.Builder)) + if err != nil { + panic(err) + } server.Serve() } diff --git a/driver/datastore.go b/driver/datastore.go index eed3d4f28..e553e9c3c 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -39,6 +39,9 @@ func (d *Driver) FindDatastore(name string, host string) (*Datastore, error) { ds := d.NewDatastore(&i.Datastore[0]) inf, err := ds.Info("name") + if err != nil { + return nil, err + } name = inf.Name } diff --git a/driver/driver.go b/driver/driver.go index 68e3029ad..e93fbe47b 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -31,14 +31,14 @@ type ConnectConfig struct { func NewDriver(config *ConnectConfig) (*Driver, error) { ctx := context.TODO() - vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) + vcenterUrl, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) if err != nil { return nil, err } credentials := url.UserPassword(config.Username, config.Password) - vcenter_url.User = credentials + vcenterUrl.User = credentials - soapClient := soap.NewClient(vcenter_url, config.InsecureConnection) + soapClient := soap.NewClient(vcenterUrl, config.InsecureConnection) vimClient, err := vim25.NewClient(ctx, soapClient) if err != nil { return nil, err diff --git a/driver/vm.go b/driver/vm.go index 8ef1fd580..35ab3ffc0 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -183,22 +183,22 @@ func (vm *VirtualMachine) Devices() (object.VirtualDeviceList, error) { return vmInfo.Config.Hardware.Device, nil } -func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) (*VirtualMachine, error) { - folder, err := template.driver.FindFolder(config.Folder) +func (vm *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) (*VirtualMachine, error) { + folder, err := vm.driver.FindFolder(config.Folder) if err != nil { return nil, err } var relocateSpec types.VirtualMachineRelocateSpec - pool, err := template.driver.FindResourcePool(config.Cluster, config.Host, config.ResourcePool) + pool, err := vm.driver.FindResourcePool(config.Cluster, config.Host, config.ResourcePool) if err != nil { return nil, err } poolRef := pool.pool.Reference() relocateSpec.Pool = &poolRef - datastore, err := template.driver.FindDatastore(config.Datastore, config.Host) + datastore, err := vm.driver.FindDatastore(config.Datastore, config.Host) if err != nil { return nil, err } @@ -212,7 +212,7 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) if config.LinkedClone == true { cloneSpec.Location.DiskMoveType = "createNewChildDiskBacking" - tpl, err := template.Info("snapshot") + tpl, err := vm.Info("snapshot") if err != nil { return nil, err } @@ -231,7 +231,7 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) } if config.Network != "" { - net, err := template.driver.FindNetwork(config.Network) + net, err := vm.driver.FindNetwork(config.Network) if err != nil { return nil, err } @@ -240,7 +240,7 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) return nil, err } - devices, err := template.vm.Device(ctx) + devices, err := vm.vm.Device(ctx) if err != nil { return nil, err } @@ -260,7 +260,7 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) configSpec.DeviceChange = append(configSpec.DeviceChange, config) } - task, err := template.vm.Clone(template.driver.ctx, folder.folder, config.Name, cloneSpec) + task, err := vm.vm.Clone(vm.driver.ctx, folder.folder, config.Name, cloneSpec) if err != nil { return nil, err } @@ -276,8 +276,8 @@ func (template *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) } vmRef := info.Result.(types.ManagedObjectReference) - vm := template.driver.NewVM(&vmRef) - return vm, nil + created := vm.driver.NewVM(&vmRef) + return created, nil } func (vm *VirtualMachine) Destroy() error { @@ -545,16 +545,6 @@ func addNetwork(d *Driver, devices object.VirtualDeviceList, config *CreateConfi return append(devices, device), nil } -func addIDE(devices object.VirtualDeviceList) (object.VirtualDeviceList, error) { - ideDevice, err := devices.CreateIDEController() - if err != nil { - return nil, err - } - devices = append(devices, ideDevice) - - return devices, nil -} - func (vm *VirtualMachine) AddCdrom(controllerType string, isoPath string) error { devices, err := vm.vm.Device(vm.driver.ctx) if err != nil { diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index fd9f9ac27..deca0e6b0 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -86,8 +86,8 @@ func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { return } - err_del := ds.Delete(UploadedFloppyPath.(string)) - if err_del != nil { + err = ds.Delete(UploadedFloppyPath.(string)) + if err != nil { state.Put("error", err) return } diff --git a/iso/step_create.go b/iso/step_create.go index 122e542e8..627f24d45 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -53,21 +53,21 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) - find_vm, err := d.FindVM(s.Location.VMName) + vm, err := d.FindVM(s.Location.VMName) if s.Force == false && err == nil { state.Put("error", fmt.Errorf("%s already exists, you can use -force flag to destroy it: %v", s.Location.VMName, err)) return multistep.ActionHalt } else if s.Force == true && err == nil { ui.Say(fmt.Sprintf("the vm/template %s already exists, but deleting it due to -force flag", s.Location.VMName)) - err := find_vm.Destroy() + err := vm.Destroy() if err != nil { state.Put("error", fmt.Errorf("error destroying %s: %v", s.Location.VMName, err)) } } ui.Say("Creating VM...") - vm, err := d.CreateVM(&driver.CreateConfig{ + vm, err = d.CreateVM(&driver.CreateConfig{ DiskThinProvisioned: s.Config.DiskThinProvisioned, DiskControllerType: s.Config.DiskControllerType, DiskSize: s.Config.DiskSize, diff --git a/iso/step_remote_upload.go b/iso/step_remote_upload.go index 53a7317af..ea57d4b8b 100644 --- a/iso/step_remote_upload.go +++ b/iso/step_remote_upload.go @@ -27,28 +27,28 @@ func (s *StepRemoteUpload) Run(_ context.Context, state multistep.StateBag) mult return multistep.ActionHalt } - remotepath := fmt.Sprintf("packer_cache/%s", filename) - remotedirectory := fmt.Sprintf("[%s] packer_cache/", ds.Name()) - final_remotepath := fmt.Sprintf("%s/%s", remotedirectory, filename) + remotePath := fmt.Sprintf("packer_cache/%s", filename) + remoteDirectory := fmt.Sprintf("[%s] packer_cache/", ds.Name()) + fullRemotePath := fmt.Sprintf("%s/%s", remoteDirectory, filename) - ui.Say(fmt.Sprintf("Uploading %s to %s", filename, remotepath)) + ui.Say(fmt.Sprintf("Uploading %s to %s", filename, remotePath)) - if exists := ds.FileExists(remotepath); exists == true { + if exists := ds.FileExists(remotePath); exists == true { ui.Say("File already upload") - state.Put("iso_remote_path", final_remotepath) + state.Put("iso_remote_path", fullRemotePath) return multistep.ActionContinue } - if err := ds.MakeDirectory(remotedirectory); err != nil { + if err := ds.MakeDirectory(remoteDirectory); err != nil { state.Put("error", err) return multistep.ActionHalt } - if err := ds.UploadFile(path.(string), remotepath, s.Host); err != nil { + if err := ds.UploadFile(path.(string), remotePath, s.Host); err != nil { state.Put("error", err) return multistep.ActionHalt } - state.Put("iso_remote_path", final_remotepath) + state.Put("iso_remote_path", fullRemotePath) } return multistep.ActionContinue From 1c7ccb833c38e656f2481d11979b0e95e9349876 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 17:55:24 +0300 Subject: [PATCH 244/266] Add SATA controller for CD-ROMs only if needed --- driver/vm_cdrom.go | 6 +++++- iso/step_add_cdrom.go | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/driver/vm_cdrom.go b/driver/vm_cdrom.go index 80884737e..c5d7e29ed 100644 --- a/driver/vm_cdrom.go +++ b/driver/vm_cdrom.go @@ -5,6 +5,10 @@ import ( "github.com/vmware/govmomi/vim25/types" ) +var ( + ErrNoSataController = errors.New("no available SATA controller") +) + func (vm *VirtualMachine) AddSATAController() error { sata := &types.VirtualAHCIController{} return vm.addDevice(sata) @@ -18,7 +22,7 @@ func (vm *VirtualMachine) FindSATAController() (*types.VirtualAHCIController, er c := l.PickController((*types.VirtualAHCIController)(nil)) if c == nil { - return nil, errors.New("no available SATA controller") + return nil, ErrNoSataController } return c.(*types.VirtualAHCIController), nil diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 2969e7551..ea06724ef 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -32,10 +32,12 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste vm := state.Get("vm").(*driver.VirtualMachine) if s.Config.CdromType == "sata" { - ui.Say("Adding SATA controller...") - if err := vm.AddSATAController(); err != nil { - state.Put("error", fmt.Errorf("error adding SATA controller: %v", err)) - return multistep.ActionHalt + if _, err := vm.FindSATAController(); err == driver.ErrNoSataController { + ui.Say("Adding SATA controller...") + if err := vm.AddSATAController(); err != nil { + state.Put("error", fmt.Errorf("error adding SATA controller: %v", err)) + return multistep.ActionHalt + } } } From a72ec1ae8dc520af63e2e8e168908cc97e34f9ee Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 18:40:01 +0300 Subject: [PATCH 245/266] Reuse library function for SSH provisioner config --- clone/builder.go | 2 +- common/config_ssh.go | 39 --------------------------------------- go.mod | 1 - go.sum | 3 +-- iso/builder.go | 2 +- 5 files changed, 3 insertions(+), 44 deletions(-) diff --git a/clone/builder.go b/clone/builder.go index ac446733b..008472296 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -62,7 +62,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost(b.config.Comm.SSHHost), - SSHConfig: common.SshConfig, + SSHConfig: b.config.Comm.SSHConfigFunc(), }, &packerCommon.StepProvision{}, &common.StepShutdown{ diff --git a/common/config_ssh.go b/common/config_ssh.go index e1df13e54..d4104a4e8 100644 --- a/common/config_ssh.go +++ b/common/config_ssh.go @@ -1,12 +1,7 @@ package common import ( - "fmt" - packerssh "github.com/hashicorp/packer/communicator/ssh" - "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" - "golang.org/x/crypto/ssh" - "io/ioutil" ) func CommHost(host string) func(multistep.StateBag) (string, error) { @@ -18,37 +13,3 @@ func CommHost(host string) func(multistep.StateBag) (string, error) { } } } - -func SshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) { - comm := state.Get("comm").(*communicator.Config) - - var auth []ssh.AuthMethod - - if comm.SSHPrivateKeyFile != "" { - privateKey, err := ioutil.ReadFile(comm.SSHPrivateKeyFile) - if err != nil { - return nil, fmt.Errorf("Error loading configured private key file: %s", err) - } - - signer, err := ssh.ParsePrivateKey(privateKey) - if err != nil { - return nil, fmt.Errorf("Error setting up SSH config: %s", err) - } - - auth = []ssh.AuthMethod{ssh.PublicKeys(signer)} - } else { - auth = []ssh.AuthMethod{ - ssh.Password(comm.SSHPassword), - ssh.KeyboardInteractive( - packerssh.PasswordKeyboardInteractive(comm.SSHPassword)), - } - } - - clientConfig := &ssh.ClientConfig{ - User: comm.SSHUsername, - HostKeyCallback: ssh.InsecureIgnoreHostKey(), - } - clientConfig.Auth = auth - - return clientConfig, nil -} diff --git a/go.mod b/go.mod index d00a4a152..10057c4fb 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,5 @@ module github.com/jetbrains-infra/packer-builder-vsphere require ( github.com/hashicorp/packer v1.4.2 github.com/vmware/govmomi v0.20.0 - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 ) diff --git a/go.sum b/go.sum index 37bf74f9a..98d5f61a4 100644 --- a/go.sum +++ b/go.sum @@ -348,9 +348,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d h1:adrbvkTDn9rGnXg2IJDKozEpXXLZN89pdIA+Syt4/u0= golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= diff --git a/iso/builder.go b/iso/builder.go index c31267c31..ccd3e8ecb 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -105,7 +105,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack &communicator.StepConnect{ Config: &b.config.Comm, Host: common.CommHost(b.config.Comm.SSHHost), - SSHConfig: common.SshConfig, + SSHConfig: b.config.Comm.SSHConfigFunc(), }, &packerCommon.StepProvision{}, &common.StepShutdown{ From d3591540e1ba3d1078c20ebd7063d60b76e754eb Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Mon, 8 Jul 2019 18:42:43 +0300 Subject: [PATCH 246/266] Add spelling distionary for GoLand --- .idea/dictionaries/project.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .idea/dictionaries/project.xml diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml new file mode 100644 index 000000000..f77b8be28 --- /dev/null +++ b/.idea/dictionaries/project.xml @@ -0,0 +1,20 @@ +<component name="ProjectDictionaryState"> + <dictionary name="project"> + <words> + <w>abcdefghijklmnopqrstuvwxyz</w> + <w>cdrom</w> + <w>cdroms</w> + <w>datastore</w> + <w>datastores</w> + <w>esxi</w> + <w>hashicorp</w> + <w>mozilla</w> + <w>sata</w> + <w>scancode</w> + <w>vcenter</w> + <w>vmware</w> + <w>vmxnet</w> + <w>vsphere</w> + </words> + </dictionary> +</component> From 9b254b2f53ae1c7fb2c18e542542e2ad0b0f0b85 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Fri, 12 Jul 2019 11:29:41 +0300 Subject: [PATCH 247/266] Simplify time.Duration parsing --- common/step_shutdown.go | 17 ++++------------- common/step_wait_for_ip.go | 22 +++++++--------------- iso/step_boot_command.go | 22 +++++++--------------- 3 files changed, 18 insertions(+), 43 deletions(-) diff --git a/common/step_shutdown.go b/common/step_shutdown.go index 86fee82c2..94a507900 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -12,27 +12,18 @@ import ( ) type ShutdownConfig struct { - Command string `mapstructure:"shutdown_command"` - RawTimeout string `mapstructure:"shutdown_timeout"` - - Timeout time.Duration + Command string `mapstructure:"shutdown_command"` + Timeout time.Duration `mapstructure:"shutdown_timeout"` } func (c *ShutdownConfig) Prepare() []error { var errs []error - if c.RawTimeout != "" { - timeout, err := time.ParseDuration(c.RawTimeout) - if err != nil { - errs = append(errs, fmt.Errorf("Failed parsing shutdown_timeout: %s", err)) - return errs - } - c.Timeout = timeout - } else { + if c.Timeout == 0 { c.Timeout = 5 * time.Minute } - return nil + return errs } type StepShutdown struct { diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index e81460df5..64a841538 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -11,9 +11,7 @@ import ( ) type WaitIpConfig struct { - SettleTimeout string `mapstructure:"ip_settle_timeout"` - - settleTimeout time.Duration + SettleTimeout time.Duration `mapstructure:"ip_settle_timeout"` } type StepWaitForIp struct { @@ -23,14 +21,8 @@ type StepWaitForIp struct { func (c *WaitIpConfig) Prepare() []error { var errs []error - if c.SettleTimeout == "" { - c.SettleTimeout = "5s" - } - - var err error - c.settleTimeout, err = time.ParseDuration(c.SettleTimeout) - if err != nil { - errs = append(errs, fmt.Errorf("failed parsing ip_settle_timeout: %s", err)) + if c.SettleTimeout == 0 { + c.SettleTimeout = 5 * time.Second } return errs @@ -71,11 +63,11 @@ func doGetIp(vm *driver.VirtualMachine, ctx context.Context, c *WaitIpConfig, er var prevIp = "" var stopTime time.Time var interval time.Duration - if c.settleTimeout.Seconds() >= 120 { + if c.SettleTimeout.Seconds() >= 120 { interval = 30 * time.Second - } else if c.settleTimeout.Seconds() >= 60 { + } else if c.SettleTimeout.Seconds() >= 60 { interval = 15 * time.Second - } else if c.settleTimeout.Seconds() >= 10 { + } else if c.SettleTimeout.Seconds() >= 10 { interval = 5 * time.Second } else { interval = 1 * time.Second @@ -93,7 +85,7 @@ loop: log.Printf("VM IP changed from %s to %s", prevIp, ip) } prevIp = ip - stopTime = time.Now().Add(c.settleTimeout) + stopTime = time.Now().Add(c.SettleTimeout) goto loop } else { log.Printf("VM IP is still the same: %s", prevIp) diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 17a90192c..462806247 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -18,11 +18,9 @@ import ( ) type BootConfig struct { - BootCommand []string `mapstructure:"boot_command"` - RawBootWait string `mapstructure:"boot_wait"` // example: "1m30s"; default: "10s" - HTTPIP string `mapstructure:"http_ip"` - - bootWait time.Duration + BootCommand []string `mapstructure:"boot_command"` + BootWait time.Duration `mapstructure:"boot_wait"` // example: "1m30s"; default: "10s" + HTTPIP string `mapstructure:"http_ip"` } type bootCommandTemplateData struct { @@ -34,14 +32,8 @@ type bootCommandTemplateData struct { func (c *BootConfig) Prepare() []error { var errs []error - if c.RawBootWait == "" { - c.RawBootWait = "10s" - } - - var err error - c.bootWait, err = time.ParseDuration(c.RawBootWait) - if err != nil { - errs = append(errs, fmt.Errorf("failed parsing boot_wait: %s", err)) + if c.BootWait == 0 { + c.BootWait = 10 * time.Second } return errs @@ -98,8 +90,8 @@ func (s *StepBootCommand) Run(_ context.Context, state multistep.StateBag) multi return multistep.ActionContinue } - ui.Say(fmt.Sprintf("Waiting %s for boot...", s.Config.bootWait)) - wait := time.After(s.Config.bootWait) + ui.Say(fmt.Sprintf("Waiting %s for boot...", s.Config.BootWait)) + wait := time.After(s.Config.BootWait) WAITLOOP: for { select { From a9ffa1559e67d3765afcb85cd41efac42dd4cf4c Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Fri, 12 Jul 2019 12:44:40 +0300 Subject: [PATCH 248/266] Don't wait for IP till heat death of the universe Introduced 'ip_wait_timeout' parameter with '5m' (five minutes) default value. --- README.md | 1 + common/step_wait_for_ip.go | 44 +++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c1c542df3..d5e3103fa 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### Provision * `communicator` - `ssh` (default), `winrm`, or `none` (create/clone, customize hardware, but do not boot). +* `ip_wait_timeout`(string) - Amount of time to wait for VM's IP, similar to 'ssh_timeout'. Defaults to 5m (5 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. * `ip_settle_timeout`(string) - Amount of time to wait for VM's IP to settle down, sometimes VM may report incorrect IP initially, then its recommended to set that parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to 5s(5 seconds). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. * `ssh_username`(string) - Username in guest OS. * `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index 64a841538..f70ee26d8 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -11,7 +11,10 @@ import ( ) type WaitIpConfig struct { + WaitTimeout time.Duration `mapstructure:"ip_wait_timeout"` SettleTimeout time.Duration `mapstructure:"ip_settle_timeout"` + + // WaitTimeout is a total timeout, so even if VM changes IP frequently and it doesn't settle down we will end waiting. } type StepWaitForIp struct { @@ -24,6 +27,10 @@ func (c *WaitIpConfig) Prepare() []error { if c.SettleTimeout == 0 { c.SettleTimeout = 5 * time.Second } + if c.WaitTimeout == 0 { + // Same default value as default timeout for 'ssh_timeout' in StepConnect + c.SettleTimeout = 5 * time.Minute + } return errs } @@ -32,22 +39,37 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) - ui.Say("Waiting for IP...") + var ip string + var err error + + sub, cancel := context.WithCancel(ctx) + waitDone := make(chan bool, 1) - ipChan := make(chan string) - errChan := make(chan error) go func() { - doGetIp(vm, ctx, s.Config, errChan, ipChan) + ui.Say("Waiting for IP...") + ip, err = doGetIp(vm, sub, s.Config) + waitDone <- true }() + log.Printf("[INFO] Waiting for IP, up to total timeout: %s, settle timeout: %s", s.Config.WaitTimeout, s.Config.SettleTimeout) + timeout := time.After(s.Config.WaitTimeout) for { select { - case err := <-errChan: + case <-timeout: + err := fmt.Errorf("Timeout waiting for IP.") state.Put("error", err) + ui.Error(err.Error()) + cancel() return multistep.ActionHalt case <-ctx.Done(): + cancel() + log.Println("[WARN] Interrupt detected, quitting waiting for IP.") return multistep.ActionHalt - case ip := <-ipChan: + case <-waitDone: + if err != nil { + state.Put("error", err) + return multistep.ActionHalt + } state.Put("ip", ip) ui.Say(fmt.Sprintf("IP address: %v", ip)) return multistep.ActionContinue @@ -59,7 +81,7 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi } } -func doGetIp(vm *driver.VirtualMachine, ctx context.Context, c *WaitIpConfig, errChan chan error, ipChan chan string) { +func doGetIp(vm *driver.VirtualMachine, ctx context.Context, c *WaitIpConfig) (string, error) { var prevIp = "" var stopTime time.Time var interval time.Duration @@ -75,8 +97,7 @@ func doGetIp(vm *driver.VirtualMachine, ctx context.Context, c *WaitIpConfig, er loop: ip, err := vm.WaitForIP(ctx) if err != nil { - errChan <- err - return + return "", err } if prevIp == "" || prevIp != ip { if prevIp == "" { @@ -91,12 +112,11 @@ loop: log.Printf("VM IP is still the same: %s", prevIp) if time.Now().After(stopTime) { log.Printf("VM IP seems stable enough: %s", ip) - ipChan <- ip - return + return ip, nil } select { case <-ctx.Done(): - return + return "", fmt.Errorf("IP wait cancelled") case <-time.After(interval): goto loop } From b8ed1bd576b5ef330e756ff821947f93af9ed7ae Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Fri, 12 Jul 2019 12:44:40 +0300 Subject: [PATCH 249/266] Fix copy-pasta error --- common/step_wait_for_ip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index f70ee26d8..930096136 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -29,7 +29,7 @@ func (c *WaitIpConfig) Prepare() []error { } if c.WaitTimeout == 0 { // Same default value as default timeout for 'ssh_timeout' in StepConnect - c.SettleTimeout = 5 * time.Minute + c.WaitTimeout = 5 * time.Minute } return errs From 4cf9ff78a27dbae455093b96980a145dcfb011b9 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Fri, 12 Jul 2019 13:22:28 +0300 Subject: [PATCH 250/266] Increase 'ip_wait_timeout' default value to 30 minutes Often copying VM (vsphere-clone) takes more than 5 minutes. Creating VM from scratch (vsphere-iso) time expensive too. --- README.md | 2 +- common/step_wait_for_ip.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d5e3103fa..ae36eb2d5 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ See complete Ubuntu, Windows, and macOS templates in the [examples folder](https ### Provision * `communicator` - `ssh` (default), `winrm`, or `none` (create/clone, customize hardware, but do not boot). -* `ip_wait_timeout`(string) - Amount of time to wait for VM's IP, similar to 'ssh_timeout'. Defaults to 5m (5 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. +* `ip_wait_timeout`(string) - Amount of time to wait for VM's IP, similar to 'ssh_timeout'. Defaults to 30m (30 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. * `ip_settle_timeout`(string) - Amount of time to wait for VM's IP to settle down, sometimes VM may report incorrect IP initially, then its recommended to set that parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to 5s(5 seconds). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. * `ssh_username`(string) - Username in guest OS. * `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index 930096136..3856082fc 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -28,8 +28,7 @@ func (c *WaitIpConfig) Prepare() []error { c.SettleTimeout = 5 * time.Second } if c.WaitTimeout == 0 { - // Same default value as default timeout for 'ssh_timeout' in StepConnect - c.WaitTimeout = 5 * time.Minute + c.WaitTimeout = 30 * time.Minute } return errs From ddbc7bb631ae08af25b4ff67117c24d85dedd26a Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Sat, 13 Jul 2019 18:23:04 +0300 Subject: [PATCH 251/266] Add goroutine leak detection in tests --- clone/leak_test.go | 8 ++++++++ driver/leak_test.go | 8 ++++++++ go.mod | 1 + go.sum | 2 ++ iso/leak_test.go | 8 ++++++++ 5 files changed, 27 insertions(+) create mode 100644 clone/leak_test.go create mode 100644 driver/leak_test.go create mode 100644 iso/leak_test.go diff --git a/clone/leak_test.go b/clone/leak_test.go new file mode 100644 index 000000000..a6aa3a00b --- /dev/null +++ b/clone/leak_test.go @@ -0,0 +1,8 @@ +package clone + +import "testing" +import "go.uber.org/goleak" + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) +} diff --git a/driver/leak_test.go b/driver/leak_test.go new file mode 100644 index 000000000..26f8b3908 --- /dev/null +++ b/driver/leak_test.go @@ -0,0 +1,8 @@ +package driver + +import "testing" +import "go.uber.org/goleak" + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) +} diff --git a/go.mod b/go.mod index 10057c4fb..da07a0d70 100644 --- a/go.mod +++ b/go.mod @@ -3,5 +3,6 @@ module github.com/jetbrains-infra/packer-builder-vsphere require ( github.com/hashicorp/packer v1.4.2 github.com/vmware/govmomi v0.20.0 + go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16 golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 ) diff --git a/go.sum b/go.sum index 98d5f61a4..270287edf 100644 --- a/go.sum +++ b/go.sum @@ -342,6 +342,8 @@ github.com/yandex-cloud/go-sdk v0.0.0-20190402114215-3fc1d6947035/go.mod h1:Eml0 go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16 h1:ucZ8P+3HTFz4/kqeQ9Mg0j8F/oHbcaWfKLWiBo3QLKk= +go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/iso/leak_test.go b/iso/leak_test.go new file mode 100644 index 000000000..c7e35604f --- /dev/null +++ b/iso/leak_test.go @@ -0,0 +1,8 @@ +package iso + +import "testing" +import "go.uber.org/goleak" + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) +} From b6cc2f01c7ce37a43d96985c69e99c25fbdee9a0 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Sat, 13 Jul 2019 20:56:43 +0300 Subject: [PATCH 252/266] Fix inspections --- driver/vm_clone_acc_test.go | 30 ++++++++++++++++++++++++------ iso/builder_acc_test.go | 12 +++++++++--- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/driver/vm_clone_acc_test.go b/driver/vm_clone_acc_test.go index 81551ab5e..d6add46d7 100644 --- a/driver/vm_clone_acc_test.go +++ b/driver/vm_clone_acc_test.go @@ -122,7 +122,10 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { MemoryHotAddEnabled: true, CpuHotAddEnabled: true, } - vm.Configure(hwConfig) + err := vm.Configure(hwConfig) + if err != nil { + t.Fatalf("Failed to configure VM: %v", err) + } log.Printf("[DEBUG] Running checks") vmInfo, err := vm.Info("config") @@ -168,7 +171,10 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { func configureRAMReserveAllCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { log.Printf("[DEBUG] Configuring the vm") - vm.Configure(&HardwareConfig{RAMReserveAll: true}) + err := vm.Configure(&HardwareConfig{RAMReserveAll: true}) + if err != nil { + t.Fatalf("Failed to configure VM: %v", err) + } log.Printf("[DEBUG] Running checks") vmInfo, err := vm.Info("config") @@ -235,16 +241,25 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { t.Errorf("'%v' is not a valid ip address", ip) } - vm.StartShutdown() + err := vm.StartShutdown() + if err != nil { + t.Fatalf("Failed to initiate guest shutdown: %v", err) + } log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") - vm.WaitForShutdown(context.TODO(), 1*time.Minute) + err = vm.WaitForShutdown(context.TODO(), 1*time.Minute) + if err != nil { + t.Fatalf("Failed to wait for giest shutdown: %v", err) + } } func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { stopper := startVM(t, vm, config.Name) defer stopper() - vm.CreateSnapshot("test-snapshot") + err := vm.CreateSnapshot("test-snapshot") + if err != nil { + t.Fatalf("Failed to create snapshot: %v", err) + } vmInfo, err := vm.Info("layoutEx.disk") if err != nil { @@ -258,7 +273,10 @@ func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { } func templateCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { - vm.ConvertToTemplate() + err := vm.ConvertToTemplate() + if err != nil { + t.Fatalf("Failed to convert to template: %v", err) + } vmInfo, err := vm.Info("config.template") if err != nil { t.Errorf("Cannot read VM properties: %v", err) diff --git a/iso/builder_acc_test.go b/iso/builder_acc_test.go index 52605d487..c67236170 100644 --- a/iso/builder_acc_test.go +++ b/iso/builder_acc_test.go @@ -369,10 +369,16 @@ func checkNetworkCard(t *testing.T) builderT.TestCheckFunc { func TestISOBuilderAcc_createFloppy(t *testing.T) { tmpFile, err := ioutil.TempFile("", "packer-vsphere-iso-test") if err != nil { - t.Fatalf("Error creating temp file ") + t.Fatalf("Error creating temp file: %v", err) + } + _, err = fmt.Fprint(tmpFile, "Hello, World!") + if err != nil { + t.Fatalf("Error creating temp file: %v", err) + } + err = tmpFile.Close() + if err != nil { + t.Fatalf("Error creating temp file: %v", err) } - fmt.Fprint(tmpFile, "Hello, World!") - tmpFile.Close() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, From 483df213fd6b12e536b476a83b31042b0b1ff20c Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Sat, 13 Jul 2019 21:02:15 +0300 Subject: [PATCH 253/266] Ensure no goroutines leak from StepWaitForIP in concurrent cases --- common/step_wait_for_ip.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index 3856082fc..e1f7e0891 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -43,6 +43,11 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi sub, cancel := context.WithCancel(ctx) waitDone := make(chan bool, 1) + defer func() { + cancel() + for range waitDone { + } + }() go func() { ui.Say("Waiting for IP...") From 69e31bc126bbc861d32c7f9bbfd796b10f3a525b Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Tue, 16 Jul 2019 23:23:17 +0300 Subject: [PATCH 254/266] A bit debugging for CD-ROM creation problems --- driver/vm.go | 2 ++ iso/step_add_cdrom.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 35ab3ffc0..d177b20ba 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -7,6 +7,7 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" + "log" "strings" "time" ) @@ -575,6 +576,7 @@ func (vm *VirtualMachine) AddCdrom(controllerType string, isoPath string) error devices.InsertIso(cdrom, isoPath) } + log.Printf("Creating CD-ROM on controller '%v' with iso '%v'", controller, isoPath) return vm.addDevice(cdrom) } diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index ea06724ef..b329d02dd 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -45,7 +45,7 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste if len(s.Config.ISOPaths) > 0 { for _, path := range s.Config.ISOPaths { if err := vm.AddCdrom(s.Config.CdromType, path); err != nil { - state.Put("error", fmt.Errorf("error mounting an image: %v", err)) + state.Put("error", fmt.Errorf("error mounting an image '%v': %v", path, err)) return multistep.ActionHalt } } @@ -53,7 +53,7 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste if path, ok := state.GetOk("iso_remote_path"); ok { if err := vm.AddCdrom(s.Config.CdromType, path.(string)); err != nil { - state.Put("error", fmt.Errorf("error mounting an image: %v", err)) + state.Put("error", fmt.Errorf("error mounting an image '%v': %v", path, err)) return multistep.ActionHalt } } From fb9038b0b29d37c22735d71d3041b8cfa1a00275 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Thu, 8 Aug 2019 14:49:24 +0300 Subject: [PATCH 255/266] Prevent endless wait --- common/step_wait_for_ip.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index e1f7e0891..4365b7f62 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -45,8 +45,6 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi waitDone := make(chan bool, 1) defer func() { cancel() - for range waitDone { - } }() go func() { From c8824f148c3e491590a30aa561635165537f3aa1 Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Thu, 8 Aug 2019 14:49:36 +0300 Subject: [PATCH 256/266] Minor nil fix --- clone/step_clone.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clone/step_clone.go b/clone/step_clone.go index ab6abf4b2..d47949903 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -44,7 +44,7 @@ func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist vm, err := d.FindVM(s.Location.VMName) if s.Force == false && err == nil { - state.Put("error", fmt.Errorf("%s already exists, you can use -force flag to destroy it: %v", s.Location.VMName, err)) + state.Put("error", fmt.Errorf("%s already exists, you can use -force flag to destroy it", s.Location.VMName)) return multistep.ActionHalt } else if s.Force == true && err == nil { ui.Say(fmt.Sprintf("the vm/template %s already exists, but deleting it due to -force flag", s.Location.VMName)) From 5ae06f4373ff0976bf2899be40ae00a382ab6f4d Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Wed, 11 Sep 2019 16:42:25 +0300 Subject: [PATCH 257/266] Fix build --- go.mod | 3 +++ go.sum | 1 + 2 files changed, 4 insertions(+) diff --git a/go.mod b/go.mod index da07a0d70..8536831d4 100644 --- a/go.mod +++ b/go.mod @@ -6,3 +6,6 @@ require ( go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16 golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 ) + +replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 + diff --git a/go.sum b/go.sum index 270287edf..493f13d5a 100644 --- a/go.sum +++ b/go.sum @@ -32,6 +32,7 @@ github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd/go.mod h1:Yee4kTMuNi github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607 h1:BFFG6KP8ASFBg2ptWsJn8p8RDufBjBDKIxLU7BTYGOM= github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43/go.mod h1:S6puKjZ9ZeqUPBv2hEBnMZGcM2J6mOsDRQcmxkMAND0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= From 4ec004e18e977a5b8a3a28f4b24279b6993d7e7c Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin <vladislav.rassokhin@jetbrains.com> Date: Fri, 13 Sep 2019 11:06:06 +0300 Subject: [PATCH 258/266] Fix tests: vpn ip migrated --- test/lab.ovpn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/lab.ovpn b/test/lab.ovpn index d96898ef2..45941a2af 100644 --- a/test/lab.ovpn +++ b/test/lab.ovpn @@ -7,8 +7,7 @@ auth SHA1 tls-client client resolv-retry infinite -remote 81.3.129.25 2000 tcp-client -remote 80.76.244.125 2000 tcp-client +remote 91.132.204.28 2000 tcp-client remote-cert-tls server pkcs12 lab.p12 From ffcae91e8eccef4bcaec679d90bd44d41ff2b292 Mon Sep 17 00:00:00 2001 From: Chris Doherty <code@randomcamel.net> Date: Mon, 9 Dec 2019 17:12:31 -0800 Subject: [PATCH 259/266] Re-arrange directory structure for merge. --- .gitignore => builder/vsphere/.gitignore | 0 LICENSE.txt => builder/vsphere/LICENSE.txt | 0 Makefile => builder/vsphere/Makefile | 0 README.md => builder/vsphere/README.md | 0 {clone => builder/vsphere/clone}/builder.go | 0 .../vsphere/clone}/builder_acc_test.go | 0 {clone => builder/vsphere/clone}/builder_test.go | 0 {clone => builder/vsphere/clone}/config.go | 0 {clone => builder/vsphere/clone}/config_test.go | 0 {clone => builder/vsphere/clone}/leak_test.go | 0 {clone => builder/vsphere/clone}/step_clone.go | 0 {cmd => builder/vsphere/cmd}/clone/main.go | 0 {cmd => builder/vsphere/cmd}/iso/main.go | 0 {common => builder/vsphere/common}/artifact.go | 0 .../vsphere/common}/config_location.go | 0 {common => builder/vsphere/common}/config_ssh.go | 0 .../vsphere/common}/step_config_params.go | 0 {common => builder/vsphere/common}/step_connect.go | 0 {common => builder/vsphere/common}/step_hardware.go | 0 {common => builder/vsphere/common}/step_run.go | 0 {common => builder/vsphere/common}/step_shutdown.go | 0 {common => builder/vsphere/common}/step_snapshot.go | 0 {common => builder/vsphere/common}/step_template.go | 0 .../vsphere/common}/step_wait_for_ip.go | 0 .../vsphere/common}/testing/utility.go | 0 .../vsphere/docker-compose.yml | 0 {driver => builder/vsphere/driver}/datastore.go | 0 .../vsphere/driver}/datastore_acc_test.go | 0 {driver => builder/vsphere/driver}/driver.go | 0 {driver => builder/vsphere/driver}/driver_test.go | 0 {driver => builder/vsphere/driver}/folder.go | 0 .../vsphere/driver}/folder_acc_test.go | 0 {driver => builder/vsphere/driver}/host.go | 0 {driver => builder/vsphere/driver}/host_acc_test.go | 0 {driver => builder/vsphere/driver}/leak_test.go | 0 {driver => builder/vsphere/driver}/network.go | 0 {driver => builder/vsphere/driver}/resource_pool.go | 0 .../vsphere/driver}/resource_pool_acc_test.go | 0 {driver => builder/vsphere/driver}/vm.go | 0 {driver => builder/vsphere/driver}/vm_cdrom.go | 0 .../vsphere/driver}/vm_clone_acc_test.go | 0 .../vsphere/driver}/vm_create_acc_test.go | 0 {driver => builder/vsphere/driver}/vm_keyboard.go | 0 .../vsphere/examples}/alpine/alpine-3.8.json | 0 .../vsphere/examples}/alpine/answerfile | 0 .../vsphere/examples}/alpine/setup.sh | 0 .../vsphere/examples}/clone/alpine.json | 0 .../vsphere/examples}/driver/main.go | 0 .../vsphere/examples}/macos/macos-10.13.json | 0 .../vsphere/examples}/macos/setup/.gitignore | 0 .../vsphere/examples}/macos/setup/iso-macos.sh | 0 .../vsphere/examples}/macos/setup/iso-setup.sh | 0 .../vsphere/examples}/macos/setup/postinstall | 0 .../vsphere/examples}/macos/setup/setup.sh | 0 .../vsphere/examples}/ubuntu/preseed.cfg | 0 .../vsphere/examples}/ubuntu/ubuntu-16.04.json | 0 .../vsphere/examples}/windows/.gitattributes | 0 .../examples}/windows/setup/Autounattend.xml | 0 .../vsphere/examples}/windows/setup/setup.ps1 | 0 .../vsphere/examples}/windows/setup/vmtools.cmd | 0 .../vsphere/examples}/windows/windows-10.json | 0 go.mod => builder/vsphere/go.mod | 0 go.sum => builder/vsphere/go.sum | 0 gofmt.sh => builder/vsphere/gofmt.sh | 0 {iso => builder/vsphere/iso}/builder.go | 0 {iso => builder/vsphere/iso}/builder_acc_test.go | 0 {iso => builder/vsphere/iso}/config.go | 0 {iso => builder/vsphere/iso}/leak_test.go | 0 {iso => builder/vsphere/iso}/step_add_cdrom.go | 0 {iso => builder/vsphere/iso}/step_add_floppy.go | 0 {iso => builder/vsphere/iso}/step_boot_command.go | 0 {iso => builder/vsphere/iso}/step_create.go | 0 {iso => builder/vsphere/iso}/step_remote_upload.go | 0 {iso => builder/vsphere/iso}/step_remove_cdrom.go | 0 {iso => builder/vsphere/iso}/step_remove_floppy.go | 0 .../vsphere/teamcity-services.yml | 0 {test => builder/vsphere/test}/lab.ovpn | 0 {test => builder/vsphere/test}/lab.p12 | Bin {test => builder/vsphere/test}/test-key.pem | 0 {test => builder/vsphere/test}/test-key.pub | 0 80 files changed, 0 insertions(+), 0 deletions(-) rename .gitignore => builder/vsphere/.gitignore (100%) rename LICENSE.txt => builder/vsphere/LICENSE.txt (100%) rename Makefile => builder/vsphere/Makefile (100%) rename README.md => builder/vsphere/README.md (100%) rename {clone => builder/vsphere/clone}/builder.go (100%) rename {clone => builder/vsphere/clone}/builder_acc_test.go (100%) rename {clone => builder/vsphere/clone}/builder_test.go (100%) rename {clone => builder/vsphere/clone}/config.go (100%) rename {clone => builder/vsphere/clone}/config_test.go (100%) rename {clone => builder/vsphere/clone}/leak_test.go (100%) rename {clone => builder/vsphere/clone}/step_clone.go (100%) rename {cmd => builder/vsphere/cmd}/clone/main.go (100%) rename {cmd => builder/vsphere/cmd}/iso/main.go (100%) rename {common => builder/vsphere/common}/artifact.go (100%) rename {common => builder/vsphere/common}/config_location.go (100%) rename {common => builder/vsphere/common}/config_ssh.go (100%) rename {common => builder/vsphere/common}/step_config_params.go (100%) rename {common => builder/vsphere/common}/step_connect.go (100%) rename {common => builder/vsphere/common}/step_hardware.go (100%) rename {common => builder/vsphere/common}/step_run.go (100%) rename {common => builder/vsphere/common}/step_shutdown.go (100%) rename {common => builder/vsphere/common}/step_snapshot.go (100%) rename {common => builder/vsphere/common}/step_template.go (100%) rename {common => builder/vsphere/common}/step_wait_for_ip.go (100%) rename {common => builder/vsphere/common}/testing/utility.go (100%) rename docker-compose.yml => builder/vsphere/docker-compose.yml (100%) rename {driver => builder/vsphere/driver}/datastore.go (100%) rename {driver => builder/vsphere/driver}/datastore_acc_test.go (100%) rename {driver => builder/vsphere/driver}/driver.go (100%) rename {driver => builder/vsphere/driver}/driver_test.go (100%) rename {driver => builder/vsphere/driver}/folder.go (100%) rename {driver => builder/vsphere/driver}/folder_acc_test.go (100%) rename {driver => builder/vsphere/driver}/host.go (100%) rename {driver => builder/vsphere/driver}/host_acc_test.go (100%) rename {driver => builder/vsphere/driver}/leak_test.go (100%) rename {driver => builder/vsphere/driver}/network.go (100%) rename {driver => builder/vsphere/driver}/resource_pool.go (100%) rename {driver => builder/vsphere/driver}/resource_pool_acc_test.go (100%) rename {driver => builder/vsphere/driver}/vm.go (100%) rename {driver => builder/vsphere/driver}/vm_cdrom.go (100%) rename {driver => builder/vsphere/driver}/vm_clone_acc_test.go (100%) rename {driver => builder/vsphere/driver}/vm_create_acc_test.go (100%) rename {driver => builder/vsphere/driver}/vm_keyboard.go (100%) rename {examples => builder/vsphere/examples}/alpine/alpine-3.8.json (100%) rename {examples => builder/vsphere/examples}/alpine/answerfile (100%) rename {examples => builder/vsphere/examples}/alpine/setup.sh (100%) rename {examples => builder/vsphere/examples}/clone/alpine.json (100%) rename {examples => builder/vsphere/examples}/driver/main.go (100%) rename {examples => builder/vsphere/examples}/macos/macos-10.13.json (100%) rename {examples => builder/vsphere/examples}/macos/setup/.gitignore (100%) rename {examples => builder/vsphere/examples}/macos/setup/iso-macos.sh (100%) rename {examples => builder/vsphere/examples}/macos/setup/iso-setup.sh (100%) rename {examples => builder/vsphere/examples}/macos/setup/postinstall (100%) rename {examples => builder/vsphere/examples}/macos/setup/setup.sh (100%) rename {examples => builder/vsphere/examples}/ubuntu/preseed.cfg (100%) rename {examples => builder/vsphere/examples}/ubuntu/ubuntu-16.04.json (100%) rename {examples => builder/vsphere/examples}/windows/.gitattributes (100%) rename {examples => builder/vsphere/examples}/windows/setup/Autounattend.xml (100%) rename {examples => builder/vsphere/examples}/windows/setup/setup.ps1 (100%) rename {examples => builder/vsphere/examples}/windows/setup/vmtools.cmd (100%) rename {examples => builder/vsphere/examples}/windows/windows-10.json (100%) rename go.mod => builder/vsphere/go.mod (100%) rename go.sum => builder/vsphere/go.sum (100%) rename gofmt.sh => builder/vsphere/gofmt.sh (100%) rename {iso => builder/vsphere/iso}/builder.go (100%) rename {iso => builder/vsphere/iso}/builder_acc_test.go (100%) rename {iso => builder/vsphere/iso}/config.go (100%) rename {iso => builder/vsphere/iso}/leak_test.go (100%) rename {iso => builder/vsphere/iso}/step_add_cdrom.go (100%) rename {iso => builder/vsphere/iso}/step_add_floppy.go (100%) rename {iso => builder/vsphere/iso}/step_boot_command.go (100%) rename {iso => builder/vsphere/iso}/step_create.go (100%) rename {iso => builder/vsphere/iso}/step_remote_upload.go (100%) rename {iso => builder/vsphere/iso}/step_remove_cdrom.go (100%) rename {iso => builder/vsphere/iso}/step_remove_floppy.go (100%) rename teamcity-services.yml => builder/vsphere/teamcity-services.yml (100%) rename {test => builder/vsphere/test}/lab.ovpn (100%) rename {test => builder/vsphere/test}/lab.p12 (100%) rename {test => builder/vsphere/test}/test-key.pem (100%) rename {test => builder/vsphere/test}/test-key.pub (100%) diff --git a/.gitignore b/builder/vsphere/.gitignore similarity index 100% rename from .gitignore rename to builder/vsphere/.gitignore diff --git a/LICENSE.txt b/builder/vsphere/LICENSE.txt similarity index 100% rename from LICENSE.txt rename to builder/vsphere/LICENSE.txt diff --git a/Makefile b/builder/vsphere/Makefile similarity index 100% rename from Makefile rename to builder/vsphere/Makefile diff --git a/README.md b/builder/vsphere/README.md similarity index 100% rename from README.md rename to builder/vsphere/README.md diff --git a/clone/builder.go b/builder/vsphere/clone/builder.go similarity index 100% rename from clone/builder.go rename to builder/vsphere/clone/builder.go diff --git a/clone/builder_acc_test.go b/builder/vsphere/clone/builder_acc_test.go similarity index 100% rename from clone/builder_acc_test.go rename to builder/vsphere/clone/builder_acc_test.go diff --git a/clone/builder_test.go b/builder/vsphere/clone/builder_test.go similarity index 100% rename from clone/builder_test.go rename to builder/vsphere/clone/builder_test.go diff --git a/clone/config.go b/builder/vsphere/clone/config.go similarity index 100% rename from clone/config.go rename to builder/vsphere/clone/config.go diff --git a/clone/config_test.go b/builder/vsphere/clone/config_test.go similarity index 100% rename from clone/config_test.go rename to builder/vsphere/clone/config_test.go diff --git a/clone/leak_test.go b/builder/vsphere/clone/leak_test.go similarity index 100% rename from clone/leak_test.go rename to builder/vsphere/clone/leak_test.go diff --git a/clone/step_clone.go b/builder/vsphere/clone/step_clone.go similarity index 100% rename from clone/step_clone.go rename to builder/vsphere/clone/step_clone.go diff --git a/cmd/clone/main.go b/builder/vsphere/cmd/clone/main.go similarity index 100% rename from cmd/clone/main.go rename to builder/vsphere/cmd/clone/main.go diff --git a/cmd/iso/main.go b/builder/vsphere/cmd/iso/main.go similarity index 100% rename from cmd/iso/main.go rename to builder/vsphere/cmd/iso/main.go diff --git a/common/artifact.go b/builder/vsphere/common/artifact.go similarity index 100% rename from common/artifact.go rename to builder/vsphere/common/artifact.go diff --git a/common/config_location.go b/builder/vsphere/common/config_location.go similarity index 100% rename from common/config_location.go rename to builder/vsphere/common/config_location.go diff --git a/common/config_ssh.go b/builder/vsphere/common/config_ssh.go similarity index 100% rename from common/config_ssh.go rename to builder/vsphere/common/config_ssh.go diff --git a/common/step_config_params.go b/builder/vsphere/common/step_config_params.go similarity index 100% rename from common/step_config_params.go rename to builder/vsphere/common/step_config_params.go diff --git a/common/step_connect.go b/builder/vsphere/common/step_connect.go similarity index 100% rename from common/step_connect.go rename to builder/vsphere/common/step_connect.go diff --git a/common/step_hardware.go b/builder/vsphere/common/step_hardware.go similarity index 100% rename from common/step_hardware.go rename to builder/vsphere/common/step_hardware.go diff --git a/common/step_run.go b/builder/vsphere/common/step_run.go similarity index 100% rename from common/step_run.go rename to builder/vsphere/common/step_run.go diff --git a/common/step_shutdown.go b/builder/vsphere/common/step_shutdown.go similarity index 100% rename from common/step_shutdown.go rename to builder/vsphere/common/step_shutdown.go diff --git a/common/step_snapshot.go b/builder/vsphere/common/step_snapshot.go similarity index 100% rename from common/step_snapshot.go rename to builder/vsphere/common/step_snapshot.go diff --git a/common/step_template.go b/builder/vsphere/common/step_template.go similarity index 100% rename from common/step_template.go rename to builder/vsphere/common/step_template.go diff --git a/common/step_wait_for_ip.go b/builder/vsphere/common/step_wait_for_ip.go similarity index 100% rename from common/step_wait_for_ip.go rename to builder/vsphere/common/step_wait_for_ip.go diff --git a/common/testing/utility.go b/builder/vsphere/common/testing/utility.go similarity index 100% rename from common/testing/utility.go rename to builder/vsphere/common/testing/utility.go diff --git a/docker-compose.yml b/builder/vsphere/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to builder/vsphere/docker-compose.yml diff --git a/driver/datastore.go b/builder/vsphere/driver/datastore.go similarity index 100% rename from driver/datastore.go rename to builder/vsphere/driver/datastore.go diff --git a/driver/datastore_acc_test.go b/builder/vsphere/driver/datastore_acc_test.go similarity index 100% rename from driver/datastore_acc_test.go rename to builder/vsphere/driver/datastore_acc_test.go diff --git a/driver/driver.go b/builder/vsphere/driver/driver.go similarity index 100% rename from driver/driver.go rename to builder/vsphere/driver/driver.go diff --git a/driver/driver_test.go b/builder/vsphere/driver/driver_test.go similarity index 100% rename from driver/driver_test.go rename to builder/vsphere/driver/driver_test.go diff --git a/driver/folder.go b/builder/vsphere/driver/folder.go similarity index 100% rename from driver/folder.go rename to builder/vsphere/driver/folder.go diff --git a/driver/folder_acc_test.go b/builder/vsphere/driver/folder_acc_test.go similarity index 100% rename from driver/folder_acc_test.go rename to builder/vsphere/driver/folder_acc_test.go diff --git a/driver/host.go b/builder/vsphere/driver/host.go similarity index 100% rename from driver/host.go rename to builder/vsphere/driver/host.go diff --git a/driver/host_acc_test.go b/builder/vsphere/driver/host_acc_test.go similarity index 100% rename from driver/host_acc_test.go rename to builder/vsphere/driver/host_acc_test.go diff --git a/driver/leak_test.go b/builder/vsphere/driver/leak_test.go similarity index 100% rename from driver/leak_test.go rename to builder/vsphere/driver/leak_test.go diff --git a/driver/network.go b/builder/vsphere/driver/network.go similarity index 100% rename from driver/network.go rename to builder/vsphere/driver/network.go diff --git a/driver/resource_pool.go b/builder/vsphere/driver/resource_pool.go similarity index 100% rename from driver/resource_pool.go rename to builder/vsphere/driver/resource_pool.go diff --git a/driver/resource_pool_acc_test.go b/builder/vsphere/driver/resource_pool_acc_test.go similarity index 100% rename from driver/resource_pool_acc_test.go rename to builder/vsphere/driver/resource_pool_acc_test.go diff --git a/driver/vm.go b/builder/vsphere/driver/vm.go similarity index 100% rename from driver/vm.go rename to builder/vsphere/driver/vm.go diff --git a/driver/vm_cdrom.go b/builder/vsphere/driver/vm_cdrom.go similarity index 100% rename from driver/vm_cdrom.go rename to builder/vsphere/driver/vm_cdrom.go diff --git a/driver/vm_clone_acc_test.go b/builder/vsphere/driver/vm_clone_acc_test.go similarity index 100% rename from driver/vm_clone_acc_test.go rename to builder/vsphere/driver/vm_clone_acc_test.go diff --git a/driver/vm_create_acc_test.go b/builder/vsphere/driver/vm_create_acc_test.go similarity index 100% rename from driver/vm_create_acc_test.go rename to builder/vsphere/driver/vm_create_acc_test.go diff --git a/driver/vm_keyboard.go b/builder/vsphere/driver/vm_keyboard.go similarity index 100% rename from driver/vm_keyboard.go rename to builder/vsphere/driver/vm_keyboard.go diff --git a/examples/alpine/alpine-3.8.json b/builder/vsphere/examples/alpine/alpine-3.8.json similarity index 100% rename from examples/alpine/alpine-3.8.json rename to builder/vsphere/examples/alpine/alpine-3.8.json diff --git a/examples/alpine/answerfile b/builder/vsphere/examples/alpine/answerfile similarity index 100% rename from examples/alpine/answerfile rename to builder/vsphere/examples/alpine/answerfile diff --git a/examples/alpine/setup.sh b/builder/vsphere/examples/alpine/setup.sh similarity index 100% rename from examples/alpine/setup.sh rename to builder/vsphere/examples/alpine/setup.sh diff --git a/examples/clone/alpine.json b/builder/vsphere/examples/clone/alpine.json similarity index 100% rename from examples/clone/alpine.json rename to builder/vsphere/examples/clone/alpine.json diff --git a/examples/driver/main.go b/builder/vsphere/examples/driver/main.go similarity index 100% rename from examples/driver/main.go rename to builder/vsphere/examples/driver/main.go diff --git a/examples/macos/macos-10.13.json b/builder/vsphere/examples/macos/macos-10.13.json similarity index 100% rename from examples/macos/macos-10.13.json rename to builder/vsphere/examples/macos/macos-10.13.json diff --git a/examples/macos/setup/.gitignore b/builder/vsphere/examples/macos/setup/.gitignore similarity index 100% rename from examples/macos/setup/.gitignore rename to builder/vsphere/examples/macos/setup/.gitignore diff --git a/examples/macos/setup/iso-macos.sh b/builder/vsphere/examples/macos/setup/iso-macos.sh similarity index 100% rename from examples/macos/setup/iso-macos.sh rename to builder/vsphere/examples/macos/setup/iso-macos.sh diff --git a/examples/macos/setup/iso-setup.sh b/builder/vsphere/examples/macos/setup/iso-setup.sh similarity index 100% rename from examples/macos/setup/iso-setup.sh rename to builder/vsphere/examples/macos/setup/iso-setup.sh diff --git a/examples/macos/setup/postinstall b/builder/vsphere/examples/macos/setup/postinstall similarity index 100% rename from examples/macos/setup/postinstall rename to builder/vsphere/examples/macos/setup/postinstall diff --git a/examples/macos/setup/setup.sh b/builder/vsphere/examples/macos/setup/setup.sh similarity index 100% rename from examples/macos/setup/setup.sh rename to builder/vsphere/examples/macos/setup/setup.sh diff --git a/examples/ubuntu/preseed.cfg b/builder/vsphere/examples/ubuntu/preseed.cfg similarity index 100% rename from examples/ubuntu/preseed.cfg rename to builder/vsphere/examples/ubuntu/preseed.cfg diff --git a/examples/ubuntu/ubuntu-16.04.json b/builder/vsphere/examples/ubuntu/ubuntu-16.04.json similarity index 100% rename from examples/ubuntu/ubuntu-16.04.json rename to builder/vsphere/examples/ubuntu/ubuntu-16.04.json diff --git a/examples/windows/.gitattributes b/builder/vsphere/examples/windows/.gitattributes similarity index 100% rename from examples/windows/.gitattributes rename to builder/vsphere/examples/windows/.gitattributes diff --git a/examples/windows/setup/Autounattend.xml b/builder/vsphere/examples/windows/setup/Autounattend.xml similarity index 100% rename from examples/windows/setup/Autounattend.xml rename to builder/vsphere/examples/windows/setup/Autounattend.xml diff --git a/examples/windows/setup/setup.ps1 b/builder/vsphere/examples/windows/setup/setup.ps1 similarity index 100% rename from examples/windows/setup/setup.ps1 rename to builder/vsphere/examples/windows/setup/setup.ps1 diff --git a/examples/windows/setup/vmtools.cmd b/builder/vsphere/examples/windows/setup/vmtools.cmd similarity index 100% rename from examples/windows/setup/vmtools.cmd rename to builder/vsphere/examples/windows/setup/vmtools.cmd diff --git a/examples/windows/windows-10.json b/builder/vsphere/examples/windows/windows-10.json similarity index 100% rename from examples/windows/windows-10.json rename to builder/vsphere/examples/windows/windows-10.json diff --git a/go.mod b/builder/vsphere/go.mod similarity index 100% rename from go.mod rename to builder/vsphere/go.mod diff --git a/go.sum b/builder/vsphere/go.sum similarity index 100% rename from go.sum rename to builder/vsphere/go.sum diff --git a/gofmt.sh b/builder/vsphere/gofmt.sh similarity index 100% rename from gofmt.sh rename to builder/vsphere/gofmt.sh diff --git a/iso/builder.go b/builder/vsphere/iso/builder.go similarity index 100% rename from iso/builder.go rename to builder/vsphere/iso/builder.go diff --git a/iso/builder_acc_test.go b/builder/vsphere/iso/builder_acc_test.go similarity index 100% rename from iso/builder_acc_test.go rename to builder/vsphere/iso/builder_acc_test.go diff --git a/iso/config.go b/builder/vsphere/iso/config.go similarity index 100% rename from iso/config.go rename to builder/vsphere/iso/config.go diff --git a/iso/leak_test.go b/builder/vsphere/iso/leak_test.go similarity index 100% rename from iso/leak_test.go rename to builder/vsphere/iso/leak_test.go diff --git a/iso/step_add_cdrom.go b/builder/vsphere/iso/step_add_cdrom.go similarity index 100% rename from iso/step_add_cdrom.go rename to builder/vsphere/iso/step_add_cdrom.go diff --git a/iso/step_add_floppy.go b/builder/vsphere/iso/step_add_floppy.go similarity index 100% rename from iso/step_add_floppy.go rename to builder/vsphere/iso/step_add_floppy.go diff --git a/iso/step_boot_command.go b/builder/vsphere/iso/step_boot_command.go similarity index 100% rename from iso/step_boot_command.go rename to builder/vsphere/iso/step_boot_command.go diff --git a/iso/step_create.go b/builder/vsphere/iso/step_create.go similarity index 100% rename from iso/step_create.go rename to builder/vsphere/iso/step_create.go diff --git a/iso/step_remote_upload.go b/builder/vsphere/iso/step_remote_upload.go similarity index 100% rename from iso/step_remote_upload.go rename to builder/vsphere/iso/step_remote_upload.go diff --git a/iso/step_remove_cdrom.go b/builder/vsphere/iso/step_remove_cdrom.go similarity index 100% rename from iso/step_remove_cdrom.go rename to builder/vsphere/iso/step_remove_cdrom.go diff --git a/iso/step_remove_floppy.go b/builder/vsphere/iso/step_remove_floppy.go similarity index 100% rename from iso/step_remove_floppy.go rename to builder/vsphere/iso/step_remove_floppy.go diff --git a/teamcity-services.yml b/builder/vsphere/teamcity-services.yml similarity index 100% rename from teamcity-services.yml rename to builder/vsphere/teamcity-services.yml diff --git a/test/lab.ovpn b/builder/vsphere/test/lab.ovpn similarity index 100% rename from test/lab.ovpn rename to builder/vsphere/test/lab.ovpn diff --git a/test/lab.p12 b/builder/vsphere/test/lab.p12 similarity index 100% rename from test/lab.p12 rename to builder/vsphere/test/lab.p12 diff --git a/test/test-key.pem b/builder/vsphere/test/test-key.pem similarity index 100% rename from test/test-key.pem rename to builder/vsphere/test/test-key.pem diff --git a/test/test-key.pub b/builder/vsphere/test/test-key.pub similarity index 100% rename from test/test-key.pub rename to builder/vsphere/test/test-key.pub From 073eda76aae664eba5e1f212bac2f66881748f5d Mon Sep 17 00:00:00 2001 From: Megan Marsh <megan@hashicorp.com> Date: Tue, 7 Jan 2020 16:59:31 -0800 Subject: [PATCH 260/266] remove extraneous files from when vsphere builder was a plugin, and move README into packer website as separated docs for vsphere-clone and vsphere-iso. Move option descriptions into struct code, and generate documentation directly from those structs as we do inside of the other builders --- builder/vsphere/.gitignore | 9 - builder/vsphere/LICENSE.txt | 373 -------------- builder/vsphere/Makefile | 36 -- builder/vsphere/README.md | 192 ------- builder/vsphere/clone/builder.go | 4 +- builder/vsphere/clone/builder_acc_test.go | 4 +- builder/vsphere/clone/config.go | 10 +- builder/vsphere/clone/config.hcl2spec.go | 7 + builder/vsphere/clone/step_clone.go | 22 +- builder/vsphere/clone/step_clone.hcl2spec.go | 38 ++ builder/vsphere/cmd/clone/main.go | 16 - builder/vsphere/cmd/iso/main.go | 16 - builder/vsphere/common/artifact.go | 2 +- builder/vsphere/common/config_location.go | 24 +- .../common/config_location.hcl2spec.go | 40 ++ builder/vsphere/common/step_config_params.go | 6 +- .../common/step_config_params.hcl2spec.go | 30 ++ builder/vsphere/common/step_connect.go | 20 +- .../vsphere/common/step_connect.hcl2spec.go | 38 ++ builder/vsphere/common/step_hardware.go | 39 +- .../vsphere/common/step_hardware.hcl2spec.go | 50 ++ builder/vsphere/common/step_run.go | 6 +- builder/vsphere/common/step_run.hcl2spec.go | 30 ++ builder/vsphere/common/step_shutdown.go | 11 +- .../vsphere/common/step_shutdown.hcl2spec.go | 32 ++ builder/vsphere/common/step_snapshot.go | 2 +- builder/vsphere/common/step_template.go | 2 +- builder/vsphere/common/step_wait_for_ip.go | 17 +- .../common/step_wait_for_ip.hcl2spec.go | 32 ++ builder/vsphere/common/testing/utility.go | 4 +- builder/vsphere/docker-compose.yml | 27 - builder/vsphere/examples/driver/main.go | 2 +- builder/vsphere/go.mod | 11 - builder/vsphere/go.sum | 468 ------------------ builder/vsphere/gofmt.sh | 14 - builder/vsphere/iso/builder.go | 4 +- builder/vsphere/iso/builder_acc_test.go | 2 +- builder/vsphere/iso/config.go | 15 +- builder/vsphere/iso/step_add_cdrom.go | 12 +- .../vsphere/iso/step_add_cdrom.hcl2spec.go | 32 ++ builder/vsphere/iso/step_add_floppy.go | 14 +- .../vsphere/iso/step_add_floppy.hcl2spec.go | 34 ++ builder/vsphere/iso/step_boot_command.go | 2 +- builder/vsphere/iso/step_create.go | 39 +- builder/vsphere/iso/step_create.hcl2spec.go | 48 ++ builder/vsphere/iso/step_remote_upload.go | 2 +- builder/vsphere/iso/step_remove_cdrom.go | 2 +- builder/vsphere/iso/step_remove_floppy.go | 2 +- builder/vsphere/teamcity-services.yml | 15 - command/plugin.go | 4 + go.mod | 16 +- go.sum | 55 +- website/source/docs/builders/vmware.html.md | 11 + .../docs/builders/vsphere-clone.html.md.erb | 150 ++++++ .../docs/builders/vsphere-iso.html.md.erb | 155 ++++++ website/source/layouts/docs.erb | 12 +- .../clone/_CloneConfig-not-required.html.md | 12 + .../clone/_Config-not-required.html.md | 7 + .../_ConfigParamsConfig-not-required.html.md | 4 + .../_ConnectConfig-not-required.html.md | 12 + .../_HardwareConfig-not-required.html.md | 25 + .../_LocationConfig-not-required.html.md | 19 + .../common/_RunConfig-not-required.html.md | 4 + .../_ShutdownConfig-not-required.html.md | 8 + .../common/_WaitIpConfig-not-required.html.md | 14 + .../iso/_CDRomConfig-not-required.html.md | 7 + .../iso/_CreateConfig-not-required.html.md | 26 + .../iso/_FloppyConfig-not-required.html.md | 10 + 68 files changed, 1092 insertions(+), 1316 deletions(-) delete mode 100644 builder/vsphere/.gitignore delete mode 100644 builder/vsphere/LICENSE.txt delete mode 100644 builder/vsphere/Makefile delete mode 100644 builder/vsphere/README.md create mode 100644 builder/vsphere/clone/config.hcl2spec.go create mode 100644 builder/vsphere/clone/step_clone.hcl2spec.go delete mode 100644 builder/vsphere/cmd/clone/main.go delete mode 100644 builder/vsphere/cmd/iso/main.go create mode 100644 builder/vsphere/common/config_location.hcl2spec.go create mode 100644 builder/vsphere/common/step_config_params.hcl2spec.go create mode 100644 builder/vsphere/common/step_connect.hcl2spec.go create mode 100644 builder/vsphere/common/step_hardware.hcl2spec.go create mode 100644 builder/vsphere/common/step_run.hcl2spec.go create mode 100644 builder/vsphere/common/step_shutdown.hcl2spec.go create mode 100644 builder/vsphere/common/step_wait_for_ip.hcl2spec.go delete mode 100644 builder/vsphere/docker-compose.yml delete mode 100644 builder/vsphere/go.mod delete mode 100644 builder/vsphere/go.sum delete mode 100755 builder/vsphere/gofmt.sh create mode 100644 builder/vsphere/iso/step_add_cdrom.hcl2spec.go create mode 100644 builder/vsphere/iso/step_add_floppy.hcl2spec.go create mode 100644 builder/vsphere/iso/step_create.hcl2spec.go delete mode 100644 builder/vsphere/teamcity-services.yml create mode 100644 website/source/docs/builders/vsphere-clone.html.md.erb create mode 100644 website/source/docs/builders/vsphere-iso.html.md.erb create mode 100644 website/source/partials/builder/vsphere/clone/_CloneConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/clone/_Config-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_ConfigParamsConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_ConnectConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_HardwareConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_LocationConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_RunConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_ShutdownConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/common/_WaitIpConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/iso/_CDRomConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md create mode 100644 website/source/partials/builder/vsphere/iso/_FloppyConfig-not-required.html.md diff --git a/builder/vsphere/.gitignore b/builder/vsphere/.gitignore deleted file mode 100644 index 274e07ca8..000000000 --- a/builder/vsphere/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.idea/ -packer-builder-vsphere* -build/ -bin/ -.env -test*.json -crash.log -packer_cache/ -vendor/ diff --git a/builder/vsphere/LICENSE.txt b/builder/vsphere/LICENSE.txt deleted file mode 100644 index 14e2f777f..000000000 --- a/builder/vsphere/LICENSE.txt +++ /dev/null @@ -1,373 +0,0 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/builder/vsphere/Makefile b/builder/vsphere/Makefile deleted file mode 100644 index 5e32f679e..000000000 --- a/builder/vsphere/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -GOOPTS := GOARCH=amd64 CGO_ENABLED=0 - -build: iso clone - -iso: iso-linux iso-windows iso-macos -clone: clone-linux clone-windows clone-macos - -iso-linux: modules bin - $(GOOPTS) GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso - -iso-windows: modules bin - $(GOOPTS) GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso - -iso-macos: modules bin - $(GOOPTS) GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso - -clone-linux: modules bin - $(GOOPTS) GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./cmd/clone - -clone-windows: modules bin - $(GOOPTS) GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./cmd/clone - -clone-macos: modules bin - $(GOOPTS) GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./cmd/clone - -modules: - go mod download - -bin: - mkdir -p bin - rm -f bin/* - -test: - PACKER_ACC=1 go test -v -count 1 ./driver ./iso ./clone - -.PHONY: bin test diff --git a/builder/vsphere/README.md b/builder/vsphere/README.md deleted file mode 100644 index ae36eb2d5..000000000 --- a/builder/vsphere/README.md +++ /dev/null @@ -1,192 +0,0 @@ -[![Team project](http://jb.gg/badges/team.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) -[![GitHub latest release](https://img.shields.io/github/release/jetbrains-infra/packer-builder-vsphere.svg)](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) -[![GitHub downloads](https://img.shields.io/github/downloads/jetbrains-infra/packer-builder-vsphere/total.svg)](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) -[![TeamCity build status](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/PackerVSphere_Build.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=PackerVSphere_Build&guest=1) - - -# Packer Builder for VMware vSphere - -This a plugin for [HashiCorp Packer](https://www.packer.io/). It uses native vSphere API, and creates virtual machines remotely. - -`vsphere-iso` builder creates new VMs from scratch. -`vsphere-clone` builder clones VMs from existing templates. - -- VMware Player is not required. -- Official vCenter API is used, no ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) is required. - -## Installation -* Download binaries from the [releases page](https://github.com/jetbrains-infra/packer-builder-vsphere/releases). -* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugins, or simply put them into the same directory with JSON templates. On Linux and macOS run `chmod +x` on the files. - -## Build - -Install Go and [dep](https://github.com/golang/dep/releases), run `build.sh`. - -Or build inside a container by Docker Compose: -``` -docker-compose run build -``` - -The binaries will be in `bin/` directory. - -Artifacts can be also downloaded from [TeamCity builds](https://teamcity.jetbrains.com/viewLog.html?buildTypeId=PackerVSphere_Build&buildId=lastSuccessful&tab=artifacts&guest=1). - -## Examples - -See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/jetbrains-infra/packer-builder-vsphere/tree/master/examples/). - -## Parameter Reference - -### Connection - -* `vcenter_server`(string) - vCenter server hostname. -* `username`(string) - vSphere username. -* `password`(string) - vSphere password. -* `insecure_connection`(boolean) - Do not validate vCenter server's TLS certificate. Defaults to `false`. -* `datacenter`(string) - VMware datacenter name. Required if there is more than one datacenter in vCenter. - -### VM Location - -* `vm_name`(string) - Name of the new VM to create. -* `folder`(string) - VM folder to create the VM in. -* `host`(string) - ESXi host where target VM is created. A full path must be specified if the host is in a folder. For example `folder/host`. See the `Specifying Clusters and Hosts` section above for more details. -* `cluster`(string) - ESXi cluster where target VM is created. See [Working with Clusters](#working-with-clusters). -* `resource_pool`(string) - VMWare resource pool. Defaults to the root resource pool of the `host` or `cluster`. -* `datastore`(string) - VMWare datastore. Required if `host` is a cluster, or if `host` has multiple datastores. -* `notes`(string) - VM notes. - -### VM Location (`vsphere-clone` only) - -* `template`(string) - Name of source VM. Path is optional. -* `linked_clone`(boolean) - Create VM as a linked clone from latest snapshot. Defaults to `false`. - -### Hardware - -* `CPUs`(number) - Number of CPU sockets. -* `cpu_cores`(number) - Number of CPU cores per socket. -* `CPU_limit`(number) - Upper limit of available CPU resources in MHz. -* `CPU_reservation`(number) - Amount of reserved CPU resources in MHz. -* `CPU_hot_plug`(boolean) - Enable CPU hot plug setting for virtual machine. Defaults to `false`. -* `RAM`(number) - Amount of RAM in MB. -* `RAM_reservation`(number) - Amount of reserved RAM in MB. -* `RAM_reserve_all`(boolean) - Reserve all available RAM. Defaults to `false`. Cannot be used together with `RAM_reservation`. -* `RAM_hot_plug`(boolean) - Enable RAM hot plug setting for virtual machine. Defaults to `false`. -* `video_ram`(number) - Amount of video memory in MB. -* `disk_size`(number) - The size of the disk in MB. -* `network`(string) - Set network VM will be connected to. -* `NestedHV`(boolean) - Enable nested hardware virtualization for VM. Defaults to `false`. -* `configuration_parameters`(map) - Custom parameters. -* `boot_order`(string) - Priority of boot devices. Defaults to `disk,cdrom` - -### Hardware (`vsphere-iso` only) - -* `vm_version`(number) - Set VM hardware version. Defaults to the most current VM hardware version supported by vCenter. See [VMWare article 1003746](https://kb.vmware.com/s/article/1003746) for the full list of supported VM hardware versions. -* `guest_os_type`(string) - Set VM OS type. Defaults to `otherGuest`. See [here](https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.GuestOsDescriptor.GuestOsIdentifier.html) for a full list of possible values. -* `disk_controller_type`(string) - Set VM disk controller type. Example `pvscsi`. -* `disk_thin_provisioned`(boolean) - Enable VMDK thin provisioning for VM. Defaults to `false`. -* `network_card`(string) - Set VM network card type. Example `vmxnet3`. -* `usb_controller`(boolean) - Create USB controller for virtual machine. Defaults to `false`. -* `cdrom_type`(string) - Which controller to use. Example `sata`. Defaults to `ide`. -* `firmware`(string) - Set the Firmware at machine creation. Example `efi`. Defaults to `bios`. - - -### Boot (`vsphere-iso` only) - -* `iso_paths`(array of strings) - List of datastore paths to ISO files that will be mounted to the VM. Example `"[datastore1] ISO/ubuntu.iso"`. -* `floppy_files`(array of strings) - List of local files to be mounted to the VM floppy drive. Can be used to make Debian preseed or RHEL kickstart files available to the VM. -* `floppy_dirs`(array of strings) - List of directories to copy files from. -* `floppy_img_path`(string) - Datastore path to a floppy image that will be mounted to the VM. Example `[datastore1] ISO/pvscsi-Windows8.flp`. -* `http_directory`(string) - Path to a directory to serve using a local HTTP server. Beware of [limitations](https://github.com/jetbrains-infra/packer-builder-vsphere/issues/108#issuecomment-449634324). -* `http_ip`(string) - Specify IP address on which the HTTP server is started. If not provided the first non-loopback interface is used. -* `http_port_min` and `http_port_max` as in other [builders](https://www.packer.io/docs/builders/virtualbox-iso.html#http_port_min). -* `iso_urls`(array of strings) - Multiple URLs for the ISO to download. Packer will try these in order. If anything goes wrong attempting to download or while downloading a single URL, it will move on to the next. All URLs must point to the same file (same checksum). By default this is empty and iso_url is used. Only one of iso_url or iso_urls can be specified. -* `iso_checksum `(string) - The checksum for the OS ISO file. Because ISO files are so large, this is required and Packer will verify it prior to booting a virtual machine with the ISO attached. The type of the checksum is specified with iso_checksum_type, documented below. At least one of iso_checksum and iso_checksum_url must be defined. This has precedence over iso_checksum_url type. -* `iso_checksum_type`(string) - The type of the checksum specified in iso_checksum. Valid values are none, md5, sha1, sha256, or sha512 currently. While none will skip checksumming, this is not recommended since ISO files are generally large and corruption does happen from time to time. -* `iso_checksum_url`(string) - A URL to a GNU or BSD style checksum file containing a checksum for the OS ISO file. At least one of iso_checksum and iso_checksum_url must be defined. This will be ignored if iso_checksum is non empty. -* `boot_wait`(string) Amount of time to wait for the VM to boot. Examples 45s and 10m. Defaults to 10 seconds. See [format](https://golang.org/pkg/time/#ParseDuration). -* `boot_command`(array of strings) - List of commands to type when the VM is first booted. Used to initalize the operating system installer. See details in [Packer docs](https://www.packer.io/docs/builders/virtualbox-iso.html#boot-command). - -### Provision - -* `communicator` - `ssh` (default), `winrm`, or `none` (create/clone, customize hardware, but do not boot). -* `ip_wait_timeout`(string) - Amount of time to wait for VM's IP, similar to 'ssh_timeout'. Defaults to 30m (30 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. -* `ip_settle_timeout`(string) - Amount of time to wait for VM's IP to settle down, sometimes VM may report incorrect IP initially, then its recommended to set that parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to 5s(5 seconds). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. -* `ssh_username`(string) - Username in guest OS. -* `ssh_password`(string) - Password to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. -* `ssh_private_key_file`(string) - Path to the SSH private key file to access guest OS. Only specify `ssh_password` or `ssh_private_key_file`, but not both. -* `winrm_username`(string) - Username in guest OS. -* `winrm_password`(string) - Password to access guest OS. -* `shutdown_command`(string) - Specify a VM guest shutdown command. VMware guest tools are used by default. -* `shutdown_timeout`(string) - Amount of time to wait for graceful VM shutdown. Examples 45s and 10m. Defaults to 5m(5 minutes). See the Go Lang [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation for full details. - -### Postprocessing - -* `create_snapshot`(boolean) - Create a snapshot when set to `true`, so the VM can be used as a base for linked clones. Defaults to `false`. -* `convert_to_template`(boolean) - Convert VM to a template. Defaults to `false`. - -## Working with Clusters -#### Standalone Hosts -Only use the `host` option. Optionally specify a `resource_pool`: -``` -"host": "esxi-1.vsphere65.test", -"resource_pool": "pool1", -``` - -#### Clusters Without DRS -Use the `cluster` and `host `parameters: -``` -"cluster": "cluster1", -"host": "esxi-2.vsphere65.test", -``` - -#### Clusters With DRS -Only use the `cluster` option. Optionally specify a `resource_pool`: -``` -"cluster": "cluster2", -"resource_pool": "pool1", -``` - -## Required vSphere Permissions - -* VM folder (this object and children): - ``` - Virtual machine -> Inventory - Virtual machine -> Configuration - Virtual machine -> Interaction - Virtual machine -> Snapshot management - Virtual machine -> Provisioning - ``` - Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235. -* Resource pool, host, or cluster (this object): - ``` - Resource -> Assign virtual machine to resource pool - ``` -* Host in clusters without DRS (this object): - ``` - Read-only - ``` -* Datastore (this object): - ``` - Datastore -> Allocate space - Datastore -> Browse datastore - Datastore -> Low level file operations - ``` -* Network (this object): - ``` - Network -> Assign network - ``` -* Distributed switch (this object): - ``` - Read-only - ``` - -For floppy image upload: - -* Datacenter (this object): - ``` - Datastore -> Low level file operations - ``` -* Host (this object): - ``` - Host -> Configuration -> System Management - ``` diff --git a/builder/vsphere/clone/builder.go b/builder/vsphere/clone/builder.go index 008472296..8c4a54365 100644 --- a/builder/vsphere/clone/builder.go +++ b/builder/vsphere/clone/builder.go @@ -2,12 +2,12 @@ package clone import ( "context" + "github.com/hashicorp/packer/builder/vsphere/common" + "github.com/hashicorp/packer/builder/vsphere/driver" packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type Builder struct { diff --git a/builder/vsphere/clone/builder_acc_test.go b/builder/vsphere/clone/builder_acc_test.go index cb7b12f52..081d43dd9 100644 --- a/builder/vsphere/clone/builder_acc_test.go +++ b/builder/vsphere/clone/builder_acc_test.go @@ -1,10 +1,10 @@ package clone import ( + "github.com/hashicorp/packer/builder/vsphere/common" + commonT "github.com/hashicorp/packer/builder/vsphere/common/testing" builderT "github.com/hashicorp/packer/helper/builder/testing" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "github.com/vmware/govmomi/vim25/types" "os" "testing" diff --git a/builder/vsphere/clone/config.go b/builder/vsphere/clone/config.go index bcb8b791b..6a780934f 100644 --- a/builder/vsphere/clone/config.go +++ b/builder/vsphere/clone/config.go @@ -1,12 +1,15 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type ShutdownConfig + package clone import ( + "github.com/hashicorp/packer/builder/vsphere/common" packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "github.com/jetbrains-infra/packer-builder-vsphere/common" ) type Config struct { @@ -23,7 +26,10 @@ type Config struct { Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` - CreateSnapshot bool `mapstructure:"create_snapshot"` + // Create a snapshot when set to `true`, so the VM can be used as a base + // for linked clones. Defaults to `false`. + CreateSnapshot bool `mapstructure:"create_snapshot"` + // Convert VM to a template. Defaults to `false`. ConvertToTemplate bool `mapstructure:"convert_to_template"` ctx interpolate.Context diff --git a/builder/vsphere/clone/config.hcl2spec.go b/builder/vsphere/clone/config.hcl2spec.go new file mode 100644 index 000000000..8c548ebcf --- /dev/null +++ b/builder/vsphere/clone/config.hcl2spec.go @@ -0,0 +1,7 @@ +// Code generated by "mapstructure-to-hcl2 -type ShutdownConfig"; DO NOT EDIT. +package clone + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) diff --git a/builder/vsphere/clone/step_clone.go b/builder/vsphere/clone/step_clone.go index d47949903..3c7ffb0c3 100644 --- a/builder/vsphere/clone/step_clone.go +++ b/builder/vsphere/clone/step_clone.go @@ -1,20 +1,28 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type CloneConfig + package clone import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/common" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type CloneConfig struct { - Template string `mapstructure:"template"` - DiskSize int64 `mapstructure:"disk_size"` - LinkedClone bool `mapstructure:"linked_clone"` - Network string `mapstructure:"network"` - Notes string `mapstructure:"notes"` + // Name of source VM. Path is optional. + Template string `mapstructure:"template"` + // The size of the disk in MB. + DiskSize int64 `mapstructure:"disk_size"` + // Create VM as a linked clone from latest snapshot. Defaults to `false`. + LinkedClone bool `mapstructure:"linked_clone"` + // Set network VM will be connected to. + Network string `mapstructure:"network"` + // VM notes. + Notes string `mapstructure:"notes"` } func (c *CloneConfig) Prepare() []error { diff --git a/builder/vsphere/clone/step_clone.hcl2spec.go b/builder/vsphere/clone/step_clone.hcl2spec.go new file mode 100644 index 000000000..2f2419b10 --- /dev/null +++ b/builder/vsphere/clone/step_clone.hcl2spec.go @@ -0,0 +1,38 @@ +// Code generated by "mapstructure-to-hcl2 -type CloneConfig"; DO NOT EDIT. +package clone + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatCloneConfig is an auto-generated flat version of CloneConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatCloneConfig struct { + Template *string `mapstructure:"template" cty:"template"` + DiskSize *int64 `mapstructure:"disk_size" cty:"disk_size"` + LinkedClone *bool `mapstructure:"linked_clone" cty:"linked_clone"` + Network *string `mapstructure:"network" cty:"network"` + Notes *string `mapstructure:"notes" cty:"notes"` +} + +// FlatMapstructure returns a new FlatCloneConfig. +// FlatCloneConfig is an auto-generated flat version of CloneConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*CloneConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatCloneConfig) +} + +// HCL2Spec returns the hcl spec of a CloneConfig. +// This spec is used by HCL to read the fields of CloneConfig. +// The decoded values from this spec will then be applied to a FlatCloneConfig. +func (*FlatCloneConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "template": &hcldec.AttrSpec{Name: "template", Type: cty.String, Required: false}, + "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, + "linked_clone": &hcldec.AttrSpec{Name: "linked_clone", Type: cty.Bool, Required: false}, + "network": &hcldec.AttrSpec{Name: "network", Type: cty.String, Required: false}, + "notes": &hcldec.AttrSpec{Name: "notes", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/cmd/clone/main.go b/builder/vsphere/cmd/clone/main.go deleted file mode 100644 index 2e60eff06..000000000 --- a/builder/vsphere/cmd/clone/main.go +++ /dev/null @@ -1,16 +0,0 @@ -package main - -import "github.com/hashicorp/packer/packer/plugin" -import "github.com/jetbrains-infra/packer-builder-vsphere/clone" - -func main() { - server, err := plugin.Server() - if err != nil { - panic(err) - } - err = server.RegisterBuilder(new(clone.Builder)) - if err != nil { - panic(err) - } - server.Serve() -} diff --git a/builder/vsphere/cmd/iso/main.go b/builder/vsphere/cmd/iso/main.go deleted file mode 100644 index f28508154..000000000 --- a/builder/vsphere/cmd/iso/main.go +++ /dev/null @@ -1,16 +0,0 @@ -package main - -import "github.com/hashicorp/packer/packer/plugin" -import "github.com/jetbrains-infra/packer-builder-vsphere/iso" - -func main() { - server, err := plugin.Server() - if err != nil { - panic(err) - } - err = server.RegisterBuilder(new(iso.Builder)) - if err != nil { - panic(err) - } - server.Serve() -} diff --git a/builder/vsphere/common/artifact.go b/builder/vsphere/common/artifact.go index ac25ea4f6..863e1013d 100644 --- a/builder/vsphere/common/artifact.go +++ b/builder/vsphere/common/artifact.go @@ -1,7 +1,7 @@ package common import ( - "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/hashicorp/packer/builder/vsphere/driver" ) const BuilderId = "jetbrains.vsphere" diff --git a/builder/vsphere/common/config_location.go b/builder/vsphere/common/config_location.go index 027b5d4dc..248bc7e1c 100644 --- a/builder/vsphere/common/config_location.go +++ b/builder/vsphere/common/config_location.go @@ -1,14 +1,28 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type LocationConfig + package common import "fmt" type LocationConfig struct { - VMName string `mapstructure:"vm_name"` - Folder string `mapstructure:"folder"` - Cluster string `mapstructure:"cluster"` - Host string `mapstructure:"host"` + // Name of the new VM to create. + VMName string `mapstructure:"vm_name"` + // VM folder to create the VM in. + Folder string `mapstructure:"folder"` + // ESXi cluster where target VM is created. See + // [Working with Clusters](#working-with-clusters). + Cluster string `mapstructure:"cluster"` + // ESXi host where target VM is created. A full path must be specified if + // the host is in a folder. For example `folder/host`. See the + // `Specifying Clusters and Hosts` section above for more details. + Host string `mapstructure:"host"` + // VMWare resource pool. Defaults to the root resource pool of the + // `host` or `cluster`. ResourcePool string `mapstructure:"resource_pool"` - Datastore string `mapstructure:"datastore"` + // VMWare datastore. Required if `host` is a cluster, or if `host` has + // multiple datastores. + Datastore string `mapstructure:"datastore"` } func (c *LocationConfig) Prepare() []error { diff --git a/builder/vsphere/common/config_location.hcl2spec.go b/builder/vsphere/common/config_location.hcl2spec.go new file mode 100644 index 000000000..be5b02f03 --- /dev/null +++ b/builder/vsphere/common/config_location.hcl2spec.go @@ -0,0 +1,40 @@ +// Code generated by "mapstructure-to-hcl2 -type LocationConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatLocationConfig is an auto-generated flat version of LocationConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatLocationConfig struct { + VMName *string `mapstructure:"vm_name" cty:"vm_name"` + Folder *string `mapstructure:"folder" cty:"folder"` + Cluster *string `mapstructure:"cluster" cty:"cluster"` + Host *string `mapstructure:"host" cty:"host"` + ResourcePool *string `mapstructure:"resource_pool" cty:"resource_pool"` + Datastore *string `mapstructure:"datastore" cty:"datastore"` +} + +// FlatMapstructure returns a new FlatLocationConfig. +// FlatLocationConfig is an auto-generated flat version of LocationConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*LocationConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatLocationConfig) +} + +// HCL2Spec returns the hcl spec of a LocationConfig. +// This spec is used by HCL to read the fields of LocationConfig. +// The decoded values from this spec will then be applied to a FlatLocationConfig. +func (*FlatLocationConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false}, + "folder": &hcldec.AttrSpec{Name: "folder", Type: cty.String, Required: false}, + "cluster": &hcldec.AttrSpec{Name: "cluster", Type: cty.String, Required: false}, + "host": &hcldec.AttrSpec{Name: "host", Type: cty.String, Required: false}, + "resource_pool": &hcldec.AttrSpec{Name: "resource_pool", Type: cty.String, Required: false}, + "datastore": &hcldec.AttrSpec{Name: "datastore", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/step_config_params.go b/builder/vsphere/common/step_config_params.go index f8e5606b1..ba81194da 100644 --- a/builder/vsphere/common/step_config_params.go +++ b/builder/vsphere/common/step_config_params.go @@ -1,14 +1,18 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type ConfigParamsConfig + package common import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type ConfigParamsConfig struct { + // Custom parameters. ConfigParams map[string]string `mapstructure:"configuration_parameters"` } diff --git a/builder/vsphere/common/step_config_params.hcl2spec.go b/builder/vsphere/common/step_config_params.hcl2spec.go new file mode 100644 index 000000000..ddb1bd51d --- /dev/null +++ b/builder/vsphere/common/step_config_params.hcl2spec.go @@ -0,0 +1,30 @@ +// Code generated by "mapstructure-to-hcl2 -type ConfigParamsConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatConfigParamsConfig is an auto-generated flat version of ConfigParamsConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatConfigParamsConfig struct { + ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters"` +} + +// FlatMapstructure returns a new FlatConfigParamsConfig. +// FlatConfigParamsConfig is an auto-generated flat version of ConfigParamsConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*ConfigParamsConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatConfigParamsConfig) +} + +// HCL2Spec returns the hcl spec of a ConfigParamsConfig. +// This spec is used by HCL to read the fields of ConfigParamsConfig. +// The decoded values from this spec will then be applied to a FlatConfigParamsConfig. +func (*FlatConfigParamsConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "configuration_parameters": &hcldec.BlockAttrsSpec{TypeName: "configuration_parameters", ElementType: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/step_connect.go b/builder/vsphere/common/step_connect.go index 258b8d5d7..85136a8d4 100644 --- a/builder/vsphere/common/step_connect.go +++ b/builder/vsphere/common/step_connect.go @@ -1,18 +1,26 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type ConnectConfig + package common import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type ConnectConfig struct { - VCenterServer string `mapstructure:"vcenter_server"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` - InsecureConnection bool `mapstructure:"insecure_connection"` - Datacenter string `mapstructure:"datacenter"` + // vCenter server hostname. + VCenterServer string `mapstructure:"vcenter_server"` + // vSphere username. + Username string `mapstructure:"username"` + // vSphere password. + Password string `mapstructure:"password"` + // Do not validate vCenter server's TLS certificate. Defaults to `false`. + InsecureConnection bool `mapstructure:"insecure_connection"` + // VMware datacenter name. Required if there is more than one datacenter in vCenter. + Datacenter string `mapstructure:"datacenter"` } func (c *ConnectConfig) Prepare() []error { diff --git a/builder/vsphere/common/step_connect.hcl2spec.go b/builder/vsphere/common/step_connect.hcl2spec.go new file mode 100644 index 000000000..d607a674a --- /dev/null +++ b/builder/vsphere/common/step_connect.hcl2spec.go @@ -0,0 +1,38 @@ +// Code generated by "mapstructure-to-hcl2 -type ConnectConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatConnectConfig is an auto-generated flat version of ConnectConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatConnectConfig struct { + VCenterServer *string `mapstructure:"vcenter_server" cty:"vcenter_server"` + Username *string `mapstructure:"username" cty:"username"` + Password *string `mapstructure:"password" cty:"password"` + InsecureConnection *bool `mapstructure:"insecure_connection" cty:"insecure_connection"` + Datacenter *string `mapstructure:"datacenter" cty:"datacenter"` +} + +// FlatMapstructure returns a new FlatConnectConfig. +// FlatConnectConfig is an auto-generated flat version of ConnectConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*ConnectConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatConnectConfig) +} + +// HCL2Spec returns the hcl spec of a ConnectConfig. +// This spec is used by HCL to read the fields of ConnectConfig. +// The decoded values from this spec will then be applied to a FlatConnectConfig. +func (*FlatConnectConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "vcenter_server": &hcldec.AttrSpec{Name: "vcenter_server", Type: cty.String, Required: false}, + "username": &hcldec.AttrSpec{Name: "username", Type: cty.String, Required: false}, + "password": &hcldec.AttrSpec{Name: "password", Type: cty.String, Required: false}, + "insecure_connection": &hcldec.AttrSpec{Name: "insecure_connection", Type: cty.Bool, Required: false}, + "datacenter": &hcldec.AttrSpec{Name: "datacenter", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/step_hardware.go b/builder/vsphere/common/step_hardware.go index 00f1f2fbd..20d67d080 100644 --- a/builder/vsphere/common/step_hardware.go +++ b/builder/vsphere/common/step_hardware.go @@ -1,27 +1,40 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type HardwareConfig + package common import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type HardwareConfig struct { - CPUs int32 `mapstructure:"CPUs"` - CpuCores int32 `mapstructure:"cpu_cores"` - CPUReservation int64 `mapstructure:"CPU_reservation"` - CPULimit int64 `mapstructure:"CPU_limit"` - CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` - - RAM int64 `mapstructure:"RAM"` - RAMReservation int64 `mapstructure:"RAM_reservation"` - RAMReserveAll bool `mapstructure:"RAM_reserve_all"` - MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` - + // Number of CPU sockets. + CPUs int32 `mapstructure:"CPUs"` + // Number of CPU cores per socket. + CpuCores int32 `mapstructure:"cpu_cores"` + // Amount of reserved CPU resources in MHz. + CPUReservation int64 `mapstructure:"CPU_reservation"` + // Upper limit of available CPU resources in MHz. + CPULimit int64 `mapstructure:"CPU_limit"` + // Enable CPU hot plug setting for virtual machine. Defaults to `false`. + CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` + // Amount of RAM in MB. + RAM int64 `mapstructure:"RAM"` + // Amount of reserved RAM in MB. + RAMReservation int64 `mapstructure:"RAM_reservation"` + // Reserve all available RAM. Defaults to `false`. Cannot be used together + // with `RAM_reservation`. + RAMReserveAll bool `mapstructure:"RAM_reserve_all"` + // Enable RAM hot plug setting for virtual machine. Defaults to `false`. + MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` + // Amount of video memory in MB. VideoRAM int64 `mapstructure:"video_ram"` - NestedHV bool `mapstructure:"NestedHV"` + // Enable nested hardware virtualization for VM. Defaults to `false`. + NestedHV bool `mapstructure:"NestedHV"` } func (c *HardwareConfig) Prepare() []error { diff --git a/builder/vsphere/common/step_hardware.hcl2spec.go b/builder/vsphere/common/step_hardware.hcl2spec.go new file mode 100644 index 000000000..9640dccc8 --- /dev/null +++ b/builder/vsphere/common/step_hardware.hcl2spec.go @@ -0,0 +1,50 @@ +// Code generated by "mapstructure-to-hcl2 -type HardwareConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatHardwareConfig is an auto-generated flat version of HardwareConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatHardwareConfig struct { + CPUs *int32 `mapstructure:"CPUs" cty:"CPUs"` + CpuCores *int32 `mapstructure:"cpu_cores" cty:"cpu_cores"` + CPUReservation *int64 `mapstructure:"CPU_reservation" cty:"CPU_reservation"` + CPULimit *int64 `mapstructure:"CPU_limit" cty:"CPU_limit"` + CpuHotAddEnabled *bool `mapstructure:"CPU_hot_plug" cty:"CPU_hot_plug"` + RAM *int64 `mapstructure:"RAM" cty:"RAM"` + RAMReservation *int64 `mapstructure:"RAM_reservation" cty:"RAM_reservation"` + RAMReserveAll *bool `mapstructure:"RAM_reserve_all" cty:"RAM_reserve_all"` + MemoryHotAddEnabled *bool `mapstructure:"RAM_hot_plug" cty:"RAM_hot_plug"` + VideoRAM *int64 `mapstructure:"video_ram" cty:"video_ram"` + NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV"` +} + +// FlatMapstructure returns a new FlatHardwareConfig. +// FlatHardwareConfig is an auto-generated flat version of HardwareConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*HardwareConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatHardwareConfig) +} + +// HCL2Spec returns the hcl spec of a HardwareConfig. +// This spec is used by HCL to read the fields of HardwareConfig. +// The decoded values from this spec will then be applied to a FlatHardwareConfig. +func (*FlatHardwareConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "CPUs": &hcldec.AttrSpec{Name: "CPUs", Type: cty.Number, Required: false}, + "cpu_cores": &hcldec.AttrSpec{Name: "cpu_cores", Type: cty.Number, Required: false}, + "CPU_reservation": &hcldec.AttrSpec{Name: "CPU_reservation", Type: cty.Number, Required: false}, + "CPU_limit": &hcldec.AttrSpec{Name: "CPU_limit", Type: cty.Number, Required: false}, + "CPU_hot_plug": &hcldec.AttrSpec{Name: "CPU_hot_plug", Type: cty.Bool, Required: false}, + "RAM": &hcldec.AttrSpec{Name: "RAM", Type: cty.Number, Required: false}, + "RAM_reservation": &hcldec.AttrSpec{Name: "RAM_reservation", Type: cty.Number, Required: false}, + "RAM_reserve_all": &hcldec.AttrSpec{Name: "RAM_reserve_all", Type: cty.Bool, Required: false}, + "RAM_hot_plug": &hcldec.AttrSpec{Name: "RAM_hot_plug", Type: cty.Bool, Required: false}, + "video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false}, + "NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/step_run.go b/builder/vsphere/common/step_run.go index 92366cf25..34fcc0c77 100644 --- a/builder/vsphere/common/step_run.go +++ b/builder/vsphere/common/step_run.go @@ -1,14 +1,18 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type RunConfig + package common import ( "context" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" ) type RunConfig struct { + // Priority of boot devices. Defaults to `disk,cdrom` BootOrder string `mapstructure:"boot_order"` // example: "floppy,cdrom,ethernet,disk" } diff --git a/builder/vsphere/common/step_run.hcl2spec.go b/builder/vsphere/common/step_run.hcl2spec.go new file mode 100644 index 000000000..5079a771c --- /dev/null +++ b/builder/vsphere/common/step_run.hcl2spec.go @@ -0,0 +1,30 @@ +// Code generated by "mapstructure-to-hcl2 -type RunConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatRunConfig is an auto-generated flat version of RunConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatRunConfig struct { + BootOrder *string `mapstructure:"boot_order" cty:"boot_order"` +} + +// FlatMapstructure returns a new FlatRunConfig. +// FlatRunConfig is an auto-generated flat version of RunConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*RunConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatRunConfig) +} + +// HCL2Spec returns the hcl spec of a RunConfig. +// This spec is used by HCL to read the fields of RunConfig. +// The decoded values from this spec will then be applied to a FlatRunConfig. +func (*FlatRunConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "boot_order": &hcldec.AttrSpec{Name: "boot_order", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/step_shutdown.go b/builder/vsphere/common/step_shutdown.go index 94a507900..c2124e84d 100644 --- a/builder/vsphere/common/step_shutdown.go +++ b/builder/vsphere/common/step_shutdown.go @@ -1,18 +1,25 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type ShutdownConfig + package common import ( "bytes" "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "log" "time" ) type ShutdownConfig struct { - Command string `mapstructure:"shutdown_command"` + // Specify a VM guest shutdown command. VMware guest tools are used by + // default. + Command string `mapstructure:"shutdown_command"` + // Amount of time to wait for graceful VM shutdown. Examples 45s and 10m. + // Defaults to 5m(5 minutes). Timeout time.Duration `mapstructure:"shutdown_timeout"` } diff --git a/builder/vsphere/common/step_shutdown.hcl2spec.go b/builder/vsphere/common/step_shutdown.hcl2spec.go new file mode 100644 index 000000000..6bd80b695 --- /dev/null +++ b/builder/vsphere/common/step_shutdown.hcl2spec.go @@ -0,0 +1,32 @@ +// Code generated by "mapstructure-to-hcl2 -type ShutdownConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatShutdownConfig is an auto-generated flat version of ShutdownConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatShutdownConfig struct { + Command *string `mapstructure:"shutdown_command" cty:"shutdown_command"` + Timeout *string `mapstructure:"shutdown_timeout" cty:"shutdown_timeout"` +} + +// FlatMapstructure returns a new FlatShutdownConfig. +// FlatShutdownConfig is an auto-generated flat version of ShutdownConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*ShutdownConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatShutdownConfig) +} + +// HCL2Spec returns the hcl spec of a ShutdownConfig. +// This spec is used by HCL to read the fields of ShutdownConfig. +// The decoded values from this spec will then be applied to a FlatShutdownConfig. +func (*FlatShutdownConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "shutdown_command": &hcldec.AttrSpec{Name: "shutdown_command", Type: cty.String, Required: false}, + "shutdown_timeout": &hcldec.AttrSpec{Name: "shutdown_timeout", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/step_snapshot.go b/builder/vsphere/common/step_snapshot.go index 1d80a4be3..4f7cd7604 100644 --- a/builder/vsphere/common/step_snapshot.go +++ b/builder/vsphere/common/step_snapshot.go @@ -2,9 +2,9 @@ package common import ( "context" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type StepCreateSnapshot struct { diff --git a/builder/vsphere/common/step_template.go b/builder/vsphere/common/step_template.go index d42b0b186..42a2573e1 100644 --- a/builder/vsphere/common/step_template.go +++ b/builder/vsphere/common/step_template.go @@ -2,9 +2,9 @@ package common import ( "context" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type StepConvertToTemplate struct { diff --git a/builder/vsphere/common/step_wait_for_ip.go b/builder/vsphere/common/step_wait_for_ip.go index 4365b7f62..51593b1f2 100644 --- a/builder/vsphere/common/step_wait_for_ip.go +++ b/builder/vsphere/common/step_wait_for_ip.go @@ -1,17 +1,30 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type WaitIpConfig + package common import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "log" "time" ) type WaitIpConfig struct { - WaitTimeout time.Duration `mapstructure:"ip_wait_timeout"` + // Amount of time to wait for VM's IP, similar to 'ssh_timeout'. + // Defaults to 30m (30 minutes). See the Goang + // [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation + // for full details. + WaitTimeout time.Duration `mapstructure:"ip_wait_timeout"` + // Amount of time to wait for VM's IP to settle down, sometimes VM may + // report incorrect IP initially, then its recommended to set that + // parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to + // 5s(5 seconds). See the Golang + // [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation + // for full details. SettleTimeout time.Duration `mapstructure:"ip_settle_timeout"` // WaitTimeout is a total timeout, so even if VM changes IP frequently and it doesn't settle down we will end waiting. diff --git a/builder/vsphere/common/step_wait_for_ip.hcl2spec.go b/builder/vsphere/common/step_wait_for_ip.hcl2spec.go new file mode 100644 index 000000000..0e35cbbf8 --- /dev/null +++ b/builder/vsphere/common/step_wait_for_ip.hcl2spec.go @@ -0,0 +1,32 @@ +// Code generated by "mapstructure-to-hcl2 -type WaitIpConfig"; DO NOT EDIT. +package common + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatWaitIpConfig is an auto-generated flat version of WaitIpConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatWaitIpConfig struct { + WaitTimeout *string `mapstructure:"ip_wait_timeout" cty:"ip_wait_timeout"` + SettleTimeout *string `mapstructure:"ip_settle_timeout" cty:"ip_settle_timeout"` +} + +// FlatMapstructure returns a new FlatWaitIpConfig. +// FlatWaitIpConfig is an auto-generated flat version of WaitIpConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*WaitIpConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatWaitIpConfig) +} + +// HCL2Spec returns the hcl spec of a WaitIpConfig. +// This spec is used by HCL to read the fields of WaitIpConfig. +// The decoded values from this spec will then be applied to a FlatWaitIpConfig. +func (*FlatWaitIpConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "ip_wait_timeout": &hcldec.AttrSpec{Name: "ip_wait_timeout", Type: cty.String, Required: false}, + "ip_settle_timeout": &hcldec.AttrSpec{Name: "ip_settle_timeout", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/common/testing/utility.go b/builder/vsphere/common/testing/utility.go index 325b86cfa..22a0d2e86 100644 --- a/builder/vsphere/common/testing/utility.go +++ b/builder/vsphere/common/testing/utility.go @@ -3,9 +3,9 @@ package testing import ( "encoding/json" "fmt" + "github.com/hashicorp/packer/builder/vsphere/common" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "math/rand" "os" "testing" diff --git a/builder/vsphere/docker-compose.yml b/builder/vsphere/docker-compose.yml deleted file mode 100644 index 8d158b02a..000000000 --- a/builder/vsphere/docker-compose.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '2' -services: - build: - image: jetbrainsinfra/golang:1.11.4 - volumes: - - .:/work - - modules:/go/pkg/mod - - cache:/root/.cache - working_dir: /work - command: make build -j 3 - - test: - image: jetbrainsinfra/golang:1.11.4 - volumes: - - .:/work - - modules:/go/pkg/mod - - cache:/root/.cache - working_dir: /work -# network_mode: "container:vpn" - environment: - VSPHERE_USERNAME: - VSPHERE_PASSWORD: - command: make test - -volumes: - modules: - cache: diff --git a/builder/vsphere/examples/driver/main.go b/builder/vsphere/examples/driver/main.go index e60c19bb5..486304158 100644 --- a/builder/vsphere/examples/driver/main.go +++ b/builder/vsphere/examples/driver/main.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "github.com/hashicorp/packer/builder/vsphere/driver" ) func main() { diff --git a/builder/vsphere/go.mod b/builder/vsphere/go.mod deleted file mode 100644 index 8536831d4..000000000 --- a/builder/vsphere/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/jetbrains-infra/packer-builder-vsphere - -require ( - github.com/hashicorp/packer v1.4.2 - github.com/vmware/govmomi v0.20.0 - go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16 - golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 -) - -replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 - diff --git a/builder/vsphere/go.sum b/builder/vsphere/go.sum deleted file mode 100644 index 493f13d5a..000000000 --- a/builder/vsphere/go.sum +++ /dev/null @@ -1,468 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8= -cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= -contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1/go.mod h1:61apmbkVJH4kg+38ftT+/l0XxdUCVnHggqcOTqZRSEE= -github.com/Azure/azure-sdk-for-go v30.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290 h1:K9I21XUHNbYD3GNMmJBN0UKJCpdP+glftwNZ7Bo8kqY= -github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591/go.mod h1:EHGzQGbwozJBj/4qj3WGrTJ0FqjgOTOxLQ0VNWvPn08= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/Telmate/proxmox-api-go v0.0.0-20190614181158-26cd147831a4/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= -github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190418113227-25233c783f4e/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= -github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170113022742-e6dbea820a9f/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd h1:S3Fr6QnkpW9VRjiEY4psQHhhbbahASuNVj52YIce7lI= -github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= -github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607 h1:BFFG6KP8ASFBg2ptWsJn8p8RDufBjBDKIxLU7BTYGOM= -github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= -github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= -github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/approvals/go-approval-tests v0.0.0-20160714161514-ad96e53bea43/go.mod h1:S6puKjZ9ZeqUPBv2hEBnMZGcM2J6mOsDRQcmxkMAND0= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/aws/aws-sdk-go v1.16.24 h1:I/A3Hwbgs3IEAP6v1bFpHKXiT7wZDoToX9cb00nxZnM= -github.com/aws/aws-sdk-go v1.16.24/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3/go.mod h1:YOY5xnRf7Jz2SZCLSKgVfyqNzbRgyTznM3HyDqQMxcU= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= -github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= -github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc= -github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/creack/goselect v0.1.0/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/FHysWyE= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/digitalocean/godo v1.11.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= -github.com/dnaeon/go-vcr v1.0.0/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/docker/docker v0.0.0-20180422163414-57142e89befe/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI= -github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= -github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY= -github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gofrs/flock v0.7.1 h1:DP+LD/t0njgoPBvT5MJLeliUIVQR03hiKR6vezdwHlc= -github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3 h1:siORttZ36U2R/WjiJuDz8znElWBiAlO9rVt+mqJt0Cc= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= -github.com/gophercloud/gophercloud v0.0.0-20180903124057-ea7289ebdf06/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= -github.com/gophercloud/utils v0.0.0-20190124192022-a5c25e7a53a6/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170319172727-a91eba7f9777/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul v1.4.0 h1:PQTW4xCuAExEiSbhrsFsikzbW5gVBoi74BjUvYFyKHw= -github.com/hashicorp/consul v1.4.0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8= -github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4= -github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-getter v1.2.0 h1:E05bVPilzyh2yXgT6srn7WEkfMZaH+LuX9tDJw/4kaE= -github.com/hashicorp/go-getter v1.2.0/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= -github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79/go.mod h1:09jT3Y/OIsjTjQ2+3bkVNPDKqWcGIYYvjB2BEKVUdvc= -github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4= -github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 h1:VBj0QYQ0u2MCJzBfeYXGexnAl17GsH1yidnoxCqqD9E= -github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90/go.mod h1:o4zcYY1e0GEZI6eSEr+43QDYmuGglw1qSO6qdHUHCgg= -github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= -github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/packer v1.4.2 h1:4WE9HLrht/bNefy7GFR4eyLmd18caM5K4RCvVUxur40= -github.com/hashicorp/packer v1.4.2/go.mod h1:uesgTpUABDx76pwrYvB7sD2zBMxUvCYU04/hmz4pIi8= -github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/vault v1.1.0 h1:v79NUgO5xCZnXVzUkIqFOXtP8YhpnHAi1fk3eo9cuOE= -github.com/hashicorp/vault v1.1.0/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hetznercloud/hcloud-go v1.12.0/go.mod h1:g5pff0YNAZywQaivY/CmhUYFVp7oP0nu3MiODC2W4Hw= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775/go.mod h1:R9rU87RxxmcD3DkspW9JqGBXiJyg5MA+WNCtJrBtnXs= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/joyent/triton-go v0.0.0-20180116165742-545edbe0d564/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v0.0.0-20160131094358-f86d2e6d8a77/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/cpuid v0.0.0-20160106104451-349c67577817/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 h1:YUrU1/jxRqnt0PSrKj1Uj/wEjk/fjnE80QFfi2Zlj7Q= -github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8PwwdtnarXqLagOX0b/TbZx2zLMqEg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= -github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c h1:FMUOnVGy8nWk1cvlMCAoftRItQGMxI0vzJ3dQjeZTCE= -github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= -github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg= -github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/winrm v0.0.0-20180224160350-7e40f93ae939 h1:cRFHA33ER97Xy5jmjS519OXCS/yE3AT3zdbQAg0Z53g= -github.com/masterzen/winrm v0.0.0-20180224160350-7e40f93ae939/go.mod h1:CfZSN7zwz5gJiFhZJz49Uzk7mEBHIceWmbFmYx7Hf7E= -github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-tty v0.0.0-20190424173100-523744f04859/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.1 h1:DVkblRdiScEnEr0LR9nTnEQqHYycjkXW9bOjd+2EL2o= -github.com/miekg/dns v1.1.1/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7 h1:PXPMDtfqV+rZJshQHOiwUFqlqErXaAcuWy+/ZmyRfNc= -github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7/go.mod h1:g7SZj7ABpStq3tM4zqHiVEG5un/DZ1+qJJKO7qx1EvU= -github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= -github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc h1:5T6hzGUO5OrL6MdYXYoLQtRWJDDgjdlOVBn9mIqGY1g= -github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557/go.mod h1:QuAqW7/z+iv6aWFJdrA8kCbsF0OOJVKCICqTcYBexuY= -github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= -github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mna/pigeon v1.0.0/go.mod h1:Iym28+kJVnC1hfQvv5MUtI6AiFFzvQjHcvI4RFTG/04= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef/go.mod h1:LgKrp0Iss/BVwquptq4eIe6HPr0s3t1WHT5x0qOh14U= -github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215/go.mod h1:CxM/JGtpRrEPve5H04IhxJrGhxgwxMc6jSP2T4YD60w= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= -github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a h1:A3QMuteviunoaY/8ex+RKFqwhcZJ/Cf3fCW3IwL2wx4= -github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca h1:k8gsErq3rkcbAyCnpOycQsbw88NjCHk7L3KfBZKhQDQ= -github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible/go.mod h1:T3/WrziK7fYH3C8ilAFAHe99R452/IzIG3YYkqaOFeQ= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17/go.mod h1:SAEjPB4voP88qmWJXI7mA5m15uNlEnuHLx4Eu2mPGpQ= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/rwtodd/Go.Sed v0.0.0-20170507045331-d6d5d585814e h1:lN+IKs+Jb9uwDOMO4VJZzH9vOjjist0THR5s9akp+Ss= -github.com/rwtodd/Go.Sed v0.0.0-20170507045331-d6d5d585814e/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 h1:7YvPJVmEeFHR1Tj9sZEYsmarJEQfMVYpd/Vyy/A8dqE= -github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70/go.mod h1:XjlXWPd6VONhsRSEuzGkV8mzRpH7ou1cdLV7IKJk96s= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= -github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 h1:U6ufy3mLDgg9RYupntOvAF7xCmNNquyKaYaaVHo1Nnk= -github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= -github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/vmware/govmomi v0.20.0 h1:+1IyhvoVb5JET2Wvgw9J3ZDv6CK4sxzUunpH8LhQqm4= -github.com/vmware/govmomi v0.20.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/xanzy/go-cloudstack v0.0.0-20190526095453-42f262b63ed0/go.mod h1:sBh287mCRwCz6zyXHMmw7sSZGPohVpnx+o+OY4M+i3A= -github.com/yandex-cloud/go-genproto v0.0.0-20190401174212-1db0ef3dce9b/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE= -github.com/yandex-cloud/go-sdk v0.0.0-20190402114215-3fc1d6947035/go.mod h1:Eml0jFLU4VVHgIN8zPHMuNwZXVzUMILyO6lQZSfz854= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16 h1:ucZ8P+3HTFz4/kqeQ9Mg0j8F/oHbcaWfKLWiBo3QLKk= -go.uber.org/goleak v0.10.1-0.20190517053103-3b0196519f16/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d h1:adrbvkTDn9rGnXg2IJDKozEpXXLZN89pdIA+Syt4/u0= -golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88 h1:H6DkDrMSuEE2MQR7DgGwkzbXSY1lvMpEN5MDE1bo/5U= -golang.org/x/mobile v0.0.0-20190607214518-6fa95d984e88/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 h1:FP8hkuE6yUEaJnK7O2eTuejKWwW+Rhfj80dQ2JcKxCU= -golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190425145619-16072639606e h1:4ktJgTV34+N3qOZUc5fAaG3Pb11qzMm3PkAoTAgUZ2I= -golang.org/x/sys v0.0.0-20190425145619-16072639606e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1 h1:nsUiJHvm6yOoRozW9Tz0siNk9sHieLzR+w814Ihse3A= -golang.org/x/text v0.3.1/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190530184349-ce1a3806b557/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/api v0.4.0 h1:KKgc1aqhV8wDPbDzlDtpvyjZFY3vjz85FP7p4wcQUyI= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= -gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/h2non/gock.v1 v1.0.12/go.mod h1:KHI4Z1sxDW6P4N3DfTWSEza07YpkQP7KJBfglRMEjKY= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516/go.mod h1:d3R+NllX3X5e0zlG1Rful3uLvsGC/Q3OHut5464DEQw= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/builder/vsphere/gofmt.sh b/builder/vsphere/gofmt.sh deleted file mode 100755 index 69f4b43af..000000000 --- a/builder/vsphere/gofmt.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -RETVAL=0 - -for file in $(find . -name '*.go' -not -path './build/*') -do - if [ -n "$(gofmt -l $file)" ] - then - echo "$file does not conform to gofmt rules. Run: gofmt -s -w $file" >&2 - RETVAL=1 - fi -done - -exit $RETVAL diff --git a/builder/vsphere/iso/builder.go b/builder/vsphere/iso/builder.go index ccd3e8ecb..21e367b37 100644 --- a/builder/vsphere/iso/builder.go +++ b/builder/vsphere/iso/builder.go @@ -2,12 +2,12 @@ package iso import ( "context" + "github.com/hashicorp/packer/builder/vsphere/common" + "github.com/hashicorp/packer/builder/vsphere/driver" packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type Builder struct { diff --git a/builder/vsphere/iso/builder_acc_test.go b/builder/vsphere/iso/builder_acc_test.go index c67236170..0857d53ec 100644 --- a/builder/vsphere/iso/builder_acc_test.go +++ b/builder/vsphere/iso/builder_acc_test.go @@ -2,9 +2,9 @@ package iso import ( "fmt" + commonT "github.com/hashicorp/packer/builder/vsphere/common/testing" builderT "github.com/hashicorp/packer/helper/builder/testing" "github.com/hashicorp/packer/packer" - commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" "github.com/vmware/govmomi/vim25/types" "io/ioutil" "os" diff --git a/builder/vsphere/iso/config.go b/builder/vsphere/iso/config.go index a6ba2953b..732c0ca36 100644 --- a/builder/vsphere/iso/config.go +++ b/builder/vsphere/iso/config.go @@ -1,12 +1,13 @@ package iso import ( + "github.com/hashicorp/packer/builder/vsphere/common" packerCommon "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/common/bootcommand" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "github.com/jetbrains-infra/packer-builder-vsphere/common" ) type Config struct { @@ -21,12 +22,12 @@ type Config struct { packerCommon.ISOConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - BootConfig `mapstructure:",squash"` - common.WaitIpConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + bootcommand.BootConfig `mapstructure:",squash"` + common.WaitIpConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` diff --git a/builder/vsphere/iso/step_add_cdrom.go b/builder/vsphere/iso/step_add_cdrom.go index b329d02dd..6838e5209 100644 --- a/builder/vsphere/iso/step_add_cdrom.go +++ b/builder/vsphere/iso/step_add_cdrom.go @@ -1,16 +1,22 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type CDRomConfig + package iso import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type CDRomConfig struct { - CdromType string `mapstructure:"cdrom_type"` - ISOPaths []string `mapstructure:"iso_paths"` + // Which controller to use. Example: `sata`. Defaults to `ide`. + CdromType string `mapstructure:"cdrom_type"` + // List of datastore paths to ISO files that will be mounted to the VM. + // Example: `"[datastore1] ISO/ubuntu.iso"`. + ISOPaths []string `mapstructure:"iso_paths"` } type StepAddCDRom struct { diff --git a/builder/vsphere/iso/step_add_cdrom.hcl2spec.go b/builder/vsphere/iso/step_add_cdrom.hcl2spec.go new file mode 100644 index 000000000..6ec436e58 --- /dev/null +++ b/builder/vsphere/iso/step_add_cdrom.hcl2spec.go @@ -0,0 +1,32 @@ +// Code generated by "mapstructure-to-hcl2 -type CDRomConfig"; DO NOT EDIT. +package iso + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatCDRomConfig is an auto-generated flat version of CDRomConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatCDRomConfig struct { + CdromType *string `mapstructure:"cdrom_type" cty:"cdrom_type"` + ISOPaths []string `mapstructure:"iso_paths" cty:"iso_paths"` +} + +// FlatMapstructure returns a new FlatCDRomConfig. +// FlatCDRomConfig is an auto-generated flat version of CDRomConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*CDRomConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatCDRomConfig) +} + +// HCL2Spec returns the hcl spec of a CDRomConfig. +// This spec is used by HCL to read the fields of CDRomConfig. +// The decoded values from this spec will then be applied to a FlatCDRomConfig. +func (*FlatCDRomConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "cdrom_type": &hcldec.AttrSpec{Name: "cdrom_type", Type: cty.String, Required: false}, + "iso_paths": &hcldec.AttrSpec{Name: "iso_paths", Type: cty.List(cty.String), Required: false}, + } + return s +} diff --git a/builder/vsphere/iso/step_add_floppy.go b/builder/vsphere/iso/step_add_floppy.go index deca0e6b0..51e987a63 100644 --- a/builder/vsphere/iso/step_add_floppy.go +++ b/builder/vsphere/iso/step_add_floppy.go @@ -1,16 +1,24 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type FloppyConfig + package iso import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type FloppyConfig struct { - FloppyIMGPath string `mapstructure:"floppy_img_path"` - FloppyFiles []string `mapstructure:"floppy_files"` + // Datastore path to a floppy image that will be mounted to the VM. + // Example: `[datastore1] ISO/pvscsi-Windows8.flp`. + FloppyIMGPath string `mapstructure:"floppy_img_path"` + // List of local files to be mounted to the VM floppy drive. Can be used to + // make Debian preseed or RHEL kickstart files available to the VM. + FloppyFiles []string `mapstructure:"floppy_files"` + // List of directories to copy files from. FloppyDirectories []string `mapstructure:"floppy_dirs"` } diff --git a/builder/vsphere/iso/step_add_floppy.hcl2spec.go b/builder/vsphere/iso/step_add_floppy.hcl2spec.go new file mode 100644 index 000000000..4bd09a9ad --- /dev/null +++ b/builder/vsphere/iso/step_add_floppy.hcl2spec.go @@ -0,0 +1,34 @@ +// Code generated by "mapstructure-to-hcl2 -type FloppyConfig"; DO NOT EDIT. +package iso + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatFloppyConfig is an auto-generated flat version of FloppyConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatFloppyConfig struct { + FloppyIMGPath *string `mapstructure:"floppy_img_path" cty:"floppy_img_path"` + FloppyFiles []string `mapstructure:"floppy_files" cty:"floppy_files"` + FloppyDirectories []string `mapstructure:"floppy_dirs" cty:"floppy_dirs"` +} + +// FlatMapstructure returns a new FlatFloppyConfig. +// FlatFloppyConfig is an auto-generated flat version of FloppyConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*FloppyConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatFloppyConfig) +} + +// HCL2Spec returns the hcl spec of a FloppyConfig. +// This spec is used by HCL to read the fields of FloppyConfig. +// The decoded values from this spec will then be applied to a FlatFloppyConfig. +func (*FlatFloppyConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "floppy_img_path": &hcldec.AttrSpec{Name: "floppy_img_path", Type: cty.String, Required: false}, + "floppy_files": &hcldec.AttrSpec{Name: "floppy_files", Type: cty.List(cty.String), Required: false}, + "floppy_dirs": &hcldec.AttrSpec{Name: "floppy_dirs", Type: cty.List(cty.String), Required: false}, + } + return s +} diff --git a/builder/vsphere/iso/step_boot_command.go b/builder/vsphere/iso/step_boot_command.go index 462806247..cb1154fbd 100644 --- a/builder/vsphere/iso/step_boot_command.go +++ b/builder/vsphere/iso/step_boot_command.go @@ -3,11 +3,11 @@ package iso import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" packerCommon "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "golang.org/x/mobile/event/key" "log" "net" diff --git a/builder/vsphere/iso/step_create.go b/builder/vsphere/iso/step_create.go index 627f24d45..41eca92c8 100644 --- a/builder/vsphere/iso/step_create.go +++ b/builder/vsphere/iso/step_create.go @@ -1,27 +1,42 @@ +//go:generate struct-markdown +//go:generate mapstructure-to-hcl2 -type CreateConfig + package iso import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/common" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/common" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type CreateConfig struct { - Version uint `mapstructure:"vm_version"` + // Set VM hardware version. Defaults to the most current VM hardware + // version supported by vCenter. See + // [VMWare article 1003746](https://kb.vmware.com/s/article/1003746) for + // the full list of supported VM hardware versions. + Version uint `mapstructure:"vm_version"` + // Set VM OS type. Defaults to `otherGuest`. See [ + // here](https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.GuestOsDescriptor.GuestOsIdentifier.html) + // for a full list of possible values. GuestOSType string `mapstructure:"guest_os_type"` - Firmware string `mapstructure:"firmware"` - - DiskControllerType string `mapstructure:"disk_controller_type"` - DiskSize int64 `mapstructure:"disk_size"` - DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` - - Network string `mapstructure:"network"` - NetworkCard string `mapstructure:"network_card"` - USBController bool `mapstructure:"usb_controller"` + // Set the Firmware at machine creation. Example `efi`. Defaults to `bios`. + Firmware string `mapstructure:"firmware"` + // Set VM disk controller type. Example `pvscsi`. + DiskControllerType string `mapstructure:"disk_controller_type"` + // The size of the disk in MB. + DiskSize int64 `mapstructure:"disk_size"` + // Enable VMDK thin provisioning for VM. Defaults to `false`. + DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` + Network string `mapstructure:"network"` + // Set VM network card type. Example `vmxnet3`. + NetworkCard string `mapstructure:"network_card"` + // Create USB controller for virtual machine. Defaults to `false`. + USBController bool `mapstructure:"usb_controller"` + // VM notes. Notes string `mapstructure:"notes"` } diff --git a/builder/vsphere/iso/step_create.hcl2spec.go b/builder/vsphere/iso/step_create.hcl2spec.go new file mode 100644 index 000000000..a9f4342f9 --- /dev/null +++ b/builder/vsphere/iso/step_create.hcl2spec.go @@ -0,0 +1,48 @@ +// Code generated by "mapstructure-to-hcl2 -type CreateConfig"; DO NOT EDIT. +package iso + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatCreateConfig is an auto-generated flat version of CreateConfig. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatCreateConfig struct { + Version *uint `mapstructure:"vm_version" cty:"vm_version"` + GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type"` + Firmware *string `mapstructure:"firmware" cty:"firmware"` + DiskControllerType *string `mapstructure:"disk_controller_type" cty:"disk_controller_type"` + DiskSize *int64 `mapstructure:"disk_size" cty:"disk_size"` + DiskThinProvisioned *bool `mapstructure:"disk_thin_provisioned" cty:"disk_thin_provisioned"` + Network *string `mapstructure:"network" cty:"network"` + NetworkCard *string `mapstructure:"network_card" cty:"network_card"` + USBController *bool `mapstructure:"usb_controller" cty:"usb_controller"` + Notes *string `mapstructure:"notes" cty:"notes"` +} + +// FlatMapstructure returns a new FlatCreateConfig. +// FlatCreateConfig is an auto-generated flat version of CreateConfig. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*CreateConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatCreateConfig) +} + +// HCL2Spec returns the hcl spec of a CreateConfig. +// This spec is used by HCL to read the fields of CreateConfig. +// The decoded values from this spec will then be applied to a FlatCreateConfig. +func (*FlatCreateConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false}, + "guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false}, + "firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false}, + "disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.String, Required: false}, + "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, + "disk_thin_provisioned": &hcldec.AttrSpec{Name: "disk_thin_provisioned", Type: cty.Bool, Required: false}, + "network": &hcldec.AttrSpec{Name: "network", Type: cty.String, Required: false}, + "network_card": &hcldec.AttrSpec{Name: "network_card", Type: cty.String, Required: false}, + "usb_controller": &hcldec.AttrSpec{Name: "usb_controller", Type: cty.Bool, Required: false}, + "notes": &hcldec.AttrSpec{Name: "notes", Type: cty.String, Required: false}, + } + return s +} diff --git a/builder/vsphere/iso/step_remote_upload.go b/builder/vsphere/iso/step_remote_upload.go index ea57d4b8b..398a25b11 100644 --- a/builder/vsphere/iso/step_remote_upload.go +++ b/builder/vsphere/iso/step_remote_upload.go @@ -3,9 +3,9 @@ package iso import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "path/filepath" ) diff --git a/builder/vsphere/iso/step_remove_cdrom.go b/builder/vsphere/iso/step_remove_cdrom.go index f9836854a..bd2e560cd 100644 --- a/builder/vsphere/iso/step_remove_cdrom.go +++ b/builder/vsphere/iso/step_remove_cdrom.go @@ -2,9 +2,9 @@ package iso import ( "context" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" ) type StepRemoveCDRom struct{} diff --git a/builder/vsphere/iso/step_remove_floppy.go b/builder/vsphere/iso/step_remove_floppy.go index af5d64846..3844b8063 100644 --- a/builder/vsphere/iso/step_remove_floppy.go +++ b/builder/vsphere/iso/step_remove_floppy.go @@ -2,9 +2,9 @@ package iso import ( "context" + "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" - "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/vmware/govmomi/vim25/types" ) diff --git a/builder/vsphere/teamcity-services.yml b/builder/vsphere/teamcity-services.yml deleted file mode 100644 index eb7033146..000000000 --- a/builder/vsphere/teamcity-services.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: '2' -services: - vpn: - container_name: vpn - image: jetbrainsinfra/openvpn - volumes: - - ./test:/vpn:ro - cap_add: - - NET_ADMIN - devices: - - /dev/net/tun:/dev/net/tun - dns: 10.0.0.1 - environment: - - VPN_PASSWORD - entrypoint: "sh -c 'echo $$VPN_PASSWORD | openvpn --cd /vpn/ --config lab.ovpn --askpass /dev/stdin'" diff --git a/command/plugin.go b/command/plugin.go index 619a162bf..9f6ee7b1b 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -59,6 +59,8 @@ import ( virtualboxvmbuilder "github.com/hashicorp/packer/builder/virtualbox/vm" vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso" vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx" + vsphereclonebuilder "github.com/hashicorp/packer/builder/vsphere/clone" + vsphereisobuilder "github.com/hashicorp/packer/builder/vsphere/iso" yandexbuilder "github.com/hashicorp/packer/builder/yandex" alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import" amazonimportpostprocessor "github.com/hashicorp/packer/post-processor/amazon-import" @@ -150,6 +152,8 @@ var Builders = map[string]packer.Builder{ "virtualbox-vm": new(virtualboxvmbuilder.Builder), "vmware-iso": new(vmwareisobuilder.Builder), "vmware-vmx": new(vmwarevmxbuilder.Builder), + "vsphere-clone": new(vsphereclonebuilder.Builder), + "vsphere-iso": new(vsphereisobuilder.Builder), "yandex": new(yandexbuilder.Builder), } diff --git a/go.mod b/go.mod index 299a7f14d..7faf02788 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( cloud.google.com/go/pubsub v1.1.0 // indirect cloud.google.com/go/storage v1.4.0 // indirect contrib.go.opencensus.io/exporter/ocagent v0.5.0 // indirect - dmitri.shuralyov.com/gpu/mtl v0.0.0-20191203043605-d42048ed14fd // indirect github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1 github.com/Azure/azure-sdk-for-go v30.0.0+incompatible github.com/Azure/go-autorest v12.0.0+incompatible @@ -34,7 +33,6 @@ require ( github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect github.com/creack/goselect v0.1.0 // indirect - github.com/creack/pty v1.1.9 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/digitalocean/go-libvirt v0.0.0-20190626172931-4d226dd6c437 // indirect github.com/digitalocean/go-qemu v0.0.0-20181112162955-dd7bb9c771b8 @@ -45,7 +43,6 @@ require ( github.com/dustin/go-humanize v1.0.0 // indirect github.com/dylanmei/iso8601 v0.1.0 // indirect github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 - github.com/envoyproxy/go-control-plane v0.9.1 // indirect github.com/exoscale/egoscale v0.18.1 github.com/fatih/camelcase v1.0.0 github.com/fatih/structtag v1.0.0 @@ -59,7 +56,6 @@ require ( github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect github.com/google/go-cmp v0.3.1 github.com/google/go-querystring v1.0.0 // indirect - github.com/google/pprof v0.0.0-20191105193234-27840fff0d09 // indirect github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 github.com/google/uuid v1.0.0 github.com/gophercloud/gophercloud v0.2.0 @@ -81,7 +77,6 @@ require ( github.com/hashicorp/golang-lru v0.5.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl/v2 v2.0.0 - github.com/hashicorp/hcl2 v0.0.0-20191002203319-fb75b3253c80 // indirect github.com/hashicorp/serf v0.8.2 // indirect github.com/hashicorp/vault v1.1.0 github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d @@ -100,7 +95,6 @@ require ( github.com/klauspost/crc32 v0.0.0-20160114101742-999f3125931f // indirect github.com/klauspost/pgzip v0.0.0-20151221113845-47f36e165cec github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169 // indirect - github.com/kr/pty v1.1.8 // indirect github.com/linode/linodego v0.7.1 github.com/masterzen/azure-sdk-for-go v0.0.0-20161014135628-ee4f0065d00c // indirect github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect @@ -112,7 +106,6 @@ require ( github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7 github.com/mitchellh/go-homedir v1.0.0 github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed - github.com/mitchellh/gox v1.0.1 // indirect github.com/mitchellh/iochan v1.0.0 github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557 @@ -125,6 +118,8 @@ require ( github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 // indirect github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b + github.com/onsi/ginkgo v1.7.0 // indirect + github.com/onsi/gomega v1.4.3 // indirect github.com/oracle/oci-go-sdk v1.8.0 github.com/outscale/osc-go v0.0.1 github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a @@ -133,9 +128,7 @@ require ( github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca github.com/posener/complete v1.1.1 github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible - github.com/prometheus/client_model v0.0.0-20191202183732-d1d2010b5bee // indirect github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17 // indirect - github.com/rogpeppe/go-internal v1.5.0 // indirect github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 // indirect github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect github.com/satori/go.uuid v1.2.0 // indirect @@ -158,18 +151,17 @@ require ( github.com/yandex-cloud/go-sdk v0.0.0-20190916101744-c781afa45829 github.com/zclconf/go-cty v1.1.2-0.20191126233707-f0f7fd24c4af go.opencensus.io v0.22.2 // indirect + go.uber.org/goleak v1.0.0 golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e golang.org/x/exp v0.0.0-20191129062945-2f5052295587 // indirect - golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect - golang.org/x/mobile v0.0.0-20191130191448-5c0e7e404af8 // indirect + golang.org/x/mobile v0.0.0-20191130191448-5c0e7e404af8 golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect golang.org/x/tools v0.0.0-20191203051722-db047d72ee39 - golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect google.golang.org/api v0.14.0 google.golang.org/appengine v1.6.5 // indirect google.golang.org/genproto v0.0.0-20191115221424-83cc0476cb11 // indirect diff --git a/go.sum b/go.sum index f6676f405..018566778 100644 --- a/go.sum +++ b/go.sum @@ -9,9 +9,12 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg cloud.google.com/go v0.49.0 h1:CH+lkubJzcPYB1Ggupcq0+k8Ni2ILdG2lYjDIgavDBQ= cloud.google.com/go v0.49.0/go.mod h1:hGvAdzcWNbyuxS3nWhD7H2cIJxjRRTRLQVB0bdputVY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0 h1:sAbMqjY1PEQKZBWfbu6Y6bsupJ9c4QdHnzg/VvYTLcE= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0 h1:9/vpR43S4aJaROxqQHQ3nH9lfyKKV0dC3vOmnw8ebQQ= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.4.0 h1:KDdqY5VTXBTqpSbctVTt0mVvfanP6JZzNzLE0qNY100= @@ -19,15 +22,12 @@ cloud.google.com/go/storage v1.4.0/go.mod h1:ZusYJWlOshgSBGbt6K3GnB3MT3H1xs2id9+ contrib.go.opencensus.io/exporter/ocagent v0.5.0 h1:TKXjQSRS0/cCDrP7KvkgU6SmILtF/yV2TOs/02K/WZQ= contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20191203043605-d42048ed14fd/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1 h1:RMTyvS5bjvSWiUcfqfr/E2pxHEMrALvU+E12n6biymg= github.com/1and1/oneandone-cloudserver-sdk-go v1.0.1/go.mod h1:61apmbkVJH4kg+38ftT+/l0XxdUCVnHggqcOTqZRSEE= github.com/Azure/azure-sdk-for-go v30.0.0+incompatible h1:6o1Yzl7wTBYg+xw0pY4qnalaPmEQolubEEdepo1/kmI= github.com/Azure/azure-sdk-for-go v30.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v12.0.0+incompatible h1:N+VqClcomLGD/sHb3smbSYYtNMgKpVV3Cd5r5i8z6bQ= github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/Azure/go-ntlmssp v0.0.0-20191115201650-bad6df29494a h1:3FwiePtHk5YJrooV799oo5jIfsgRdES25VdngJM03dU= github.com/Azure/go-ntlmssp v0.0.0-20191115201650-bad6df29494a/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -41,8 +41,6 @@ github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/Telmate/proxmox-api-go v0.0.0-20190815172943-ef9222844e60 h1:iEmbIRk4brAP3wevhCr5MGAqxHUbbIDHvE+6D1/7pRA= -github.com/Telmate/proxmox-api-go v0.0.0-20190815172943-ef9222844e60/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= github.com/Telmate/proxmox-api-go v0.0.0-20191015171801-b0c2796b9fcf h1:rVT2xsBm03Jp0r0yfGm5AMlqp0mZmxTTiNnSrc9S+Hs= github.com/Telmate/proxmox-api-go v0.0.0-20191015171801-b0c2796b9fcf/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= @@ -63,10 +61,9 @@ github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd h1:S3Fr6QnkpW9VRjiEY github.com/antchfx/xpath v0.0.0-20170728053731-b5c552e1acbd/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607 h1:BFFG6KP8ASFBg2ptWsJn8p8RDufBjBDKIxLU7BTYGOM= github.com/antchfx/xquery v0.0.0-20170730121040-eb8c3c172607/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= -github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6 h1:uZuxRZCz65cG1o6K/xUqImNcYKtmk9ylqaH0itMSvzA= -github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= @@ -90,7 +87,6 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3 h1:3b+p838vN4sc37brz9W2HDphtSwZFcXZwFLyzm5Vk28= github.com/biogo/hts v0.0.0-20160420073057-50da7d4131a3/go.mod h1:YOY5xnRf7Jz2SZCLSKgVfyqNzbRgyTznM3HyDqQMxcU= -github.com/bsm/go-vlq v0.0.0-20150828105119-ec6e8d4f5f4e/go.mod h1:N+BjUcTjSxc2mtRGSCPsat1kze3CUtvJN3/jTXlp29k= github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae h1:2Zmk+8cNvAGuY8AyvZuWpUdpQUAXwfom4ReVMe/CTIo= github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXGM30YZL1WW/M337pXml+GrcZ4= @@ -108,8 +104,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/creack/goselect v0.1.0 h1:4QiXIhcpSQF50XGaBsFzesjwX/1qOY5bOveQPmN9CXY= github.com/creack/goselect v0.1.0/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/FHysWyE= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -134,7 +128,6 @@ github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCf github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY= github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1/go.mod h1:G1fbsNGAFpC1aaERrShZQVdUV2ZuZuv6FCl2v9JNSxQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/exoscale/egoscale v0.18.1 h1:1FNZVk8jHUx0AvWhOZxLEDNlacTU0chMXUUNkm9EZaI= github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= @@ -149,12 +142,12 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.25.4 h1:Mujh4R/dH6YL8bxuISne3xX2+qcQ9p0IxKAP6ExWoUo= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= @@ -200,7 +193,6 @@ github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPg github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191105193234-27840fff0d09/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 h1:JM174NTeGNJ2m/oLH3UOWOvWQQKd+BoL3hcSCUWFLt0= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= @@ -223,7 +215,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.8.5 h1:2+KSC78XiO6Qy0hIjfc1OD9H+hsaJdJ github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/consul v1.4.0 h1:PQTW4xCuAExEiSbhrsFsikzbW5gVBoi74BjUvYFyKHw= github.com/hashicorp/consul v1.4.0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= -github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8= @@ -236,7 +227,6 @@ github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxB github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v0.0.0-20180717150148-3d5d8f294aa0/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79 h1:RKu7yAXZTaQsxj1K9GDsh+QVw0+Wu1SWHxtbFN0n+hE= @@ -253,7 +243,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= @@ -269,8 +258,6 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl/v2 v2.0.0 h1:efQznTz+ydmQXq3BOnRa3AXzvCeTq1P4dKj/z5GLlY8= github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= -github.com/hashicorp/hcl2 v0.0.0-20191002203319-fb75b3253c80 h1:PFfGModn55JA0oBsvFghhj0v93me+Ctr3uHC/UmFAls= -github.com/hashicorp/hcl2 v0.0.0-20191002203319-fb75b3253c80/go.mod h1:Cxv+IJLuBiEhQ7pBYGEuORa0nr4U994pE8mYLuFd7v0= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= @@ -285,17 +272,12 @@ github.com/hetznercloud/hcloud-go v1.15.1 h1:G8Q+xyAqQ5IUY7yq4HKZgkabFa0S/VXJXq3 github.com/hetznercloud/hcloud-go v1.15.1/go.mod h1:8lR3yHBHZWy2uGcUi9Ibt4UOoop2wrVdERJgCtxsF3Q= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775 h1:MIteIoIQ5nFoOmwEHPDsqng8d0dtKj3lCnQCwGvtxXc= -github.com/hyperonecom/h1-client-go v0.0.0-20190122232013-cf38e8387775/go.mod h1:R9rU87RxxmcD3DkspW9JqGBXiJyg5MA+WNCtJrBtnXs= -github.com/hyperonecom/h1-client-go v0.0.0-20190913175216-d19ba8b5e876 h1:7GEvE+OUG2Vhl/fgSns4Wg2kTUJtDyhcS57ZSVpjB1Q= -github.com/hyperonecom/h1-client-go v0.0.0-20190913175216-d19ba8b5e876/go.mod h1:BwyQSLvalkGOjxkAgoWgTocPoN+ZDUodCruMhtIrwQs= github.com/hyperonecom/h1-client-go v0.0.0-20191203060043-b46280e4c4a4 h1:mSmyzhwBeQt2TlHbsXYLona9pwjWAvYGwQJ2Cq/k3VE= github.com/hyperonecom/h1-client-go v0.0.0-20191203060043-b46280e4c4a4/go.mod h1:yNUVHSleURKSaYUKq4Wx0i/vjCen2aq7CvPyHd/Vj2Q= github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961 h1:a2/K4HRhg31A5vafiz5yYiGMjaCxwRpyjJStfVquKds= github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961/go.mod h1:UrKjuULIWLjHFlG6aSPunArE5QX57LftMmStAZJBEX8= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -329,7 +311,6 @@ github.com/kr/fs v0.0.0-20131111012553-2788f0dbd169/go.mod h1:glhvuHOU9Hy7/8Pwwd github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= @@ -351,8 +332,6 @@ github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW1 github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-tty v0.0.0-20190424173100-523744f04859 h1:smQbSzmT3EHl4EUwtFwFGmGIpiYgIiiPeVv1uguIQEE= -github.com/mattn/go-tty v0.0.0-20190424173100-523744f04859/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/mattn/go-tty v0.0.0-20191112051231-74040eebce08 h1:8YAWbq7rJqfbc6IaAvA2eCQuOQvf6Bs4vHKcOyWw//E= github.com/mattn/go-tty v0.0.0-20191112051231-74040eebce08/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -371,8 +350,6 @@ github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaC github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= -github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -427,12 +404,10 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible h1:ZoVHH6voxW9Onzo6z2yLtocVoN6mBocyDoqoyAMHokE= github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible/go.mod h1:T3/WrziK7fYH3C8ilAFAHe99R452/IzIG3YYkqaOFeQ= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20191202183732-d1d2010b5bee/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17 h1:4qPms2txLWMLXKzqlnYSulKRS4cS9aYgPtAEpUelQok= github.com/renstrom/fuzzysearch v0.0.0-20160331204855-2d205ac6ec17/go.mod h1:SAEjPB4voP88qmWJXI7mA5m15uNlEnuHLx4Eu2mPGpQ= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.5.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 h1:7YvPJVmEeFHR1Tj9sZEYsmarJEQfMVYpd/Vyy/A8dqE= github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= @@ -444,6 +419,7 @@ github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70 h1:DaqC32ZwO github.com/scaleway/scaleway-cli v0.0.0-20180921094345-7b12c9699d70/go.mod h1:XjlXWPd6VONhsRSEuzGkV8mzRpH7ou1cdLV7IKJk96s= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM= github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= @@ -461,6 +437,7 @@ github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -472,8 +449,6 @@ github.com/temoto/robotstxt v1.1.1 h1:Gh8RCs8ouX3hRSxxK7B1mO5RFByQ4CmJZDwgom++Ja github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= github.com/tencentcloud/tencentcloud-sdk-go v3.0.97+incompatible h1:y2gZtLpcWqFzSFbQSKwv1gL+NocPRM0ktGh7Dlb8U7s= github.com/tencentcloud/tencentcloud-sdk-go v3.0.97+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= -github.com/ucloud/ucloud-sdk-go v0.8.7 h1:BmXOb5RivI0Uu4oZRpjI6SQ9/y7n/H9wxTGR1txIE8o= -github.com/ucloud/ucloud-sdk-go v0.8.7/go.mod h1:lM6fpI8y6iwACtlbHUav823/uKPdXsNBlnBpRF2fj3c= github.com/ucloud/ucloud-sdk-go v0.12.0 h1:VCFN3jWg/G4wvwjG6qG5AhFuAT1JdmGvY6+4WHbuJcw= github.com/ucloud/ucloud-sdk-go v0.12.0/go.mod h1:lM6fpI8y6iwACtlbHUav823/uKPdXsNBlnBpRF2fj3c= github.com/ufilesdk-dev/ufile-gosdk v0.0.0-20190830075812-b4dbc4ef43a6 h1:FAWNiqocJ04wC4Znj7Ax4PGWstZijayO6ifuHHvb+vI= @@ -492,11 +467,8 @@ github.com/yandex-cloud/go-genproto v0.0.0-20190916101622-7617782d381e h1:hzwq5G github.com/yandex-cloud/go-genproto v0.0.0-20190916101622-7617782d381e/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE= github.com/yandex-cloud/go-sdk v0.0.0-20190916101744-c781afa45829 h1:2FGwbx03GpP1Ulzg/L46tSoKh9t4yg8BhMKQl/Ff1x8= github.com/yandex-cloud/go-sdk v0.0.0-20190916101744-c781afa45829/go.mod h1:Eml0jFLU4VVHgIN8zPHMuNwZXVzUMILyO6lQZSfz854= -github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.1.1 h1:Shl2p9Dat0cqJfXu0DZa+cOTRPhXQjK8IYWD6GVfiqo= -github.com/zclconf/go-cty v1.1.1/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.2-0.20191126233707-f0f7fd24c4af h1:4arg31xOP/qIUV1YVbCWJtChPGzwGzgmlucVbddUq+Y= github.com/zclconf/go-cty v1.1.2-0.20191126233707-f0f7fd24c4af/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= @@ -506,6 +478,8 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= +go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -518,8 +492,6 @@ golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708 h1:pXVtWnwHkrWD9ru3sDxY/qFK/bfc0egRovX91EjWjf4= -golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e h1:egKlR8l7Nu9vHGWbcUV8lqR4987UfUbBd7GbhqGzNYU= golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -532,7 +504,6 @@ golang.org/x/exp v0.0.0-20191129062945-2f5052295587 h1:5Uz0rkjCFu9BC9gCRN7EkwVvh golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -544,6 +515,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNT golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mobile v0.0.0-20191130191448-5c0e7e404af8 h1:9w7mvrikkrG9zFfEJfuFe08FVKrg8Yi0ePhOdGAKpUw= golang.org/x/mobile v0.0.0-20191130191448-5c0e7e404af8/go.mod h1:p895TfNkDgPEmEQrNiOtIl3j98d/tGU95djDj7NfyjQ= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= @@ -564,7 +536,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJV golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= @@ -609,8 +580,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191110163157-d32e6e3b99c4 h1:Hynbrlo6LbYI3H1IqXpkVDOcX/3HiPdhVEuyj5a59RM= -golang.org/x/sys v0.0.0-20191110163157-d32e6e3b99c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 h1:ZBzSG/7F4eNKz2L3GE9o300RX0Az1Bw5HF7PDraD+qU= golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= @@ -644,13 +613,13 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190909214602-067311248421/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191203051722-db047d72ee39 h1:zARK4PTmTfx1BC6iKP21qIRjz0nFzFj4ZAlbUy6Q6pM= golang.org/x/tools v0.0.0-20191203051722-db047d72ee39/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0 h1:KKgc1aqhV8wDPbDzlDtpvyjZFY3vjz85FP7p4wcQUyI= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -694,6 +663,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= @@ -720,7 +690,6 @@ gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/website/source/docs/builders/vmware.html.md b/website/source/docs/builders/vmware.html.md index 213400f2c..ca3fe6508 100644 --- a/website/source/docs/builders/vmware.html.md +++ b/website/source/docs/builders/vmware.html.md @@ -27,3 +27,14 @@ the following VMware builders: an existing VMware VM you want to use as the source. As an additional benefit, you can feed the artifact of this builder back into Packer to iterate on a machine. + +- [vsphere-iso](/docs/builders/vsphere-iso.html) - This builder starts from an + ISO file, but utilizes the vSphere API rather than the esxcli to build on a + remote esx instance. This allows you to build vms even if you do not have + SSH access to your vSphere cluster. + +- [vsphere-clone](/docs/builders/vsphere-clone.html) - This builder clones a + vm from an existing template, then modifies it and saves it as a new + template. It uses the vSphere API rather than the esxcli to build on a + remote esx instance. This allows you to build vms even if you do not have + SSH access to your vSphere cluster. \ No newline at end of file diff --git a/website/source/docs/builders/vsphere-clone.html.md.erb b/website/source/docs/builders/vsphere-clone.html.md.erb new file mode 100644 index 000000000..e7fc56cc2 --- /dev/null +++ b/website/source/docs/builders/vsphere-clone.html.md.erb @@ -0,0 +1,150 @@ +--- +modeline: | + vim: set ft=pandoc: +description: | + This VMware Packer builder uses the vSphere API to clone an existing vSphere template and create a new virtual machine remotely. +layout: docs +page_title: 'VSphere Clone - Builders' +sidebar_current: 'docs-builders-vsphere-clone' +--- + +# VMWare Vsphere Clone Builder + +Type: `vsphere-clone` + +This builder clones VMs from existing templates. + +- VMware Player is not required. +- It uses the official vCenter API, and does not require ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) + + +## Examples + +See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/hashicorp/packer/tree/master/builder/vsphere/examples/). + +## VSphere-Clone Configuration Reference + +There are many configuration options available for this builder. In addition to +the items listed here, you will want to look at the general configuration +references for [ISO](#iso-configuration), +[HTTP](#http-directory-configuration), +[Boot](#boot-configuration), +[Driver](#driver-configuration), +[Hardware](#hardware-configuration), +[Output](#output-configuration), +[Run](#run-configuration), +[Shutdown](#shutdown-configuration), +[Communicator](#communicator-configuration), +[Tools](#tools-configuration), +[vmx](#vmx-configuration), +[Export](#export-configuration), +configuration references, which are +necessary for this build to succeed and can be found further down the page. + +<%= partial "partials/builder/vsphere/clone/Config-not-required" %> + +### Clone Configuration + +<%= partial "partials/builder/vsphere/clone/CloneConfig-not-required" %> + +### Extra Configuration Parameters +<%= partial "partials/builder/vsphere/common/ConfigParamsConfig-not-required" %> + +### Connection Configuration +<%= partial "partials/builder/vsphere/common/ConnectConfig-not-required" %> + +### Hardware Configuration +<%= partial "partials/builder/vsphere/common/HardwareConfig-not-required" %> + +### Location Configuration +<%= partial "partials/builder/vsphere/common/LocationConfig-not-required" %> + +### Run Configuration +<%= partial "partials/builder/vsphere/common/RunConfig-not-required" %> + +### Shutdown Configuration +<%= partial "partials/builder/vsphere/common/ShutdownConfig-not-required" %> + +### Wait Configuration +<%= partial "partials/builder/vsphere/common/WaitIpConfig-not-required" %> + +### Communicator configuration + +#### Optional common fields: + +<%= partial "partials/helper/communicator/Config-not-required" %> + +#### Optional SSH fields: + +<%= partial "partials/helper/communicator/SSH-not-required" %> + +#### Optional WinRM fields: + +<%= partial "partials/helper/communicator/WinRM-not-required" %> + +## Working with Clusters +#### Standalone Hosts +Only use the `host` option. Optionally specify a `resource_pool`: +``` +"host": "esxi-1.vsphere65.test", +"resource_pool": "pool1", +``` + +#### Clusters Without DRS +Use the `cluster` and `host `parameters: +``` +"cluster": "cluster1", +"host": "esxi-2.vsphere65.test", +``` + +#### Clusters With DRS +Only use the `cluster` option. Optionally specify a `resource_pool`: +``` +"cluster": "cluster2", +"resource_pool": "pool1", +``` + +## Required vSphere Permissions + +* VM folder (this object and children): + ``` + Virtual machine -> Inventory + Virtual machine -> Configuration + Virtual machine -> Interaction + Virtual machine -> Snapshot management + Virtual machine -> Provisioning + ``` + Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235. +* Resource pool, host, or cluster (this object): + ``` + Resource -> Assign virtual machine to resource pool + ``` +* Host in clusters without DRS (this object): + ``` + Read-only + ``` +* Datastore (this object): + ``` + Datastore -> Allocate space + Datastore -> Browse datastore + Datastore -> Low level file operations + ``` +* Network (this object): + ``` + Network -> Assign network + ``` +* Distributed switch (this object): + ``` + Read-only + ``` + +For floppy image upload: + +* Datacenter (this object): + ``` + Datastore -> Low level file operations + ``` +* Host (this object): + ``` + Host -> Configuration -> System Management + ``` diff --git a/website/source/docs/builders/vsphere-iso.html.md.erb b/website/source/docs/builders/vsphere-iso.html.md.erb new file mode 100644 index 000000000..bf05eb64a --- /dev/null +++ b/website/source/docs/builders/vsphere-iso.html.md.erb @@ -0,0 +1,155 @@ +--- +modeline: | + vim: set ft=pandoc: +description: | + This VMware Packer builder starts from an ISO and creates a vm using the + vSphere API to build on a remote VMWare machine. +layout: docs +page_title: 'VSphere ISO - Builders' +sidebar_current: 'docs-builders-vsphere-iso' +--- + +# Packer Builder for VMware vSphere + +Type: `vsphere-iso` + +This builder uses the vSphere API, and creates virtual machines remotely. It +starts from an ISO file and creates new VMs from scratch. + +- VMware Player is not required. +- It uses the official vCenter API, and does not require ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) + +## Examples + +See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/hashicorp/packer/tree/master/builder/vsphere/examples/). + +# Configuration Reference + +There are many configuration options available for this builder. In addition to +the items listed here, you will want to look at the general configuration +references for [ISO](#iso-configuration), +[HTTP](#http-directory-configuration), +[Floppy](#floppy-configuration), +[Boot](#boot-configuration), +[Driver](#driver-configuration), +[Hardware](#hardware-configuration), +[Output](#output-configuration), +[Run](#run-configuration), +[Shutdown](#shutdown-configuration), +[Communicator](#communicator-configuration), +[Tools](#tools-configuration), +[vmx](#vmx-configuration), +[Export](#export-configuration), +configuration references, which are +necessary for this build to succeed and can be found further down the page. + +### Connection Configuration +<%= partial "partials/builder/vsphere/common/ConnectConfig-not-required" %> + +### Hardware Configuration +<%= partial "partials/builder/vsphere/common/HardwareConfig-not-required" %> + +### Location Configuration +<%= partial "partials/builder/vsphere/common/LocationConfig-not-required" %> + +### Run Configuration +<%= partial "partials/builder/vsphere/common/RunConfig-not-required" %> + +### Shutdown Configuration +<%= partial "partials/builder/vsphere/common/ShutdownConfig-not-required" %> + +### Wait Configuration +<%= partial "partials/builder/vsphere/common/WaitIpConfig-not-required" %> + +### CDRom Configuration +<%= partial "partials/builder/vsphere/iso/CDRomConfig-not-required" %> + +### Create Configuration +<%= partial "partials/builder/vsphere/iso/CreateConfig-not-required" %> + +### Floppy Configuration +<%= partial "partials/builder/vsphere/iso/FloppyConfig-not-required" %> + +### Extra Configuration Parameters +<%= partial "partials/builder/vsphere/common/ConfigParamsConfig-not-required" %> + +### Communicator configuration + +#### Optional common fields: + +<%= partial "partials/helper/communicator/Config-not-required" %> + +#### Optional SSH fields: + +<%= partial "partials/helper/communicator/SSH-not-required" %> + +#### Optional WinRM fields: + +<%= partial "partials/helper/communicator/WinRM-not-required" %> + +## Working with Clusters +#### Standalone Hosts +Only use the `host` option. Optionally specify a `resource_pool`: +``` +"host": "esxi-1.vsphere65.test", +"resource_pool": "pool1", +``` + +#### Clusters Without DRS +Use the `cluster` and `host `parameters: +``` +"cluster": "cluster1", +"host": "esxi-2.vsphere65.test", +``` + +#### Clusters With DRS +Only use the `cluster` option. Optionally specify a `resource_pool`: +``` +"cluster": "cluster2", +"resource_pool": "pool1", +``` + +## Required vSphere Permissions + +* VM folder (this object and children): + ``` + Virtual machine -> Inventory + Virtual machine -> Configuration + Virtual machine -> Interaction + Virtual machine -> Snapshot management + Virtual machine -> Provisioning + ``` + Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235. +* Resource pool, host, or cluster (this object): + ``` + Resource -> Assign virtual machine to resource pool + ``` +* Host in clusters without DRS (this object): + ``` + Read-only + ``` +* Datastore (this object): + ``` + Datastore -> Allocate space + Datastore -> Browse datastore + Datastore -> Low level file operations + ``` +* Network (this object): + ``` + Network -> Assign network + ``` +* Distributed switch (this object): + ``` + Read-only + ``` + +For floppy image upload: + +* Datacenter (this object): + ``` + Datastore -> Low level file operations + ``` +* Host (this object): + ``` + Host -> Configuration -> System Management + ``` diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 6f833a900..e7ba8cf32 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -18,7 +18,7 @@ </li> <hr> - + <li><a href="/docs/basics/terminology.html">Terminology</a></li> <li<%= sidebar_current("docs-commands") %>> @@ -254,10 +254,16 @@ <a href="/docs/builders/vmware.html">VMware</a> <ul class="nav"> <li<%= sidebar_current("docs-builders-vmware-iso") %>> - <a href="/docs/builders/vmware-iso.html">ISO</a> + <a href="/docs/builders/vmware-iso.html">VMWare ISO</a> </li> <li<%= sidebar_current("docs-builders-vmware-vmx") %>> - <a href="/docs/builders/vmware-vmx.html">VMX</a> + <a href="/docs/builders/vmware-vmx.html">VMWare VMX</a> + </li> + <li<%= sidebar_current("docs-builders-vsphere-iso") %>> + <a href="/docs/builders/vsphere-iso.html">VSphere ISO</a> + </li> + <li<%= sidebar_current("docs-builders-vsphere-clone") %>> + <a href="/docs/builders/vsphere-clone.html">VSphere Clone</a> </li> </ul> </li> diff --git a/website/source/partials/builder/vsphere/clone/_CloneConfig-not-required.html.md b/website/source/partials/builder/vsphere/clone/_CloneConfig-not-required.html.md new file mode 100644 index 000000000..de4d6c8a7 --- /dev/null +++ b/website/source/partials/builder/vsphere/clone/_CloneConfig-not-required.html.md @@ -0,0 +1,12 @@ +<!-- Code generated from the comments of the CloneConfig struct in builder/vsphere/clone/step_clone.go; DO NOT EDIT MANUALLY --> + +- `template` (string) - Name of source VM. Path is optional. + +- `disk_size` (int64) - The size of the disk in MB. + +- `linked_clone` (bool) - Create VM as a linked clone from latest snapshot. Defaults to `false`. + +- `network` (string) - Set network VM will be connected to. + +- `notes` (string) - VM notes. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/clone/_Config-not-required.html.md b/website/source/partials/builder/vsphere/clone/_Config-not-required.html.md new file mode 100644 index 000000000..479da57e2 --- /dev/null +++ b/website/source/partials/builder/vsphere/clone/_Config-not-required.html.md @@ -0,0 +1,7 @@ +<!-- Code generated from the comments of the Config struct in builder/vsphere/clone/config.go; DO NOT EDIT MANUALLY --> + +- `create_snapshot` (bool) - Create a snapshot when set to `true`, so the VM can be used as a base + for linked clones. Defaults to `false`. + +- `convert_to_template` (bool) - Convert VM to a template. Defaults to `false`. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_ConfigParamsConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_ConfigParamsConfig-not-required.html.md new file mode 100644 index 000000000..53cf6de9b --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_ConfigParamsConfig-not-required.html.md @@ -0,0 +1,4 @@ +<!-- Code generated from the comments of the ConfigParamsConfig struct in builder/vsphere/common/step_config_params.go; DO NOT EDIT MANUALLY --> + +- `configuration_parameters` (map[string]string) - Custom parameters. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_ConnectConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_ConnectConfig-not-required.html.md new file mode 100644 index 000000000..02aed19df --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_ConnectConfig-not-required.html.md @@ -0,0 +1,12 @@ +<!-- Code generated from the comments of the ConnectConfig struct in builder/vsphere/common/step_connect.go; DO NOT EDIT MANUALLY --> + +- `vcenter_server` (string) - vCenter server hostname. + +- `username` (string) - vSphere username. + +- `password` (string) - vSphere password. + +- `insecure_connection` (bool) - Do not validate vCenter server's TLS certificate. Defaults to `false`. + +- `datacenter` (string) - VMware datacenter name. Required if there is more than one datacenter in vCenter. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_HardwareConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_HardwareConfig-not-required.html.md new file mode 100644 index 000000000..7990d5b06 --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_HardwareConfig-not-required.html.md @@ -0,0 +1,25 @@ +<!-- Code generated from the comments of the HardwareConfig struct in builder/vsphere/common/step_hardware.go; DO NOT EDIT MANUALLY --> + +- `CPUs` (int32) - Number of CPU sockets. + +- `cpu_cores` (int32) - Number of CPU cores per socket. + +- `CPU_reservation` (int64) - Amount of reserved CPU resources in MHz. + +- `CPU_limit` (int64) - Upper limit of available CPU resources in MHz. + +- `CPU_hot_plug` (bool) - Enable CPU hot plug setting for virtual machine. Defaults to `false`. + +- `RAM` (int64) - Amount of RAM in MB. + +- `RAM_reservation` (int64) - Amount of reserved RAM in MB. + +- `RAM_reserve_all` (bool) - Reserve all available RAM. Defaults to `false`. Cannot be used together + with `RAM_reservation`. + +- `RAM_hot_plug` (bool) - Enable RAM hot plug setting for virtual machine. Defaults to `false`. + +- `video_ram` (int64) - Amount of video memory in MB. + +- `NestedHV` (bool) - Enable nested hardware virtualization for VM. Defaults to `false`. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_LocationConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_LocationConfig-not-required.html.md new file mode 100644 index 000000000..40695b1a6 --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_LocationConfig-not-required.html.md @@ -0,0 +1,19 @@ +<!-- Code generated from the comments of the LocationConfig struct in builder/vsphere/common/config_location.go; DO NOT EDIT MANUALLY --> + +- `vm_name` (string) - Name of the new VM to create. + +- `folder` (string) - VM folder to create the VM in. + +- `cluster` (string) - ESXi cluster where target VM is created. See + [Working with Clusters](#working-with-clusters). + +- `host` (string) - ESXi host where target VM is created. A full path must be specified if + the host is in a folder. For example `folder/host`. See the + `Specifying Clusters and Hosts` section above for more details. + +- `resource_pool` (string) - VMWare resource pool. Defaults to the root resource pool of the + `host` or `cluster`. + +- `datastore` (string) - VMWare datastore. Required if `host` is a cluster, or if `host` has + multiple datastores. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_RunConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_RunConfig-not-required.html.md new file mode 100644 index 000000000..a8d2e47c4 --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_RunConfig-not-required.html.md @@ -0,0 +1,4 @@ +<!-- Code generated from the comments of the RunConfig struct in builder/vsphere/common/step_run.go; DO NOT EDIT MANUALLY --> + +- `boot_order` (string) - Priority of boot devices. Defaults to `disk,cdrom` + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_ShutdownConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_ShutdownConfig-not-required.html.md new file mode 100644 index 000000000..d88210484 --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_ShutdownConfig-not-required.html.md @@ -0,0 +1,8 @@ +<!-- Code generated from the comments of the ShutdownConfig struct in builder/vsphere/common/step_shutdown.go; DO NOT EDIT MANUALLY --> + +- `shutdown_command` (string) - Specify a VM guest shutdown command. VMware guest tools are used by + default. + +- `shutdown_timeout` (duration string | ex: "1h5m2s") - Amount of time to wait for graceful VM shutdown. Examples 45s and 10m. + Defaults to 5m(5 minutes). + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/common/_WaitIpConfig-not-required.html.md b/website/source/partials/builder/vsphere/common/_WaitIpConfig-not-required.html.md new file mode 100644 index 000000000..3c6b96739 --- /dev/null +++ b/website/source/partials/builder/vsphere/common/_WaitIpConfig-not-required.html.md @@ -0,0 +1,14 @@ +<!-- Code generated from the comments of the WaitIpConfig struct in builder/vsphere/common/step_wait_for_ip.go; DO NOT EDIT MANUALLY --> + +- `ip_wait_timeout` (duration string | ex: "1h5m2s") - Amount of time to wait for VM's IP, similar to 'ssh_timeout'. + Defaults to 30m (30 minutes). See the Goang + [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation + for full details. + +- `ip_settle_timeout` (duration string | ex: "1h5m2s") - Amount of time to wait for VM's IP to settle down, sometimes VM may + report incorrect IP initially, then its recommended to set that + parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to + 5s(5 seconds). See the Golang + [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation + for full details. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/iso/_CDRomConfig-not-required.html.md b/website/source/partials/builder/vsphere/iso/_CDRomConfig-not-required.html.md new file mode 100644 index 000000000..e3952b792 --- /dev/null +++ b/website/source/partials/builder/vsphere/iso/_CDRomConfig-not-required.html.md @@ -0,0 +1,7 @@ +<!-- Code generated from the comments of the CDRomConfig struct in builder/vsphere/iso/step_add_cdrom.go; DO NOT EDIT MANUALLY --> + +- `cdrom_type` (string) - Which controller to use. Example: `sata`. Defaults to `ide`. + +- `iso_paths` ([]string) - List of datastore paths to ISO files that will be mounted to the VM. + Example: `"[datastore1] ISO/ubuntu.iso"`. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md b/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md new file mode 100644 index 000000000..a9cd1ff2f --- /dev/null +++ b/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md @@ -0,0 +1,26 @@ +<!-- Code generated from the comments of the CreateConfig struct in builder/vsphere/iso/step_create.go; DO NOT EDIT MANUALLY --> + +- `vm_version` (uint) - Set VM hardware version. Defaults to the most current VM hardware + version supported by vCenter. See + [VMWare article 1003746](https://kb.vmware.com/s/article/1003746) for + the full list of supported VM hardware versions. + +- `guest_os_type` (string) - Set VM OS type. Defaults to `otherGuest`. See [ + here](https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.GuestOsDescriptor.GuestOsIdentifier.html) + for a full list of possible values. + +- `firmware` (string) - Set the Firmware at machine creation. Example `efi`. Defaults to `bios`. + +- `disk_controller_type` (string) - Set VM disk controller type. Example `pvscsi`. + +- `disk_size` (int64) - The size of the disk in MB. + +- `disk_thin_provisioned` (bool) - Enable VMDK thin provisioning for VM. Defaults to `false`. + +- `network` (string) - Network +- `network_card` (string) - Set VM network card type. Example `vmxnet3`. + +- `usb_controller` (bool) - Create USB controller for virtual machine. Defaults to `false`. + +- `notes` (string) - VM notes. + \ No newline at end of file diff --git a/website/source/partials/builder/vsphere/iso/_FloppyConfig-not-required.html.md b/website/source/partials/builder/vsphere/iso/_FloppyConfig-not-required.html.md new file mode 100644 index 000000000..090b17f58 --- /dev/null +++ b/website/source/partials/builder/vsphere/iso/_FloppyConfig-not-required.html.md @@ -0,0 +1,10 @@ +<!-- Code generated from the comments of the FloppyConfig struct in builder/vsphere/iso/step_add_floppy.go; DO NOT EDIT MANUALLY --> + +- `floppy_img_path` (string) - Datastore path to a floppy image that will be mounted to the VM. + Example: `[datastore1] ISO/pvscsi-Windows8.flp`. + +- `floppy_files` ([]string) - List of local files to be mounted to the VM floppy drive. Can be used to + make Debian preseed or RHEL kickstart files available to the VM. + +- `floppy_dirs` ([]string) - List of directories to copy files from. + \ No newline at end of file From e87aa237dd254e05a48752286714c965e2bc73d7 Mon Sep 17 00:00:00 2001 From: Megan Marsh <megan@hashicorp.com> Date: Wed, 8 Jan 2020 10:22:55 -0800 Subject: [PATCH 261/266] Get plugin up to parity with v1.5.0. Remove custom jetbrains-internal testing logic; disable acceptance tests (for now) until we can set up a test rig inside of HashiCorp. Regenerate code based on vendoring changes. --- .teamcity/.gitignore | 2 - .teamcity/pom.xml | 104 - .teamcity/settings.kts | 137 - builder/vsphere/clone/builder.go | 9 +- builder/vsphere/clone/builder_acc_test.go | 17 + builder/vsphere/clone/config.go | 2 +- builder/vsphere/clone/config.hcl2spec.go | 187 +- builder/vsphere/clone/leak_test.go | 8 - builder/vsphere/driver/datastore_acc_test.go | 3 + builder/vsphere/driver/folder_acc_test.go | 1 + builder/vsphere/driver/host_acc_test.go | 1 + builder/vsphere/driver/leak_test.go | 8 - .../vsphere/driver/resource_pool_acc_test.go | 1 + builder/vsphere/driver/vm_clone_acc_test.go | 1 + builder/vsphere/driver/vm_create_acc_test.go | 1 + .../vsphere/examples/macos/setup/iso-macos.sh | 0 .../vsphere/examples/macos/setup/iso-setup.sh | 0 .../vsphere/examples/macos/setup/postinstall | 0 builder/vsphere/iso/builder.go | 9 +- builder/vsphere/iso/config.go | 15 +- builder/vsphere/iso/config.hcl2spec.go | 238 ++ builder/vsphere/iso/leak_test.go | 8 - builder/vsphere/test/test-key.pub | 0 go.mod | 3 +- go.sum | 10 +- vendor/github.com/vmware/govmomi/.drone.sec | 1 - vendor/github.com/vmware/govmomi/.drone.yml | 17 - vendor/github.com/vmware/govmomi/.gitignore | 5 + .../github.com/vmware/govmomi/.goreleaser.yml | 118 + vendor/github.com/vmware/govmomi/.mailmap | 12 + vendor/github.com/vmware/govmomi/.travis.yml | 99 +- vendor/github.com/vmware/govmomi/CHANGELOG.md | 76 + vendor/github.com/vmware/govmomi/CONTRIBUTORS | 64 +- .../github.com/vmware/govmomi/Dockerfile.govc | 4 + .../vmware/govmomi/Dockerfile.vcsim | 4 + vendor/github.com/vmware/govmomi/Gopkg.lock | 60 + vendor/github.com/vmware/govmomi/Gopkg.toml | 19 + vendor/github.com/vmware/govmomi/Makefile | 24 +- vendor/github.com/vmware/govmomi/README.md | 48 +- vendor/github.com/vmware/govmomi/client.go | 31 - .../github.com/vmware/govmomi/find/finder.go | 45 +- .../vmware/govmomi/find/recurser.go | 2 +- vendor/github.com/vmware/govmomi/go.mod | 13 + vendor/github.com/vmware/govmomi/go.sum | 13 + vendor/github.com/vmware/govmomi/nfc/lease.go | 233 ++ .../vmware/govmomi/nfc/lease_updater.go | 146 + .../object/cluster_compute_resource.go | 25 +- .../vmware/govmomi/object/common.go | 26 +- .../vmware/govmomi/object/compute_resource.go | 13 - .../govmomi/object/custom_fields_manager.go | 19 +- .../vmware/govmomi/object/datacenter.go | 39 + .../vmware/govmomi/object/datastore.go | 29 +- .../vmware/govmomi/object/datastore_file.go | 20 +- .../govmomi/object/datastore_file_manager.go | 91 +- .../vmware/govmomi/object/datastore_path.go | 8 +- .../govmomi/object/diagnostic_manager.go | 6 +- .../object/distributed_virtual_portgroup.go | 11 +- .../object/distributed_virtual_switch.go | 13 + .../vmware/govmomi/object/file_manager.go | 4 +- .../object/host_certificate_manager.go | 2 +- .../govmomi/object/host_datastore_system.go | 16 + .../govmomi/object/host_network_system.go | 8 +- .../govmomi/object/host_storage_system.go | 55 + .../object/host_vsan_internal_system.go | 2 +- .../vmware/govmomi/object/http_nfc_lease.go | 143 - .../vmware/govmomi/object/ovf_manager.go | 104 - .../vmware/govmomi/object/resource_pool.go | 5 +- .../github.com/vmware/govmomi/object/task.go | 17 +- .../github.com/vmware/govmomi/object/types.go | 4 +- .../govmomi/object/virtual_device_list.go | 25 +- .../govmomi/object/virtual_disk_manager.go | 57 + .../object/virtual_disk_manager_internal.go | 77 +- .../vmware/govmomi/object/virtual_machine.go | 92 +- vendor/github.com/vmware/govmomi/program.mk | 48 + .../vmware/govmomi/property/collector.go | 36 +- .../vmware/govmomi/property/filter.go | 2 +- .../vmware/govmomi/property/wait.go | 166 +- .../vmware/govmomi/session/keep_alive.go | 7 +- .../vmware/govmomi/session/manager.go | 89 +- vendor/github.com/vmware/govmomi/task/wait.go | 2 +- .../github.com/vmware/govmomi/vim25/client.go | 70 +- .../vmware/govmomi/vim25/methods/internal.go | 124 - .../vmware/govmomi/vim25/methods/methods.go | 3114 ++++++++++---- .../govmomi/vim25/methods/service_content.go | 7 +- .../github.com/vmware/govmomi/vim25/mo/mo.go | 86 +- .../vmware/govmomi/vim25/mo/retrieve.go | 16 + .../vmware/govmomi/vim25/mo/type_info.go | 51 +- .../vmware/govmomi/vim25/progress/reader.go | 40 +- .../vmware/govmomi/vim25/soap/client.go | 413 +- .../vmware/govmomi/vim25/soap/debug.go | 30 +- .../vmware/govmomi/vim25/soap/error.go | 6 +- .../vmware/govmomi/vim25/soap/soap.go | 14 +- .../vmware/govmomi/vim25/types/enum.go | 453 +- .../vmware/govmomi/vim25/types/helpers.go | 47 +- .../vmware/govmomi/vim25/types/if.go | 34 +- .../vmware/govmomi/vim25/types/internal.go | 266 -- .../vmware/govmomi/vim25/types/types.go | 3660 +++++++++++++++-- vendor/golang.org/x/mobile/AUTHORS | 3 + vendor/golang.org/x/mobile/CONTRIBUTORS | 3 + vendor/golang.org/x/mobile/LICENSE | 27 + vendor/golang.org/x/mobile/PATENTS | 22 + .../x/mobile/event/key/code_string.go | 60 + vendor/golang.org/x/mobile/event/key/key.go | 270 ++ vendor/modules.txt | 5 +- 104 files changed, 9211 insertions(+), 2670 deletions(-) delete mode 100644 .teamcity/.gitignore delete mode 100644 .teamcity/pom.xml delete mode 100644 .teamcity/settings.kts delete mode 100644 builder/vsphere/clone/leak_test.go delete mode 100644 builder/vsphere/driver/leak_test.go mode change 100755 => 100644 builder/vsphere/examples/macos/setup/iso-macos.sh mode change 100755 => 100644 builder/vsphere/examples/macos/setup/iso-setup.sh mode change 100755 => 100644 builder/vsphere/examples/macos/setup/postinstall create mode 100644 builder/vsphere/iso/config.hcl2spec.go delete mode 100644 builder/vsphere/iso/leak_test.go mode change 100755 => 100644 builder/vsphere/test/test-key.pub delete mode 100644 vendor/github.com/vmware/govmomi/.drone.sec delete mode 100644 vendor/github.com/vmware/govmomi/.drone.yml create mode 100644 vendor/github.com/vmware/govmomi/.goreleaser.yml create mode 100644 vendor/github.com/vmware/govmomi/Dockerfile.govc create mode 100644 vendor/github.com/vmware/govmomi/Dockerfile.vcsim create mode 100644 vendor/github.com/vmware/govmomi/Gopkg.lock create mode 100644 vendor/github.com/vmware/govmomi/Gopkg.toml create mode 100644 vendor/github.com/vmware/govmomi/go.mod create mode 100644 vendor/github.com/vmware/govmomi/go.sum create mode 100644 vendor/github.com/vmware/govmomi/nfc/lease.go create mode 100644 vendor/github.com/vmware/govmomi/nfc/lease_updater.go delete mode 100644 vendor/github.com/vmware/govmomi/object/http_nfc_lease.go delete mode 100644 vendor/github.com/vmware/govmomi/object/ovf_manager.go create mode 100644 vendor/github.com/vmware/govmomi/program.mk delete mode 100644 vendor/github.com/vmware/govmomi/vim25/methods/internal.go delete mode 100644 vendor/github.com/vmware/govmomi/vim25/types/internal.go create mode 100644 vendor/golang.org/x/mobile/AUTHORS create mode 100644 vendor/golang.org/x/mobile/CONTRIBUTORS create mode 100644 vendor/golang.org/x/mobile/LICENSE create mode 100644 vendor/golang.org/x/mobile/PATENTS create mode 100644 vendor/golang.org/x/mobile/event/key/code_string.go create mode 100644 vendor/golang.org/x/mobile/event/key/key.go diff --git a/.teamcity/.gitignore b/.teamcity/.gitignore deleted file mode 100644 index 7f995f335..000000000 --- a/.teamcity/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.iml -target/ diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml deleted file mode 100644 index 49f9e3cd6..000000000 --- a/.teamcity/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0"?> -<project> - <modelVersion>4.0.0</modelVersion> - <name>PackerVSphere Config DSL Script</name> - <groupId>PackerVSphere</groupId> - <artifactId>PackerVSphere_dsl</artifactId> - <version>1.0-SNAPSHOT</version> - - <parent> - <groupId>org.jetbrains.teamcity</groupId> - <artifactId>configs-dsl-kotlin-parent</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <repositories> - <repository> - <id>jetbrains-all</id> - <url>https://download.jetbrains.com/teamcity-repository</url> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - <repository> - <id>teamcity-server</id> - <url>https://teamcity.jetbrains.com/app/dsl-plugins-repository</url> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - - <pluginRepositories> - <pluginRepository> - <id>JetBrains</id> - <url>https://download.jetbrains.com/teamcity-repository</url> - </pluginRepository> - </pluginRepositories> - - <build> - <sourceDirectory>.</sourceDirectory> - <plugins> - <plugin> - <artifactId>kotlin-maven-plugin</artifactId> - <groupId>org.jetbrains.kotlin</groupId> - <version>${kotlin.version}</version> - - <configuration/> - <executions> - <execution> - <id>compile</id> - <phase>process-sources</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - <execution> - <id>test-compile</id> - <phase>process-test-sources</phase> - <goals> - <goal>test-compile</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.jetbrains.teamcity</groupId> - <artifactId>teamcity-configs-maven-plugin</artifactId> - <version>${teamcity.dsl.version}</version> - <configuration> - <format>kotlin</format> - <dstDir>target/generated-configs</dstDir> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.jetbrains.teamcity</groupId> - <artifactId>configs-dsl-kotlin</artifactId> - <version>${teamcity.dsl.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.teamcity</groupId> - <artifactId>configs-dsl-kotlin-plugins</artifactId> - <version>1.0-SNAPSHOT</version> - <type>pom</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-stdlib-jdk8</artifactId> - <version>${kotlin.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-script-runtime</artifactId> - <version>${kotlin.version}</version> - <scope>compile</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts deleted file mode 100644 index 8bf94e4c1..000000000 --- a/.teamcity/settings.kts +++ /dev/null @@ -1,137 +0,0 @@ -import jetbrains.buildServer.configs.kotlin.v2018_2.* -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.PullRequests -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.commitStatusPublisher -import jetbrains.buildServer.configs.kotlin.v2018_2.buildFeatures.pullRequests -import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.dockerCompose -import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.script -import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.vcs -import jetbrains.buildServer.configs.kotlin.v2018_2.vcs.GitVcsRoot - -version = "2018.2" - -project { - description = "https://github.com/jetbrains-infra/packer-builder-vsphere" - - vcsRoot(GitHub) - buildType(Build) - - features { - feature { - type = "OAuthProvider" - param("providerType", "GitHub") - param("displayName", "GitHub.com") - param("gitHubUrl", "https://github.com/") - param("clientId", "1abfd46417d7795298a1") - param("secure:clientSecret", "credentialsJSON:5fe99dc3-4d1d-4fd6-9f5c-e87fbcbd9a4e") - param("defaultTokenScope", "public_repo,repo,repo:status,write:repo_hook") - } - feature { - type = "IssueTracker" - param("name", "packer-builder-vsphere") - param("type", "GithubIssues") - param("repository", "https://github.com/jetbrains-infra/packer-builder-vsphere") - param("authType", "anonymous") - param("pattern", """#(\d+)""") - } - } -} - -object GitHub : GitVcsRoot({ - name = "packer-builder-vsphere" - url = "https://github.com/jetbrains-infra/packer-builder-vsphere" - branch = "master" - branchSpec = "+:refs/heads/(*)" - userNameStyle = GitVcsRoot.UserNameStyle.FULL -}) - -object Build : BuildType({ - val golangImage = "jetbrainsinfra/golang:1.11.4" - - name = "Build" - - vcs { - root(GitHub) - } - - requirements { - equals("docker.server.osType", "linux") - exists("dockerCompose.version") - - doesNotContain("teamcity.agent.name", "ubuntu-single-build") - } - - params { - param("env.GOPATH", "%teamcity.build.checkoutDir%/build/modules") - param("env.GOCACHE", "%teamcity.build.checkoutDir%/build/cache") - - password("env.VPN_PASSWORD", "credentialsJSON:8c355e81-9a26-4788-8fea-c854cd646c35") - param ("env.VSPHERE_USERNAME", """vsphere65.test\teamcity""") - password("env.VSPHERE_PASSWORD", "credentialsJSON:d5e7ac7f-357b-464a-b2fa-ddd4c433b22b") - } - - steps { - script { - name = "Build" - scriptContent = "make build -j 3" - dockerImage = golangImage - dockerPull = true - } - - dockerCompose { - name = "Start VPN tunnel" - file = "teamcity-services.yml" - } - - script { - name = "Test" - scriptContent = "make test | go-test-teamcity" - dockerImage = golangImage - dockerPull = true - dockerRunParameters = "--network=container:vpn" - } - script { - name = "gofmt" - executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE - scriptContent = "./gofmt.sh" - dockerImage = golangImage - dockerPull = true - } - } - - features { - commitStatusPublisher { - publisher = github { - githubUrl = "https://api.github.com" - authType = personalToken { - token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" - } - } - } - pullRequests { - provider = github { - authType = token { - token = "credentialsJSON:5ead3bb1-c370-4589-beb8-24f8d02c36bc" - } - filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY - } - } - } - - triggers { - vcs { - triggerRules = """ - -:*.md - -:.teamcity/ - """.trimIndent() - branchFilter = """ - +:* - -:temp-* - -:pull/* - """.trimIndent() - } - } - maxRunningBuilds = 2 - - artifactRules = "bin/* => packer-builder-vsphere-%build.number%.zip" - allowExternalStatus = true -}) diff --git a/builder/vsphere/clone/builder.go b/builder/vsphere/clone/builder.go index 8c4a54365..48e1681c0 100644 --- a/builder/vsphere/clone/builder.go +++ b/builder/vsphere/clone/builder.go @@ -2,6 +2,7 @@ package clone import ( "context" + "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/builder/vsphere/common" "github.com/hashicorp/packer/builder/vsphere/driver" packerCommon "github.com/hashicorp/packer/common" @@ -15,14 +16,16 @@ type Builder struct { runner multistep.Runner } -func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { +func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } + +func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { c, warnings, errs := NewConfig(raws...) if errs != nil { - return warnings, errs + return warnings, nil, errs } b.config = c - return warnings, nil + return warnings, nil, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { diff --git a/builder/vsphere/clone/builder_acc_test.go b/builder/vsphere/clone/builder_acc_test.go index 081d43dd9..ec988ed83 100644 --- a/builder/vsphere/clone/builder_acc_test.go +++ b/builder/vsphere/clone/builder_acc_test.go @@ -11,6 +11,7 @@ import ( ) func TestCloneBuilderAcc_default(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -101,6 +102,7 @@ func checkDefault(t *testing.T, name string, host string, datastore string) buil } func TestCloneBuilderAcc_artifact(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") config := defaultConfig() builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, @@ -126,6 +128,7 @@ func checkArtifact(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_folder(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: folderConfig(), @@ -163,6 +166,7 @@ func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc { } func TestCloneBuilderAcc_resourcePool(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: resourcePoolConfig(), @@ -200,6 +204,7 @@ func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc { } func TestCloneBuilderAcc_datastore(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: datastoreConfig(), @@ -259,6 +264,7 @@ func multipleDatastoresConfig() string { } func TestCloneBuilderAcc_fullClone(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: fullCloneConfig(), @@ -291,6 +297,7 @@ func checkFullClone(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_linkedClone(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: linkedCloneConfig(), @@ -323,6 +330,7 @@ func checkLinkedClone(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_network(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: networkConfig(), @@ -368,6 +376,7 @@ func checkNetwork(t *testing.T, name string) builderT.TestCheckFunc { } func TestCloneBuilderAcc_hardware(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: hardwareConfig(), @@ -457,6 +466,7 @@ func checkHardware(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_RAMReservation(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: RAMReservationConfig(), @@ -490,6 +500,7 @@ func checkRAMReservation(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_sshPassword(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: sshPasswordConfig(), @@ -525,6 +536,7 @@ func checkDefaultBootOrder(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_sshKey(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: sshKeyConfig(), @@ -540,6 +552,7 @@ func sshKeyConfig() string { } func TestCloneBuilderAcc_snapshot(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: snapshotConfig(), @@ -574,6 +587,7 @@ func checkSnapshot(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_template(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: templateConfig(), @@ -606,6 +620,7 @@ func checkTemplate(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_bootOrder(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: bootOrderConfig(), @@ -644,6 +659,7 @@ func checkBootOrder(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_notes(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") builderT.Test(t, builderT.TestCase{ Builder: &Builder{}, Template: notesConfig(), @@ -678,6 +694,7 @@ func checkNotes(t *testing.T) builderT.TestCheckFunc { } func TestCloneBuilderAcc_windows(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") t.Skip("test is too slow") config := windowsConfig() builderT.Test(t, builderT.TestCase{ diff --git a/builder/vsphere/clone/config.go b/builder/vsphere/clone/config.go index 6a780934f..f03685a82 100644 --- a/builder/vsphere/clone/config.go +++ b/builder/vsphere/clone/config.go @@ -1,5 +1,5 @@ //go:generate struct-markdown -//go:generate mapstructure-to-hcl2 -type ShutdownConfig +//go:generate mapstructure-to-hcl2 -type Config package clone diff --git a/builder/vsphere/clone/config.hcl2spec.go b/builder/vsphere/clone/config.hcl2spec.go index 8c548ebcf..992a83aa0 100644 --- a/builder/vsphere/clone/config.hcl2spec.go +++ b/builder/vsphere/clone/config.hcl2spec.go @@ -1,7 +1,192 @@ -// Code generated by "mapstructure-to-hcl2 -type ShutdownConfig"; DO NOT EDIT. +// Code generated by "mapstructure-to-hcl2 -type Config"; DO NOT EDIT. package clone import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/zclconf/go-cty/cty" ) + +// FlatConfig is an auto-generated flat version of Config. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatConfig struct { + PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name"` + PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type"` + PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug"` + PackerForce *bool `mapstructure:"packer_force" cty:"packer_force"` + PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error"` + PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"` + PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"` + VCenterServer *string `mapstructure:"vcenter_server" cty:"vcenter_server"` + Username *string `mapstructure:"username" cty:"username"` + Password *string `mapstructure:"password" cty:"password"` + InsecureConnection *bool `mapstructure:"insecure_connection" cty:"insecure_connection"` + Datacenter *string `mapstructure:"datacenter" cty:"datacenter"` + Template *string `mapstructure:"template" cty:"template"` + DiskSize *int64 `mapstructure:"disk_size" cty:"disk_size"` + LinkedClone *bool `mapstructure:"linked_clone" cty:"linked_clone"` + Network *string `mapstructure:"network" cty:"network"` + Notes *string `mapstructure:"notes" cty:"notes"` + VMName *string `mapstructure:"vm_name" cty:"vm_name"` + Folder *string `mapstructure:"folder" cty:"folder"` + Cluster *string `mapstructure:"cluster" cty:"cluster"` + Host *string `mapstructure:"host" cty:"host"` + ResourcePool *string `mapstructure:"resource_pool" cty:"resource_pool"` + Datastore *string `mapstructure:"datastore" cty:"datastore"` + CPUs *int32 `mapstructure:"CPUs" cty:"CPUs"` + CpuCores *int32 `mapstructure:"cpu_cores" cty:"cpu_cores"` + CPUReservation *int64 `mapstructure:"CPU_reservation" cty:"CPU_reservation"` + CPULimit *int64 `mapstructure:"CPU_limit" cty:"CPU_limit"` + CpuHotAddEnabled *bool `mapstructure:"CPU_hot_plug" cty:"CPU_hot_plug"` + RAM *int64 `mapstructure:"RAM" cty:"RAM"` + RAMReservation *int64 `mapstructure:"RAM_reservation" cty:"RAM_reservation"` + RAMReserveAll *bool `mapstructure:"RAM_reserve_all" cty:"RAM_reserve_all"` + MemoryHotAddEnabled *bool `mapstructure:"RAM_hot_plug" cty:"RAM_hot_plug"` + VideoRAM *int64 `mapstructure:"video_ram" cty:"video_ram"` + NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV"` + ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters"` + BootOrder *string `mapstructure:"boot_order" cty:"boot_order"` + WaitTimeout *string `mapstructure:"ip_wait_timeout" cty:"ip_wait_timeout"` + SettleTimeout *string `mapstructure:"ip_settle_timeout" cty:"ip_settle_timeout"` + Type *string `mapstructure:"communicator" cty:"communicator"` + PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"` + SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host"` + SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port"` + SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username"` + SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password"` + SSHKeyPairName *string `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"` + SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"` + SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"` + SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"` + SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty"` + SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout"` + SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"` + SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"` + SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"` + SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"` + SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"` + SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"` + SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"` + SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"` + SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"` + SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"` + SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"` + SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"` + SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"` + SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"` + SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"` + SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"` + SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"` + SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"` + SSHPublicKey []byte `mapstructure:"ssh_public_key" cty:"ssh_public_key"` + SSHPrivateKey []byte `mapstructure:"ssh_private_key" cty:"ssh_private_key"` + WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username"` + WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password"` + WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host"` + WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port"` + WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout"` + WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"` + WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"` + WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"` + Command *string `mapstructure:"shutdown_command" cty:"shutdown_command"` + Timeout *string `mapstructure:"shutdown_timeout" cty:"shutdown_timeout"` + CreateSnapshot *bool `mapstructure:"create_snapshot" cty:"create_snapshot"` + ConvertToTemplate *bool `mapstructure:"convert_to_template" cty:"convert_to_template"` +} + +// FlatMapstructure returns a new FlatConfig. +// FlatConfig is an auto-generated flat version of Config. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatConfig) +} + +// HCL2Spec returns the hcl spec of a Config. +// This spec is used by HCL to read the fields of Config. +// The decoded values from this spec will then be applied to a FlatConfig. +func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "packer_build_name": &hcldec.AttrSpec{Name: "packer_build_name", Type: cty.String, Required: false}, + "packer_builder_type": &hcldec.AttrSpec{Name: "packer_builder_type", Type: cty.String, Required: false}, + "packer_debug": &hcldec.AttrSpec{Name: "packer_debug", Type: cty.Bool, Required: false}, + "packer_force": &hcldec.AttrSpec{Name: "packer_force", Type: cty.Bool, Required: false}, + "packer_on_error": &hcldec.AttrSpec{Name: "packer_on_error", Type: cty.String, Required: false}, + "packer_user_variables": &hcldec.BlockAttrsSpec{TypeName: "packer_user_variables", ElementType: cty.String, Required: false}, + "packer_sensitive_variables": &hcldec.AttrSpec{Name: "packer_sensitive_variables", Type: cty.List(cty.String), Required: false}, + "vcenter_server": &hcldec.AttrSpec{Name: "vcenter_server", Type: cty.String, Required: false}, + "username": &hcldec.AttrSpec{Name: "username", Type: cty.String, Required: false}, + "password": &hcldec.AttrSpec{Name: "password", Type: cty.String, Required: false}, + "insecure_connection": &hcldec.AttrSpec{Name: "insecure_connection", Type: cty.Bool, Required: false}, + "datacenter": &hcldec.AttrSpec{Name: "datacenter", Type: cty.String, Required: false}, + "template": &hcldec.AttrSpec{Name: "template", Type: cty.String, Required: false}, + "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, + "linked_clone": &hcldec.AttrSpec{Name: "linked_clone", Type: cty.Bool, Required: false}, + "network": &hcldec.AttrSpec{Name: "network", Type: cty.String, Required: false}, + "notes": &hcldec.AttrSpec{Name: "notes", Type: cty.String, Required: false}, + "vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false}, + "folder": &hcldec.AttrSpec{Name: "folder", Type: cty.String, Required: false}, + "cluster": &hcldec.AttrSpec{Name: "cluster", Type: cty.String, Required: false}, + "host": &hcldec.AttrSpec{Name: "host", Type: cty.String, Required: false}, + "resource_pool": &hcldec.AttrSpec{Name: "resource_pool", Type: cty.String, Required: false}, + "datastore": &hcldec.AttrSpec{Name: "datastore", Type: cty.String, Required: false}, + "CPUs": &hcldec.AttrSpec{Name: "CPUs", Type: cty.Number, Required: false}, + "cpu_cores": &hcldec.AttrSpec{Name: "cpu_cores", Type: cty.Number, Required: false}, + "CPU_reservation": &hcldec.AttrSpec{Name: "CPU_reservation", Type: cty.Number, Required: false}, + "CPU_limit": &hcldec.AttrSpec{Name: "CPU_limit", Type: cty.Number, Required: false}, + "CPU_hot_plug": &hcldec.AttrSpec{Name: "CPU_hot_plug", Type: cty.Bool, Required: false}, + "RAM": &hcldec.AttrSpec{Name: "RAM", Type: cty.Number, Required: false}, + "RAM_reservation": &hcldec.AttrSpec{Name: "RAM_reservation", Type: cty.Number, Required: false}, + "RAM_reserve_all": &hcldec.AttrSpec{Name: "RAM_reserve_all", Type: cty.Bool, Required: false}, + "RAM_hot_plug": &hcldec.AttrSpec{Name: "RAM_hot_plug", Type: cty.Bool, Required: false}, + "video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false}, + "NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false}, + "configuration_parameters": &hcldec.BlockAttrsSpec{TypeName: "configuration_parameters", ElementType: cty.String, Required: false}, + "boot_order": &hcldec.AttrSpec{Name: "boot_order", Type: cty.String, Required: false}, + "ip_wait_timeout": &hcldec.AttrSpec{Name: "ip_wait_timeout", Type: cty.String, Required: false}, + "ip_settle_timeout": &hcldec.AttrSpec{Name: "ip_settle_timeout", Type: cty.String, Required: false}, + "communicator": &hcldec.AttrSpec{Name: "communicator", Type: cty.String, Required: false}, + "pause_before_connecting": &hcldec.AttrSpec{Name: "pause_before_connecting", Type: cty.String, Required: false}, + "ssh_host": &hcldec.AttrSpec{Name: "ssh_host", Type: cty.String, Required: false}, + "ssh_port": &hcldec.AttrSpec{Name: "ssh_port", Type: cty.Number, Required: false}, + "ssh_username": &hcldec.AttrSpec{Name: "ssh_username", Type: cty.String, Required: false}, + "ssh_password": &hcldec.AttrSpec{Name: "ssh_password", Type: cty.String, Required: false}, + "ssh_keypair_name": &hcldec.AttrSpec{Name: "ssh_keypair_name", Type: cty.String, Required: false}, + "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false}, + "ssh_clear_authorized_keys": &hcldec.AttrSpec{Name: "ssh_clear_authorized_keys", Type: cty.Bool, Required: false}, + "ssh_private_key_file": &hcldec.AttrSpec{Name: "ssh_private_key_file", Type: cty.String, Required: false}, + "ssh_pty": &hcldec.AttrSpec{Name: "ssh_pty", Type: cty.Bool, Required: false}, + "ssh_timeout": &hcldec.AttrSpec{Name: "ssh_timeout", Type: cty.String, Required: false}, + "ssh_agent_auth": &hcldec.AttrSpec{Name: "ssh_agent_auth", Type: cty.Bool, Required: false}, + "ssh_disable_agent_forwarding": &hcldec.AttrSpec{Name: "ssh_disable_agent_forwarding", Type: cty.Bool, Required: false}, + "ssh_handshake_attempts": &hcldec.AttrSpec{Name: "ssh_handshake_attempts", Type: cty.Number, Required: false}, + "ssh_bastion_host": &hcldec.AttrSpec{Name: "ssh_bastion_host", Type: cty.String, Required: false}, + "ssh_bastion_port": &hcldec.AttrSpec{Name: "ssh_bastion_port", Type: cty.Number, Required: false}, + "ssh_bastion_agent_auth": &hcldec.AttrSpec{Name: "ssh_bastion_agent_auth", Type: cty.Bool, Required: false}, + "ssh_bastion_username": &hcldec.AttrSpec{Name: "ssh_bastion_username", Type: cty.String, Required: false}, + "ssh_bastion_password": &hcldec.AttrSpec{Name: "ssh_bastion_password", Type: cty.String, Required: false}, + "ssh_bastion_private_key_file": &hcldec.AttrSpec{Name: "ssh_bastion_private_key_file", Type: cty.String, Required: false}, + "ssh_file_transfer_method": &hcldec.AttrSpec{Name: "ssh_file_transfer_method", Type: cty.String, Required: false}, + "ssh_proxy_host": &hcldec.AttrSpec{Name: "ssh_proxy_host", Type: cty.String, Required: false}, + "ssh_proxy_port": &hcldec.AttrSpec{Name: "ssh_proxy_port", Type: cty.Number, Required: false}, + "ssh_proxy_username": &hcldec.AttrSpec{Name: "ssh_proxy_username", Type: cty.String, Required: false}, + "ssh_proxy_password": &hcldec.AttrSpec{Name: "ssh_proxy_password", Type: cty.String, Required: false}, + "ssh_keep_alive_interval": &hcldec.AttrSpec{Name: "ssh_keep_alive_interval", Type: cty.String, Required: false}, + "ssh_read_write_timeout": &hcldec.AttrSpec{Name: "ssh_read_write_timeout", Type: cty.String, Required: false}, + "ssh_remote_tunnels": &hcldec.AttrSpec{Name: "ssh_remote_tunnels", Type: cty.List(cty.String), Required: false}, + "ssh_local_tunnels": &hcldec.AttrSpec{Name: "ssh_local_tunnels", Type: cty.List(cty.String), Required: false}, + "ssh_public_key": &hcldec.AttrSpec{Name: "ssh_public_key", Type: cty.List(cty.Number), Required: false}, + "ssh_private_key": &hcldec.AttrSpec{Name: "ssh_private_key", Type: cty.List(cty.Number), Required: false}, + "winrm_username": &hcldec.AttrSpec{Name: "winrm_username", Type: cty.String, Required: false}, + "winrm_password": &hcldec.AttrSpec{Name: "winrm_password", Type: cty.String, Required: false}, + "winrm_host": &hcldec.AttrSpec{Name: "winrm_host", Type: cty.String, Required: false}, + "winrm_port": &hcldec.AttrSpec{Name: "winrm_port", Type: cty.Number, Required: false}, + "winrm_timeout": &hcldec.AttrSpec{Name: "winrm_timeout", Type: cty.String, Required: false}, + "winrm_use_ssl": &hcldec.AttrSpec{Name: "winrm_use_ssl", Type: cty.Bool, Required: false}, + "winrm_insecure": &hcldec.AttrSpec{Name: "winrm_insecure", Type: cty.Bool, Required: false}, + "winrm_use_ntlm": &hcldec.AttrSpec{Name: "winrm_use_ntlm", Type: cty.Bool, Required: false}, + "shutdown_command": &hcldec.AttrSpec{Name: "shutdown_command", Type: cty.String, Required: false}, + "shutdown_timeout": &hcldec.AttrSpec{Name: "shutdown_timeout", Type: cty.String, Required: false}, + "create_snapshot": &hcldec.AttrSpec{Name: "create_snapshot", Type: cty.Bool, Required: false}, + "convert_to_template": &hcldec.AttrSpec{Name: "convert_to_template", Type: cty.Bool, Required: false}, + } + return s +} diff --git a/builder/vsphere/clone/leak_test.go b/builder/vsphere/clone/leak_test.go deleted file mode 100644 index a6aa3a00b..000000000 --- a/builder/vsphere/clone/leak_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package clone - -import "testing" -import "go.uber.org/goleak" - -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) -} diff --git a/builder/vsphere/driver/datastore_acc_test.go b/builder/vsphere/driver/datastore_acc_test.go index 75a522711..a45b2ffb4 100644 --- a/builder/vsphere/driver/datastore_acc_test.go +++ b/builder/vsphere/driver/datastore_acc_test.go @@ -8,6 +8,7 @@ import ( ) func TestDatastoreAcc(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") d := newTestDriver(t) ds, err := d.FindDatastore("datastore1", "") if err != nil { @@ -23,6 +24,7 @@ func TestDatastoreAcc(t *testing.T) { } func TestFileUpload(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") dsName := "datastore1" hostName := "esxi-1.vsphere65.test" @@ -58,6 +60,7 @@ func TestFileUpload(t *testing.T) { } func TestFileUploadDRS(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") dsName := "datastore3" hostName := "" diff --git a/builder/vsphere/driver/folder_acc_test.go b/builder/vsphere/driver/folder_acc_test.go index 29d1364e0..7f3b527b6 100644 --- a/builder/vsphere/driver/folder_acc_test.go +++ b/builder/vsphere/driver/folder_acc_test.go @@ -3,6 +3,7 @@ package driver import "testing" func TestFolderAcc(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") d := newTestDriver(t) f, err := d.FindFolder("folder1/folder2") if err != nil { diff --git a/builder/vsphere/driver/host_acc_test.go b/builder/vsphere/driver/host_acc_test.go index 765550551..faee0fdaa 100644 --- a/builder/vsphere/driver/host_acc_test.go +++ b/builder/vsphere/driver/host_acc_test.go @@ -5,6 +5,7 @@ import ( ) func TestHostAcc(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") d := newTestDriver(t) host, err := d.FindHost(TestHostName) if err != nil { diff --git a/builder/vsphere/driver/leak_test.go b/builder/vsphere/driver/leak_test.go deleted file mode 100644 index 26f8b3908..000000000 --- a/builder/vsphere/driver/leak_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package driver - -import "testing" -import "go.uber.org/goleak" - -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) -} diff --git a/builder/vsphere/driver/resource_pool_acc_test.go b/builder/vsphere/driver/resource_pool_acc_test.go index a2b3a93d4..bfb38d2cc 100644 --- a/builder/vsphere/driver/resource_pool_acc_test.go +++ b/builder/vsphere/driver/resource_pool_acc_test.go @@ -3,6 +3,7 @@ package driver import "testing" func TestResourcePoolAcc(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") d := newTestDriver(t) p, err := d.FindResourcePool("", "esxi-1.vsphere65.test", "pool1/pool2") if err != nil { diff --git a/builder/vsphere/driver/vm_clone_acc_test.go b/builder/vsphere/driver/vm_clone_acc_test.go index d6add46d7..664103f1f 100644 --- a/builder/vsphere/driver/vm_clone_acc_test.go +++ b/builder/vsphere/driver/vm_clone_acc_test.go @@ -9,6 +9,7 @@ import ( ) func TestVMAcc_clone(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") testCases := []struct { name string config *CloneConfig diff --git a/builder/vsphere/driver/vm_create_acc_test.go b/builder/vsphere/driver/vm_create_acc_test.go index 5b53dbcca..32b2c2b40 100644 --- a/builder/vsphere/driver/vm_create_acc_test.go +++ b/builder/vsphere/driver/vm_create_acc_test.go @@ -6,6 +6,7 @@ import ( ) func TestVMAcc_create(t *testing.T) { + t.Skip("Acceptance tests not configured yet.") testCases := []struct { name string config *CreateConfig diff --git a/builder/vsphere/examples/macos/setup/iso-macos.sh b/builder/vsphere/examples/macos/setup/iso-macos.sh old mode 100755 new mode 100644 diff --git a/builder/vsphere/examples/macos/setup/iso-setup.sh b/builder/vsphere/examples/macos/setup/iso-setup.sh old mode 100755 new mode 100644 diff --git a/builder/vsphere/examples/macos/setup/postinstall b/builder/vsphere/examples/macos/setup/postinstall old mode 100755 new mode 100644 diff --git a/builder/vsphere/iso/builder.go b/builder/vsphere/iso/builder.go index 21e367b37..0cae03611 100644 --- a/builder/vsphere/iso/builder.go +++ b/builder/vsphere/iso/builder.go @@ -2,6 +2,7 @@ package iso import ( "context" + "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/builder/vsphere/common" "github.com/hashicorp/packer/builder/vsphere/driver" packerCommon "github.com/hashicorp/packer/common" @@ -15,14 +16,16 @@ type Builder struct { runner multistep.Runner } -func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { +func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } + +func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { c, warnings, errs := NewConfig(raws...) if errs != nil { - return warnings, errs + return warnings, nil, errs } b.config = c - return warnings, nil + return warnings, nil, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { diff --git a/builder/vsphere/iso/config.go b/builder/vsphere/iso/config.go index 732c0ca36..e5c060519 100644 --- a/builder/vsphere/iso/config.go +++ b/builder/vsphere/iso/config.go @@ -1,9 +1,10 @@ +//go:generate mapstructure-to-hcl2 -type Config + package iso import ( "github.com/hashicorp/packer/builder/vsphere/common" packerCommon "github.com/hashicorp/packer/common" - "github.com/hashicorp/packer/common/bootcommand" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/config" "github.com/hashicorp/packer/packer" @@ -22,12 +23,12 @@ type Config struct { packerCommon.ISOConfig `mapstructure:",squash"` - CDRomConfig `mapstructure:",squash"` - FloppyConfig `mapstructure:",squash"` - common.RunConfig `mapstructure:",squash"` - bootcommand.BootConfig `mapstructure:",squash"` - common.WaitIpConfig `mapstructure:",squash"` - Comm communicator.Config `mapstructure:",squash"` + CDRomConfig `mapstructure:",squash"` + FloppyConfig `mapstructure:",squash"` + common.RunConfig `mapstructure:",squash"` + BootConfig `mapstructure:",squash"` + common.WaitIpConfig `mapstructure:",squash"` + Comm communicator.Config `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"` diff --git a/builder/vsphere/iso/config.hcl2spec.go b/builder/vsphere/iso/config.hcl2spec.go new file mode 100644 index 000000000..7ea8949ca --- /dev/null +++ b/builder/vsphere/iso/config.hcl2spec.go @@ -0,0 +1,238 @@ +// Code generated by "mapstructure-to-hcl2 -type Config"; DO NOT EDIT. +package iso + +import ( + "github.com/hashicorp/hcl/v2/hcldec" + "github.com/zclconf/go-cty/cty" +) + +// FlatConfig is an auto-generated flat version of Config. +// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up. +type FlatConfig struct { + PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name"` + PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type"` + PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug"` + PackerForce *bool `mapstructure:"packer_force" cty:"packer_force"` + PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error"` + PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables"` + PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"` + HTTPDir *string `mapstructure:"http_directory" cty:"http_directory"` + HTTPPortMin *int `mapstructure:"http_port_min" cty:"http_port_min"` + HTTPPortMax *int `mapstructure:"http_port_max" cty:"http_port_max"` + VCenterServer *string `mapstructure:"vcenter_server" cty:"vcenter_server"` + Username *string `mapstructure:"username" cty:"username"` + Password *string `mapstructure:"password" cty:"password"` + InsecureConnection *bool `mapstructure:"insecure_connection" cty:"insecure_connection"` + Datacenter *string `mapstructure:"datacenter" cty:"datacenter"` + Version *uint `mapstructure:"vm_version" cty:"vm_version"` + GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type"` + Firmware *string `mapstructure:"firmware" cty:"firmware"` + DiskControllerType *string `mapstructure:"disk_controller_type" cty:"disk_controller_type"` + DiskSize *int64 `mapstructure:"disk_size" cty:"disk_size"` + DiskThinProvisioned *bool `mapstructure:"disk_thin_provisioned" cty:"disk_thin_provisioned"` + Network *string `mapstructure:"network" cty:"network"` + NetworkCard *string `mapstructure:"network_card" cty:"network_card"` + USBController *bool `mapstructure:"usb_controller" cty:"usb_controller"` + Notes *string `mapstructure:"notes" cty:"notes"` + VMName *string `mapstructure:"vm_name" cty:"vm_name"` + Folder *string `mapstructure:"folder" cty:"folder"` + Cluster *string `mapstructure:"cluster" cty:"cluster"` + Host *string `mapstructure:"host" cty:"host"` + ResourcePool *string `mapstructure:"resource_pool" cty:"resource_pool"` + Datastore *string `mapstructure:"datastore" cty:"datastore"` + CPUs *int32 `mapstructure:"CPUs" cty:"CPUs"` + CpuCores *int32 `mapstructure:"cpu_cores" cty:"cpu_cores"` + CPUReservation *int64 `mapstructure:"CPU_reservation" cty:"CPU_reservation"` + CPULimit *int64 `mapstructure:"CPU_limit" cty:"CPU_limit"` + CpuHotAddEnabled *bool `mapstructure:"CPU_hot_plug" cty:"CPU_hot_plug"` + RAM *int64 `mapstructure:"RAM" cty:"RAM"` + RAMReservation *int64 `mapstructure:"RAM_reservation" cty:"RAM_reservation"` + RAMReserveAll *bool `mapstructure:"RAM_reserve_all" cty:"RAM_reserve_all"` + MemoryHotAddEnabled *bool `mapstructure:"RAM_hot_plug" cty:"RAM_hot_plug"` + VideoRAM *int64 `mapstructure:"video_ram" cty:"video_ram"` + NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV"` + ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters"` + ISOChecksum *string `mapstructure:"iso_checksum" required:"true" cty:"iso_checksum"` + ISOChecksumURL *string `mapstructure:"iso_checksum_url" cty:"iso_checksum_url"` + ISOChecksumType *string `mapstructure:"iso_checksum_type" cty:"iso_checksum_type"` + RawSingleISOUrl *string `mapstructure:"iso_url" required:"true" cty:"iso_url"` + ISOUrls []string `mapstructure:"iso_urls" cty:"iso_urls"` + TargetPath *string `mapstructure:"iso_target_path" cty:"iso_target_path"` + TargetExtension *string `mapstructure:"iso_target_extension" cty:"iso_target_extension"` + CdromType *string `mapstructure:"cdrom_type" cty:"cdrom_type"` + ISOPaths []string `mapstructure:"iso_paths" cty:"iso_paths"` + FloppyIMGPath *string `mapstructure:"floppy_img_path" cty:"floppy_img_path"` + FloppyFiles []string `mapstructure:"floppy_files" cty:"floppy_files"` + FloppyDirectories []string `mapstructure:"floppy_dirs" cty:"floppy_dirs"` + BootOrder *string `mapstructure:"boot_order" cty:"boot_order"` + BootCommand []string `mapstructure:"boot_command" cty:"boot_command"` + BootWait *string `mapstructure:"boot_wait" cty:"boot_wait"` + HTTPIP *string `mapstructure:"http_ip" cty:"http_ip"` + WaitTimeout *string `mapstructure:"ip_wait_timeout" cty:"ip_wait_timeout"` + SettleTimeout *string `mapstructure:"ip_settle_timeout" cty:"ip_settle_timeout"` + Type *string `mapstructure:"communicator" cty:"communicator"` + PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"` + SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host"` + SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port"` + SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username"` + SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password"` + SSHKeyPairName *string `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"` + SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"` + SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"` + SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"` + SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty"` + SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout"` + SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"` + SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"` + SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"` + SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"` + SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"` + SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"` + SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"` + SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"` + SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"` + SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"` + SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"` + SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"` + SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"` + SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"` + SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"` + SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"` + SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"` + SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"` + SSHPublicKey []byte `mapstructure:"ssh_public_key" cty:"ssh_public_key"` + SSHPrivateKey []byte `mapstructure:"ssh_private_key" cty:"ssh_private_key"` + WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username"` + WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password"` + WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host"` + WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port"` + WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout"` + WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"` + WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure"` + WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"` + Command *string `mapstructure:"shutdown_command" cty:"shutdown_command"` + Timeout *string `mapstructure:"shutdown_timeout" cty:"shutdown_timeout"` + CreateSnapshot *bool `mapstructure:"create_snapshot" cty:"create_snapshot"` + ConvertToTemplate *bool `mapstructure:"convert_to_template" cty:"convert_to_template"` +} + +// FlatMapstructure returns a new FlatConfig. +// FlatConfig is an auto-generated flat version of Config. +// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up. +func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } { + return new(FlatConfig) +} + +// HCL2Spec returns the hcl spec of a Config. +// This spec is used by HCL to read the fields of Config. +// The decoded values from this spec will then be applied to a FlatConfig. +func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { + s := map[string]hcldec.Spec{ + "packer_build_name": &hcldec.AttrSpec{Name: "packer_build_name", Type: cty.String, Required: false}, + "packer_builder_type": &hcldec.AttrSpec{Name: "packer_builder_type", Type: cty.String, Required: false}, + "packer_debug": &hcldec.AttrSpec{Name: "packer_debug", Type: cty.Bool, Required: false}, + "packer_force": &hcldec.AttrSpec{Name: "packer_force", Type: cty.Bool, Required: false}, + "packer_on_error": &hcldec.AttrSpec{Name: "packer_on_error", Type: cty.String, Required: false}, + "packer_user_variables": &hcldec.BlockAttrsSpec{TypeName: "packer_user_variables", ElementType: cty.String, Required: false}, + "packer_sensitive_variables": &hcldec.AttrSpec{Name: "packer_sensitive_variables", Type: cty.List(cty.String), Required: false}, + "http_directory": &hcldec.AttrSpec{Name: "http_directory", Type: cty.String, Required: false}, + "http_port_min": &hcldec.AttrSpec{Name: "http_port_min", Type: cty.Number, Required: false}, + "http_port_max": &hcldec.AttrSpec{Name: "http_port_max", Type: cty.Number, Required: false}, + "vcenter_server": &hcldec.AttrSpec{Name: "vcenter_server", Type: cty.String, Required: false}, + "username": &hcldec.AttrSpec{Name: "username", Type: cty.String, Required: false}, + "password": &hcldec.AttrSpec{Name: "password", Type: cty.String, Required: false}, + "insecure_connection": &hcldec.AttrSpec{Name: "insecure_connection", Type: cty.Bool, Required: false}, + "datacenter": &hcldec.AttrSpec{Name: "datacenter", Type: cty.String, Required: false}, + "vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false}, + "guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false}, + "firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false}, + "disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.String, Required: false}, + "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, + "disk_thin_provisioned": &hcldec.AttrSpec{Name: "disk_thin_provisioned", Type: cty.Bool, Required: false}, + "network": &hcldec.AttrSpec{Name: "network", Type: cty.String, Required: false}, + "network_card": &hcldec.AttrSpec{Name: "network_card", Type: cty.String, Required: false}, + "usb_controller": &hcldec.AttrSpec{Name: "usb_controller", Type: cty.Bool, Required: false}, + "notes": &hcldec.AttrSpec{Name: "notes", Type: cty.String, Required: false}, + "vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false}, + "folder": &hcldec.AttrSpec{Name: "folder", Type: cty.String, Required: false}, + "cluster": &hcldec.AttrSpec{Name: "cluster", Type: cty.String, Required: false}, + "host": &hcldec.AttrSpec{Name: "host", Type: cty.String, Required: false}, + "resource_pool": &hcldec.AttrSpec{Name: "resource_pool", Type: cty.String, Required: false}, + "datastore": &hcldec.AttrSpec{Name: "datastore", Type: cty.String, Required: false}, + "CPUs": &hcldec.AttrSpec{Name: "CPUs", Type: cty.Number, Required: false}, + "cpu_cores": &hcldec.AttrSpec{Name: "cpu_cores", Type: cty.Number, Required: false}, + "CPU_reservation": &hcldec.AttrSpec{Name: "CPU_reservation", Type: cty.Number, Required: false}, + "CPU_limit": &hcldec.AttrSpec{Name: "CPU_limit", Type: cty.Number, Required: false}, + "CPU_hot_plug": &hcldec.AttrSpec{Name: "CPU_hot_plug", Type: cty.Bool, Required: false}, + "RAM": &hcldec.AttrSpec{Name: "RAM", Type: cty.Number, Required: false}, + "RAM_reservation": &hcldec.AttrSpec{Name: "RAM_reservation", Type: cty.Number, Required: false}, + "RAM_reserve_all": &hcldec.AttrSpec{Name: "RAM_reserve_all", Type: cty.Bool, Required: false}, + "RAM_hot_plug": &hcldec.AttrSpec{Name: "RAM_hot_plug", Type: cty.Bool, Required: false}, + "video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false}, + "NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false}, + "configuration_parameters": &hcldec.BlockAttrsSpec{TypeName: "configuration_parameters", ElementType: cty.String, Required: false}, + "iso_checksum": &hcldec.AttrSpec{Name: "iso_checksum", Type: cty.String, Required: false}, + "iso_checksum_url": &hcldec.AttrSpec{Name: "iso_checksum_url", Type: cty.String, Required: false}, + "iso_checksum_type": &hcldec.AttrSpec{Name: "iso_checksum_type", Type: cty.String, Required: false}, + "iso_url": &hcldec.AttrSpec{Name: "iso_url", Type: cty.String, Required: false}, + "iso_urls": &hcldec.AttrSpec{Name: "iso_urls", Type: cty.List(cty.String), Required: false}, + "iso_target_path": &hcldec.AttrSpec{Name: "iso_target_path", Type: cty.String, Required: false}, + "iso_target_extension": &hcldec.AttrSpec{Name: "iso_target_extension", Type: cty.String, Required: false}, + "cdrom_type": &hcldec.AttrSpec{Name: "cdrom_type", Type: cty.String, Required: false}, + "iso_paths": &hcldec.AttrSpec{Name: "iso_paths", Type: cty.List(cty.String), Required: false}, + "floppy_img_path": &hcldec.AttrSpec{Name: "floppy_img_path", Type: cty.String, Required: false}, + "floppy_files": &hcldec.AttrSpec{Name: "floppy_files", Type: cty.List(cty.String), Required: false}, + "floppy_dirs": &hcldec.AttrSpec{Name: "floppy_dirs", Type: cty.List(cty.String), Required: false}, + "boot_order": &hcldec.AttrSpec{Name: "boot_order", Type: cty.String, Required: false}, + "boot_command": &hcldec.AttrSpec{Name: "boot_command", Type: cty.List(cty.String), Required: false}, + "boot_wait": &hcldec.AttrSpec{Name: "boot_wait", Type: cty.String, Required: false}, + "http_ip": &hcldec.AttrSpec{Name: "http_ip", Type: cty.String, Required: false}, + "ip_wait_timeout": &hcldec.AttrSpec{Name: "ip_wait_timeout", Type: cty.String, Required: false}, + "ip_settle_timeout": &hcldec.AttrSpec{Name: "ip_settle_timeout", Type: cty.String, Required: false}, + "communicator": &hcldec.AttrSpec{Name: "communicator", Type: cty.String, Required: false}, + "pause_before_connecting": &hcldec.AttrSpec{Name: "pause_before_connecting", Type: cty.String, Required: false}, + "ssh_host": &hcldec.AttrSpec{Name: "ssh_host", Type: cty.String, Required: false}, + "ssh_port": &hcldec.AttrSpec{Name: "ssh_port", Type: cty.Number, Required: false}, + "ssh_username": &hcldec.AttrSpec{Name: "ssh_username", Type: cty.String, Required: false}, + "ssh_password": &hcldec.AttrSpec{Name: "ssh_password", Type: cty.String, Required: false}, + "ssh_keypair_name": &hcldec.AttrSpec{Name: "ssh_keypair_name", Type: cty.String, Required: false}, + "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false}, + "ssh_clear_authorized_keys": &hcldec.AttrSpec{Name: "ssh_clear_authorized_keys", Type: cty.Bool, Required: false}, + "ssh_private_key_file": &hcldec.AttrSpec{Name: "ssh_private_key_file", Type: cty.String, Required: false}, + "ssh_pty": &hcldec.AttrSpec{Name: "ssh_pty", Type: cty.Bool, Required: false}, + "ssh_timeout": &hcldec.AttrSpec{Name: "ssh_timeout", Type: cty.String, Required: false}, + "ssh_agent_auth": &hcldec.AttrSpec{Name: "ssh_agent_auth", Type: cty.Bool, Required: false}, + "ssh_disable_agent_forwarding": &hcldec.AttrSpec{Name: "ssh_disable_agent_forwarding", Type: cty.Bool, Required: false}, + "ssh_handshake_attempts": &hcldec.AttrSpec{Name: "ssh_handshake_attempts", Type: cty.Number, Required: false}, + "ssh_bastion_host": &hcldec.AttrSpec{Name: "ssh_bastion_host", Type: cty.String, Required: false}, + "ssh_bastion_port": &hcldec.AttrSpec{Name: "ssh_bastion_port", Type: cty.Number, Required: false}, + "ssh_bastion_agent_auth": &hcldec.AttrSpec{Name: "ssh_bastion_agent_auth", Type: cty.Bool, Required: false}, + "ssh_bastion_username": &hcldec.AttrSpec{Name: "ssh_bastion_username", Type: cty.String, Required: false}, + "ssh_bastion_password": &hcldec.AttrSpec{Name: "ssh_bastion_password", Type: cty.String, Required: false}, + "ssh_bastion_private_key_file": &hcldec.AttrSpec{Name: "ssh_bastion_private_key_file", Type: cty.String, Required: false}, + "ssh_file_transfer_method": &hcldec.AttrSpec{Name: "ssh_file_transfer_method", Type: cty.String, Required: false}, + "ssh_proxy_host": &hcldec.AttrSpec{Name: "ssh_proxy_host", Type: cty.String, Required: false}, + "ssh_proxy_port": &hcldec.AttrSpec{Name: "ssh_proxy_port", Type: cty.Number, Required: false}, + "ssh_proxy_username": &hcldec.AttrSpec{Name: "ssh_proxy_username", Type: cty.String, Required: false}, + "ssh_proxy_password": &hcldec.AttrSpec{Name: "ssh_proxy_password", Type: cty.String, Required: false}, + "ssh_keep_alive_interval": &hcldec.AttrSpec{Name: "ssh_keep_alive_interval", Type: cty.String, Required: false}, + "ssh_read_write_timeout": &hcldec.AttrSpec{Name: "ssh_read_write_timeout", Type: cty.String, Required: false}, + "ssh_remote_tunnels": &hcldec.AttrSpec{Name: "ssh_remote_tunnels", Type: cty.List(cty.String), Required: false}, + "ssh_local_tunnels": &hcldec.AttrSpec{Name: "ssh_local_tunnels", Type: cty.List(cty.String), Required: false}, + "ssh_public_key": &hcldec.AttrSpec{Name: "ssh_public_key", Type: cty.List(cty.Number), Required: false}, + "ssh_private_key": &hcldec.AttrSpec{Name: "ssh_private_key", Type: cty.List(cty.Number), Required: false}, + "winrm_username": &hcldec.AttrSpec{Name: "winrm_username", Type: cty.String, Required: false}, + "winrm_password": &hcldec.AttrSpec{Name: "winrm_password", Type: cty.String, Required: false}, + "winrm_host": &hcldec.AttrSpec{Name: "winrm_host", Type: cty.String, Required: false}, + "winrm_port": &hcldec.AttrSpec{Name: "winrm_port", Type: cty.Number, Required: false}, + "winrm_timeout": &hcldec.AttrSpec{Name: "winrm_timeout", Type: cty.String, Required: false}, + "winrm_use_ssl": &hcldec.AttrSpec{Name: "winrm_use_ssl", Type: cty.Bool, Required: false}, + "winrm_insecure": &hcldec.AttrSpec{Name: "winrm_insecure", Type: cty.Bool, Required: false}, + "winrm_use_ntlm": &hcldec.AttrSpec{Name: "winrm_use_ntlm", Type: cty.Bool, Required: false}, + "shutdown_command": &hcldec.AttrSpec{Name: "shutdown_command", Type: cty.String, Required: false}, + "shutdown_timeout": &hcldec.AttrSpec{Name: "shutdown_timeout", Type: cty.String, Required: false}, + "create_snapshot": &hcldec.AttrSpec{Name: "create_snapshot", Type: cty.Bool, Required: false}, + "convert_to_template": &hcldec.AttrSpec{Name: "convert_to_template", Type: cty.Bool, Required: false}, + } + return s +} diff --git a/builder/vsphere/iso/leak_test.go b/builder/vsphere/iso/leak_test.go deleted file mode 100644 index c7e35604f..000000000 --- a/builder/vsphere/iso/leak_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package iso - -import "testing" -import "go.uber.org/goleak" - -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) -} diff --git a/builder/vsphere/test/test-key.pub b/builder/vsphere/test/test-key.pub old mode 100755 new mode 100644 diff --git a/go.mod b/go.mod index 7faf02788..8a7289ff5 100644 --- a/go.mod +++ b/go.mod @@ -145,13 +145,12 @@ require ( github.com/ufilesdk-dev/ufile-gosdk v0.0.0-20190830075812-b4dbc4ef43a6 github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 github.com/ulikunitz/xz v0.5.5 - github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 + github.com/vmware/govmomi v0.21.0 github.com/xanzy/go-cloudstack v0.0.0-20190526095453-42f262b63ed0 github.com/yandex-cloud/go-genproto v0.0.0-20190916101622-7617782d381e github.com/yandex-cloud/go-sdk v0.0.0-20190916101744-c781afa45829 github.com/zclconf/go-cty v1.1.2-0.20191126233707-f0f7fd24c4af go.opencensus.io v0.22.2 // indirect - go.uber.org/goleak v1.0.0 golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e golang.org/x/exp v0.0.0-20191129062945-2f5052295587 // indirect golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect diff --git a/go.sum b/go.sum index 018566778..ba8e78e84 100644 --- a/go.sum +++ b/go.sum @@ -107,6 +107,7 @@ github.com/creack/goselect v0.1.0/go.mod h1:gHrIcH/9UZDn2qgeTUeW5K9eZsVYCH6/60J/ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/digitalocean/go-libvirt v0.0.0-20190626172931-4d226dd6c437 h1:phR13shVFOIpa1pnLBmewI9p16NEladLPvVylLPeexo= @@ -196,6 +197,7 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9 h1:JM174NTeGNJ2m/oLH3UOWOvWQQKd+BoL3hcSCUWFLt0= github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= +github.com/google/uuid v0.0.0-20170306145142-6a5e28554805/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -459,8 +461,9 @@ github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 h1:s5pyxd5S6wRs2WpEE0xRfWUF46Wbz44h203KnbX0ecI= -github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/vmware/govmomi v0.21.0 h1:jc8uMuxpcV2xMAA/cnEDlnsIjvqcMra5Y8onh/U3VuY= +github.com/vmware/govmomi v0.21.0/go.mod h1:zbnFoBQ9GIjs2RVETy8CNEpb+L+Lwkjs3XZUL0B3/m0= +github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= github.com/xanzy/go-cloudstack v0.0.0-20190526095453-42f262b63ed0 h1:NJrcIkdzq0C3I8ypAZwFE9RHtGbfp+mJvqIcoFATZuk= github.com/xanzy/go-cloudstack v0.0.0-20190526095453-42f262b63ed0/go.mod h1:sBh287mCRwCz6zyXHMmw7sSZGPohVpnx+o+OY4M+i3A= github.com/yandex-cloud/go-genproto v0.0.0-20190916101622-7617782d381e h1:hzwq5GUKP0aQzDja1XP4sBYyOmnezs/RVtzP+xiLbfI= @@ -478,8 +481,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= -go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -613,7 +614,6 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190909214602-067311248421/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/vendor/github.com/vmware/govmomi/.drone.sec b/vendor/github.com/vmware/govmomi/.drone.sec deleted file mode 100644 index ad52e59ac..000000000 --- a/vendor/github.com/vmware/govmomi/.drone.sec +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.kK6pryC8R-O1R0Gj9ydLvQuIZlcYLGze23WdW7xbpiEEKdz6nweJrMm7ysy8lgu1tM47JVo19p2_b26bNKSQshCUOETvd7Hb2UMZOjnyUnqdyAAyoi6UkIquXfUUbHTNS0iMxwSxxW9KMp2GXNq8-o6T8xQZTDirBJFKKd8ZNUasTaoa5j8U9IfdR1aCavTBuOhvk8IVs-jSbY5TVJMJiE0IOPXois7aRJ6uAiANQBk9VKLegEcZD_qAewecXHDsHi-u0jbmg3o3PPaJaK_Qv5dsPlR2M-E2kE3AGUn0-zn5zYRngoAZ8WZr2O4GvLdltJKq9i2z7jOrdOzzRcDRow.96qvwl_E1Hj15u7Q.hWs-jQ8FsqQFD7pE9N-UEP1BWQ9rsJIcCaPvQRIp8Fukm_vvlw9YEaEq0ERLrsUWsJWpd1ca8_h8x7xD6f_d5YppwRqRHIeGIsdBOTMhNs0lG8ikkQXLat-UroCpy8EC17nuUtDE2E2Kdxrk4Cdd6Bk-dKk0Ta4w3Ud0YBKa.P8zrO7xizgv0i98eVWWzEg \ No newline at end of file diff --git a/vendor/github.com/vmware/govmomi/.drone.yml b/vendor/github.com/vmware/govmomi/.drone.yml deleted file mode 100644 index dee4bf5b3..000000000 --- a/vendor/github.com/vmware/govmomi/.drone.yml +++ /dev/null @@ -1,17 +0,0 @@ -clone: - tags: true - path: github.com/vmware/govmomi -build: - image: golang:1.7 - pull: true - environment: - - GOVC_TEST_URL=$$GOVC_TEST_URL - - GOVC_INSECURE=1 - - VCA=1 - commands: - - make all install - - git clone https://github.com/sstephenson/bats.git /tmp/bats - - /tmp/bats/install.sh /usr/local - - apt-get -qq update && apt-get install -yqq uuid-runtime bsdmainutils jq - - govc/test/images/update.sh - - bats govc/test diff --git a/vendor/github.com/vmware/govmomi/.gitignore b/vendor/github.com/vmware/govmomi/.gitignore index 769c24400..71b0b8426 100644 --- a/vendor/github.com/vmware/govmomi/.gitignore +++ b/vendor/github.com/vmware/govmomi/.gitignore @@ -1 +1,6 @@ secrets.yml +dist/ +.idea/ + +# Ignore editor temp files +*~ diff --git a/vendor/github.com/vmware/govmomi/.goreleaser.yml b/vendor/github.com/vmware/govmomi/.goreleaser.yml new file mode 100644 index 000000000..6a374cd9b --- /dev/null +++ b/vendor/github.com/vmware/govmomi/.goreleaser.yml @@ -0,0 +1,118 @@ +--- +project_name: govmomi +builds: +- id: govc + goos: + - linux + - darwin + - windows + - freebsd + goarch: + - amd64 + - 386 + - arm64 + env: + - CGO_ENABLED=0 + main: ./govc/main.go + binary: govc + flags: -compiler gc + ldflags: -X github.com/vmware/govmomi/govc/flags.GitVersion={{.Version}} +- id: vcsim + goos: + - linux + - darwin + - windows + - freebsd + goarch: + - amd64 + - 386 + - arm64 + env: + - CGO_ENABLED=0 + main: ./vcsim/main.go + binary: vcsim + flags: -compiler gc + ldflags: -X github.com/vmware/govmomi/vcsim/flags.GitVersion={{.Version}} +archives: +- id: govcbuild + builds: ['govc'] + name_template: 'govc_{{ .Os }}_{{ .Arch }}' + format: gz + format_overrides: + - goos: windows + format: zip + files: + - none* +- id: vcsimbuild + builds: ['vcsim'] + name_template: 'vcsim_{{ .Os }}_{{ .Arch }}' + format: gz + format_overrides: + - goos: windows + format: zip + files: + - none* +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - Merge pull request + - Merge branch +brews: + - name: govc + ids: + - govc + github: + owner: govmomi + name: homebrew-tap + commit_author: + name: Alfred the Narwhal + email: cna-alfred@vmware.com + folder: Formula + homepage: "https://github.com/vmware/govmomi/blob/master/govc/README.md" + description: "govc is a vSphere CLI built on top of govmomi." + test: | + system "#{bin}/govc version" + install: | + bin.install "govc" + - name: vcsim + ids: + - vcsim + github: + owner: govmomi + name: homebrew-tap + commit_author: + name: Alfred the Narwhal + email: cna-alfred@vmware.com + folder: Formula + homepage: "https://github.com/vmware/govmomi/blob/master/vcsim/README.md" + description: "vcsim is a vSphere API simulator built on top of govmomi." + test: | + system "#{bin}/vcsim -h" + install: | + bin.install "vcsim" +dockers: +- image_templates: + - "vmware/govc:{{ .Tag }}" + - "vmware/govc:v{{ .Major }}" + - "vmware/govc:v{{ .Major }}.{{ .Minor }}" + - "vmware/govc:latest" + goos: linux + goarch: amd64 + dockerfile: Dockerfile.govc + binaries: + - govc +- image_templates: + - "vmware/vcsim:{{ .Tag }}" + - "vmware/vcsim:v{{ .Major }}" + - "vmware/vcsim:v{{ .Major }}.{{ .Minor }}" + - "vmware/vcsim:latest" + goos: linux + goarch: amd64 + dockerfile: Dockerfile.vcsim + binaries: + - vcsim diff --git a/vendor/github.com/vmware/govmomi/.mailmap b/vendor/github.com/vmware/govmomi/.mailmap index b6f07fac3..705bc72c3 100644 --- a/vendor/github.com/vmware/govmomi/.mailmap +++ b/vendor/github.com/vmware/govmomi/.mailmap @@ -1,17 +1,29 @@ +Amanda H. L. de Andrade <amanda.andrade@serpro.gov.br> amandahla <amanda.andrade@serpro.gov.br> +Amanda H. L. de Andrade <amanda.andrade@serpro.gov.br> Amanda Hager Lopes de Andrade Katz <amanda.katz@serpro.gov.br> Amit Bathla <abathla@.vmware.com> <abathla@promb-1s-dhcp216.eng.vmware.com> +Andrew Kutz <akutz@vmware.com> akutz <akutz@vmware.com> +Andrew Kutz <akutz@vmware.com> <sakutz@gmail.com> +Andrew Kutz <akutz@vmware.com> Andrew Kutz <101085+akutz@users.noreply.github.com> Bruce Downs <bruceadowns@gmail.com> <bdowns@vmware.com> Bruce Downs <bruceadowns@gmail.com> <bruce.downs@jivesoftware.com> +Bruce Downs <bruceadowns@gmail.com> <bruce.downs@autodesk.com> Clint Greenwood <cgreenwood@vmware.com> <clint.greenwood@gmail.com> Cédric Blomart <cblomart@gmail.com> <cedric.blomart@minfin.fed.be> Cédric Blomart <cblomart@gmail.com> cedric <cblomart@gmail.com> David Stark <dave@davidstark.name> <david.stark@bskyb.com> Eric Gray <egray@vmware.com> <ericgray@users.noreply.github.com> Eric Yutao <eric.yutao@gmail.com> eric <eric.yutao@gmail.com> +Fabio Rapposelli <fabio@vmware.com> <fabio@rapposelli.org> Henrik Hodne <henrik@travis-ci.com> <henrik@hodne.io> Jeremy Canady <jcanady@jackhenry.com> <jcanady@gmail.com> Pieter Noordhuis <pnoordhuis@vmware.com> <pcnoordhuis@gmail.com> Takaaki Furukawa <takaaki.frkw@gmail.com> takaaki.furukawa <takaaki.furukawa@mail.rakuten.com> Takaaki Furukawa <takaaki.frkw@gmail.com> tkak <takaaki.frkw@gmail.com> Vadim Egorov <vegorov@vmware.com> <egorovv@gmail.com> +Anfernee Yongkun Gui <agui@vmware.com> <anfernee.gui@gmail.com> +Anfernee Yongkun Gui <agui@vmware.com> Yongkun Anfernee Gui <agui@vmware.com> Zach Tucker <ztucker@vmware.com> <jzt@users.noreply.github.com> Zee Yang <zeey@vmware.com> <zee.yang@gmail.com> +Jiatong Wang <wjiatong@vmware.com> jiatongw <wjiatong@vmware.com> +Uwe Bessle <Uwe.Bessle@iteratec.de> Uwe Bessle <u.bessle.extern@eos-ts.com> +Uwe Bessle <Uwe.Bessle@iteratec.de> Uwe Bessle <uwe.bessle@web.de> diff --git a/vendor/github.com/vmware/govmomi/.travis.yml b/vendor/github.com/vmware/govmomi/.travis.yml index 23798f283..8c474b77a 100644 --- a/vendor/github.com/vmware/govmomi/.travis.yml +++ b/vendor/github.com/vmware/govmomi/.travis.yml @@ -1,12 +1,95 @@ -sudo: false +# Use the newer Travis-CI build templates based on the +# Ubuntu Linux distribution "Xenial Xerus" release. +os: linux +dist: xenial -language: go +# Disable sudo for all builds by default. This ensures all jobs use +# Travis-CI's containerized build environment unless specified otherwise. +# The container builds have *much* shorter queue times than the VM-based +# build environment on which the sudo builds depend. +sudo: false +services: false -go: - - 1.8 +# Set the version of Go. +language: go +go: 1.12 -before_install: - - make vendor +# Always set the project's Go import path to ensure that forked +# builds get cloned to the correct location. +go_import_path: github.com/vmware/govmomi -script: - - make check test +# Ensure all the jobs know where the temp directory is. +env: + global: TMPDIR=/tmp + +jobs: + include: + + # The "lint" stage runs the various linters against the project. + - &lint-stage + stage: lint + env: LINTER=govet + install: true + script: make "${LINTER}" + + - <<: *lint-stage + env: LINTER=goimports + + # The "build" stage verifies the program can be built against the + # various GOOS and GOARCH combinations found in the Go releaser + # config file, ".goreleaser.yml". + - &build-stage + stage: build + env: GOOS=linux GOARCH=amd64 + install: true + script: make install + + - <<: *build-stage + env: GOOS=linux GOARCH=386 + + - <<: *build-stage + env: GOOS=darwin GOARCH=amd64 + - <<: *build-stage + env: GOOS=darwin GOARCH=386 + + - <<: *build-stage + env: GOOS=freebsd GOARCH=amd64 + - <<: *build-stage + env: GOOS=freebsd GOARCH=386 + + - <<: *build-stage + env: GOOS=windows GOARCH=amd64 + - <<: *build-stage + env: GOOS=windows GOARCH=386 + + # The test stage executes the test target. + - stage: test + install: true + script: make test + + # The deploy stage deploys the build artifacts using goreleaser. + # + # This stage will only be activated when there is an annotated tag present + # or when the text "/ci-deploy" is present in the commit message. However, + # the "deploy" phase of the build will still only be executed on non-PR + # builds as that restriction is baked into Travis-CI. + # + # Finally, this stage requires the Travis-CI VM infrastructure in order to + # leverage Docker. This will increase the amount of time the jobs sit + # in the queue, waiting to be built. However, it's a necessity as Travis-CI + # only allows the use of Docker with VM builds. + - stage: deploy + if: tag IS present OR commit_message =~ /\/ci-deploy/ + sudo: required + services: docker + install: true + script: make install + after_success: docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}" + deploy: + - provider: script + skip_cleanup: true + script: curl -sL http://git.io/goreleaser | bash + addons: + apt: + update: true + packages: xmlstarlet diff --git a/vendor/github.com/vmware/govmomi/CHANGELOG.md b/vendor/github.com/vmware/govmomi/CHANGELOG.md index 2dc436bf1..af8dde7bc 100644 --- a/vendor/github.com/vmware/govmomi/CHANGELOG.md +++ b/vendor/github.com/vmware/govmomi/CHANGELOG.md @@ -1,5 +1,81 @@ # changelog +### 0.21.0 (2019-07-24) + +* Add vsan package + +* Add vslm (FCD) global catalog support + +* Add content library support + +### 0.20.0 (2019-02-06) + +* Add vslm package for managing First Class Disks + +* Add LoginByToken to session KeepAliveHandler + +### 0.19.0 (2018-09-30) + +* New vapi/rest and and vapi/tags packages + +* Allowing the use of STS for exchanging tokens + +* Add object.VirtualMachine.UUID method + +* SetRootCAs on the soap.Client returns an error for invalid certificates + +* Add ClusterComputeResource.MoveInto method + +### 0.18.0 (2018-05-24) + +* Add VirtualDiskManager wrapper to set UUID + +* Add vmxnet2, pcnet32 and sriov to VirtualDeviceList.EthernetCardTypes + +* Add new vSphere 6.7 APIs + +* Decrease LoginExtensionByCertificate tunnel usage + +* SAML token authentication support via SessionManager.LoginByToken + +* New SSO admin client for managing users + +* New STS client for issuing and renewing SAML tokens + +* New Lookup Service client for discovering endpoints such as STS and ssoadmin + +* Switch from gvt to go dep for managing dependencies + +### 0.17.1 (2018-03-19) + +* vcsim: add Destroy method for Folder and Datacenter types + +* In progress.Reader emit final report on EOF. + +* vcsim: add EventManager.QueryEvents + +### 0.17.0 (2018-02-28) + +* Add HostStorageSystem.AttachScsiLun method + +* Avoid possible panic in Datastore.Stat (#969) + +* Destroy event history collectors (#962) + +* Add VirtualDiskManager.CreateChildDisk method + +### 0.16.0 (2017-11-08) + +* Add support for SOAP request operation ID header + +* Moved ovf helpers from govc import.ovf command to ovf and nfc packages + +* Added guest/toolbox (client) package + +* Added toolbox package and toolbox command + +* Added simulator package and vcsim command + ### 0.15.0 (2017-06-19) * WaitOptions.MaxWaitSeconds is now optional diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS index 22630d95e..93ca21b68 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS @@ -3,34 +3,55 @@ # This script is generated by contributors.sh # +Abhijeet Kasurde <akasurde@redhat.com> abrarshivani <abrarshivani@users.noreply.github.com> +Adam Shannon <adamkshannon@gmail.com> +Alessandro Cortiana <alessandro.cortiana@gmail.com> +Alex Bozhenko <alexbozhenko@fb.com> +Alex Ellis (VMware) <alexellis2@gmail.com> +Alex <puzo2002@gmail.com> Alvaro Miranda <kikitux@gmail.com> -amandahla <amanda.andrade@serpro.gov.br> +Amanda H. L. de Andrade <amanda.andrade@serpro.gov.br> Amit Bathla <abathla@.vmware.com> +amit bezalel <amit.bezalel@hpe.com> +Andrew <AndrewDi@users.noreply.github.com> Andrew Chin <andrew@andrewtchin.com> +Andrew Kutz <akutz@vmware.com> +Andrey Klimentyev <andrey.klimentyev@flant.com> +Anfernee Yongkun Gui <agui@vmware.com> +angystardust <angystardust@users.noreply.github.com> aniketGslab <aniket.shinde@gslab.com> Arran Walker <arran.walker@zopa.com> Aryeh Weinreb <aryehweinreb@gmail.com> Austin Parker <aparker@apprenda.com> Balu Dontu <bdontu@vmware.com> bastienbc <bastien.barbe.creuly@gmail.com> +Benjamin Peterson <benjamin@python.org> Bob Killen <killen.bob@gmail.com> Brad Fitzpatrick <bradfitz@golang.org> Bruce Downs <bruceadowns@gmail.com> Cédric Blomart <cblomart@gmail.com> +Chris Marchesi <chrism@vancluevertech.com> Christian Höltje <docwhat@gerf.org> Clint Greenwood <cgreenwood@vmware.com> +CuiHaozhi <cuihaozhi@chinacloud.com.cn> Danny Lockard <danny.lockard@banno.com> +Dave Smith-Uchida <dsmithuchida@vmware.com> Dave Tucker <dave@dtucker.co.uk> Davide Agnello <dagnello@hp.com> David Stark <dave@davidstark.name> +Davinder Kumar <davinderk@vmware.com> +Deric Crago <deric.crago@gmail.com> Doug MacEachern <dougm@vmware.com> Eloy Coto <eloy.coto@gmail.com> Eric Gray <egray@vmware.com> Eric Yutao <eric.yutao@gmail.com> +Erik Hollensbe <github@hollensbe.org> +Ethan Kaley <ethan.kaley@emc.com> Fabio Rapposelli <fabio@vmware.com> Faiyaz Ahmed <ahmedf@vmware.com> forkbomber <forkbomber@users.noreply.github.com> +freebsdly <qinhuajun@outlook.com> Gavin Gray <gavin@infinio.com> Gavrie Philipson <gavrie.philipson@elastifile.com> George Hicken <ghicken@vmware.com> @@ -38,24 +59,65 @@ Gerrit Renker <Gerrit.Renker@ctl.io> gthombare <gthombare@vmware.com> Hasan Mahmood <mahmoodh@vmware.com> Henrik Hodne <henrik@travis-ci.com> +hui luo <luoh@vmware.com> Isaac Rodman <isaac@eyz.us> Ivan Porto Carrero <icarrero@vmware.com> +James King <james.king@emc.com> Jason Kincl <jkincl@gmail.com> Jeremy Canady <jcanady@jackhenry.com> +jeremy-clerc <jeremy@clerc.io> +Jiatong Wang <wjiatong@vmware.com> +João Pereira <joaodrp@gmail.com> +Jonas Ausevicius <jonas.ausevicius@virtustream.com> +Jorge Sevilla <jorge.sevilla@rstor.io> +kayrus <kay.diam@gmail.com> +Kevin George <georgek@vmware.com> +leslie-qiwa <leslie.qiwa@gmail.com> Louie Jiang <jiangl@vmware.com> +maplain <fangyuanl@vmware.com> Marc Carmier <mcarmier@gmail.com> +Maria Ntalla <maria.ntalla@gmail.com> +Marin Atanasov Nikolov <mnikolov@vmware.com> +Mario Trangoni <mjtrangoni@gmail.com> +Mark Peek <markpeek@vmware.com> +Matt Clay <matt@mystile.com> +Matthew Cosgrove <matthew.cosgrove@dell.com> +Matt Moriarity <matt@mattmoriarity.com> Mevan Samaratunga <mevansam@gmail.com> +Michal Jankowski <mjankowski@vmware.com> +mingwei <mingwei@smartx.com> Nicolas Lamirault <nicolas.lamirault@gmail.com> +Omar Kohl <omarkohl@gmail.com> +Parham Alvani <parham.alvani@gmail.com> +Pierre Gronlier <pierre.gronlier@corp.ovh.com> Pieter Noordhuis <pnoordhuis@vmware.com> +prydin <prydin@vmware.com> +rHermes <teodor_spaeren@riseup.net> +Rowan Jacobs <rojacobs@pivotal.io> runner.mei <runner.mei@gmail.com> S.Çağlar Onur <conur@vmware.com> Sergey Ignatov <sergey.ignatov@jetbrains.com> +Sten Feldman <exile@chamber.ee> +Stepan Mazurov <smazurov@gmail.com> Steve Purcell <steve@sanityinc.com> Takaaki Furukawa <takaaki.frkw@gmail.com> +Tamas Eger <tamas.eger@bitrise.io> +tanishi <tanishi503@gmail.com> Ted Zlatanov <tzz@lifelogs.com> Thibaut Ackermann <thibaut.ackermann@alcatel-lucent.com> +Tim McNamara <tim.mcnamara@canonical.com> +Tjeu Kayim <15987676+TjeuKayim@users.noreply.github.com> +Trevor Dawe <trevor.dawe@gmail.com> +Uwe Bessle <Uwe.Bessle@iteratec.de> Vadim Egorov <vegorov@vmware.com> +Vikram Krishnamurthy <vikramkrishnamu@vmware.com> +Volodymyr Bobyr <pupsua@gmail.com> +William Lam <info.virtuallyghetto@gmail.com> +Witold Krecicki <wpk@culm.net> Yang Yang <yangy@vmware.com> +ykakarap <yuva2811@gmail.com> Yuya Kusakabe <yuya.kusakabe@gmail.com> +Zacharias Taubert <zacharias.taubert@gmail.com> Zach Tucker <ztucker@vmware.com> Zee Yang <zeey@vmware.com> +zyuxin <zyuxin@vmware.com> diff --git a/vendor/github.com/vmware/govmomi/Dockerfile.govc b/vendor/github.com/vmware/govmomi/Dockerfile.govc new file mode 100644 index 000000000..4f84fadaa --- /dev/null +++ b/vendor/github.com/vmware/govmomi/Dockerfile.govc @@ -0,0 +1,4 @@ +FROM scratch +LABEL maintainer="fabio@vmware.com" +COPY govc / +ENTRYPOINT [ "/govc" ] \ No newline at end of file diff --git a/vendor/github.com/vmware/govmomi/Dockerfile.vcsim b/vendor/github.com/vmware/govmomi/Dockerfile.vcsim new file mode 100644 index 000000000..117e9b553 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/Dockerfile.vcsim @@ -0,0 +1,4 @@ +FROM scratch +LABEL maintainer="fabio@vmware.com" +COPY vcsim / +ENTRYPOINT [ "/vcsim" ] \ No newline at end of file diff --git a/vendor/github.com/vmware/govmomi/Gopkg.lock b/vendor/github.com/vmware/govmomi/Gopkg.lock new file mode 100644 index 000000000..f45057fb2 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/Gopkg.lock @@ -0,0 +1,60 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "improvements" + digest = "1:b183578c34fabccaf65f1a57d2efeec2086abdce1446978d69ab3a0016cb750c" + name = "github.com/davecgh/go-xdr" + packages = ["xdr2"] + pruneopts = "NUT" + revision = "4930550ba2e22f87187498acfd78348b15f4e7a8" + source = "https://github.com/rasky/go-xdr" + +[[projects]] + digest = "1:1ab18cf8c2084968d6dca0dd46fbda9efba08664ecd7957b63c7ca57bb2455df" + name = "github.com/google/uuid" + packages = ["."] + pruneopts = "NUT" + revision = "6a5e28554805e78ea6141142aba763936c4761c0" + +[[projects]] + branch = "govmomi" + digest = "1:f49ed6cb2129e9a3ce9dde5037cb243b5849c0ec0c7973b9d1e987872d8b8cc6" + name = "github.com/kr/pretty" + packages = ["."] + pruneopts = "NUT" + revision = "2ee9d7453c02ef7fa518a83ae23644eb8872186a" + source = "https://github.com/dougm/pretty" + +[[projects]] + branch = "master" + digest = "1:c3a7836b5904db0f8b609595b619916a6831cb35b8b714aec39f96d00c6155d8" + name = "github.com/kr/text" + packages = ["."] + pruneopts = "NUT" + revision = "7cafcd837844e784b526369c9bce262804aebc60" + +[[projects]] + branch = "master" + digest = "1:4bea31865971675c482ed875caeabe7d2182dcb47d52900b7da5236d66dc9970" + name = "github.com/vmware/vmw-guestinfo" + packages = [ + "bdoor", + "message", + "vmcheck", + ] + pruneopts = "NUT" + revision = "25eff159a728be87e103a0b8045e08273f4dbec4" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + input-imports = [ + "github.com/davecgh/go-xdr/xdr2", + "github.com/google/uuid", + "github.com/kr/pretty", + "github.com/vmware/vmw-guestinfo/message", + "github.com/vmware/vmw-guestinfo/vmcheck", + ] + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/vmware/govmomi/Gopkg.toml b/vendor/github.com/vmware/govmomi/Gopkg.toml new file mode 100644 index 000000000..4c4d6765e --- /dev/null +++ b/vendor/github.com/vmware/govmomi/Gopkg.toml @@ -0,0 +1,19 @@ +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# Refer to https://github.com/toml-lang/toml for detailed TOML docs. + +[prune] + non-go = true + go-tests = true + unused-packages = true + +[[constraint]] + branch = "improvements" + name = "github.com/davecgh/go-xdr" + source = "https://github.com/rasky/go-xdr" + +[[constraint]] + branch = "govmomi" + name = "github.com/kr/pretty" + source = "https://github.com/dougm/pretty" diff --git a/vendor/github.com/vmware/govmomi/Makefile b/vendor/github.com/vmware/govmomi/Makefile index 9ffd57516..99898f78c 100644 --- a/vendor/github.com/vmware/govmomi/Makefile +++ b/vendor/github.com/vmware/govmomi/Makefile @@ -1,4 +1,5 @@ -.PHONY: test +GO ?= go +pkgs = $(shell $(GO) list ./... | grep -v 'github.com/vmware/govmomi/vim25/xml') all: check test @@ -6,19 +7,26 @@ check: goimports govet goimports: @echo checking go imports... - @go get golang.org/x/tools/cmd/goimports + @command -v goimports >/dev/null 2>&1 || $(GO) get golang.org/x/tools/cmd/goimports @! goimports -d . 2>&1 | egrep -v '^$$' govet: @echo checking go vet... - @go tool vet -structtags=false -methods=false $$(find . -mindepth 1 -maxdepth 1 -type d -not -name vendor) - -test: - go test -v $(TEST_OPTS) ./... + @$(GO) vet -structtag=false -methods=false $(pkgs) install: - go install -v github.com/vmware/govmomi/govc - go install -v github.com/vmware/govmomi/vcsim + $(MAKE) -C govc install + $(MAKE) -C vcsim install + +go-test: + GORACE=history_size=5 $(GO) test -timeout 5m -count 1 -race -v $(TEST_OPTS) ./... + +govc-test: install + ./govc/test/images/update.sh + (cd govc/test && ./vendor/github.com/sstephenson/bats/libexec/bats -t .) + +.PHONY: test +test: go-test govc-test doc: install ./govc/usage.sh > ./govc/USAGE.md diff --git a/vendor/github.com/vmware/govmomi/README.md b/vendor/github.com/vmware/govmomi/README.md index b5978ddb0..d1764705d 100644 --- a/vendor/github.com/vmware/govmomi/README.md +++ b/vendor/github.com/vmware/govmomi/README.md @@ -5,14 +5,19 @@ A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter). -For `govc`, a CLI built on top of govmomi, check out the [govc](./govc) directory and [USAGE](./govc/USAGE.md) document. +In addition to the vSphere API client, this repository includes: + +* [govc](./govc) - vSphere CLI + +* [vcsim](./vcsim) - vSphere API mock framework + +* [toolbox](./toolbox) - VM guest tools framework ## Compatibility -This library is built for and tested against ESXi and vCenter 5.5, 6.0 and 6.5. +This library is built for and tested against ESXi and vCenter 6.0, 6.5 and 6.7. -If you're able to use it against older versions of ESXi and/or vCenter, please -leave a note and we'll include it in this compatibility list. +It may work with versions 5.5 and 5.1, but neither are officially supported. ## Documentation @@ -25,17 +30,12 @@ See [godoc.org][godoc] for documentation. [apiref]:http://pubs.vmware.com/vsphere-6-5/index.jsp#com.vmware.wssdk.apiref.doc/right-pane.html [godoc]:http://godoc.org/github.com/vmware/govmomi -[drone]:https://drone.io -[dronesrc]:https://github.com/drone/drone -[dronecli]:http://readme.drone.io/devs/cli/ -#### Building with CI -Merges to this repository will trigger builds in both Travis and [Drone][drone]. +## Installation -To build locally with Drone: -- Ensure that you have Docker 1.6 or higher installed. -- Install the [Drone command line tools][dronecli]. -- Run `drone exec` from within the root directory of the govmomi repository. +```sh +go get -u github.com/vmware/govmomi +``` ## Discussion @@ -53,9 +53,21 @@ Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes. * [Docker Machine](https://github.com/docker/machine/tree/master/drivers/vmwarevsphere) +* [Docker InfraKit](https://github.com/docker/infrakit/tree/master/pkg/provider/vsphere) + +* [Docker LinuxKit](https://github.com/linuxkit/linuxkit/tree/master/src/cmd/linuxkit) + * [Kubernetes](https://github.com/kubernetes/kubernetes/tree/master/pkg/cloudprovider/providers/vsphere) -* [Terraform](https://github.com/hashicorp/terraform/tree/master/builtin/providers/vsphere) +* [Kubernetes Cloud Provider](https://github.com/kubernetes/cloud-provider-vsphere) + +* [Kubernetes Cluster API](https://github.com/kubernetes-sigs/cluster-api-provider-vsphere) + +* [Kubernetes kops](https://github.com/kubernetes/kops/tree/master/upup/pkg/fi/cloudup/vsphere) + +* [Terraform](https://github.com/terraform-providers/terraform-provider-vsphere) + +* [Packer](https://github.com/jetbrains-infra/packer-builder-vsphere) * [VMware VIC Engine](https://github.com/vmware/vic) @@ -67,6 +79,12 @@ Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes. * [Libretto](https://github.com/apcera/libretto/tree/master/virtualmachine/vsphere) +* [Telegraf](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/vsphere) + +* [Open Storage](https://github.com/libopenstorage/openstorage/tree/master/pkg/storageops/vsphere) + +* [Juju](https://github.com/juju/juju) + ## Related projects * [rbvmomi](https://github.com/vmware/rbvmomi) @@ -75,4 +93,4 @@ Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes. ## License -govmomi is available under the [Apache 2 license](LICENSE). +govmomi is available under the [Apache 2 license](LICENSE.txt). diff --git a/vendor/github.com/vmware/govmomi/client.go b/vendor/github.com/vmware/govmomi/client.go index e3dc7976a..ad49fe6bf 100644 --- a/vendor/github.com/vmware/govmomi/client.go +++ b/vendor/github.com/vmware/govmomi/client.go @@ -58,7 +58,6 @@ package govmomi import ( "context" - "crypto/tls" "net/url" "github.com/vmware/govmomi/property" @@ -99,41 +98,11 @@ func NewClient(ctx context.Context, u *url.URL, insecure bool) (*Client, error) return c, nil } -// NewClientWithCertificate creates a new client from a URL. The client authenticates with the -// server with the certificate before returning if the URL contains user information. -func NewClientWithCertificate(ctx context.Context, u *url.URL, insecure bool, cert tls.Certificate) (*Client, error) { - soapClient := soap.NewClient(u, insecure) - soapClient.SetCertificate(cert) - vimClient, err := vim25.NewClient(ctx, soapClient) - if err != nil { - return nil, err - } - - c := &Client{ - Client: vimClient, - SessionManager: session.NewManager(vimClient), - } - - if u.User != nil { - err = c.LoginExtensionByCertificate(ctx, u.User.Username(), "") - if err != nil { - return nil, err - } - } - - return c, nil -} - // Login dispatches to the SessionManager. func (c *Client) Login(ctx context.Context, u *url.Userinfo) error { return c.SessionManager.Login(ctx, u) } -// Login dispatches to the SessionManager. -func (c *Client) LoginExtensionByCertificate(ctx context.Context, key string, locale string) error { - return c.SessionManager.LoginExtensionByCertificate(ctx, key, locale) -} - // Logout dispatches to the SessionManager. func (c *Client) Logout(ctx context.Context) error { // Close any idle connections after logging out. diff --git a/vendor/github.com/vmware/govmomi/find/finder.go b/vendor/github.com/vmware/govmomi/find/finder.go index 04d0e891a..a46c70bf5 100644 --- a/vendor/github.com/vmware/govmomi/find/finder.go +++ b/vendor/github.com/vmware/govmomi/find/finder.go @@ -38,16 +38,26 @@ type Finder struct { folders *object.DatacenterFolders } -func NewFinder(client *vim25.Client, all bool) *Finder { +func NewFinder(client *vim25.Client, all ...bool) *Finder { + props := false + if len(all) == 1 { + props = all[0] + } + f := &Finder{ client: client, si: object.NewSearchIndex(client), r: recurser{ Collector: property.DefaultCollector(client), - All: all, + All: props, }, } + if len(all) == 0 { + // attempt to avoid SetDatacenter() requirement + f.dc, _ = f.DefaultDatacenter(context.Background()) + } + return f } @@ -253,7 +263,7 @@ func (f *Finder) managedObjectList(ctx context.Context, path string, tl bool, in fn = f.dcReference } - if len(path) == 0 { + if path == "" { path = "." } @@ -625,6 +635,15 @@ func (f *Finder) ClusterComputeResourceList(ctx context.Context, path string) ([ return ccrs, nil } +func (f *Finder) DefaultClusterComputeResource(ctx context.Context) (*object.ClusterComputeResource, error) { + cr, err := f.ClusterComputeResource(ctx, "*") + if err != nil { + return nil, toDefaultError(err) + } + + return cr, nil +} + func (f *Finder) ClusterComputeResource(ctx context.Context, path string) (*object.ClusterComputeResource, error) { ccrs, err := f.ClusterComputeResourceList(ctx, path) if err != nil { @@ -638,6 +657,18 @@ func (f *Finder) ClusterComputeResource(ctx context.Context, path string) (*obje return ccrs[0], nil } +func (f *Finder) ClusterComputeResourceOrDefault(ctx context.Context, path string) (*object.ClusterComputeResource, error) { + if path != "" { + cr, err := f.ClusterComputeResource(ctx, path) + if err != nil { + return nil, err + } + return cr, nil + } + + return f.DefaultClusterComputeResource(ctx) +} + func (f *Finder) HostSystemList(ctx context.Context, path string) ([]*object.HostSystem, error) { s := &spec{ Relative: f.hostFolder, @@ -695,7 +726,7 @@ func (f *Finder) HostSystem(ctx context.Context, path string) (*object.HostSyste } func (f *Finder) DefaultHostSystem(ctx context.Context) (*object.HostSystem, error) { - hs, err := f.HostSystem(ctx, "*/*") + hs, err := f.HostSystem(ctx, "*") if err != nil { return nil, toDefaultError(err) } @@ -885,6 +916,12 @@ func (f *Finder) DefaultFolder(ctx context.Context) (*object.Folder, error) { } folder := object.NewFolder(f.client, ref.Reference()) + // Set the InventoryPath of the newly created folder object + // The default foler becomes the datacenter's "vm" folder. + // The "vm" folder always exists for a datacenter. It cannot be + // removed or replaced + folder.SetInventoryPath(path.Join(f.dc.InventoryPath, "vm")) + return folder, nil } diff --git a/vendor/github.com/vmware/govmomi/find/recurser.go b/vendor/github.com/vmware/govmomi/find/recurser.go index 806029568..80d958a26 100644 --- a/vendor/github.com/vmware/govmomi/find/recurser.go +++ b/vendor/github.com/vmware/govmomi/find/recurser.go @@ -190,7 +190,7 @@ func (r recurser) List(ctx context.Context, s *spec, root list.Element, parts [] } if !matched { - matched = strings.HasSuffix(e.Path, path.Join(all...)) + matched = strings.HasSuffix(e.Path, "/"+path.Join(all...)) if matched { // name contains a '/' out = append(out, e) diff --git a/vendor/github.com/vmware/govmomi/go.mod b/vendor/github.com/vmware/govmomi/go.mod new file mode 100644 index 000000000..50a00611d --- /dev/null +++ b/vendor/github.com/vmware/govmomi/go.mod @@ -0,0 +1,13 @@ +module github.com/vmware/govmomi + +replace github.com/davecgh/go-xdr => github.com/rasky/go-xdr v0.0.0-20170217172119-4930550ba2e2 + +replace github.com/kr/pretty v0.1.0 => github.com/dougm/pretty v0.0.0-20171025230240-2ee9d7453c02 + +require ( + github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892 + github.com/google/uuid v0.0.0-20170306145142-6a5e28554805 + github.com/kr/pretty v0.1.0 + github.com/kr/text v0.1.0 // indirect + github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728 +) diff --git a/vendor/github.com/vmware/govmomi/go.sum b/vendor/github.com/vmware/govmomi/go.sum new file mode 100644 index 000000000..72b4a8ed2 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/go.sum @@ -0,0 +1,13 @@ +github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892 h1:qg9VbHo1TlL0KDM0vYvBG9EY0X0Yku5WYIPoFWt8f6o= +github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE= +github.com/dougm/pretty v0.0.0-20171025230240-2ee9d7453c02 h1:tR3jsKPiO/mb6ntzk/dJlHZtm37CPfVp1C9KIo534+4= +github.com/dougm/pretty v0.0.0-20171025230240-2ee9d7453c02/go.mod h1:7NQ3kWOx2cZOSjtcveTa5nqupVr2s6/83sG+rTlI7uA= +github.com/google/uuid v0.0.0-20170306145142-6a5e28554805 h1:skl44gU1qEIcRpwKjb9bhlRwjvr96wLdvpTogCBBJe8= +github.com/google/uuid v0.0.0-20170306145142-6a5e28554805/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/rasky/go-xdr v0.0.0-20170217172119-4930550ba2e2 h1:lbe6PJ3nOQAUvpx9P3GtsQ/jyNBOHLV+cj2++uZrpa4= +github.com/rasky/go-xdr v0.0.0-20170217172119-4930550ba2e2/go.mod h1:Nfe4efndBz4TibWycNE+lqyJZiMX4ycx+QKV8Ta0f/o= +github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728 h1:sH9mEk+flyDxiUa5BuPiuhDETMbzrt9A20I2wktMvRQ= +github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= diff --git a/vendor/github.com/vmware/govmomi/nfc/lease.go b/vendor/github.com/vmware/govmomi/nfc/lease.go new file mode 100644 index 000000000..d6c90ac52 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/nfc/lease.go @@ -0,0 +1,233 @@ +/* +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package nfc + +import ( + "context" + "errors" + "fmt" + "io" + "path" + + "github.com/vmware/govmomi/property" + "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" + "github.com/vmware/govmomi/vim25/soap" + "github.com/vmware/govmomi/vim25/types" +) + +type Lease struct { + types.ManagedObjectReference + + c *vim25.Client +} + +func NewLease(c *vim25.Client, ref types.ManagedObjectReference) *Lease { + return &Lease{ref, c} +} + +// Abort wraps methods.Abort +func (l *Lease) Abort(ctx context.Context, fault *types.LocalizedMethodFault) error { + req := types.HttpNfcLeaseAbort{ + This: l.Reference(), + Fault: fault, + } + + _, err := methods.HttpNfcLeaseAbort(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +// Complete wraps methods.Complete +func (l *Lease) Complete(ctx context.Context) error { + req := types.HttpNfcLeaseComplete{ + This: l.Reference(), + } + + _, err := methods.HttpNfcLeaseComplete(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +// GetManifest wraps methods.GetManifest +func (l *Lease) GetManifest(ctx context.Context) error { + req := types.HttpNfcLeaseGetManifest{ + This: l.Reference(), + } + + _, err := methods.HttpNfcLeaseGetManifest(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +// Progress wraps methods.Progress +func (l *Lease) Progress(ctx context.Context, percent int32) error { + req := types.HttpNfcLeaseProgress{ + This: l.Reference(), + Percent: percent, + } + + _, err := methods.HttpNfcLeaseProgress(ctx, l.c, &req) + if err != nil { + return err + } + + return nil +} + +type LeaseInfo struct { + types.HttpNfcLeaseInfo + + Items []FileItem +} + +func (l *Lease) newLeaseInfo(li *types.HttpNfcLeaseInfo, items []types.OvfFileItem) (*LeaseInfo, error) { + info := &LeaseInfo{ + HttpNfcLeaseInfo: *li, + } + + for _, device := range li.DeviceUrl { + u, err := l.c.ParseURL(device.Url) + if err != nil { + return nil, err + } + + if device.SslThumbprint != "" { + // TODO: prefer host management IP + l.c.SetThumbprint(u.Host, device.SslThumbprint) + } + + if len(items) == 0 { + // this is an export + item := types.OvfFileItem{ + DeviceId: device.Key, + Path: device.TargetId, + Size: device.FileSize, + } + + if item.Size == 0 { + item.Size = li.TotalDiskCapacityInKB * 1024 + } + + if item.Path == "" { + item.Path = path.Base(device.Url) + } + + info.Items = append(info.Items, NewFileItem(u, item)) + + continue + } + + // this is an import + for _, item := range items { + if device.ImportKey == item.DeviceId { + info.Items = append(info.Items, NewFileItem(u, item)) + break + } + } + } + + return info, nil +} + +func (l *Lease) Wait(ctx context.Context, items []types.OvfFileItem) (*LeaseInfo, error) { + var lease mo.HttpNfcLease + + pc := property.DefaultCollector(l.c) + err := property.Wait(ctx, pc, l.Reference(), []string{"state", "info", "error"}, func(pc []types.PropertyChange) bool { + done := false + + for _, c := range pc { + if c.Val == nil { + continue + } + + switch c.Name { + case "error": + val := c.Val.(types.LocalizedMethodFault) + lease.Error = &val + done = true + case "info": + val := c.Val.(types.HttpNfcLeaseInfo) + lease.Info = &val + case "state": + lease.State = c.Val.(types.HttpNfcLeaseState) + if lease.State != types.HttpNfcLeaseStateInitializing { + done = true + } + } + } + + return done + }) + + if err != nil { + return nil, err + } + + if lease.State == types.HttpNfcLeaseStateReady { + return l.newLeaseInfo(lease.Info, items) + } + + if lease.Error != nil { + return nil, errors.New(lease.Error.LocalizedMessage) + } + + return nil, fmt.Errorf("unexpected nfc lease state: %s", lease.State) +} + +func (l *Lease) StartUpdater(ctx context.Context, info *LeaseInfo) *LeaseUpdater { + return newLeaseUpdater(ctx, l, info) +} + +func (l *Lease) Upload(ctx context.Context, item FileItem, f io.Reader, opts soap.Upload) error { + if opts.Progress == nil { + opts.Progress = item + } + + // Non-disk files (such as .iso) use the PUT method. + // Overwrite: t header is also required in this case (ovftool does the same) + if item.Create { + opts.Method = "PUT" + opts.Headers = map[string]string{ + "Overwrite": "t", + } + } else { + opts.Method = "POST" + opts.Type = "application/x-vnd.vmware-streamVmdk" + } + + return l.c.Upload(ctx, f, item.URL, &opts) +} + +func (l *Lease) DownloadFile(ctx context.Context, file string, item FileItem, opts soap.Download) error { + if opts.Progress == nil { + opts.Progress = item + } + + return l.c.DownloadFile(ctx, file, item.URL, &opts) +} diff --git a/vendor/github.com/vmware/govmomi/nfc/lease_updater.go b/vendor/github.com/vmware/govmomi/nfc/lease_updater.go new file mode 100644 index 000000000..02ce9cf53 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/nfc/lease_updater.go @@ -0,0 +1,146 @@ +/* +Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package nfc + +import ( + "context" + "log" + "net/url" + "sync" + "sync/atomic" + "time" + + "github.com/vmware/govmomi/vim25/progress" + "github.com/vmware/govmomi/vim25/types" +) + +type FileItem struct { + types.OvfFileItem + URL *url.URL + + ch chan progress.Report +} + +func NewFileItem(u *url.URL, item types.OvfFileItem) FileItem { + return FileItem{ + OvfFileItem: item, + URL: u, + ch: make(chan progress.Report), + } +} + +func (o FileItem) Sink() chan<- progress.Report { + return o.ch +} + +// File converts the FileItem.OvfFileItem to an OvfFile +func (o FileItem) File() types.OvfFile { + return types.OvfFile{ + DeviceId: o.DeviceId, + Path: o.Path, + Size: o.Size, + } +} + +type LeaseUpdater struct { + pos int64 // Number of bytes (keep first to ensure 64 bit alignment) + total int64 // Total number of bytes (keep first to ensure 64 bit alignment) + + lease *Lease + + done chan struct{} // When lease updater should stop + + wg sync.WaitGroup // Track when update loop is done +} + +func newLeaseUpdater(ctx context.Context, lease *Lease, info *LeaseInfo) *LeaseUpdater { + l := LeaseUpdater{ + lease: lease, + + done: make(chan struct{}), + } + + for _, item := range info.Items { + l.total += item.Size + go l.waitForProgress(item) + } + + // Kickstart update loop + l.wg.Add(1) + go l.run() + + return &l +} + +func (l *LeaseUpdater) waitForProgress(item FileItem) { + var pos, total int64 + + total = item.Size + + for { + select { + case <-l.done: + return + case p, ok := <-item.ch: + // Return in case of error + if ok && p.Error() != nil { + return + } + + if !ok { + // Last element on the channel, add to total + atomic.AddInt64(&l.pos, total-pos) + return + } + + // Approximate progress in number of bytes + x := int64(float32(total) * (p.Percentage() / 100.0)) + atomic.AddInt64(&l.pos, x-pos) + pos = x + } + } +} + +func (l *LeaseUpdater) run() { + defer l.wg.Done() + + tick := time.NewTicker(2 * time.Second) + defer tick.Stop() + + for { + select { + case <-l.done: + return + case <-tick.C: + // From the vim api HttpNfcLeaseProgress(percent) doc, percent == + // "Completion status represented as an integer in the 0-100 range." + // Always report the current value of percent, as it will renew the + // lease even if the value hasn't changed or is 0. + percent := int32(float32(100*atomic.LoadInt64(&l.pos)) / float32(l.total)) + err := l.lease.Progress(context.TODO(), percent) + if err != nil { + log.Printf("NFC lease progress: %s", err) + return + } + } + } +} + +func (l *LeaseUpdater) Done() { + close(l.done) + l.wg.Wait() +} diff --git a/vendor/github.com/vmware/govmomi/object/cluster_compute_resource.go b/vendor/github.com/vmware/govmomi/object/cluster_compute_resource.go index 225f41b6d..24c346825 100644 --- a/vendor/github.com/vmware/govmomi/object/cluster_compute_resource.go +++ b/vendor/github.com/vmware/govmomi/object/cluster_compute_resource.go @@ -21,6 +21,7 @@ import ( "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" + "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" ) @@ -34,19 +35,15 @@ func NewClusterComputeResource(c *vim25.Client, ref types.ManagedObjectReference } } -func (c ClusterComputeResource) ReconfigureCluster(ctx context.Context, spec types.ClusterConfigSpec) (*Task, error) { - req := types.ReconfigureCluster_Task{ - This: c.Reference(), - Spec: spec, - Modify: true, - } +func (c ClusterComputeResource) Configuration(ctx context.Context) (*types.ClusterConfigInfoEx, error) { + var obj mo.ClusterComputeResource - res, err := methods.ReconfigureCluster_Task(ctx, c.c, &req) + err := c.Properties(ctx, c.Reference(), []string{"configurationEx"}, &obj) if err != nil { return nil, err } - return NewTask(c.c, res.Returnval), nil + return obj.ConfigurationEx.(*types.ClusterConfigInfoEx), nil } func (c ClusterComputeResource) AddHost(ctx context.Context, spec types.HostConnectSpec, asConnected bool, license *string, resourcePool *types.ManagedObjectReference) (*Task, error) { @@ -72,12 +69,18 @@ func (c ClusterComputeResource) AddHost(ctx context.Context, spec types.HostConn return NewTask(c.c, res.Returnval), nil } -func (c ClusterComputeResource) Destroy(ctx context.Context) (*Task, error) { - req := types.Destroy_Task{ +func (c ClusterComputeResource) MoveInto(ctx context.Context, hosts ...*HostSystem) (*Task, error) { + req := types.MoveInto_Task{ This: c.Reference(), } - res, err := methods.Destroy_Task(ctx, c.c, &req) + hostReferences := make([]types.ManagedObjectReference, len(hosts)) + for i, host := range hosts { + hostReferences[i] = host.Reference() + } + req.Host = hostReferences + + res, err := methods.MoveInto_Task(ctx, c.c, &req) if err != nil { return nil, err } diff --git a/vendor/github.com/vmware/govmomi/object/common.go b/vendor/github.com/vmware/govmomi/object/common.go index 8f0a94ff6..abb4076c7 100644 --- a/vendor/github.com/vmware/govmomi/object/common.go +++ b/vendor/github.com/vmware/govmomi/object/common.go @@ -85,9 +85,22 @@ func (c Common) ObjectName(ctx context.Context) (string, error) { return "", err } - return o.Name, nil + if o.Name != "" { + return o.Name, nil + } + + // Network has its own "name" field... + var n mo.Network + + err = c.Properties(ctx, c.Reference(), []string{"name"}, &n) + if err != nil { + return "", err + } + + return n.Name, nil } +// Properties is a wrapper for property.DefaultCollector().RetrieveOne() func (c Common) Properties(ctx context.Context, r types.ManagedObjectReference, ps []string, dst interface{}) error { return property.DefaultCollector(c.c).RetrieveOne(ctx, r, ps, dst) } @@ -118,3 +131,14 @@ func (c Common) Rename(ctx context.Context, name string) (*Task, error) { return NewTask(c.c, res.Returnval), nil } + +func (c Common) SetCustomValue(ctx context.Context, key string, value string) error { + req := types.SetCustomValue{ + This: c.Reference(), + Key: key, + Value: value, + } + + _, err := methods.SetCustomValue(ctx, c.c, &req) + return err +} diff --git a/vendor/github.com/vmware/govmomi/object/compute_resource.go b/vendor/github.com/vmware/govmomi/object/compute_resource.go index ac1c73019..7645fddaf 100644 --- a/vendor/github.com/vmware/govmomi/object/compute_resource.go +++ b/vendor/github.com/vmware/govmomi/object/compute_resource.go @@ -109,16 +109,3 @@ func (c ComputeResource) Reconfigure(ctx context.Context, spec types.BaseCompute return NewTask(c.c, res.Returnval), nil } - -func (c ComputeResource) Destroy(ctx context.Context) (*Task, error) { - req := types.Destroy_Task{ - This: c.Reference(), - } - - res, err := methods.Destroy_Task(ctx, c.c, &req) - if err != nil { - return nil, err - } - - return NewTask(c.c, res.Returnval), nil -} diff --git a/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go b/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go index 60b78df2b..ef748ef2c 100644 --- a/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go +++ b/vendor/github.com/vmware/govmomi/object/custom_fields_manager.go @@ -102,7 +102,9 @@ func (m CustomFieldsManager) Set(ctx context.Context, entity types.ManagedObject return err } -func (m CustomFieldsManager) Field(ctx context.Context) ([]types.CustomFieldDef, error) { +type CustomFieldDefList []types.CustomFieldDef + +func (m CustomFieldsManager) Field(ctx context.Context) (CustomFieldDefList, error) { var fm mo.CustomFieldsManager err := m.Properties(ctx, m.Reference(), []string{"field"}, &fm) @@ -113,19 +115,19 @@ func (m CustomFieldsManager) Field(ctx context.Context) ([]types.CustomFieldDef, return fm.Field, nil } -func (m CustomFieldsManager) FindKey(ctx context.Context, key string) (int32, error) { +func (m CustomFieldsManager) FindKey(ctx context.Context, name string) (int32, error) { field, err := m.Field(ctx) if err != nil { return -1, err } for _, def := range field { - if def.Name == key { + if def.Name == name { return def.Key, nil } } - k, err := strconv.Atoi(key) + k, err := strconv.Atoi(name) if err == nil { // assume literal int key return int32(k), nil @@ -133,3 +135,12 @@ func (m CustomFieldsManager) FindKey(ctx context.Context, key string) (int32, er return -1, ErrKeyNameNotFound } + +func (l CustomFieldDefList) ByKey(key int32) *types.CustomFieldDef { + for _, def := range l { + if def.Key == key { + return &def + } + } + return nil +} diff --git a/vendor/github.com/vmware/govmomi/object/datacenter.go b/vendor/github.com/vmware/govmomi/object/datacenter.go index adddc5ffa..41fa35265 100644 --- a/vendor/github.com/vmware/govmomi/object/datacenter.go +++ b/vendor/github.com/vmware/govmomi/object/datacenter.go @@ -88,3 +88,42 @@ func (d Datacenter) Destroy(ctx context.Context) (*Task, error) { return NewTask(d.c, res.Returnval), nil } + +// PowerOnVM powers on multiple virtual machines with a single vCenter call. +// If called against ESX, serially powers on the list of VMs and the returned *Task will always be nil. +func (d Datacenter) PowerOnVM(ctx context.Context, vm []types.ManagedObjectReference, option ...types.BaseOptionValue) (*Task, error) { + if d.Client().IsVC() { + req := types.PowerOnMultiVM_Task{ + This: d.Reference(), + Vm: vm, + Option: option, + } + + res, err := methods.PowerOnMultiVM_Task(ctx, d.c, &req) + if err != nil { + return nil, err + } + + return NewTask(d.c, res.Returnval), nil + } + + for _, ref := range vm { + obj := NewVirtualMachine(d.Client(), ref) + task, err := obj.PowerOn(ctx) + if err != nil { + return nil, err + } + + err = task.Wait(ctx) + if err != nil { + // Ignore any InvalidPowerState fault, as it indicates the VM is already powered on + if f, ok := err.(types.HasFault); ok { + if _, ok = f.Fault().(*types.InvalidPowerState); !ok { + return nil, err + } + } + } + } + + return nil, nil +} diff --git a/vendor/github.com/vmware/govmomi/object/datastore.go b/vendor/github.com/vmware/govmomi/object/datastore.go index fc696cdf2..65264ae15 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore.go +++ b/vendor/github.com/vmware/govmomi/object/datastore.go @@ -17,17 +17,16 @@ limitations under the License. package object import ( + "context" "fmt" "io" "math/rand" + "net/http" + "net/url" "os" "path" "strings" - "context" - "net/http" - "net/url" - "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/session" "github.com/vmware/govmomi/vim25" @@ -69,6 +68,11 @@ func NewDatastore(c *vim25.Client, ref types.ManagedObjectReference) *Datastore } func (d Datastore) Path(path string) string { + var p DatastorePath + if p.FromString(path) { + return p.String() // already in "[datastore] path" format + } + return (&DatastorePath{ Datastore: d.Name(), Path: path, @@ -284,7 +288,7 @@ func (d Datastore) Upload(ctx context.Context, f io.Reader, path string, param * if err != nil { return err } - return d.Client().Upload(f, u, p) + return d.Client().Upload(ctx, f, u, p) } // UploadFile via soap.Upload with an http service ticket @@ -293,7 +297,7 @@ func (d Datastore) UploadFile(ctx context.Context, file string, path string, par if err != nil { return err } - return d.Client().UploadFile(file, u, p) + return d.Client().UploadFile(ctx, file, u, p) } // Download via soap.Download with an http service ticket @@ -302,7 +306,7 @@ func (d Datastore) Download(ctx context.Context, path string, param *soap.Downlo if err != nil { return nil, 0, err } - return d.Client().Download(u, p) + return d.Client().Download(ctx, u, p) } // DownloadFile via soap.Download with an http service ticket @@ -311,7 +315,7 @@ func (d Datastore) DownloadFile(ctx context.Context, path string, file string, p if err != nil { return err } - return d.Client().DownloadFile(file, u, p) + return d.Client().DownloadFile(ctx, file, u, p) } // AttachedHosts returns hosts that have this Datastore attached, accessible and writable. @@ -406,12 +410,9 @@ func (d Datastore) Stat(ctx context.Context, file string) (types.BaseFileInfo, e info, err := task.WaitForResult(ctx, nil) if err != nil { - if info == nil || info.Error != nil { - _, ok := info.Error.Fault.(*types.FileNotFound) - if ok { - // FileNotFound means the base path doesn't exist. - return nil, DatastoreNoSuchDirectoryError{"stat", dsPath} - } + if types.IsFileNotFound(err) { + // FileNotFound means the base path doesn't exist. + return nil, DatastoreNoSuchDirectoryError{"stat", dsPath} } return nil, err diff --git a/vendor/github.com/vmware/govmomi/object/datastore_file.go b/vendor/github.com/vmware/govmomi/object/datastore_file.go index d4813a756..86d7d9c72 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_file.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_file.go @@ -25,6 +25,7 @@ import ( "net/http" "os" "path" + "sync" "time" "github.com/vmware/govmomi/vim25/soap" @@ -171,7 +172,7 @@ func (f *DatastoreFile) Stat() (os.FileInfo, error) { return nil, err } - res, err := f.d.Client().DownloadRequest(u, p) + res, err := f.d.Client().DownloadRequest(f.ctx, u, p) if err != nil { return nil, err } @@ -201,7 +202,7 @@ func (f *DatastoreFile) get() (io.Reader, error) { } } - res, err := f.d.Client().DownloadRequest(u, p) + res, err := f.d.Client().DownloadRequest(f.ctx, u, p) if err != nil { return nil, err } @@ -296,10 +297,8 @@ func (f *DatastoreFile) TailFunc(lines int, include func(line int, message strin nread = bsize + remain eof = true - } else { - if pos, err = f.Seek(offset, io.SeekEnd); err != nil { - return err - } + } else if pos, err = f.Seek(offset, io.SeekEnd); err != nil { + return err } if _, err = io.CopyN(buf, f, nread); err != nil { @@ -347,6 +346,7 @@ type followDatastoreFile struct { r *DatastoreFile c chan struct{} i time.Duration + o sync.Once } // Read reads up to len(b) bytes from the DatastoreFile being followed. @@ -398,11 +398,15 @@ func (f *followDatastoreFile) Read(p []byte) (int, error) { // Close will stop Follow polling and close the underlying DatastoreFile. func (f *followDatastoreFile) Close() error { - close(f.c) + f.o.Do(func() { close(f.c) }) return nil } // Follow returns an io.ReadCloser to stream the file contents as data is appended. func (f *DatastoreFile) Follow(interval time.Duration) io.ReadCloser { - return &followDatastoreFile{f, make(chan struct{}), interval} + return &followDatastoreFile{ + r: f, + c: make(chan struct{}), + i: interval, + } } diff --git a/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go b/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go index 7164fbbed..a6e29c2c5 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_file_manager.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2017-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import ( "path" "strings" + "github.com/vmware/govmomi/vim25/progress" "github.com/vmware/govmomi/vim25/soap" ) @@ -36,7 +37,8 @@ type DatastoreFileManager struct { FileManager *FileManager VirtualDiskManager *VirtualDiskManager - Force bool + Force bool + DatacenterTarget *Datacenter } // NewFileManager creates a new instance of DatastoreFileManager @@ -49,11 +51,25 @@ func (d Datastore) NewFileManager(dc *Datacenter, force bool) *DatastoreFileMana FileManager: NewFileManager(c), VirtualDiskManager: NewVirtualDiskManager(c), Force: force, + DatacenterTarget: dc, } return m } +func (m *DatastoreFileManager) WithProgress(ctx context.Context, s progress.Sinker) context.Context { + return context.WithValue(ctx, m, s) +} + +func (m *DatastoreFileManager) wait(ctx context.Context, task *Task) error { + var logger progress.Sinker + if s, ok := ctx.Value(m).(progress.Sinker); ok { + logger = s + } + _, err := task.WaitForResult(ctx, logger) + return err +} + // Delete dispatches to the appropriate Delete method based on file name extension func (m *DatastoreFileManager) Delete(ctx context.Context, name string) error { switch path.Ext(name) { @@ -73,7 +89,7 @@ func (m *DatastoreFileManager) DeleteFile(ctx context.Context, name string) erro return err } - return task.Wait(ctx) + return m.wait(ctx, task) } // DeleteVirtualDisk calls VirtualDiskManager.DeleteVirtualDisk @@ -94,7 +110,74 @@ func (m *DatastoreFileManager) DeleteVirtualDisk(ctx context.Context, name strin return err } - return task.Wait(ctx) + return m.wait(ctx, task) +} + +// CopyFile calls FileManager.CopyDatastoreFile +func (m *DatastoreFileManager) CopyFile(ctx context.Context, src string, dst string) error { + srcp := m.Path(src) + dstp := m.Path(dst) + + task, err := m.FileManager.CopyDatastoreFile(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarget, m.Force) + if err != nil { + return err + } + + return m.wait(ctx, task) +} + +// Copy dispatches to the appropriate FileManager or VirtualDiskManager Copy method based on file name extension +func (m *DatastoreFileManager) Copy(ctx context.Context, src string, dst string) error { + srcp := m.Path(src) + dstp := m.Path(dst) + + f := m.FileManager.CopyDatastoreFile + + if srcp.IsVMDK() { + // types.VirtualDiskSpec=nil as it is not implemented by vCenter + f = func(ctx context.Context, src string, srcDC *Datacenter, dst string, dstDC *Datacenter, force bool) (*Task, error) { + return m.VirtualDiskManager.CopyVirtualDisk(ctx, src, srcDC, dst, dstDC, nil, force) + } + } + + task, err := f(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarget, m.Force) + if err != nil { + return err + } + + return m.wait(ctx, task) +} + +// MoveFile calls FileManager.MoveDatastoreFile +func (m *DatastoreFileManager) MoveFile(ctx context.Context, src string, dst string) error { + srcp := m.Path(src) + dstp := m.Path(dst) + + task, err := m.FileManager.MoveDatastoreFile(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarget, m.Force) + if err != nil { + return err + } + + return m.wait(ctx, task) +} + +// Move dispatches to the appropriate FileManager or VirtualDiskManager Move method based on file name extension +func (m *DatastoreFileManager) Move(ctx context.Context, src string, dst string) error { + srcp := m.Path(src) + dstp := m.Path(dst) + + f := m.FileManager.MoveDatastoreFile + + if srcp.IsVMDK() { + f = m.VirtualDiskManager.MoveVirtualDisk + } + + task, err := f(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarget, m.Force) + if err != nil { + return err + } + + return m.wait(ctx, task) } // Path converts path name to a DatastorePath diff --git a/vendor/github.com/vmware/govmomi/object/datastore_path.go b/vendor/github.com/vmware/govmomi/object/datastore_path.go index ea152103d..104c7dfe3 100644 --- a/vendor/github.com/vmware/govmomi/object/datastore_path.go +++ b/vendor/github.com/vmware/govmomi/object/datastore_path.go @@ -18,6 +18,7 @@ package object import ( "fmt" + "path" "strings" ) @@ -30,7 +31,7 @@ type DatastorePath struct { // FromString parses a datastore path. // Returns true if the path could be parsed, false otherwise. func (p *DatastorePath) FromString(s string) bool { - if len(s) == 0 { + if s == "" { return false } @@ -63,3 +64,8 @@ func (p *DatastorePath) String() string { return strings.Join([]string{s, p.Path}, " ") } + +// IsVMDK returns true if Path has a ".vmdk" extension +func (p *DatastorePath) IsVMDK() bool { + return path.Ext(p.Path) == ".vmdk" +} diff --git a/vendor/github.com/vmware/govmomi/object/diagnostic_manager.go b/vendor/github.com/vmware/govmomi/object/diagnostic_manager.go index 5baf1ad90..026dc1cb5 100644 --- a/vendor/github.com/vmware/govmomi/object/diagnostic_manager.go +++ b/vendor/github.com/vmware/govmomi/object/diagnostic_manager.go @@ -71,10 +71,8 @@ func (m DiagnosticManager) GenerateLogBundles(ctx context.Context, includeDefaul IncludeDefault: includeDefault, } - if host != nil { - for _, h := range host { - req.Host = append(req.Host, h.Reference()) - } + for _, h := range host { + req.Host = append(req.Host, h.Reference()) } res, err := methods.GenerateLogBundles_Task(ctx, m.c, &req) diff --git a/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go b/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go index 864bb783f..f8ac5512c 100644 --- a/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go +++ b/vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go @@ -18,6 +18,7 @@ package object import ( "context" + "fmt" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" @@ -38,12 +39,18 @@ func NewDistributedVirtualPortgroup(c *vim25.Client, ref types.ManagedObjectRefe // EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this DistributedVirtualPortgroup func (p DistributedVirtualPortgroup) EthernetCardBackingInfo(ctx context.Context) (types.BaseVirtualDeviceBackingInfo, error) { var dvp mo.DistributedVirtualPortgroup - var dvs mo.VmwareDistributedVirtualSwitch // TODO: should be mo.BaseDistributedVirtualSwitch + var dvs mo.DistributedVirtualSwitch + prop := "config.distributedVirtualSwitch" - if err := p.Properties(ctx, p.Reference(), []string{"key", "config.distributedVirtualSwitch"}, &dvp); err != nil { + if err := p.Properties(ctx, p.Reference(), []string{"key", prop}, &dvp); err != nil { return nil, err } + // "This property should always be set unless the user's setting does not have System.Read privilege on the object referred to by this property." + if dvp.Config.DistributedVirtualSwitch == nil { + return nil, fmt.Errorf("no System.Read privilege on: %s.%s", p.Reference(), prop) + } + if err := p.Properties(ctx, *dvp.Config.DistributedVirtualSwitch, []string{"uuid"}, &dvs); err != nil { return nil, err } diff --git a/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go b/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go index 29ee52d95..526ce4bf7 100644 --- a/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go +++ b/vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go @@ -65,3 +65,16 @@ func (s DistributedVirtualSwitch) AddPortgroup(ctx context.Context, spec []types return NewTask(s.Client(), res.Returnval), nil } + +func (s DistributedVirtualSwitch) FetchDVPorts(ctx context.Context, criteria *types.DistributedVirtualSwitchPortCriteria) ([]types.DistributedVirtualPort, error) { + req := &types.FetchDVPorts{ + This: s.Reference(), + Criteria: criteria, + } + + res, err := methods.FetchDVPorts(ctx, s.Client(), req) + if err != nil { + return nil, err + } + return res.Returnval, nil +} diff --git a/vendor/github.com/vmware/govmomi/object/file_manager.go b/vendor/github.com/vmware/govmomi/object/file_manager.go index ba947be20..8e8f5d3b0 100644 --- a/vendor/github.com/vmware/govmomi/object/file_manager.go +++ b/vendor/github.com/vmware/govmomi/object/file_manager.go @@ -85,8 +85,8 @@ func (f FileManager) DeleteDatastoreFile(ctx context.Context, name string, dc *D // MakeDirectory creates a folder using the specified name. func (f FileManager) MakeDirectory(ctx context.Context, name string, dc *Datacenter, createParentDirectories bool) error { req := types.MakeDirectory{ - This: f.Reference(), - Name: name, + This: f.Reference(), + Name: name, CreateParentDirectories: types.NewBool(createParentDirectories), } diff --git a/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go b/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go index 2875a9fc1..ddf1d8c59 100644 --- a/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go +++ b/vendor/github.com/vmware/govmomi/object/host_certificate_manager.go @@ -66,7 +66,7 @@ func (m HostCertificateManager) CertificateInfo(ctx context.Context) (*HostCerti // Use InstallServerCertificate to import this certificate. func (m HostCertificateManager) GenerateCertificateSigningRequest(ctx context.Context, useIPAddressAsCommonName bool) (string, error) { req := types.GenerateCertificateSigningRequest{ - This: m.Reference(), + This: m.Reference(), UseIpAddressAsCommonName: useIPAddressAsCommonName, } diff --git a/vendor/github.com/vmware/govmomi/object/host_datastore_system.go b/vendor/github.com/vmware/govmomi/object/host_datastore_system.go index 7b738e611..64f3add91 100644 --- a/vendor/github.com/vmware/govmomi/object/host_datastore_system.go +++ b/vendor/github.com/vmware/govmomi/object/host_datastore_system.go @@ -117,3 +117,19 @@ func (s HostDatastoreSystem) QueryVmfsDatastoreCreateOptions(ctx context.Context return res.Returnval, nil } + +func (s HostDatastoreSystem) ResignatureUnresolvedVmfsVolumes(ctx context.Context, devicePaths []string) (*Task, error) { + req := &types.ResignatureUnresolvedVmfsVolume_Task{ + This: s.Reference(), + ResolutionSpec: types.HostUnresolvedVmfsResignatureSpec{ + ExtentDevicePath: devicePaths, + }, + } + + res, err := methods.ResignatureUnresolvedVmfsVolume_Task(ctx, s.Client(), req) + if err != nil { + return nil, err + } + + return NewTask(s.c, res.Returnval), nil +} diff --git a/vendor/github.com/vmware/govmomi/object/host_network_system.go b/vendor/github.com/vmware/govmomi/object/host_network_system.go index c21e1ec35..340b764a5 100644 --- a/vendor/github.com/vmware/govmomi/object/host_network_system.go +++ b/vendor/github.com/vmware/govmomi/object/host_network_system.go @@ -98,18 +98,18 @@ func (o HostNetworkSystem) AddVirtualSwitch(ctx context.Context, vswitchName str } // QueryNetworkHint wraps methods.QueryNetworkHint -func (o HostNetworkSystem) QueryNetworkHint(ctx context.Context, device []string) error { +func (o HostNetworkSystem) QueryNetworkHint(ctx context.Context, device []string) ([]types.PhysicalNicHintInfo, error) { req := types.QueryNetworkHint{ This: o.Reference(), Device: device, } - _, err := methods.QueryNetworkHint(ctx, o.c, &req) + res, err := methods.QueryNetworkHint(ctx, o.c, &req) if err != nil { - return err + return nil, err } - return nil + return res.Returnval, err } // RefreshNetworkSystem wraps methods.RefreshNetworkSystem diff --git a/vendor/github.com/vmware/govmomi/object/host_storage_system.go b/vendor/github.com/vmware/govmomi/object/host_storage_system.go index 2a433ff2a..5c9f08eee 100644 --- a/vendor/github.com/vmware/govmomi/object/host_storage_system.go +++ b/vendor/github.com/vmware/govmomi/object/host_storage_system.go @@ -88,6 +88,24 @@ func (s HostStorageSystem) RescanAllHba(ctx context.Context) error { return err } +func (s HostStorageSystem) Refresh(ctx context.Context) error { + req := types.RefreshStorageSystem{ + This: s.Reference(), + } + + _, err := methods.RefreshStorageSystem(ctx, s.c, &req) + return err +} + +func (s HostStorageSystem) RescanVmfs(ctx context.Context) error { + req := types.RescanVmfs{ + This: s.Reference(), + } + + _, err := methods.RescanVmfs(ctx, s.c, &req) + return err +} + func (s HostStorageSystem) MarkAsSsd(ctx context.Context, uuid string) (*Task, error) { req := types.MarkAsSsd_Task{ This: s.Reference(), @@ -143,3 +161,40 @@ func (s HostStorageSystem) MarkAsNonLocal(ctx context.Context, uuid string) (*Ta return NewTask(s.c, res.Returnval), nil } + +func (s HostStorageSystem) AttachScsiLun(ctx context.Context, uuid string) error { + req := types.AttachScsiLun{ + This: s.Reference(), + LunUuid: uuid, + } + + _, err := methods.AttachScsiLun(ctx, s.c, &req) + + return err +} + +func (s HostStorageSystem) QueryUnresolvedVmfsVolumes(ctx context.Context) ([]types.HostUnresolvedVmfsVolume, error) { + req := &types.QueryUnresolvedVmfsVolume{ + This: s.Reference(), + } + + res, err := methods.QueryUnresolvedVmfsVolume(ctx, s.Client(), req) + if err != nil { + return nil, err + } + return res.Returnval, nil +} + +func (s HostStorageSystem) UnmountVmfsVolume(ctx context.Context, vmfsUuid string) error { + req := &types.UnmountVmfsVolume{ + This: s.Reference(), + VmfsUuid: vmfsUuid, + } + + _, err := methods.UnmountVmfsVolume(ctx, s.Client(), req) + if err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go b/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go index 65e4587f6..1430e8a88 100644 --- a/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go +++ b/vendor/github.com/vmware/govmomi/object/host_vsan_internal_system.go @@ -42,7 +42,7 @@ func (m HostVsanInternalSystem) QueryVsanObjectUuidsByFilter(ctx context.Context req := types.QueryVsanObjectUuidsByFilter{ This: m.Reference(), Uuids: uuids, - Limit: limit, + Limit: &limit, Version: version, } diff --git a/vendor/github.com/vmware/govmomi/object/http_nfc_lease.go b/vendor/github.com/vmware/govmomi/object/http_nfc_lease.go deleted file mode 100644 index 3ca53558b..000000000 --- a/vendor/github.com/vmware/govmomi/object/http_nfc_lease.go +++ /dev/null @@ -1,143 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -import ( - "context" - "errors" - "fmt" - - "github.com/vmware/govmomi/property" - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/mo" - "github.com/vmware/govmomi/vim25/types" -) - -type HttpNfcLease struct { - Common -} - -func NewHttpNfcLease(c *vim25.Client, ref types.ManagedObjectReference) *HttpNfcLease { - return &HttpNfcLease{ - Common: NewCommon(c, ref), - } -} - -// HttpNfcLeaseAbort wraps methods.HttpNfcLeaseAbort -func (o HttpNfcLease) HttpNfcLeaseAbort(ctx context.Context, fault *types.LocalizedMethodFault) error { - req := types.HttpNfcLeaseAbort{ - This: o.Reference(), - Fault: fault, - } - - _, err := methods.HttpNfcLeaseAbort(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -// HttpNfcLeaseComplete wraps methods.HttpNfcLeaseComplete -func (o HttpNfcLease) HttpNfcLeaseComplete(ctx context.Context) error { - req := types.HttpNfcLeaseComplete{ - This: o.Reference(), - } - - _, err := methods.HttpNfcLeaseComplete(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -// HttpNfcLeaseGetManifest wraps methods.HttpNfcLeaseGetManifest -func (o HttpNfcLease) HttpNfcLeaseGetManifest(ctx context.Context) error { - req := types.HttpNfcLeaseGetManifest{ - This: o.Reference(), - } - - _, err := methods.HttpNfcLeaseGetManifest(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -// HttpNfcLeaseProgress wraps methods.HttpNfcLeaseProgress -func (o HttpNfcLease) HttpNfcLeaseProgress(ctx context.Context, percent int32) error { - req := types.HttpNfcLeaseProgress{ - This: o.Reference(), - Percent: percent, - } - - _, err := methods.HttpNfcLeaseProgress(ctx, o.c, &req) - if err != nil { - return err - } - - return nil -} - -func (o HttpNfcLease) Wait(ctx context.Context) (*types.HttpNfcLeaseInfo, error) { - var lease mo.HttpNfcLease - - pc := property.DefaultCollector(o.c) - err := property.Wait(ctx, pc, o.Reference(), []string{"state", "info", "error"}, func(pc []types.PropertyChange) bool { - done := false - - for _, c := range pc { - if c.Val == nil { - continue - } - - switch c.Name { - case "error": - val := c.Val.(types.LocalizedMethodFault) - lease.Error = &val - done = true - case "info": - val := c.Val.(types.HttpNfcLeaseInfo) - lease.Info = &val - case "state": - lease.State = c.Val.(types.HttpNfcLeaseState) - if lease.State != types.HttpNfcLeaseStateInitializing { - done = true - } - } - } - - return done - }) - - if err != nil { - return nil, err - } - - if lease.State == types.HttpNfcLeaseStateReady { - return lease.Info, nil - } - - if lease.Error != nil { - return nil, errors.New(lease.Error.LocalizedMessage) - } - - return nil, fmt.Errorf("unexpected nfc lease state: %s", lease.State) -} diff --git a/vendor/github.com/vmware/govmomi/object/ovf_manager.go b/vendor/github.com/vmware/govmomi/object/ovf_manager.go deleted file mode 100644 index 7fedf689f..000000000 --- a/vendor/github.com/vmware/govmomi/object/ovf_manager.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package object - -import ( - "context" - - "github.com/vmware/govmomi/vim25" - "github.com/vmware/govmomi/vim25/methods" - "github.com/vmware/govmomi/vim25/types" -) - -type OvfManager struct { - Common -} - -func NewOvfManager(c *vim25.Client) *OvfManager { - o := OvfManager{ - Common: NewCommon(c, *c.ServiceContent.OvfManager), - } - - return &o -} - -// CreateDescriptor wraps methods.CreateDescriptor -func (o OvfManager) CreateDescriptor(ctx context.Context, obj Reference, cdp types.OvfCreateDescriptorParams) (*types.OvfCreateDescriptorResult, error) { - req := types.CreateDescriptor{ - This: o.Reference(), - Obj: obj.Reference(), - Cdp: cdp, - } - - res, err := methods.CreateDescriptor(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} - -// CreateImportSpec wraps methods.CreateImportSpec -func (o OvfManager) CreateImportSpec(ctx context.Context, ovfDescriptor string, resourcePool Reference, datastore Reference, cisp types.OvfCreateImportSpecParams) (*types.OvfCreateImportSpecResult, error) { - req := types.CreateImportSpec{ - This: o.Reference(), - OvfDescriptor: ovfDescriptor, - ResourcePool: resourcePool.Reference(), - Datastore: datastore.Reference(), - Cisp: cisp, - } - - res, err := methods.CreateImportSpec(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} - -// ParseDescriptor wraps methods.ParseDescriptor -func (o OvfManager) ParseDescriptor(ctx context.Context, ovfDescriptor string, pdp types.OvfParseDescriptorParams) (*types.OvfParseDescriptorResult, error) { - req := types.ParseDescriptor{ - This: o.Reference(), - OvfDescriptor: ovfDescriptor, - Pdp: pdp, - } - - res, err := methods.ParseDescriptor(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} - -// ValidateHost wraps methods.ValidateHost -func (o OvfManager) ValidateHost(ctx context.Context, ovfDescriptor string, host Reference, vhp types.OvfValidateHostParams) (*types.OvfValidateHostResult, error) { - req := types.ValidateHost{ - This: o.Reference(), - OvfDescriptor: ovfDescriptor, - Host: host.Reference(), - Vhp: vhp, - } - - res, err := methods.ValidateHost(ctx, o.c, &req) - if err != nil { - return nil, err - } - - return &res.Returnval, nil -} diff --git a/vendor/github.com/vmware/govmomi/object/resource_pool.go b/vendor/github.com/vmware/govmomi/object/resource_pool.go index 791fd3822..55c2e2b2f 100644 --- a/vendor/github.com/vmware/govmomi/object/resource_pool.go +++ b/vendor/github.com/vmware/govmomi/object/resource_pool.go @@ -19,6 +19,7 @@ package object import ( "context" + "github.com/vmware/govmomi/nfc" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/types" @@ -34,7 +35,7 @@ func NewResourcePool(c *vim25.Client, ref types.ManagedObjectReference) *Resourc } } -func (p ResourcePool) ImportVApp(ctx context.Context, spec types.BaseImportSpec, folder *Folder, host *HostSystem) (*HttpNfcLease, error) { +func (p ResourcePool) ImportVApp(ctx context.Context, spec types.BaseImportSpec, folder *Folder, host *HostSystem) (*nfc.Lease, error) { req := types.ImportVApp{ This: p.Reference(), Spec: spec, @@ -55,7 +56,7 @@ func (p ResourcePool) ImportVApp(ctx context.Context, spec types.BaseImportSpec, return nil, err } - return NewHttpNfcLease(p.c, res.Returnval), nil + return nfc.NewLease(p.c, res.Returnval), nil } func (p ResourcePool) Create(ctx context.Context, name string, spec types.ResourceConfigSpec) (*ResourcePool, error) { diff --git a/vendor/github.com/vmware/govmomi/object/task.go b/vendor/github.com/vmware/govmomi/object/task.go index 8572b4363..d77b6278a 100644 --- a/vendor/github.com/vmware/govmomi/object/task.go +++ b/vendor/github.com/vmware/govmomi/object/task.go @@ -22,6 +22,7 @@ import ( "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/task" "github.com/vmware/govmomi/vim25" + "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/progress" "github.com/vmware/govmomi/vim25/types" ) @@ -47,7 +48,19 @@ func (t *Task) Wait(ctx context.Context) error { return err } -func (t *Task) WaitForResult(ctx context.Context, s progress.Sinker) (*types.TaskInfo, error) { +func (t *Task) WaitForResult(ctx context.Context, s ...progress.Sinker) (*types.TaskInfo, error) { + var pr progress.Sinker + if len(s) == 1 { + pr = s[0] + } p := property.DefaultCollector(t.c) - return task.Wait(ctx, t.Reference(), p, s) + return task.Wait(ctx, t.Reference(), p, pr) +} + +func (t *Task) Cancel(ctx context.Context) error { + _, err := methods.CancelTask(ctx, t.Client(), &types.CancelTask{ + This: t.Reference(), + }) + + return err } diff --git a/vendor/github.com/vmware/govmomi/object/types.go b/vendor/github.com/vmware/govmomi/object/types.go index aefb611fd..4eb8d1b8b 100644 --- a/vendor/github.com/vmware/govmomi/object/types.go +++ b/vendor/github.com/vmware/govmomi/object/types.go @@ -47,8 +47,10 @@ func NewReference(c *vim25.Client, e types.ManagedObjectReference) Reference { return NewClusterComputeResource(c, e) case "HostSystem": return NewHostSystem(c, e) - case "Network", "OpaqueNetwork": + case "Network": return NewNetwork(c, e) + case "OpaqueNetwork": + return NewOpaqueNetwork(c, e) case "ResourcePool": return NewResourcePool(c, e) case "DistributedVirtualSwitch": diff --git a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go index 24821aa6b..58b61f5d5 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import ( // Type values for use in BootOrder const ( + DeviceTypeNone = "-" DeviceTypeCdrom = "cdrom" DeviceTypeDisk = "disk" DeviceTypeEthernet = "ethernet" @@ -60,7 +61,10 @@ func EthernetCardTypes() VirtualDeviceList { return VirtualDeviceList([]types.BaseVirtualDevice{ &types.VirtualE1000{}, &types.VirtualE1000e{}, + &types.VirtualVmxnet2{}, &types.VirtualVmxnet3{}, + &types.VirtualPCNet32{}, + &types.VirtualSriovEthernetCard{}, }).Select(func(device types.BaseVirtualDevice) bool { c := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard() c.GetVirtualDevice().Key = -1 @@ -225,8 +229,10 @@ func (l VirtualDeviceList) FindSCSIController(name string) (*types.VirtualSCSICo func (l VirtualDeviceList) CreateSCSIController(name string) (types.BaseVirtualDevice, error) { ctypes := SCSIControllerTypes() - if name == "scsi" || name == "" { + if name == "" || name == "scsi" { name = ctypes.Type(ctypes[0]) + } else if name == "virtualscsi" { + name = "pvscsi" // ovf VirtualSCSI mapping } found := ctypes.Select(func(device types.BaseVirtualDevice) bool { @@ -754,6 +760,9 @@ func (l VirtualDeviceList) PrimaryMacAddress() string { // convert a BaseVirtualDevice to a BaseVirtualMachineBootOptionsBootableDevice var bootableDevices = map[string]func(device types.BaseVirtualDevice) types.BaseVirtualMachineBootOptionsBootableDevice{ + DeviceTypeNone: func(types.BaseVirtualDevice) types.BaseVirtualMachineBootOptionsBootableDevice { + return &types.VirtualMachineBootOptionsBootableDevice{} + }, DeviceTypeCdrom: func(types.BaseVirtualDevice) types.BaseVirtualMachineBootOptionsBootableDevice { return &types.VirtualMachineBootOptionsBootableCdromDevice{} }, @@ -773,17 +782,23 @@ var bootableDevices = map[string]func(device types.BaseVirtualDevice) types.Base } // BootOrder returns a list of devices which can be used to set boot order via VirtualMachine.SetBootOptions. -// The order can any of "ethernet", "cdrom", "floppy" or "disk" or by specific device name. +// The order can be any of "ethernet", "cdrom", "floppy" or "disk" or by specific device name. +// A value of "-" will clear the existing boot order on the VC/ESX side. func (l VirtualDeviceList) BootOrder(order []string) []types.BaseVirtualMachineBootOptionsBootableDevice { var devices []types.BaseVirtualMachineBootOptionsBootableDevice for _, name := range order { if kind, ok := bootableDevices[name]; ok { + if name == DeviceTypeNone { + // Not covered in the API docs, nor obvious, but this clears the boot order on the VC/ESX side. + devices = append(devices, new(types.VirtualMachineBootOptionsBootableDevice)) + continue + } + for _, device := range l { if l.Type(device) == name { devices = append(devices, kind(device)) } - } continue } @@ -824,7 +839,7 @@ func (l VirtualDeviceList) TypeName(device types.BaseVirtualDevice) string { return dtype.Elem().Name() } -var deviceNameRegexp = regexp.MustCompile(`(?:Virtual)?(?:Machine)?(\w+?)(?:Card|Device|Controller)?$`) +var deviceNameRegexp = regexp.MustCompile(`(?:Virtual)?(?:Machine)?(\w+?)(?:Card|EthernetCard|Device|Controller)?$`) func (l VirtualDeviceList) deviceName(device types.BaseVirtualDevice) string { name := "device" diff --git a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go index b26e2f71c..72439caf9 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go @@ -145,6 +145,47 @@ func (m VirtualDiskManager) DeleteVirtualDisk(ctx context.Context, name string, return NewTask(m.c, res.Returnval), nil } +// InflateVirtualDisk inflates a virtual disk. +func (m VirtualDiskManager) InflateVirtualDisk(ctx context.Context, name string, dc *Datacenter) (*Task, error) { + req := types.InflateVirtualDisk_Task{ + This: m.Reference(), + Name: name, + } + + if dc != nil { + ref := dc.Reference() + req.Datacenter = &ref + } + + res, err := methods.InflateVirtualDisk_Task(ctx, m.c, &req) + if err != nil { + return nil, err + } + + return NewTask(m.c, res.Returnval), nil +} + +// ShrinkVirtualDisk shrinks a virtual disk. +func (m VirtualDiskManager) ShrinkVirtualDisk(ctx context.Context, name string, dc *Datacenter, copy *bool) (*Task, error) { + req := types.ShrinkVirtualDisk_Task{ + This: m.Reference(), + Name: name, + Copy: copy, + } + + if dc != nil { + ref := dc.Reference() + req.Datacenter = &ref + } + + res, err := methods.ShrinkVirtualDisk_Task(ctx, m.c, &req) + if err != nil { + return nil, err + } + + return NewTask(m.c, res.Returnval), nil +} + // Queries virtual disk uuid func (m VirtualDiskManager) QueryVirtualDiskUuid(ctx context.Context, name string, dc *Datacenter) (string, error) { req := types.QueryVirtualDiskUuid{ @@ -168,3 +209,19 @@ func (m VirtualDiskManager) QueryVirtualDiskUuid(ctx context.Context, name strin return res.Returnval, nil } + +func (m VirtualDiskManager) SetVirtualDiskUuid(ctx context.Context, name string, dc *Datacenter, uuid string) error { + req := types.SetVirtualDiskUuid{ + This: m.Reference(), + Name: name, + Uuid: uuid, + } + + if dc != nil { + ref := dc.Reference() + req.Datacenter = &ref + } + + _, err := methods.SetVirtualDiskUuid(ctx, m.c, &req) + return err +} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go index 642cd62f6..faa9ecad5 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_disk_manager_internal.go @@ -46,9 +46,10 @@ type queryVirtualDiskInfoTaskResponse struct { } type queryVirtualDiskInfoTaskBody struct { - Req *queryVirtualDiskInfoTaskRequest `xml:"urn:internalvim25 QueryVirtualDiskInfo_Task,omitempty"` - Res *queryVirtualDiskInfoTaskResponse `xml:"urn:vim25 QueryVirtualDiskInfo_TaskResponse,omitempty"` - Err *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` + Req *queryVirtualDiskInfoTaskRequest `xml:"urn:internalvim25 QueryVirtualDiskInfo_Task,omitempty"` + Res *queryVirtualDiskInfoTaskResponse `xml:"urn:vim25 QueryVirtualDiskInfo_TaskResponse,omitempty"` + InternalRes *queryVirtualDiskInfoTaskResponse `xml:"urn:internalvim25 QueryVirtualDiskInfo_TaskResponse,omitempty"` + Err *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } func (b *queryVirtualDiskInfoTaskBody) Fault() *soap.Fault { return b.Err } @@ -62,7 +63,11 @@ func queryVirtualDiskInfoTask(ctx context.Context, r soap.RoundTripper, req *que return nil, err } - return resBody.Res, nil + if resBody.Res != nil { + return resBody.Res, nil + } + + return resBody.InternalRes, nil } type VirtualDiskInfo struct { @@ -95,3 +100,67 @@ func (m VirtualDiskManager) QueryVirtualDiskInfo(ctx context.Context, name strin return info.Result.(arrayOfVirtualDiskInfo).VirtualDiskInfo, nil } + +type createChildDiskTaskRequest struct { + This types.ManagedObjectReference `xml:"_this"` + ChildName string `xml:"childName"` + ChildDatacenter *types.ManagedObjectReference `xml:"childDatacenter,omitempty"` + ParentName string `xml:"parentName"` + ParentDatacenter *types.ManagedObjectReference `xml:"parentDatacenter,omitempty"` + IsLinkedClone bool `xml:"isLinkedClone"` +} + +type createChildDiskTaskResponse struct { + Returnval types.ManagedObjectReference `xml:"returnval"` +} + +type createChildDiskTaskBody struct { + Req *createChildDiskTaskRequest `xml:"urn:internalvim25 CreateChildDisk_Task,omitempty"` + Res *createChildDiskTaskResponse `xml:"urn:vim25 CreateChildDisk_TaskResponse,omitempty"` + InternalRes *createChildDiskTaskResponse `xml:"urn:internalvim25 CreateChildDisk_TaskResponse,omitempty"` + Err *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *createChildDiskTaskBody) Fault() *soap.Fault { return b.Err } + +func createChildDiskTask(ctx context.Context, r soap.RoundTripper, req *createChildDiskTaskRequest) (*createChildDiskTaskResponse, error) { + var reqBody, resBody createChildDiskTaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + if resBody.Res != nil { + return resBody.Res, nil // vim-version <= 6.5 + } + + return resBody.InternalRes, nil // vim-version >= 6.7 +} + +func (m VirtualDiskManager) CreateChildDisk(ctx context.Context, parent string, pdc *Datacenter, name string, dc *Datacenter, linked bool) (*Task, error) { + req := createChildDiskTaskRequest{ + This: m.Reference(), + ChildName: name, + ParentName: parent, + IsLinkedClone: linked, + } + + if dc != nil { + ref := dc.Reference() + req.ChildDatacenter = &ref + } + + if pdc != nil { + ref := pdc.Reference() + req.ParentDatacenter = &ref + } + + res, err := createChildDiskTask(ctx, m.Client(), &req) + if err != nil { + return nil, err + } + + return NewTask(m.Client(), res.Returnval), nil +} diff --git a/vendor/github.com/vmware/govmomi/object/virtual_machine.go b/vendor/github.com/vmware/govmomi/object/virtual_machine.go index 02c4e2371..9284b4940 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_machine.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_machine.go @@ -23,6 +23,7 @@ import ( "net" "path" + "github.com/vmware/govmomi/nfc" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/methods" @@ -81,6 +82,20 @@ func (v VirtualMachine) PowerOff(ctx context.Context) (*Task, error) { return NewTask(v.c, res.Returnval), nil } +func (v VirtualMachine) PutUsbScanCodes(ctx context.Context, spec types.UsbScanCodeSpec) (int32, error) { + req := types.PutUsbScanCodes{ + This: v.Reference(), + Spec: spec, + } + + res, err := methods.PutUsbScanCodes(ctx, v.c, &req) + if err != nil { + return 0, err + } + + return res.Returnval, nil +} + func (v VirtualMachine) Reset(ctx context.Context) (*Task, error) { req := types.ResetVM_Task{ This: v.Reference(), @@ -197,6 +212,15 @@ func (v VirtualMachine) Reconfigure(ctx context.Context, config types.VirtualMac return NewTask(v.c, res.Returnval), nil } +func (v VirtualMachine) RefreshStorageInfo(ctx context.Context) error { + req := types.RefreshStorageInfo{ + This: v.Reference(), + } + + _, err := methods.RefreshStorageInfo(ctx, v.c, &req) + return err +} + func (v VirtualMachine) WaitForIP(ctx context.Context) (string, error) { var ip string @@ -261,6 +285,10 @@ func (v VirtualMachine) WaitForNetIP(ctx context.Context, v4 bool, device ...str return true }) + if err != nil { + return nil, err + } + if len(device) != 0 { // Only wait for specific NIC(s) macs = make(map[string][]string) @@ -464,6 +492,20 @@ func (v VirtualMachine) Answer(ctx context.Context, id, answer string) error { return nil } +func (v VirtualMachine) AcquireTicket(ctx context.Context, kind string) (*types.VirtualMachineTicket, error) { + req := types.AcquireTicket{ + This: v.Reference(), + TicketType: kind, + } + + res, err := methods.AcquireTicket(ctx, v.c, &req) + if err != nil { + return nil, err + } + + return &res.Returnval, nil +} + // CreateSnapshot creates a new snapshot of a virtual machine. func (v VirtualMachine) CreateSnapshot(ctx context.Context, name string, description string, memory bool, quiesce bool) (*Task, error) { req := types.CreateSnapshot_Task{ @@ -497,7 +539,7 @@ func (v VirtualMachine) RemoveAllSnapshot(ctx context.Context, consolidate *bool return NewTask(v.c, res.Returnval), nil } -type snapshotMap map[string][]Reference +type snapshotMap map[string][]types.ManagedObjectReference func (m snapshotMap) add(parent string, tree []types.VirtualMachineSnapshotTree) { for i, st := range tree { @@ -511,7 +553,7 @@ func (m snapshotMap) add(parent string, tree []types.VirtualMachineSnapshotTree) } for _, name := range names { - m[name] = append(m[name], &tree[i].Snapshot) + m[name] = append(m[name], tree[i].Snapshot) } m.add(sname, st.ChildSnapshotList) @@ -522,7 +564,7 @@ func (m snapshotMap) add(parent string, tree []types.VirtualMachineSnapshotTree) // 1) snapshot ManagedObjectReference.Value (unique) // 2) snapshot name (may not be unique) // 3) snapshot tree path (may not be unique) -func (v VirtualMachine) FindSnapshot(ctx context.Context, name string) (Reference, error) { +func (v VirtualMachine) FindSnapshot(ctx context.Context, name string) (*types.ManagedObjectReference, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"snapshot"}, &o) @@ -531,7 +573,7 @@ func (v VirtualMachine) FindSnapshot(ctx context.Context, name string) (Referenc } if o.Snapshot == nil || len(o.Snapshot.RootSnapshotList) == 0 { - return nil, errors.New("No snapshots for this VM") + return nil, errors.New("no snapshots for this VM") } m := make(snapshotMap) @@ -542,7 +584,7 @@ func (v VirtualMachine) FindSnapshot(ctx context.Context, name string) (Referenc case 0: return nil, fmt.Errorf("snapshot %q not found", name) case 1: - return s[0], nil + return &s[0], nil default: return nil, fmt.Errorf("%q resolves to %d snapshots", name, len(s)) } @@ -757,3 +799,43 @@ func (v VirtualMachine) UpgradeTools(ctx context.Context, options string) (*Task return NewTask(v.c, res.Returnval), nil } + +func (v VirtualMachine) Export(ctx context.Context) (*nfc.Lease, error) { + req := types.ExportVm{ + This: v.Reference(), + } + + res, err := methods.ExportVm(ctx, v.Client(), &req) + if err != nil { + return nil, err + } + + return nfc.NewLease(v.c, res.Returnval), nil +} + +func (v VirtualMachine) UpgradeVM(ctx context.Context, version string) (*Task, error) { + req := types.UpgradeVM_Task{ + This: v.Reference(), + Version: version, + } + + res, err := methods.UpgradeVM_Task(ctx, v.Client(), &req) + if err != nil { + return nil, err + } + + return NewTask(v.c, res.Returnval), nil +} + +// UUID is a helper to get the UUID of the VirtualMachine managed object. +// This method returns an empty string if an error occurs when retrieving UUID from the VirtualMachine object. +func (v VirtualMachine) UUID(ctx context.Context) string { + var o mo.VirtualMachine + + err := v.Properties(ctx, v.Reference(), []string{"config.uuid"}, &o) + if err != nil { + return "" + } + + return o.Config.Uuid +} diff --git a/vendor/github.com/vmware/govmomi/program.mk b/vendor/github.com/vmware/govmomi/program.mk new file mode 100644 index 000000000..c5f653193 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/program.mk @@ -0,0 +1,48 @@ +ifneq (,$(strip $(GOOS))) +ifeq (,$(strip $(GOARCH))) +GOARCH := $(shell go env | grep GOARCH | awk -F= '{print $$2}' | tr -d '"') +endif +endif + +ifneq (,$(strip $(GOARCH))) +ifeq (,$(strip $(GOOS))) +GOOS := $(shell go env | grep GOOS | awk -F= '{print $$2}' | tr -d '"') +endif +endif + +ifeq (2,$(words $(GOOS) $(GOARCH))) +PROGRAM := $(PROGRAM)_$(GOOS)_$(GOARCH) +endif + +ifeq (windows,$(GOOS)) +PROGRAM := $(PROGRAM).exe +endif + +all: $(PROGRAM) + +TAGS += netgo +ifeq (,$(strip $(findstring -w,$(LDFLAGS)))) +LDFLAGS += -w +endif +BUILD_ARGS := -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -v + +$(PROGRAM): + CGO_ENABLED=0 go build -a $(BUILD_ARGS) -o $@ + +install: + CGO_ENABLED=0 go install -i -v $(BUILD_ARGS) + +ifneq (,$(strip $(BUILD_OS))) +ifneq (,$(strip $(BUILD_ARCH))) +GOOS_GOARCH_TARGETS := $(foreach a,$(BUILD_ARCH),$(patsubst %,%_$a,$(BUILD_OS))) +XBUILD := $(addprefix $(PROGRAM)_,$(GOOS_GOARCH_TARGETS)) +$(XBUILD): + GOOS=$(word 2,$(subst _, ,$@)) GOARCH=$(word 3,$(subst _, ,$@)) $(MAKE) --output-sync=target +build-all: $(XBUILD) +endif +endif + +clean: + @rm -f $(PROGRAM) $(XBUILD) + +.PHONY: build-all install clean diff --git a/vendor/github.com/vmware/govmomi/property/collector.go b/vendor/github.com/vmware/govmomi/property/collector.go index 04a9e7737..b77e60061 100644 --- a/vendor/github.com/vmware/govmomi/property/collector.go +++ b/vendor/github.com/vmware/govmomi/property/collector.go @@ -111,6 +111,12 @@ func (p *Collector) WaitForUpdates(ctx context.Context, v string) (*types.Update return res.Returnval, nil } +func (p *Collector) CancelWaitForUpdates(ctx context.Context) error { + req := &types.CancelWaitForUpdates{This: p.Reference()} + _, err := methods.CancelWaitForUpdates(ctx, p.roundTripper, req) + return err +} + func (p *Collector) RetrieveProperties(ctx context.Context, req types.RetrieveProperties) (*types.RetrievePropertiesResponse, error) { req.This = p.Reference() return methods.RetrieveProperties(ctx, p.roundTripper, &req) @@ -120,26 +126,30 @@ func (p *Collector) RetrieveProperties(ctx context.Context, req types.RetrievePr // must be a pointer to a []interface{}, which is populated with the instances // of the specified managed objects, with the relevant properties filled in. If // the properties slice is nil, all properties are loaded. +// Note that pointer types are optional fields that may be left as a nil value. +// The caller should check such fields for a nil value before dereferencing. func (p *Collector) Retrieve(ctx context.Context, objs []types.ManagedObjectReference, ps []string, dst interface{}) error { - var propSpec *types.PropertySpec + if len(objs) == 0 { + return errors.New("object references is empty") + } + + kinds := make(map[string]bool) + + var propSet []types.PropertySpec var objectSet []types.ObjectSpec for _, obj := range objs { - // Ensure that all object reference types are the same - if propSpec == nil { - propSpec = &types.PropertySpec{ + if _, ok := kinds[obj.Type]; !ok { + spec := types.PropertySpec{ Type: obj.Type, } - if ps == nil { - propSpec.All = types.NewBool(true) + spec.All = types.NewBool(true) } else { - propSpec.PathSet = ps - } - } else { - if obj.Type != propSpec.Type { - return errors.New("object references must have the same type") + spec.PathSet = ps } + propSet = append(propSet, spec) + kinds[obj.Type] = true } objectSpec := types.ObjectSpec{ @@ -154,7 +164,7 @@ func (p *Collector) Retrieve(ctx context.Context, objs []types.ManagedObjectRefe SpecSet: []types.PropertyFilterSpec{ { ObjectSet: objectSet, - PropSet: []types.PropertySpec{*propSpec}, + PropSet: propSet, }, }, } @@ -194,7 +204,7 @@ func (p *Collector) RetrieveWithFilter(ctx context.Context, objs []types.Managed return p.Retrieve(ctx, objs, ps, dst) } -// RetrieveOne calls Retrieve with a single managed object reference. +// RetrieveOne calls Retrieve with a single managed object reference via Collector.Retrieve(). func (p *Collector) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, ps []string, dst interface{}) error { var objs = []types.ManagedObjectReference{obj} return p.Retrieve(ctx, objs, ps, dst) diff --git a/vendor/github.com/vmware/govmomi/property/filter.go b/vendor/github.com/vmware/govmomi/property/filter.go index 8284b0c7d..a4bf16d05 100644 --- a/vendor/github.com/vmware/govmomi/property/filter.go +++ b/vendor/github.com/vmware/govmomi/property/filter.go @@ -122,7 +122,7 @@ func (f Filter) MatchPropertyList(props []types.DynamicProperty) bool { } } - return true + return len(f) == len(props) // false if a property such as VM "guest" is unset } // MatchObjectContent returns a list of ObjectContent.Obj where the ObjectContent.PropSet matches the Filter. diff --git a/vendor/github.com/vmware/govmomi/property/wait.go b/vendor/github.com/vmware/govmomi/property/wait.go index 689477bfb..08de1913d 100644 --- a/vendor/github.com/vmware/govmomi/property/wait.go +++ b/vendor/github.com/vmware/govmomi/property/wait.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,10 +19,55 @@ package property import ( "context" + "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/types" ) -// Wait waits for any of the specified properties of the specified managed +// WaitFilter provides helpers to construct a types.CreateFilter for use with property.Wait +type WaitFilter struct { + types.CreateFilter + Options *types.WaitOptions +} + +// Add a new ObjectSpec and PropertySpec to the WaitFilter +func (f *WaitFilter) Add(obj types.ManagedObjectReference, kind string, ps []string, set ...types.BaseSelectionSpec) *WaitFilter { + spec := types.ObjectSpec{ + Obj: obj, + SelectSet: set, + } + + pset := types.PropertySpec{ + Type: kind, + PathSet: ps, + } + + if len(ps) == 0 { + pset.All = types.NewBool(true) + } + + f.Spec.ObjectSet = append(f.Spec.ObjectSet, spec) + + f.Spec.PropSet = append(f.Spec.PropSet, pset) + + return f +} + +// Wait creates a new WaitFilter and calls the specified function for each ObjectUpdate via WaitForUpdates +func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { + filter := new(WaitFilter).Add(obj, obj.Type, ps) + + return WaitForUpdates(ctx, c, filter, func(updates []types.ObjectUpdate) bool { + for _, update := range updates { + if f(update.ChangeSet) { + return true + } + } + + return false + }) +} + +// WaitForUpdates waits for any of the specified properties of the specified managed // object to change. It calls the specified function for every update it // receives. If this function returns false, it continues waiting for // subsequent updates. If this function returns true, it stops waiting and @@ -32,122 +77,57 @@ import ( // creates a new property collector and calls CreateFilter. A new property // collector is required because filters can only be added, not removed. // +// If the Context is canceled, a call to CancelWaitForUpdates() is made and its error value is returned. // The newly created collector is destroyed before this function returns (both // in case of success or error). // -func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { +func WaitForUpdates(ctx context.Context, c *Collector, filter *WaitFilter, f func([]types.ObjectUpdate) bool) error { p, err := c.Create(ctx) if err != nil { return err } // Attempt to destroy the collector using the background context, as the - // specified context may have timed out or have been cancelled. - defer p.Destroy(context.Background()) + // specified context may have timed out or have been canceled. + defer func() { + _ = p.Destroy(context.Background()) + }() - req := types.CreateFilter{ - Spec: types.PropertyFilterSpec{ - ObjectSet: []types.ObjectSpec{ - { - Obj: obj, - }, - }, - PropSet: []types.PropertySpec{ - { - PathSet: ps, - Type: obj.Type, - }, - }, - }, - } - - if len(ps) == 0 { - req.Spec.PropSet[0].All = types.NewBool(true) - } - - err = p.CreateFilter(ctx, req) - if err != nil { - return err - } - return waitLoop(ctx, p, func(_ types.ManagedObjectReference, pc []types.PropertyChange) bool { - return f(pc) - }) -} - -// WaitForView waits for any of the specified properties of the managed -// objects in the View to change. It calls the specified function for every update it -// receives. If this function returns false, it continues waiting for -// subsequent updates. If this function returns true, it stops waiting and -// returns. -// -// To only receive updates for the View's specified managed objects, the function -// creates a new property collector and calls CreateFilter. A new property -// collector is required because filters can only be added, not removed. -// -// The newly created collector is destroyed before this function returns (both -// in case of success or error). -// -// The code assumes that all objects in the View are the same type -func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectReference, obj types.ManagedObjectReference, ps []string, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error { - p, err := c.Create(ctx) + err = p.CreateFilter(ctx, filter.CreateFilter) if err != nil { return err } - // Attempt to destroy the collector using the background context, as the - // specified context may have timed out or have been cancelled. - defer p.Destroy(context.Background()) - - req := types.CreateFilter{ - Spec: types.PropertyFilterSpec{ - ObjectSet: []types.ObjectSpec{ - { - Obj: view, - SelectSet: []types.BaseSelectionSpec{ - &types.TraversalSpec{ - SelectionSpec: types.SelectionSpec{ - Name: "traverseEntities", - }, - Path: "view", - Type: view.Type}}, - }, - }, - PropSet: []types.PropertySpec{ - { - Type: obj.Type, - PathSet: ps, - }, - }, - }} - - err = p.CreateFilter(ctx, req) - if err != nil { - return err + req := types.WaitForUpdatesEx{ + This: p.Reference(), + Options: filter.Options, } - return waitLoop(ctx, p, f) -} -func waitLoop(ctx context.Context, c *Collector, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error { - for version := ""; ; { - res, err := c.WaitForUpdates(ctx, version) + for { + res, err := methods.WaitForUpdatesEx(ctx, p.roundTripper, &req) if err != nil { + if ctx.Err() == context.Canceled { + werr := p.CancelWaitForUpdates(context.Background()) + return werr + } return err } - // Retry if the result came back empty - if res == nil { + set := res.Returnval + if set == nil { + if req.Options != nil && req.Options.MaxWaitSeconds != nil { + return nil // WaitOptions.MaxWaitSeconds exceeded + } + // Retry if the result came back empty continue } - version = res.Version + req.Version = set.Version - for _, fs := range res.FilterSet { - for _, os := range fs.ObjectSet { - if f(os.Obj, os.ChangeSet) { - return nil - } + for _, fs := range set.FilterSet { + if f(fs.ObjectSet) { + return nil } } } - } diff --git a/vendor/github.com/vmware/govmomi/session/keep_alive.go b/vendor/github.com/vmware/govmomi/session/keep_alive.go index a9d4c141c..fede89da9 100644 --- a/vendor/github.com/vmware/govmomi/session/keep_alive.go +++ b/vendor/github.com/vmware/govmomi/session/keep_alive.go @@ -40,8 +40,8 @@ type keepAlive struct { } func defaultKeepAlive(roundTripper soap.RoundTripper) error { - _, _ = methods.GetCurrentTime(context.Background(), roundTripper) - return nil + _, err := methods.GetCurrentTime(context.Background(), roundTripper) + return err } // KeepAlive wraps the specified soap.RoundTripper and executes a meaningless @@ -114,10 +114,9 @@ func (k *keepAlive) RoundTrip(ctx context.Context, req, res soap.HasFault) error if err != nil { return err } - // Start ticker on login, stop ticker on logout. switch req.(type) { - case *methods.LoginBody, *methods.LoginExtensionByCertificateBody: + case *methods.LoginBody, *methods.LoginExtensionByCertificateBody, *methods.LoginByTokenBody: k.start() case *methods.LogoutBody: k.stop() diff --git a/vendor/github.com/vmware/govmomi/session/manager.go b/vendor/github.com/vmware/govmomi/session/manager.go index b4591c1c4..30adfeee5 100644 --- a/vendor/github.com/vmware/govmomi/session/manager.go +++ b/vendor/github.com/vmware/govmomi/session/manager.go @@ -18,8 +18,11 @@ package session import ( "context" + "io/ioutil" + "net/http" "net/url" "os" + "strings" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25" @@ -40,6 +43,21 @@ func init() { } } +// Secret returns the contents if a file path value is given, otherwise returns value itself. +func Secret(value string) (string, error) { + if len(value) == 0 { + return value, nil + } + contents, err := ioutil.ReadFile(value) + if err != nil { + if os.IsNotExist(err) { + return value, nil + } + return "", err + } + return strings.TrimSpace(string(contents)), nil +} + type Manager struct { client *vim25.Client userSession *types.UserSession @@ -89,14 +107,51 @@ func (sm *Manager) Login(ctx context.Context, u *url.Userinfo) error { return nil } -func (sm *Manager) LoginExtensionByCertificate(ctx context.Context, key string, locale string) error { +// LoginExtensionByCertificate uses the vCenter SDK tunnel to login using a client certificate. +// The client certificate can be set using the soap.Client.SetCertificate method. +// See: https://kb.vmware.com/s/article/2004305 +func (sm *Manager) LoginExtensionByCertificate(ctx context.Context, key string) error { + c := sm.client + u := c.URL() + if u.Hostname() != "sdkTunnel" { + sc := c.Tunnel() + c = &vim25.Client{ + Client: sc, + RoundTripper: sc, + ServiceContent: c.ServiceContent, + } + // When http.Transport.Proxy is used, our thumbprint checker is bypassed, resulting in: + // "Post https://sdkTunnel:8089/sdk: x509: certificate is valid for $vcenter_hostname, not sdkTunnel" + // The only easy way around this is to disable verification for the call to LoginExtensionByCertificate(). + // TODO: find a way to avoid disabling InsecureSkipVerify. + c.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = true + } + req := types.LoginExtensionByCertificate{ This: sm.Reference(), ExtensionKey: key, - Locale: locale, + Locale: Locale, } - login, err := methods.LoginExtensionByCertificate(ctx, sm.client, &req) + login, err := methods.LoginExtensionByCertificate(ctx, c, &req) + if err != nil { + return err + } + + // Copy the session cookie + sm.client.Jar.SetCookies(u, c.Jar.Cookies(c.URL())) + + sm.userSession = &login.Returnval + return nil +} + +func (sm *Manager) LoginByToken(ctx context.Context) error { + req := types.LoginByToken{ + This: sm.Reference(), + Locale: Locale, + } + + login, err := methods.LoginByToken(ctx, sm.client, &req) if err != nil { return err } @@ -199,3 +254,31 @@ func (sm *Manager) AcquireLocalTicket(ctx context.Context, userName string) (*ty return &res.Returnval, nil } + +func (sm *Manager) AcquireCloneTicket(ctx context.Context) (string, error) { + req := types.AcquireCloneTicket{ + This: sm.Reference(), + } + + res, err := methods.AcquireCloneTicket(ctx, sm.client, &req) + if err != nil { + return "", err + } + + return res.Returnval, nil +} + +func (sm *Manager) CloneSession(ctx context.Context, ticket string) error { + req := types.CloneSession{ + This: sm.Reference(), + CloneTicket: ticket, + } + + res, err := methods.CloneSession(ctx, sm.client, &req) + if err != nil { + return err + } + + sm.userSession = &res.Returnval + return nil +} diff --git a/vendor/github.com/vmware/govmomi/task/wait.go b/vendor/github.com/vmware/govmomi/task/wait.go index 19fee5384..c7555b72d 100644 --- a/vendor/github.com/vmware/govmomi/task/wait.go +++ b/vendor/github.com/vmware/govmomi/task/wait.go @@ -68,7 +68,7 @@ func (t *taskCallback) fn(pc []types.PropertyChange) bool { t.info = &ti } - // t.info could be nil if pc can't satify the rules above + // t.info could be nil if pc can't satisfy the rules above if t.info == nil { return false } diff --git a/vendor/github.com/vmware/govmomi/vim25/client.go b/vendor/github.com/vmware/govmomi/vim25/client.go index 1289f33ef..8ad8934e0 100644 --- a/vendor/github.com/vmware/govmomi/vim25/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/client.go @@ -19,12 +19,30 @@ package vim25 import ( "context" "encoding/json" + "encoding/xml" + "fmt" + "net/http" + "path" + "strings" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/types" ) +const ( + Namespace = "vim25" + Version = "6.7" + Path = "/sdk" +) + +var ( + ServiceInstance = types.ManagedObjectReference{ + Type: "ServiceInstance", + Value: "ServiceInstance", + } +) + // Client is a tiny wrapper around the vim25/soap Client that stores session // specific state (i.e. state that only needs to be retrieved once after the // client has been created). This means the client can be reused after @@ -40,27 +58,63 @@ type Client struct { RoundTripper soap.RoundTripper } -// NewClient creates and returns a new client wirh the ServiceContent field +// NewClient creates and returns a new client with the ServiceContent field // filled in. func NewClient(ctx context.Context, rt soap.RoundTripper) (*Client, error) { - serviceContent, err := methods.GetServiceContent(ctx, rt) - if err != nil { - return nil, err - } - c := Client{ - ServiceContent: serviceContent, - RoundTripper: rt, + RoundTripper: rt, } // Set client if it happens to be a soap.Client if sc, ok := rt.(*soap.Client); ok { c.Client = sc + + if c.Namespace == "" { + c.Namespace = "urn:" + Namespace + } else if !strings.Contains(c.Namespace, ":") { + c.Namespace = "urn:" + c.Namespace // ensure valid URI format + } + if c.Version == "" { + c.Version = Version + } + } + + var err error + c.ServiceContent, err = methods.GetServiceContent(ctx, rt) + if err != nil { + return nil, err } return &c, nil } +// UseServiceVersion sets soap.Client.Version to the current version of the service endpoint via /sdk/vimServiceVersions.xml +func (c *Client) UseServiceVersion() error { + u := c.URL() + u.Path = path.Join(Path, "vimServiceVersions.xml") + + res, err := c.Get(u.String()) + if err != nil { + return err + } + + if res.StatusCode != http.StatusOK { + return fmt.Errorf("http.Get(%s): %s", u.Path, err) + } + + v := struct { + Version *string `xml:"namespace>version"` + }{&c.Version} + + err = xml.NewDecoder(res.Body).Decode(&v) + _ = res.Body.Close() + if err != nil { + return fmt.Errorf("xml.Decode(%s): %s", u.Path, err) + } + + return nil +} + // RoundTrip dispatches to the RoundTripper field. func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error { return c.RoundTripper.RoundTrip(ctx, req, res) diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/internal.go b/vendor/github.com/vmware/govmomi/vim25/methods/internal.go deleted file mode 100644 index a79adf3a8..000000000 --- a/vendor/github.com/vmware/govmomi/vim25/methods/internal.go +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package methods - -import ( - "context" - - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25/types" -) - -type RetrieveDynamicTypeManagerBody struct { - Req *types.RetrieveDynamicTypeManager `xml:"urn:vim25 RetrieveDynamicTypeManager"` - Res *types.RetrieveDynamicTypeManagerResponse `xml:"urn:vim25 RetrieveDynamicTypeManagerResponse"` - Fault_ *soap.Fault -} - -func (b *RetrieveDynamicTypeManagerBody) Fault() *soap.Fault { return b.Fault_ } - -func RetrieveDynamicTypeManager(ctx context.Context, r soap.RoundTripper, req *types.RetrieveDynamicTypeManager) (*types.RetrieveDynamicTypeManagerResponse, error) { - var reqBody, resBody RetrieveDynamicTypeManagerBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type RetrieveManagedMethodExecuterBody struct { - Req *types.RetrieveManagedMethodExecuter `xml:"urn:vim25 RetrieveManagedMethodExecuter"` - Res *types.RetrieveManagedMethodExecuterResponse `xml:"urn:vim25 RetrieveManagedMethodExecuterResponse"` - Fault_ *soap.Fault -} - -func (b *RetrieveManagedMethodExecuterBody) Fault() *soap.Fault { return b.Fault_ } - -func RetrieveManagedMethodExecuter(ctx context.Context, r soap.RoundTripper, req *types.RetrieveManagedMethodExecuter) (*types.RetrieveManagedMethodExecuterResponse, error) { - var reqBody, resBody RetrieveManagedMethodExecuterBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type DynamicTypeMgrQueryMoInstancesBody struct { - Req *types.DynamicTypeMgrQueryMoInstances `xml:"urn:vim25 DynamicTypeMgrQueryMoInstances"` - Res *types.DynamicTypeMgrQueryMoInstancesResponse `xml:"urn:vim25 DynamicTypeMgrQueryMoInstancesResponse"` - Fault_ *soap.Fault -} - -func (b *DynamicTypeMgrQueryMoInstancesBody) Fault() *soap.Fault { return b.Fault_ } - -func DynamicTypeMgrQueryMoInstances(ctx context.Context, r soap.RoundTripper, req *types.DynamicTypeMgrQueryMoInstances) (*types.DynamicTypeMgrQueryMoInstancesResponse, error) { - var reqBody, resBody DynamicTypeMgrQueryMoInstancesBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type DynamicTypeMgrQueryTypeInfoBody struct { - Req *types.DynamicTypeMgrQueryTypeInfo `xml:"urn:vim25 DynamicTypeMgrQueryTypeInfo"` - Res *types.DynamicTypeMgrQueryTypeInfoResponse `xml:"urn:vim25 DynamicTypeMgrQueryTypeInfoResponse"` - Fault_ *soap.Fault -} - -func (b *DynamicTypeMgrQueryTypeInfoBody) Fault() *soap.Fault { return b.Fault_ } - -func DynamicTypeMgrQueryTypeInfo(ctx context.Context, r soap.RoundTripper, req *types.DynamicTypeMgrQueryTypeInfo) (*types.DynamicTypeMgrQueryTypeInfoResponse, error) { - var reqBody, resBody DynamicTypeMgrQueryTypeInfoBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} - -type ExecuteSoapBody struct { - Req *types.ExecuteSoap `xml:"urn:vim25 ExecuteSoap"` - Res *types.ExecuteSoapResponse `xml:"urn:vim25 ExecuteSoapResponse"` - Fault_ *soap.Fault -} - -func (b *ExecuteSoapBody) Fault() *soap.Fault { return b.Fault_ } - -func ExecuteSoap(ctx context.Context, r soap.RoundTripper, req *types.ExecuteSoap) (*types.ExecuteSoapResponse, error) { - var reqBody, resBody ExecuteSoapBody - - reqBody.Req = req - - if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { - return nil, err - } - - return resBody.Res, nil -} diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/methods.go b/vendor/github.com/vmware/govmomi/vim25/methods/methods.go index 0895a81c6..f2124121f 100644 --- a/vendor/github.com/vmware/govmomi/vim25/methods/methods.go +++ b/vendor/github.com/vmware/govmomi/vim25/methods/methods.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,9 +23,29 @@ import ( "github.com/vmware/govmomi/vim25/types" ) +type AbandonHciWorkflowBody struct { + Req *types.AbandonHciWorkflow `xml:"urn:vim25 AbandonHciWorkflow,omitempty"` + Res *types.AbandonHciWorkflowResponse `xml:"AbandonHciWorkflowResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *AbandonHciWorkflowBody) Fault() *soap.Fault { return b.Fault_ } + +func AbandonHciWorkflow(ctx context.Context, r soap.RoundTripper, req *types.AbandonHciWorkflow) (*types.AbandonHciWorkflowResponse, error) { + var reqBody, resBody AbandonHciWorkflowBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type AbdicateDomOwnershipBody struct { Req *types.AbdicateDomOwnership `xml:"urn:vim25 AbdicateDomOwnership,omitempty"` - Res *types.AbdicateDomOwnershipResponse `xml:"urn:vim25 AbdicateDomOwnershipResponse,omitempty"` + Res *types.AbdicateDomOwnershipResponse `xml:"AbdicateDomOwnershipResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -45,7 +65,7 @@ func AbdicateDomOwnership(ctx context.Context, r soap.RoundTripper, req *types.A type AcknowledgeAlarmBody struct { Req *types.AcknowledgeAlarm `xml:"urn:vim25 AcknowledgeAlarm,omitempty"` - Res *types.AcknowledgeAlarmResponse `xml:"urn:vim25 AcknowledgeAlarmResponse,omitempty"` + Res *types.AcknowledgeAlarmResponse `xml:"AcknowledgeAlarmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -65,7 +85,7 @@ func AcknowledgeAlarm(ctx context.Context, r soap.RoundTripper, req *types.Ackno type AcquireCimServicesTicketBody struct { Req *types.AcquireCimServicesTicket `xml:"urn:vim25 AcquireCimServicesTicket,omitempty"` - Res *types.AcquireCimServicesTicketResponse `xml:"urn:vim25 AcquireCimServicesTicketResponse,omitempty"` + Res *types.AcquireCimServicesTicketResponse `xml:"AcquireCimServicesTicketResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -85,7 +105,7 @@ func AcquireCimServicesTicket(ctx context.Context, r soap.RoundTripper, req *typ type AcquireCloneTicketBody struct { Req *types.AcquireCloneTicket `xml:"urn:vim25 AcquireCloneTicket,omitempty"` - Res *types.AcquireCloneTicketResponse `xml:"urn:vim25 AcquireCloneTicketResponse,omitempty"` + Res *types.AcquireCloneTicketResponse `xml:"AcquireCloneTicketResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -105,7 +125,7 @@ func AcquireCloneTicket(ctx context.Context, r soap.RoundTripper, req *types.Acq type AcquireCredentialsInGuestBody struct { Req *types.AcquireCredentialsInGuest `xml:"urn:vim25 AcquireCredentialsInGuest,omitempty"` - Res *types.AcquireCredentialsInGuestResponse `xml:"urn:vim25 AcquireCredentialsInGuestResponse,omitempty"` + Res *types.AcquireCredentialsInGuestResponse `xml:"AcquireCredentialsInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -125,7 +145,7 @@ func AcquireCredentialsInGuest(ctx context.Context, r soap.RoundTripper, req *ty type AcquireGenericServiceTicketBody struct { Req *types.AcquireGenericServiceTicket `xml:"urn:vim25 AcquireGenericServiceTicket,omitempty"` - Res *types.AcquireGenericServiceTicketResponse `xml:"urn:vim25 AcquireGenericServiceTicketResponse,omitempty"` + Res *types.AcquireGenericServiceTicketResponse `xml:"AcquireGenericServiceTicketResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -145,7 +165,7 @@ func AcquireGenericServiceTicket(ctx context.Context, r soap.RoundTripper, req * type AcquireLocalTicketBody struct { Req *types.AcquireLocalTicket `xml:"urn:vim25 AcquireLocalTicket,omitempty"` - Res *types.AcquireLocalTicketResponse `xml:"urn:vim25 AcquireLocalTicketResponse,omitempty"` + Res *types.AcquireLocalTicketResponse `xml:"AcquireLocalTicketResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -165,7 +185,7 @@ func AcquireLocalTicket(ctx context.Context, r soap.RoundTripper, req *types.Acq type AcquireMksTicketBody struct { Req *types.AcquireMksTicket `xml:"urn:vim25 AcquireMksTicket,omitempty"` - Res *types.AcquireMksTicketResponse `xml:"urn:vim25 AcquireMksTicketResponse,omitempty"` + Res *types.AcquireMksTicketResponse `xml:"AcquireMksTicketResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -185,7 +205,7 @@ func AcquireMksTicket(ctx context.Context, r soap.RoundTripper, req *types.Acqui type AcquireTicketBody struct { Req *types.AcquireTicket `xml:"urn:vim25 AcquireTicket,omitempty"` - Res *types.AcquireTicketResponse `xml:"urn:vim25 AcquireTicketResponse,omitempty"` + Res *types.AcquireTicketResponse `xml:"AcquireTicketResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -205,7 +225,7 @@ func AcquireTicket(ctx context.Context, r soap.RoundTripper, req *types.AcquireT type AddAuthorizationRoleBody struct { Req *types.AddAuthorizationRole `xml:"urn:vim25 AddAuthorizationRole,omitempty"` - Res *types.AddAuthorizationRoleResponse `xml:"urn:vim25 AddAuthorizationRoleResponse,omitempty"` + Res *types.AddAuthorizationRoleResponse `xml:"AddAuthorizationRoleResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -225,7 +245,7 @@ func AddAuthorizationRole(ctx context.Context, r soap.RoundTripper, req *types.A type AddCustomFieldDefBody struct { Req *types.AddCustomFieldDef `xml:"urn:vim25 AddCustomFieldDef,omitempty"` - Res *types.AddCustomFieldDefResponse `xml:"urn:vim25 AddCustomFieldDefResponse,omitempty"` + Res *types.AddCustomFieldDefResponse `xml:"AddCustomFieldDefResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -245,7 +265,7 @@ func AddCustomFieldDef(ctx context.Context, r soap.RoundTripper, req *types.AddC type AddDVPortgroup_TaskBody struct { Req *types.AddDVPortgroup_Task `xml:"urn:vim25 AddDVPortgroup_Task,omitempty"` - Res *types.AddDVPortgroup_TaskResponse `xml:"urn:vim25 AddDVPortgroup_TaskResponse,omitempty"` + Res *types.AddDVPortgroup_TaskResponse `xml:"AddDVPortgroup_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -265,7 +285,7 @@ func AddDVPortgroup_Task(ctx context.Context, r soap.RoundTripper, req *types.Ad type AddDisks_TaskBody struct { Req *types.AddDisks_Task `xml:"urn:vim25 AddDisks_Task,omitempty"` - Res *types.AddDisks_TaskResponse `xml:"urn:vim25 AddDisks_TaskResponse,omitempty"` + Res *types.AddDisks_TaskResponse `xml:"AddDisks_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -285,7 +305,7 @@ func AddDisks_Task(ctx context.Context, r soap.RoundTripper, req *types.AddDisks type AddFilterBody struct { Req *types.AddFilter `xml:"urn:vim25 AddFilter,omitempty"` - Res *types.AddFilterResponse `xml:"urn:vim25 AddFilterResponse,omitempty"` + Res *types.AddFilterResponse `xml:"AddFilterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -305,7 +325,7 @@ func AddFilter(ctx context.Context, r soap.RoundTripper, req *types.AddFilter) ( type AddFilterEntitiesBody struct { Req *types.AddFilterEntities `xml:"urn:vim25 AddFilterEntities,omitempty"` - Res *types.AddFilterEntitiesResponse `xml:"urn:vim25 AddFilterEntitiesResponse,omitempty"` + Res *types.AddFilterEntitiesResponse `xml:"AddFilterEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -325,7 +345,7 @@ func AddFilterEntities(ctx context.Context, r soap.RoundTripper, req *types.AddF type AddGuestAliasBody struct { Req *types.AddGuestAlias `xml:"urn:vim25 AddGuestAlias,omitempty"` - Res *types.AddGuestAliasResponse `xml:"urn:vim25 AddGuestAliasResponse,omitempty"` + Res *types.AddGuestAliasResponse `xml:"AddGuestAliasResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -345,7 +365,7 @@ func AddGuestAlias(ctx context.Context, r soap.RoundTripper, req *types.AddGuest type AddHost_TaskBody struct { Req *types.AddHost_Task `xml:"urn:vim25 AddHost_Task,omitempty"` - Res *types.AddHost_TaskResponse `xml:"urn:vim25 AddHost_TaskResponse,omitempty"` + Res *types.AddHost_TaskResponse `xml:"AddHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -365,7 +385,7 @@ func AddHost_Task(ctx context.Context, r soap.RoundTripper, req *types.AddHost_T type AddInternetScsiSendTargetsBody struct { Req *types.AddInternetScsiSendTargets `xml:"urn:vim25 AddInternetScsiSendTargets,omitempty"` - Res *types.AddInternetScsiSendTargetsResponse `xml:"urn:vim25 AddInternetScsiSendTargetsResponse,omitempty"` + Res *types.AddInternetScsiSendTargetsResponse `xml:"AddInternetScsiSendTargetsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -385,7 +405,7 @@ func AddInternetScsiSendTargets(ctx context.Context, r soap.RoundTripper, req *t type AddInternetScsiStaticTargetsBody struct { Req *types.AddInternetScsiStaticTargets `xml:"urn:vim25 AddInternetScsiStaticTargets,omitempty"` - Res *types.AddInternetScsiStaticTargetsResponse `xml:"urn:vim25 AddInternetScsiStaticTargetsResponse,omitempty"` + Res *types.AddInternetScsiStaticTargetsResponse `xml:"AddInternetScsiStaticTargetsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -405,7 +425,7 @@ func AddInternetScsiStaticTargets(ctx context.Context, r soap.RoundTripper, req type AddKeyBody struct { Req *types.AddKey `xml:"urn:vim25 AddKey,omitempty"` - Res *types.AddKeyResponse `xml:"urn:vim25 AddKeyResponse,omitempty"` + Res *types.AddKeyResponse `xml:"AddKeyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -425,7 +445,7 @@ func AddKey(ctx context.Context, r soap.RoundTripper, req *types.AddKey) (*types type AddKeysBody struct { Req *types.AddKeys `xml:"urn:vim25 AddKeys,omitempty"` - Res *types.AddKeysResponse `xml:"urn:vim25 AddKeysResponse,omitempty"` + Res *types.AddKeysResponse `xml:"AddKeysResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -445,7 +465,7 @@ func AddKeys(ctx context.Context, r soap.RoundTripper, req *types.AddKeys) (*typ type AddLicenseBody struct { Req *types.AddLicense `xml:"urn:vim25 AddLicense,omitempty"` - Res *types.AddLicenseResponse `xml:"urn:vim25 AddLicenseResponse,omitempty"` + Res *types.AddLicenseResponse `xml:"AddLicenseResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -465,7 +485,7 @@ func AddLicense(ctx context.Context, r soap.RoundTripper, req *types.AddLicense) type AddMonitoredEntitiesBody struct { Req *types.AddMonitoredEntities `xml:"urn:vim25 AddMonitoredEntities,omitempty"` - Res *types.AddMonitoredEntitiesResponse `xml:"urn:vim25 AddMonitoredEntitiesResponse,omitempty"` + Res *types.AddMonitoredEntitiesResponse `xml:"AddMonitoredEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -485,7 +505,7 @@ func AddMonitoredEntities(ctx context.Context, r soap.RoundTripper, req *types.A type AddNetworkResourcePoolBody struct { Req *types.AddNetworkResourcePool `xml:"urn:vim25 AddNetworkResourcePool,omitempty"` - Res *types.AddNetworkResourcePoolResponse `xml:"urn:vim25 AddNetworkResourcePoolResponse,omitempty"` + Res *types.AddNetworkResourcePoolResponse `xml:"AddNetworkResourcePoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -505,7 +525,7 @@ func AddNetworkResourcePool(ctx context.Context, r soap.RoundTripper, req *types type AddPortGroupBody struct { Req *types.AddPortGroup `xml:"urn:vim25 AddPortGroup,omitempty"` - Res *types.AddPortGroupResponse `xml:"urn:vim25 AddPortGroupResponse,omitempty"` + Res *types.AddPortGroupResponse `xml:"AddPortGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -525,7 +545,7 @@ func AddPortGroup(ctx context.Context, r soap.RoundTripper, req *types.AddPortGr type AddServiceConsoleVirtualNicBody struct { Req *types.AddServiceConsoleVirtualNic `xml:"urn:vim25 AddServiceConsoleVirtualNic,omitempty"` - Res *types.AddServiceConsoleVirtualNicResponse `xml:"urn:vim25 AddServiceConsoleVirtualNicResponse,omitempty"` + Res *types.AddServiceConsoleVirtualNicResponse `xml:"AddServiceConsoleVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -545,7 +565,7 @@ func AddServiceConsoleVirtualNic(ctx context.Context, r soap.RoundTripper, req * type AddStandaloneHost_TaskBody struct { Req *types.AddStandaloneHost_Task `xml:"urn:vim25 AddStandaloneHost_Task,omitempty"` - Res *types.AddStandaloneHost_TaskResponse `xml:"urn:vim25 AddStandaloneHost_TaskResponse,omitempty"` + Res *types.AddStandaloneHost_TaskResponse `xml:"AddStandaloneHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -565,7 +585,7 @@ func AddStandaloneHost_Task(ctx context.Context, r soap.RoundTripper, req *types type AddVirtualNicBody struct { Req *types.AddVirtualNic `xml:"urn:vim25 AddVirtualNic,omitempty"` - Res *types.AddVirtualNicResponse `xml:"urn:vim25 AddVirtualNicResponse,omitempty"` + Res *types.AddVirtualNicResponse `xml:"AddVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -585,7 +605,7 @@ func AddVirtualNic(ctx context.Context, r soap.RoundTripper, req *types.AddVirtu type AddVirtualSwitchBody struct { Req *types.AddVirtualSwitch `xml:"urn:vim25 AddVirtualSwitch,omitempty"` - Res *types.AddVirtualSwitchResponse `xml:"urn:vim25 AddVirtualSwitchResponse,omitempty"` + Res *types.AddVirtualSwitchResponse `xml:"AddVirtualSwitchResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -605,7 +625,7 @@ func AddVirtualSwitch(ctx context.Context, r soap.RoundTripper, req *types.AddVi type AllocateIpv4AddressBody struct { Req *types.AllocateIpv4Address `xml:"urn:vim25 AllocateIpv4Address,omitempty"` - Res *types.AllocateIpv4AddressResponse `xml:"urn:vim25 AllocateIpv4AddressResponse,omitempty"` + Res *types.AllocateIpv4AddressResponse `xml:"AllocateIpv4AddressResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -625,7 +645,7 @@ func AllocateIpv4Address(ctx context.Context, r soap.RoundTripper, req *types.Al type AllocateIpv6AddressBody struct { Req *types.AllocateIpv6Address `xml:"urn:vim25 AllocateIpv6Address,omitempty"` - Res *types.AllocateIpv6AddressResponse `xml:"urn:vim25 AllocateIpv6AddressResponse,omitempty"` + Res *types.AllocateIpv6AddressResponse `xml:"AllocateIpv6AddressResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -645,7 +665,7 @@ func AllocateIpv6Address(ctx context.Context, r soap.RoundTripper, req *types.Al type AnswerVMBody struct { Req *types.AnswerVM `xml:"urn:vim25 AnswerVM,omitempty"` - Res *types.AnswerVMResponse `xml:"urn:vim25 AnswerVMResponse,omitempty"` + Res *types.AnswerVMResponse `xml:"AnswerVMResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -665,7 +685,7 @@ func AnswerVM(ctx context.Context, r soap.RoundTripper, req *types.AnswerVM) (*t type ApplyEntitiesConfig_TaskBody struct { Req *types.ApplyEntitiesConfig_Task `xml:"urn:vim25 ApplyEntitiesConfig_Task,omitempty"` - Res *types.ApplyEntitiesConfig_TaskResponse `xml:"urn:vim25 ApplyEntitiesConfig_TaskResponse,omitempty"` + Res *types.ApplyEntitiesConfig_TaskResponse `xml:"ApplyEntitiesConfig_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -683,9 +703,29 @@ func ApplyEntitiesConfig_Task(ctx context.Context, r soap.RoundTripper, req *typ return resBody.Res, nil } +type ApplyEvcModeVM_TaskBody struct { + Req *types.ApplyEvcModeVM_Task `xml:"urn:vim25 ApplyEvcModeVM_Task,omitempty"` + Res *types.ApplyEvcModeVM_TaskResponse `xml:"ApplyEvcModeVM_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ApplyEvcModeVM_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ApplyEvcModeVM_Task(ctx context.Context, r soap.RoundTripper, req *types.ApplyEvcModeVM_Task) (*types.ApplyEvcModeVM_TaskResponse, error) { + var reqBody, resBody ApplyEvcModeVM_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ApplyHostConfig_TaskBody struct { Req *types.ApplyHostConfig_Task `xml:"urn:vim25 ApplyHostConfig_Task,omitempty"` - Res *types.ApplyHostConfig_TaskResponse `xml:"urn:vim25 ApplyHostConfig_TaskResponse,omitempty"` + Res *types.ApplyHostConfig_TaskResponse `xml:"ApplyHostConfig_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -705,7 +745,7 @@ func ApplyHostConfig_Task(ctx context.Context, r soap.RoundTripper, req *types.A type ApplyRecommendationBody struct { Req *types.ApplyRecommendation `xml:"urn:vim25 ApplyRecommendation,omitempty"` - Res *types.ApplyRecommendationResponse `xml:"urn:vim25 ApplyRecommendationResponse,omitempty"` + Res *types.ApplyRecommendationResponse `xml:"ApplyRecommendationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -725,7 +765,7 @@ func ApplyRecommendation(ctx context.Context, r soap.RoundTripper, req *types.Ap type ApplyStorageDrsRecommendationToPod_TaskBody struct { Req *types.ApplyStorageDrsRecommendationToPod_Task `xml:"urn:vim25 ApplyStorageDrsRecommendationToPod_Task,omitempty"` - Res *types.ApplyStorageDrsRecommendationToPod_TaskResponse `xml:"urn:vim25 ApplyStorageDrsRecommendationToPod_TaskResponse,omitempty"` + Res *types.ApplyStorageDrsRecommendationToPod_TaskResponse `xml:"ApplyStorageDrsRecommendationToPod_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -745,7 +785,7 @@ func ApplyStorageDrsRecommendationToPod_Task(ctx context.Context, r soap.RoundTr type ApplyStorageDrsRecommendation_TaskBody struct { Req *types.ApplyStorageDrsRecommendation_Task `xml:"urn:vim25 ApplyStorageDrsRecommendation_Task,omitempty"` - Res *types.ApplyStorageDrsRecommendation_TaskResponse `xml:"urn:vim25 ApplyStorageDrsRecommendation_TaskResponse,omitempty"` + Res *types.ApplyStorageDrsRecommendation_TaskResponse `xml:"ApplyStorageDrsRecommendation_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -765,7 +805,7 @@ func ApplyStorageDrsRecommendation_Task(ctx context.Context, r soap.RoundTripper type AreAlarmActionsEnabledBody struct { Req *types.AreAlarmActionsEnabled `xml:"urn:vim25 AreAlarmActionsEnabled,omitempty"` - Res *types.AreAlarmActionsEnabledResponse `xml:"urn:vim25 AreAlarmActionsEnabledResponse,omitempty"` + Res *types.AreAlarmActionsEnabledResponse `xml:"AreAlarmActionsEnabledResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -785,7 +825,7 @@ func AreAlarmActionsEnabled(ctx context.Context, r soap.RoundTripper, req *types type AssignUserToGroupBody struct { Req *types.AssignUserToGroup `xml:"urn:vim25 AssignUserToGroup,omitempty"` - Res *types.AssignUserToGroupResponse `xml:"urn:vim25 AssignUserToGroupResponse,omitempty"` + Res *types.AssignUserToGroupResponse `xml:"AssignUserToGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -805,7 +845,7 @@ func AssignUserToGroup(ctx context.Context, r soap.RoundTripper, req *types.Assi type AssociateProfileBody struct { Req *types.AssociateProfile `xml:"urn:vim25 AssociateProfile,omitempty"` - Res *types.AssociateProfileResponse `xml:"urn:vim25 AssociateProfileResponse,omitempty"` + Res *types.AssociateProfileResponse `xml:"AssociateProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -825,7 +865,7 @@ func AssociateProfile(ctx context.Context, r soap.RoundTripper, req *types.Assoc type AttachDisk_TaskBody struct { Req *types.AttachDisk_Task `xml:"urn:vim25 AttachDisk_Task,omitempty"` - Res *types.AttachDisk_TaskResponse `xml:"urn:vim25 AttachDisk_TaskResponse,omitempty"` + Res *types.AttachDisk_TaskResponse `xml:"AttachDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -845,7 +885,7 @@ func AttachDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Attach type AttachScsiLunBody struct { Req *types.AttachScsiLun `xml:"urn:vim25 AttachScsiLun,omitempty"` - Res *types.AttachScsiLunResponse `xml:"urn:vim25 AttachScsiLunResponse,omitempty"` + Res *types.AttachScsiLunResponse `xml:"AttachScsiLunResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -865,7 +905,7 @@ func AttachScsiLun(ctx context.Context, r soap.RoundTripper, req *types.AttachSc type AttachScsiLunEx_TaskBody struct { Req *types.AttachScsiLunEx_Task `xml:"urn:vim25 AttachScsiLunEx_Task,omitempty"` - Res *types.AttachScsiLunEx_TaskResponse `xml:"urn:vim25 AttachScsiLunEx_TaskResponse,omitempty"` + Res *types.AttachScsiLunEx_TaskResponse `xml:"AttachScsiLunEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -885,7 +925,7 @@ func AttachScsiLunEx_Task(ctx context.Context, r soap.RoundTripper, req *types.A type AttachTagToVStorageObjectBody struct { Req *types.AttachTagToVStorageObject `xml:"urn:vim25 AttachTagToVStorageObject,omitempty"` - Res *types.AttachTagToVStorageObjectResponse `xml:"urn:vim25 AttachTagToVStorageObjectResponse,omitempty"` + Res *types.AttachTagToVStorageObjectResponse `xml:"AttachTagToVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -905,7 +945,7 @@ func AttachTagToVStorageObject(ctx context.Context, r soap.RoundTripper, req *ty type AttachVmfsExtentBody struct { Req *types.AttachVmfsExtent `xml:"urn:vim25 AttachVmfsExtent,omitempty"` - Res *types.AttachVmfsExtentResponse `xml:"urn:vim25 AttachVmfsExtentResponse,omitempty"` + Res *types.AttachVmfsExtentResponse `xml:"AttachVmfsExtentResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -925,7 +965,7 @@ func AttachVmfsExtent(ctx context.Context, r soap.RoundTripper, req *types.Attac type AutoStartPowerOffBody struct { Req *types.AutoStartPowerOff `xml:"urn:vim25 AutoStartPowerOff,omitempty"` - Res *types.AutoStartPowerOffResponse `xml:"urn:vim25 AutoStartPowerOffResponse,omitempty"` + Res *types.AutoStartPowerOffResponse `xml:"AutoStartPowerOffResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -945,7 +985,7 @@ func AutoStartPowerOff(ctx context.Context, r soap.RoundTripper, req *types.Auto type AutoStartPowerOnBody struct { Req *types.AutoStartPowerOn `xml:"urn:vim25 AutoStartPowerOn,omitempty"` - Res *types.AutoStartPowerOnResponse `xml:"urn:vim25 AutoStartPowerOnResponse,omitempty"` + Res *types.AutoStartPowerOnResponse `xml:"AutoStartPowerOnResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -965,7 +1005,7 @@ func AutoStartPowerOn(ctx context.Context, r soap.RoundTripper, req *types.AutoS type BackupFirmwareConfigurationBody struct { Req *types.BackupFirmwareConfiguration `xml:"urn:vim25 BackupFirmwareConfiguration,omitempty"` - Res *types.BackupFirmwareConfigurationResponse `xml:"urn:vim25 BackupFirmwareConfigurationResponse,omitempty"` + Res *types.BackupFirmwareConfigurationResponse `xml:"BackupFirmwareConfigurationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -983,9 +1023,69 @@ func BackupFirmwareConfiguration(ctx context.Context, r soap.RoundTripper, req * return resBody.Res, nil } +type BatchAddHostsToCluster_TaskBody struct { + Req *types.BatchAddHostsToCluster_Task `xml:"urn:vim25 BatchAddHostsToCluster_Task,omitempty"` + Res *types.BatchAddHostsToCluster_TaskResponse `xml:"BatchAddHostsToCluster_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *BatchAddHostsToCluster_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func BatchAddHostsToCluster_Task(ctx context.Context, r soap.RoundTripper, req *types.BatchAddHostsToCluster_Task) (*types.BatchAddHostsToCluster_TaskResponse, error) { + var reqBody, resBody BatchAddHostsToCluster_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type BatchAddStandaloneHosts_TaskBody struct { + Req *types.BatchAddStandaloneHosts_Task `xml:"urn:vim25 BatchAddStandaloneHosts_Task,omitempty"` + Res *types.BatchAddStandaloneHosts_TaskResponse `xml:"BatchAddStandaloneHosts_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *BatchAddStandaloneHosts_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func BatchAddStandaloneHosts_Task(ctx context.Context, r soap.RoundTripper, req *types.BatchAddStandaloneHosts_Task) (*types.BatchAddStandaloneHosts_TaskResponse, error) { + var reqBody, resBody BatchAddStandaloneHosts_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type BatchQueryConnectInfoBody struct { + Req *types.BatchQueryConnectInfo `xml:"urn:vim25 BatchQueryConnectInfo,omitempty"` + Res *types.BatchQueryConnectInfoResponse `xml:"BatchQueryConnectInfoResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *BatchQueryConnectInfoBody) Fault() *soap.Fault { return b.Fault_ } + +func BatchQueryConnectInfo(ctx context.Context, r soap.RoundTripper, req *types.BatchQueryConnectInfo) (*types.BatchQueryConnectInfoResponse, error) { + var reqBody, resBody BatchQueryConnectInfoBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type BindVnicBody struct { Req *types.BindVnic `xml:"urn:vim25 BindVnic,omitempty"` - Res *types.BindVnicResponse `xml:"urn:vim25 BindVnicResponse,omitempty"` + Res *types.BindVnicResponse `xml:"BindVnicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1005,7 +1105,7 @@ func BindVnic(ctx context.Context, r soap.RoundTripper, req *types.BindVnic) (*t type BrowseDiagnosticLogBody struct { Req *types.BrowseDiagnosticLog `xml:"urn:vim25 BrowseDiagnosticLog,omitempty"` - Res *types.BrowseDiagnosticLogResponse `xml:"urn:vim25 BrowseDiagnosticLogResponse,omitempty"` + Res *types.BrowseDiagnosticLogResponse `xml:"BrowseDiagnosticLogResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1025,7 +1125,7 @@ func BrowseDiagnosticLog(ctx context.Context, r soap.RoundTripper, req *types.Br type CanProvisionObjectsBody struct { Req *types.CanProvisionObjects `xml:"urn:vim25 CanProvisionObjects,omitempty"` - Res *types.CanProvisionObjectsResponse `xml:"urn:vim25 CanProvisionObjectsResponse,omitempty"` + Res *types.CanProvisionObjectsResponse `xml:"CanProvisionObjectsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1045,7 +1145,7 @@ func CanProvisionObjects(ctx context.Context, r soap.RoundTripper, req *types.Ca type CancelRecommendationBody struct { Req *types.CancelRecommendation `xml:"urn:vim25 CancelRecommendation,omitempty"` - Res *types.CancelRecommendationResponse `xml:"urn:vim25 CancelRecommendationResponse,omitempty"` + Res *types.CancelRecommendationResponse `xml:"CancelRecommendationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1065,7 +1165,7 @@ func CancelRecommendation(ctx context.Context, r soap.RoundTripper, req *types.C type CancelRetrievePropertiesExBody struct { Req *types.CancelRetrievePropertiesEx `xml:"urn:vim25 CancelRetrievePropertiesEx,omitempty"` - Res *types.CancelRetrievePropertiesExResponse `xml:"urn:vim25 CancelRetrievePropertiesExResponse,omitempty"` + Res *types.CancelRetrievePropertiesExResponse `xml:"CancelRetrievePropertiesExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1085,7 +1185,7 @@ func CancelRetrievePropertiesEx(ctx context.Context, r soap.RoundTripper, req *t type CancelStorageDrsRecommendationBody struct { Req *types.CancelStorageDrsRecommendation `xml:"urn:vim25 CancelStorageDrsRecommendation,omitempty"` - Res *types.CancelStorageDrsRecommendationResponse `xml:"urn:vim25 CancelStorageDrsRecommendationResponse,omitempty"` + Res *types.CancelStorageDrsRecommendationResponse `xml:"CancelStorageDrsRecommendationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1105,7 +1205,7 @@ func CancelStorageDrsRecommendation(ctx context.Context, r soap.RoundTripper, re type CancelTaskBody struct { Req *types.CancelTask `xml:"urn:vim25 CancelTask,omitempty"` - Res *types.CancelTaskResponse `xml:"urn:vim25 CancelTaskResponse,omitempty"` + Res *types.CancelTaskResponse `xml:"CancelTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1125,7 +1225,7 @@ func CancelTask(ctx context.Context, r soap.RoundTripper, req *types.CancelTask) type CancelWaitForUpdatesBody struct { Req *types.CancelWaitForUpdates `xml:"urn:vim25 CancelWaitForUpdates,omitempty"` - Res *types.CancelWaitForUpdatesResponse `xml:"urn:vim25 CancelWaitForUpdatesResponse,omitempty"` + Res *types.CancelWaitForUpdatesResponse `xml:"CancelWaitForUpdatesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1145,7 +1245,7 @@ func CancelWaitForUpdates(ctx context.Context, r soap.RoundTripper, req *types.C type CertMgrRefreshCACertificatesAndCRLs_TaskBody struct { Req *types.CertMgrRefreshCACertificatesAndCRLs_Task `xml:"urn:vim25 CertMgrRefreshCACertificatesAndCRLs_Task,omitempty"` - Res *types.CertMgrRefreshCACertificatesAndCRLs_TaskResponse `xml:"urn:vim25 CertMgrRefreshCACertificatesAndCRLs_TaskResponse,omitempty"` + Res *types.CertMgrRefreshCACertificatesAndCRLs_TaskResponse `xml:"CertMgrRefreshCACertificatesAndCRLs_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1165,7 +1265,7 @@ func CertMgrRefreshCACertificatesAndCRLs_Task(ctx context.Context, r soap.RoundT type CertMgrRefreshCertificates_TaskBody struct { Req *types.CertMgrRefreshCertificates_Task `xml:"urn:vim25 CertMgrRefreshCertificates_Task,omitempty"` - Res *types.CertMgrRefreshCertificates_TaskResponse `xml:"urn:vim25 CertMgrRefreshCertificates_TaskResponse,omitempty"` + Res *types.CertMgrRefreshCertificates_TaskResponse `xml:"CertMgrRefreshCertificates_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1185,7 +1285,7 @@ func CertMgrRefreshCertificates_Task(ctx context.Context, r soap.RoundTripper, r type CertMgrRevokeCertificates_TaskBody struct { Req *types.CertMgrRevokeCertificates_Task `xml:"urn:vim25 CertMgrRevokeCertificates_Task,omitempty"` - Res *types.CertMgrRevokeCertificates_TaskResponse `xml:"urn:vim25 CertMgrRevokeCertificates_TaskResponse,omitempty"` + Res *types.CertMgrRevokeCertificates_TaskResponse `xml:"CertMgrRevokeCertificates_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1205,7 +1305,7 @@ func CertMgrRevokeCertificates_Task(ctx context.Context, r soap.RoundTripper, re type ChangeAccessModeBody struct { Req *types.ChangeAccessMode `xml:"urn:vim25 ChangeAccessMode,omitempty"` - Res *types.ChangeAccessModeResponse `xml:"urn:vim25 ChangeAccessModeResponse,omitempty"` + Res *types.ChangeAccessModeResponse `xml:"ChangeAccessModeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1225,7 +1325,7 @@ func ChangeAccessMode(ctx context.Context, r soap.RoundTripper, req *types.Chang type ChangeFileAttributesInGuestBody struct { Req *types.ChangeFileAttributesInGuest `xml:"urn:vim25 ChangeFileAttributesInGuest,omitempty"` - Res *types.ChangeFileAttributesInGuestResponse `xml:"urn:vim25 ChangeFileAttributesInGuestResponse,omitempty"` + Res *types.ChangeFileAttributesInGuestResponse `xml:"ChangeFileAttributesInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1243,9 +1343,29 @@ func ChangeFileAttributesInGuest(ctx context.Context, r soap.RoundTripper, req * return resBody.Res, nil } +type ChangeKey_TaskBody struct { + Req *types.ChangeKey_Task `xml:"urn:vim25 ChangeKey_Task,omitempty"` + Res *types.ChangeKey_TaskResponse `xml:"ChangeKey_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ChangeKey_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ChangeKey_Task(ctx context.Context, r soap.RoundTripper, req *types.ChangeKey_Task) (*types.ChangeKey_TaskResponse, error) { + var reqBody, resBody ChangeKey_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ChangeLockdownModeBody struct { Req *types.ChangeLockdownMode `xml:"urn:vim25 ChangeLockdownMode,omitempty"` - Res *types.ChangeLockdownModeResponse `xml:"urn:vim25 ChangeLockdownModeResponse,omitempty"` + Res *types.ChangeLockdownModeResponse `xml:"ChangeLockdownModeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1265,7 +1385,7 @@ func ChangeLockdownMode(ctx context.Context, r soap.RoundTripper, req *types.Cha type ChangeNFSUserPasswordBody struct { Req *types.ChangeNFSUserPassword `xml:"urn:vim25 ChangeNFSUserPassword,omitempty"` - Res *types.ChangeNFSUserPasswordResponse `xml:"urn:vim25 ChangeNFSUserPasswordResponse,omitempty"` + Res *types.ChangeNFSUserPasswordResponse `xml:"ChangeNFSUserPasswordResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1285,7 +1405,7 @@ func ChangeNFSUserPassword(ctx context.Context, r soap.RoundTripper, req *types. type ChangeOwnerBody struct { Req *types.ChangeOwner `xml:"urn:vim25 ChangeOwner,omitempty"` - Res *types.ChangeOwnerResponse `xml:"urn:vim25 ChangeOwnerResponse,omitempty"` + Res *types.ChangeOwnerResponse `xml:"ChangeOwnerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1303,9 +1423,29 @@ func ChangeOwner(ctx context.Context, r soap.RoundTripper, req *types.ChangeOwne return resBody.Res, nil } +type ChangePasswordBody struct { + Req *types.ChangePassword `xml:"urn:vim25 ChangePassword,omitempty"` + Res *types.ChangePasswordResponse `xml:"ChangePasswordResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ChangePasswordBody) Fault() *soap.Fault { return b.Fault_ } + +func ChangePassword(ctx context.Context, r soap.RoundTripper, req *types.ChangePassword) (*types.ChangePasswordResponse, error) { + var reqBody, resBody ChangePasswordBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CheckAddHostEvc_TaskBody struct { Req *types.CheckAddHostEvc_Task `xml:"urn:vim25 CheckAddHostEvc_Task,omitempty"` - Res *types.CheckAddHostEvc_TaskResponse `xml:"urn:vim25 CheckAddHostEvc_TaskResponse,omitempty"` + Res *types.CheckAddHostEvc_TaskResponse `xml:"CheckAddHostEvc_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1325,7 +1465,7 @@ func CheckAddHostEvc_Task(ctx context.Context, r soap.RoundTripper, req *types.C type CheckAnswerFileStatus_TaskBody struct { Req *types.CheckAnswerFileStatus_Task `xml:"urn:vim25 CheckAnswerFileStatus_Task,omitempty"` - Res *types.CheckAnswerFileStatus_TaskResponse `xml:"urn:vim25 CheckAnswerFileStatus_TaskResponse,omitempty"` + Res *types.CheckAnswerFileStatus_TaskResponse `xml:"CheckAnswerFileStatus_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1343,9 +1483,29 @@ func CheckAnswerFileStatus_Task(ctx context.Context, r soap.RoundTripper, req *t return resBody.Res, nil } +type CheckClone_TaskBody struct { + Req *types.CheckClone_Task `xml:"urn:vim25 CheckClone_Task,omitempty"` + Res *types.CheckClone_TaskResponse `xml:"CheckClone_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CheckClone_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CheckClone_Task(ctx context.Context, r soap.RoundTripper, req *types.CheckClone_Task) (*types.CheckClone_TaskResponse, error) { + var reqBody, resBody CheckClone_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CheckCompatibility_TaskBody struct { Req *types.CheckCompatibility_Task `xml:"urn:vim25 CheckCompatibility_Task,omitempty"` - Res *types.CheckCompatibility_TaskResponse `xml:"urn:vim25 CheckCompatibility_TaskResponse,omitempty"` + Res *types.CheckCompatibility_TaskResponse `xml:"CheckCompatibility_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1365,7 +1525,7 @@ func CheckCompatibility_Task(ctx context.Context, r soap.RoundTripper, req *type type CheckCompliance_TaskBody struct { Req *types.CheckCompliance_Task `xml:"urn:vim25 CheckCompliance_Task,omitempty"` - Res *types.CheckCompliance_TaskResponse `xml:"urn:vim25 CheckCompliance_TaskResponse,omitempty"` + Res *types.CheckCompliance_TaskResponse `xml:"CheckCompliance_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1385,7 +1545,7 @@ func CheckCompliance_Task(ctx context.Context, r soap.RoundTripper, req *types.C type CheckConfigureEvcMode_TaskBody struct { Req *types.CheckConfigureEvcMode_Task `xml:"urn:vim25 CheckConfigureEvcMode_Task,omitempty"` - Res *types.CheckConfigureEvcMode_TaskResponse `xml:"urn:vim25 CheckConfigureEvcMode_TaskResponse,omitempty"` + Res *types.CheckConfigureEvcMode_TaskResponse `xml:"CheckConfigureEvcMode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1405,7 +1565,7 @@ func CheckConfigureEvcMode_Task(ctx context.Context, r soap.RoundTripper, req *t type CheckCustomizationResourcesBody struct { Req *types.CheckCustomizationResources `xml:"urn:vim25 CheckCustomizationResources,omitempty"` - Res *types.CheckCustomizationResourcesResponse `xml:"urn:vim25 CheckCustomizationResourcesResponse,omitempty"` + Res *types.CheckCustomizationResourcesResponse `xml:"CheckCustomizationResourcesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1425,7 +1585,7 @@ func CheckCustomizationResources(ctx context.Context, r soap.RoundTripper, req * type CheckCustomizationSpecBody struct { Req *types.CheckCustomizationSpec `xml:"urn:vim25 CheckCustomizationSpec,omitempty"` - Res *types.CheckCustomizationSpecResponse `xml:"urn:vim25 CheckCustomizationSpecResponse,omitempty"` + Res *types.CheckCustomizationSpecResponse `xml:"CheckCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1445,7 +1605,7 @@ func CheckCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *types type CheckForUpdatesBody struct { Req *types.CheckForUpdates `xml:"urn:vim25 CheckForUpdates,omitempty"` - Res *types.CheckForUpdatesResponse `xml:"urn:vim25 CheckForUpdatesResponse,omitempty"` + Res *types.CheckForUpdatesResponse `xml:"CheckForUpdatesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1465,7 +1625,7 @@ func CheckForUpdates(ctx context.Context, r soap.RoundTripper, req *types.CheckF type CheckHostPatch_TaskBody struct { Req *types.CheckHostPatch_Task `xml:"urn:vim25 CheckHostPatch_Task,omitempty"` - Res *types.CheckHostPatch_TaskResponse `xml:"urn:vim25 CheckHostPatch_TaskResponse,omitempty"` + Res *types.CheckHostPatch_TaskResponse `xml:"CheckHostPatch_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1483,9 +1643,29 @@ func CheckHostPatch_Task(ctx context.Context, r soap.RoundTripper, req *types.Ch return resBody.Res, nil } +type CheckInstantClone_TaskBody struct { + Req *types.CheckInstantClone_Task `xml:"urn:vim25 CheckInstantClone_Task,omitempty"` + Res *types.CheckInstantClone_TaskResponse `xml:"CheckInstantClone_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CheckInstantClone_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CheckInstantClone_Task(ctx context.Context, r soap.RoundTripper, req *types.CheckInstantClone_Task) (*types.CheckInstantClone_TaskResponse, error) { + var reqBody, resBody CheckInstantClone_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CheckLicenseFeatureBody struct { Req *types.CheckLicenseFeature `xml:"urn:vim25 CheckLicenseFeature,omitempty"` - Res *types.CheckLicenseFeatureResponse `xml:"urn:vim25 CheckLicenseFeatureResponse,omitempty"` + Res *types.CheckLicenseFeatureResponse `xml:"CheckLicenseFeatureResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1505,7 +1685,7 @@ func CheckLicenseFeature(ctx context.Context, r soap.RoundTripper, req *types.Ch type CheckMigrate_TaskBody struct { Req *types.CheckMigrate_Task `xml:"urn:vim25 CheckMigrate_Task,omitempty"` - Res *types.CheckMigrate_TaskResponse `xml:"urn:vim25 CheckMigrate_TaskResponse,omitempty"` + Res *types.CheckMigrate_TaskResponse `xml:"CheckMigrate_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1523,9 +1703,29 @@ func CheckMigrate_Task(ctx context.Context, r soap.RoundTripper, req *types.Chec return resBody.Res, nil } +type CheckPowerOn_TaskBody struct { + Req *types.CheckPowerOn_Task `xml:"urn:vim25 CheckPowerOn_Task,omitempty"` + Res *types.CheckPowerOn_TaskResponse `xml:"CheckPowerOn_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CheckPowerOn_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CheckPowerOn_Task(ctx context.Context, r soap.RoundTripper, req *types.CheckPowerOn_Task) (*types.CheckPowerOn_TaskResponse, error) { + var reqBody, resBody CheckPowerOn_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CheckProfileCompliance_TaskBody struct { Req *types.CheckProfileCompliance_Task `xml:"urn:vim25 CheckProfileCompliance_Task,omitempty"` - Res *types.CheckProfileCompliance_TaskResponse `xml:"urn:vim25 CheckProfileCompliance_TaskResponse,omitempty"` + Res *types.CheckProfileCompliance_TaskResponse `xml:"CheckProfileCompliance_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1545,7 +1745,7 @@ func CheckProfileCompliance_Task(ctx context.Context, r soap.RoundTripper, req * type CheckRelocate_TaskBody struct { Req *types.CheckRelocate_Task `xml:"urn:vim25 CheckRelocate_Task,omitempty"` - Res *types.CheckRelocate_TaskResponse `xml:"urn:vim25 CheckRelocate_TaskResponse,omitempty"` + Res *types.CheckRelocate_TaskResponse `xml:"CheckRelocate_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1563,9 +1763,29 @@ func CheckRelocate_Task(ctx context.Context, r soap.RoundTripper, req *types.Che return resBody.Res, nil } +type CheckVmConfig_TaskBody struct { + Req *types.CheckVmConfig_Task `xml:"urn:vim25 CheckVmConfig_Task,omitempty"` + Res *types.CheckVmConfig_TaskResponse `xml:"CheckVmConfig_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CheckVmConfig_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CheckVmConfig_Task(ctx context.Context, r soap.RoundTripper, req *types.CheckVmConfig_Task) (*types.CheckVmConfig_TaskResponse, error) { + var reqBody, resBody CheckVmConfig_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ClearComplianceStatusBody struct { Req *types.ClearComplianceStatus `xml:"urn:vim25 ClearComplianceStatus,omitempty"` - Res *types.ClearComplianceStatusResponse `xml:"urn:vim25 ClearComplianceStatusResponse,omitempty"` + Res *types.ClearComplianceStatusResponse `xml:"ClearComplianceStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1585,7 +1805,7 @@ func ClearComplianceStatus(ctx context.Context, r soap.RoundTripper, req *types. type ClearNFSUserBody struct { Req *types.ClearNFSUser `xml:"urn:vim25 ClearNFSUser,omitempty"` - Res *types.ClearNFSUserResponse `xml:"urn:vim25 ClearNFSUserResponse,omitempty"` + Res *types.ClearNFSUserResponse `xml:"ClearNFSUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1605,7 +1825,7 @@ func ClearNFSUser(ctx context.Context, r soap.RoundTripper, req *types.ClearNFSU type ClearSystemEventLogBody struct { Req *types.ClearSystemEventLog `xml:"urn:vim25 ClearSystemEventLog,omitempty"` - Res *types.ClearSystemEventLogResponse `xml:"urn:vim25 ClearSystemEventLogResponse,omitempty"` + Res *types.ClearSystemEventLogResponse `xml:"ClearSystemEventLogResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1623,9 +1843,49 @@ func ClearSystemEventLog(ctx context.Context, r soap.RoundTripper, req *types.Cl return resBody.Res, nil } +type ClearTriggeredAlarmsBody struct { + Req *types.ClearTriggeredAlarms `xml:"urn:vim25 ClearTriggeredAlarms,omitempty"` + Res *types.ClearTriggeredAlarmsResponse `xml:"ClearTriggeredAlarmsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ClearTriggeredAlarmsBody) Fault() *soap.Fault { return b.Fault_ } + +func ClearTriggeredAlarms(ctx context.Context, r soap.RoundTripper, req *types.ClearTriggeredAlarms) (*types.ClearTriggeredAlarmsResponse, error) { + var reqBody, resBody ClearTriggeredAlarmsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type ClearVStorageObjectControlFlagsBody struct { + Req *types.ClearVStorageObjectControlFlags `xml:"urn:vim25 ClearVStorageObjectControlFlags,omitempty"` + Res *types.ClearVStorageObjectControlFlagsResponse `xml:"ClearVStorageObjectControlFlagsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ClearVStorageObjectControlFlagsBody) Fault() *soap.Fault { return b.Fault_ } + +func ClearVStorageObjectControlFlags(ctx context.Context, r soap.RoundTripper, req *types.ClearVStorageObjectControlFlags) (*types.ClearVStorageObjectControlFlagsResponse, error) { + var reqBody, resBody ClearVStorageObjectControlFlagsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CloneSessionBody struct { Req *types.CloneSession `xml:"urn:vim25 CloneSession,omitempty"` - Res *types.CloneSessionResponse `xml:"urn:vim25 CloneSessionResponse,omitempty"` + Res *types.CloneSessionResponse `xml:"CloneSessionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1645,7 +1905,7 @@ func CloneSession(ctx context.Context, r soap.RoundTripper, req *types.CloneSess type CloneVApp_TaskBody struct { Req *types.CloneVApp_Task `xml:"urn:vim25 CloneVApp_Task,omitempty"` - Res *types.CloneVApp_TaskResponse `xml:"urn:vim25 CloneVApp_TaskResponse,omitempty"` + Res *types.CloneVApp_TaskResponse `xml:"CloneVApp_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1665,7 +1925,7 @@ func CloneVApp_Task(ctx context.Context, r soap.RoundTripper, req *types.CloneVA type CloneVM_TaskBody struct { Req *types.CloneVM_Task `xml:"urn:vim25 CloneVM_Task,omitempty"` - Res *types.CloneVM_TaskResponse `xml:"urn:vim25 CloneVM_TaskResponse,omitempty"` + Res *types.CloneVM_TaskResponse `xml:"CloneVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1685,7 +1945,7 @@ func CloneVM_Task(ctx context.Context, r soap.RoundTripper, req *types.CloneVM_T type CloneVStorageObject_TaskBody struct { Req *types.CloneVStorageObject_Task `xml:"urn:vim25 CloneVStorageObject_Task,omitempty"` - Res *types.CloneVStorageObject_TaskResponse `xml:"urn:vim25 CloneVStorageObject_TaskResponse,omitempty"` + Res *types.CloneVStorageObject_TaskResponse `xml:"CloneVStorageObject_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1705,7 +1965,7 @@ func CloneVStorageObject_Task(ctx context.Context, r soap.RoundTripper, req *typ type CloseInventoryViewFolderBody struct { Req *types.CloseInventoryViewFolder `xml:"urn:vim25 CloseInventoryViewFolder,omitempty"` - Res *types.CloseInventoryViewFolderResponse `xml:"urn:vim25 CloseInventoryViewFolderResponse,omitempty"` + Res *types.CloseInventoryViewFolderResponse `xml:"CloseInventoryViewFolderResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1725,7 +1985,7 @@ func CloseInventoryViewFolder(ctx context.Context, r soap.RoundTripper, req *typ type ClusterEnterMaintenanceModeBody struct { Req *types.ClusterEnterMaintenanceMode `xml:"urn:vim25 ClusterEnterMaintenanceMode,omitempty"` - Res *types.ClusterEnterMaintenanceModeResponse `xml:"urn:vim25 ClusterEnterMaintenanceModeResponse,omitempty"` + Res *types.ClusterEnterMaintenanceModeResponse `xml:"ClusterEnterMaintenanceModeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1743,9 +2003,29 @@ func ClusterEnterMaintenanceMode(ctx context.Context, r soap.RoundTripper, req * return resBody.Res, nil } +type CompositeHostProfile_TaskBody struct { + Req *types.CompositeHostProfile_Task `xml:"urn:vim25 CompositeHostProfile_Task,omitempty"` + Res *types.CompositeHostProfile_TaskResponse `xml:"CompositeHostProfile_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CompositeHostProfile_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CompositeHostProfile_Task(ctx context.Context, r soap.RoundTripper, req *types.CompositeHostProfile_Task) (*types.CompositeHostProfile_TaskResponse, error) { + var reqBody, resBody CompositeHostProfile_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ComputeDiskPartitionInfoBody struct { Req *types.ComputeDiskPartitionInfo `xml:"urn:vim25 ComputeDiskPartitionInfo,omitempty"` - Res *types.ComputeDiskPartitionInfoResponse `xml:"urn:vim25 ComputeDiskPartitionInfoResponse,omitempty"` + Res *types.ComputeDiskPartitionInfoResponse `xml:"ComputeDiskPartitionInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1765,7 +2045,7 @@ func ComputeDiskPartitionInfo(ctx context.Context, r soap.RoundTripper, req *typ type ComputeDiskPartitionInfoForResizeBody struct { Req *types.ComputeDiskPartitionInfoForResize `xml:"urn:vim25 ComputeDiskPartitionInfoForResize,omitempty"` - Res *types.ComputeDiskPartitionInfoForResizeResponse `xml:"urn:vim25 ComputeDiskPartitionInfoForResizeResponse,omitempty"` + Res *types.ComputeDiskPartitionInfoForResizeResponse `xml:"ComputeDiskPartitionInfoForResizeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1785,7 +2065,7 @@ func ComputeDiskPartitionInfoForResize(ctx context.Context, r soap.RoundTripper, type ConfigureCryptoKeyBody struct { Req *types.ConfigureCryptoKey `xml:"urn:vim25 ConfigureCryptoKey,omitempty"` - Res *types.ConfigureCryptoKeyResponse `xml:"urn:vim25 ConfigureCryptoKeyResponse,omitempty"` + Res *types.ConfigureCryptoKeyResponse `xml:"ConfigureCryptoKeyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1805,7 +2085,7 @@ func ConfigureCryptoKey(ctx context.Context, r soap.RoundTripper, req *types.Con type ConfigureDatastoreIORM_TaskBody struct { Req *types.ConfigureDatastoreIORM_Task `xml:"urn:vim25 ConfigureDatastoreIORM_Task,omitempty"` - Res *types.ConfigureDatastoreIORM_TaskResponse `xml:"urn:vim25 ConfigureDatastoreIORM_TaskResponse,omitempty"` + Res *types.ConfigureDatastoreIORM_TaskResponse `xml:"ConfigureDatastoreIORM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1825,7 +2105,7 @@ func ConfigureDatastoreIORM_Task(ctx context.Context, r soap.RoundTripper, req * type ConfigureDatastorePrincipalBody struct { Req *types.ConfigureDatastorePrincipal `xml:"urn:vim25 ConfigureDatastorePrincipal,omitempty"` - Res *types.ConfigureDatastorePrincipalResponse `xml:"urn:vim25 ConfigureDatastorePrincipalResponse,omitempty"` + Res *types.ConfigureDatastorePrincipalResponse `xml:"ConfigureDatastorePrincipalResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1845,7 +2125,7 @@ func ConfigureDatastorePrincipal(ctx context.Context, r soap.RoundTripper, req * type ConfigureEvcMode_TaskBody struct { Req *types.ConfigureEvcMode_Task `xml:"urn:vim25 ConfigureEvcMode_Task,omitempty"` - Res *types.ConfigureEvcMode_TaskResponse `xml:"urn:vim25 ConfigureEvcMode_TaskResponse,omitempty"` + Res *types.ConfigureEvcMode_TaskResponse `xml:"ConfigureEvcMode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1863,9 +2143,29 @@ func ConfigureEvcMode_Task(ctx context.Context, r soap.RoundTripper, req *types. return resBody.Res, nil } +type ConfigureHCI_TaskBody struct { + Req *types.ConfigureHCI_Task `xml:"urn:vim25 ConfigureHCI_Task,omitempty"` + Res *types.ConfigureHCI_TaskResponse `xml:"ConfigureHCI_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ConfigureHCI_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ConfigureHCI_Task(ctx context.Context, r soap.RoundTripper, req *types.ConfigureHCI_Task) (*types.ConfigureHCI_TaskResponse, error) { + var reqBody, resBody ConfigureHCI_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ConfigureHostCache_TaskBody struct { Req *types.ConfigureHostCache_Task `xml:"urn:vim25 ConfigureHostCache_Task,omitempty"` - Res *types.ConfigureHostCache_TaskResponse `xml:"urn:vim25 ConfigureHostCache_TaskResponse,omitempty"` + Res *types.ConfigureHostCache_TaskResponse `xml:"ConfigureHostCache_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1885,7 +2185,7 @@ func ConfigureHostCache_Task(ctx context.Context, r soap.RoundTripper, req *type type ConfigureLicenseSourceBody struct { Req *types.ConfigureLicenseSource `xml:"urn:vim25 ConfigureLicenseSource,omitempty"` - Res *types.ConfigureLicenseSourceResponse `xml:"urn:vim25 ConfigureLicenseSourceResponse,omitempty"` + Res *types.ConfigureLicenseSourceResponse `xml:"ConfigureLicenseSourceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1905,7 +2205,7 @@ func ConfigureLicenseSource(ctx context.Context, r soap.RoundTripper, req *types type ConfigurePowerPolicyBody struct { Req *types.ConfigurePowerPolicy `xml:"urn:vim25 ConfigurePowerPolicy,omitempty"` - Res *types.ConfigurePowerPolicyResponse `xml:"urn:vim25 ConfigurePowerPolicyResponse,omitempty"` + Res *types.ConfigurePowerPolicyResponse `xml:"ConfigurePowerPolicyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1925,7 +2225,7 @@ func ConfigurePowerPolicy(ctx context.Context, r soap.RoundTripper, req *types.C type ConfigureStorageDrsForPod_TaskBody struct { Req *types.ConfigureStorageDrsForPod_Task `xml:"urn:vim25 ConfigureStorageDrsForPod_Task,omitempty"` - Res *types.ConfigureStorageDrsForPod_TaskResponse `xml:"urn:vim25 ConfigureStorageDrsForPod_TaskResponse,omitempty"` + Res *types.ConfigureStorageDrsForPod_TaskResponse `xml:"ConfigureStorageDrsForPod_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1945,7 +2245,7 @@ func ConfigureStorageDrsForPod_Task(ctx context.Context, r soap.RoundTripper, re type ConfigureVFlashResourceEx_TaskBody struct { Req *types.ConfigureVFlashResourceEx_Task `xml:"urn:vim25 ConfigureVFlashResourceEx_Task,omitempty"` - Res *types.ConfigureVFlashResourceEx_TaskResponse `xml:"urn:vim25 ConfigureVFlashResourceEx_TaskResponse,omitempty"` + Res *types.ConfigureVFlashResourceEx_TaskResponse `xml:"ConfigureVFlashResourceEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1965,7 +2265,7 @@ func ConfigureVFlashResourceEx_Task(ctx context.Context, r soap.RoundTripper, re type ConsolidateVMDisks_TaskBody struct { Req *types.ConsolidateVMDisks_Task `xml:"urn:vim25 ConsolidateVMDisks_Task,omitempty"` - Res *types.ConsolidateVMDisks_TaskResponse `xml:"urn:vim25 ConsolidateVMDisks_TaskResponse,omitempty"` + Res *types.ConsolidateVMDisks_TaskResponse `xml:"ConsolidateVMDisks_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -1985,7 +2285,7 @@ func ConsolidateVMDisks_Task(ctx context.Context, r soap.RoundTripper, req *type type ContinueRetrievePropertiesExBody struct { Req *types.ContinueRetrievePropertiesEx `xml:"urn:vim25 ContinueRetrievePropertiesEx,omitempty"` - Res *types.ContinueRetrievePropertiesExResponse `xml:"urn:vim25 ContinueRetrievePropertiesExResponse,omitempty"` + Res *types.ContinueRetrievePropertiesExResponse `xml:"ContinueRetrievePropertiesExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2005,7 +2305,7 @@ func ContinueRetrievePropertiesEx(ctx context.Context, r soap.RoundTripper, req type ConvertNamespacePathToUuidPathBody struct { Req *types.ConvertNamespacePathToUuidPath `xml:"urn:vim25 ConvertNamespacePathToUuidPath,omitempty"` - Res *types.ConvertNamespacePathToUuidPathResponse `xml:"urn:vim25 ConvertNamespacePathToUuidPathResponse,omitempty"` + Res *types.ConvertNamespacePathToUuidPathResponse `xml:"ConvertNamespacePathToUuidPathResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2025,7 +2325,7 @@ func ConvertNamespacePathToUuidPath(ctx context.Context, r soap.RoundTripper, re type CopyDatastoreFile_TaskBody struct { Req *types.CopyDatastoreFile_Task `xml:"urn:vim25 CopyDatastoreFile_Task,omitempty"` - Res *types.CopyDatastoreFile_TaskResponse `xml:"urn:vim25 CopyDatastoreFile_TaskResponse,omitempty"` + Res *types.CopyDatastoreFile_TaskResponse `xml:"CopyDatastoreFile_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2045,7 +2345,7 @@ func CopyDatastoreFile_Task(ctx context.Context, r soap.RoundTripper, req *types type CopyVirtualDisk_TaskBody struct { Req *types.CopyVirtualDisk_Task `xml:"urn:vim25 CopyVirtualDisk_Task,omitempty"` - Res *types.CopyVirtualDisk_TaskResponse `xml:"urn:vim25 CopyVirtualDisk_TaskResponse,omitempty"` + Res *types.CopyVirtualDisk_TaskResponse `xml:"CopyVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2065,7 +2365,7 @@ func CopyVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.C type CreateAlarmBody struct { Req *types.CreateAlarm `xml:"urn:vim25 CreateAlarm,omitempty"` - Res *types.CreateAlarmResponse `xml:"urn:vim25 CreateAlarmResponse,omitempty"` + Res *types.CreateAlarmResponse `xml:"CreateAlarmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2085,7 +2385,7 @@ func CreateAlarm(ctx context.Context, r soap.RoundTripper, req *types.CreateAlar type CreateChildVM_TaskBody struct { Req *types.CreateChildVM_Task `xml:"urn:vim25 CreateChildVM_Task,omitempty"` - Res *types.CreateChildVM_TaskResponse `xml:"urn:vim25 CreateChildVM_TaskResponse,omitempty"` + Res *types.CreateChildVM_TaskResponse `xml:"CreateChildVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2105,7 +2405,7 @@ func CreateChildVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Cre type CreateClusterBody struct { Req *types.CreateCluster `xml:"urn:vim25 CreateCluster,omitempty"` - Res *types.CreateClusterResponse `xml:"urn:vim25 CreateClusterResponse,omitempty"` + Res *types.CreateClusterResponse `xml:"CreateClusterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2125,7 +2425,7 @@ func CreateCluster(ctx context.Context, r soap.RoundTripper, req *types.CreateCl type CreateClusterExBody struct { Req *types.CreateClusterEx `xml:"urn:vim25 CreateClusterEx,omitempty"` - Res *types.CreateClusterExResponse `xml:"urn:vim25 CreateClusterExResponse,omitempty"` + Res *types.CreateClusterExResponse `xml:"CreateClusterExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2145,7 +2445,7 @@ func CreateClusterEx(ctx context.Context, r soap.RoundTripper, req *types.Create type CreateCollectorForEventsBody struct { Req *types.CreateCollectorForEvents `xml:"urn:vim25 CreateCollectorForEvents,omitempty"` - Res *types.CreateCollectorForEventsResponse `xml:"urn:vim25 CreateCollectorForEventsResponse,omitempty"` + Res *types.CreateCollectorForEventsResponse `xml:"CreateCollectorForEventsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2165,7 +2465,7 @@ func CreateCollectorForEvents(ctx context.Context, r soap.RoundTripper, req *typ type CreateCollectorForTasksBody struct { Req *types.CreateCollectorForTasks `xml:"urn:vim25 CreateCollectorForTasks,omitempty"` - Res *types.CreateCollectorForTasksResponse `xml:"urn:vim25 CreateCollectorForTasksResponse,omitempty"` + Res *types.CreateCollectorForTasksResponse `xml:"CreateCollectorForTasksResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2185,7 +2485,7 @@ func CreateCollectorForTasks(ctx context.Context, r soap.RoundTripper, req *type type CreateContainerViewBody struct { Req *types.CreateContainerView `xml:"urn:vim25 CreateContainerView,omitempty"` - Res *types.CreateContainerViewResponse `xml:"urn:vim25 CreateContainerViewResponse,omitempty"` + Res *types.CreateContainerViewResponse `xml:"CreateContainerViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2205,7 +2505,7 @@ func CreateContainerView(ctx context.Context, r soap.RoundTripper, req *types.Cr type CreateCustomizationSpecBody struct { Req *types.CreateCustomizationSpec `xml:"urn:vim25 CreateCustomizationSpec,omitempty"` - Res *types.CreateCustomizationSpecResponse `xml:"urn:vim25 CreateCustomizationSpecResponse,omitempty"` + Res *types.CreateCustomizationSpecResponse `xml:"CreateCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2225,7 +2525,7 @@ func CreateCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *type type CreateDVPortgroup_TaskBody struct { Req *types.CreateDVPortgroup_Task `xml:"urn:vim25 CreateDVPortgroup_Task,omitempty"` - Res *types.CreateDVPortgroup_TaskResponse `xml:"urn:vim25 CreateDVPortgroup_TaskResponse,omitempty"` + Res *types.CreateDVPortgroup_TaskResponse `xml:"CreateDVPortgroup_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2245,7 +2545,7 @@ func CreateDVPortgroup_Task(ctx context.Context, r soap.RoundTripper, req *types type CreateDVS_TaskBody struct { Req *types.CreateDVS_Task `xml:"urn:vim25 CreateDVS_Task,omitempty"` - Res *types.CreateDVS_TaskResponse `xml:"urn:vim25 CreateDVS_TaskResponse,omitempty"` + Res *types.CreateDVS_TaskResponse `xml:"CreateDVS_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2265,7 +2565,7 @@ func CreateDVS_Task(ctx context.Context, r soap.RoundTripper, req *types.CreateD type CreateDatacenterBody struct { Req *types.CreateDatacenter `xml:"urn:vim25 CreateDatacenter,omitempty"` - Res *types.CreateDatacenterResponse `xml:"urn:vim25 CreateDatacenterResponse,omitempty"` + Res *types.CreateDatacenterResponse `xml:"CreateDatacenterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2285,7 +2585,7 @@ func CreateDatacenter(ctx context.Context, r soap.RoundTripper, req *types.Creat type CreateDefaultProfileBody struct { Req *types.CreateDefaultProfile `xml:"urn:vim25 CreateDefaultProfile,omitempty"` - Res *types.CreateDefaultProfileResponse `xml:"urn:vim25 CreateDefaultProfileResponse,omitempty"` + Res *types.CreateDefaultProfileResponse `xml:"CreateDefaultProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2305,7 +2605,7 @@ func CreateDefaultProfile(ctx context.Context, r soap.RoundTripper, req *types.C type CreateDescriptorBody struct { Req *types.CreateDescriptor `xml:"urn:vim25 CreateDescriptor,omitempty"` - Res *types.CreateDescriptorResponse `xml:"urn:vim25 CreateDescriptorResponse,omitempty"` + Res *types.CreateDescriptorResponse `xml:"CreateDescriptorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2325,7 +2625,7 @@ func CreateDescriptor(ctx context.Context, r soap.RoundTripper, req *types.Creat type CreateDiagnosticPartitionBody struct { Req *types.CreateDiagnosticPartition `xml:"urn:vim25 CreateDiagnosticPartition,omitempty"` - Res *types.CreateDiagnosticPartitionResponse `xml:"urn:vim25 CreateDiagnosticPartitionResponse,omitempty"` + Res *types.CreateDiagnosticPartitionResponse `xml:"CreateDiagnosticPartitionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2345,7 +2645,7 @@ func CreateDiagnosticPartition(ctx context.Context, r soap.RoundTripper, req *ty type CreateDirectoryBody struct { Req *types.CreateDirectory `xml:"urn:vim25 CreateDirectory,omitempty"` - Res *types.CreateDirectoryResponse `xml:"urn:vim25 CreateDirectoryResponse,omitempty"` + Res *types.CreateDirectoryResponse `xml:"CreateDirectoryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2363,9 +2663,29 @@ func CreateDirectory(ctx context.Context, r soap.RoundTripper, req *types.Create return resBody.Res, nil } +type CreateDiskFromSnapshot_TaskBody struct { + Req *types.CreateDiskFromSnapshot_Task `xml:"urn:vim25 CreateDiskFromSnapshot_Task,omitempty"` + Res *types.CreateDiskFromSnapshot_TaskResponse `xml:"CreateDiskFromSnapshot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CreateDiskFromSnapshot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CreateDiskFromSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.CreateDiskFromSnapshot_Task) (*types.CreateDiskFromSnapshot_TaskResponse, error) { + var reqBody, resBody CreateDiskFromSnapshot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CreateDisk_TaskBody struct { Req *types.CreateDisk_Task `xml:"urn:vim25 CreateDisk_Task,omitempty"` - Res *types.CreateDisk_TaskResponse `xml:"urn:vim25 CreateDisk_TaskResponse,omitempty"` + Res *types.CreateDisk_TaskResponse `xml:"CreateDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2385,7 +2705,7 @@ func CreateDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Create type CreateFilterBody struct { Req *types.CreateFilter `xml:"urn:vim25 CreateFilter,omitempty"` - Res *types.CreateFilterResponse `xml:"urn:vim25 CreateFilterResponse,omitempty"` + Res *types.CreateFilterResponse `xml:"CreateFilterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2405,7 +2725,7 @@ func CreateFilter(ctx context.Context, r soap.RoundTripper, req *types.CreateFil type CreateFolderBody struct { Req *types.CreateFolder `xml:"urn:vim25 CreateFolder,omitempty"` - Res *types.CreateFolderResponse `xml:"urn:vim25 CreateFolderResponse,omitempty"` + Res *types.CreateFolderResponse `xml:"CreateFolderResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2425,7 +2745,7 @@ func CreateFolder(ctx context.Context, r soap.RoundTripper, req *types.CreateFol type CreateGroupBody struct { Req *types.CreateGroup `xml:"urn:vim25 CreateGroup,omitempty"` - Res *types.CreateGroupResponse `xml:"urn:vim25 CreateGroupResponse,omitempty"` + Res *types.CreateGroupResponse `xml:"CreateGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2445,7 +2765,7 @@ func CreateGroup(ctx context.Context, r soap.RoundTripper, req *types.CreateGrou type CreateImportSpecBody struct { Req *types.CreateImportSpec `xml:"urn:vim25 CreateImportSpec,omitempty"` - Res *types.CreateImportSpecResponse `xml:"urn:vim25 CreateImportSpecResponse,omitempty"` + Res *types.CreateImportSpecResponse `xml:"CreateImportSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2465,7 +2785,7 @@ func CreateImportSpec(ctx context.Context, r soap.RoundTripper, req *types.Creat type CreateInventoryViewBody struct { Req *types.CreateInventoryView `xml:"urn:vim25 CreateInventoryView,omitempty"` - Res *types.CreateInventoryViewResponse `xml:"urn:vim25 CreateInventoryViewResponse,omitempty"` + Res *types.CreateInventoryViewResponse `xml:"CreateInventoryViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2485,7 +2805,7 @@ func CreateInventoryView(ctx context.Context, r soap.RoundTripper, req *types.Cr type CreateIpPoolBody struct { Req *types.CreateIpPool `xml:"urn:vim25 CreateIpPool,omitempty"` - Res *types.CreateIpPoolResponse `xml:"urn:vim25 CreateIpPoolResponse,omitempty"` + Res *types.CreateIpPoolResponse `xml:"CreateIpPoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2505,7 +2825,7 @@ func CreateIpPool(ctx context.Context, r soap.RoundTripper, req *types.CreateIpP type CreateListViewBody struct { Req *types.CreateListView `xml:"urn:vim25 CreateListView,omitempty"` - Res *types.CreateListViewResponse `xml:"urn:vim25 CreateListViewResponse,omitempty"` + Res *types.CreateListViewResponse `xml:"CreateListViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2525,7 +2845,7 @@ func CreateListView(ctx context.Context, r soap.RoundTripper, req *types.CreateL type CreateListViewFromViewBody struct { Req *types.CreateListViewFromView `xml:"urn:vim25 CreateListViewFromView,omitempty"` - Res *types.CreateListViewFromViewResponse `xml:"urn:vim25 CreateListViewFromViewResponse,omitempty"` + Res *types.CreateListViewFromViewResponse `xml:"CreateListViewFromViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2545,7 +2865,7 @@ func CreateListViewFromView(ctx context.Context, r soap.RoundTripper, req *types type CreateLocalDatastoreBody struct { Req *types.CreateLocalDatastore `xml:"urn:vim25 CreateLocalDatastore,omitempty"` - Res *types.CreateLocalDatastoreResponse `xml:"urn:vim25 CreateLocalDatastoreResponse,omitempty"` + Res *types.CreateLocalDatastoreResponse `xml:"CreateLocalDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2565,7 +2885,7 @@ func CreateLocalDatastore(ctx context.Context, r soap.RoundTripper, req *types.C type CreateNasDatastoreBody struct { Req *types.CreateNasDatastore `xml:"urn:vim25 CreateNasDatastore,omitempty"` - Res *types.CreateNasDatastoreResponse `xml:"urn:vim25 CreateNasDatastoreResponse,omitempty"` + Res *types.CreateNasDatastoreResponse `xml:"CreateNasDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2583,9 +2903,49 @@ func CreateNasDatastore(ctx context.Context, r soap.RoundTripper, req *types.Cre return resBody.Res, nil } +type CreateNvdimmNamespace_TaskBody struct { + Req *types.CreateNvdimmNamespace_Task `xml:"urn:vim25 CreateNvdimmNamespace_Task,omitempty"` + Res *types.CreateNvdimmNamespace_TaskResponse `xml:"CreateNvdimmNamespace_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CreateNvdimmNamespace_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CreateNvdimmNamespace_Task(ctx context.Context, r soap.RoundTripper, req *types.CreateNvdimmNamespace_Task) (*types.CreateNvdimmNamespace_TaskResponse, error) { + var reqBody, resBody CreateNvdimmNamespace_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type CreateNvdimmPMemNamespace_TaskBody struct { + Req *types.CreateNvdimmPMemNamespace_Task `xml:"urn:vim25 CreateNvdimmPMemNamespace_Task,omitempty"` + Res *types.CreateNvdimmPMemNamespace_TaskResponse `xml:"CreateNvdimmPMemNamespace_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CreateNvdimmPMemNamespace_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CreateNvdimmPMemNamespace_Task(ctx context.Context, r soap.RoundTripper, req *types.CreateNvdimmPMemNamespace_Task) (*types.CreateNvdimmPMemNamespace_TaskResponse, error) { + var reqBody, resBody CreateNvdimmPMemNamespace_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CreateObjectScheduledTaskBody struct { Req *types.CreateObjectScheduledTask `xml:"urn:vim25 CreateObjectScheduledTask,omitempty"` - Res *types.CreateObjectScheduledTaskResponse `xml:"urn:vim25 CreateObjectScheduledTaskResponse,omitempty"` + Res *types.CreateObjectScheduledTaskResponse `xml:"CreateObjectScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2605,7 +2965,7 @@ func CreateObjectScheduledTask(ctx context.Context, r soap.RoundTripper, req *ty type CreatePerfIntervalBody struct { Req *types.CreatePerfInterval `xml:"urn:vim25 CreatePerfInterval,omitempty"` - Res *types.CreatePerfIntervalResponse `xml:"urn:vim25 CreatePerfIntervalResponse,omitempty"` + Res *types.CreatePerfIntervalResponse `xml:"CreatePerfIntervalResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2625,7 +2985,7 @@ func CreatePerfInterval(ctx context.Context, r soap.RoundTripper, req *types.Cre type CreateProfileBody struct { Req *types.CreateProfile `xml:"urn:vim25 CreateProfile,omitempty"` - Res *types.CreateProfileResponse `xml:"urn:vim25 CreateProfileResponse,omitempty"` + Res *types.CreateProfileResponse `xml:"CreateProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2645,7 +3005,7 @@ func CreateProfile(ctx context.Context, r soap.RoundTripper, req *types.CreatePr type CreatePropertyCollectorBody struct { Req *types.CreatePropertyCollector `xml:"urn:vim25 CreatePropertyCollector,omitempty"` - Res *types.CreatePropertyCollectorResponse `xml:"urn:vim25 CreatePropertyCollectorResponse,omitempty"` + Res *types.CreatePropertyCollectorResponse `xml:"CreatePropertyCollectorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2665,7 +3025,7 @@ func CreatePropertyCollector(ctx context.Context, r soap.RoundTripper, req *type type CreateRegistryKeyInGuestBody struct { Req *types.CreateRegistryKeyInGuest `xml:"urn:vim25 CreateRegistryKeyInGuest,omitempty"` - Res *types.CreateRegistryKeyInGuestResponse `xml:"urn:vim25 CreateRegistryKeyInGuestResponse,omitempty"` + Res *types.CreateRegistryKeyInGuestResponse `xml:"CreateRegistryKeyInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2685,7 +3045,7 @@ func CreateRegistryKeyInGuest(ctx context.Context, r soap.RoundTripper, req *typ type CreateResourcePoolBody struct { Req *types.CreateResourcePool `xml:"urn:vim25 CreateResourcePool,omitempty"` - Res *types.CreateResourcePoolResponse `xml:"urn:vim25 CreateResourcePoolResponse,omitempty"` + Res *types.CreateResourcePoolResponse `xml:"CreateResourcePoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2705,7 +3065,7 @@ func CreateResourcePool(ctx context.Context, r soap.RoundTripper, req *types.Cre type CreateScheduledTaskBody struct { Req *types.CreateScheduledTask `xml:"urn:vim25 CreateScheduledTask,omitempty"` - Res *types.CreateScheduledTaskResponse `xml:"urn:vim25 CreateScheduledTaskResponse,omitempty"` + Res *types.CreateScheduledTaskResponse `xml:"CreateScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2725,7 +3085,7 @@ func CreateScheduledTask(ctx context.Context, r soap.RoundTripper, req *types.Cr type CreateScreenshot_TaskBody struct { Req *types.CreateScreenshot_Task `xml:"urn:vim25 CreateScreenshot_Task,omitempty"` - Res *types.CreateScreenshot_TaskResponse `xml:"urn:vim25 CreateScreenshot_TaskResponse,omitempty"` + Res *types.CreateScreenshot_TaskResponse `xml:"CreateScreenshot_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2745,7 +3105,7 @@ func CreateScreenshot_Task(ctx context.Context, r soap.RoundTripper, req *types. type CreateSecondaryVMEx_TaskBody struct { Req *types.CreateSecondaryVMEx_Task `xml:"urn:vim25 CreateSecondaryVMEx_Task,omitempty"` - Res *types.CreateSecondaryVMEx_TaskResponse `xml:"urn:vim25 CreateSecondaryVMEx_TaskResponse,omitempty"` + Res *types.CreateSecondaryVMEx_TaskResponse `xml:"CreateSecondaryVMEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2765,7 +3125,7 @@ func CreateSecondaryVMEx_Task(ctx context.Context, r soap.RoundTripper, req *typ type CreateSecondaryVM_TaskBody struct { Req *types.CreateSecondaryVM_Task `xml:"urn:vim25 CreateSecondaryVM_Task,omitempty"` - Res *types.CreateSecondaryVM_TaskResponse `xml:"urn:vim25 CreateSecondaryVM_TaskResponse,omitempty"` + Res *types.CreateSecondaryVM_TaskResponse `xml:"CreateSecondaryVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2785,7 +3145,7 @@ func CreateSecondaryVM_Task(ctx context.Context, r soap.RoundTripper, req *types type CreateSnapshotEx_TaskBody struct { Req *types.CreateSnapshotEx_Task `xml:"urn:vim25 CreateSnapshotEx_Task,omitempty"` - Res *types.CreateSnapshotEx_TaskResponse `xml:"urn:vim25 CreateSnapshotEx_TaskResponse,omitempty"` + Res *types.CreateSnapshotEx_TaskResponse `xml:"CreateSnapshotEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2805,7 +3165,7 @@ func CreateSnapshotEx_Task(ctx context.Context, r soap.RoundTripper, req *types. type CreateSnapshot_TaskBody struct { Req *types.CreateSnapshot_Task `xml:"urn:vim25 CreateSnapshot_Task,omitempty"` - Res *types.CreateSnapshot_TaskResponse `xml:"urn:vim25 CreateSnapshot_TaskResponse,omitempty"` + Res *types.CreateSnapshot_TaskResponse `xml:"CreateSnapshot_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2825,7 +3185,7 @@ func CreateSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.Cr type CreateStoragePodBody struct { Req *types.CreateStoragePod `xml:"urn:vim25 CreateStoragePod,omitempty"` - Res *types.CreateStoragePodResponse `xml:"urn:vim25 CreateStoragePodResponse,omitempty"` + Res *types.CreateStoragePodResponse `xml:"CreateStoragePodResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2845,7 +3205,7 @@ func CreateStoragePod(ctx context.Context, r soap.RoundTripper, req *types.Creat type CreateTaskBody struct { Req *types.CreateTask `xml:"urn:vim25 CreateTask,omitempty"` - Res *types.CreateTaskResponse `xml:"urn:vim25 CreateTaskResponse,omitempty"` + Res *types.CreateTaskResponse `xml:"CreateTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2865,7 +3225,7 @@ func CreateTask(ctx context.Context, r soap.RoundTripper, req *types.CreateTask) type CreateTemporaryDirectoryInGuestBody struct { Req *types.CreateTemporaryDirectoryInGuest `xml:"urn:vim25 CreateTemporaryDirectoryInGuest,omitempty"` - Res *types.CreateTemporaryDirectoryInGuestResponse `xml:"urn:vim25 CreateTemporaryDirectoryInGuestResponse,omitempty"` + Res *types.CreateTemporaryDirectoryInGuestResponse `xml:"CreateTemporaryDirectoryInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2885,7 +3245,7 @@ func CreateTemporaryDirectoryInGuest(ctx context.Context, r soap.RoundTripper, r type CreateTemporaryFileInGuestBody struct { Req *types.CreateTemporaryFileInGuest `xml:"urn:vim25 CreateTemporaryFileInGuest,omitempty"` - Res *types.CreateTemporaryFileInGuestResponse `xml:"urn:vim25 CreateTemporaryFileInGuestResponse,omitempty"` + Res *types.CreateTemporaryFileInGuestResponse `xml:"CreateTemporaryFileInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2905,7 +3265,7 @@ func CreateTemporaryFileInGuest(ctx context.Context, r soap.RoundTripper, req *t type CreateUserBody struct { Req *types.CreateUser `xml:"urn:vim25 CreateUser,omitempty"` - Res *types.CreateUserResponse `xml:"urn:vim25 CreateUserResponse,omitempty"` + Res *types.CreateUserResponse `xml:"CreateUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2925,7 +3285,7 @@ func CreateUser(ctx context.Context, r soap.RoundTripper, req *types.CreateUser) type CreateVAppBody struct { Req *types.CreateVApp `xml:"urn:vim25 CreateVApp,omitempty"` - Res *types.CreateVAppResponse `xml:"urn:vim25 CreateVAppResponse,omitempty"` + Res *types.CreateVAppResponse `xml:"CreateVAppResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2945,7 +3305,7 @@ func CreateVApp(ctx context.Context, r soap.RoundTripper, req *types.CreateVApp) type CreateVM_TaskBody struct { Req *types.CreateVM_Task `xml:"urn:vim25 CreateVM_Task,omitempty"` - Res *types.CreateVM_TaskResponse `xml:"urn:vim25 CreateVM_TaskResponse,omitempty"` + Res *types.CreateVM_TaskResponse `xml:"CreateVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2965,7 +3325,7 @@ func CreateVM_Task(ctx context.Context, r soap.RoundTripper, req *types.CreateVM type CreateVirtualDisk_TaskBody struct { Req *types.CreateVirtualDisk_Task `xml:"urn:vim25 CreateVirtualDisk_Task,omitempty"` - Res *types.CreateVirtualDisk_TaskResponse `xml:"urn:vim25 CreateVirtualDisk_TaskResponse,omitempty"` + Res *types.CreateVirtualDisk_TaskResponse `xml:"CreateVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -2985,7 +3345,7 @@ func CreateVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types type CreateVmfsDatastoreBody struct { Req *types.CreateVmfsDatastore `xml:"urn:vim25 CreateVmfsDatastore,omitempty"` - Res *types.CreateVmfsDatastoreResponse `xml:"urn:vim25 CreateVmfsDatastoreResponse,omitempty"` + Res *types.CreateVmfsDatastoreResponse `xml:"CreateVmfsDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3005,7 +3365,7 @@ func CreateVmfsDatastore(ctx context.Context, r soap.RoundTripper, req *types.Cr type CreateVvolDatastoreBody struct { Req *types.CreateVvolDatastore `xml:"urn:vim25 CreateVvolDatastore,omitempty"` - Res *types.CreateVvolDatastoreResponse `xml:"urn:vim25 CreateVvolDatastoreResponse,omitempty"` + Res *types.CreateVvolDatastoreResponse `xml:"CreateVvolDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3023,9 +3383,69 @@ func CreateVvolDatastore(ctx context.Context, r soap.RoundTripper, req *types.Cr return resBody.Res, nil } +type CryptoManagerHostEnableBody struct { + Req *types.CryptoManagerHostEnable `xml:"urn:vim25 CryptoManagerHostEnable,omitempty"` + Res *types.CryptoManagerHostEnableResponse `xml:"CryptoManagerHostEnableResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CryptoManagerHostEnableBody) Fault() *soap.Fault { return b.Fault_ } + +func CryptoManagerHostEnable(ctx context.Context, r soap.RoundTripper, req *types.CryptoManagerHostEnable) (*types.CryptoManagerHostEnableResponse, error) { + var reqBody, resBody CryptoManagerHostEnableBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type CryptoManagerHostPrepareBody struct { + Req *types.CryptoManagerHostPrepare `xml:"urn:vim25 CryptoManagerHostPrepare,omitempty"` + Res *types.CryptoManagerHostPrepareResponse `xml:"CryptoManagerHostPrepareResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CryptoManagerHostPrepareBody) Fault() *soap.Fault { return b.Fault_ } + +func CryptoManagerHostPrepare(ctx context.Context, r soap.RoundTripper, req *types.CryptoManagerHostPrepare) (*types.CryptoManagerHostPrepareResponse, error) { + var reqBody, resBody CryptoManagerHostPrepareBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type CryptoUnlock_TaskBody struct { + Req *types.CryptoUnlock_Task `xml:"urn:vim25 CryptoUnlock_Task,omitempty"` + Res *types.CryptoUnlock_TaskResponse `xml:"CryptoUnlock_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CryptoUnlock_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CryptoUnlock_Task(ctx context.Context, r soap.RoundTripper, req *types.CryptoUnlock_Task) (*types.CryptoUnlock_TaskResponse, error) { + var reqBody, resBody CryptoUnlock_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type CurrentTimeBody struct { Req *types.CurrentTime `xml:"urn:vim25 CurrentTime,omitempty"` - Res *types.CurrentTimeResponse `xml:"urn:vim25 CurrentTimeResponse,omitempty"` + Res *types.CurrentTimeResponse `xml:"CurrentTimeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3045,7 +3465,7 @@ func CurrentTime(ctx context.Context, r soap.RoundTripper, req *types.CurrentTim type CustomizationSpecItemToXmlBody struct { Req *types.CustomizationSpecItemToXml `xml:"urn:vim25 CustomizationSpecItemToXml,omitempty"` - Res *types.CustomizationSpecItemToXmlResponse `xml:"urn:vim25 CustomizationSpecItemToXmlResponse,omitempty"` + Res *types.CustomizationSpecItemToXmlResponse `xml:"CustomizationSpecItemToXmlResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3065,7 +3485,7 @@ func CustomizationSpecItemToXml(ctx context.Context, r soap.RoundTripper, req *t type CustomizeVM_TaskBody struct { Req *types.CustomizeVM_Task `xml:"urn:vim25 CustomizeVM_Task,omitempty"` - Res *types.CustomizeVM_TaskResponse `xml:"urn:vim25 CustomizeVM_TaskResponse,omitempty"` + Res *types.CustomizeVM_TaskResponse `xml:"CustomizeVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3085,7 +3505,7 @@ func CustomizeVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Custo type DVPortgroupRollback_TaskBody struct { Req *types.DVPortgroupRollback_Task `xml:"urn:vim25 DVPortgroupRollback_Task,omitempty"` - Res *types.DVPortgroupRollback_TaskResponse `xml:"urn:vim25 DVPortgroupRollback_TaskResponse,omitempty"` + Res *types.DVPortgroupRollback_TaskResponse `xml:"DVPortgroupRollback_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3105,7 +3525,7 @@ func DVPortgroupRollback_Task(ctx context.Context, r soap.RoundTripper, req *typ type DVSManagerExportEntity_TaskBody struct { Req *types.DVSManagerExportEntity_Task `xml:"urn:vim25 DVSManagerExportEntity_Task,omitempty"` - Res *types.DVSManagerExportEntity_TaskResponse `xml:"urn:vim25 DVSManagerExportEntity_TaskResponse,omitempty"` + Res *types.DVSManagerExportEntity_TaskResponse `xml:"DVSManagerExportEntity_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3125,7 +3545,7 @@ func DVSManagerExportEntity_Task(ctx context.Context, r soap.RoundTripper, req * type DVSManagerImportEntity_TaskBody struct { Req *types.DVSManagerImportEntity_Task `xml:"urn:vim25 DVSManagerImportEntity_Task,omitempty"` - Res *types.DVSManagerImportEntity_TaskResponse `xml:"urn:vim25 DVSManagerImportEntity_TaskResponse,omitempty"` + Res *types.DVSManagerImportEntity_TaskResponse `xml:"DVSManagerImportEntity_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3145,7 +3565,7 @@ func DVSManagerImportEntity_Task(ctx context.Context, r soap.RoundTripper, req * type DVSManagerLookupDvPortGroupBody struct { Req *types.DVSManagerLookupDvPortGroup `xml:"urn:vim25 DVSManagerLookupDvPortGroup,omitempty"` - Res *types.DVSManagerLookupDvPortGroupResponse `xml:"urn:vim25 DVSManagerLookupDvPortGroupResponse,omitempty"` + Res *types.DVSManagerLookupDvPortGroupResponse `xml:"DVSManagerLookupDvPortGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3165,7 +3585,7 @@ func DVSManagerLookupDvPortGroup(ctx context.Context, r soap.RoundTripper, req * type DVSRollback_TaskBody struct { Req *types.DVSRollback_Task `xml:"urn:vim25 DVSRollback_Task,omitempty"` - Res *types.DVSRollback_TaskResponse `xml:"urn:vim25 DVSRollback_TaskResponse,omitempty"` + Res *types.DVSRollback_TaskResponse `xml:"DVSRollback_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3185,7 +3605,7 @@ func DVSRollback_Task(ctx context.Context, r soap.RoundTripper, req *types.DVSRo type DatastoreEnterMaintenanceModeBody struct { Req *types.DatastoreEnterMaintenanceMode `xml:"urn:vim25 DatastoreEnterMaintenanceMode,omitempty"` - Res *types.DatastoreEnterMaintenanceModeResponse `xml:"urn:vim25 DatastoreEnterMaintenanceModeResponse,omitempty"` + Res *types.DatastoreEnterMaintenanceModeResponse `xml:"DatastoreEnterMaintenanceModeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3205,7 +3625,7 @@ func DatastoreEnterMaintenanceMode(ctx context.Context, r soap.RoundTripper, req type DatastoreExitMaintenanceMode_TaskBody struct { Req *types.DatastoreExitMaintenanceMode_Task `xml:"urn:vim25 DatastoreExitMaintenanceMode_Task,omitempty"` - Res *types.DatastoreExitMaintenanceMode_TaskResponse `xml:"urn:vim25 DatastoreExitMaintenanceMode_TaskResponse,omitempty"` + Res *types.DatastoreExitMaintenanceMode_TaskResponse `xml:"DatastoreExitMaintenanceMode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3225,7 +3645,7 @@ func DatastoreExitMaintenanceMode_Task(ctx context.Context, r soap.RoundTripper, type DecodeLicenseBody struct { Req *types.DecodeLicense `xml:"urn:vim25 DecodeLicense,omitempty"` - Res *types.DecodeLicenseResponse `xml:"urn:vim25 DecodeLicenseResponse,omitempty"` + Res *types.DecodeLicenseResponse `xml:"DecodeLicenseResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3245,7 +3665,7 @@ func DecodeLicense(ctx context.Context, r soap.RoundTripper, req *types.DecodeLi type DefragmentAllDisksBody struct { Req *types.DefragmentAllDisks `xml:"urn:vim25 DefragmentAllDisks,omitempty"` - Res *types.DefragmentAllDisksResponse `xml:"urn:vim25 DefragmentAllDisksResponse,omitempty"` + Res *types.DefragmentAllDisksResponse `xml:"DefragmentAllDisksResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3265,7 +3685,7 @@ func DefragmentAllDisks(ctx context.Context, r soap.RoundTripper, req *types.Def type DefragmentVirtualDisk_TaskBody struct { Req *types.DefragmentVirtualDisk_Task `xml:"urn:vim25 DefragmentVirtualDisk_Task,omitempty"` - Res *types.DefragmentVirtualDisk_TaskResponse `xml:"urn:vim25 DefragmentVirtualDisk_TaskResponse,omitempty"` + Res *types.DefragmentVirtualDisk_TaskResponse `xml:"DefragmentVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3285,7 +3705,7 @@ func DefragmentVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *t type DeleteCustomizationSpecBody struct { Req *types.DeleteCustomizationSpec `xml:"urn:vim25 DeleteCustomizationSpec,omitempty"` - Res *types.DeleteCustomizationSpecResponse `xml:"urn:vim25 DeleteCustomizationSpecResponse,omitempty"` + Res *types.DeleteCustomizationSpecResponse `xml:"DeleteCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3305,7 +3725,7 @@ func DeleteCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *type type DeleteDatastoreFile_TaskBody struct { Req *types.DeleteDatastoreFile_Task `xml:"urn:vim25 DeleteDatastoreFile_Task,omitempty"` - Res *types.DeleteDatastoreFile_TaskResponse `xml:"urn:vim25 DeleteDatastoreFile_TaskResponse,omitempty"` + Res *types.DeleteDatastoreFile_TaskResponse `xml:"DeleteDatastoreFile_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3325,7 +3745,7 @@ func DeleteDatastoreFile_Task(ctx context.Context, r soap.RoundTripper, req *typ type DeleteDirectoryBody struct { Req *types.DeleteDirectory `xml:"urn:vim25 DeleteDirectory,omitempty"` - Res *types.DeleteDirectoryResponse `xml:"urn:vim25 DeleteDirectoryResponse,omitempty"` + Res *types.DeleteDirectoryResponse `xml:"DeleteDirectoryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3345,7 +3765,7 @@ func DeleteDirectory(ctx context.Context, r soap.RoundTripper, req *types.Delete type DeleteDirectoryInGuestBody struct { Req *types.DeleteDirectoryInGuest `xml:"urn:vim25 DeleteDirectoryInGuest,omitempty"` - Res *types.DeleteDirectoryInGuestResponse `xml:"urn:vim25 DeleteDirectoryInGuestResponse,omitempty"` + Res *types.DeleteDirectoryInGuestResponse `xml:"DeleteDirectoryInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3365,7 +3785,7 @@ func DeleteDirectoryInGuest(ctx context.Context, r soap.RoundTripper, req *types type DeleteFileBody struct { Req *types.DeleteFile `xml:"urn:vim25 DeleteFile,omitempty"` - Res *types.DeleteFileResponse `xml:"urn:vim25 DeleteFileResponse,omitempty"` + Res *types.DeleteFileResponse `xml:"DeleteFileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3385,7 +3805,7 @@ func DeleteFile(ctx context.Context, r soap.RoundTripper, req *types.DeleteFile) type DeleteFileInGuestBody struct { Req *types.DeleteFileInGuest `xml:"urn:vim25 DeleteFileInGuest,omitempty"` - Res *types.DeleteFileInGuestResponse `xml:"urn:vim25 DeleteFileInGuestResponse,omitempty"` + Res *types.DeleteFileInGuestResponse `xml:"DeleteFileInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3405,7 +3825,7 @@ func DeleteFileInGuest(ctx context.Context, r soap.RoundTripper, req *types.Dele type DeleteHostSpecificationBody struct { Req *types.DeleteHostSpecification `xml:"urn:vim25 DeleteHostSpecification,omitempty"` - Res *types.DeleteHostSpecificationResponse `xml:"urn:vim25 DeleteHostSpecificationResponse,omitempty"` + Res *types.DeleteHostSpecificationResponse `xml:"DeleteHostSpecificationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3425,7 +3845,7 @@ func DeleteHostSpecification(ctx context.Context, r soap.RoundTripper, req *type type DeleteHostSubSpecificationBody struct { Req *types.DeleteHostSubSpecification `xml:"urn:vim25 DeleteHostSubSpecification,omitempty"` - Res *types.DeleteHostSubSpecificationResponse `xml:"urn:vim25 DeleteHostSubSpecificationResponse,omitempty"` + Res *types.DeleteHostSubSpecificationResponse `xml:"DeleteHostSubSpecificationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3443,9 +3863,49 @@ func DeleteHostSubSpecification(ctx context.Context, r soap.RoundTripper, req *t return resBody.Res, nil } +type DeleteNvdimmBlockNamespaces_TaskBody struct { + Req *types.DeleteNvdimmBlockNamespaces_Task `xml:"urn:vim25 DeleteNvdimmBlockNamespaces_Task,omitempty"` + Res *types.DeleteNvdimmBlockNamespaces_TaskResponse `xml:"DeleteNvdimmBlockNamespaces_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DeleteNvdimmBlockNamespaces_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func DeleteNvdimmBlockNamespaces_Task(ctx context.Context, r soap.RoundTripper, req *types.DeleteNvdimmBlockNamespaces_Task) (*types.DeleteNvdimmBlockNamespaces_TaskResponse, error) { + var reqBody, resBody DeleteNvdimmBlockNamespaces_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DeleteNvdimmNamespace_TaskBody struct { + Req *types.DeleteNvdimmNamespace_Task `xml:"urn:vim25 DeleteNvdimmNamespace_Task,omitempty"` + Res *types.DeleteNvdimmNamespace_TaskResponse `xml:"DeleteNvdimmNamespace_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DeleteNvdimmNamespace_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func DeleteNvdimmNamespace_Task(ctx context.Context, r soap.RoundTripper, req *types.DeleteNvdimmNamespace_Task) (*types.DeleteNvdimmNamespace_TaskResponse, error) { + var reqBody, resBody DeleteNvdimmNamespace_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type DeleteRegistryKeyInGuestBody struct { Req *types.DeleteRegistryKeyInGuest `xml:"urn:vim25 DeleteRegistryKeyInGuest,omitempty"` - Res *types.DeleteRegistryKeyInGuestResponse `xml:"urn:vim25 DeleteRegistryKeyInGuestResponse,omitempty"` + Res *types.DeleteRegistryKeyInGuestResponse `xml:"DeleteRegistryKeyInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3465,7 +3925,7 @@ func DeleteRegistryKeyInGuest(ctx context.Context, r soap.RoundTripper, req *typ type DeleteRegistryValueInGuestBody struct { Req *types.DeleteRegistryValueInGuest `xml:"urn:vim25 DeleteRegistryValueInGuest,omitempty"` - Res *types.DeleteRegistryValueInGuestResponse `xml:"urn:vim25 DeleteRegistryValueInGuestResponse,omitempty"` + Res *types.DeleteRegistryValueInGuestResponse `xml:"DeleteRegistryValueInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3485,7 +3945,7 @@ func DeleteRegistryValueInGuest(ctx context.Context, r soap.RoundTripper, req *t type DeleteScsiLunStateBody struct { Req *types.DeleteScsiLunState `xml:"urn:vim25 DeleteScsiLunState,omitempty"` - Res *types.DeleteScsiLunStateResponse `xml:"urn:vim25 DeleteScsiLunStateResponse,omitempty"` + Res *types.DeleteScsiLunStateResponse `xml:"DeleteScsiLunStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3503,9 +3963,29 @@ func DeleteScsiLunState(ctx context.Context, r soap.RoundTripper, req *types.Del return resBody.Res, nil } +type DeleteSnapshot_TaskBody struct { + Req *types.DeleteSnapshot_Task `xml:"urn:vim25 DeleteSnapshot_Task,omitempty"` + Res *types.DeleteSnapshot_TaskResponse `xml:"DeleteSnapshot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DeleteSnapshot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func DeleteSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.DeleteSnapshot_Task) (*types.DeleteSnapshot_TaskResponse, error) { + var reqBody, resBody DeleteSnapshot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type DeleteVStorageObject_TaskBody struct { Req *types.DeleteVStorageObject_Task `xml:"urn:vim25 DeleteVStorageObject_Task,omitempty"` - Res *types.DeleteVStorageObject_TaskResponse `xml:"urn:vim25 DeleteVStorageObject_TaskResponse,omitempty"` + Res *types.DeleteVStorageObject_TaskResponse `xml:"DeleteVStorageObject_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3525,7 +4005,7 @@ func DeleteVStorageObject_Task(ctx context.Context, r soap.RoundTripper, req *ty type DeleteVffsVolumeStateBody struct { Req *types.DeleteVffsVolumeState `xml:"urn:vim25 DeleteVffsVolumeState,omitempty"` - Res *types.DeleteVffsVolumeStateResponse `xml:"urn:vim25 DeleteVffsVolumeStateResponse,omitempty"` + Res *types.DeleteVffsVolumeStateResponse `xml:"DeleteVffsVolumeStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3545,7 +4025,7 @@ func DeleteVffsVolumeState(ctx context.Context, r soap.RoundTripper, req *types. type DeleteVirtualDisk_TaskBody struct { Req *types.DeleteVirtualDisk_Task `xml:"urn:vim25 DeleteVirtualDisk_Task,omitempty"` - Res *types.DeleteVirtualDisk_TaskResponse `xml:"urn:vim25 DeleteVirtualDisk_TaskResponse,omitempty"` + Res *types.DeleteVirtualDisk_TaskResponse `xml:"DeleteVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3565,7 +4045,7 @@ func DeleteVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types type DeleteVmfsVolumeStateBody struct { Req *types.DeleteVmfsVolumeState `xml:"urn:vim25 DeleteVmfsVolumeState,omitempty"` - Res *types.DeleteVmfsVolumeStateResponse `xml:"urn:vim25 DeleteVmfsVolumeStateResponse,omitempty"` + Res *types.DeleteVmfsVolumeStateResponse `xml:"DeleteVmfsVolumeStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3585,7 +4065,7 @@ func DeleteVmfsVolumeState(ctx context.Context, r soap.RoundTripper, req *types. type DeleteVsanObjectsBody struct { Req *types.DeleteVsanObjects `xml:"urn:vim25 DeleteVsanObjects,omitempty"` - Res *types.DeleteVsanObjectsResponse `xml:"urn:vim25 DeleteVsanObjectsResponse,omitempty"` + Res *types.DeleteVsanObjectsResponse `xml:"DeleteVsanObjectsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3605,7 +4085,7 @@ func DeleteVsanObjects(ctx context.Context, r soap.RoundTripper, req *types.Dele type DeselectVnicBody struct { Req *types.DeselectVnic `xml:"urn:vim25 DeselectVnic,omitempty"` - Res *types.DeselectVnicResponse `xml:"urn:vim25 DeselectVnicResponse,omitempty"` + Res *types.DeselectVnicResponse `xml:"DeselectVnicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3625,7 +4105,7 @@ func DeselectVnic(ctx context.Context, r soap.RoundTripper, req *types.DeselectV type DeselectVnicForNicTypeBody struct { Req *types.DeselectVnicForNicType `xml:"urn:vim25 DeselectVnicForNicType,omitempty"` - Res *types.DeselectVnicForNicTypeResponse `xml:"urn:vim25 DeselectVnicForNicTypeResponse,omitempty"` + Res *types.DeselectVnicForNicTypeResponse `xml:"DeselectVnicForNicTypeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3645,7 +4125,7 @@ func DeselectVnicForNicType(ctx context.Context, r soap.RoundTripper, req *types type DestroyChildrenBody struct { Req *types.DestroyChildren `xml:"urn:vim25 DestroyChildren,omitempty"` - Res *types.DestroyChildrenResponse `xml:"urn:vim25 DestroyChildrenResponse,omitempty"` + Res *types.DestroyChildrenResponse `xml:"DestroyChildrenResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3665,7 +4145,7 @@ func DestroyChildren(ctx context.Context, r soap.RoundTripper, req *types.Destro type DestroyCollectorBody struct { Req *types.DestroyCollector `xml:"urn:vim25 DestroyCollector,omitempty"` - Res *types.DestroyCollectorResponse `xml:"urn:vim25 DestroyCollectorResponse,omitempty"` + Res *types.DestroyCollectorResponse `xml:"DestroyCollectorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3685,7 +4165,7 @@ func DestroyCollector(ctx context.Context, r soap.RoundTripper, req *types.Destr type DestroyDatastoreBody struct { Req *types.DestroyDatastore `xml:"urn:vim25 DestroyDatastore,omitempty"` - Res *types.DestroyDatastoreResponse `xml:"urn:vim25 DestroyDatastoreResponse,omitempty"` + Res *types.DestroyDatastoreResponse `xml:"DestroyDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3705,7 +4185,7 @@ func DestroyDatastore(ctx context.Context, r soap.RoundTripper, req *types.Destr type DestroyIpPoolBody struct { Req *types.DestroyIpPool `xml:"urn:vim25 DestroyIpPool,omitempty"` - Res *types.DestroyIpPoolResponse `xml:"urn:vim25 DestroyIpPoolResponse,omitempty"` + Res *types.DestroyIpPoolResponse `xml:"DestroyIpPoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3725,7 +4205,7 @@ func DestroyIpPool(ctx context.Context, r soap.RoundTripper, req *types.DestroyI type DestroyNetworkBody struct { Req *types.DestroyNetwork `xml:"urn:vim25 DestroyNetwork,omitempty"` - Res *types.DestroyNetworkResponse `xml:"urn:vim25 DestroyNetworkResponse,omitempty"` + Res *types.DestroyNetworkResponse `xml:"DestroyNetworkResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3745,7 +4225,7 @@ func DestroyNetwork(ctx context.Context, r soap.RoundTripper, req *types.Destroy type DestroyProfileBody struct { Req *types.DestroyProfile `xml:"urn:vim25 DestroyProfile,omitempty"` - Res *types.DestroyProfileResponse `xml:"urn:vim25 DestroyProfileResponse,omitempty"` + Res *types.DestroyProfileResponse `xml:"DestroyProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3765,7 +4245,7 @@ func DestroyProfile(ctx context.Context, r soap.RoundTripper, req *types.Destroy type DestroyPropertyCollectorBody struct { Req *types.DestroyPropertyCollector `xml:"urn:vim25 DestroyPropertyCollector,omitempty"` - Res *types.DestroyPropertyCollectorResponse `xml:"urn:vim25 DestroyPropertyCollectorResponse,omitempty"` + Res *types.DestroyPropertyCollectorResponse `xml:"DestroyPropertyCollectorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3785,7 +4265,7 @@ func DestroyPropertyCollector(ctx context.Context, r soap.RoundTripper, req *typ type DestroyPropertyFilterBody struct { Req *types.DestroyPropertyFilter `xml:"urn:vim25 DestroyPropertyFilter,omitempty"` - Res *types.DestroyPropertyFilterResponse `xml:"urn:vim25 DestroyPropertyFilterResponse,omitempty"` + Res *types.DestroyPropertyFilterResponse `xml:"DestroyPropertyFilterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3805,7 +4285,7 @@ func DestroyPropertyFilter(ctx context.Context, r soap.RoundTripper, req *types. type DestroyVffsBody struct { Req *types.DestroyVffs `xml:"urn:vim25 DestroyVffs,omitempty"` - Res *types.DestroyVffsResponse `xml:"urn:vim25 DestroyVffsResponse,omitempty"` + Res *types.DestroyVffsResponse `xml:"DestroyVffsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3825,7 +4305,7 @@ func DestroyVffs(ctx context.Context, r soap.RoundTripper, req *types.DestroyVff type DestroyViewBody struct { Req *types.DestroyView `xml:"urn:vim25 DestroyView,omitempty"` - Res *types.DestroyViewResponse `xml:"urn:vim25 DestroyViewResponse,omitempty"` + Res *types.DestroyViewResponse `xml:"DestroyViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3845,7 +4325,7 @@ func DestroyView(ctx context.Context, r soap.RoundTripper, req *types.DestroyVie type Destroy_TaskBody struct { Req *types.Destroy_Task `xml:"urn:vim25 Destroy_Task,omitempty"` - Res *types.Destroy_TaskResponse `xml:"urn:vim25 Destroy_TaskResponse,omitempty"` + Res *types.Destroy_TaskResponse `xml:"Destroy_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3865,7 +4345,7 @@ func Destroy_Task(ctx context.Context, r soap.RoundTripper, req *types.Destroy_T type DetachDisk_TaskBody struct { Req *types.DetachDisk_Task `xml:"urn:vim25 DetachDisk_Task,omitempty"` - Res *types.DetachDisk_TaskResponse `xml:"urn:vim25 DetachDisk_TaskResponse,omitempty"` + Res *types.DetachDisk_TaskResponse `xml:"DetachDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3885,7 +4365,7 @@ func DetachDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Detach type DetachScsiLunBody struct { Req *types.DetachScsiLun `xml:"urn:vim25 DetachScsiLun,omitempty"` - Res *types.DetachScsiLunResponse `xml:"urn:vim25 DetachScsiLunResponse,omitempty"` + Res *types.DetachScsiLunResponse `xml:"DetachScsiLunResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3905,7 +4385,7 @@ func DetachScsiLun(ctx context.Context, r soap.RoundTripper, req *types.DetachSc type DetachScsiLunEx_TaskBody struct { Req *types.DetachScsiLunEx_Task `xml:"urn:vim25 DetachScsiLunEx_Task,omitempty"` - Res *types.DetachScsiLunEx_TaskResponse `xml:"urn:vim25 DetachScsiLunEx_TaskResponse,omitempty"` + Res *types.DetachScsiLunEx_TaskResponse `xml:"DetachScsiLunEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3925,7 +4405,7 @@ func DetachScsiLunEx_Task(ctx context.Context, r soap.RoundTripper, req *types.D type DetachTagFromVStorageObjectBody struct { Req *types.DetachTagFromVStorageObject `xml:"urn:vim25 DetachTagFromVStorageObject,omitempty"` - Res *types.DetachTagFromVStorageObjectResponse `xml:"urn:vim25 DetachTagFromVStorageObjectResponse,omitempty"` + Res *types.DetachTagFromVStorageObjectResponse `xml:"DetachTagFromVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3945,7 +4425,7 @@ func DetachTagFromVStorageObject(ctx context.Context, r soap.RoundTripper, req * type DisableEvcMode_TaskBody struct { Req *types.DisableEvcMode_Task `xml:"urn:vim25 DisableEvcMode_Task,omitempty"` - Res *types.DisableEvcMode_TaskResponse `xml:"urn:vim25 DisableEvcMode_TaskResponse,omitempty"` + Res *types.DisableEvcMode_TaskResponse `xml:"DisableEvcMode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3965,7 +4445,7 @@ func DisableEvcMode_Task(ctx context.Context, r soap.RoundTripper, req *types.Di type DisableFeatureBody struct { Req *types.DisableFeature `xml:"urn:vim25 DisableFeature,omitempty"` - Res *types.DisableFeatureResponse `xml:"urn:vim25 DisableFeatureResponse,omitempty"` + Res *types.DisableFeatureResponse `xml:"DisableFeatureResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -3985,7 +4465,7 @@ func DisableFeature(ctx context.Context, r soap.RoundTripper, req *types.Disable type DisableHyperThreadingBody struct { Req *types.DisableHyperThreading `xml:"urn:vim25 DisableHyperThreading,omitempty"` - Res *types.DisableHyperThreadingResponse `xml:"urn:vim25 DisableHyperThreadingResponse,omitempty"` + Res *types.DisableHyperThreadingResponse `xml:"DisableHyperThreadingResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4005,7 +4485,7 @@ func DisableHyperThreading(ctx context.Context, r soap.RoundTripper, req *types. type DisableMultipathPathBody struct { Req *types.DisableMultipathPath `xml:"urn:vim25 DisableMultipathPath,omitempty"` - Res *types.DisableMultipathPathResponse `xml:"urn:vim25 DisableMultipathPathResponse,omitempty"` + Res *types.DisableMultipathPathResponse `xml:"DisableMultipathPathResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4025,7 +4505,7 @@ func DisableMultipathPath(ctx context.Context, r soap.RoundTripper, req *types.D type DisableRulesetBody struct { Req *types.DisableRuleset `xml:"urn:vim25 DisableRuleset,omitempty"` - Res *types.DisableRulesetResponse `xml:"urn:vim25 DisableRulesetResponse,omitempty"` + Res *types.DisableRulesetResponse `xml:"DisableRulesetResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4045,7 +4525,7 @@ func DisableRuleset(ctx context.Context, r soap.RoundTripper, req *types.Disable type DisableSecondaryVM_TaskBody struct { Req *types.DisableSecondaryVM_Task `xml:"urn:vim25 DisableSecondaryVM_Task,omitempty"` - Res *types.DisableSecondaryVM_TaskResponse `xml:"urn:vim25 DisableSecondaryVM_TaskResponse,omitempty"` + Res *types.DisableSecondaryVM_TaskResponse `xml:"DisableSecondaryVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4065,7 +4545,7 @@ func DisableSecondaryVM_Task(ctx context.Context, r soap.RoundTripper, req *type type DisableSmartCardAuthenticationBody struct { Req *types.DisableSmartCardAuthentication `xml:"urn:vim25 DisableSmartCardAuthentication,omitempty"` - Res *types.DisableSmartCardAuthenticationResponse `xml:"urn:vim25 DisableSmartCardAuthenticationResponse,omitempty"` + Res *types.DisableSmartCardAuthenticationResponse `xml:"DisableSmartCardAuthenticationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4085,7 +4565,7 @@ func DisableSmartCardAuthentication(ctx context.Context, r soap.RoundTripper, re type DisconnectHost_TaskBody struct { Req *types.DisconnectHost_Task `xml:"urn:vim25 DisconnectHost_Task,omitempty"` - Res *types.DisconnectHost_TaskResponse `xml:"urn:vim25 DisconnectHost_TaskResponse,omitempty"` + Res *types.DisconnectHost_TaskResponse `xml:"DisconnectHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4105,7 +4585,7 @@ func DisconnectHost_Task(ctx context.Context, r soap.RoundTripper, req *types.Di type DiscoverFcoeHbasBody struct { Req *types.DiscoverFcoeHbas `xml:"urn:vim25 DiscoverFcoeHbas,omitempty"` - Res *types.DiscoverFcoeHbasResponse `xml:"urn:vim25 DiscoverFcoeHbasResponse,omitempty"` + Res *types.DiscoverFcoeHbasResponse `xml:"DiscoverFcoeHbasResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4125,7 +4605,7 @@ func DiscoverFcoeHbas(ctx context.Context, r soap.RoundTripper, req *types.Disco type DissociateProfileBody struct { Req *types.DissociateProfile `xml:"urn:vim25 DissociateProfile,omitempty"` - Res *types.DissociateProfileResponse `xml:"urn:vim25 DissociateProfileResponse,omitempty"` + Res *types.DissociateProfileResponse `xml:"DissociateProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4145,7 +4625,7 @@ func DissociateProfile(ctx context.Context, r soap.RoundTripper, req *types.Diss type DoesCustomizationSpecExistBody struct { Req *types.DoesCustomizationSpecExist `xml:"urn:vim25 DoesCustomizationSpecExist,omitempty"` - Res *types.DoesCustomizationSpecExistResponse `xml:"urn:vim25 DoesCustomizationSpecExistResponse,omitempty"` + Res *types.DoesCustomizationSpecExistResponse `xml:"DoesCustomizationSpecExistResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4165,7 +4645,7 @@ func DoesCustomizationSpecExist(ctx context.Context, r soap.RoundTripper, req *t type DuplicateCustomizationSpecBody struct { Req *types.DuplicateCustomizationSpec `xml:"urn:vim25 DuplicateCustomizationSpec,omitempty"` - Res *types.DuplicateCustomizationSpecResponse `xml:"urn:vim25 DuplicateCustomizationSpecResponse,omitempty"` + Res *types.DuplicateCustomizationSpecResponse `xml:"DuplicateCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4185,7 +4665,7 @@ func DuplicateCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *t type DvsReconfigureVmVnicNetworkResourcePool_TaskBody struct { Req *types.DvsReconfigureVmVnicNetworkResourcePool_Task `xml:"urn:vim25 DvsReconfigureVmVnicNetworkResourcePool_Task,omitempty"` - Res *types.DvsReconfigureVmVnicNetworkResourcePool_TaskResponse `xml:"urn:vim25 DvsReconfigureVmVnicNetworkResourcePool_TaskResponse,omitempty"` + Res *types.DvsReconfigureVmVnicNetworkResourcePool_TaskResponse `xml:"DvsReconfigureVmVnicNetworkResourcePool_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4205,7 +4685,7 @@ func DvsReconfigureVmVnicNetworkResourcePool_Task(ctx context.Context, r soap.Ro type EagerZeroVirtualDisk_TaskBody struct { Req *types.EagerZeroVirtualDisk_Task `xml:"urn:vim25 EagerZeroVirtualDisk_Task,omitempty"` - Res *types.EagerZeroVirtualDisk_TaskResponse `xml:"urn:vim25 EagerZeroVirtualDisk_TaskResponse,omitempty"` + Res *types.EagerZeroVirtualDisk_TaskResponse `xml:"EagerZeroVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4225,7 +4705,7 @@ func EagerZeroVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *ty type EnableAlarmActionsBody struct { Req *types.EnableAlarmActions `xml:"urn:vim25 EnableAlarmActions,omitempty"` - Res *types.EnableAlarmActionsResponse `xml:"urn:vim25 EnableAlarmActionsResponse,omitempty"` + Res *types.EnableAlarmActionsResponse `xml:"EnableAlarmActionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4245,7 +4725,7 @@ func EnableAlarmActions(ctx context.Context, r soap.RoundTripper, req *types.Ena type EnableCryptoBody struct { Req *types.EnableCrypto `xml:"urn:vim25 EnableCrypto,omitempty"` - Res *types.EnableCryptoResponse `xml:"urn:vim25 EnableCryptoResponse,omitempty"` + Res *types.EnableCryptoResponse `xml:"EnableCryptoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4265,7 +4745,7 @@ func EnableCrypto(ctx context.Context, r soap.RoundTripper, req *types.EnableCry type EnableFeatureBody struct { Req *types.EnableFeature `xml:"urn:vim25 EnableFeature,omitempty"` - Res *types.EnableFeatureResponse `xml:"urn:vim25 EnableFeatureResponse,omitempty"` + Res *types.EnableFeatureResponse `xml:"EnableFeatureResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4285,7 +4765,7 @@ func EnableFeature(ctx context.Context, r soap.RoundTripper, req *types.EnableFe type EnableHyperThreadingBody struct { Req *types.EnableHyperThreading `xml:"urn:vim25 EnableHyperThreading,omitempty"` - Res *types.EnableHyperThreadingResponse `xml:"urn:vim25 EnableHyperThreadingResponse,omitempty"` + Res *types.EnableHyperThreadingResponse `xml:"EnableHyperThreadingResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4305,7 +4785,7 @@ func EnableHyperThreading(ctx context.Context, r soap.RoundTripper, req *types.E type EnableMultipathPathBody struct { Req *types.EnableMultipathPath `xml:"urn:vim25 EnableMultipathPath,omitempty"` - Res *types.EnableMultipathPathResponse `xml:"urn:vim25 EnableMultipathPathResponse,omitempty"` + Res *types.EnableMultipathPathResponse `xml:"EnableMultipathPathResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4325,7 +4805,7 @@ func EnableMultipathPath(ctx context.Context, r soap.RoundTripper, req *types.En type EnableNetworkResourceManagementBody struct { Req *types.EnableNetworkResourceManagement `xml:"urn:vim25 EnableNetworkResourceManagement,omitempty"` - Res *types.EnableNetworkResourceManagementResponse `xml:"urn:vim25 EnableNetworkResourceManagementResponse,omitempty"` + Res *types.EnableNetworkResourceManagementResponse `xml:"EnableNetworkResourceManagementResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4345,7 +4825,7 @@ func EnableNetworkResourceManagement(ctx context.Context, r soap.RoundTripper, r type EnableRulesetBody struct { Req *types.EnableRuleset `xml:"urn:vim25 EnableRuleset,omitempty"` - Res *types.EnableRulesetResponse `xml:"urn:vim25 EnableRulesetResponse,omitempty"` + Res *types.EnableRulesetResponse `xml:"EnableRulesetResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4365,7 +4845,7 @@ func EnableRuleset(ctx context.Context, r soap.RoundTripper, req *types.EnableRu type EnableSecondaryVM_TaskBody struct { Req *types.EnableSecondaryVM_Task `xml:"urn:vim25 EnableSecondaryVM_Task,omitempty"` - Res *types.EnableSecondaryVM_TaskResponse `xml:"urn:vim25 EnableSecondaryVM_TaskResponse,omitempty"` + Res *types.EnableSecondaryVM_TaskResponse `xml:"EnableSecondaryVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4385,7 +4865,7 @@ func EnableSecondaryVM_Task(ctx context.Context, r soap.RoundTripper, req *types type EnableSmartCardAuthenticationBody struct { Req *types.EnableSmartCardAuthentication `xml:"urn:vim25 EnableSmartCardAuthentication,omitempty"` - Res *types.EnableSmartCardAuthenticationResponse `xml:"urn:vim25 EnableSmartCardAuthenticationResponse,omitempty"` + Res *types.EnableSmartCardAuthenticationResponse `xml:"EnableSmartCardAuthenticationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4405,7 +4885,7 @@ func EnableSmartCardAuthentication(ctx context.Context, r soap.RoundTripper, req type EnterLockdownModeBody struct { Req *types.EnterLockdownMode `xml:"urn:vim25 EnterLockdownMode,omitempty"` - Res *types.EnterLockdownModeResponse `xml:"urn:vim25 EnterLockdownModeResponse,omitempty"` + Res *types.EnterLockdownModeResponse `xml:"EnterLockdownModeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4425,7 +4905,7 @@ func EnterLockdownMode(ctx context.Context, r soap.RoundTripper, req *types.Ente type EnterMaintenanceMode_TaskBody struct { Req *types.EnterMaintenanceMode_Task `xml:"urn:vim25 EnterMaintenanceMode_Task,omitempty"` - Res *types.EnterMaintenanceMode_TaskResponse `xml:"urn:vim25 EnterMaintenanceMode_TaskResponse,omitempty"` + Res *types.EnterMaintenanceMode_TaskResponse `xml:"EnterMaintenanceMode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4445,7 +4925,7 @@ func EnterMaintenanceMode_Task(ctx context.Context, r soap.RoundTripper, req *ty type EstimateDatabaseSizeBody struct { Req *types.EstimateDatabaseSize `xml:"urn:vim25 EstimateDatabaseSize,omitempty"` - Res *types.EstimateDatabaseSizeResponse `xml:"urn:vim25 EstimateDatabaseSizeResponse,omitempty"` + Res *types.EstimateDatabaseSizeResponse `xml:"EstimateDatabaseSizeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4465,7 +4945,7 @@ func EstimateDatabaseSize(ctx context.Context, r soap.RoundTripper, req *types.E type EstimateStorageForConsolidateSnapshots_TaskBody struct { Req *types.EstimateStorageForConsolidateSnapshots_Task `xml:"urn:vim25 EstimateStorageForConsolidateSnapshots_Task,omitempty"` - Res *types.EstimateStorageForConsolidateSnapshots_TaskResponse `xml:"urn:vim25 EstimateStorageForConsolidateSnapshots_TaskResponse,omitempty"` + Res *types.EstimateStorageForConsolidateSnapshots_TaskResponse `xml:"EstimateStorageForConsolidateSnapshots_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4485,7 +4965,7 @@ func EstimateStorageForConsolidateSnapshots_Task(ctx context.Context, r soap.Rou type EsxAgentHostManagerUpdateConfigBody struct { Req *types.EsxAgentHostManagerUpdateConfig `xml:"urn:vim25 EsxAgentHostManagerUpdateConfig,omitempty"` - Res *types.EsxAgentHostManagerUpdateConfigResponse `xml:"urn:vim25 EsxAgentHostManagerUpdateConfigResponse,omitempty"` + Res *types.EsxAgentHostManagerUpdateConfigResponse `xml:"EsxAgentHostManagerUpdateConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4505,7 +4985,7 @@ func EsxAgentHostManagerUpdateConfig(ctx context.Context, r soap.RoundTripper, r type EvacuateVsanNode_TaskBody struct { Req *types.EvacuateVsanNode_Task `xml:"urn:vim25 EvacuateVsanNode_Task,omitempty"` - Res *types.EvacuateVsanNode_TaskResponse `xml:"urn:vim25 EvacuateVsanNode_TaskResponse,omitempty"` + Res *types.EvacuateVsanNode_TaskResponse `xml:"EvacuateVsanNode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4525,7 +5005,7 @@ func EvacuateVsanNode_Task(ctx context.Context, r soap.RoundTripper, req *types. type EvcManagerBody struct { Req *types.EvcManager `xml:"urn:vim25 EvcManager,omitempty"` - Res *types.EvcManagerResponse `xml:"urn:vim25 EvcManagerResponse,omitempty"` + Res *types.EvcManagerResponse `xml:"EvcManagerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4545,7 +5025,7 @@ func EvcManager(ctx context.Context, r soap.RoundTripper, req *types.EvcManager) type ExecuteHostProfileBody struct { Req *types.ExecuteHostProfile `xml:"urn:vim25 ExecuteHostProfile,omitempty"` - Res *types.ExecuteHostProfileResponse `xml:"urn:vim25 ExecuteHostProfileResponse,omitempty"` + Res *types.ExecuteHostProfileResponse `xml:"ExecuteHostProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4565,7 +5045,7 @@ func ExecuteHostProfile(ctx context.Context, r soap.RoundTripper, req *types.Exe type ExecuteSimpleCommandBody struct { Req *types.ExecuteSimpleCommand `xml:"urn:vim25 ExecuteSimpleCommand,omitempty"` - Res *types.ExecuteSimpleCommandResponse `xml:"urn:vim25 ExecuteSimpleCommandResponse,omitempty"` + Res *types.ExecuteSimpleCommandResponse `xml:"ExecuteSimpleCommandResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4585,7 +5065,7 @@ func ExecuteSimpleCommand(ctx context.Context, r soap.RoundTripper, req *types.E type ExitLockdownModeBody struct { Req *types.ExitLockdownMode `xml:"urn:vim25 ExitLockdownMode,omitempty"` - Res *types.ExitLockdownModeResponse `xml:"urn:vim25 ExitLockdownModeResponse,omitempty"` + Res *types.ExitLockdownModeResponse `xml:"ExitLockdownModeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4605,7 +5085,7 @@ func ExitLockdownMode(ctx context.Context, r soap.RoundTripper, req *types.ExitL type ExitMaintenanceMode_TaskBody struct { Req *types.ExitMaintenanceMode_Task `xml:"urn:vim25 ExitMaintenanceMode_Task,omitempty"` - Res *types.ExitMaintenanceMode_TaskResponse `xml:"urn:vim25 ExitMaintenanceMode_TaskResponse,omitempty"` + Res *types.ExitMaintenanceMode_TaskResponse `xml:"ExitMaintenanceMode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4625,7 +5105,7 @@ func ExitMaintenanceMode_Task(ctx context.Context, r soap.RoundTripper, req *typ type ExpandVmfsDatastoreBody struct { Req *types.ExpandVmfsDatastore `xml:"urn:vim25 ExpandVmfsDatastore,omitempty"` - Res *types.ExpandVmfsDatastoreResponse `xml:"urn:vim25 ExpandVmfsDatastoreResponse,omitempty"` + Res *types.ExpandVmfsDatastoreResponse `xml:"ExpandVmfsDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4645,7 +5125,7 @@ func ExpandVmfsDatastore(ctx context.Context, r soap.RoundTripper, req *types.Ex type ExpandVmfsExtentBody struct { Req *types.ExpandVmfsExtent `xml:"urn:vim25 ExpandVmfsExtent,omitempty"` - Res *types.ExpandVmfsExtentResponse `xml:"urn:vim25 ExpandVmfsExtentResponse,omitempty"` + Res *types.ExpandVmfsExtentResponse `xml:"ExpandVmfsExtentResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4665,7 +5145,7 @@ func ExpandVmfsExtent(ctx context.Context, r soap.RoundTripper, req *types.Expan type ExportAnswerFile_TaskBody struct { Req *types.ExportAnswerFile_Task `xml:"urn:vim25 ExportAnswerFile_Task,omitempty"` - Res *types.ExportAnswerFile_TaskResponse `xml:"urn:vim25 ExportAnswerFile_TaskResponse,omitempty"` + Res *types.ExportAnswerFile_TaskResponse `xml:"ExportAnswerFile_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4685,7 +5165,7 @@ func ExportAnswerFile_Task(ctx context.Context, r soap.RoundTripper, req *types. type ExportProfileBody struct { Req *types.ExportProfile `xml:"urn:vim25 ExportProfile,omitempty"` - Res *types.ExportProfileResponse `xml:"urn:vim25 ExportProfileResponse,omitempty"` + Res *types.ExportProfileResponse `xml:"ExportProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4705,7 +5185,7 @@ func ExportProfile(ctx context.Context, r soap.RoundTripper, req *types.ExportPr type ExportSnapshotBody struct { Req *types.ExportSnapshot `xml:"urn:vim25 ExportSnapshot,omitempty"` - Res *types.ExportSnapshotResponse `xml:"urn:vim25 ExportSnapshotResponse,omitempty"` + Res *types.ExportSnapshotResponse `xml:"ExportSnapshotResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4725,7 +5205,7 @@ func ExportSnapshot(ctx context.Context, r soap.RoundTripper, req *types.ExportS type ExportVAppBody struct { Req *types.ExportVApp `xml:"urn:vim25 ExportVApp,omitempty"` - Res *types.ExportVAppResponse `xml:"urn:vim25 ExportVAppResponse,omitempty"` + Res *types.ExportVAppResponse `xml:"ExportVAppResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4745,7 +5225,7 @@ func ExportVApp(ctx context.Context, r soap.RoundTripper, req *types.ExportVApp) type ExportVmBody struct { Req *types.ExportVm `xml:"urn:vim25 ExportVm,omitempty"` - Res *types.ExportVmResponse `xml:"urn:vim25 ExportVmResponse,omitempty"` + Res *types.ExportVmResponse `xml:"ExportVmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4765,7 +5245,7 @@ func ExportVm(ctx context.Context, r soap.RoundTripper, req *types.ExportVm) (*t type ExtendDisk_TaskBody struct { Req *types.ExtendDisk_Task `xml:"urn:vim25 ExtendDisk_Task,omitempty"` - Res *types.ExtendDisk_TaskResponse `xml:"urn:vim25 ExtendDisk_TaskResponse,omitempty"` + Res *types.ExtendDisk_TaskResponse `xml:"ExtendDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4783,9 +5263,29 @@ func ExtendDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Extend return resBody.Res, nil } +type ExtendHCI_TaskBody struct { + Req *types.ExtendHCI_Task `xml:"urn:vim25 ExtendHCI_Task,omitempty"` + Res *types.ExtendHCI_TaskResponse `xml:"ExtendHCI_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ExtendHCI_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ExtendHCI_Task(ctx context.Context, r soap.RoundTripper, req *types.ExtendHCI_Task) (*types.ExtendHCI_TaskResponse, error) { + var reqBody, resBody ExtendHCI_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ExtendVffsBody struct { Req *types.ExtendVffs `xml:"urn:vim25 ExtendVffs,omitempty"` - Res *types.ExtendVffsResponse `xml:"urn:vim25 ExtendVffsResponse,omitempty"` + Res *types.ExtendVffsResponse `xml:"ExtendVffsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4805,7 +5305,7 @@ func ExtendVffs(ctx context.Context, r soap.RoundTripper, req *types.ExtendVffs) type ExtendVirtualDisk_TaskBody struct { Req *types.ExtendVirtualDisk_Task `xml:"urn:vim25 ExtendVirtualDisk_Task,omitempty"` - Res *types.ExtendVirtualDisk_TaskResponse `xml:"urn:vim25 ExtendVirtualDisk_TaskResponse,omitempty"` + Res *types.ExtendVirtualDisk_TaskResponse `xml:"ExtendVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4825,7 +5325,7 @@ func ExtendVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types type ExtendVmfsDatastoreBody struct { Req *types.ExtendVmfsDatastore `xml:"urn:vim25 ExtendVmfsDatastore,omitempty"` - Res *types.ExtendVmfsDatastoreResponse `xml:"urn:vim25 ExtendVmfsDatastoreResponse,omitempty"` + Res *types.ExtendVmfsDatastoreResponse `xml:"ExtendVmfsDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4845,7 +5345,7 @@ func ExtendVmfsDatastore(ctx context.Context, r soap.RoundTripper, req *types.Ex type ExtractOvfEnvironmentBody struct { Req *types.ExtractOvfEnvironment `xml:"urn:vim25 ExtractOvfEnvironment,omitempty"` - Res *types.ExtractOvfEnvironmentResponse `xml:"urn:vim25 ExtractOvfEnvironmentResponse,omitempty"` + Res *types.ExtractOvfEnvironmentResponse `xml:"ExtractOvfEnvironmentResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4865,7 +5365,7 @@ func ExtractOvfEnvironment(ctx context.Context, r soap.RoundTripper, req *types. type FetchDVPortKeysBody struct { Req *types.FetchDVPortKeys `xml:"urn:vim25 FetchDVPortKeys,omitempty"` - Res *types.FetchDVPortKeysResponse `xml:"urn:vim25 FetchDVPortKeysResponse,omitempty"` + Res *types.FetchDVPortKeysResponse `xml:"FetchDVPortKeysResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4885,7 +5385,7 @@ func FetchDVPortKeys(ctx context.Context, r soap.RoundTripper, req *types.FetchD type FetchDVPortsBody struct { Req *types.FetchDVPorts `xml:"urn:vim25 FetchDVPorts,omitempty"` - Res *types.FetchDVPortsResponse `xml:"urn:vim25 FetchDVPortsResponse,omitempty"` + Res *types.FetchDVPortsResponse `xml:"FetchDVPortsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4905,7 +5405,7 @@ func FetchDVPorts(ctx context.Context, r soap.RoundTripper, req *types.FetchDVPo type FetchSystemEventLogBody struct { Req *types.FetchSystemEventLog `xml:"urn:vim25 FetchSystemEventLog,omitempty"` - Res *types.FetchSystemEventLogResponse `xml:"urn:vim25 FetchSystemEventLogResponse,omitempty"` + Res *types.FetchSystemEventLogResponse `xml:"FetchSystemEventLogResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4925,7 +5425,7 @@ func FetchSystemEventLog(ctx context.Context, r soap.RoundTripper, req *types.Fe type FetchUserPrivilegeOnEntitiesBody struct { Req *types.FetchUserPrivilegeOnEntities `xml:"urn:vim25 FetchUserPrivilegeOnEntities,omitempty"` - Res *types.FetchUserPrivilegeOnEntitiesResponse `xml:"urn:vim25 FetchUserPrivilegeOnEntitiesResponse,omitempty"` + Res *types.FetchUserPrivilegeOnEntitiesResponse `xml:"FetchUserPrivilegeOnEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4945,7 +5445,7 @@ func FetchUserPrivilegeOnEntities(ctx context.Context, r soap.RoundTripper, req type FindAllByDnsNameBody struct { Req *types.FindAllByDnsName `xml:"urn:vim25 FindAllByDnsName,omitempty"` - Res *types.FindAllByDnsNameResponse `xml:"urn:vim25 FindAllByDnsNameResponse,omitempty"` + Res *types.FindAllByDnsNameResponse `xml:"FindAllByDnsNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4965,7 +5465,7 @@ func FindAllByDnsName(ctx context.Context, r soap.RoundTripper, req *types.FindA type FindAllByIpBody struct { Req *types.FindAllByIp `xml:"urn:vim25 FindAllByIp,omitempty"` - Res *types.FindAllByIpResponse `xml:"urn:vim25 FindAllByIpResponse,omitempty"` + Res *types.FindAllByIpResponse `xml:"FindAllByIpResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -4985,7 +5485,7 @@ func FindAllByIp(ctx context.Context, r soap.RoundTripper, req *types.FindAllByI type FindAllByUuidBody struct { Req *types.FindAllByUuid `xml:"urn:vim25 FindAllByUuid,omitempty"` - Res *types.FindAllByUuidResponse `xml:"urn:vim25 FindAllByUuidResponse,omitempty"` + Res *types.FindAllByUuidResponse `xml:"FindAllByUuidResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5005,7 +5505,7 @@ func FindAllByUuid(ctx context.Context, r soap.RoundTripper, req *types.FindAllB type FindAssociatedProfileBody struct { Req *types.FindAssociatedProfile `xml:"urn:vim25 FindAssociatedProfile,omitempty"` - Res *types.FindAssociatedProfileResponse `xml:"urn:vim25 FindAssociatedProfileResponse,omitempty"` + Res *types.FindAssociatedProfileResponse `xml:"FindAssociatedProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5025,7 +5525,7 @@ func FindAssociatedProfile(ctx context.Context, r soap.RoundTripper, req *types. type FindByDatastorePathBody struct { Req *types.FindByDatastorePath `xml:"urn:vim25 FindByDatastorePath,omitempty"` - Res *types.FindByDatastorePathResponse `xml:"urn:vim25 FindByDatastorePathResponse,omitempty"` + Res *types.FindByDatastorePathResponse `xml:"FindByDatastorePathResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5045,7 +5545,7 @@ func FindByDatastorePath(ctx context.Context, r soap.RoundTripper, req *types.Fi type FindByDnsNameBody struct { Req *types.FindByDnsName `xml:"urn:vim25 FindByDnsName,omitempty"` - Res *types.FindByDnsNameResponse `xml:"urn:vim25 FindByDnsNameResponse,omitempty"` + Res *types.FindByDnsNameResponse `xml:"FindByDnsNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5065,7 +5565,7 @@ func FindByDnsName(ctx context.Context, r soap.RoundTripper, req *types.FindByDn type FindByInventoryPathBody struct { Req *types.FindByInventoryPath `xml:"urn:vim25 FindByInventoryPath,omitempty"` - Res *types.FindByInventoryPathResponse `xml:"urn:vim25 FindByInventoryPathResponse,omitempty"` + Res *types.FindByInventoryPathResponse `xml:"FindByInventoryPathResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5085,7 +5585,7 @@ func FindByInventoryPath(ctx context.Context, r soap.RoundTripper, req *types.Fi type FindByIpBody struct { Req *types.FindByIp `xml:"urn:vim25 FindByIp,omitempty"` - Res *types.FindByIpResponse `xml:"urn:vim25 FindByIpResponse,omitempty"` + Res *types.FindByIpResponse `xml:"FindByIpResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5105,7 +5605,7 @@ func FindByIp(ctx context.Context, r soap.RoundTripper, req *types.FindByIp) (*t type FindByUuidBody struct { Req *types.FindByUuid `xml:"urn:vim25 FindByUuid,omitempty"` - Res *types.FindByUuidResponse `xml:"urn:vim25 FindByUuidResponse,omitempty"` + Res *types.FindByUuidResponse `xml:"FindByUuidResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5125,7 +5625,7 @@ func FindByUuid(ctx context.Context, r soap.RoundTripper, req *types.FindByUuid) type FindChildBody struct { Req *types.FindChild `xml:"urn:vim25 FindChild,omitempty"` - Res *types.FindChildResponse `xml:"urn:vim25 FindChildResponse,omitempty"` + Res *types.FindChildResponse `xml:"FindChildResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5145,7 +5645,7 @@ func FindChild(ctx context.Context, r soap.RoundTripper, req *types.FindChild) ( type FindExtensionBody struct { Req *types.FindExtension `xml:"urn:vim25 FindExtension,omitempty"` - Res *types.FindExtensionResponse `xml:"urn:vim25 FindExtensionResponse,omitempty"` + Res *types.FindExtensionResponse `xml:"FindExtensionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5165,7 +5665,7 @@ func FindExtension(ctx context.Context, r soap.RoundTripper, req *types.FindExte type FindRulesForVmBody struct { Req *types.FindRulesForVm `xml:"urn:vim25 FindRulesForVm,omitempty"` - Res *types.FindRulesForVmResponse `xml:"urn:vim25 FindRulesForVmResponse,omitempty"` + Res *types.FindRulesForVmResponse `xml:"FindRulesForVmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5185,7 +5685,7 @@ func FindRulesForVm(ctx context.Context, r soap.RoundTripper, req *types.FindRul type FormatVffsBody struct { Req *types.FormatVffs `xml:"urn:vim25 FormatVffs,omitempty"` - Res *types.FormatVffsResponse `xml:"urn:vim25 FormatVffsResponse,omitempty"` + Res *types.FormatVffsResponse `xml:"FormatVffsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5205,7 +5705,7 @@ func FormatVffs(ctx context.Context, r soap.RoundTripper, req *types.FormatVffs) type FormatVmfsBody struct { Req *types.FormatVmfs `xml:"urn:vim25 FormatVmfs,omitempty"` - Res *types.FormatVmfsResponse `xml:"urn:vim25 FormatVmfsResponse,omitempty"` + Res *types.FormatVmfsResponse `xml:"FormatVmfsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5225,7 +5725,7 @@ func FormatVmfs(ctx context.Context, r soap.RoundTripper, req *types.FormatVmfs) type GenerateCertificateSigningRequestBody struct { Req *types.GenerateCertificateSigningRequest `xml:"urn:vim25 GenerateCertificateSigningRequest,omitempty"` - Res *types.GenerateCertificateSigningRequestResponse `xml:"urn:vim25 GenerateCertificateSigningRequestResponse,omitempty"` + Res *types.GenerateCertificateSigningRequestResponse `xml:"GenerateCertificateSigningRequestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5245,7 +5745,7 @@ func GenerateCertificateSigningRequest(ctx context.Context, r soap.RoundTripper, type GenerateCertificateSigningRequestByDnBody struct { Req *types.GenerateCertificateSigningRequestByDn `xml:"urn:vim25 GenerateCertificateSigningRequestByDn,omitempty"` - Res *types.GenerateCertificateSigningRequestByDnResponse `xml:"urn:vim25 GenerateCertificateSigningRequestByDnResponse,omitempty"` + Res *types.GenerateCertificateSigningRequestByDnResponse `xml:"GenerateCertificateSigningRequestByDnResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5265,7 +5765,7 @@ func GenerateCertificateSigningRequestByDn(ctx context.Context, r soap.RoundTrip type GenerateClientCsrBody struct { Req *types.GenerateClientCsr `xml:"urn:vim25 GenerateClientCsr,omitempty"` - Res *types.GenerateClientCsrResponse `xml:"urn:vim25 GenerateClientCsrResponse,omitempty"` + Res *types.GenerateClientCsrResponse `xml:"GenerateClientCsrResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5285,7 +5785,7 @@ func GenerateClientCsr(ctx context.Context, r soap.RoundTripper, req *types.Gene type GenerateConfigTaskListBody struct { Req *types.GenerateConfigTaskList `xml:"urn:vim25 GenerateConfigTaskList,omitempty"` - Res *types.GenerateConfigTaskListResponse `xml:"urn:vim25 GenerateConfigTaskListResponse,omitempty"` + Res *types.GenerateConfigTaskListResponse `xml:"GenerateConfigTaskListResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5305,7 +5805,7 @@ func GenerateConfigTaskList(ctx context.Context, r soap.RoundTripper, req *types type GenerateHostConfigTaskSpec_TaskBody struct { Req *types.GenerateHostConfigTaskSpec_Task `xml:"urn:vim25 GenerateHostConfigTaskSpec_Task,omitempty"` - Res *types.GenerateHostConfigTaskSpec_TaskResponse `xml:"urn:vim25 GenerateHostConfigTaskSpec_TaskResponse,omitempty"` + Res *types.GenerateHostConfigTaskSpec_TaskResponse `xml:"GenerateHostConfigTaskSpec_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5325,7 +5825,7 @@ func GenerateHostConfigTaskSpec_Task(ctx context.Context, r soap.RoundTripper, r type GenerateHostProfileTaskList_TaskBody struct { Req *types.GenerateHostProfileTaskList_Task `xml:"urn:vim25 GenerateHostProfileTaskList_Task,omitempty"` - Res *types.GenerateHostProfileTaskList_TaskResponse `xml:"urn:vim25 GenerateHostProfileTaskList_TaskResponse,omitempty"` + Res *types.GenerateHostProfileTaskList_TaskResponse `xml:"GenerateHostProfileTaskList_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5345,7 +5845,7 @@ func GenerateHostProfileTaskList_Task(ctx context.Context, r soap.RoundTripper, type GenerateKeyBody struct { Req *types.GenerateKey `xml:"urn:vim25 GenerateKey,omitempty"` - Res *types.GenerateKeyResponse `xml:"urn:vim25 GenerateKeyResponse,omitempty"` + Res *types.GenerateKeyResponse `xml:"GenerateKeyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5365,7 +5865,7 @@ func GenerateKey(ctx context.Context, r soap.RoundTripper, req *types.GenerateKe type GenerateLogBundles_TaskBody struct { Req *types.GenerateLogBundles_Task `xml:"urn:vim25 GenerateLogBundles_Task,omitempty"` - Res *types.GenerateLogBundles_TaskResponse `xml:"urn:vim25 GenerateLogBundles_TaskResponse,omitempty"` + Res *types.GenerateLogBundles_TaskResponse `xml:"GenerateLogBundles_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5385,7 +5885,7 @@ func GenerateLogBundles_Task(ctx context.Context, r soap.RoundTripper, req *type type GenerateSelfSignedClientCertBody struct { Req *types.GenerateSelfSignedClientCert `xml:"urn:vim25 GenerateSelfSignedClientCert,omitempty"` - Res *types.GenerateSelfSignedClientCertResponse `xml:"urn:vim25 GenerateSelfSignedClientCertResponse,omitempty"` + Res *types.GenerateSelfSignedClientCertResponse `xml:"GenerateSelfSignedClientCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5405,7 +5905,7 @@ func GenerateSelfSignedClientCert(ctx context.Context, r soap.RoundTripper, req type GetAlarmBody struct { Req *types.GetAlarm `xml:"urn:vim25 GetAlarm,omitempty"` - Res *types.GetAlarmResponse `xml:"urn:vim25 GetAlarmResponse,omitempty"` + Res *types.GetAlarmResponse `xml:"GetAlarmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5425,7 +5925,7 @@ func GetAlarm(ctx context.Context, r soap.RoundTripper, req *types.GetAlarm) (*t type GetAlarmStateBody struct { Req *types.GetAlarmState `xml:"urn:vim25 GetAlarmState,omitempty"` - Res *types.GetAlarmStateResponse `xml:"urn:vim25 GetAlarmStateResponse,omitempty"` + Res *types.GetAlarmStateResponse `xml:"GetAlarmStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5445,7 +5945,7 @@ func GetAlarmState(ctx context.Context, r soap.RoundTripper, req *types.GetAlarm type GetCustomizationSpecBody struct { Req *types.GetCustomizationSpec `xml:"urn:vim25 GetCustomizationSpec,omitempty"` - Res *types.GetCustomizationSpecResponse `xml:"urn:vim25 GetCustomizationSpecResponse,omitempty"` + Res *types.GetCustomizationSpecResponse `xml:"GetCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5465,7 +5965,7 @@ func GetCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *types.G type GetPublicKeyBody struct { Req *types.GetPublicKey `xml:"urn:vim25 GetPublicKey,omitempty"` - Res *types.GetPublicKeyResponse `xml:"urn:vim25 GetPublicKeyResponse,omitempty"` + Res *types.GetPublicKeyResponse `xml:"GetPublicKeyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5485,7 +5985,7 @@ func GetPublicKey(ctx context.Context, r soap.RoundTripper, req *types.GetPublic type GetResourceUsageBody struct { Req *types.GetResourceUsage `xml:"urn:vim25 GetResourceUsage,omitempty"` - Res *types.GetResourceUsageResponse `xml:"urn:vim25 GetResourceUsageResponse,omitempty"` + Res *types.GetResourceUsageResponse `xml:"GetResourceUsageResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5505,7 +6005,7 @@ func GetResourceUsage(ctx context.Context, r soap.RoundTripper, req *types.GetRe type GetVchaClusterHealthBody struct { Req *types.GetVchaClusterHealth `xml:"urn:vim25 GetVchaClusterHealth,omitempty"` - Res *types.GetVchaClusterHealthResponse `xml:"urn:vim25 GetVchaClusterHealthResponse,omitempty"` + Res *types.GetVchaClusterHealthResponse `xml:"GetVchaClusterHealthResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5525,7 +6025,7 @@ func GetVchaClusterHealth(ctx context.Context, r soap.RoundTripper, req *types.G type GetVsanObjExtAttrsBody struct { Req *types.GetVsanObjExtAttrs `xml:"urn:vim25 GetVsanObjExtAttrs,omitempty"` - Res *types.GetVsanObjExtAttrsResponse `xml:"urn:vim25 GetVsanObjExtAttrsResponse,omitempty"` + Res *types.GetVsanObjExtAttrsResponse `xml:"GetVsanObjExtAttrsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5545,7 +6045,7 @@ func GetVsanObjExtAttrs(ctx context.Context, r soap.RoundTripper, req *types.Get type HasMonitoredEntityBody struct { Req *types.HasMonitoredEntity `xml:"urn:vim25 HasMonitoredEntity,omitempty"` - Res *types.HasMonitoredEntityResponse `xml:"urn:vim25 HasMonitoredEntityResponse,omitempty"` + Res *types.HasMonitoredEntityResponse `xml:"HasMonitoredEntityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5565,7 +6065,7 @@ func HasMonitoredEntity(ctx context.Context, r soap.RoundTripper, req *types.Has type HasPrivilegeOnEntitiesBody struct { Req *types.HasPrivilegeOnEntities `xml:"urn:vim25 HasPrivilegeOnEntities,omitempty"` - Res *types.HasPrivilegeOnEntitiesResponse `xml:"urn:vim25 HasPrivilegeOnEntitiesResponse,omitempty"` + Res *types.HasPrivilegeOnEntitiesResponse `xml:"HasPrivilegeOnEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5585,7 +6085,7 @@ func HasPrivilegeOnEntities(ctx context.Context, r soap.RoundTripper, req *types type HasPrivilegeOnEntityBody struct { Req *types.HasPrivilegeOnEntity `xml:"urn:vim25 HasPrivilegeOnEntity,omitempty"` - Res *types.HasPrivilegeOnEntityResponse `xml:"urn:vim25 HasPrivilegeOnEntityResponse,omitempty"` + Res *types.HasPrivilegeOnEntityResponse `xml:"HasPrivilegeOnEntityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5605,7 +6105,7 @@ func HasPrivilegeOnEntity(ctx context.Context, r soap.RoundTripper, req *types.H type HasProviderBody struct { Req *types.HasProvider `xml:"urn:vim25 HasProvider,omitempty"` - Res *types.HasProviderResponse `xml:"urn:vim25 HasProviderResponse,omitempty"` + Res *types.HasProviderResponse `xml:"HasProviderResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5625,7 +6125,7 @@ func HasProvider(ctx context.Context, r soap.RoundTripper, req *types.HasProvide type HasUserPrivilegeOnEntitiesBody struct { Req *types.HasUserPrivilegeOnEntities `xml:"urn:vim25 HasUserPrivilegeOnEntities,omitempty"` - Res *types.HasUserPrivilegeOnEntitiesResponse `xml:"urn:vim25 HasUserPrivilegeOnEntitiesResponse,omitempty"` + Res *types.HasUserPrivilegeOnEntitiesResponse `xml:"HasUserPrivilegeOnEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5643,9 +6143,29 @@ func HasUserPrivilegeOnEntities(ctx context.Context, r soap.RoundTripper, req *t return resBody.Res, nil } +type HostClearVStorageObjectControlFlagsBody struct { + Req *types.HostClearVStorageObjectControlFlags `xml:"urn:vim25 HostClearVStorageObjectControlFlags,omitempty"` + Res *types.HostClearVStorageObjectControlFlagsResponse `xml:"HostClearVStorageObjectControlFlagsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostClearVStorageObjectControlFlagsBody) Fault() *soap.Fault { return b.Fault_ } + +func HostClearVStorageObjectControlFlags(ctx context.Context, r soap.RoundTripper, req *types.HostClearVStorageObjectControlFlags) (*types.HostClearVStorageObjectControlFlagsResponse, error) { + var reqBody, resBody HostClearVStorageObjectControlFlagsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type HostCloneVStorageObject_TaskBody struct { Req *types.HostCloneVStorageObject_Task `xml:"urn:vim25 HostCloneVStorageObject_Task,omitempty"` - Res *types.HostCloneVStorageObject_TaskResponse `xml:"urn:vim25 HostCloneVStorageObject_TaskResponse,omitempty"` + Res *types.HostCloneVStorageObject_TaskResponse `xml:"HostCloneVStorageObject_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5665,7 +6185,7 @@ func HostCloneVStorageObject_Task(ctx context.Context, r soap.RoundTripper, req type HostConfigVFlashCacheBody struct { Req *types.HostConfigVFlashCache `xml:"urn:vim25 HostConfigVFlashCache,omitempty"` - Res *types.HostConfigVFlashCacheResponse `xml:"urn:vim25 HostConfigVFlashCacheResponse,omitempty"` + Res *types.HostConfigVFlashCacheResponse `xml:"HostConfigVFlashCacheResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5685,7 +6205,7 @@ func HostConfigVFlashCache(ctx context.Context, r soap.RoundTripper, req *types. type HostConfigureVFlashResourceBody struct { Req *types.HostConfigureVFlashResource `xml:"urn:vim25 HostConfigureVFlashResource,omitempty"` - Res *types.HostConfigureVFlashResourceResponse `xml:"urn:vim25 HostConfigureVFlashResourceResponse,omitempty"` + Res *types.HostConfigureVFlashResourceResponse `xml:"HostConfigureVFlashResourceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5705,7 +6225,7 @@ func HostConfigureVFlashResource(ctx context.Context, r soap.RoundTripper, req * type HostCreateDisk_TaskBody struct { Req *types.HostCreateDisk_Task `xml:"urn:vim25 HostCreateDisk_Task,omitempty"` - Res *types.HostCreateDisk_TaskResponse `xml:"urn:vim25 HostCreateDisk_TaskResponse,omitempty"` + Res *types.HostCreateDisk_TaskResponse `xml:"HostCreateDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5725,7 +6245,7 @@ func HostCreateDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Ho type HostDeleteVStorageObject_TaskBody struct { Req *types.HostDeleteVStorageObject_Task `xml:"urn:vim25 HostDeleteVStorageObject_Task,omitempty"` - Res *types.HostDeleteVStorageObject_TaskResponse `xml:"urn:vim25 HostDeleteVStorageObject_TaskResponse,omitempty"` + Res *types.HostDeleteVStorageObject_TaskResponse `xml:"HostDeleteVStorageObject_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5745,7 +6265,7 @@ func HostDeleteVStorageObject_Task(ctx context.Context, r soap.RoundTripper, req type HostExtendDisk_TaskBody struct { Req *types.HostExtendDisk_Task `xml:"urn:vim25 HostExtendDisk_Task,omitempty"` - Res *types.HostExtendDisk_TaskResponse `xml:"urn:vim25 HostExtendDisk_TaskResponse,omitempty"` + Res *types.HostExtendDisk_TaskResponse `xml:"HostExtendDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5765,7 +6285,7 @@ func HostExtendDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Ho type HostGetVFlashModuleDefaultConfigBody struct { Req *types.HostGetVFlashModuleDefaultConfig `xml:"urn:vim25 HostGetVFlashModuleDefaultConfig,omitempty"` - Res *types.HostGetVFlashModuleDefaultConfigResponse `xml:"urn:vim25 HostGetVFlashModuleDefaultConfigResponse,omitempty"` + Res *types.HostGetVFlashModuleDefaultConfigResponse `xml:"HostGetVFlashModuleDefaultConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5785,7 +6305,7 @@ func HostGetVFlashModuleDefaultConfig(ctx context.Context, r soap.RoundTripper, type HostImageConfigGetAcceptanceBody struct { Req *types.HostImageConfigGetAcceptance `xml:"urn:vim25 HostImageConfigGetAcceptance,omitempty"` - Res *types.HostImageConfigGetAcceptanceResponse `xml:"urn:vim25 HostImageConfigGetAcceptanceResponse,omitempty"` + Res *types.HostImageConfigGetAcceptanceResponse `xml:"HostImageConfigGetAcceptanceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5805,7 +6325,7 @@ func HostImageConfigGetAcceptance(ctx context.Context, r soap.RoundTripper, req type HostImageConfigGetProfileBody struct { Req *types.HostImageConfigGetProfile `xml:"urn:vim25 HostImageConfigGetProfile,omitempty"` - Res *types.HostImageConfigGetProfileResponse `xml:"urn:vim25 HostImageConfigGetProfileResponse,omitempty"` + Res *types.HostImageConfigGetProfileResponse `xml:"HostImageConfigGetProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5825,7 +6345,7 @@ func HostImageConfigGetProfile(ctx context.Context, r soap.RoundTripper, req *ty type HostInflateDisk_TaskBody struct { Req *types.HostInflateDisk_Task `xml:"urn:vim25 HostInflateDisk_Task,omitempty"` - Res *types.HostInflateDisk_TaskResponse `xml:"urn:vim25 HostInflateDisk_TaskResponse,omitempty"` + Res *types.HostInflateDisk_TaskResponse `xml:"HostInflateDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5845,7 +6365,7 @@ func HostInflateDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.H type HostListVStorageObjectBody struct { Req *types.HostListVStorageObject `xml:"urn:vim25 HostListVStorageObject,omitempty"` - Res *types.HostListVStorageObjectResponse `xml:"urn:vim25 HostListVStorageObjectResponse,omitempty"` + Res *types.HostListVStorageObjectResponse `xml:"HostListVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5863,9 +6383,29 @@ func HostListVStorageObject(ctx context.Context, r soap.RoundTripper, req *types return resBody.Res, nil } +type HostProfileResetValidationStateBody struct { + Req *types.HostProfileResetValidationState `xml:"urn:vim25 HostProfileResetValidationState,omitempty"` + Res *types.HostProfileResetValidationStateResponse `xml:"HostProfileResetValidationStateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostProfileResetValidationStateBody) Fault() *soap.Fault { return b.Fault_ } + +func HostProfileResetValidationState(ctx context.Context, r soap.RoundTripper, req *types.HostProfileResetValidationState) (*types.HostProfileResetValidationStateResponse, error) { + var reqBody, resBody HostProfileResetValidationStateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type HostReconcileDatastoreInventory_TaskBody struct { Req *types.HostReconcileDatastoreInventory_Task `xml:"urn:vim25 HostReconcileDatastoreInventory_Task,omitempty"` - Res *types.HostReconcileDatastoreInventory_TaskResponse `xml:"urn:vim25 HostReconcileDatastoreInventory_TaskResponse,omitempty"` + Res *types.HostReconcileDatastoreInventory_TaskResponse `xml:"HostReconcileDatastoreInventory_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5885,7 +6425,7 @@ func HostReconcileDatastoreInventory_Task(ctx context.Context, r soap.RoundTripp type HostRegisterDiskBody struct { Req *types.HostRegisterDisk `xml:"urn:vim25 HostRegisterDisk,omitempty"` - Res *types.HostRegisterDiskResponse `xml:"urn:vim25 HostRegisterDiskResponse,omitempty"` + Res *types.HostRegisterDiskResponse `xml:"HostRegisterDiskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5905,7 +6445,7 @@ func HostRegisterDisk(ctx context.Context, r soap.RoundTripper, req *types.HostR type HostRelocateVStorageObject_TaskBody struct { Req *types.HostRelocateVStorageObject_Task `xml:"urn:vim25 HostRelocateVStorageObject_Task,omitempty"` - Res *types.HostRelocateVStorageObject_TaskResponse `xml:"urn:vim25 HostRelocateVStorageObject_TaskResponse,omitempty"` + Res *types.HostRelocateVStorageObject_TaskResponse `xml:"HostRelocateVStorageObject_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5925,7 +6465,7 @@ func HostRelocateVStorageObject_Task(ctx context.Context, r soap.RoundTripper, r type HostRemoveVFlashResourceBody struct { Req *types.HostRemoveVFlashResource `xml:"urn:vim25 HostRemoveVFlashResource,omitempty"` - Res *types.HostRemoveVFlashResourceResponse `xml:"urn:vim25 HostRemoveVFlashResourceResponse,omitempty"` + Res *types.HostRemoveVFlashResourceResponse `xml:"HostRemoveVFlashResourceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5945,7 +6485,7 @@ func HostRemoveVFlashResource(ctx context.Context, r soap.RoundTripper, req *typ type HostRenameVStorageObjectBody struct { Req *types.HostRenameVStorageObject `xml:"urn:vim25 HostRenameVStorageObject,omitempty"` - Res *types.HostRenameVStorageObjectResponse `xml:"urn:vim25 HostRenameVStorageObjectResponse,omitempty"` + Res *types.HostRenameVStorageObjectResponse `xml:"HostRenameVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5963,9 +6503,29 @@ func HostRenameVStorageObject(ctx context.Context, r soap.RoundTripper, req *typ return resBody.Res, nil } +type HostRetrieveVStorageInfrastructureObjectPolicyBody struct { + Req *types.HostRetrieveVStorageInfrastructureObjectPolicy `xml:"urn:vim25 HostRetrieveVStorageInfrastructureObjectPolicy,omitempty"` + Res *types.HostRetrieveVStorageInfrastructureObjectPolicyResponse `xml:"HostRetrieveVStorageInfrastructureObjectPolicyResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostRetrieveVStorageInfrastructureObjectPolicyBody) Fault() *soap.Fault { return b.Fault_ } + +func HostRetrieveVStorageInfrastructureObjectPolicy(ctx context.Context, r soap.RoundTripper, req *types.HostRetrieveVStorageInfrastructureObjectPolicy) (*types.HostRetrieveVStorageInfrastructureObjectPolicyResponse, error) { + var reqBody, resBody HostRetrieveVStorageInfrastructureObjectPolicyBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type HostRetrieveVStorageObjectBody struct { Req *types.HostRetrieveVStorageObject `xml:"urn:vim25 HostRetrieveVStorageObject,omitempty"` - Res *types.HostRetrieveVStorageObjectResponse `xml:"urn:vim25 HostRetrieveVStorageObjectResponse,omitempty"` + Res *types.HostRetrieveVStorageObjectResponse `xml:"HostRetrieveVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -5983,9 +6543,49 @@ func HostRetrieveVStorageObject(ctx context.Context, r soap.RoundTripper, req *t return resBody.Res, nil } +type HostRetrieveVStorageObjectMetadataBody struct { + Req *types.HostRetrieveVStorageObjectMetadata `xml:"urn:vim25 HostRetrieveVStorageObjectMetadata,omitempty"` + Res *types.HostRetrieveVStorageObjectMetadataResponse `xml:"HostRetrieveVStorageObjectMetadataResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostRetrieveVStorageObjectMetadataBody) Fault() *soap.Fault { return b.Fault_ } + +func HostRetrieveVStorageObjectMetadata(ctx context.Context, r soap.RoundTripper, req *types.HostRetrieveVStorageObjectMetadata) (*types.HostRetrieveVStorageObjectMetadataResponse, error) { + var reqBody, resBody HostRetrieveVStorageObjectMetadataBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HostRetrieveVStorageObjectMetadataValueBody struct { + Req *types.HostRetrieveVStorageObjectMetadataValue `xml:"urn:vim25 HostRetrieveVStorageObjectMetadataValue,omitempty"` + Res *types.HostRetrieveVStorageObjectMetadataValueResponse `xml:"HostRetrieveVStorageObjectMetadataValueResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostRetrieveVStorageObjectMetadataValueBody) Fault() *soap.Fault { return b.Fault_ } + +func HostRetrieveVStorageObjectMetadataValue(ctx context.Context, r soap.RoundTripper, req *types.HostRetrieveVStorageObjectMetadataValue) (*types.HostRetrieveVStorageObjectMetadataValueResponse, error) { + var reqBody, resBody HostRetrieveVStorageObjectMetadataValueBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type HostRetrieveVStorageObjectStateBody struct { Req *types.HostRetrieveVStorageObjectState `xml:"urn:vim25 HostRetrieveVStorageObjectState,omitempty"` - Res *types.HostRetrieveVStorageObjectStateResponse `xml:"urn:vim25 HostRetrieveVStorageObjectStateResponse,omitempty"` + Res *types.HostRetrieveVStorageObjectStateResponse `xml:"HostRetrieveVStorageObjectStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6005,7 +6605,7 @@ func HostRetrieveVStorageObjectState(ctx context.Context, r soap.RoundTripper, r type HostScheduleReconcileDatastoreInventoryBody struct { Req *types.HostScheduleReconcileDatastoreInventory `xml:"urn:vim25 HostScheduleReconcileDatastoreInventory,omitempty"` - Res *types.HostScheduleReconcileDatastoreInventoryResponse `xml:"urn:vim25 HostScheduleReconcileDatastoreInventoryResponse,omitempty"` + Res *types.HostScheduleReconcileDatastoreInventoryResponse `xml:"HostScheduleReconcileDatastoreInventoryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6023,9 +6623,29 @@ func HostScheduleReconcileDatastoreInventory(ctx context.Context, r soap.RoundTr return resBody.Res, nil } +type HostSetVStorageObjectControlFlagsBody struct { + Req *types.HostSetVStorageObjectControlFlags `xml:"urn:vim25 HostSetVStorageObjectControlFlags,omitempty"` + Res *types.HostSetVStorageObjectControlFlagsResponse `xml:"HostSetVStorageObjectControlFlagsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostSetVStorageObjectControlFlagsBody) Fault() *soap.Fault { return b.Fault_ } + +func HostSetVStorageObjectControlFlags(ctx context.Context, r soap.RoundTripper, req *types.HostSetVStorageObjectControlFlags) (*types.HostSetVStorageObjectControlFlagsResponse, error) { + var reqBody, resBody HostSetVStorageObjectControlFlagsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type HostSpecGetUpdatedHostsBody struct { Req *types.HostSpecGetUpdatedHosts `xml:"urn:vim25 HostSpecGetUpdatedHosts,omitempty"` - Res *types.HostSpecGetUpdatedHostsResponse `xml:"urn:vim25 HostSpecGetUpdatedHostsResponse,omitempty"` + Res *types.HostSpecGetUpdatedHostsResponse `xml:"HostSpecGetUpdatedHostsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6043,9 +6663,129 @@ func HostSpecGetUpdatedHosts(ctx context.Context, r soap.RoundTripper, req *type return resBody.Res, nil } +type HostUpdateVStorageObjectMetadata_TaskBody struct { + Req *types.HostUpdateVStorageObjectMetadata_Task `xml:"urn:vim25 HostUpdateVStorageObjectMetadata_Task,omitempty"` + Res *types.HostUpdateVStorageObjectMetadata_TaskResponse `xml:"HostUpdateVStorageObjectMetadata_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostUpdateVStorageObjectMetadata_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func HostUpdateVStorageObjectMetadata_Task(ctx context.Context, r soap.RoundTripper, req *types.HostUpdateVStorageObjectMetadata_Task) (*types.HostUpdateVStorageObjectMetadata_TaskResponse, error) { + var reqBody, resBody HostUpdateVStorageObjectMetadata_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HostVStorageObjectCreateDiskFromSnapshot_TaskBody struct { + Req *types.HostVStorageObjectCreateDiskFromSnapshot_Task `xml:"urn:vim25 HostVStorageObjectCreateDiskFromSnapshot_Task,omitempty"` + Res *types.HostVStorageObjectCreateDiskFromSnapshot_TaskResponse `xml:"HostVStorageObjectCreateDiskFromSnapshot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostVStorageObjectCreateDiskFromSnapshot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func HostVStorageObjectCreateDiskFromSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.HostVStorageObjectCreateDiskFromSnapshot_Task) (*types.HostVStorageObjectCreateDiskFromSnapshot_TaskResponse, error) { + var reqBody, resBody HostVStorageObjectCreateDiskFromSnapshot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HostVStorageObjectCreateSnapshot_TaskBody struct { + Req *types.HostVStorageObjectCreateSnapshot_Task `xml:"urn:vim25 HostVStorageObjectCreateSnapshot_Task,omitempty"` + Res *types.HostVStorageObjectCreateSnapshot_TaskResponse `xml:"HostVStorageObjectCreateSnapshot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostVStorageObjectCreateSnapshot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func HostVStorageObjectCreateSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.HostVStorageObjectCreateSnapshot_Task) (*types.HostVStorageObjectCreateSnapshot_TaskResponse, error) { + var reqBody, resBody HostVStorageObjectCreateSnapshot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HostVStorageObjectDeleteSnapshot_TaskBody struct { + Req *types.HostVStorageObjectDeleteSnapshot_Task `xml:"urn:vim25 HostVStorageObjectDeleteSnapshot_Task,omitempty"` + Res *types.HostVStorageObjectDeleteSnapshot_TaskResponse `xml:"HostVStorageObjectDeleteSnapshot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostVStorageObjectDeleteSnapshot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func HostVStorageObjectDeleteSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.HostVStorageObjectDeleteSnapshot_Task) (*types.HostVStorageObjectDeleteSnapshot_TaskResponse, error) { + var reqBody, resBody HostVStorageObjectDeleteSnapshot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HostVStorageObjectRetrieveSnapshotInfoBody struct { + Req *types.HostVStorageObjectRetrieveSnapshotInfo `xml:"urn:vim25 HostVStorageObjectRetrieveSnapshotInfo,omitempty"` + Res *types.HostVStorageObjectRetrieveSnapshotInfoResponse `xml:"HostVStorageObjectRetrieveSnapshotInfoResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostVStorageObjectRetrieveSnapshotInfoBody) Fault() *soap.Fault { return b.Fault_ } + +func HostVStorageObjectRetrieveSnapshotInfo(ctx context.Context, r soap.RoundTripper, req *types.HostVStorageObjectRetrieveSnapshotInfo) (*types.HostVStorageObjectRetrieveSnapshotInfoResponse, error) { + var reqBody, resBody HostVStorageObjectRetrieveSnapshotInfoBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HostVStorageObjectRevert_TaskBody struct { + Req *types.HostVStorageObjectRevert_Task `xml:"urn:vim25 HostVStorageObjectRevert_Task,omitempty"` + Res *types.HostVStorageObjectRevert_TaskResponse `xml:"HostVStorageObjectRevert_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HostVStorageObjectRevert_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func HostVStorageObjectRevert_Task(ctx context.Context, r soap.RoundTripper, req *types.HostVStorageObjectRevert_Task) (*types.HostVStorageObjectRevert_TaskResponse, error) { + var reqBody, resBody HostVStorageObjectRevert_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type HttpNfcLeaseAbortBody struct { Req *types.HttpNfcLeaseAbort `xml:"urn:vim25 HttpNfcLeaseAbort,omitempty"` - Res *types.HttpNfcLeaseAbortResponse `xml:"urn:vim25 HttpNfcLeaseAbortResponse,omitempty"` + Res *types.HttpNfcLeaseAbortResponse `xml:"HttpNfcLeaseAbortResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6065,7 +6805,7 @@ func HttpNfcLeaseAbort(ctx context.Context, r soap.RoundTripper, req *types.Http type HttpNfcLeaseCompleteBody struct { Req *types.HttpNfcLeaseComplete `xml:"urn:vim25 HttpNfcLeaseComplete,omitempty"` - Res *types.HttpNfcLeaseCompleteResponse `xml:"urn:vim25 HttpNfcLeaseCompleteResponse,omitempty"` + Res *types.HttpNfcLeaseCompleteResponse `xml:"HttpNfcLeaseCompleteResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6085,7 +6825,7 @@ func HttpNfcLeaseComplete(ctx context.Context, r soap.RoundTripper, req *types.H type HttpNfcLeaseGetManifestBody struct { Req *types.HttpNfcLeaseGetManifest `xml:"urn:vim25 HttpNfcLeaseGetManifest,omitempty"` - Res *types.HttpNfcLeaseGetManifestResponse `xml:"urn:vim25 HttpNfcLeaseGetManifestResponse,omitempty"` + Res *types.HttpNfcLeaseGetManifestResponse `xml:"HttpNfcLeaseGetManifestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6105,7 +6845,7 @@ func HttpNfcLeaseGetManifest(ctx context.Context, r soap.RoundTripper, req *type type HttpNfcLeaseProgressBody struct { Req *types.HttpNfcLeaseProgress `xml:"urn:vim25 HttpNfcLeaseProgress,omitempty"` - Res *types.HttpNfcLeaseProgressResponse `xml:"urn:vim25 HttpNfcLeaseProgressResponse,omitempty"` + Res *types.HttpNfcLeaseProgressResponse `xml:"HttpNfcLeaseProgressResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6123,9 +6863,49 @@ func HttpNfcLeaseProgress(ctx context.Context, r soap.RoundTripper, req *types.H return resBody.Res, nil } +type HttpNfcLeasePullFromUrls_TaskBody struct { + Req *types.HttpNfcLeasePullFromUrls_Task `xml:"urn:vim25 HttpNfcLeasePullFromUrls_Task,omitempty"` + Res *types.HttpNfcLeasePullFromUrls_TaskResponse `xml:"HttpNfcLeasePullFromUrls_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HttpNfcLeasePullFromUrls_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func HttpNfcLeasePullFromUrls_Task(ctx context.Context, r soap.RoundTripper, req *types.HttpNfcLeasePullFromUrls_Task) (*types.HttpNfcLeasePullFromUrls_TaskResponse, error) { + var reqBody, resBody HttpNfcLeasePullFromUrls_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type HttpNfcLeaseSetManifestChecksumTypeBody struct { + Req *types.HttpNfcLeaseSetManifestChecksumType `xml:"urn:vim25 HttpNfcLeaseSetManifestChecksumType,omitempty"` + Res *types.HttpNfcLeaseSetManifestChecksumTypeResponse `xml:"HttpNfcLeaseSetManifestChecksumTypeResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *HttpNfcLeaseSetManifestChecksumTypeBody) Fault() *soap.Fault { return b.Fault_ } + +func HttpNfcLeaseSetManifestChecksumType(ctx context.Context, r soap.RoundTripper, req *types.HttpNfcLeaseSetManifestChecksumType) (*types.HttpNfcLeaseSetManifestChecksumTypeResponse, error) { + var reqBody, resBody HttpNfcLeaseSetManifestChecksumTypeBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ImpersonateUserBody struct { Req *types.ImpersonateUser `xml:"urn:vim25 ImpersonateUser,omitempty"` - Res *types.ImpersonateUserResponse `xml:"urn:vim25 ImpersonateUserResponse,omitempty"` + Res *types.ImpersonateUserResponse `xml:"ImpersonateUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6145,7 +6925,7 @@ func ImpersonateUser(ctx context.Context, r soap.RoundTripper, req *types.Impers type ImportCertificateForCAM_TaskBody struct { Req *types.ImportCertificateForCAM_Task `xml:"urn:vim25 ImportCertificateForCAM_Task,omitempty"` - Res *types.ImportCertificateForCAM_TaskResponse `xml:"urn:vim25 ImportCertificateForCAM_TaskResponse,omitempty"` + Res *types.ImportCertificateForCAM_TaskResponse `xml:"ImportCertificateForCAM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6165,7 +6945,7 @@ func ImportCertificateForCAM_Task(ctx context.Context, r soap.RoundTripper, req type ImportUnmanagedSnapshotBody struct { Req *types.ImportUnmanagedSnapshot `xml:"urn:vim25 ImportUnmanagedSnapshot,omitempty"` - Res *types.ImportUnmanagedSnapshotResponse `xml:"urn:vim25 ImportUnmanagedSnapshotResponse,omitempty"` + Res *types.ImportUnmanagedSnapshotResponse `xml:"ImportUnmanagedSnapshotResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6185,7 +6965,7 @@ func ImportUnmanagedSnapshot(ctx context.Context, r soap.RoundTripper, req *type type ImportVAppBody struct { Req *types.ImportVApp `xml:"urn:vim25 ImportVApp,omitempty"` - Res *types.ImportVAppResponse `xml:"urn:vim25 ImportVAppResponse,omitempty"` + Res *types.ImportVAppResponse `xml:"ImportVAppResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6205,7 +6985,7 @@ func ImportVApp(ctx context.Context, r soap.RoundTripper, req *types.ImportVApp) type InflateDisk_TaskBody struct { Req *types.InflateDisk_Task `xml:"urn:vim25 InflateDisk_Task,omitempty"` - Res *types.InflateDisk_TaskResponse `xml:"urn:vim25 InflateDisk_TaskResponse,omitempty"` + Res *types.InflateDisk_TaskResponse `xml:"InflateDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6225,7 +7005,7 @@ func InflateDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Infla type InflateVirtualDisk_TaskBody struct { Req *types.InflateVirtualDisk_Task `xml:"urn:vim25 InflateVirtualDisk_Task,omitempty"` - Res *types.InflateVirtualDisk_TaskResponse `xml:"urn:vim25 InflateVirtualDisk_TaskResponse,omitempty"` + Res *types.InflateVirtualDisk_TaskResponse `xml:"InflateVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6245,7 +7025,7 @@ func InflateVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *type type InitializeDisks_TaskBody struct { Req *types.InitializeDisks_Task `xml:"urn:vim25 InitializeDisks_Task,omitempty"` - Res *types.InitializeDisks_TaskResponse `xml:"urn:vim25 InitializeDisks_TaskResponse,omitempty"` + Res *types.InitializeDisks_TaskResponse `xml:"InitializeDisks_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6265,7 +7045,7 @@ func InitializeDisks_Task(ctx context.Context, r soap.RoundTripper, req *types.I type InitiateFileTransferFromGuestBody struct { Req *types.InitiateFileTransferFromGuest `xml:"urn:vim25 InitiateFileTransferFromGuest,omitempty"` - Res *types.InitiateFileTransferFromGuestResponse `xml:"urn:vim25 InitiateFileTransferFromGuestResponse,omitempty"` + Res *types.InitiateFileTransferFromGuestResponse `xml:"InitiateFileTransferFromGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6285,7 +7065,7 @@ func InitiateFileTransferFromGuest(ctx context.Context, r soap.RoundTripper, req type InitiateFileTransferToGuestBody struct { Req *types.InitiateFileTransferToGuest `xml:"urn:vim25 InitiateFileTransferToGuest,omitempty"` - Res *types.InitiateFileTransferToGuestResponse `xml:"urn:vim25 InitiateFileTransferToGuestResponse,omitempty"` + Res *types.InitiateFileTransferToGuestResponse `xml:"InitiateFileTransferToGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6305,7 +7085,7 @@ func InitiateFileTransferToGuest(ctx context.Context, r soap.RoundTripper, req * type InstallHostPatchV2_TaskBody struct { Req *types.InstallHostPatchV2_Task `xml:"urn:vim25 InstallHostPatchV2_Task,omitempty"` - Res *types.InstallHostPatchV2_TaskResponse `xml:"urn:vim25 InstallHostPatchV2_TaskResponse,omitempty"` + Res *types.InstallHostPatchV2_TaskResponse `xml:"InstallHostPatchV2_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6325,7 +7105,7 @@ func InstallHostPatchV2_Task(ctx context.Context, r soap.RoundTripper, req *type type InstallHostPatch_TaskBody struct { Req *types.InstallHostPatch_Task `xml:"urn:vim25 InstallHostPatch_Task,omitempty"` - Res *types.InstallHostPatch_TaskResponse `xml:"urn:vim25 InstallHostPatch_TaskResponse,omitempty"` + Res *types.InstallHostPatch_TaskResponse `xml:"InstallHostPatch_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6345,7 +7125,7 @@ func InstallHostPatch_Task(ctx context.Context, r soap.RoundTripper, req *types. type InstallIoFilter_TaskBody struct { Req *types.InstallIoFilter_Task `xml:"urn:vim25 InstallIoFilter_Task,omitempty"` - Res *types.InstallIoFilter_TaskResponse `xml:"urn:vim25 InstallIoFilter_TaskResponse,omitempty"` + Res *types.InstallIoFilter_TaskResponse `xml:"InstallIoFilter_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6365,7 +7145,7 @@ func InstallIoFilter_Task(ctx context.Context, r soap.RoundTripper, req *types.I type InstallServerCertificateBody struct { Req *types.InstallServerCertificate `xml:"urn:vim25 InstallServerCertificate,omitempty"` - Res *types.InstallServerCertificateResponse `xml:"urn:vim25 InstallServerCertificateResponse,omitempty"` + Res *types.InstallServerCertificateResponse `xml:"InstallServerCertificateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6385,7 +7165,7 @@ func InstallServerCertificate(ctx context.Context, r soap.RoundTripper, req *typ type InstallSmartCardTrustAnchorBody struct { Req *types.InstallSmartCardTrustAnchor `xml:"urn:vim25 InstallSmartCardTrustAnchor,omitempty"` - Res *types.InstallSmartCardTrustAnchorResponse `xml:"urn:vim25 InstallSmartCardTrustAnchorResponse,omitempty"` + Res *types.InstallSmartCardTrustAnchorResponse `xml:"InstallSmartCardTrustAnchorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6403,9 +7183,29 @@ func InstallSmartCardTrustAnchor(ctx context.Context, r soap.RoundTripper, req * return resBody.Res, nil } +type InstantClone_TaskBody struct { + Req *types.InstantClone_Task `xml:"urn:vim25 InstantClone_Task,omitempty"` + Res *types.InstantClone_TaskResponse `xml:"InstantClone_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *InstantClone_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func InstantClone_Task(ctx context.Context, r soap.RoundTripper, req *types.InstantClone_Task) (*types.InstantClone_TaskResponse, error) { + var reqBody, resBody InstantClone_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type IsSharedGraphicsActiveBody struct { Req *types.IsSharedGraphicsActive `xml:"urn:vim25 IsSharedGraphicsActive,omitempty"` - Res *types.IsSharedGraphicsActiveResponse `xml:"urn:vim25 IsSharedGraphicsActiveResponse,omitempty"` + Res *types.IsSharedGraphicsActiveResponse `xml:"IsSharedGraphicsActiveResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6425,7 +7225,7 @@ func IsSharedGraphicsActive(ctx context.Context, r soap.RoundTripper, req *types type JoinDomainWithCAM_TaskBody struct { Req *types.JoinDomainWithCAM_Task `xml:"urn:vim25 JoinDomainWithCAM_Task,omitempty"` - Res *types.JoinDomainWithCAM_TaskResponse `xml:"urn:vim25 JoinDomainWithCAM_TaskResponse,omitempty"` + Res *types.JoinDomainWithCAM_TaskResponse `xml:"JoinDomainWithCAM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6445,7 +7245,7 @@ func JoinDomainWithCAM_Task(ctx context.Context, r soap.RoundTripper, req *types type JoinDomain_TaskBody struct { Req *types.JoinDomain_Task `xml:"urn:vim25 JoinDomain_Task,omitempty"` - Res *types.JoinDomain_TaskResponse `xml:"urn:vim25 JoinDomain_TaskResponse,omitempty"` + Res *types.JoinDomain_TaskResponse `xml:"JoinDomain_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6465,7 +7265,7 @@ func JoinDomain_Task(ctx context.Context, r soap.RoundTripper, req *types.JoinDo type LeaveCurrentDomain_TaskBody struct { Req *types.LeaveCurrentDomain_Task `xml:"urn:vim25 LeaveCurrentDomain_Task,omitempty"` - Res *types.LeaveCurrentDomain_TaskResponse `xml:"urn:vim25 LeaveCurrentDomain_TaskResponse,omitempty"` + Res *types.LeaveCurrentDomain_TaskResponse `xml:"LeaveCurrentDomain_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6485,7 +7285,7 @@ func LeaveCurrentDomain_Task(ctx context.Context, r soap.RoundTripper, req *type type ListCACertificateRevocationListsBody struct { Req *types.ListCACertificateRevocationLists `xml:"urn:vim25 ListCACertificateRevocationLists,omitempty"` - Res *types.ListCACertificateRevocationListsResponse `xml:"urn:vim25 ListCACertificateRevocationListsResponse,omitempty"` + Res *types.ListCACertificateRevocationListsResponse `xml:"ListCACertificateRevocationListsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6505,7 +7305,7 @@ func ListCACertificateRevocationLists(ctx context.Context, r soap.RoundTripper, type ListCACertificatesBody struct { Req *types.ListCACertificates `xml:"urn:vim25 ListCACertificates,omitempty"` - Res *types.ListCACertificatesResponse `xml:"urn:vim25 ListCACertificatesResponse,omitempty"` + Res *types.ListCACertificatesResponse `xml:"ListCACertificatesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6525,7 +7325,7 @@ func ListCACertificates(ctx context.Context, r soap.RoundTripper, req *types.Lis type ListFilesInGuestBody struct { Req *types.ListFilesInGuest `xml:"urn:vim25 ListFilesInGuest,omitempty"` - Res *types.ListFilesInGuestResponse `xml:"urn:vim25 ListFilesInGuestResponse,omitempty"` + Res *types.ListFilesInGuestResponse `xml:"ListFilesInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6545,7 +7345,7 @@ func ListFilesInGuest(ctx context.Context, r soap.RoundTripper, req *types.ListF type ListGuestAliasesBody struct { Req *types.ListGuestAliases `xml:"urn:vim25 ListGuestAliases,omitempty"` - Res *types.ListGuestAliasesResponse `xml:"urn:vim25 ListGuestAliasesResponse,omitempty"` + Res *types.ListGuestAliasesResponse `xml:"ListGuestAliasesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6565,7 +7365,7 @@ func ListGuestAliases(ctx context.Context, r soap.RoundTripper, req *types.ListG type ListGuestMappedAliasesBody struct { Req *types.ListGuestMappedAliases `xml:"urn:vim25 ListGuestMappedAliases,omitempty"` - Res *types.ListGuestMappedAliasesResponse `xml:"urn:vim25 ListGuestMappedAliasesResponse,omitempty"` + Res *types.ListGuestMappedAliasesResponse `xml:"ListGuestMappedAliasesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6585,7 +7385,7 @@ func ListGuestMappedAliases(ctx context.Context, r soap.RoundTripper, req *types type ListKeysBody struct { Req *types.ListKeys `xml:"urn:vim25 ListKeys,omitempty"` - Res *types.ListKeysResponse `xml:"urn:vim25 ListKeysResponse,omitempty"` + Res *types.ListKeysResponse `xml:"ListKeysResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6605,7 +7405,7 @@ func ListKeys(ctx context.Context, r soap.RoundTripper, req *types.ListKeys) (*t type ListKmipServersBody struct { Req *types.ListKmipServers `xml:"urn:vim25 ListKmipServers,omitempty"` - Res *types.ListKmipServersResponse `xml:"urn:vim25 ListKmipServersResponse,omitempty"` + Res *types.ListKmipServersResponse `xml:"ListKmipServersResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6625,7 +7425,7 @@ func ListKmipServers(ctx context.Context, r soap.RoundTripper, req *types.ListKm type ListProcessesInGuestBody struct { Req *types.ListProcessesInGuest `xml:"urn:vim25 ListProcessesInGuest,omitempty"` - Res *types.ListProcessesInGuestResponse `xml:"urn:vim25 ListProcessesInGuestResponse,omitempty"` + Res *types.ListProcessesInGuestResponse `xml:"ListProcessesInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6645,7 +7445,7 @@ func ListProcessesInGuest(ctx context.Context, r soap.RoundTripper, req *types.L type ListRegistryKeysInGuestBody struct { Req *types.ListRegistryKeysInGuest `xml:"urn:vim25 ListRegistryKeysInGuest,omitempty"` - Res *types.ListRegistryKeysInGuestResponse `xml:"urn:vim25 ListRegistryKeysInGuestResponse,omitempty"` + Res *types.ListRegistryKeysInGuestResponse `xml:"ListRegistryKeysInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6665,7 +7465,7 @@ func ListRegistryKeysInGuest(ctx context.Context, r soap.RoundTripper, req *type type ListRegistryValuesInGuestBody struct { Req *types.ListRegistryValuesInGuest `xml:"urn:vim25 ListRegistryValuesInGuest,omitempty"` - Res *types.ListRegistryValuesInGuestResponse `xml:"urn:vim25 ListRegistryValuesInGuestResponse,omitempty"` + Res *types.ListRegistryValuesInGuestResponse `xml:"ListRegistryValuesInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6685,7 +7485,7 @@ func ListRegistryValuesInGuest(ctx context.Context, r soap.RoundTripper, req *ty type ListSmartCardTrustAnchorsBody struct { Req *types.ListSmartCardTrustAnchors `xml:"urn:vim25 ListSmartCardTrustAnchors,omitempty"` - Res *types.ListSmartCardTrustAnchorsResponse `xml:"urn:vim25 ListSmartCardTrustAnchorsResponse,omitempty"` + Res *types.ListSmartCardTrustAnchorsResponse `xml:"ListSmartCardTrustAnchorsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6705,7 +7505,7 @@ func ListSmartCardTrustAnchors(ctx context.Context, r soap.RoundTripper, req *ty type ListTagsAttachedToVStorageObjectBody struct { Req *types.ListTagsAttachedToVStorageObject `xml:"urn:vim25 ListTagsAttachedToVStorageObject,omitempty"` - Res *types.ListTagsAttachedToVStorageObjectResponse `xml:"urn:vim25 ListTagsAttachedToVStorageObjectResponse,omitempty"` + Res *types.ListTagsAttachedToVStorageObjectResponse `xml:"ListTagsAttachedToVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6725,7 +7525,7 @@ func ListTagsAttachedToVStorageObject(ctx context.Context, r soap.RoundTripper, type ListVStorageObjectBody struct { Req *types.ListVStorageObject `xml:"urn:vim25 ListVStorageObject,omitempty"` - Res *types.ListVStorageObjectResponse `xml:"urn:vim25 ListVStorageObjectResponse,omitempty"` + Res *types.ListVStorageObjectResponse `xml:"ListVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6745,7 +7545,7 @@ func ListVStorageObject(ctx context.Context, r soap.RoundTripper, req *types.Lis type ListVStorageObjectsAttachedToTagBody struct { Req *types.ListVStorageObjectsAttachedToTag `xml:"urn:vim25 ListVStorageObjectsAttachedToTag,omitempty"` - Res *types.ListVStorageObjectsAttachedToTagResponse `xml:"urn:vim25 ListVStorageObjectsAttachedToTagResponse,omitempty"` + Res *types.ListVStorageObjectsAttachedToTagResponse `xml:"ListVStorageObjectsAttachedToTagResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6765,7 +7565,7 @@ func ListVStorageObjectsAttachedToTag(ctx context.Context, r soap.RoundTripper, type LogUserEventBody struct { Req *types.LogUserEvent `xml:"urn:vim25 LogUserEvent,omitempty"` - Res *types.LogUserEventResponse `xml:"urn:vim25 LogUserEventResponse,omitempty"` + Res *types.LogUserEventResponse `xml:"LogUserEventResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6785,7 +7585,7 @@ func LogUserEvent(ctx context.Context, r soap.RoundTripper, req *types.LogUserEv type LoginBody struct { Req *types.Login `xml:"urn:vim25 Login,omitempty"` - Res *types.LoginResponse `xml:"urn:vim25 LoginResponse,omitempty"` + Res *types.LoginResponse `xml:"LoginResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6805,7 +7605,7 @@ func Login(ctx context.Context, r soap.RoundTripper, req *types.Login) (*types.L type LoginBySSPIBody struct { Req *types.LoginBySSPI `xml:"urn:vim25 LoginBySSPI,omitempty"` - Res *types.LoginBySSPIResponse `xml:"urn:vim25 LoginBySSPIResponse,omitempty"` + Res *types.LoginBySSPIResponse `xml:"LoginBySSPIResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6825,7 +7625,7 @@ func LoginBySSPI(ctx context.Context, r soap.RoundTripper, req *types.LoginBySSP type LoginByTokenBody struct { Req *types.LoginByToken `xml:"urn:vim25 LoginByToken,omitempty"` - Res *types.LoginByTokenResponse `xml:"urn:vim25 LoginByTokenResponse,omitempty"` + Res *types.LoginByTokenResponse `xml:"LoginByTokenResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6845,7 +7645,7 @@ func LoginByToken(ctx context.Context, r soap.RoundTripper, req *types.LoginByTo type LoginExtensionByCertificateBody struct { Req *types.LoginExtensionByCertificate `xml:"urn:vim25 LoginExtensionByCertificate,omitempty"` - Res *types.LoginExtensionByCertificateResponse `xml:"urn:vim25 LoginExtensionByCertificateResponse,omitempty"` + Res *types.LoginExtensionByCertificateResponse `xml:"LoginExtensionByCertificateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6865,7 +7665,7 @@ func LoginExtensionByCertificate(ctx context.Context, r soap.RoundTripper, req * type LoginExtensionBySubjectNameBody struct { Req *types.LoginExtensionBySubjectName `xml:"urn:vim25 LoginExtensionBySubjectName,omitempty"` - Res *types.LoginExtensionBySubjectNameResponse `xml:"urn:vim25 LoginExtensionBySubjectNameResponse,omitempty"` + Res *types.LoginExtensionBySubjectNameResponse `xml:"LoginExtensionBySubjectNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6885,7 +7685,7 @@ func LoginExtensionBySubjectName(ctx context.Context, r soap.RoundTripper, req * type LogoutBody struct { Req *types.Logout `xml:"urn:vim25 Logout,omitempty"` - Res *types.LogoutResponse `xml:"urn:vim25 LogoutResponse,omitempty"` + Res *types.LogoutResponse `xml:"LogoutResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6905,7 +7705,7 @@ func Logout(ctx context.Context, r soap.RoundTripper, req *types.Logout) (*types type LookupDvPortGroupBody struct { Req *types.LookupDvPortGroup `xml:"urn:vim25 LookupDvPortGroup,omitempty"` - Res *types.LookupDvPortGroupResponse `xml:"urn:vim25 LookupDvPortGroupResponse,omitempty"` + Res *types.LookupDvPortGroupResponse `xml:"LookupDvPortGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6925,7 +7725,7 @@ func LookupDvPortGroup(ctx context.Context, r soap.RoundTripper, req *types.Look type LookupVmOverheadMemoryBody struct { Req *types.LookupVmOverheadMemory `xml:"urn:vim25 LookupVmOverheadMemory,omitempty"` - Res *types.LookupVmOverheadMemoryResponse `xml:"urn:vim25 LookupVmOverheadMemoryResponse,omitempty"` + Res *types.LookupVmOverheadMemoryResponse `xml:"LookupVmOverheadMemoryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6945,7 +7745,7 @@ func LookupVmOverheadMemory(ctx context.Context, r soap.RoundTripper, req *types type MakeDirectoryBody struct { Req *types.MakeDirectory `xml:"urn:vim25 MakeDirectory,omitempty"` - Res *types.MakeDirectoryResponse `xml:"urn:vim25 MakeDirectoryResponse,omitempty"` + Res *types.MakeDirectoryResponse `xml:"MakeDirectoryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6965,7 +7765,7 @@ func MakeDirectory(ctx context.Context, r soap.RoundTripper, req *types.MakeDire type MakeDirectoryInGuestBody struct { Req *types.MakeDirectoryInGuest `xml:"urn:vim25 MakeDirectoryInGuest,omitempty"` - Res *types.MakeDirectoryInGuestResponse `xml:"urn:vim25 MakeDirectoryInGuestResponse,omitempty"` + Res *types.MakeDirectoryInGuestResponse `xml:"MakeDirectoryInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -6985,7 +7785,7 @@ func MakeDirectoryInGuest(ctx context.Context, r soap.RoundTripper, req *types.M type MakePrimaryVM_TaskBody struct { Req *types.MakePrimaryVM_Task `xml:"urn:vim25 MakePrimaryVM_Task,omitempty"` - Res *types.MakePrimaryVM_TaskResponse `xml:"urn:vim25 MakePrimaryVM_TaskResponse,omitempty"` + Res *types.MakePrimaryVM_TaskResponse `xml:"MakePrimaryVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7005,7 +7805,7 @@ func MakePrimaryVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Mak type MarkAsLocal_TaskBody struct { Req *types.MarkAsLocal_Task `xml:"urn:vim25 MarkAsLocal_Task,omitempty"` - Res *types.MarkAsLocal_TaskResponse `xml:"urn:vim25 MarkAsLocal_TaskResponse,omitempty"` + Res *types.MarkAsLocal_TaskResponse `xml:"MarkAsLocal_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7025,7 +7825,7 @@ func MarkAsLocal_Task(ctx context.Context, r soap.RoundTripper, req *types.MarkA type MarkAsNonLocal_TaskBody struct { Req *types.MarkAsNonLocal_Task `xml:"urn:vim25 MarkAsNonLocal_Task,omitempty"` - Res *types.MarkAsNonLocal_TaskResponse `xml:"urn:vim25 MarkAsNonLocal_TaskResponse,omitempty"` + Res *types.MarkAsNonLocal_TaskResponse `xml:"MarkAsNonLocal_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7045,7 +7845,7 @@ func MarkAsNonLocal_Task(ctx context.Context, r soap.RoundTripper, req *types.Ma type MarkAsNonSsd_TaskBody struct { Req *types.MarkAsNonSsd_Task `xml:"urn:vim25 MarkAsNonSsd_Task,omitempty"` - Res *types.MarkAsNonSsd_TaskResponse `xml:"urn:vim25 MarkAsNonSsd_TaskResponse,omitempty"` + Res *types.MarkAsNonSsd_TaskResponse `xml:"MarkAsNonSsd_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7065,7 +7865,7 @@ func MarkAsNonSsd_Task(ctx context.Context, r soap.RoundTripper, req *types.Mark type MarkAsSsd_TaskBody struct { Req *types.MarkAsSsd_Task `xml:"urn:vim25 MarkAsSsd_Task,omitempty"` - Res *types.MarkAsSsd_TaskResponse `xml:"urn:vim25 MarkAsSsd_TaskResponse,omitempty"` + Res *types.MarkAsSsd_TaskResponse `xml:"MarkAsSsd_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7085,7 +7885,7 @@ func MarkAsSsd_Task(ctx context.Context, r soap.RoundTripper, req *types.MarkAsS type MarkAsTemplateBody struct { Req *types.MarkAsTemplate `xml:"urn:vim25 MarkAsTemplate,omitempty"` - Res *types.MarkAsTemplateResponse `xml:"urn:vim25 MarkAsTemplateResponse,omitempty"` + Res *types.MarkAsTemplateResponse `xml:"MarkAsTemplateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7105,7 +7905,7 @@ func MarkAsTemplate(ctx context.Context, r soap.RoundTripper, req *types.MarkAsT type MarkAsVirtualMachineBody struct { Req *types.MarkAsVirtualMachine `xml:"urn:vim25 MarkAsVirtualMachine,omitempty"` - Res *types.MarkAsVirtualMachineResponse `xml:"urn:vim25 MarkAsVirtualMachineResponse,omitempty"` + Res *types.MarkAsVirtualMachineResponse `xml:"MarkAsVirtualMachineResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7125,7 +7925,7 @@ func MarkAsVirtualMachine(ctx context.Context, r soap.RoundTripper, req *types.M type MarkDefaultBody struct { Req *types.MarkDefault `xml:"urn:vim25 MarkDefault,omitempty"` - Res *types.MarkDefaultResponse `xml:"urn:vim25 MarkDefaultResponse,omitempty"` + Res *types.MarkDefaultResponse `xml:"MarkDefaultResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7145,7 +7945,7 @@ func MarkDefault(ctx context.Context, r soap.RoundTripper, req *types.MarkDefaul type MarkForRemovalBody struct { Req *types.MarkForRemoval `xml:"urn:vim25 MarkForRemoval,omitempty"` - Res *types.MarkForRemovalResponse `xml:"urn:vim25 MarkForRemovalResponse,omitempty"` + Res *types.MarkForRemovalResponse `xml:"MarkForRemovalResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7163,9 +7963,49 @@ func MarkForRemoval(ctx context.Context, r soap.RoundTripper, req *types.MarkFor return resBody.Res, nil } +type MarkPerenniallyReservedBody struct { + Req *types.MarkPerenniallyReserved `xml:"urn:vim25 MarkPerenniallyReserved,omitempty"` + Res *types.MarkPerenniallyReservedResponse `xml:"MarkPerenniallyReservedResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *MarkPerenniallyReservedBody) Fault() *soap.Fault { return b.Fault_ } + +func MarkPerenniallyReserved(ctx context.Context, r soap.RoundTripper, req *types.MarkPerenniallyReserved) (*types.MarkPerenniallyReservedResponse, error) { + var reqBody, resBody MarkPerenniallyReservedBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type MarkPerenniallyReservedEx_TaskBody struct { + Req *types.MarkPerenniallyReservedEx_Task `xml:"urn:vim25 MarkPerenniallyReservedEx_Task,omitempty"` + Res *types.MarkPerenniallyReservedEx_TaskResponse `xml:"MarkPerenniallyReservedEx_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *MarkPerenniallyReservedEx_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func MarkPerenniallyReservedEx_Task(ctx context.Context, r soap.RoundTripper, req *types.MarkPerenniallyReservedEx_Task) (*types.MarkPerenniallyReservedEx_TaskResponse, error) { + var reqBody, resBody MarkPerenniallyReservedEx_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type MergeDvs_TaskBody struct { Req *types.MergeDvs_Task `xml:"urn:vim25 MergeDvs_Task,omitempty"` - Res *types.MergeDvs_TaskResponse `xml:"urn:vim25 MergeDvs_TaskResponse,omitempty"` + Res *types.MergeDvs_TaskResponse `xml:"MergeDvs_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7185,7 +8025,7 @@ func MergeDvs_Task(ctx context.Context, r soap.RoundTripper, req *types.MergeDvs type MergePermissionsBody struct { Req *types.MergePermissions `xml:"urn:vim25 MergePermissions,omitempty"` - Res *types.MergePermissionsResponse `xml:"urn:vim25 MergePermissionsResponse,omitempty"` + Res *types.MergePermissionsResponse `xml:"MergePermissionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7205,7 +8045,7 @@ func MergePermissions(ctx context.Context, r soap.RoundTripper, req *types.Merge type MigrateVM_TaskBody struct { Req *types.MigrateVM_Task `xml:"urn:vim25 MigrateVM_Task,omitempty"` - Res *types.MigrateVM_TaskResponse `xml:"urn:vim25 MigrateVM_TaskResponse,omitempty"` + Res *types.MigrateVM_TaskResponse `xml:"MigrateVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7225,7 +8065,7 @@ func MigrateVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Migrate type ModifyListViewBody struct { Req *types.ModifyListView `xml:"urn:vim25 ModifyListView,omitempty"` - Res *types.ModifyListViewResponse `xml:"urn:vim25 ModifyListViewResponse,omitempty"` + Res *types.ModifyListViewResponse `xml:"ModifyListViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7245,7 +8085,7 @@ func ModifyListView(ctx context.Context, r soap.RoundTripper, req *types.ModifyL type MountToolsInstallerBody struct { Req *types.MountToolsInstaller `xml:"urn:vim25 MountToolsInstaller,omitempty"` - Res *types.MountToolsInstallerResponse `xml:"urn:vim25 MountToolsInstallerResponse,omitempty"` + Res *types.MountToolsInstallerResponse `xml:"MountToolsInstallerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7265,7 +8105,7 @@ func MountToolsInstaller(ctx context.Context, r soap.RoundTripper, req *types.Mo type MountVffsVolumeBody struct { Req *types.MountVffsVolume `xml:"urn:vim25 MountVffsVolume,omitempty"` - Res *types.MountVffsVolumeResponse `xml:"urn:vim25 MountVffsVolumeResponse,omitempty"` + Res *types.MountVffsVolumeResponse `xml:"MountVffsVolumeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7285,7 +8125,7 @@ func MountVffsVolume(ctx context.Context, r soap.RoundTripper, req *types.MountV type MountVmfsVolumeBody struct { Req *types.MountVmfsVolume `xml:"urn:vim25 MountVmfsVolume,omitempty"` - Res *types.MountVmfsVolumeResponse `xml:"urn:vim25 MountVmfsVolumeResponse,omitempty"` + Res *types.MountVmfsVolumeResponse `xml:"MountVmfsVolumeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7305,7 +8145,7 @@ func MountVmfsVolume(ctx context.Context, r soap.RoundTripper, req *types.MountV type MountVmfsVolumeEx_TaskBody struct { Req *types.MountVmfsVolumeEx_Task `xml:"urn:vim25 MountVmfsVolumeEx_Task,omitempty"` - Res *types.MountVmfsVolumeEx_TaskResponse `xml:"urn:vim25 MountVmfsVolumeEx_TaskResponse,omitempty"` + Res *types.MountVmfsVolumeEx_TaskResponse `xml:"MountVmfsVolumeEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7325,7 +8165,7 @@ func MountVmfsVolumeEx_Task(ctx context.Context, r soap.RoundTripper, req *types type MoveDVPort_TaskBody struct { Req *types.MoveDVPort_Task `xml:"urn:vim25 MoveDVPort_Task,omitempty"` - Res *types.MoveDVPort_TaskResponse `xml:"urn:vim25 MoveDVPort_TaskResponse,omitempty"` + Res *types.MoveDVPort_TaskResponse `xml:"MoveDVPort_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7345,7 +8185,7 @@ func MoveDVPort_Task(ctx context.Context, r soap.RoundTripper, req *types.MoveDV type MoveDatastoreFile_TaskBody struct { Req *types.MoveDatastoreFile_Task `xml:"urn:vim25 MoveDatastoreFile_Task,omitempty"` - Res *types.MoveDatastoreFile_TaskResponse `xml:"urn:vim25 MoveDatastoreFile_TaskResponse,omitempty"` + Res *types.MoveDatastoreFile_TaskResponse `xml:"MoveDatastoreFile_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7365,7 +8205,7 @@ func MoveDatastoreFile_Task(ctx context.Context, r soap.RoundTripper, req *types type MoveDirectoryInGuestBody struct { Req *types.MoveDirectoryInGuest `xml:"urn:vim25 MoveDirectoryInGuest,omitempty"` - Res *types.MoveDirectoryInGuestResponse `xml:"urn:vim25 MoveDirectoryInGuestResponse,omitempty"` + Res *types.MoveDirectoryInGuestResponse `xml:"MoveDirectoryInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7385,7 +8225,7 @@ func MoveDirectoryInGuest(ctx context.Context, r soap.RoundTripper, req *types.M type MoveFileInGuestBody struct { Req *types.MoveFileInGuest `xml:"urn:vim25 MoveFileInGuest,omitempty"` - Res *types.MoveFileInGuestResponse `xml:"urn:vim25 MoveFileInGuestResponse,omitempty"` + Res *types.MoveFileInGuestResponse `xml:"MoveFileInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7405,7 +8245,7 @@ func MoveFileInGuest(ctx context.Context, r soap.RoundTripper, req *types.MoveFi type MoveHostInto_TaskBody struct { Req *types.MoveHostInto_Task `xml:"urn:vim25 MoveHostInto_Task,omitempty"` - Res *types.MoveHostInto_TaskResponse `xml:"urn:vim25 MoveHostInto_TaskResponse,omitempty"` + Res *types.MoveHostInto_TaskResponse `xml:"MoveHostInto_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7425,7 +8265,7 @@ func MoveHostInto_Task(ctx context.Context, r soap.RoundTripper, req *types.Move type MoveIntoFolder_TaskBody struct { Req *types.MoveIntoFolder_Task `xml:"urn:vim25 MoveIntoFolder_Task,omitempty"` - Res *types.MoveIntoFolder_TaskResponse `xml:"urn:vim25 MoveIntoFolder_TaskResponse,omitempty"` + Res *types.MoveIntoFolder_TaskResponse `xml:"MoveIntoFolder_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7445,7 +8285,7 @@ func MoveIntoFolder_Task(ctx context.Context, r soap.RoundTripper, req *types.Mo type MoveIntoResourcePoolBody struct { Req *types.MoveIntoResourcePool `xml:"urn:vim25 MoveIntoResourcePool,omitempty"` - Res *types.MoveIntoResourcePoolResponse `xml:"urn:vim25 MoveIntoResourcePoolResponse,omitempty"` + Res *types.MoveIntoResourcePoolResponse `xml:"MoveIntoResourcePoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7465,7 +8305,7 @@ func MoveIntoResourcePool(ctx context.Context, r soap.RoundTripper, req *types.M type MoveInto_TaskBody struct { Req *types.MoveInto_Task `xml:"urn:vim25 MoveInto_Task,omitempty"` - Res *types.MoveInto_TaskResponse `xml:"urn:vim25 MoveInto_TaskResponse,omitempty"` + Res *types.MoveInto_TaskResponse `xml:"MoveInto_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7485,7 +8325,7 @@ func MoveInto_Task(ctx context.Context, r soap.RoundTripper, req *types.MoveInto type MoveVirtualDisk_TaskBody struct { Req *types.MoveVirtualDisk_Task `xml:"urn:vim25 MoveVirtualDisk_Task,omitempty"` - Res *types.MoveVirtualDisk_TaskResponse `xml:"urn:vim25 MoveVirtualDisk_TaskResponse,omitempty"` + Res *types.MoveVirtualDisk_TaskResponse `xml:"MoveVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7505,7 +8345,7 @@ func MoveVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.M type OpenInventoryViewFolderBody struct { Req *types.OpenInventoryViewFolder `xml:"urn:vim25 OpenInventoryViewFolder,omitempty"` - Res *types.OpenInventoryViewFolderResponse `xml:"urn:vim25 OpenInventoryViewFolderResponse,omitempty"` + Res *types.OpenInventoryViewFolderResponse `xml:"OpenInventoryViewFolderResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7525,7 +8365,7 @@ func OpenInventoryViewFolder(ctx context.Context, r soap.RoundTripper, req *type type OverwriteCustomizationSpecBody struct { Req *types.OverwriteCustomizationSpec `xml:"urn:vim25 OverwriteCustomizationSpec,omitempty"` - Res *types.OverwriteCustomizationSpecResponse `xml:"urn:vim25 OverwriteCustomizationSpecResponse,omitempty"` + Res *types.OverwriteCustomizationSpecResponse `xml:"OverwriteCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7545,7 +8385,7 @@ func OverwriteCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *t type ParseDescriptorBody struct { Req *types.ParseDescriptor `xml:"urn:vim25 ParseDescriptor,omitempty"` - Res *types.ParseDescriptorResponse `xml:"urn:vim25 ParseDescriptorResponse,omitempty"` + Res *types.ParseDescriptorResponse `xml:"ParseDescriptorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7565,7 +8405,7 @@ func ParseDescriptor(ctx context.Context, r soap.RoundTripper, req *types.ParseD type PerformDvsProductSpecOperation_TaskBody struct { Req *types.PerformDvsProductSpecOperation_Task `xml:"urn:vim25 PerformDvsProductSpecOperation_Task,omitempty"` - Res *types.PerformDvsProductSpecOperation_TaskResponse `xml:"urn:vim25 PerformDvsProductSpecOperation_TaskResponse,omitempty"` + Res *types.PerformDvsProductSpecOperation_TaskResponse `xml:"PerformDvsProductSpecOperation_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7585,7 +8425,7 @@ func PerformDvsProductSpecOperation_Task(ctx context.Context, r soap.RoundTrippe type PerformVsanUpgradePreflightCheckBody struct { Req *types.PerformVsanUpgradePreflightCheck `xml:"urn:vim25 PerformVsanUpgradePreflightCheck,omitempty"` - Res *types.PerformVsanUpgradePreflightCheckResponse `xml:"urn:vim25 PerformVsanUpgradePreflightCheckResponse,omitempty"` + Res *types.PerformVsanUpgradePreflightCheckResponse `xml:"PerformVsanUpgradePreflightCheckResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7605,7 +8445,7 @@ func PerformVsanUpgradePreflightCheck(ctx context.Context, r soap.RoundTripper, type PerformVsanUpgrade_TaskBody struct { Req *types.PerformVsanUpgrade_Task `xml:"urn:vim25 PerformVsanUpgrade_Task,omitempty"` - Res *types.PerformVsanUpgrade_TaskResponse `xml:"urn:vim25 PerformVsanUpgrade_TaskResponse,omitempty"` + Res *types.PerformVsanUpgrade_TaskResponse `xml:"PerformVsanUpgrade_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7625,7 +8465,7 @@ func PerformVsanUpgrade_Task(ctx context.Context, r soap.RoundTripper, req *type type PlaceVmBody struct { Req *types.PlaceVm `xml:"urn:vim25 PlaceVm,omitempty"` - Res *types.PlaceVmResponse `xml:"urn:vim25 PlaceVmResponse,omitempty"` + Res *types.PlaceVmResponse `xml:"PlaceVmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7645,7 +8485,7 @@ func PlaceVm(ctx context.Context, r soap.RoundTripper, req *types.PlaceVm) (*typ type PostEventBody struct { Req *types.PostEvent `xml:"urn:vim25 PostEvent,omitempty"` - Res *types.PostEventResponse `xml:"urn:vim25 PostEventResponse,omitempty"` + Res *types.PostEventResponse `xml:"PostEventResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7665,7 +8505,7 @@ func PostEvent(ctx context.Context, r soap.RoundTripper, req *types.PostEvent) ( type PostHealthUpdatesBody struct { Req *types.PostHealthUpdates `xml:"urn:vim25 PostHealthUpdates,omitempty"` - Res *types.PostHealthUpdatesResponse `xml:"urn:vim25 PostHealthUpdatesResponse,omitempty"` + Res *types.PostHealthUpdatesResponse `xml:"PostHealthUpdatesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7685,7 +8525,7 @@ func PostHealthUpdates(ctx context.Context, r soap.RoundTripper, req *types.Post type PowerDownHostToStandBy_TaskBody struct { Req *types.PowerDownHostToStandBy_Task `xml:"urn:vim25 PowerDownHostToStandBy_Task,omitempty"` - Res *types.PowerDownHostToStandBy_TaskResponse `xml:"urn:vim25 PowerDownHostToStandBy_TaskResponse,omitempty"` + Res *types.PowerDownHostToStandBy_TaskResponse `xml:"PowerDownHostToStandBy_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7705,7 +8545,7 @@ func PowerDownHostToStandBy_Task(ctx context.Context, r soap.RoundTripper, req * type PowerOffVApp_TaskBody struct { Req *types.PowerOffVApp_Task `xml:"urn:vim25 PowerOffVApp_Task,omitempty"` - Res *types.PowerOffVApp_TaskResponse `xml:"urn:vim25 PowerOffVApp_TaskResponse,omitempty"` + Res *types.PowerOffVApp_TaskResponse `xml:"PowerOffVApp_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7725,7 +8565,7 @@ func PowerOffVApp_Task(ctx context.Context, r soap.RoundTripper, req *types.Powe type PowerOffVM_TaskBody struct { Req *types.PowerOffVM_Task `xml:"urn:vim25 PowerOffVM_Task,omitempty"` - Res *types.PowerOffVM_TaskResponse `xml:"urn:vim25 PowerOffVM_TaskResponse,omitempty"` + Res *types.PowerOffVM_TaskResponse `xml:"PowerOffVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7745,7 +8585,7 @@ func PowerOffVM_Task(ctx context.Context, r soap.RoundTripper, req *types.PowerO type PowerOnMultiVM_TaskBody struct { Req *types.PowerOnMultiVM_Task `xml:"urn:vim25 PowerOnMultiVM_Task,omitempty"` - Res *types.PowerOnMultiVM_TaskResponse `xml:"urn:vim25 PowerOnMultiVM_TaskResponse,omitempty"` + Res *types.PowerOnMultiVM_TaskResponse `xml:"PowerOnMultiVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7765,7 +8605,7 @@ func PowerOnMultiVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Po type PowerOnVApp_TaskBody struct { Req *types.PowerOnVApp_Task `xml:"urn:vim25 PowerOnVApp_Task,omitempty"` - Res *types.PowerOnVApp_TaskResponse `xml:"urn:vim25 PowerOnVApp_TaskResponse,omitempty"` + Res *types.PowerOnVApp_TaskResponse `xml:"PowerOnVApp_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7785,7 +8625,7 @@ func PowerOnVApp_Task(ctx context.Context, r soap.RoundTripper, req *types.Power type PowerOnVM_TaskBody struct { Req *types.PowerOnVM_Task `xml:"urn:vim25 PowerOnVM_Task,omitempty"` - Res *types.PowerOnVM_TaskResponse `xml:"urn:vim25 PowerOnVM_TaskResponse,omitempty"` + Res *types.PowerOnVM_TaskResponse `xml:"PowerOnVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7805,7 +8645,7 @@ func PowerOnVM_Task(ctx context.Context, r soap.RoundTripper, req *types.PowerOn type PowerUpHostFromStandBy_TaskBody struct { Req *types.PowerUpHostFromStandBy_Task `xml:"urn:vim25 PowerUpHostFromStandBy_Task,omitempty"` - Res *types.PowerUpHostFromStandBy_TaskResponse `xml:"urn:vim25 PowerUpHostFromStandBy_TaskResponse,omitempty"` + Res *types.PowerUpHostFromStandBy_TaskResponse `xml:"PowerUpHostFromStandBy_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7825,7 +8665,7 @@ func PowerUpHostFromStandBy_Task(ctx context.Context, r soap.RoundTripper, req * type PrepareCryptoBody struct { Req *types.PrepareCrypto `xml:"urn:vim25 PrepareCrypto,omitempty"` - Res *types.PrepareCryptoResponse `xml:"urn:vim25 PrepareCryptoResponse,omitempty"` + Res *types.PrepareCryptoResponse `xml:"PrepareCryptoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7845,7 +8685,7 @@ func PrepareCrypto(ctx context.Context, r soap.RoundTripper, req *types.PrepareC type PromoteDisks_TaskBody struct { Req *types.PromoteDisks_Task `xml:"urn:vim25 PromoteDisks_Task,omitempty"` - Res *types.PromoteDisks_TaskResponse `xml:"urn:vim25 PromoteDisks_TaskResponse,omitempty"` + Res *types.PromoteDisks_TaskResponse `xml:"PromoteDisks_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7865,7 +8705,7 @@ func PromoteDisks_Task(ctx context.Context, r soap.RoundTripper, req *types.Prom type PutUsbScanCodesBody struct { Req *types.PutUsbScanCodes `xml:"urn:vim25 PutUsbScanCodes,omitempty"` - Res *types.PutUsbScanCodesResponse `xml:"urn:vim25 PutUsbScanCodesResponse,omitempty"` + Res *types.PutUsbScanCodesResponse `xml:"PutUsbScanCodesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7885,7 +8725,7 @@ func PutUsbScanCodes(ctx context.Context, r soap.RoundTripper, req *types.PutUsb type QueryAnswerFileStatusBody struct { Req *types.QueryAnswerFileStatus `xml:"urn:vim25 QueryAnswerFileStatus,omitempty"` - Res *types.QueryAnswerFileStatusResponse `xml:"urn:vim25 QueryAnswerFileStatusResponse,omitempty"` + Res *types.QueryAnswerFileStatusResponse `xml:"QueryAnswerFileStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7905,7 +8745,7 @@ func QueryAnswerFileStatus(ctx context.Context, r soap.RoundTripper, req *types. type QueryAssignedLicensesBody struct { Req *types.QueryAssignedLicenses `xml:"urn:vim25 QueryAssignedLicenses,omitempty"` - Res *types.QueryAssignedLicensesResponse `xml:"urn:vim25 QueryAssignedLicensesResponse,omitempty"` + Res *types.QueryAssignedLicensesResponse `xml:"QueryAssignedLicensesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7925,7 +8765,7 @@ func QueryAssignedLicenses(ctx context.Context, r soap.RoundTripper, req *types. type QueryAvailableDisksForVmfsBody struct { Req *types.QueryAvailableDisksForVmfs `xml:"urn:vim25 QueryAvailableDisksForVmfs,omitempty"` - Res *types.QueryAvailableDisksForVmfsResponse `xml:"urn:vim25 QueryAvailableDisksForVmfsResponse,omitempty"` + Res *types.QueryAvailableDisksForVmfsResponse `xml:"QueryAvailableDisksForVmfsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7945,7 +8785,7 @@ func QueryAvailableDisksForVmfs(ctx context.Context, r soap.RoundTripper, req *t type QueryAvailableDvsSpecBody struct { Req *types.QueryAvailableDvsSpec `xml:"urn:vim25 QueryAvailableDvsSpec,omitempty"` - Res *types.QueryAvailableDvsSpecResponse `xml:"urn:vim25 QueryAvailableDvsSpecResponse,omitempty"` + Res *types.QueryAvailableDvsSpecResponse `xml:"QueryAvailableDvsSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7965,7 +8805,7 @@ func QueryAvailableDvsSpec(ctx context.Context, r soap.RoundTripper, req *types. type QueryAvailablePartitionBody struct { Req *types.QueryAvailablePartition `xml:"urn:vim25 QueryAvailablePartition,omitempty"` - Res *types.QueryAvailablePartitionResponse `xml:"urn:vim25 QueryAvailablePartitionResponse,omitempty"` + Res *types.QueryAvailablePartitionResponse `xml:"QueryAvailablePartitionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -7985,7 +8825,7 @@ func QueryAvailablePartition(ctx context.Context, r soap.RoundTripper, req *type type QueryAvailablePerfMetricBody struct { Req *types.QueryAvailablePerfMetric `xml:"urn:vim25 QueryAvailablePerfMetric,omitempty"` - Res *types.QueryAvailablePerfMetricResponse `xml:"urn:vim25 QueryAvailablePerfMetricResponse,omitempty"` + Res *types.QueryAvailablePerfMetricResponse `xml:"QueryAvailablePerfMetricResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8005,7 +8845,7 @@ func QueryAvailablePerfMetric(ctx context.Context, r soap.RoundTripper, req *typ type QueryAvailableSsdsBody struct { Req *types.QueryAvailableSsds `xml:"urn:vim25 QueryAvailableSsds,omitempty"` - Res *types.QueryAvailableSsdsResponse `xml:"urn:vim25 QueryAvailableSsdsResponse,omitempty"` + Res *types.QueryAvailableSsdsResponse `xml:"QueryAvailableSsdsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8025,7 +8865,7 @@ func QueryAvailableSsds(ctx context.Context, r soap.RoundTripper, req *types.Que type QueryAvailableTimeZonesBody struct { Req *types.QueryAvailableTimeZones `xml:"urn:vim25 QueryAvailableTimeZones,omitempty"` - Res *types.QueryAvailableTimeZonesResponse `xml:"urn:vim25 QueryAvailableTimeZonesResponse,omitempty"` + Res *types.QueryAvailableTimeZonesResponse `xml:"QueryAvailableTimeZonesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8045,7 +8885,7 @@ func QueryAvailableTimeZones(ctx context.Context, r soap.RoundTripper, req *type type QueryBootDevicesBody struct { Req *types.QueryBootDevices `xml:"urn:vim25 QueryBootDevices,omitempty"` - Res *types.QueryBootDevicesResponse `xml:"urn:vim25 QueryBootDevicesResponse,omitempty"` + Res *types.QueryBootDevicesResponse `xml:"QueryBootDevicesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8065,7 +8905,7 @@ func QueryBootDevices(ctx context.Context, r soap.RoundTripper, req *types.Query type QueryBoundVnicsBody struct { Req *types.QueryBoundVnics `xml:"urn:vim25 QueryBoundVnics,omitempty"` - Res *types.QueryBoundVnicsResponse `xml:"urn:vim25 QueryBoundVnicsResponse,omitempty"` + Res *types.QueryBoundVnicsResponse `xml:"QueryBoundVnicsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8085,7 +8925,7 @@ func QueryBoundVnics(ctx context.Context, r soap.RoundTripper, req *types.QueryB type QueryCandidateNicsBody struct { Req *types.QueryCandidateNics `xml:"urn:vim25 QueryCandidateNics,omitempty"` - Res *types.QueryCandidateNicsResponse `xml:"urn:vim25 QueryCandidateNicsResponse,omitempty"` + Res *types.QueryCandidateNicsResponse `xml:"QueryCandidateNicsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8105,7 +8945,7 @@ func QueryCandidateNics(ctx context.Context, r soap.RoundTripper, req *types.Que type QueryChangedDiskAreasBody struct { Req *types.QueryChangedDiskAreas `xml:"urn:vim25 QueryChangedDiskAreas,omitempty"` - Res *types.QueryChangedDiskAreasResponse `xml:"urn:vim25 QueryChangedDiskAreasResponse,omitempty"` + Res *types.QueryChangedDiskAreasResponse `xml:"QueryChangedDiskAreasResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8125,7 +8965,7 @@ func QueryChangedDiskAreas(ctx context.Context, r soap.RoundTripper, req *types. type QueryCmmdsBody struct { Req *types.QueryCmmds `xml:"urn:vim25 QueryCmmds,omitempty"` - Res *types.QueryCmmdsResponse `xml:"urn:vim25 QueryCmmdsResponse,omitempty"` + Res *types.QueryCmmdsResponse `xml:"QueryCmmdsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8145,7 +8985,7 @@ func QueryCmmds(ctx context.Context, r soap.RoundTripper, req *types.QueryCmmds) type QueryCompatibleHostForExistingDvsBody struct { Req *types.QueryCompatibleHostForExistingDvs `xml:"urn:vim25 QueryCompatibleHostForExistingDvs,omitempty"` - Res *types.QueryCompatibleHostForExistingDvsResponse `xml:"urn:vim25 QueryCompatibleHostForExistingDvsResponse,omitempty"` + Res *types.QueryCompatibleHostForExistingDvsResponse `xml:"QueryCompatibleHostForExistingDvsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8165,7 +9005,7 @@ func QueryCompatibleHostForExistingDvs(ctx context.Context, r soap.RoundTripper, type QueryCompatibleHostForNewDvsBody struct { Req *types.QueryCompatibleHostForNewDvs `xml:"urn:vim25 QueryCompatibleHostForNewDvs,omitempty"` - Res *types.QueryCompatibleHostForNewDvsResponse `xml:"urn:vim25 QueryCompatibleHostForNewDvsResponse,omitempty"` + Res *types.QueryCompatibleHostForNewDvsResponse `xml:"QueryCompatibleHostForNewDvsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8185,7 +9025,7 @@ func QueryCompatibleHostForNewDvs(ctx context.Context, r soap.RoundTripper, req type QueryComplianceStatusBody struct { Req *types.QueryComplianceStatus `xml:"urn:vim25 QueryComplianceStatus,omitempty"` - Res *types.QueryComplianceStatusResponse `xml:"urn:vim25 QueryComplianceStatusResponse,omitempty"` + Res *types.QueryComplianceStatusResponse `xml:"QueryComplianceStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8205,7 +9045,7 @@ func QueryComplianceStatus(ctx context.Context, r soap.RoundTripper, req *types. type QueryConfigOptionBody struct { Req *types.QueryConfigOption `xml:"urn:vim25 QueryConfigOption,omitempty"` - Res *types.QueryConfigOptionResponse `xml:"urn:vim25 QueryConfigOptionResponse,omitempty"` + Res *types.QueryConfigOptionResponse `xml:"QueryConfigOptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8225,7 +9065,7 @@ func QueryConfigOption(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryConfigOptionDescriptorBody struct { Req *types.QueryConfigOptionDescriptor `xml:"urn:vim25 QueryConfigOptionDescriptor,omitempty"` - Res *types.QueryConfigOptionDescriptorResponse `xml:"urn:vim25 QueryConfigOptionDescriptorResponse,omitempty"` + Res *types.QueryConfigOptionDescriptorResponse `xml:"QueryConfigOptionDescriptorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8245,7 +9085,7 @@ func QueryConfigOptionDescriptor(ctx context.Context, r soap.RoundTripper, req * type QueryConfigOptionExBody struct { Req *types.QueryConfigOptionEx `xml:"urn:vim25 QueryConfigOptionEx,omitempty"` - Res *types.QueryConfigOptionExResponse `xml:"urn:vim25 QueryConfigOptionExResponse,omitempty"` + Res *types.QueryConfigOptionExResponse `xml:"QueryConfigOptionExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8265,7 +9105,7 @@ func QueryConfigOptionEx(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryConfigTargetBody struct { Req *types.QueryConfigTarget `xml:"urn:vim25 QueryConfigTarget,omitempty"` - Res *types.QueryConfigTargetResponse `xml:"urn:vim25 QueryConfigTargetResponse,omitempty"` + Res *types.QueryConfigTargetResponse `xml:"QueryConfigTargetResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8285,7 +9125,7 @@ func QueryConfigTarget(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryConfiguredModuleOptionStringBody struct { Req *types.QueryConfiguredModuleOptionString `xml:"urn:vim25 QueryConfiguredModuleOptionString,omitempty"` - Res *types.QueryConfiguredModuleOptionStringResponse `xml:"urn:vim25 QueryConfiguredModuleOptionStringResponse,omitempty"` + Res *types.QueryConfiguredModuleOptionStringResponse `xml:"QueryConfiguredModuleOptionStringResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8305,7 +9145,7 @@ func QueryConfiguredModuleOptionString(ctx context.Context, r soap.RoundTripper, type QueryConnectionInfoBody struct { Req *types.QueryConnectionInfo `xml:"urn:vim25 QueryConnectionInfo,omitempty"` - Res *types.QueryConnectionInfoResponse `xml:"urn:vim25 QueryConnectionInfoResponse,omitempty"` + Res *types.QueryConnectionInfoResponse `xml:"QueryConnectionInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8325,7 +9165,7 @@ func QueryConnectionInfo(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryConnectionInfoViaSpecBody struct { Req *types.QueryConnectionInfoViaSpec `xml:"urn:vim25 QueryConnectionInfoViaSpec,omitempty"` - Res *types.QueryConnectionInfoViaSpecResponse `xml:"urn:vim25 QueryConnectionInfoViaSpecResponse,omitempty"` + Res *types.QueryConnectionInfoViaSpecResponse `xml:"QueryConnectionInfoViaSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8343,9 +9183,29 @@ func QueryConnectionInfoViaSpec(ctx context.Context, r soap.RoundTripper, req *t return resBody.Res, nil } +type QueryCryptoKeyStatusBody struct { + Req *types.QueryCryptoKeyStatus `xml:"urn:vim25 QueryCryptoKeyStatus,omitempty"` + Res *types.QueryCryptoKeyStatusResponse `xml:"QueryCryptoKeyStatusResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *QueryCryptoKeyStatusBody) Fault() *soap.Fault { return b.Fault_ } + +func QueryCryptoKeyStatus(ctx context.Context, r soap.RoundTripper, req *types.QueryCryptoKeyStatus) (*types.QueryCryptoKeyStatusResponse, error) { + var reqBody, resBody QueryCryptoKeyStatusBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type QueryDatastorePerformanceSummaryBody struct { Req *types.QueryDatastorePerformanceSummary `xml:"urn:vim25 QueryDatastorePerformanceSummary,omitempty"` - Res *types.QueryDatastorePerformanceSummaryResponse `xml:"urn:vim25 QueryDatastorePerformanceSummaryResponse,omitempty"` + Res *types.QueryDatastorePerformanceSummaryResponse `xml:"QueryDatastorePerformanceSummaryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8365,7 +9225,7 @@ func QueryDatastorePerformanceSummary(ctx context.Context, r soap.RoundTripper, type QueryDateTimeBody struct { Req *types.QueryDateTime `xml:"urn:vim25 QueryDateTime,omitempty"` - Res *types.QueryDateTimeResponse `xml:"urn:vim25 QueryDateTimeResponse,omitempty"` + Res *types.QueryDateTimeResponse `xml:"QueryDateTimeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8385,7 +9245,7 @@ func QueryDateTime(ctx context.Context, r soap.RoundTripper, req *types.QueryDat type QueryDescriptionsBody struct { Req *types.QueryDescriptions `xml:"urn:vim25 QueryDescriptions,omitempty"` - Res *types.QueryDescriptionsResponse `xml:"urn:vim25 QueryDescriptionsResponse,omitempty"` + Res *types.QueryDescriptionsResponse `xml:"QueryDescriptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8405,7 +9265,7 @@ func QueryDescriptions(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryDisksForVsanBody struct { Req *types.QueryDisksForVsan `xml:"urn:vim25 QueryDisksForVsan,omitempty"` - Res *types.QueryDisksForVsanResponse `xml:"urn:vim25 QueryDisksForVsanResponse,omitempty"` + Res *types.QueryDisksForVsanResponse `xml:"QueryDisksForVsanResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8425,7 +9285,7 @@ func QueryDisksForVsan(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryDisksUsingFilterBody struct { Req *types.QueryDisksUsingFilter `xml:"urn:vim25 QueryDisksUsingFilter,omitempty"` - Res *types.QueryDisksUsingFilterResponse `xml:"urn:vim25 QueryDisksUsingFilterResponse,omitempty"` + Res *types.QueryDisksUsingFilterResponse `xml:"QueryDisksUsingFilterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8445,7 +9305,7 @@ func QueryDisksUsingFilter(ctx context.Context, r soap.RoundTripper, req *types. type QueryDvsByUuidBody struct { Req *types.QueryDvsByUuid `xml:"urn:vim25 QueryDvsByUuid,omitempty"` - Res *types.QueryDvsByUuidResponse `xml:"urn:vim25 QueryDvsByUuidResponse,omitempty"` + Res *types.QueryDvsByUuidResponse `xml:"QueryDvsByUuidResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8465,7 +9325,7 @@ func QueryDvsByUuid(ctx context.Context, r soap.RoundTripper, req *types.QueryDv type QueryDvsCheckCompatibilityBody struct { Req *types.QueryDvsCheckCompatibility `xml:"urn:vim25 QueryDvsCheckCompatibility,omitempty"` - Res *types.QueryDvsCheckCompatibilityResponse `xml:"urn:vim25 QueryDvsCheckCompatibilityResponse,omitempty"` + Res *types.QueryDvsCheckCompatibilityResponse `xml:"QueryDvsCheckCompatibilityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8485,7 +9345,7 @@ func QueryDvsCheckCompatibility(ctx context.Context, r soap.RoundTripper, req *t type QueryDvsCompatibleHostSpecBody struct { Req *types.QueryDvsCompatibleHostSpec `xml:"urn:vim25 QueryDvsCompatibleHostSpec,omitempty"` - Res *types.QueryDvsCompatibleHostSpecResponse `xml:"urn:vim25 QueryDvsCompatibleHostSpecResponse,omitempty"` + Res *types.QueryDvsCompatibleHostSpecResponse `xml:"QueryDvsCompatibleHostSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8505,7 +9365,7 @@ func QueryDvsCompatibleHostSpec(ctx context.Context, r soap.RoundTripper, req *t type QueryDvsConfigTargetBody struct { Req *types.QueryDvsConfigTarget `xml:"urn:vim25 QueryDvsConfigTarget,omitempty"` - Res *types.QueryDvsConfigTargetResponse `xml:"urn:vim25 QueryDvsConfigTargetResponse,omitempty"` + Res *types.QueryDvsConfigTargetResponse `xml:"QueryDvsConfigTargetResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8525,7 +9385,7 @@ func QueryDvsConfigTarget(ctx context.Context, r soap.RoundTripper, req *types.Q type QueryDvsFeatureCapabilityBody struct { Req *types.QueryDvsFeatureCapability `xml:"urn:vim25 QueryDvsFeatureCapability,omitempty"` - Res *types.QueryDvsFeatureCapabilityResponse `xml:"urn:vim25 QueryDvsFeatureCapabilityResponse,omitempty"` + Res *types.QueryDvsFeatureCapabilityResponse `xml:"QueryDvsFeatureCapabilityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8545,7 +9405,7 @@ func QueryDvsFeatureCapability(ctx context.Context, r soap.RoundTripper, req *ty type QueryEventsBody struct { Req *types.QueryEvents `xml:"urn:vim25 QueryEvents,omitempty"` - Res *types.QueryEventsResponse `xml:"urn:vim25 QueryEventsResponse,omitempty"` + Res *types.QueryEventsResponse `xml:"QueryEventsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8565,7 +9425,7 @@ func QueryEvents(ctx context.Context, r soap.RoundTripper, req *types.QueryEvent type QueryExpressionMetadataBody struct { Req *types.QueryExpressionMetadata `xml:"urn:vim25 QueryExpressionMetadata,omitempty"` - Res *types.QueryExpressionMetadataResponse `xml:"urn:vim25 QueryExpressionMetadataResponse,omitempty"` + Res *types.QueryExpressionMetadataResponse `xml:"QueryExpressionMetadataResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8585,7 +9445,7 @@ func QueryExpressionMetadata(ctx context.Context, r soap.RoundTripper, req *type type QueryExtensionIpAllocationUsageBody struct { Req *types.QueryExtensionIpAllocationUsage `xml:"urn:vim25 QueryExtensionIpAllocationUsage,omitempty"` - Res *types.QueryExtensionIpAllocationUsageResponse `xml:"urn:vim25 QueryExtensionIpAllocationUsageResponse,omitempty"` + Res *types.QueryExtensionIpAllocationUsageResponse `xml:"QueryExtensionIpAllocationUsageResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8605,7 +9465,7 @@ func QueryExtensionIpAllocationUsage(ctx context.Context, r soap.RoundTripper, r type QueryFaultToleranceCompatibilityBody struct { Req *types.QueryFaultToleranceCompatibility `xml:"urn:vim25 QueryFaultToleranceCompatibility,omitempty"` - Res *types.QueryFaultToleranceCompatibilityResponse `xml:"urn:vim25 QueryFaultToleranceCompatibilityResponse,omitempty"` + Res *types.QueryFaultToleranceCompatibilityResponse `xml:"QueryFaultToleranceCompatibilityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8625,7 +9485,7 @@ func QueryFaultToleranceCompatibility(ctx context.Context, r soap.RoundTripper, type QueryFaultToleranceCompatibilityExBody struct { Req *types.QueryFaultToleranceCompatibilityEx `xml:"urn:vim25 QueryFaultToleranceCompatibilityEx,omitempty"` - Res *types.QueryFaultToleranceCompatibilityExResponse `xml:"urn:vim25 QueryFaultToleranceCompatibilityExResponse,omitempty"` + Res *types.QueryFaultToleranceCompatibilityExResponse `xml:"QueryFaultToleranceCompatibilityExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8645,7 +9505,7 @@ func QueryFaultToleranceCompatibilityEx(ctx context.Context, r soap.RoundTripper type QueryFilterEntitiesBody struct { Req *types.QueryFilterEntities `xml:"urn:vim25 QueryFilterEntities,omitempty"` - Res *types.QueryFilterEntitiesResponse `xml:"urn:vim25 QueryFilterEntitiesResponse,omitempty"` + Res *types.QueryFilterEntitiesResponse `xml:"QueryFilterEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8665,7 +9525,7 @@ func QueryFilterEntities(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryFilterInfoIdsBody struct { Req *types.QueryFilterInfoIds `xml:"urn:vim25 QueryFilterInfoIds,omitempty"` - Res *types.QueryFilterInfoIdsResponse `xml:"urn:vim25 QueryFilterInfoIdsResponse,omitempty"` + Res *types.QueryFilterInfoIdsResponse `xml:"QueryFilterInfoIdsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8685,7 +9545,7 @@ func QueryFilterInfoIds(ctx context.Context, r soap.RoundTripper, req *types.Que type QueryFilterListBody struct { Req *types.QueryFilterList `xml:"urn:vim25 QueryFilterList,omitempty"` - Res *types.QueryFilterListResponse `xml:"urn:vim25 QueryFilterListResponse,omitempty"` + Res *types.QueryFilterListResponse `xml:"QueryFilterListResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8705,7 +9565,7 @@ func QueryFilterList(ctx context.Context, r soap.RoundTripper, req *types.QueryF type QueryFilterNameBody struct { Req *types.QueryFilterName `xml:"urn:vim25 QueryFilterName,omitempty"` - Res *types.QueryFilterNameResponse `xml:"urn:vim25 QueryFilterNameResponse,omitempty"` + Res *types.QueryFilterNameResponse `xml:"QueryFilterNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8725,7 +9585,7 @@ func QueryFilterName(ctx context.Context, r soap.RoundTripper, req *types.QueryF type QueryFirmwareConfigUploadURLBody struct { Req *types.QueryFirmwareConfigUploadURL `xml:"urn:vim25 QueryFirmwareConfigUploadURL,omitempty"` - Res *types.QueryFirmwareConfigUploadURLResponse `xml:"urn:vim25 QueryFirmwareConfigUploadURLResponse,omitempty"` + Res *types.QueryFirmwareConfigUploadURLResponse `xml:"QueryFirmwareConfigUploadURLResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8745,7 +9605,7 @@ func QueryFirmwareConfigUploadURL(ctx context.Context, r soap.RoundTripper, req type QueryHealthUpdateInfosBody struct { Req *types.QueryHealthUpdateInfos `xml:"urn:vim25 QueryHealthUpdateInfos,omitempty"` - Res *types.QueryHealthUpdateInfosResponse `xml:"urn:vim25 QueryHealthUpdateInfosResponse,omitempty"` + Res *types.QueryHealthUpdateInfosResponse `xml:"QueryHealthUpdateInfosResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8765,7 +9625,7 @@ func QueryHealthUpdateInfos(ctx context.Context, r soap.RoundTripper, req *types type QueryHealthUpdatesBody struct { Req *types.QueryHealthUpdates `xml:"urn:vim25 QueryHealthUpdates,omitempty"` - Res *types.QueryHealthUpdatesResponse `xml:"urn:vim25 QueryHealthUpdatesResponse,omitempty"` + Res *types.QueryHealthUpdatesResponse `xml:"QueryHealthUpdatesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8785,7 +9645,7 @@ func QueryHealthUpdates(ctx context.Context, r soap.RoundTripper, req *types.Que type QueryHostConnectionInfoBody struct { Req *types.QueryHostConnectionInfo `xml:"urn:vim25 QueryHostConnectionInfo,omitempty"` - Res *types.QueryHostConnectionInfoResponse `xml:"urn:vim25 QueryHostConnectionInfoResponse,omitempty"` + Res *types.QueryHostConnectionInfoResponse `xml:"QueryHostConnectionInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8805,7 +9665,7 @@ func QueryHostConnectionInfo(ctx context.Context, r soap.RoundTripper, req *type type QueryHostPatch_TaskBody struct { Req *types.QueryHostPatch_Task `xml:"urn:vim25 QueryHostPatch_Task,omitempty"` - Res *types.QueryHostPatch_TaskResponse `xml:"urn:vim25 QueryHostPatch_TaskResponse,omitempty"` + Res *types.QueryHostPatch_TaskResponse `xml:"QueryHostPatch_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8825,7 +9685,7 @@ func QueryHostPatch_Task(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryHostProfileMetadataBody struct { Req *types.QueryHostProfileMetadata `xml:"urn:vim25 QueryHostProfileMetadata,omitempty"` - Res *types.QueryHostProfileMetadataResponse `xml:"urn:vim25 QueryHostProfileMetadataResponse,omitempty"` + Res *types.QueryHostProfileMetadataResponse `xml:"QueryHostProfileMetadataResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8845,7 +9705,7 @@ func QueryHostProfileMetadata(ctx context.Context, r soap.RoundTripper, req *typ type QueryHostStatusBody struct { Req *types.QueryHostStatus `xml:"urn:vim25 QueryHostStatus,omitempty"` - Res *types.QueryHostStatusResponse `xml:"urn:vim25 QueryHostStatusResponse,omitempty"` + Res *types.QueryHostStatusResponse `xml:"QueryHostStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8863,9 +9723,29 @@ func QueryHostStatus(ctx context.Context, r soap.RoundTripper, req *types.QueryH return resBody.Res, nil } +type QueryHostsWithAttachedLunBody struct { + Req *types.QueryHostsWithAttachedLun `xml:"urn:vim25 QueryHostsWithAttachedLun,omitempty"` + Res *types.QueryHostsWithAttachedLunResponse `xml:"QueryHostsWithAttachedLunResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *QueryHostsWithAttachedLunBody) Fault() *soap.Fault { return b.Fault_ } + +func QueryHostsWithAttachedLun(ctx context.Context, r soap.RoundTripper, req *types.QueryHostsWithAttachedLun) (*types.QueryHostsWithAttachedLunResponse, error) { + var reqBody, resBody QueryHostsWithAttachedLunBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type QueryIORMConfigOptionBody struct { Req *types.QueryIORMConfigOption `xml:"urn:vim25 QueryIORMConfigOption,omitempty"` - Res *types.QueryIORMConfigOptionResponse `xml:"urn:vim25 QueryIORMConfigOptionResponse,omitempty"` + Res *types.QueryIORMConfigOptionResponse `xml:"QueryIORMConfigOptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8885,7 +9765,7 @@ func QueryIORMConfigOption(ctx context.Context, r soap.RoundTripper, req *types. type QueryIPAllocationsBody struct { Req *types.QueryIPAllocations `xml:"urn:vim25 QueryIPAllocations,omitempty"` - Res *types.QueryIPAllocationsResponse `xml:"urn:vim25 QueryIPAllocationsResponse,omitempty"` + Res *types.QueryIPAllocationsResponse `xml:"QueryIPAllocationsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8905,7 +9785,7 @@ func QueryIPAllocations(ctx context.Context, r soap.RoundTripper, req *types.Que type QueryIoFilterInfoBody struct { Req *types.QueryIoFilterInfo `xml:"urn:vim25 QueryIoFilterInfo,omitempty"` - Res *types.QueryIoFilterInfoResponse `xml:"urn:vim25 QueryIoFilterInfoResponse,omitempty"` + Res *types.QueryIoFilterInfoResponse `xml:"QueryIoFilterInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8925,7 +9805,7 @@ func QueryIoFilterInfo(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryIoFilterIssuesBody struct { Req *types.QueryIoFilterIssues `xml:"urn:vim25 QueryIoFilterIssues,omitempty"` - Res *types.QueryIoFilterIssuesResponse `xml:"urn:vim25 QueryIoFilterIssuesResponse,omitempty"` + Res *types.QueryIoFilterIssuesResponse `xml:"QueryIoFilterIssuesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8945,7 +9825,7 @@ func QueryIoFilterIssues(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryIpPoolsBody struct { Req *types.QueryIpPools `xml:"urn:vim25 QueryIpPools,omitempty"` - Res *types.QueryIpPoolsResponse `xml:"urn:vim25 QueryIpPoolsResponse,omitempty"` + Res *types.QueryIpPoolsResponse `xml:"QueryIpPoolsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8965,7 +9845,7 @@ func QueryIpPools(ctx context.Context, r soap.RoundTripper, req *types.QueryIpPo type QueryLicenseSourceAvailabilityBody struct { Req *types.QueryLicenseSourceAvailability `xml:"urn:vim25 QueryLicenseSourceAvailability,omitempty"` - Res *types.QueryLicenseSourceAvailabilityResponse `xml:"urn:vim25 QueryLicenseSourceAvailabilityResponse,omitempty"` + Res *types.QueryLicenseSourceAvailabilityResponse `xml:"QueryLicenseSourceAvailabilityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -8985,7 +9865,7 @@ func QueryLicenseSourceAvailability(ctx context.Context, r soap.RoundTripper, re type QueryLicenseUsageBody struct { Req *types.QueryLicenseUsage `xml:"urn:vim25 QueryLicenseUsage,omitempty"` - Res *types.QueryLicenseUsageResponse `xml:"urn:vim25 QueryLicenseUsageResponse,omitempty"` + Res *types.QueryLicenseUsageResponse `xml:"QueryLicenseUsageResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9005,7 +9885,7 @@ func QueryLicenseUsage(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryLockdownExceptionsBody struct { Req *types.QueryLockdownExceptions `xml:"urn:vim25 QueryLockdownExceptions,omitempty"` - Res *types.QueryLockdownExceptionsResponse `xml:"urn:vim25 QueryLockdownExceptionsResponse,omitempty"` + Res *types.QueryLockdownExceptionsResponse `xml:"QueryLockdownExceptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9025,7 +9905,7 @@ func QueryLockdownExceptions(ctx context.Context, r soap.RoundTripper, req *type type QueryManagedByBody struct { Req *types.QueryManagedBy `xml:"urn:vim25 QueryManagedBy,omitempty"` - Res *types.QueryManagedByResponse `xml:"urn:vim25 QueryManagedByResponse,omitempty"` + Res *types.QueryManagedByResponse `xml:"QueryManagedByResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9045,7 +9925,7 @@ func QueryManagedBy(ctx context.Context, r soap.RoundTripper, req *types.QueryMa type QueryMemoryOverheadBody struct { Req *types.QueryMemoryOverhead `xml:"urn:vim25 QueryMemoryOverhead,omitempty"` - Res *types.QueryMemoryOverheadResponse `xml:"urn:vim25 QueryMemoryOverheadResponse,omitempty"` + Res *types.QueryMemoryOverheadResponse `xml:"QueryMemoryOverheadResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9065,7 +9945,7 @@ func QueryMemoryOverhead(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryMemoryOverheadExBody struct { Req *types.QueryMemoryOverheadEx `xml:"urn:vim25 QueryMemoryOverheadEx,omitempty"` - Res *types.QueryMemoryOverheadExResponse `xml:"urn:vim25 QueryMemoryOverheadExResponse,omitempty"` + Res *types.QueryMemoryOverheadExResponse `xml:"QueryMemoryOverheadExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9085,7 +9965,7 @@ func QueryMemoryOverheadEx(ctx context.Context, r soap.RoundTripper, req *types. type QueryMigrationDependenciesBody struct { Req *types.QueryMigrationDependencies `xml:"urn:vim25 QueryMigrationDependencies,omitempty"` - Res *types.QueryMigrationDependenciesResponse `xml:"urn:vim25 QueryMigrationDependenciesResponse,omitempty"` + Res *types.QueryMigrationDependenciesResponse `xml:"QueryMigrationDependenciesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9105,7 +9985,7 @@ func QueryMigrationDependencies(ctx context.Context, r soap.RoundTripper, req *t type QueryModulesBody struct { Req *types.QueryModules `xml:"urn:vim25 QueryModules,omitempty"` - Res *types.QueryModulesResponse `xml:"urn:vim25 QueryModulesResponse,omitempty"` + Res *types.QueryModulesResponse `xml:"QueryModulesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9125,7 +10005,7 @@ func QueryModules(ctx context.Context, r soap.RoundTripper, req *types.QueryModu type QueryMonitoredEntitiesBody struct { Req *types.QueryMonitoredEntities `xml:"urn:vim25 QueryMonitoredEntities,omitempty"` - Res *types.QueryMonitoredEntitiesResponse `xml:"urn:vim25 QueryMonitoredEntitiesResponse,omitempty"` + Res *types.QueryMonitoredEntitiesResponse `xml:"QueryMonitoredEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9145,7 +10025,7 @@ func QueryMonitoredEntities(ctx context.Context, r soap.RoundTripper, req *types type QueryNFSUserBody struct { Req *types.QueryNFSUser `xml:"urn:vim25 QueryNFSUser,omitempty"` - Res *types.QueryNFSUserResponse `xml:"urn:vim25 QueryNFSUserResponse,omitempty"` + Res *types.QueryNFSUserResponse `xml:"QueryNFSUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9165,7 +10045,7 @@ func QueryNFSUser(ctx context.Context, r soap.RoundTripper, req *types.QueryNFSU type QueryNetConfigBody struct { Req *types.QueryNetConfig `xml:"urn:vim25 QueryNetConfig,omitempty"` - Res *types.QueryNetConfigResponse `xml:"urn:vim25 QueryNetConfigResponse,omitempty"` + Res *types.QueryNetConfigResponse `xml:"QueryNetConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9185,7 +10065,7 @@ func QueryNetConfig(ctx context.Context, r soap.RoundTripper, req *types.QueryNe type QueryNetworkHintBody struct { Req *types.QueryNetworkHint `xml:"urn:vim25 QueryNetworkHint,omitempty"` - Res *types.QueryNetworkHintResponse `xml:"urn:vim25 QueryNetworkHintResponse,omitempty"` + Res *types.QueryNetworkHintResponse `xml:"QueryNetworkHintResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9205,7 +10085,7 @@ func QueryNetworkHint(ctx context.Context, r soap.RoundTripper, req *types.Query type QueryObjectsOnPhysicalVsanDiskBody struct { Req *types.QueryObjectsOnPhysicalVsanDisk `xml:"urn:vim25 QueryObjectsOnPhysicalVsanDisk,omitempty"` - Res *types.QueryObjectsOnPhysicalVsanDiskResponse `xml:"urn:vim25 QueryObjectsOnPhysicalVsanDiskResponse,omitempty"` + Res *types.QueryObjectsOnPhysicalVsanDiskResponse `xml:"QueryObjectsOnPhysicalVsanDiskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9225,7 +10105,7 @@ func QueryObjectsOnPhysicalVsanDisk(ctx context.Context, r soap.RoundTripper, re type QueryOptionsBody struct { Req *types.QueryOptions `xml:"urn:vim25 QueryOptions,omitempty"` - Res *types.QueryOptionsResponse `xml:"urn:vim25 QueryOptionsResponse,omitempty"` + Res *types.QueryOptionsResponse `xml:"QueryOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9245,7 +10125,7 @@ func QueryOptions(ctx context.Context, r soap.RoundTripper, req *types.QueryOpti type QueryPartitionCreateDescBody struct { Req *types.QueryPartitionCreateDesc `xml:"urn:vim25 QueryPartitionCreateDesc,omitempty"` - Res *types.QueryPartitionCreateDescResponse `xml:"urn:vim25 QueryPartitionCreateDescResponse,omitempty"` + Res *types.QueryPartitionCreateDescResponse `xml:"QueryPartitionCreateDescResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9265,7 +10145,7 @@ func QueryPartitionCreateDesc(ctx context.Context, r soap.RoundTripper, req *typ type QueryPartitionCreateOptionsBody struct { Req *types.QueryPartitionCreateOptions `xml:"urn:vim25 QueryPartitionCreateOptions,omitempty"` - Res *types.QueryPartitionCreateOptionsResponse `xml:"urn:vim25 QueryPartitionCreateOptionsResponse,omitempty"` + Res *types.QueryPartitionCreateOptionsResponse `xml:"QueryPartitionCreateOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9285,7 +10165,7 @@ func QueryPartitionCreateOptions(ctx context.Context, r soap.RoundTripper, req * type QueryPathSelectionPolicyOptionsBody struct { Req *types.QueryPathSelectionPolicyOptions `xml:"urn:vim25 QueryPathSelectionPolicyOptions,omitempty"` - Res *types.QueryPathSelectionPolicyOptionsResponse `xml:"urn:vim25 QueryPathSelectionPolicyOptionsResponse,omitempty"` + Res *types.QueryPathSelectionPolicyOptionsResponse `xml:"QueryPathSelectionPolicyOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9305,7 +10185,7 @@ func QueryPathSelectionPolicyOptions(ctx context.Context, r soap.RoundTripper, r type QueryPerfBody struct { Req *types.QueryPerf `xml:"urn:vim25 QueryPerf,omitempty"` - Res *types.QueryPerfResponse `xml:"urn:vim25 QueryPerfResponse,omitempty"` + Res *types.QueryPerfResponse `xml:"QueryPerfResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9325,7 +10205,7 @@ func QueryPerf(ctx context.Context, r soap.RoundTripper, req *types.QueryPerf) ( type QueryPerfCompositeBody struct { Req *types.QueryPerfComposite `xml:"urn:vim25 QueryPerfComposite,omitempty"` - Res *types.QueryPerfCompositeResponse `xml:"urn:vim25 QueryPerfCompositeResponse,omitempty"` + Res *types.QueryPerfCompositeResponse `xml:"QueryPerfCompositeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9345,7 +10225,7 @@ func QueryPerfComposite(ctx context.Context, r soap.RoundTripper, req *types.Que type QueryPerfCounterBody struct { Req *types.QueryPerfCounter `xml:"urn:vim25 QueryPerfCounter,omitempty"` - Res *types.QueryPerfCounterResponse `xml:"urn:vim25 QueryPerfCounterResponse,omitempty"` + Res *types.QueryPerfCounterResponse `xml:"QueryPerfCounterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9365,7 +10245,7 @@ func QueryPerfCounter(ctx context.Context, r soap.RoundTripper, req *types.Query type QueryPerfCounterByLevelBody struct { Req *types.QueryPerfCounterByLevel `xml:"urn:vim25 QueryPerfCounterByLevel,omitempty"` - Res *types.QueryPerfCounterByLevelResponse `xml:"urn:vim25 QueryPerfCounterByLevelResponse,omitempty"` + Res *types.QueryPerfCounterByLevelResponse `xml:"QueryPerfCounterByLevelResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9385,7 +10265,7 @@ func QueryPerfCounterByLevel(ctx context.Context, r soap.RoundTripper, req *type type QueryPerfProviderSummaryBody struct { Req *types.QueryPerfProviderSummary `xml:"urn:vim25 QueryPerfProviderSummary,omitempty"` - Res *types.QueryPerfProviderSummaryResponse `xml:"urn:vim25 QueryPerfProviderSummaryResponse,omitempty"` + Res *types.QueryPerfProviderSummaryResponse `xml:"QueryPerfProviderSummaryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9405,7 +10285,7 @@ func QueryPerfProviderSummary(ctx context.Context, r soap.RoundTripper, req *typ type QueryPhysicalVsanDisksBody struct { Req *types.QueryPhysicalVsanDisks `xml:"urn:vim25 QueryPhysicalVsanDisks,omitempty"` - Res *types.QueryPhysicalVsanDisksResponse `xml:"urn:vim25 QueryPhysicalVsanDisksResponse,omitempty"` + Res *types.QueryPhysicalVsanDisksResponse `xml:"QueryPhysicalVsanDisksResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9425,7 +10305,7 @@ func QueryPhysicalVsanDisks(ctx context.Context, r soap.RoundTripper, req *types type QueryPnicStatusBody struct { Req *types.QueryPnicStatus `xml:"urn:vim25 QueryPnicStatus,omitempty"` - Res *types.QueryPnicStatusResponse `xml:"urn:vim25 QueryPnicStatusResponse,omitempty"` + Res *types.QueryPnicStatusResponse `xml:"QueryPnicStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9445,7 +10325,7 @@ func QueryPnicStatus(ctx context.Context, r soap.RoundTripper, req *types.QueryP type QueryPolicyMetadataBody struct { Req *types.QueryPolicyMetadata `xml:"urn:vim25 QueryPolicyMetadata,omitempty"` - Res *types.QueryPolicyMetadataResponse `xml:"urn:vim25 QueryPolicyMetadataResponse,omitempty"` + Res *types.QueryPolicyMetadataResponse `xml:"QueryPolicyMetadataResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9463,9 +10343,29 @@ func QueryPolicyMetadata(ctx context.Context, r soap.RoundTripper, req *types.Qu return resBody.Res, nil } +type QueryProductLockerLocationBody struct { + Req *types.QueryProductLockerLocation `xml:"urn:vim25 QueryProductLockerLocation,omitempty"` + Res *types.QueryProductLockerLocationResponse `xml:"QueryProductLockerLocationResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *QueryProductLockerLocationBody) Fault() *soap.Fault { return b.Fault_ } + +func QueryProductLockerLocation(ctx context.Context, r soap.RoundTripper, req *types.QueryProductLockerLocation) (*types.QueryProductLockerLocationResponse, error) { + var reqBody, resBody QueryProductLockerLocationBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type QueryProfileStructureBody struct { Req *types.QueryProfileStructure `xml:"urn:vim25 QueryProfileStructure,omitempty"` - Res *types.QueryProfileStructureResponse `xml:"urn:vim25 QueryProfileStructureResponse,omitempty"` + Res *types.QueryProfileStructureResponse `xml:"QueryProfileStructureResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9485,7 +10385,7 @@ func QueryProfileStructure(ctx context.Context, r soap.RoundTripper, req *types. type QueryProviderListBody struct { Req *types.QueryProviderList `xml:"urn:vim25 QueryProviderList,omitempty"` - Res *types.QueryProviderListResponse `xml:"urn:vim25 QueryProviderListResponse,omitempty"` + Res *types.QueryProviderListResponse `xml:"QueryProviderListResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9505,7 +10405,7 @@ func QueryProviderList(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryProviderNameBody struct { Req *types.QueryProviderName `xml:"urn:vim25 QueryProviderName,omitempty"` - Res *types.QueryProviderNameResponse `xml:"urn:vim25 QueryProviderNameResponse,omitempty"` + Res *types.QueryProviderNameResponse `xml:"QueryProviderNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9525,7 +10425,7 @@ func QueryProviderName(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryResourceConfigOptionBody struct { Req *types.QueryResourceConfigOption `xml:"urn:vim25 QueryResourceConfigOption,omitempty"` - Res *types.QueryResourceConfigOptionResponse `xml:"urn:vim25 QueryResourceConfigOptionResponse,omitempty"` + Res *types.QueryResourceConfigOptionResponse `xml:"QueryResourceConfigOptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9545,7 +10445,7 @@ func QueryResourceConfigOption(ctx context.Context, r soap.RoundTripper, req *ty type QueryServiceListBody struct { Req *types.QueryServiceList `xml:"urn:vim25 QueryServiceList,omitempty"` - Res *types.QueryServiceListResponse `xml:"urn:vim25 QueryServiceListResponse,omitempty"` + Res *types.QueryServiceListResponse `xml:"QueryServiceListResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9565,7 +10465,7 @@ func QueryServiceList(ctx context.Context, r soap.RoundTripper, req *types.Query type QueryStorageArrayTypePolicyOptionsBody struct { Req *types.QueryStorageArrayTypePolicyOptions `xml:"urn:vim25 QueryStorageArrayTypePolicyOptions,omitempty"` - Res *types.QueryStorageArrayTypePolicyOptionsResponse `xml:"urn:vim25 QueryStorageArrayTypePolicyOptionsResponse,omitempty"` + Res *types.QueryStorageArrayTypePolicyOptionsResponse `xml:"QueryStorageArrayTypePolicyOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9585,7 +10485,7 @@ func QueryStorageArrayTypePolicyOptions(ctx context.Context, r soap.RoundTripper type QuerySupportedFeaturesBody struct { Req *types.QuerySupportedFeatures `xml:"urn:vim25 QuerySupportedFeatures,omitempty"` - Res *types.QuerySupportedFeaturesResponse `xml:"urn:vim25 QuerySupportedFeaturesResponse,omitempty"` + Res *types.QuerySupportedFeaturesResponse `xml:"QuerySupportedFeaturesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9605,7 +10505,7 @@ func QuerySupportedFeatures(ctx context.Context, r soap.RoundTripper, req *types type QuerySyncingVsanObjectsBody struct { Req *types.QuerySyncingVsanObjects `xml:"urn:vim25 QuerySyncingVsanObjects,omitempty"` - Res *types.QuerySyncingVsanObjectsResponse `xml:"urn:vim25 QuerySyncingVsanObjectsResponse,omitempty"` + Res *types.QuerySyncingVsanObjectsResponse `xml:"QuerySyncingVsanObjectsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9625,7 +10525,7 @@ func QuerySyncingVsanObjects(ctx context.Context, r soap.RoundTripper, req *type type QuerySystemUsersBody struct { Req *types.QuerySystemUsers `xml:"urn:vim25 QuerySystemUsers,omitempty"` - Res *types.QuerySystemUsersResponse `xml:"urn:vim25 QuerySystemUsersResponse,omitempty"` + Res *types.QuerySystemUsersResponse `xml:"QuerySystemUsersResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9645,7 +10545,7 @@ func QuerySystemUsers(ctx context.Context, r soap.RoundTripper, req *types.Query type QueryTargetCapabilitiesBody struct { Req *types.QueryTargetCapabilities `xml:"urn:vim25 QueryTargetCapabilities,omitempty"` - Res *types.QueryTargetCapabilitiesResponse `xml:"urn:vim25 QueryTargetCapabilitiesResponse,omitempty"` + Res *types.QueryTargetCapabilitiesResponse `xml:"QueryTargetCapabilitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9665,7 +10565,7 @@ func QueryTargetCapabilities(ctx context.Context, r soap.RoundTripper, req *type type QueryTpmAttestationReportBody struct { Req *types.QueryTpmAttestationReport `xml:"urn:vim25 QueryTpmAttestationReport,omitempty"` - Res *types.QueryTpmAttestationReportResponse `xml:"urn:vim25 QueryTpmAttestationReportResponse,omitempty"` + Res *types.QueryTpmAttestationReportResponse `xml:"QueryTpmAttestationReportResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9685,7 +10585,7 @@ func QueryTpmAttestationReport(ctx context.Context, r soap.RoundTripper, req *ty type QueryUnmonitoredHostsBody struct { Req *types.QueryUnmonitoredHosts `xml:"urn:vim25 QueryUnmonitoredHosts,omitempty"` - Res *types.QueryUnmonitoredHostsResponse `xml:"urn:vim25 QueryUnmonitoredHostsResponse,omitempty"` + Res *types.QueryUnmonitoredHostsResponse `xml:"QueryUnmonitoredHostsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9705,7 +10605,7 @@ func QueryUnmonitoredHosts(ctx context.Context, r soap.RoundTripper, req *types. type QueryUnownedFilesBody struct { Req *types.QueryUnownedFiles `xml:"urn:vim25 QueryUnownedFiles,omitempty"` - Res *types.QueryUnownedFilesResponse `xml:"urn:vim25 QueryUnownedFilesResponse,omitempty"` + Res *types.QueryUnownedFilesResponse `xml:"QueryUnownedFilesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9725,7 +10625,7 @@ func QueryUnownedFiles(ctx context.Context, r soap.RoundTripper, req *types.Quer type QueryUnresolvedVmfsVolumeBody struct { Req *types.QueryUnresolvedVmfsVolume `xml:"urn:vim25 QueryUnresolvedVmfsVolume,omitempty"` - Res *types.QueryUnresolvedVmfsVolumeResponse `xml:"urn:vim25 QueryUnresolvedVmfsVolumeResponse,omitempty"` + Res *types.QueryUnresolvedVmfsVolumeResponse `xml:"QueryUnresolvedVmfsVolumeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9745,7 +10645,7 @@ func QueryUnresolvedVmfsVolume(ctx context.Context, r soap.RoundTripper, req *ty type QueryUnresolvedVmfsVolumesBody struct { Req *types.QueryUnresolvedVmfsVolumes `xml:"urn:vim25 QueryUnresolvedVmfsVolumes,omitempty"` - Res *types.QueryUnresolvedVmfsVolumesResponse `xml:"urn:vim25 QueryUnresolvedVmfsVolumesResponse,omitempty"` + Res *types.QueryUnresolvedVmfsVolumesResponse `xml:"QueryUnresolvedVmfsVolumesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9765,7 +10665,7 @@ func QueryUnresolvedVmfsVolumes(ctx context.Context, r soap.RoundTripper, req *t type QueryUsedVlanIdInDvsBody struct { Req *types.QueryUsedVlanIdInDvs `xml:"urn:vim25 QueryUsedVlanIdInDvs,omitempty"` - Res *types.QueryUsedVlanIdInDvsResponse `xml:"urn:vim25 QueryUsedVlanIdInDvsResponse,omitempty"` + Res *types.QueryUsedVlanIdInDvsResponse `xml:"QueryUsedVlanIdInDvsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9785,7 +10685,7 @@ func QueryUsedVlanIdInDvs(ctx context.Context, r soap.RoundTripper, req *types.Q type QueryVMotionCompatibilityBody struct { Req *types.QueryVMotionCompatibility `xml:"urn:vim25 QueryVMotionCompatibility,omitempty"` - Res *types.QueryVMotionCompatibilityResponse `xml:"urn:vim25 QueryVMotionCompatibilityResponse,omitempty"` + Res *types.QueryVMotionCompatibilityResponse `xml:"QueryVMotionCompatibilityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9805,7 +10705,7 @@ func QueryVMotionCompatibility(ctx context.Context, r soap.RoundTripper, req *ty type QueryVMotionCompatibilityEx_TaskBody struct { Req *types.QueryVMotionCompatibilityEx_Task `xml:"urn:vim25 QueryVMotionCompatibilityEx_Task,omitempty"` - Res *types.QueryVMotionCompatibilityEx_TaskResponse `xml:"urn:vim25 QueryVMotionCompatibilityEx_TaskResponse,omitempty"` + Res *types.QueryVMotionCompatibilityEx_TaskResponse `xml:"QueryVMotionCompatibilityEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9825,7 +10725,7 @@ func QueryVMotionCompatibilityEx_Task(ctx context.Context, r soap.RoundTripper, type QueryVirtualDiskFragmentationBody struct { Req *types.QueryVirtualDiskFragmentation `xml:"urn:vim25 QueryVirtualDiskFragmentation,omitempty"` - Res *types.QueryVirtualDiskFragmentationResponse `xml:"urn:vim25 QueryVirtualDiskFragmentationResponse,omitempty"` + Res *types.QueryVirtualDiskFragmentationResponse `xml:"QueryVirtualDiskFragmentationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9845,7 +10745,7 @@ func QueryVirtualDiskFragmentation(ctx context.Context, r soap.RoundTripper, req type QueryVirtualDiskGeometryBody struct { Req *types.QueryVirtualDiskGeometry `xml:"urn:vim25 QueryVirtualDiskGeometry,omitempty"` - Res *types.QueryVirtualDiskGeometryResponse `xml:"urn:vim25 QueryVirtualDiskGeometryResponse,omitempty"` + Res *types.QueryVirtualDiskGeometryResponse `xml:"QueryVirtualDiskGeometryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9865,7 +10765,7 @@ func QueryVirtualDiskGeometry(ctx context.Context, r soap.RoundTripper, req *typ type QueryVirtualDiskUuidBody struct { Req *types.QueryVirtualDiskUuid `xml:"urn:vim25 QueryVirtualDiskUuid,omitempty"` - Res *types.QueryVirtualDiskUuidResponse `xml:"urn:vim25 QueryVirtualDiskUuidResponse,omitempty"` + Res *types.QueryVirtualDiskUuidResponse `xml:"QueryVirtualDiskUuidResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9885,7 +10785,7 @@ func QueryVirtualDiskUuid(ctx context.Context, r soap.RoundTripper, req *types.Q type QueryVmfsConfigOptionBody struct { Req *types.QueryVmfsConfigOption `xml:"urn:vim25 QueryVmfsConfigOption,omitempty"` - Res *types.QueryVmfsConfigOptionResponse `xml:"urn:vim25 QueryVmfsConfigOptionResponse,omitempty"` + Res *types.QueryVmfsConfigOptionResponse `xml:"QueryVmfsConfigOptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9905,7 +10805,7 @@ func QueryVmfsConfigOption(ctx context.Context, r soap.RoundTripper, req *types. type QueryVmfsDatastoreCreateOptionsBody struct { Req *types.QueryVmfsDatastoreCreateOptions `xml:"urn:vim25 QueryVmfsDatastoreCreateOptions,omitempty"` - Res *types.QueryVmfsDatastoreCreateOptionsResponse `xml:"urn:vim25 QueryVmfsDatastoreCreateOptionsResponse,omitempty"` + Res *types.QueryVmfsDatastoreCreateOptionsResponse `xml:"QueryVmfsDatastoreCreateOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9925,7 +10825,7 @@ func QueryVmfsDatastoreCreateOptions(ctx context.Context, r soap.RoundTripper, r type QueryVmfsDatastoreExpandOptionsBody struct { Req *types.QueryVmfsDatastoreExpandOptions `xml:"urn:vim25 QueryVmfsDatastoreExpandOptions,omitempty"` - Res *types.QueryVmfsDatastoreExpandOptionsResponse `xml:"urn:vim25 QueryVmfsDatastoreExpandOptionsResponse,omitempty"` + Res *types.QueryVmfsDatastoreExpandOptionsResponse `xml:"QueryVmfsDatastoreExpandOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9945,7 +10845,7 @@ func QueryVmfsDatastoreExpandOptions(ctx context.Context, r soap.RoundTripper, r type QueryVmfsDatastoreExtendOptionsBody struct { Req *types.QueryVmfsDatastoreExtendOptions `xml:"urn:vim25 QueryVmfsDatastoreExtendOptions,omitempty"` - Res *types.QueryVmfsDatastoreExtendOptionsResponse `xml:"urn:vim25 QueryVmfsDatastoreExtendOptionsResponse,omitempty"` + Res *types.QueryVmfsDatastoreExtendOptionsResponse `xml:"QueryVmfsDatastoreExtendOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9965,7 +10865,7 @@ func QueryVmfsDatastoreExtendOptions(ctx context.Context, r soap.RoundTripper, r type QueryVnicStatusBody struct { Req *types.QueryVnicStatus `xml:"urn:vim25 QueryVnicStatus,omitempty"` - Res *types.QueryVnicStatusResponse `xml:"urn:vim25 QueryVnicStatusResponse,omitempty"` + Res *types.QueryVnicStatusResponse `xml:"QueryVnicStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -9985,7 +10885,7 @@ func QueryVnicStatus(ctx context.Context, r soap.RoundTripper, req *types.QueryV type QueryVsanObjectUuidsByFilterBody struct { Req *types.QueryVsanObjectUuidsByFilter `xml:"urn:vim25 QueryVsanObjectUuidsByFilter,omitempty"` - Res *types.QueryVsanObjectUuidsByFilterResponse `xml:"urn:vim25 QueryVsanObjectUuidsByFilterResponse,omitempty"` + Res *types.QueryVsanObjectUuidsByFilterResponse `xml:"QueryVsanObjectUuidsByFilterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10005,7 +10905,7 @@ func QueryVsanObjectUuidsByFilter(ctx context.Context, r soap.RoundTripper, req type QueryVsanObjectsBody struct { Req *types.QueryVsanObjects `xml:"urn:vim25 QueryVsanObjects,omitempty"` - Res *types.QueryVsanObjectsResponse `xml:"urn:vim25 QueryVsanObjectsResponse,omitempty"` + Res *types.QueryVsanObjectsResponse `xml:"QueryVsanObjectsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10025,7 +10925,7 @@ func QueryVsanObjects(ctx context.Context, r soap.RoundTripper, req *types.Query type QueryVsanStatisticsBody struct { Req *types.QueryVsanStatistics `xml:"urn:vim25 QueryVsanStatistics,omitempty"` - Res *types.QueryVsanStatisticsResponse `xml:"urn:vim25 QueryVsanStatisticsResponse,omitempty"` + Res *types.QueryVsanStatisticsResponse `xml:"QueryVsanStatisticsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10045,7 +10945,7 @@ func QueryVsanStatistics(ctx context.Context, r soap.RoundTripper, req *types.Qu type QueryVsanUpgradeStatusBody struct { Req *types.QueryVsanUpgradeStatus `xml:"urn:vim25 QueryVsanUpgradeStatus,omitempty"` - Res *types.QueryVsanUpgradeStatusResponse `xml:"urn:vim25 QueryVsanUpgradeStatusResponse,omitempty"` + Res *types.QueryVsanUpgradeStatusResponse `xml:"QueryVsanUpgradeStatusResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10065,7 +10965,7 @@ func QueryVsanUpgradeStatus(ctx context.Context, r soap.RoundTripper, req *types type ReadEnvironmentVariableInGuestBody struct { Req *types.ReadEnvironmentVariableInGuest `xml:"urn:vim25 ReadEnvironmentVariableInGuest,omitempty"` - Res *types.ReadEnvironmentVariableInGuestResponse `xml:"urn:vim25 ReadEnvironmentVariableInGuestResponse,omitempty"` + Res *types.ReadEnvironmentVariableInGuestResponse `xml:"ReadEnvironmentVariableInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10085,7 +10985,7 @@ func ReadEnvironmentVariableInGuest(ctx context.Context, r soap.RoundTripper, re type ReadNextEventsBody struct { Req *types.ReadNextEvents `xml:"urn:vim25 ReadNextEvents,omitempty"` - Res *types.ReadNextEventsResponse `xml:"urn:vim25 ReadNextEventsResponse,omitempty"` + Res *types.ReadNextEventsResponse `xml:"ReadNextEventsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10105,7 +11005,7 @@ func ReadNextEvents(ctx context.Context, r soap.RoundTripper, req *types.ReadNex type ReadNextTasksBody struct { Req *types.ReadNextTasks `xml:"urn:vim25 ReadNextTasks,omitempty"` - Res *types.ReadNextTasksResponse `xml:"urn:vim25 ReadNextTasksResponse,omitempty"` + Res *types.ReadNextTasksResponse `xml:"ReadNextTasksResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10125,7 +11025,7 @@ func ReadNextTasks(ctx context.Context, r soap.RoundTripper, req *types.ReadNext type ReadPreviousEventsBody struct { Req *types.ReadPreviousEvents `xml:"urn:vim25 ReadPreviousEvents,omitempty"` - Res *types.ReadPreviousEventsResponse `xml:"urn:vim25 ReadPreviousEventsResponse,omitempty"` + Res *types.ReadPreviousEventsResponse `xml:"ReadPreviousEventsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10145,7 +11045,7 @@ func ReadPreviousEvents(ctx context.Context, r soap.RoundTripper, req *types.Rea type ReadPreviousTasksBody struct { Req *types.ReadPreviousTasks `xml:"urn:vim25 ReadPreviousTasks,omitempty"` - Res *types.ReadPreviousTasksResponse `xml:"urn:vim25 ReadPreviousTasksResponse,omitempty"` + Res *types.ReadPreviousTasksResponse `xml:"ReadPreviousTasksResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10165,7 +11065,7 @@ func ReadPreviousTasks(ctx context.Context, r soap.RoundTripper, req *types.Read type RebootGuestBody struct { Req *types.RebootGuest `xml:"urn:vim25 RebootGuest,omitempty"` - Res *types.RebootGuestResponse `xml:"urn:vim25 RebootGuestResponse,omitempty"` + Res *types.RebootGuestResponse `xml:"RebootGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10185,7 +11085,7 @@ func RebootGuest(ctx context.Context, r soap.RoundTripper, req *types.RebootGues type RebootHost_TaskBody struct { Req *types.RebootHost_Task `xml:"urn:vim25 RebootHost_Task,omitempty"` - Res *types.RebootHost_TaskResponse `xml:"urn:vim25 RebootHost_TaskResponse,omitempty"` + Res *types.RebootHost_TaskResponse `xml:"RebootHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10205,7 +11105,7 @@ func RebootHost_Task(ctx context.Context, r soap.RoundTripper, req *types.Reboot type RecommendDatastoresBody struct { Req *types.RecommendDatastores `xml:"urn:vim25 RecommendDatastores,omitempty"` - Res *types.RecommendDatastoresResponse `xml:"urn:vim25 RecommendDatastoresResponse,omitempty"` + Res *types.RecommendDatastoresResponse `xml:"RecommendDatastoresResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10225,7 +11125,7 @@ func RecommendDatastores(ctx context.Context, r soap.RoundTripper, req *types.Re type RecommendHostsForVmBody struct { Req *types.RecommendHostsForVm `xml:"urn:vim25 RecommendHostsForVm,omitempty"` - Res *types.RecommendHostsForVmResponse `xml:"urn:vim25 RecommendHostsForVmResponse,omitempty"` + Res *types.RecommendHostsForVmResponse `xml:"RecommendHostsForVmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10245,7 +11145,7 @@ func RecommendHostsForVm(ctx context.Context, r soap.RoundTripper, req *types.Re type RecommissionVsanNode_TaskBody struct { Req *types.RecommissionVsanNode_Task `xml:"urn:vim25 RecommissionVsanNode_Task,omitempty"` - Res *types.RecommissionVsanNode_TaskResponse `xml:"urn:vim25 RecommissionVsanNode_TaskResponse,omitempty"` + Res *types.RecommissionVsanNode_TaskResponse `xml:"RecommissionVsanNode_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10265,7 +11165,7 @@ func RecommissionVsanNode_Task(ctx context.Context, r soap.RoundTripper, req *ty type ReconcileDatastoreInventory_TaskBody struct { Req *types.ReconcileDatastoreInventory_Task `xml:"urn:vim25 ReconcileDatastoreInventory_Task,omitempty"` - Res *types.ReconcileDatastoreInventory_TaskResponse `xml:"urn:vim25 ReconcileDatastoreInventory_TaskResponse,omitempty"` + Res *types.ReconcileDatastoreInventory_TaskResponse `xml:"ReconcileDatastoreInventory_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10285,7 +11185,7 @@ func ReconcileDatastoreInventory_Task(ctx context.Context, r soap.RoundTripper, type ReconfigVM_TaskBody struct { Req *types.ReconfigVM_Task `xml:"urn:vim25 ReconfigVM_Task,omitempty"` - Res *types.ReconfigVM_TaskResponse `xml:"urn:vim25 ReconfigVM_TaskResponse,omitempty"` + Res *types.ReconfigVM_TaskResponse `xml:"ReconfigVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10305,7 +11205,7 @@ func ReconfigVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Reconf type ReconfigurationSatisfiableBody struct { Req *types.ReconfigurationSatisfiable `xml:"urn:vim25 ReconfigurationSatisfiable,omitempty"` - Res *types.ReconfigurationSatisfiableResponse `xml:"urn:vim25 ReconfigurationSatisfiableResponse,omitempty"` + Res *types.ReconfigurationSatisfiableResponse `xml:"ReconfigurationSatisfiableResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10325,7 +11225,7 @@ func ReconfigurationSatisfiable(ctx context.Context, r soap.RoundTripper, req *t type ReconfigureAlarmBody struct { Req *types.ReconfigureAlarm `xml:"urn:vim25 ReconfigureAlarm,omitempty"` - Res *types.ReconfigureAlarmResponse `xml:"urn:vim25 ReconfigureAlarmResponse,omitempty"` + Res *types.ReconfigureAlarmResponse `xml:"ReconfigureAlarmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10345,7 +11245,7 @@ func ReconfigureAlarm(ctx context.Context, r soap.RoundTripper, req *types.Recon type ReconfigureAutostartBody struct { Req *types.ReconfigureAutostart `xml:"urn:vim25 ReconfigureAutostart,omitempty"` - Res *types.ReconfigureAutostartResponse `xml:"urn:vim25 ReconfigureAutostartResponse,omitempty"` + Res *types.ReconfigureAutostartResponse `xml:"ReconfigureAutostartResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10365,7 +11265,7 @@ func ReconfigureAutostart(ctx context.Context, r soap.RoundTripper, req *types.R type ReconfigureCluster_TaskBody struct { Req *types.ReconfigureCluster_Task `xml:"urn:vim25 ReconfigureCluster_Task,omitempty"` - Res *types.ReconfigureCluster_TaskResponse `xml:"urn:vim25 ReconfigureCluster_TaskResponse,omitempty"` + Res *types.ReconfigureCluster_TaskResponse `xml:"ReconfigureCluster_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10385,7 +11285,7 @@ func ReconfigureCluster_Task(ctx context.Context, r soap.RoundTripper, req *type type ReconfigureComputeResource_TaskBody struct { Req *types.ReconfigureComputeResource_Task `xml:"urn:vim25 ReconfigureComputeResource_Task,omitempty"` - Res *types.ReconfigureComputeResource_TaskResponse `xml:"urn:vim25 ReconfigureComputeResource_TaskResponse,omitempty"` + Res *types.ReconfigureComputeResource_TaskResponse `xml:"ReconfigureComputeResource_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10405,7 +11305,7 @@ func ReconfigureComputeResource_Task(ctx context.Context, r soap.RoundTripper, r type ReconfigureDVPort_TaskBody struct { Req *types.ReconfigureDVPort_Task `xml:"urn:vim25 ReconfigureDVPort_Task,omitempty"` - Res *types.ReconfigureDVPort_TaskResponse `xml:"urn:vim25 ReconfigureDVPort_TaskResponse,omitempty"` + Res *types.ReconfigureDVPort_TaskResponse `xml:"ReconfigureDVPort_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10425,7 +11325,7 @@ func ReconfigureDVPort_Task(ctx context.Context, r soap.RoundTripper, req *types type ReconfigureDVPortgroup_TaskBody struct { Req *types.ReconfigureDVPortgroup_Task `xml:"urn:vim25 ReconfigureDVPortgroup_Task,omitempty"` - Res *types.ReconfigureDVPortgroup_TaskResponse `xml:"urn:vim25 ReconfigureDVPortgroup_TaskResponse,omitempty"` + Res *types.ReconfigureDVPortgroup_TaskResponse `xml:"ReconfigureDVPortgroup_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10445,7 +11345,7 @@ func ReconfigureDVPortgroup_Task(ctx context.Context, r soap.RoundTripper, req * type ReconfigureDatacenter_TaskBody struct { Req *types.ReconfigureDatacenter_Task `xml:"urn:vim25 ReconfigureDatacenter_Task,omitempty"` - Res *types.ReconfigureDatacenter_TaskResponse `xml:"urn:vim25 ReconfigureDatacenter_TaskResponse,omitempty"` + Res *types.ReconfigureDatacenter_TaskResponse `xml:"ReconfigureDatacenter_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10465,7 +11365,7 @@ func ReconfigureDatacenter_Task(ctx context.Context, r soap.RoundTripper, req *t type ReconfigureDomObjectBody struct { Req *types.ReconfigureDomObject `xml:"urn:vim25 ReconfigureDomObject,omitempty"` - Res *types.ReconfigureDomObjectResponse `xml:"urn:vim25 ReconfigureDomObjectResponse,omitempty"` + Res *types.ReconfigureDomObjectResponse `xml:"ReconfigureDomObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10485,7 +11385,7 @@ func ReconfigureDomObject(ctx context.Context, r soap.RoundTripper, req *types.R type ReconfigureDvs_TaskBody struct { Req *types.ReconfigureDvs_Task `xml:"urn:vim25 ReconfigureDvs_Task,omitempty"` - Res *types.ReconfigureDvs_TaskResponse `xml:"urn:vim25 ReconfigureDvs_TaskResponse,omitempty"` + Res *types.ReconfigureDvs_TaskResponse `xml:"ReconfigureDvs_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10505,7 +11405,7 @@ func ReconfigureDvs_Task(ctx context.Context, r soap.RoundTripper, req *types.Re type ReconfigureHostForDAS_TaskBody struct { Req *types.ReconfigureHostForDAS_Task `xml:"urn:vim25 ReconfigureHostForDAS_Task,omitempty"` - Res *types.ReconfigureHostForDAS_TaskResponse `xml:"urn:vim25 ReconfigureHostForDAS_TaskResponse,omitempty"` + Res *types.ReconfigureHostForDAS_TaskResponse `xml:"ReconfigureHostForDAS_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10525,7 +11425,7 @@ func ReconfigureHostForDAS_Task(ctx context.Context, r soap.RoundTripper, req *t type ReconfigureScheduledTaskBody struct { Req *types.ReconfigureScheduledTask `xml:"urn:vim25 ReconfigureScheduledTask,omitempty"` - Res *types.ReconfigureScheduledTaskResponse `xml:"urn:vim25 ReconfigureScheduledTaskResponse,omitempty"` + Res *types.ReconfigureScheduledTaskResponse `xml:"ReconfigureScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10545,7 +11445,7 @@ func ReconfigureScheduledTask(ctx context.Context, r soap.RoundTripper, req *typ type ReconfigureServiceConsoleReservationBody struct { Req *types.ReconfigureServiceConsoleReservation `xml:"urn:vim25 ReconfigureServiceConsoleReservation,omitempty"` - Res *types.ReconfigureServiceConsoleReservationResponse `xml:"urn:vim25 ReconfigureServiceConsoleReservationResponse,omitempty"` + Res *types.ReconfigureServiceConsoleReservationResponse `xml:"ReconfigureServiceConsoleReservationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10565,7 +11465,7 @@ func ReconfigureServiceConsoleReservation(ctx context.Context, r soap.RoundTripp type ReconfigureSnmpAgentBody struct { Req *types.ReconfigureSnmpAgent `xml:"urn:vim25 ReconfigureSnmpAgent,omitempty"` - Res *types.ReconfigureSnmpAgentResponse `xml:"urn:vim25 ReconfigureSnmpAgentResponse,omitempty"` + Res *types.ReconfigureSnmpAgentResponse `xml:"ReconfigureSnmpAgentResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10585,7 +11485,7 @@ func ReconfigureSnmpAgent(ctx context.Context, r soap.RoundTripper, req *types.R type ReconfigureVirtualMachineReservationBody struct { Req *types.ReconfigureVirtualMachineReservation `xml:"urn:vim25 ReconfigureVirtualMachineReservation,omitempty"` - Res *types.ReconfigureVirtualMachineReservationResponse `xml:"urn:vim25 ReconfigureVirtualMachineReservationResponse,omitempty"` + Res *types.ReconfigureVirtualMachineReservationResponse `xml:"ReconfigureVirtualMachineReservationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10605,7 +11505,7 @@ func ReconfigureVirtualMachineReservation(ctx context.Context, r soap.RoundTripp type ReconnectHost_TaskBody struct { Req *types.ReconnectHost_Task `xml:"urn:vim25 ReconnectHost_Task,omitempty"` - Res *types.ReconnectHost_TaskResponse `xml:"urn:vim25 ReconnectHost_TaskResponse,omitempty"` + Res *types.ReconnectHost_TaskResponse `xml:"ReconnectHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10625,7 +11525,7 @@ func ReconnectHost_Task(ctx context.Context, r soap.RoundTripper, req *types.Rec type RectifyDvsHost_TaskBody struct { Req *types.RectifyDvsHost_Task `xml:"urn:vim25 RectifyDvsHost_Task,omitempty"` - Res *types.RectifyDvsHost_TaskResponse `xml:"urn:vim25 RectifyDvsHost_TaskResponse,omitempty"` + Res *types.RectifyDvsHost_TaskResponse `xml:"RectifyDvsHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10645,7 +11545,7 @@ func RectifyDvsHost_Task(ctx context.Context, r soap.RoundTripper, req *types.Re type RectifyDvsOnHost_TaskBody struct { Req *types.RectifyDvsOnHost_Task `xml:"urn:vim25 RectifyDvsOnHost_Task,omitempty"` - Res *types.RectifyDvsOnHost_TaskResponse `xml:"urn:vim25 RectifyDvsOnHost_TaskResponse,omitempty"` + Res *types.RectifyDvsOnHost_TaskResponse `xml:"RectifyDvsOnHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10665,7 +11565,7 @@ func RectifyDvsOnHost_Task(ctx context.Context, r soap.RoundTripper, req *types. type RefreshBody struct { Req *types.Refresh `xml:"urn:vim25 Refresh,omitempty"` - Res *types.RefreshResponse `xml:"urn:vim25 RefreshResponse,omitempty"` + Res *types.RefreshResponse `xml:"RefreshResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10685,7 +11585,7 @@ func Refresh(ctx context.Context, r soap.RoundTripper, req *types.Refresh) (*typ type RefreshDVPortStateBody struct { Req *types.RefreshDVPortState `xml:"urn:vim25 RefreshDVPortState,omitempty"` - Res *types.RefreshDVPortStateResponse `xml:"urn:vim25 RefreshDVPortStateResponse,omitempty"` + Res *types.RefreshDVPortStateResponse `xml:"RefreshDVPortStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10705,7 +11605,7 @@ func RefreshDVPortState(ctx context.Context, r soap.RoundTripper, req *types.Ref type RefreshDatastoreBody struct { Req *types.RefreshDatastore `xml:"urn:vim25 RefreshDatastore,omitempty"` - Res *types.RefreshDatastoreResponse `xml:"urn:vim25 RefreshDatastoreResponse,omitempty"` + Res *types.RefreshDatastoreResponse `xml:"RefreshDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10725,7 +11625,7 @@ func RefreshDatastore(ctx context.Context, r soap.RoundTripper, req *types.Refre type RefreshDatastoreStorageInfoBody struct { Req *types.RefreshDatastoreStorageInfo `xml:"urn:vim25 RefreshDatastoreStorageInfo,omitempty"` - Res *types.RefreshDatastoreStorageInfoResponse `xml:"urn:vim25 RefreshDatastoreStorageInfoResponse,omitempty"` + Res *types.RefreshDatastoreStorageInfoResponse `xml:"RefreshDatastoreStorageInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10745,7 +11645,7 @@ func RefreshDatastoreStorageInfo(ctx context.Context, r soap.RoundTripper, req * type RefreshDateTimeSystemBody struct { Req *types.RefreshDateTimeSystem `xml:"urn:vim25 RefreshDateTimeSystem,omitempty"` - Res *types.RefreshDateTimeSystemResponse `xml:"urn:vim25 RefreshDateTimeSystemResponse,omitempty"` + Res *types.RefreshDateTimeSystemResponse `xml:"RefreshDateTimeSystemResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10765,7 +11665,7 @@ func RefreshDateTimeSystem(ctx context.Context, r soap.RoundTripper, req *types. type RefreshFirewallBody struct { Req *types.RefreshFirewall `xml:"urn:vim25 RefreshFirewall,omitempty"` - Res *types.RefreshFirewallResponse `xml:"urn:vim25 RefreshFirewallResponse,omitempty"` + Res *types.RefreshFirewallResponse `xml:"RefreshFirewallResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10785,7 +11685,7 @@ func RefreshFirewall(ctx context.Context, r soap.RoundTripper, req *types.Refres type RefreshGraphicsManagerBody struct { Req *types.RefreshGraphicsManager `xml:"urn:vim25 RefreshGraphicsManager,omitempty"` - Res *types.RefreshGraphicsManagerResponse `xml:"urn:vim25 RefreshGraphicsManagerResponse,omitempty"` + Res *types.RefreshGraphicsManagerResponse `xml:"RefreshGraphicsManagerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10805,7 +11705,7 @@ func RefreshGraphicsManager(ctx context.Context, r soap.RoundTripper, req *types type RefreshHealthStatusSystemBody struct { Req *types.RefreshHealthStatusSystem `xml:"urn:vim25 RefreshHealthStatusSystem,omitempty"` - Res *types.RefreshHealthStatusSystemResponse `xml:"urn:vim25 RefreshHealthStatusSystemResponse,omitempty"` + Res *types.RefreshHealthStatusSystemResponse `xml:"RefreshHealthStatusSystemResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10825,7 +11725,7 @@ func RefreshHealthStatusSystem(ctx context.Context, r soap.RoundTripper, req *ty type RefreshNetworkSystemBody struct { Req *types.RefreshNetworkSystem `xml:"urn:vim25 RefreshNetworkSystem,omitempty"` - Res *types.RefreshNetworkSystemResponse `xml:"urn:vim25 RefreshNetworkSystemResponse,omitempty"` + Res *types.RefreshNetworkSystemResponse `xml:"RefreshNetworkSystemResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10845,7 +11745,7 @@ func RefreshNetworkSystem(ctx context.Context, r soap.RoundTripper, req *types.R type RefreshRecommendationBody struct { Req *types.RefreshRecommendation `xml:"urn:vim25 RefreshRecommendation,omitempty"` - Res *types.RefreshRecommendationResponse `xml:"urn:vim25 RefreshRecommendationResponse,omitempty"` + Res *types.RefreshRecommendationResponse `xml:"RefreshRecommendationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10865,7 +11765,7 @@ func RefreshRecommendation(ctx context.Context, r soap.RoundTripper, req *types. type RefreshRuntimeBody struct { Req *types.RefreshRuntime `xml:"urn:vim25 RefreshRuntime,omitempty"` - Res *types.RefreshRuntimeResponse `xml:"urn:vim25 RefreshRuntimeResponse,omitempty"` + Res *types.RefreshRuntimeResponse `xml:"RefreshRuntimeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10885,7 +11785,7 @@ func RefreshRuntime(ctx context.Context, r soap.RoundTripper, req *types.Refresh type RefreshServicesBody struct { Req *types.RefreshServices `xml:"urn:vim25 RefreshServices,omitempty"` - Res *types.RefreshServicesResponse `xml:"urn:vim25 RefreshServicesResponse,omitempty"` + Res *types.RefreshServicesResponse `xml:"RefreshServicesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10905,7 +11805,7 @@ func RefreshServices(ctx context.Context, r soap.RoundTripper, req *types.Refres type RefreshStorageDrsRecommendationBody struct { Req *types.RefreshStorageDrsRecommendation `xml:"urn:vim25 RefreshStorageDrsRecommendation,omitempty"` - Res *types.RefreshStorageDrsRecommendationResponse `xml:"urn:vim25 RefreshStorageDrsRecommendationResponse,omitempty"` + Res *types.RefreshStorageDrsRecommendationResponse `xml:"RefreshStorageDrsRecommendationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10923,9 +11823,29 @@ func RefreshStorageDrsRecommendation(ctx context.Context, r soap.RoundTripper, r return resBody.Res, nil } +type RefreshStorageDrsRecommendationsForPod_TaskBody struct { + Req *types.RefreshStorageDrsRecommendationsForPod_Task `xml:"urn:vim25 RefreshStorageDrsRecommendationsForPod_Task,omitempty"` + Res *types.RefreshStorageDrsRecommendationsForPod_TaskResponse `xml:"RefreshStorageDrsRecommendationsForPod_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *RefreshStorageDrsRecommendationsForPod_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func RefreshStorageDrsRecommendationsForPod_Task(ctx context.Context, r soap.RoundTripper, req *types.RefreshStorageDrsRecommendationsForPod_Task) (*types.RefreshStorageDrsRecommendationsForPod_TaskResponse, error) { + var reqBody, resBody RefreshStorageDrsRecommendationsForPod_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type RefreshStorageInfoBody struct { Req *types.RefreshStorageInfo `xml:"urn:vim25 RefreshStorageInfo,omitempty"` - Res *types.RefreshStorageInfoResponse `xml:"urn:vim25 RefreshStorageInfoResponse,omitempty"` + Res *types.RefreshStorageInfoResponse `xml:"RefreshStorageInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10945,7 +11865,7 @@ func RefreshStorageInfo(ctx context.Context, r soap.RoundTripper, req *types.Ref type RefreshStorageSystemBody struct { Req *types.RefreshStorageSystem `xml:"urn:vim25 RefreshStorageSystem,omitempty"` - Res *types.RefreshStorageSystemResponse `xml:"urn:vim25 RefreshStorageSystemResponse,omitempty"` + Res *types.RefreshStorageSystemResponse `xml:"RefreshStorageSystemResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10965,7 +11885,7 @@ func RefreshStorageSystem(ctx context.Context, r soap.RoundTripper, req *types.R type RegisterChildVM_TaskBody struct { Req *types.RegisterChildVM_Task `xml:"urn:vim25 RegisterChildVM_Task,omitempty"` - Res *types.RegisterChildVM_TaskResponse `xml:"urn:vim25 RegisterChildVM_TaskResponse,omitempty"` + Res *types.RegisterChildVM_TaskResponse `xml:"RegisterChildVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -10985,7 +11905,7 @@ func RegisterChildVM_Task(ctx context.Context, r soap.RoundTripper, req *types.R type RegisterDiskBody struct { Req *types.RegisterDisk `xml:"urn:vim25 RegisterDisk,omitempty"` - Res *types.RegisterDiskResponse `xml:"urn:vim25 RegisterDiskResponse,omitempty"` + Res *types.RegisterDiskResponse `xml:"RegisterDiskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11005,7 +11925,7 @@ func RegisterDisk(ctx context.Context, r soap.RoundTripper, req *types.RegisterD type RegisterExtensionBody struct { Req *types.RegisterExtension `xml:"urn:vim25 RegisterExtension,omitempty"` - Res *types.RegisterExtensionResponse `xml:"urn:vim25 RegisterExtensionResponse,omitempty"` + Res *types.RegisterExtensionResponse `xml:"RegisterExtensionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11025,7 +11945,7 @@ func RegisterExtension(ctx context.Context, r soap.RoundTripper, req *types.Regi type RegisterHealthUpdateProviderBody struct { Req *types.RegisterHealthUpdateProvider `xml:"urn:vim25 RegisterHealthUpdateProvider,omitempty"` - Res *types.RegisterHealthUpdateProviderResponse `xml:"urn:vim25 RegisterHealthUpdateProviderResponse,omitempty"` + Res *types.RegisterHealthUpdateProviderResponse `xml:"RegisterHealthUpdateProviderResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11045,7 +11965,7 @@ func RegisterHealthUpdateProvider(ctx context.Context, r soap.RoundTripper, req type RegisterKmipServerBody struct { Req *types.RegisterKmipServer `xml:"urn:vim25 RegisterKmipServer,omitempty"` - Res *types.RegisterKmipServerResponse `xml:"urn:vim25 RegisterKmipServerResponse,omitempty"` + Res *types.RegisterKmipServerResponse `xml:"RegisterKmipServerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11065,7 +11985,7 @@ func RegisterKmipServer(ctx context.Context, r soap.RoundTripper, req *types.Reg type RegisterVM_TaskBody struct { Req *types.RegisterVM_Task `xml:"urn:vim25 RegisterVM_Task,omitempty"` - Res *types.RegisterVM_TaskResponse `xml:"urn:vim25 RegisterVM_TaskResponse,omitempty"` + Res *types.RegisterVM_TaskResponse `xml:"RegisterVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11085,7 +12005,7 @@ func RegisterVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Regist type ReleaseCredentialsInGuestBody struct { Req *types.ReleaseCredentialsInGuest `xml:"urn:vim25 ReleaseCredentialsInGuest,omitempty"` - Res *types.ReleaseCredentialsInGuestResponse `xml:"urn:vim25 ReleaseCredentialsInGuestResponse,omitempty"` + Res *types.ReleaseCredentialsInGuestResponse `xml:"ReleaseCredentialsInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11105,7 +12025,7 @@ func ReleaseCredentialsInGuest(ctx context.Context, r soap.RoundTripper, req *ty type ReleaseIpAllocationBody struct { Req *types.ReleaseIpAllocation `xml:"urn:vim25 ReleaseIpAllocation,omitempty"` - Res *types.ReleaseIpAllocationResponse `xml:"urn:vim25 ReleaseIpAllocationResponse,omitempty"` + Res *types.ReleaseIpAllocationResponse `xml:"ReleaseIpAllocationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11125,7 +12045,7 @@ func ReleaseIpAllocation(ctx context.Context, r soap.RoundTripper, req *types.Re type ReleaseManagedSnapshotBody struct { Req *types.ReleaseManagedSnapshot `xml:"urn:vim25 ReleaseManagedSnapshot,omitempty"` - Res *types.ReleaseManagedSnapshotResponse `xml:"urn:vim25 ReleaseManagedSnapshotResponse,omitempty"` + Res *types.ReleaseManagedSnapshotResponse `xml:"ReleaseManagedSnapshotResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11145,7 +12065,7 @@ func ReleaseManagedSnapshot(ctx context.Context, r soap.RoundTripper, req *types type ReloadBody struct { Req *types.Reload `xml:"urn:vim25 Reload,omitempty"` - Res *types.ReloadResponse `xml:"urn:vim25 ReloadResponse,omitempty"` + Res *types.ReloadResponse `xml:"ReloadResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11165,7 +12085,7 @@ func Reload(ctx context.Context, r soap.RoundTripper, req *types.Reload) (*types type RelocateVM_TaskBody struct { Req *types.RelocateVM_Task `xml:"urn:vim25 RelocateVM_Task,omitempty"` - Res *types.RelocateVM_TaskResponse `xml:"urn:vim25 RelocateVM_TaskResponse,omitempty"` + Res *types.RelocateVM_TaskResponse `xml:"RelocateVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11185,7 +12105,7 @@ func RelocateVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Reloca type RelocateVStorageObject_TaskBody struct { Req *types.RelocateVStorageObject_Task `xml:"urn:vim25 RelocateVStorageObject_Task,omitempty"` - Res *types.RelocateVStorageObject_TaskResponse `xml:"urn:vim25 RelocateVStorageObject_TaskResponse,omitempty"` + Res *types.RelocateVStorageObject_TaskResponse `xml:"RelocateVStorageObject_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11205,7 +12125,7 @@ func RelocateVStorageObject_Task(ctx context.Context, r soap.RoundTripper, req * type RemoveAlarmBody struct { Req *types.RemoveAlarm `xml:"urn:vim25 RemoveAlarm,omitempty"` - Res *types.RemoveAlarmResponse `xml:"urn:vim25 RemoveAlarmResponse,omitempty"` + Res *types.RemoveAlarmResponse `xml:"RemoveAlarmResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11225,7 +12145,7 @@ func RemoveAlarm(ctx context.Context, r soap.RoundTripper, req *types.RemoveAlar type RemoveAllSnapshots_TaskBody struct { Req *types.RemoveAllSnapshots_Task `xml:"urn:vim25 RemoveAllSnapshots_Task,omitempty"` - Res *types.RemoveAllSnapshots_TaskResponse `xml:"urn:vim25 RemoveAllSnapshots_TaskResponse,omitempty"` + Res *types.RemoveAllSnapshots_TaskResponse `xml:"RemoveAllSnapshots_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11245,7 +12165,7 @@ func RemoveAllSnapshots_Task(ctx context.Context, r soap.RoundTripper, req *type type RemoveAssignedLicenseBody struct { Req *types.RemoveAssignedLicense `xml:"urn:vim25 RemoveAssignedLicense,omitempty"` - Res *types.RemoveAssignedLicenseResponse `xml:"urn:vim25 RemoveAssignedLicenseResponse,omitempty"` + Res *types.RemoveAssignedLicenseResponse `xml:"RemoveAssignedLicenseResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11265,7 +12185,7 @@ func RemoveAssignedLicense(ctx context.Context, r soap.RoundTripper, req *types. type RemoveAuthorizationRoleBody struct { Req *types.RemoveAuthorizationRole `xml:"urn:vim25 RemoveAuthorizationRole,omitempty"` - Res *types.RemoveAuthorizationRoleResponse `xml:"urn:vim25 RemoveAuthorizationRoleResponse,omitempty"` + Res *types.RemoveAuthorizationRoleResponse `xml:"RemoveAuthorizationRoleResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11285,7 +12205,7 @@ func RemoveAuthorizationRole(ctx context.Context, r soap.RoundTripper, req *type type RemoveCustomFieldDefBody struct { Req *types.RemoveCustomFieldDef `xml:"urn:vim25 RemoveCustomFieldDef,omitempty"` - Res *types.RemoveCustomFieldDefResponse `xml:"urn:vim25 RemoveCustomFieldDefResponse,omitempty"` + Res *types.RemoveCustomFieldDefResponse `xml:"RemoveCustomFieldDefResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11305,7 +12225,7 @@ func RemoveCustomFieldDef(ctx context.Context, r soap.RoundTripper, req *types.R type RemoveDatastoreBody struct { Req *types.RemoveDatastore `xml:"urn:vim25 RemoveDatastore,omitempty"` - Res *types.RemoveDatastoreResponse `xml:"urn:vim25 RemoveDatastoreResponse,omitempty"` + Res *types.RemoveDatastoreResponse `xml:"RemoveDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11325,7 +12245,7 @@ func RemoveDatastore(ctx context.Context, r soap.RoundTripper, req *types.Remove type RemoveDatastoreEx_TaskBody struct { Req *types.RemoveDatastoreEx_Task `xml:"urn:vim25 RemoveDatastoreEx_Task,omitempty"` - Res *types.RemoveDatastoreEx_TaskResponse `xml:"urn:vim25 RemoveDatastoreEx_TaskResponse,omitempty"` + Res *types.RemoveDatastoreEx_TaskResponse `xml:"RemoveDatastoreEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11345,7 +12265,7 @@ func RemoveDatastoreEx_Task(ctx context.Context, r soap.RoundTripper, req *types type RemoveDiskMapping_TaskBody struct { Req *types.RemoveDiskMapping_Task `xml:"urn:vim25 RemoveDiskMapping_Task,omitempty"` - Res *types.RemoveDiskMapping_TaskResponse `xml:"urn:vim25 RemoveDiskMapping_TaskResponse,omitempty"` + Res *types.RemoveDiskMapping_TaskResponse `xml:"RemoveDiskMapping_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11365,7 +12285,7 @@ func RemoveDiskMapping_Task(ctx context.Context, r soap.RoundTripper, req *types type RemoveDisk_TaskBody struct { Req *types.RemoveDisk_Task `xml:"urn:vim25 RemoveDisk_Task,omitempty"` - Res *types.RemoveDisk_TaskResponse `xml:"urn:vim25 RemoveDisk_TaskResponse,omitempty"` + Res *types.RemoveDisk_TaskResponse `xml:"RemoveDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11385,7 +12305,7 @@ func RemoveDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.Remove type RemoveEntityPermissionBody struct { Req *types.RemoveEntityPermission `xml:"urn:vim25 RemoveEntityPermission,omitempty"` - Res *types.RemoveEntityPermissionResponse `xml:"urn:vim25 RemoveEntityPermissionResponse,omitempty"` + Res *types.RemoveEntityPermissionResponse `xml:"RemoveEntityPermissionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11405,7 +12325,7 @@ func RemoveEntityPermission(ctx context.Context, r soap.RoundTripper, req *types type RemoveFilterBody struct { Req *types.RemoveFilter `xml:"urn:vim25 RemoveFilter,omitempty"` - Res *types.RemoveFilterResponse `xml:"urn:vim25 RemoveFilterResponse,omitempty"` + Res *types.RemoveFilterResponse `xml:"RemoveFilterResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11425,7 +12345,7 @@ func RemoveFilter(ctx context.Context, r soap.RoundTripper, req *types.RemoveFil type RemoveFilterEntitiesBody struct { Req *types.RemoveFilterEntities `xml:"urn:vim25 RemoveFilterEntities,omitempty"` - Res *types.RemoveFilterEntitiesResponse `xml:"urn:vim25 RemoveFilterEntitiesResponse,omitempty"` + Res *types.RemoveFilterEntitiesResponse `xml:"RemoveFilterEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11445,7 +12365,7 @@ func RemoveFilterEntities(ctx context.Context, r soap.RoundTripper, req *types.R type RemoveGroupBody struct { Req *types.RemoveGroup `xml:"urn:vim25 RemoveGroup,omitempty"` - Res *types.RemoveGroupResponse `xml:"urn:vim25 RemoveGroupResponse,omitempty"` + Res *types.RemoveGroupResponse `xml:"RemoveGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11465,7 +12385,7 @@ func RemoveGroup(ctx context.Context, r soap.RoundTripper, req *types.RemoveGrou type RemoveGuestAliasBody struct { Req *types.RemoveGuestAlias `xml:"urn:vim25 RemoveGuestAlias,omitempty"` - Res *types.RemoveGuestAliasResponse `xml:"urn:vim25 RemoveGuestAliasResponse,omitempty"` + Res *types.RemoveGuestAliasResponse `xml:"RemoveGuestAliasResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11485,7 +12405,7 @@ func RemoveGuestAlias(ctx context.Context, r soap.RoundTripper, req *types.Remov type RemoveGuestAliasByCertBody struct { Req *types.RemoveGuestAliasByCert `xml:"urn:vim25 RemoveGuestAliasByCert,omitempty"` - Res *types.RemoveGuestAliasByCertResponse `xml:"urn:vim25 RemoveGuestAliasByCertResponse,omitempty"` + Res *types.RemoveGuestAliasByCertResponse `xml:"RemoveGuestAliasByCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11505,7 +12425,7 @@ func RemoveGuestAliasByCert(ctx context.Context, r soap.RoundTripper, req *types type RemoveInternetScsiSendTargetsBody struct { Req *types.RemoveInternetScsiSendTargets `xml:"urn:vim25 RemoveInternetScsiSendTargets,omitempty"` - Res *types.RemoveInternetScsiSendTargetsResponse `xml:"urn:vim25 RemoveInternetScsiSendTargetsResponse,omitempty"` + Res *types.RemoveInternetScsiSendTargetsResponse `xml:"RemoveInternetScsiSendTargetsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11525,7 +12445,7 @@ func RemoveInternetScsiSendTargets(ctx context.Context, r soap.RoundTripper, req type RemoveInternetScsiStaticTargetsBody struct { Req *types.RemoveInternetScsiStaticTargets `xml:"urn:vim25 RemoveInternetScsiStaticTargets,omitempty"` - Res *types.RemoveInternetScsiStaticTargetsResponse `xml:"urn:vim25 RemoveInternetScsiStaticTargetsResponse,omitempty"` + Res *types.RemoveInternetScsiStaticTargetsResponse `xml:"RemoveInternetScsiStaticTargetsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11545,7 +12465,7 @@ func RemoveInternetScsiStaticTargets(ctx context.Context, r soap.RoundTripper, r type RemoveKeyBody struct { Req *types.RemoveKey `xml:"urn:vim25 RemoveKey,omitempty"` - Res *types.RemoveKeyResponse `xml:"urn:vim25 RemoveKeyResponse,omitempty"` + Res *types.RemoveKeyResponse `xml:"RemoveKeyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11565,7 +12485,7 @@ func RemoveKey(ctx context.Context, r soap.RoundTripper, req *types.RemoveKey) ( type RemoveKeysBody struct { Req *types.RemoveKeys `xml:"urn:vim25 RemoveKeys,omitempty"` - Res *types.RemoveKeysResponse `xml:"urn:vim25 RemoveKeysResponse,omitempty"` + Res *types.RemoveKeysResponse `xml:"RemoveKeysResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11585,7 +12505,7 @@ func RemoveKeys(ctx context.Context, r soap.RoundTripper, req *types.RemoveKeys) type RemoveKmipServerBody struct { Req *types.RemoveKmipServer `xml:"urn:vim25 RemoveKmipServer,omitempty"` - Res *types.RemoveKmipServerResponse `xml:"urn:vim25 RemoveKmipServerResponse,omitempty"` + Res *types.RemoveKmipServerResponse `xml:"RemoveKmipServerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11605,7 +12525,7 @@ func RemoveKmipServer(ctx context.Context, r soap.RoundTripper, req *types.Remov type RemoveLicenseBody struct { Req *types.RemoveLicense `xml:"urn:vim25 RemoveLicense,omitempty"` - Res *types.RemoveLicenseResponse `xml:"urn:vim25 RemoveLicenseResponse,omitempty"` + Res *types.RemoveLicenseResponse `xml:"RemoveLicenseResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11625,7 +12545,7 @@ func RemoveLicense(ctx context.Context, r soap.RoundTripper, req *types.RemoveLi type RemoveLicenseLabelBody struct { Req *types.RemoveLicenseLabel `xml:"urn:vim25 RemoveLicenseLabel,omitempty"` - Res *types.RemoveLicenseLabelResponse `xml:"urn:vim25 RemoveLicenseLabelResponse,omitempty"` + Res *types.RemoveLicenseLabelResponse `xml:"RemoveLicenseLabelResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11645,7 +12565,7 @@ func RemoveLicenseLabel(ctx context.Context, r soap.RoundTripper, req *types.Rem type RemoveMonitoredEntitiesBody struct { Req *types.RemoveMonitoredEntities `xml:"urn:vim25 RemoveMonitoredEntities,omitempty"` - Res *types.RemoveMonitoredEntitiesResponse `xml:"urn:vim25 RemoveMonitoredEntitiesResponse,omitempty"` + Res *types.RemoveMonitoredEntitiesResponse `xml:"RemoveMonitoredEntitiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11665,7 +12585,7 @@ func RemoveMonitoredEntities(ctx context.Context, r soap.RoundTripper, req *type type RemoveNetworkResourcePoolBody struct { Req *types.RemoveNetworkResourcePool `xml:"urn:vim25 RemoveNetworkResourcePool,omitempty"` - Res *types.RemoveNetworkResourcePoolResponse `xml:"urn:vim25 RemoveNetworkResourcePoolResponse,omitempty"` + Res *types.RemoveNetworkResourcePoolResponse `xml:"RemoveNetworkResourcePoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11685,7 +12605,7 @@ func RemoveNetworkResourcePool(ctx context.Context, r soap.RoundTripper, req *ty type RemovePerfIntervalBody struct { Req *types.RemovePerfInterval `xml:"urn:vim25 RemovePerfInterval,omitempty"` - Res *types.RemovePerfIntervalResponse `xml:"urn:vim25 RemovePerfIntervalResponse,omitempty"` + Res *types.RemovePerfIntervalResponse `xml:"RemovePerfIntervalResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11705,7 +12625,7 @@ func RemovePerfInterval(ctx context.Context, r soap.RoundTripper, req *types.Rem type RemovePortGroupBody struct { Req *types.RemovePortGroup `xml:"urn:vim25 RemovePortGroup,omitempty"` - Res *types.RemovePortGroupResponse `xml:"urn:vim25 RemovePortGroupResponse,omitempty"` + Res *types.RemovePortGroupResponse `xml:"RemovePortGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11725,7 +12645,7 @@ func RemovePortGroup(ctx context.Context, r soap.RoundTripper, req *types.Remove type RemoveScheduledTaskBody struct { Req *types.RemoveScheduledTask `xml:"urn:vim25 RemoveScheduledTask,omitempty"` - Res *types.RemoveScheduledTaskResponse `xml:"urn:vim25 RemoveScheduledTaskResponse,omitempty"` + Res *types.RemoveScheduledTaskResponse `xml:"RemoveScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11745,7 +12665,7 @@ func RemoveScheduledTask(ctx context.Context, r soap.RoundTripper, req *types.Re type RemoveServiceConsoleVirtualNicBody struct { Req *types.RemoveServiceConsoleVirtualNic `xml:"urn:vim25 RemoveServiceConsoleVirtualNic,omitempty"` - Res *types.RemoveServiceConsoleVirtualNicResponse `xml:"urn:vim25 RemoveServiceConsoleVirtualNicResponse,omitempty"` + Res *types.RemoveServiceConsoleVirtualNicResponse `xml:"RemoveServiceConsoleVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11765,7 +12685,7 @@ func RemoveServiceConsoleVirtualNic(ctx context.Context, r soap.RoundTripper, re type RemoveSmartCardTrustAnchorBody struct { Req *types.RemoveSmartCardTrustAnchor `xml:"urn:vim25 RemoveSmartCardTrustAnchor,omitempty"` - Res *types.RemoveSmartCardTrustAnchorResponse `xml:"urn:vim25 RemoveSmartCardTrustAnchorResponse,omitempty"` + Res *types.RemoveSmartCardTrustAnchorResponse `xml:"RemoveSmartCardTrustAnchorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11785,7 +12705,7 @@ func RemoveSmartCardTrustAnchor(ctx context.Context, r soap.RoundTripper, req *t type RemoveSmartCardTrustAnchorByFingerprintBody struct { Req *types.RemoveSmartCardTrustAnchorByFingerprint `xml:"urn:vim25 RemoveSmartCardTrustAnchorByFingerprint,omitempty"` - Res *types.RemoveSmartCardTrustAnchorByFingerprintResponse `xml:"urn:vim25 RemoveSmartCardTrustAnchorByFingerprintResponse,omitempty"` + Res *types.RemoveSmartCardTrustAnchorByFingerprintResponse `xml:"RemoveSmartCardTrustAnchorByFingerprintResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11805,7 +12725,7 @@ func RemoveSmartCardTrustAnchorByFingerprint(ctx context.Context, r soap.RoundTr type RemoveSnapshot_TaskBody struct { Req *types.RemoveSnapshot_Task `xml:"urn:vim25 RemoveSnapshot_Task,omitempty"` - Res *types.RemoveSnapshot_TaskResponse `xml:"urn:vim25 RemoveSnapshot_TaskResponse,omitempty"` + Res *types.RemoveSnapshot_TaskResponse `xml:"RemoveSnapshot_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11825,7 +12745,7 @@ func RemoveSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.Re type RemoveUserBody struct { Req *types.RemoveUser `xml:"urn:vim25 RemoveUser,omitempty"` - Res *types.RemoveUserResponse `xml:"urn:vim25 RemoveUserResponse,omitempty"` + Res *types.RemoveUserResponse `xml:"RemoveUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11845,7 +12765,7 @@ func RemoveUser(ctx context.Context, r soap.RoundTripper, req *types.RemoveUser) type RemoveVirtualNicBody struct { Req *types.RemoveVirtualNic `xml:"urn:vim25 RemoveVirtualNic,omitempty"` - Res *types.RemoveVirtualNicResponse `xml:"urn:vim25 RemoveVirtualNicResponse,omitempty"` + Res *types.RemoveVirtualNicResponse `xml:"RemoveVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11865,7 +12785,7 @@ func RemoveVirtualNic(ctx context.Context, r soap.RoundTripper, req *types.Remov type RemoveVirtualSwitchBody struct { Req *types.RemoveVirtualSwitch `xml:"urn:vim25 RemoveVirtualSwitch,omitempty"` - Res *types.RemoveVirtualSwitchResponse `xml:"urn:vim25 RemoveVirtualSwitchResponse,omitempty"` + Res *types.RemoveVirtualSwitchResponse `xml:"RemoveVirtualSwitchResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11885,7 +12805,7 @@ func RemoveVirtualSwitch(ctx context.Context, r soap.RoundTripper, req *types.Re type RenameCustomFieldDefBody struct { Req *types.RenameCustomFieldDef `xml:"urn:vim25 RenameCustomFieldDef,omitempty"` - Res *types.RenameCustomFieldDefResponse `xml:"urn:vim25 RenameCustomFieldDefResponse,omitempty"` + Res *types.RenameCustomFieldDefResponse `xml:"RenameCustomFieldDefResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11905,7 +12825,7 @@ func RenameCustomFieldDef(ctx context.Context, r soap.RoundTripper, req *types.R type RenameCustomizationSpecBody struct { Req *types.RenameCustomizationSpec `xml:"urn:vim25 RenameCustomizationSpec,omitempty"` - Res *types.RenameCustomizationSpecResponse `xml:"urn:vim25 RenameCustomizationSpecResponse,omitempty"` + Res *types.RenameCustomizationSpecResponse `xml:"RenameCustomizationSpecResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11925,7 +12845,7 @@ func RenameCustomizationSpec(ctx context.Context, r soap.RoundTripper, req *type type RenameDatastoreBody struct { Req *types.RenameDatastore `xml:"urn:vim25 RenameDatastore,omitempty"` - Res *types.RenameDatastoreResponse `xml:"urn:vim25 RenameDatastoreResponse,omitempty"` + Res *types.RenameDatastoreResponse `xml:"RenameDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11945,7 +12865,7 @@ func RenameDatastore(ctx context.Context, r soap.RoundTripper, req *types.Rename type RenameSnapshotBody struct { Req *types.RenameSnapshot `xml:"urn:vim25 RenameSnapshot,omitempty"` - Res *types.RenameSnapshotResponse `xml:"urn:vim25 RenameSnapshotResponse,omitempty"` + Res *types.RenameSnapshotResponse `xml:"RenameSnapshotResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11965,7 +12885,7 @@ func RenameSnapshot(ctx context.Context, r soap.RoundTripper, req *types.RenameS type RenameVStorageObjectBody struct { Req *types.RenameVStorageObject `xml:"urn:vim25 RenameVStorageObject,omitempty"` - Res *types.RenameVStorageObjectResponse `xml:"urn:vim25 RenameVStorageObjectResponse,omitempty"` + Res *types.RenameVStorageObjectResponse `xml:"RenameVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -11985,7 +12905,7 @@ func RenameVStorageObject(ctx context.Context, r soap.RoundTripper, req *types.R type Rename_TaskBody struct { Req *types.Rename_Task `xml:"urn:vim25 Rename_Task,omitempty"` - Res *types.Rename_TaskResponse `xml:"urn:vim25 Rename_TaskResponse,omitempty"` + Res *types.Rename_TaskResponse `xml:"Rename_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12005,7 +12925,7 @@ func Rename_Task(ctx context.Context, r soap.RoundTripper, req *types.Rename_Tas type ReplaceCACertificatesAndCRLsBody struct { Req *types.ReplaceCACertificatesAndCRLs `xml:"urn:vim25 ReplaceCACertificatesAndCRLs,omitempty"` - Res *types.ReplaceCACertificatesAndCRLsResponse `xml:"urn:vim25 ReplaceCACertificatesAndCRLsResponse,omitempty"` + Res *types.ReplaceCACertificatesAndCRLsResponse `xml:"ReplaceCACertificatesAndCRLsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12025,7 +12945,7 @@ func ReplaceCACertificatesAndCRLs(ctx context.Context, r soap.RoundTripper, req type ReplaceSmartCardTrustAnchorsBody struct { Req *types.ReplaceSmartCardTrustAnchors `xml:"urn:vim25 ReplaceSmartCardTrustAnchors,omitempty"` - Res *types.ReplaceSmartCardTrustAnchorsResponse `xml:"urn:vim25 ReplaceSmartCardTrustAnchorsResponse,omitempty"` + Res *types.ReplaceSmartCardTrustAnchorsResponse `xml:"ReplaceSmartCardTrustAnchorsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12045,7 +12965,7 @@ func ReplaceSmartCardTrustAnchors(ctx context.Context, r soap.RoundTripper, req type RescanAllHbaBody struct { Req *types.RescanAllHba `xml:"urn:vim25 RescanAllHba,omitempty"` - Res *types.RescanAllHbaResponse `xml:"urn:vim25 RescanAllHbaResponse,omitempty"` + Res *types.RescanAllHbaResponse `xml:"RescanAllHbaResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12065,7 +12985,7 @@ func RescanAllHba(ctx context.Context, r soap.RoundTripper, req *types.RescanAll type RescanHbaBody struct { Req *types.RescanHba `xml:"urn:vim25 RescanHba,omitempty"` - Res *types.RescanHbaResponse `xml:"urn:vim25 RescanHbaResponse,omitempty"` + Res *types.RescanHbaResponse `xml:"RescanHbaResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12085,7 +13005,7 @@ func RescanHba(ctx context.Context, r soap.RoundTripper, req *types.RescanHba) ( type RescanVffsBody struct { Req *types.RescanVffs `xml:"urn:vim25 RescanVffs,omitempty"` - Res *types.RescanVffsResponse `xml:"urn:vim25 RescanVffsResponse,omitempty"` + Res *types.RescanVffsResponse `xml:"RescanVffsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12105,7 +13025,7 @@ func RescanVffs(ctx context.Context, r soap.RoundTripper, req *types.RescanVffs) type RescanVmfsBody struct { Req *types.RescanVmfs `xml:"urn:vim25 RescanVmfs,omitempty"` - Res *types.RescanVmfsResponse `xml:"urn:vim25 RescanVmfsResponse,omitempty"` + Res *types.RescanVmfsResponse `xml:"RescanVmfsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12125,7 +13045,7 @@ func RescanVmfs(ctx context.Context, r soap.RoundTripper, req *types.RescanVmfs) type ResetCollectorBody struct { Req *types.ResetCollector `xml:"urn:vim25 ResetCollector,omitempty"` - Res *types.ResetCollectorResponse `xml:"urn:vim25 ResetCollectorResponse,omitempty"` + Res *types.ResetCollectorResponse `xml:"ResetCollectorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12145,7 +13065,7 @@ func ResetCollector(ctx context.Context, r soap.RoundTripper, req *types.ResetCo type ResetCounterLevelMappingBody struct { Req *types.ResetCounterLevelMapping `xml:"urn:vim25 ResetCounterLevelMapping,omitempty"` - Res *types.ResetCounterLevelMappingResponse `xml:"urn:vim25 ResetCounterLevelMappingResponse,omitempty"` + Res *types.ResetCounterLevelMappingResponse `xml:"ResetCounterLevelMappingResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12165,7 +13085,7 @@ func ResetCounterLevelMapping(ctx context.Context, r soap.RoundTripper, req *typ type ResetEntityPermissionsBody struct { Req *types.ResetEntityPermissions `xml:"urn:vim25 ResetEntityPermissions,omitempty"` - Res *types.ResetEntityPermissionsResponse `xml:"urn:vim25 ResetEntityPermissionsResponse,omitempty"` + Res *types.ResetEntityPermissionsResponse `xml:"ResetEntityPermissionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12185,7 +13105,7 @@ func ResetEntityPermissions(ctx context.Context, r soap.RoundTripper, req *types type ResetFirmwareToFactoryDefaultsBody struct { Req *types.ResetFirmwareToFactoryDefaults `xml:"urn:vim25 ResetFirmwareToFactoryDefaults,omitempty"` - Res *types.ResetFirmwareToFactoryDefaultsResponse `xml:"urn:vim25 ResetFirmwareToFactoryDefaultsResponse,omitempty"` + Res *types.ResetFirmwareToFactoryDefaultsResponse `xml:"ResetFirmwareToFactoryDefaultsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12205,7 +13125,7 @@ func ResetFirmwareToFactoryDefaults(ctx context.Context, r soap.RoundTripper, re type ResetGuestInformationBody struct { Req *types.ResetGuestInformation `xml:"urn:vim25 ResetGuestInformation,omitempty"` - Res *types.ResetGuestInformationResponse `xml:"urn:vim25 ResetGuestInformationResponse,omitempty"` + Res *types.ResetGuestInformationResponse `xml:"ResetGuestInformationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12225,7 +13145,7 @@ func ResetGuestInformation(ctx context.Context, r soap.RoundTripper, req *types. type ResetListViewBody struct { Req *types.ResetListView `xml:"urn:vim25 ResetListView,omitempty"` - Res *types.ResetListViewResponse `xml:"urn:vim25 ResetListViewResponse,omitempty"` + Res *types.ResetListViewResponse `xml:"ResetListViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12245,7 +13165,7 @@ func ResetListView(ctx context.Context, r soap.RoundTripper, req *types.ResetLis type ResetListViewFromViewBody struct { Req *types.ResetListViewFromView `xml:"urn:vim25 ResetListViewFromView,omitempty"` - Res *types.ResetListViewFromViewResponse `xml:"urn:vim25 ResetListViewFromViewResponse,omitempty"` + Res *types.ResetListViewFromViewResponse `xml:"ResetListViewFromViewResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12265,7 +13185,7 @@ func ResetListViewFromView(ctx context.Context, r soap.RoundTripper, req *types. type ResetSystemHealthInfoBody struct { Req *types.ResetSystemHealthInfo `xml:"urn:vim25 ResetSystemHealthInfo,omitempty"` - Res *types.ResetSystemHealthInfoResponse `xml:"urn:vim25 ResetSystemHealthInfoResponse,omitempty"` + Res *types.ResetSystemHealthInfoResponse `xml:"ResetSystemHealthInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12285,7 +13205,7 @@ func ResetSystemHealthInfo(ctx context.Context, r soap.RoundTripper, req *types. type ResetVM_TaskBody struct { Req *types.ResetVM_Task `xml:"urn:vim25 ResetVM_Task,omitempty"` - Res *types.ResetVM_TaskResponse `xml:"urn:vim25 ResetVM_TaskResponse,omitempty"` + Res *types.ResetVM_TaskResponse `xml:"ResetVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12305,7 +13225,7 @@ func ResetVM_Task(ctx context.Context, r soap.RoundTripper, req *types.ResetVM_T type ResignatureUnresolvedVmfsVolume_TaskBody struct { Req *types.ResignatureUnresolvedVmfsVolume_Task `xml:"urn:vim25 ResignatureUnresolvedVmfsVolume_Task,omitempty"` - Res *types.ResignatureUnresolvedVmfsVolume_TaskResponse `xml:"urn:vim25 ResignatureUnresolvedVmfsVolume_TaskResponse,omitempty"` + Res *types.ResignatureUnresolvedVmfsVolume_TaskResponse `xml:"ResignatureUnresolvedVmfsVolume_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12325,7 +13245,7 @@ func ResignatureUnresolvedVmfsVolume_Task(ctx context.Context, r soap.RoundTripp type ResolveInstallationErrorsOnCluster_TaskBody struct { Req *types.ResolveInstallationErrorsOnCluster_Task `xml:"urn:vim25 ResolveInstallationErrorsOnCluster_Task,omitempty"` - Res *types.ResolveInstallationErrorsOnCluster_TaskResponse `xml:"urn:vim25 ResolveInstallationErrorsOnCluster_TaskResponse,omitempty"` + Res *types.ResolveInstallationErrorsOnCluster_TaskResponse `xml:"ResolveInstallationErrorsOnCluster_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12345,7 +13265,7 @@ func ResolveInstallationErrorsOnCluster_Task(ctx context.Context, r soap.RoundTr type ResolveInstallationErrorsOnHost_TaskBody struct { Req *types.ResolveInstallationErrorsOnHost_Task `xml:"urn:vim25 ResolveInstallationErrorsOnHost_Task,omitempty"` - Res *types.ResolveInstallationErrorsOnHost_TaskResponse `xml:"urn:vim25 ResolveInstallationErrorsOnHost_TaskResponse,omitempty"` + Res *types.ResolveInstallationErrorsOnHost_TaskResponse `xml:"ResolveInstallationErrorsOnHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12365,7 +13285,7 @@ func ResolveInstallationErrorsOnHost_Task(ctx context.Context, r soap.RoundTripp type ResolveMultipleUnresolvedVmfsVolumesBody struct { Req *types.ResolveMultipleUnresolvedVmfsVolumes `xml:"urn:vim25 ResolveMultipleUnresolvedVmfsVolumes,omitempty"` - Res *types.ResolveMultipleUnresolvedVmfsVolumesResponse `xml:"urn:vim25 ResolveMultipleUnresolvedVmfsVolumesResponse,omitempty"` + Res *types.ResolveMultipleUnresolvedVmfsVolumesResponse `xml:"ResolveMultipleUnresolvedVmfsVolumesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12385,7 +13305,7 @@ func ResolveMultipleUnresolvedVmfsVolumes(ctx context.Context, r soap.RoundTripp type ResolveMultipleUnresolvedVmfsVolumesEx_TaskBody struct { Req *types.ResolveMultipleUnresolvedVmfsVolumesEx_Task `xml:"urn:vim25 ResolveMultipleUnresolvedVmfsVolumesEx_Task,omitempty"` - Res *types.ResolveMultipleUnresolvedVmfsVolumesEx_TaskResponse `xml:"urn:vim25 ResolveMultipleUnresolvedVmfsVolumesEx_TaskResponse,omitempty"` + Res *types.ResolveMultipleUnresolvedVmfsVolumesEx_TaskResponse `xml:"ResolveMultipleUnresolvedVmfsVolumesEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12405,7 +13325,7 @@ func ResolveMultipleUnresolvedVmfsVolumesEx_Task(ctx context.Context, r soap.Rou type RestartServiceBody struct { Req *types.RestartService `xml:"urn:vim25 RestartService,omitempty"` - Res *types.RestartServiceResponse `xml:"urn:vim25 RestartServiceResponse,omitempty"` + Res *types.RestartServiceResponse `xml:"RestartServiceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12425,7 +13345,7 @@ func RestartService(ctx context.Context, r soap.RoundTripper, req *types.Restart type RestartServiceConsoleVirtualNicBody struct { Req *types.RestartServiceConsoleVirtualNic `xml:"urn:vim25 RestartServiceConsoleVirtualNic,omitempty"` - Res *types.RestartServiceConsoleVirtualNicResponse `xml:"urn:vim25 RestartServiceConsoleVirtualNicResponse,omitempty"` + Res *types.RestartServiceConsoleVirtualNicResponse `xml:"RestartServiceConsoleVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12445,7 +13365,7 @@ func RestartServiceConsoleVirtualNic(ctx context.Context, r soap.RoundTripper, r type RestoreFirmwareConfigurationBody struct { Req *types.RestoreFirmwareConfiguration `xml:"urn:vim25 RestoreFirmwareConfiguration,omitempty"` - Res *types.RestoreFirmwareConfigurationResponse `xml:"urn:vim25 RestoreFirmwareConfigurationResponse,omitempty"` + Res *types.RestoreFirmwareConfigurationResponse `xml:"RestoreFirmwareConfigurationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12465,7 +13385,7 @@ func RestoreFirmwareConfiguration(ctx context.Context, r soap.RoundTripper, req type RetrieveAllPermissionsBody struct { Req *types.RetrieveAllPermissions `xml:"urn:vim25 RetrieveAllPermissions,omitempty"` - Res *types.RetrieveAllPermissionsResponse `xml:"urn:vim25 RetrieveAllPermissionsResponse,omitempty"` + Res *types.RetrieveAllPermissionsResponse `xml:"RetrieveAllPermissionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12485,7 +13405,7 @@ func RetrieveAllPermissions(ctx context.Context, r soap.RoundTripper, req *types type RetrieveAnswerFileBody struct { Req *types.RetrieveAnswerFile `xml:"urn:vim25 RetrieveAnswerFile,omitempty"` - Res *types.RetrieveAnswerFileResponse `xml:"urn:vim25 RetrieveAnswerFileResponse,omitempty"` + Res *types.RetrieveAnswerFileResponse `xml:"RetrieveAnswerFileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12505,7 +13425,7 @@ func RetrieveAnswerFile(ctx context.Context, r soap.RoundTripper, req *types.Ret type RetrieveAnswerFileForProfileBody struct { Req *types.RetrieveAnswerFileForProfile `xml:"urn:vim25 RetrieveAnswerFileForProfile,omitempty"` - Res *types.RetrieveAnswerFileForProfileResponse `xml:"urn:vim25 RetrieveAnswerFileForProfileResponse,omitempty"` + Res *types.RetrieveAnswerFileForProfileResponse `xml:"RetrieveAnswerFileForProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12525,7 +13445,7 @@ func RetrieveAnswerFileForProfile(ctx context.Context, r soap.RoundTripper, req type RetrieveArgumentDescriptionBody struct { Req *types.RetrieveArgumentDescription `xml:"urn:vim25 RetrieveArgumentDescription,omitempty"` - Res *types.RetrieveArgumentDescriptionResponse `xml:"urn:vim25 RetrieveArgumentDescriptionResponse,omitempty"` + Res *types.RetrieveArgumentDescriptionResponse `xml:"RetrieveArgumentDescriptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12545,7 +13465,7 @@ func RetrieveArgumentDescription(ctx context.Context, r soap.RoundTripper, req * type RetrieveClientCertBody struct { Req *types.RetrieveClientCert `xml:"urn:vim25 RetrieveClientCert,omitempty"` - Res *types.RetrieveClientCertResponse `xml:"urn:vim25 RetrieveClientCertResponse,omitempty"` + Res *types.RetrieveClientCertResponse `xml:"RetrieveClientCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12565,7 +13485,7 @@ func RetrieveClientCert(ctx context.Context, r soap.RoundTripper, req *types.Ret type RetrieveClientCsrBody struct { Req *types.RetrieveClientCsr `xml:"urn:vim25 RetrieveClientCsr,omitempty"` - Res *types.RetrieveClientCsrResponse `xml:"urn:vim25 RetrieveClientCsrResponse,omitempty"` + Res *types.RetrieveClientCsrResponse `xml:"RetrieveClientCsrResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12585,7 +13505,7 @@ func RetrieveClientCsr(ctx context.Context, r soap.RoundTripper, req *types.Retr type RetrieveDasAdvancedRuntimeInfoBody struct { Req *types.RetrieveDasAdvancedRuntimeInfo `xml:"urn:vim25 RetrieveDasAdvancedRuntimeInfo,omitempty"` - Res *types.RetrieveDasAdvancedRuntimeInfoResponse `xml:"urn:vim25 RetrieveDasAdvancedRuntimeInfoResponse,omitempty"` + Res *types.RetrieveDasAdvancedRuntimeInfoResponse `xml:"RetrieveDasAdvancedRuntimeInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12605,7 +13525,7 @@ func RetrieveDasAdvancedRuntimeInfo(ctx context.Context, r soap.RoundTripper, re type RetrieveDescriptionBody struct { Req *types.RetrieveDescription `xml:"urn:vim25 RetrieveDescription,omitempty"` - Res *types.RetrieveDescriptionResponse `xml:"urn:vim25 RetrieveDescriptionResponse,omitempty"` + Res *types.RetrieveDescriptionResponse `xml:"RetrieveDescriptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12625,7 +13545,7 @@ func RetrieveDescription(ctx context.Context, r soap.RoundTripper, req *types.Re type RetrieveDiskPartitionInfoBody struct { Req *types.RetrieveDiskPartitionInfo `xml:"urn:vim25 RetrieveDiskPartitionInfo,omitempty"` - Res *types.RetrieveDiskPartitionInfoResponse `xml:"urn:vim25 RetrieveDiskPartitionInfoResponse,omitempty"` + Res *types.RetrieveDiskPartitionInfoResponse `xml:"RetrieveDiskPartitionInfoResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12645,7 +13565,7 @@ func RetrieveDiskPartitionInfo(ctx context.Context, r soap.RoundTripper, req *ty type RetrieveEntityPermissionsBody struct { Req *types.RetrieveEntityPermissions `xml:"urn:vim25 RetrieveEntityPermissions,omitempty"` - Res *types.RetrieveEntityPermissionsResponse `xml:"urn:vim25 RetrieveEntityPermissionsResponse,omitempty"` + Res *types.RetrieveEntityPermissionsResponse `xml:"RetrieveEntityPermissionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12665,7 +13585,7 @@ func RetrieveEntityPermissions(ctx context.Context, r soap.RoundTripper, req *ty type RetrieveEntityScheduledTaskBody struct { Req *types.RetrieveEntityScheduledTask `xml:"urn:vim25 RetrieveEntityScheduledTask,omitempty"` - Res *types.RetrieveEntityScheduledTaskResponse `xml:"urn:vim25 RetrieveEntityScheduledTaskResponse,omitempty"` + Res *types.RetrieveEntityScheduledTaskResponse `xml:"RetrieveEntityScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12685,7 +13605,7 @@ func RetrieveEntityScheduledTask(ctx context.Context, r soap.RoundTripper, req * type RetrieveHardwareUptimeBody struct { Req *types.RetrieveHardwareUptime `xml:"urn:vim25 RetrieveHardwareUptime,omitempty"` - Res *types.RetrieveHardwareUptimeResponse `xml:"urn:vim25 RetrieveHardwareUptimeResponse,omitempty"` + Res *types.RetrieveHardwareUptimeResponse `xml:"RetrieveHardwareUptimeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12705,7 +13625,7 @@ func RetrieveHardwareUptime(ctx context.Context, r soap.RoundTripper, req *types type RetrieveHostAccessControlEntriesBody struct { Req *types.RetrieveHostAccessControlEntries `xml:"urn:vim25 RetrieveHostAccessControlEntries,omitempty"` - Res *types.RetrieveHostAccessControlEntriesResponse `xml:"urn:vim25 RetrieveHostAccessControlEntriesResponse,omitempty"` + Res *types.RetrieveHostAccessControlEntriesResponse `xml:"RetrieveHostAccessControlEntriesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12725,7 +13645,7 @@ func RetrieveHostAccessControlEntries(ctx context.Context, r soap.RoundTripper, type RetrieveHostCustomizationsBody struct { Req *types.RetrieveHostCustomizations `xml:"urn:vim25 RetrieveHostCustomizations,omitempty"` - Res *types.RetrieveHostCustomizationsResponse `xml:"urn:vim25 RetrieveHostCustomizationsResponse,omitempty"` + Res *types.RetrieveHostCustomizationsResponse `xml:"RetrieveHostCustomizationsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12745,7 +13665,7 @@ func RetrieveHostCustomizations(ctx context.Context, r soap.RoundTripper, req *t type RetrieveHostCustomizationsForProfileBody struct { Req *types.RetrieveHostCustomizationsForProfile `xml:"urn:vim25 RetrieveHostCustomizationsForProfile,omitempty"` - Res *types.RetrieveHostCustomizationsForProfileResponse `xml:"urn:vim25 RetrieveHostCustomizationsForProfileResponse,omitempty"` + Res *types.RetrieveHostCustomizationsForProfileResponse `xml:"RetrieveHostCustomizationsForProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12765,7 +13685,7 @@ func RetrieveHostCustomizationsForProfile(ctx context.Context, r soap.RoundTripp type RetrieveHostSpecificationBody struct { Req *types.RetrieveHostSpecification `xml:"urn:vim25 RetrieveHostSpecification,omitempty"` - Res *types.RetrieveHostSpecificationResponse `xml:"urn:vim25 RetrieveHostSpecificationResponse,omitempty"` + Res *types.RetrieveHostSpecificationResponse `xml:"RetrieveHostSpecificationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12785,7 +13705,7 @@ func RetrieveHostSpecification(ctx context.Context, r soap.RoundTripper, req *ty type RetrieveKmipServerCertBody struct { Req *types.RetrieveKmipServerCert `xml:"urn:vim25 RetrieveKmipServerCert,omitempty"` - Res *types.RetrieveKmipServerCertResponse `xml:"urn:vim25 RetrieveKmipServerCertResponse,omitempty"` + Res *types.RetrieveKmipServerCertResponse `xml:"RetrieveKmipServerCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12805,7 +13725,7 @@ func RetrieveKmipServerCert(ctx context.Context, r soap.RoundTripper, req *types type RetrieveKmipServersStatus_TaskBody struct { Req *types.RetrieveKmipServersStatus_Task `xml:"urn:vim25 RetrieveKmipServersStatus_Task,omitempty"` - Res *types.RetrieveKmipServersStatus_TaskResponse `xml:"urn:vim25 RetrieveKmipServersStatus_TaskResponse,omitempty"` + Res *types.RetrieveKmipServersStatus_TaskResponse `xml:"RetrieveKmipServersStatus_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12825,7 +13745,7 @@ func RetrieveKmipServersStatus_Task(ctx context.Context, r soap.RoundTripper, re type RetrieveObjectScheduledTaskBody struct { Req *types.RetrieveObjectScheduledTask `xml:"urn:vim25 RetrieveObjectScheduledTask,omitempty"` - Res *types.RetrieveObjectScheduledTaskResponse `xml:"urn:vim25 RetrieveObjectScheduledTaskResponse,omitempty"` + Res *types.RetrieveObjectScheduledTaskResponse `xml:"RetrieveObjectScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12845,7 +13765,7 @@ func RetrieveObjectScheduledTask(ctx context.Context, r soap.RoundTripper, req * type RetrieveProductComponentsBody struct { Req *types.RetrieveProductComponents `xml:"urn:vim25 RetrieveProductComponents,omitempty"` - Res *types.RetrieveProductComponentsResponse `xml:"urn:vim25 RetrieveProductComponentsResponse,omitempty"` + Res *types.RetrieveProductComponentsResponse `xml:"RetrieveProductComponentsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12865,7 +13785,7 @@ func RetrieveProductComponents(ctx context.Context, r soap.RoundTripper, req *ty type RetrievePropertiesBody struct { Req *types.RetrieveProperties `xml:"urn:vim25 RetrieveProperties,omitempty"` - Res *types.RetrievePropertiesResponse `xml:"urn:vim25 RetrievePropertiesResponse,omitempty"` + Res *types.RetrievePropertiesResponse `xml:"RetrievePropertiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12885,7 +13805,7 @@ func RetrieveProperties(ctx context.Context, r soap.RoundTripper, req *types.Ret type RetrievePropertiesExBody struct { Req *types.RetrievePropertiesEx `xml:"urn:vim25 RetrievePropertiesEx,omitempty"` - Res *types.RetrievePropertiesExResponse `xml:"urn:vim25 RetrievePropertiesExResponse,omitempty"` + Res *types.RetrievePropertiesExResponse `xml:"RetrievePropertiesExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12905,7 +13825,7 @@ func RetrievePropertiesEx(ctx context.Context, r soap.RoundTripper, req *types.R type RetrieveRolePermissionsBody struct { Req *types.RetrieveRolePermissions `xml:"urn:vim25 RetrieveRolePermissions,omitempty"` - Res *types.RetrieveRolePermissionsResponse `xml:"urn:vim25 RetrieveRolePermissionsResponse,omitempty"` + Res *types.RetrieveRolePermissionsResponse `xml:"RetrieveRolePermissionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12925,7 +13845,7 @@ func RetrieveRolePermissions(ctx context.Context, r soap.RoundTripper, req *type type RetrieveSelfSignedClientCertBody struct { Req *types.RetrieveSelfSignedClientCert `xml:"urn:vim25 RetrieveSelfSignedClientCert,omitempty"` - Res *types.RetrieveSelfSignedClientCertResponse `xml:"urn:vim25 RetrieveSelfSignedClientCertResponse,omitempty"` + Res *types.RetrieveSelfSignedClientCertResponse `xml:"RetrieveSelfSignedClientCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12945,7 +13865,7 @@ func RetrieveSelfSignedClientCert(ctx context.Context, r soap.RoundTripper, req type RetrieveServiceContentBody struct { Req *types.RetrieveServiceContent `xml:"urn:vim25 RetrieveServiceContent,omitempty"` - Res *types.RetrieveServiceContentResponse `xml:"urn:vim25 RetrieveServiceContentResponse,omitempty"` + Res *types.RetrieveServiceContentResponse `xml:"RetrieveServiceContentResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12963,9 +13883,29 @@ func RetrieveServiceContent(ctx context.Context, r soap.RoundTripper, req *types return resBody.Res, nil } +type RetrieveSnapshotInfoBody struct { + Req *types.RetrieveSnapshotInfo `xml:"urn:vim25 RetrieveSnapshotInfo,omitempty"` + Res *types.RetrieveSnapshotInfoResponse `xml:"RetrieveSnapshotInfoResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *RetrieveSnapshotInfoBody) Fault() *soap.Fault { return b.Fault_ } + +func RetrieveSnapshotInfo(ctx context.Context, r soap.RoundTripper, req *types.RetrieveSnapshotInfo) (*types.RetrieveSnapshotInfoResponse, error) { + var reqBody, resBody RetrieveSnapshotInfoBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type RetrieveUserGroupsBody struct { Req *types.RetrieveUserGroups `xml:"urn:vim25 RetrieveUserGroups,omitempty"` - Res *types.RetrieveUserGroupsResponse `xml:"urn:vim25 RetrieveUserGroupsResponse,omitempty"` + Res *types.RetrieveUserGroupsResponse `xml:"RetrieveUserGroupsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -12983,9 +13923,29 @@ func RetrieveUserGroups(ctx context.Context, r soap.RoundTripper, req *types.Ret return resBody.Res, nil } +type RetrieveVStorageInfrastructureObjectPolicyBody struct { + Req *types.RetrieveVStorageInfrastructureObjectPolicy `xml:"urn:vim25 RetrieveVStorageInfrastructureObjectPolicy,omitempty"` + Res *types.RetrieveVStorageInfrastructureObjectPolicyResponse `xml:"RetrieveVStorageInfrastructureObjectPolicyResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *RetrieveVStorageInfrastructureObjectPolicyBody) Fault() *soap.Fault { return b.Fault_ } + +func RetrieveVStorageInfrastructureObjectPolicy(ctx context.Context, r soap.RoundTripper, req *types.RetrieveVStorageInfrastructureObjectPolicy) (*types.RetrieveVStorageInfrastructureObjectPolicyResponse, error) { + var reqBody, resBody RetrieveVStorageInfrastructureObjectPolicyBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type RetrieveVStorageObjectBody struct { Req *types.RetrieveVStorageObject `xml:"urn:vim25 RetrieveVStorageObject,omitempty"` - Res *types.RetrieveVStorageObjectResponse `xml:"urn:vim25 RetrieveVStorageObjectResponse,omitempty"` + Res *types.RetrieveVStorageObjectResponse `xml:"RetrieveVStorageObjectResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13003,9 +13963,29 @@ func RetrieveVStorageObject(ctx context.Context, r soap.RoundTripper, req *types return resBody.Res, nil } +type RetrieveVStorageObjectAssociationsBody struct { + Req *types.RetrieveVStorageObjectAssociations `xml:"urn:vim25 RetrieveVStorageObjectAssociations,omitempty"` + Res *types.RetrieveVStorageObjectAssociationsResponse `xml:"RetrieveVStorageObjectAssociationsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *RetrieveVStorageObjectAssociationsBody) Fault() *soap.Fault { return b.Fault_ } + +func RetrieveVStorageObjectAssociations(ctx context.Context, r soap.RoundTripper, req *types.RetrieveVStorageObjectAssociations) (*types.RetrieveVStorageObjectAssociationsResponse, error) { + var reqBody, resBody RetrieveVStorageObjectAssociationsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type RetrieveVStorageObjectStateBody struct { Req *types.RetrieveVStorageObjectState `xml:"urn:vim25 RetrieveVStorageObjectState,omitempty"` - Res *types.RetrieveVStorageObjectStateResponse `xml:"urn:vim25 RetrieveVStorageObjectStateResponse,omitempty"` + Res *types.RetrieveVStorageObjectStateResponse `xml:"RetrieveVStorageObjectStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13025,7 +14005,7 @@ func RetrieveVStorageObjectState(ctx context.Context, r soap.RoundTripper, req * type RevertToCurrentSnapshot_TaskBody struct { Req *types.RevertToCurrentSnapshot_Task `xml:"urn:vim25 RevertToCurrentSnapshot_Task,omitempty"` - Res *types.RevertToCurrentSnapshot_TaskResponse `xml:"urn:vim25 RevertToCurrentSnapshot_TaskResponse,omitempty"` + Res *types.RevertToCurrentSnapshot_TaskResponse `xml:"RevertToCurrentSnapshot_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13045,7 +14025,7 @@ func RevertToCurrentSnapshot_Task(ctx context.Context, r soap.RoundTripper, req type RevertToSnapshot_TaskBody struct { Req *types.RevertToSnapshot_Task `xml:"urn:vim25 RevertToSnapshot_Task,omitempty"` - Res *types.RevertToSnapshot_TaskResponse `xml:"urn:vim25 RevertToSnapshot_TaskResponse,omitempty"` + Res *types.RevertToSnapshot_TaskResponse `xml:"RevertToSnapshot_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13063,9 +14043,29 @@ func RevertToSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types. return resBody.Res, nil } +type RevertVStorageObject_TaskBody struct { + Req *types.RevertVStorageObject_Task `xml:"urn:vim25 RevertVStorageObject_Task,omitempty"` + Res *types.RevertVStorageObject_TaskResponse `xml:"RevertVStorageObject_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *RevertVStorageObject_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func RevertVStorageObject_Task(ctx context.Context, r soap.RoundTripper, req *types.RevertVStorageObject_Task) (*types.RevertVStorageObject_TaskResponse, error) { + var reqBody, resBody RevertVStorageObject_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type RewindCollectorBody struct { Req *types.RewindCollector `xml:"urn:vim25 RewindCollector,omitempty"` - Res *types.RewindCollectorResponse `xml:"urn:vim25 RewindCollectorResponse,omitempty"` + Res *types.RewindCollectorResponse `xml:"RewindCollectorResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13085,7 +14085,7 @@ func RewindCollector(ctx context.Context, r soap.RoundTripper, req *types.Rewind type RunScheduledTaskBody struct { Req *types.RunScheduledTask `xml:"urn:vim25 RunScheduledTask,omitempty"` - Res *types.RunScheduledTaskResponse `xml:"urn:vim25 RunScheduledTaskResponse,omitempty"` + Res *types.RunScheduledTaskResponse `xml:"RunScheduledTaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13105,7 +14105,7 @@ func RunScheduledTask(ctx context.Context, r soap.RoundTripper, req *types.RunSc type RunVsanPhysicalDiskDiagnosticsBody struct { Req *types.RunVsanPhysicalDiskDiagnostics `xml:"urn:vim25 RunVsanPhysicalDiskDiagnostics,omitempty"` - Res *types.RunVsanPhysicalDiskDiagnosticsResponse `xml:"urn:vim25 RunVsanPhysicalDiskDiagnosticsResponse,omitempty"` + Res *types.RunVsanPhysicalDiskDiagnosticsResponse `xml:"RunVsanPhysicalDiskDiagnosticsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13125,7 +14125,7 @@ func RunVsanPhysicalDiskDiagnostics(ctx context.Context, r soap.RoundTripper, re type ScanHostPatchV2_TaskBody struct { Req *types.ScanHostPatchV2_Task `xml:"urn:vim25 ScanHostPatchV2_Task,omitempty"` - Res *types.ScanHostPatchV2_TaskResponse `xml:"urn:vim25 ScanHostPatchV2_TaskResponse,omitempty"` + Res *types.ScanHostPatchV2_TaskResponse `xml:"ScanHostPatchV2_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13145,7 +14145,7 @@ func ScanHostPatchV2_Task(ctx context.Context, r soap.RoundTripper, req *types.S type ScanHostPatch_TaskBody struct { Req *types.ScanHostPatch_Task `xml:"urn:vim25 ScanHostPatch_Task,omitempty"` - Res *types.ScanHostPatch_TaskResponse `xml:"urn:vim25 ScanHostPatch_TaskResponse,omitempty"` + Res *types.ScanHostPatch_TaskResponse `xml:"ScanHostPatch_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13165,7 +14165,7 @@ func ScanHostPatch_Task(ctx context.Context, r soap.RoundTripper, req *types.Sca type ScheduleReconcileDatastoreInventoryBody struct { Req *types.ScheduleReconcileDatastoreInventory `xml:"urn:vim25 ScheduleReconcileDatastoreInventory,omitempty"` - Res *types.ScheduleReconcileDatastoreInventoryResponse `xml:"urn:vim25 ScheduleReconcileDatastoreInventoryResponse,omitempty"` + Res *types.ScheduleReconcileDatastoreInventoryResponse `xml:"ScheduleReconcileDatastoreInventoryResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13185,7 +14185,7 @@ func ScheduleReconcileDatastoreInventory(ctx context.Context, r soap.RoundTrippe type SearchDatastoreSubFolders_TaskBody struct { Req *types.SearchDatastoreSubFolders_Task `xml:"urn:vim25 SearchDatastoreSubFolders_Task,omitempty"` - Res *types.SearchDatastoreSubFolders_TaskResponse `xml:"urn:vim25 SearchDatastoreSubFolders_TaskResponse,omitempty"` + Res *types.SearchDatastoreSubFolders_TaskResponse `xml:"SearchDatastoreSubFolders_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13205,7 +14205,7 @@ func SearchDatastoreSubFolders_Task(ctx context.Context, r soap.RoundTripper, re type SearchDatastore_TaskBody struct { Req *types.SearchDatastore_Task `xml:"urn:vim25 SearchDatastore_Task,omitempty"` - Res *types.SearchDatastore_TaskResponse `xml:"urn:vim25 SearchDatastore_TaskResponse,omitempty"` + Res *types.SearchDatastore_TaskResponse `xml:"SearchDatastore_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13225,7 +14225,7 @@ func SearchDatastore_Task(ctx context.Context, r soap.RoundTripper, req *types.S type SelectActivePartitionBody struct { Req *types.SelectActivePartition `xml:"urn:vim25 SelectActivePartition,omitempty"` - Res *types.SelectActivePartitionResponse `xml:"urn:vim25 SelectActivePartitionResponse,omitempty"` + Res *types.SelectActivePartitionResponse `xml:"SelectActivePartitionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13245,7 +14245,7 @@ func SelectActivePartition(ctx context.Context, r soap.RoundTripper, req *types. type SelectVnicBody struct { Req *types.SelectVnic `xml:"urn:vim25 SelectVnic,omitempty"` - Res *types.SelectVnicResponse `xml:"urn:vim25 SelectVnicResponse,omitempty"` + Res *types.SelectVnicResponse `xml:"SelectVnicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13265,7 +14265,7 @@ func SelectVnic(ctx context.Context, r soap.RoundTripper, req *types.SelectVnic) type SelectVnicForNicTypeBody struct { Req *types.SelectVnicForNicType `xml:"urn:vim25 SelectVnicForNicType,omitempty"` - Res *types.SelectVnicForNicTypeResponse `xml:"urn:vim25 SelectVnicForNicTypeResponse,omitempty"` + Res *types.SelectVnicForNicTypeResponse `xml:"SelectVnicForNicTypeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13285,7 +14285,7 @@ func SelectVnicForNicType(ctx context.Context, r soap.RoundTripper, req *types.S type SendNMIBody struct { Req *types.SendNMI `xml:"urn:vim25 SendNMI,omitempty"` - Res *types.SendNMIResponse `xml:"urn:vim25 SendNMIResponse,omitempty"` + Res *types.SendNMIResponse `xml:"SendNMIResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13305,7 +14305,7 @@ func SendNMI(ctx context.Context, r soap.RoundTripper, req *types.SendNMI) (*typ type SendTestNotificationBody struct { Req *types.SendTestNotification `xml:"urn:vim25 SendTestNotification,omitempty"` - Res *types.SendTestNotificationResponse `xml:"urn:vim25 SendTestNotificationResponse,omitempty"` + Res *types.SendTestNotificationResponse `xml:"SendTestNotificationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13325,7 +14325,7 @@ func SendTestNotification(ctx context.Context, r soap.RoundTripper, req *types.S type SessionIsActiveBody struct { Req *types.SessionIsActive `xml:"urn:vim25 SessionIsActive,omitempty"` - Res *types.SessionIsActiveResponse `xml:"urn:vim25 SessionIsActiveResponse,omitempty"` + Res *types.SessionIsActiveResponse `xml:"SessionIsActiveResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13345,7 +14345,7 @@ func SessionIsActive(ctx context.Context, r soap.RoundTripper, req *types.Sessio type SetCollectorPageSizeBody struct { Req *types.SetCollectorPageSize `xml:"urn:vim25 SetCollectorPageSize,omitempty"` - Res *types.SetCollectorPageSizeResponse `xml:"urn:vim25 SetCollectorPageSizeResponse,omitempty"` + Res *types.SetCollectorPageSizeResponse `xml:"SetCollectorPageSizeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13365,7 +14365,7 @@ func SetCollectorPageSize(ctx context.Context, r soap.RoundTripper, req *types.S type SetDisplayTopologyBody struct { Req *types.SetDisplayTopology `xml:"urn:vim25 SetDisplayTopology,omitempty"` - Res *types.SetDisplayTopologyResponse `xml:"urn:vim25 SetDisplayTopologyResponse,omitempty"` + Res *types.SetDisplayTopologyResponse `xml:"SetDisplayTopologyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13385,7 +14385,7 @@ func SetDisplayTopology(ctx context.Context, r soap.RoundTripper, req *types.Set type SetEntityPermissionsBody struct { Req *types.SetEntityPermissions `xml:"urn:vim25 SetEntityPermissions,omitempty"` - Res *types.SetEntityPermissionsResponse `xml:"urn:vim25 SetEntityPermissionsResponse,omitempty"` + Res *types.SetEntityPermissionsResponse `xml:"SetEntityPermissionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13405,7 +14405,7 @@ func SetEntityPermissions(ctx context.Context, r soap.RoundTripper, req *types.S type SetExtensionCertificateBody struct { Req *types.SetExtensionCertificate `xml:"urn:vim25 SetExtensionCertificate,omitempty"` - Res *types.SetExtensionCertificateResponse `xml:"urn:vim25 SetExtensionCertificateResponse,omitempty"` + Res *types.SetExtensionCertificateResponse `xml:"SetExtensionCertificateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13425,7 +14425,7 @@ func SetExtensionCertificate(ctx context.Context, r soap.RoundTripper, req *type type SetFieldBody struct { Req *types.SetField `xml:"urn:vim25 SetField,omitempty"` - Res *types.SetFieldResponse `xml:"urn:vim25 SetFieldResponse,omitempty"` + Res *types.SetFieldResponse `xml:"SetFieldResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13445,7 +14445,7 @@ func SetField(ctx context.Context, r soap.RoundTripper, req *types.SetField) (*t type SetLicenseEditionBody struct { Req *types.SetLicenseEdition `xml:"urn:vim25 SetLicenseEdition,omitempty"` - Res *types.SetLicenseEditionResponse `xml:"urn:vim25 SetLicenseEditionResponse,omitempty"` + Res *types.SetLicenseEditionResponse `xml:"SetLicenseEditionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13465,7 +14465,7 @@ func SetLicenseEdition(ctx context.Context, r soap.RoundTripper, req *types.SetL type SetLocaleBody struct { Req *types.SetLocale `xml:"urn:vim25 SetLocale,omitempty"` - Res *types.SetLocaleResponse `xml:"urn:vim25 SetLocaleResponse,omitempty"` + Res *types.SetLocaleResponse `xml:"SetLocaleResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13485,7 +14485,7 @@ func SetLocale(ctx context.Context, r soap.RoundTripper, req *types.SetLocale) ( type SetMultipathLunPolicyBody struct { Req *types.SetMultipathLunPolicy `xml:"urn:vim25 SetMultipathLunPolicy,omitempty"` - Res *types.SetMultipathLunPolicyResponse `xml:"urn:vim25 SetMultipathLunPolicyResponse,omitempty"` + Res *types.SetMultipathLunPolicyResponse `xml:"SetMultipathLunPolicyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13505,7 +14505,7 @@ func SetMultipathLunPolicy(ctx context.Context, r soap.RoundTripper, req *types. type SetNFSUserBody struct { Req *types.SetNFSUser `xml:"urn:vim25 SetNFSUser,omitempty"` - Res *types.SetNFSUserResponse `xml:"urn:vim25 SetNFSUserResponse,omitempty"` + Res *types.SetNFSUserResponse `xml:"SetNFSUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13525,7 +14525,7 @@ func SetNFSUser(ctx context.Context, r soap.RoundTripper, req *types.SetNFSUser) type SetPublicKeyBody struct { Req *types.SetPublicKey `xml:"urn:vim25 SetPublicKey,omitempty"` - Res *types.SetPublicKeyResponse `xml:"urn:vim25 SetPublicKeyResponse,omitempty"` + Res *types.SetPublicKeyResponse `xml:"SetPublicKeyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13545,7 +14545,7 @@ func SetPublicKey(ctx context.Context, r soap.RoundTripper, req *types.SetPublic type SetRegistryValueInGuestBody struct { Req *types.SetRegistryValueInGuest `xml:"urn:vim25 SetRegistryValueInGuest,omitempty"` - Res *types.SetRegistryValueInGuestResponse `xml:"urn:vim25 SetRegistryValueInGuestResponse,omitempty"` + Res *types.SetRegistryValueInGuestResponse `xml:"SetRegistryValueInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13565,7 +14565,7 @@ func SetRegistryValueInGuest(ctx context.Context, r soap.RoundTripper, req *type type SetScreenResolutionBody struct { Req *types.SetScreenResolution `xml:"urn:vim25 SetScreenResolution,omitempty"` - Res *types.SetScreenResolutionResponse `xml:"urn:vim25 SetScreenResolutionResponse,omitempty"` + Res *types.SetScreenResolutionResponse `xml:"SetScreenResolutionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13585,7 +14585,7 @@ func SetScreenResolution(ctx context.Context, r soap.RoundTripper, req *types.Se type SetTaskDescriptionBody struct { Req *types.SetTaskDescription `xml:"urn:vim25 SetTaskDescription,omitempty"` - Res *types.SetTaskDescriptionResponse `xml:"urn:vim25 SetTaskDescriptionResponse,omitempty"` + Res *types.SetTaskDescriptionResponse `xml:"SetTaskDescriptionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13605,7 +14605,7 @@ func SetTaskDescription(ctx context.Context, r soap.RoundTripper, req *types.Set type SetTaskStateBody struct { Req *types.SetTaskState `xml:"urn:vim25 SetTaskState,omitempty"` - Res *types.SetTaskStateResponse `xml:"urn:vim25 SetTaskStateResponse,omitempty"` + Res *types.SetTaskStateResponse `xml:"SetTaskStateResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13623,9 +14623,29 @@ func SetTaskState(ctx context.Context, r soap.RoundTripper, req *types.SetTaskSt return resBody.Res, nil } +type SetVStorageObjectControlFlagsBody struct { + Req *types.SetVStorageObjectControlFlags `xml:"urn:vim25 SetVStorageObjectControlFlags,omitempty"` + Res *types.SetVStorageObjectControlFlagsResponse `xml:"SetVStorageObjectControlFlagsResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *SetVStorageObjectControlFlagsBody) Fault() *soap.Fault { return b.Fault_ } + +func SetVStorageObjectControlFlags(ctx context.Context, r soap.RoundTripper, req *types.SetVStorageObjectControlFlags) (*types.SetVStorageObjectControlFlagsResponse, error) { + var reqBody, resBody SetVStorageObjectControlFlagsBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type SetVirtualDiskUuidBody struct { Req *types.SetVirtualDiskUuid `xml:"urn:vim25 SetVirtualDiskUuid,omitempty"` - Res *types.SetVirtualDiskUuidResponse `xml:"urn:vim25 SetVirtualDiskUuidResponse,omitempty"` + Res *types.SetVirtualDiskUuidResponse `xml:"SetVirtualDiskUuidResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13645,7 +14665,7 @@ func SetVirtualDiskUuid(ctx context.Context, r soap.RoundTripper, req *types.Set type ShrinkVirtualDisk_TaskBody struct { Req *types.ShrinkVirtualDisk_Task `xml:"urn:vim25 ShrinkVirtualDisk_Task,omitempty"` - Res *types.ShrinkVirtualDisk_TaskResponse `xml:"urn:vim25 ShrinkVirtualDisk_TaskResponse,omitempty"` + Res *types.ShrinkVirtualDisk_TaskResponse `xml:"ShrinkVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13665,7 +14685,7 @@ func ShrinkVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types type ShutdownGuestBody struct { Req *types.ShutdownGuest `xml:"urn:vim25 ShutdownGuest,omitempty"` - Res *types.ShutdownGuestResponse `xml:"urn:vim25 ShutdownGuestResponse,omitempty"` + Res *types.ShutdownGuestResponse `xml:"ShutdownGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13685,7 +14705,7 @@ func ShutdownGuest(ctx context.Context, r soap.RoundTripper, req *types.Shutdown type ShutdownHost_TaskBody struct { Req *types.ShutdownHost_Task `xml:"urn:vim25 ShutdownHost_Task,omitempty"` - Res *types.ShutdownHost_TaskResponse `xml:"urn:vim25 ShutdownHost_TaskResponse,omitempty"` + Res *types.ShutdownHost_TaskResponse `xml:"ShutdownHost_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13705,7 +14725,7 @@ func ShutdownHost_Task(ctx context.Context, r soap.RoundTripper, req *types.Shut type StageHostPatch_TaskBody struct { Req *types.StageHostPatch_Task `xml:"urn:vim25 StageHostPatch_Task,omitempty"` - Res *types.StageHostPatch_TaskResponse `xml:"urn:vim25 StageHostPatch_TaskResponse,omitempty"` + Res *types.StageHostPatch_TaskResponse `xml:"StageHostPatch_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13725,7 +14745,7 @@ func StageHostPatch_Task(ctx context.Context, r soap.RoundTripper, req *types.St type StampAllRulesWithUuid_TaskBody struct { Req *types.StampAllRulesWithUuid_Task `xml:"urn:vim25 StampAllRulesWithUuid_Task,omitempty"` - Res *types.StampAllRulesWithUuid_TaskResponse `xml:"urn:vim25 StampAllRulesWithUuid_TaskResponse,omitempty"` + Res *types.StampAllRulesWithUuid_TaskResponse `xml:"StampAllRulesWithUuid_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13745,7 +14765,7 @@ func StampAllRulesWithUuid_Task(ctx context.Context, r soap.RoundTripper, req *t type StandbyGuestBody struct { Req *types.StandbyGuest `xml:"urn:vim25 StandbyGuest,omitempty"` - Res *types.StandbyGuestResponse `xml:"urn:vim25 StandbyGuestResponse,omitempty"` + Res *types.StandbyGuestResponse `xml:"StandbyGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13765,7 +14785,7 @@ func StandbyGuest(ctx context.Context, r soap.RoundTripper, req *types.StandbyGu type StartProgramInGuestBody struct { Req *types.StartProgramInGuest `xml:"urn:vim25 StartProgramInGuest,omitempty"` - Res *types.StartProgramInGuestResponse `xml:"urn:vim25 StartProgramInGuestResponse,omitempty"` + Res *types.StartProgramInGuestResponse `xml:"StartProgramInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13785,7 +14805,7 @@ func StartProgramInGuest(ctx context.Context, r soap.RoundTripper, req *types.St type StartRecording_TaskBody struct { Req *types.StartRecording_Task `xml:"urn:vim25 StartRecording_Task,omitempty"` - Res *types.StartRecording_TaskResponse `xml:"urn:vim25 StartRecording_TaskResponse,omitempty"` + Res *types.StartRecording_TaskResponse `xml:"StartRecording_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13805,7 +14825,7 @@ func StartRecording_Task(ctx context.Context, r soap.RoundTripper, req *types.St type StartReplaying_TaskBody struct { Req *types.StartReplaying_Task `xml:"urn:vim25 StartReplaying_Task,omitempty"` - Res *types.StartReplaying_TaskResponse `xml:"urn:vim25 StartReplaying_TaskResponse,omitempty"` + Res *types.StartReplaying_TaskResponse `xml:"StartReplaying_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13825,7 +14845,7 @@ func StartReplaying_Task(ctx context.Context, r soap.RoundTripper, req *types.St type StartServiceBody struct { Req *types.StartService `xml:"urn:vim25 StartService,omitempty"` - Res *types.StartServiceResponse `xml:"urn:vim25 StartServiceResponse,omitempty"` + Res *types.StartServiceResponse `xml:"StartServiceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13845,7 +14865,7 @@ func StartService(ctx context.Context, r soap.RoundTripper, req *types.StartServ type StopRecording_TaskBody struct { Req *types.StopRecording_Task `xml:"urn:vim25 StopRecording_Task,omitempty"` - Res *types.StopRecording_TaskResponse `xml:"urn:vim25 StopRecording_TaskResponse,omitempty"` + Res *types.StopRecording_TaskResponse `xml:"StopRecording_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13865,7 +14885,7 @@ func StopRecording_Task(ctx context.Context, r soap.RoundTripper, req *types.Sto type StopReplaying_TaskBody struct { Req *types.StopReplaying_Task `xml:"urn:vim25 StopReplaying_Task,omitempty"` - Res *types.StopReplaying_TaskResponse `xml:"urn:vim25 StopReplaying_TaskResponse,omitempty"` + Res *types.StopReplaying_TaskResponse `xml:"StopReplaying_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13885,7 +14905,7 @@ func StopReplaying_Task(ctx context.Context, r soap.RoundTripper, req *types.Sto type StopServiceBody struct { Req *types.StopService `xml:"urn:vim25 StopService,omitempty"` - Res *types.StopServiceResponse `xml:"urn:vim25 StopServiceResponse,omitempty"` + Res *types.StopServiceResponse `xml:"StopServiceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13905,7 +14925,7 @@ func StopService(ctx context.Context, r soap.RoundTripper, req *types.StopServic type SuspendVApp_TaskBody struct { Req *types.SuspendVApp_Task `xml:"urn:vim25 SuspendVApp_Task,omitempty"` - Res *types.SuspendVApp_TaskResponse `xml:"urn:vim25 SuspendVApp_TaskResponse,omitempty"` + Res *types.SuspendVApp_TaskResponse `xml:"SuspendVApp_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13925,7 +14945,7 @@ func SuspendVApp_Task(ctx context.Context, r soap.RoundTripper, req *types.Suspe type SuspendVM_TaskBody struct { Req *types.SuspendVM_Task `xml:"urn:vim25 SuspendVM_Task,omitempty"` - Res *types.SuspendVM_TaskResponse `xml:"urn:vim25 SuspendVM_TaskResponse,omitempty"` + Res *types.SuspendVM_TaskResponse `xml:"SuspendVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13945,7 +14965,7 @@ func SuspendVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Suspend type TerminateFaultTolerantVM_TaskBody struct { Req *types.TerminateFaultTolerantVM_Task `xml:"urn:vim25 TerminateFaultTolerantVM_Task,omitempty"` - Res *types.TerminateFaultTolerantVM_TaskResponse `xml:"urn:vim25 TerminateFaultTolerantVM_TaskResponse,omitempty"` + Res *types.TerminateFaultTolerantVM_TaskResponse `xml:"TerminateFaultTolerantVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13965,7 +14985,7 @@ func TerminateFaultTolerantVM_Task(ctx context.Context, r soap.RoundTripper, req type TerminateProcessInGuestBody struct { Req *types.TerminateProcessInGuest `xml:"urn:vim25 TerminateProcessInGuest,omitempty"` - Res *types.TerminateProcessInGuestResponse `xml:"urn:vim25 TerminateProcessInGuestResponse,omitempty"` + Res *types.TerminateProcessInGuestResponse `xml:"TerminateProcessInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -13985,7 +15005,7 @@ func TerminateProcessInGuest(ctx context.Context, r soap.RoundTripper, req *type type TerminateSessionBody struct { Req *types.TerminateSession `xml:"urn:vim25 TerminateSession,omitempty"` - Res *types.TerminateSessionResponse `xml:"urn:vim25 TerminateSessionResponse,omitempty"` + Res *types.TerminateSessionResponse `xml:"TerminateSessionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14005,7 +15025,7 @@ func TerminateSession(ctx context.Context, r soap.RoundTripper, req *types.Termi type TerminateVMBody struct { Req *types.TerminateVM `xml:"urn:vim25 TerminateVM,omitempty"` - Res *types.TerminateVMResponse `xml:"urn:vim25 TerminateVMResponse,omitempty"` + Res *types.TerminateVMResponse `xml:"TerminateVMResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14025,7 +15045,7 @@ func TerminateVM(ctx context.Context, r soap.RoundTripper, req *types.TerminateV type TurnDiskLocatorLedOff_TaskBody struct { Req *types.TurnDiskLocatorLedOff_Task `xml:"urn:vim25 TurnDiskLocatorLedOff_Task,omitempty"` - Res *types.TurnDiskLocatorLedOff_TaskResponse `xml:"urn:vim25 TurnDiskLocatorLedOff_TaskResponse,omitempty"` + Res *types.TurnDiskLocatorLedOff_TaskResponse `xml:"TurnDiskLocatorLedOff_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14045,7 +15065,7 @@ func TurnDiskLocatorLedOff_Task(ctx context.Context, r soap.RoundTripper, req *t type TurnDiskLocatorLedOn_TaskBody struct { Req *types.TurnDiskLocatorLedOn_Task `xml:"urn:vim25 TurnDiskLocatorLedOn_Task,omitempty"` - Res *types.TurnDiskLocatorLedOn_TaskResponse `xml:"urn:vim25 TurnDiskLocatorLedOn_TaskResponse,omitempty"` + Res *types.TurnDiskLocatorLedOn_TaskResponse `xml:"TurnDiskLocatorLedOn_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14065,7 +15085,7 @@ func TurnDiskLocatorLedOn_Task(ctx context.Context, r soap.RoundTripper, req *ty type TurnOffFaultToleranceForVM_TaskBody struct { Req *types.TurnOffFaultToleranceForVM_Task `xml:"urn:vim25 TurnOffFaultToleranceForVM_Task,omitempty"` - Res *types.TurnOffFaultToleranceForVM_TaskResponse `xml:"urn:vim25 TurnOffFaultToleranceForVM_TaskResponse,omitempty"` + Res *types.TurnOffFaultToleranceForVM_TaskResponse `xml:"TurnOffFaultToleranceForVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14085,7 +15105,7 @@ func TurnOffFaultToleranceForVM_Task(ctx context.Context, r soap.RoundTripper, r type UnassignUserFromGroupBody struct { Req *types.UnassignUserFromGroup `xml:"urn:vim25 UnassignUserFromGroup,omitempty"` - Res *types.UnassignUserFromGroupResponse `xml:"urn:vim25 UnassignUserFromGroupResponse,omitempty"` + Res *types.UnassignUserFromGroupResponse `xml:"UnassignUserFromGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14105,7 +15125,7 @@ func UnassignUserFromGroup(ctx context.Context, r soap.RoundTripper, req *types. type UnbindVnicBody struct { Req *types.UnbindVnic `xml:"urn:vim25 UnbindVnic,omitempty"` - Res *types.UnbindVnicResponse `xml:"urn:vim25 UnbindVnicResponse,omitempty"` + Res *types.UnbindVnicResponse `xml:"UnbindVnicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14125,7 +15145,7 @@ func UnbindVnic(ctx context.Context, r soap.RoundTripper, req *types.UnbindVnic) type UninstallHostPatch_TaskBody struct { Req *types.UninstallHostPatch_Task `xml:"urn:vim25 UninstallHostPatch_Task,omitempty"` - Res *types.UninstallHostPatch_TaskResponse `xml:"urn:vim25 UninstallHostPatch_TaskResponse,omitempty"` + Res *types.UninstallHostPatch_TaskResponse `xml:"UninstallHostPatch_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14145,7 +15165,7 @@ func UninstallHostPatch_Task(ctx context.Context, r soap.RoundTripper, req *type type UninstallIoFilter_TaskBody struct { Req *types.UninstallIoFilter_Task `xml:"urn:vim25 UninstallIoFilter_Task,omitempty"` - Res *types.UninstallIoFilter_TaskResponse `xml:"urn:vim25 UninstallIoFilter_TaskResponse,omitempty"` + Res *types.UninstallIoFilter_TaskResponse `xml:"UninstallIoFilter_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14165,7 +15185,7 @@ func UninstallIoFilter_Task(ctx context.Context, r soap.RoundTripper, req *types type UninstallServiceBody struct { Req *types.UninstallService `xml:"urn:vim25 UninstallService,omitempty"` - Res *types.UninstallServiceResponse `xml:"urn:vim25 UninstallServiceResponse,omitempty"` + Res *types.UninstallServiceResponse `xml:"UninstallServiceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14185,7 +15205,7 @@ func UninstallService(ctx context.Context, r soap.RoundTripper, req *types.Unins type UnmapVmfsVolumeEx_TaskBody struct { Req *types.UnmapVmfsVolumeEx_Task `xml:"urn:vim25 UnmapVmfsVolumeEx_Task,omitempty"` - Res *types.UnmapVmfsVolumeEx_TaskResponse `xml:"urn:vim25 UnmapVmfsVolumeEx_TaskResponse,omitempty"` + Res *types.UnmapVmfsVolumeEx_TaskResponse `xml:"UnmapVmfsVolumeEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14205,7 +15225,7 @@ func UnmapVmfsVolumeEx_Task(ctx context.Context, r soap.RoundTripper, req *types type UnmountDiskMapping_TaskBody struct { Req *types.UnmountDiskMapping_Task `xml:"urn:vim25 UnmountDiskMapping_Task,omitempty"` - Res *types.UnmountDiskMapping_TaskResponse `xml:"urn:vim25 UnmountDiskMapping_TaskResponse,omitempty"` + Res *types.UnmountDiskMapping_TaskResponse `xml:"UnmountDiskMapping_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14225,7 +15245,7 @@ func UnmountDiskMapping_Task(ctx context.Context, r soap.RoundTripper, req *type type UnmountForceMountedVmfsVolumeBody struct { Req *types.UnmountForceMountedVmfsVolume `xml:"urn:vim25 UnmountForceMountedVmfsVolume,omitempty"` - Res *types.UnmountForceMountedVmfsVolumeResponse `xml:"urn:vim25 UnmountForceMountedVmfsVolumeResponse,omitempty"` + Res *types.UnmountForceMountedVmfsVolumeResponse `xml:"UnmountForceMountedVmfsVolumeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14245,7 +15265,7 @@ func UnmountForceMountedVmfsVolume(ctx context.Context, r soap.RoundTripper, req type UnmountToolsInstallerBody struct { Req *types.UnmountToolsInstaller `xml:"urn:vim25 UnmountToolsInstaller,omitempty"` - Res *types.UnmountToolsInstallerResponse `xml:"urn:vim25 UnmountToolsInstallerResponse,omitempty"` + Res *types.UnmountToolsInstallerResponse `xml:"UnmountToolsInstallerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14265,7 +15285,7 @@ func UnmountToolsInstaller(ctx context.Context, r soap.RoundTripper, req *types. type UnmountVffsVolumeBody struct { Req *types.UnmountVffsVolume `xml:"urn:vim25 UnmountVffsVolume,omitempty"` - Res *types.UnmountVffsVolumeResponse `xml:"urn:vim25 UnmountVffsVolumeResponse,omitempty"` + Res *types.UnmountVffsVolumeResponse `xml:"UnmountVffsVolumeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14285,7 +15305,7 @@ func UnmountVffsVolume(ctx context.Context, r soap.RoundTripper, req *types.Unmo type UnmountVmfsVolumeBody struct { Req *types.UnmountVmfsVolume `xml:"urn:vim25 UnmountVmfsVolume,omitempty"` - Res *types.UnmountVmfsVolumeResponse `xml:"urn:vim25 UnmountVmfsVolumeResponse,omitempty"` + Res *types.UnmountVmfsVolumeResponse `xml:"UnmountVmfsVolumeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14305,7 +15325,7 @@ func UnmountVmfsVolume(ctx context.Context, r soap.RoundTripper, req *types.Unmo type UnmountVmfsVolumeEx_TaskBody struct { Req *types.UnmountVmfsVolumeEx_Task `xml:"urn:vim25 UnmountVmfsVolumeEx_Task,omitempty"` - Res *types.UnmountVmfsVolumeEx_TaskResponse `xml:"urn:vim25 UnmountVmfsVolumeEx_TaskResponse,omitempty"` + Res *types.UnmountVmfsVolumeEx_TaskResponse `xml:"UnmountVmfsVolumeEx_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14325,7 +15345,7 @@ func UnmountVmfsVolumeEx_Task(ctx context.Context, r soap.RoundTripper, req *typ type UnregisterAndDestroy_TaskBody struct { Req *types.UnregisterAndDestroy_Task `xml:"urn:vim25 UnregisterAndDestroy_Task,omitempty"` - Res *types.UnregisterAndDestroy_TaskResponse `xml:"urn:vim25 UnregisterAndDestroy_TaskResponse,omitempty"` + Res *types.UnregisterAndDestroy_TaskResponse `xml:"UnregisterAndDestroy_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14345,7 +15365,7 @@ func UnregisterAndDestroy_Task(ctx context.Context, r soap.RoundTripper, req *ty type UnregisterExtensionBody struct { Req *types.UnregisterExtension `xml:"urn:vim25 UnregisterExtension,omitempty"` - Res *types.UnregisterExtensionResponse `xml:"urn:vim25 UnregisterExtensionResponse,omitempty"` + Res *types.UnregisterExtensionResponse `xml:"UnregisterExtensionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14365,7 +15385,7 @@ func UnregisterExtension(ctx context.Context, r soap.RoundTripper, req *types.Un type UnregisterHealthUpdateProviderBody struct { Req *types.UnregisterHealthUpdateProvider `xml:"urn:vim25 UnregisterHealthUpdateProvider,omitempty"` - Res *types.UnregisterHealthUpdateProviderResponse `xml:"urn:vim25 UnregisterHealthUpdateProviderResponse,omitempty"` + Res *types.UnregisterHealthUpdateProviderResponse `xml:"UnregisterHealthUpdateProviderResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14385,7 +15405,7 @@ func UnregisterHealthUpdateProvider(ctx context.Context, r soap.RoundTripper, re type UnregisterVMBody struct { Req *types.UnregisterVM `xml:"urn:vim25 UnregisterVM,omitempty"` - Res *types.UnregisterVMResponse `xml:"urn:vim25 UnregisterVMResponse,omitempty"` + Res *types.UnregisterVMResponse `xml:"UnregisterVMResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14405,7 +15425,7 @@ func UnregisterVM(ctx context.Context, r soap.RoundTripper, req *types.Unregiste type UpdateAnswerFile_TaskBody struct { Req *types.UpdateAnswerFile_Task `xml:"urn:vim25 UpdateAnswerFile_Task,omitempty"` - Res *types.UpdateAnswerFile_TaskResponse `xml:"urn:vim25 UpdateAnswerFile_TaskResponse,omitempty"` + Res *types.UpdateAnswerFile_TaskResponse `xml:"UpdateAnswerFile_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14425,7 +15445,7 @@ func UpdateAnswerFile_Task(ctx context.Context, r soap.RoundTripper, req *types. type UpdateAssignedLicenseBody struct { Req *types.UpdateAssignedLicense `xml:"urn:vim25 UpdateAssignedLicense,omitempty"` - Res *types.UpdateAssignedLicenseResponse `xml:"urn:vim25 UpdateAssignedLicenseResponse,omitempty"` + Res *types.UpdateAssignedLicenseResponse `xml:"UpdateAssignedLicenseResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14445,7 +15465,7 @@ func UpdateAssignedLicense(ctx context.Context, r soap.RoundTripper, req *types. type UpdateAuthorizationRoleBody struct { Req *types.UpdateAuthorizationRole `xml:"urn:vim25 UpdateAuthorizationRole,omitempty"` - Res *types.UpdateAuthorizationRoleResponse `xml:"urn:vim25 UpdateAuthorizationRoleResponse,omitempty"` + Res *types.UpdateAuthorizationRoleResponse `xml:"UpdateAuthorizationRoleResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14465,7 +15485,7 @@ func UpdateAuthorizationRole(ctx context.Context, r soap.RoundTripper, req *type type UpdateBootDeviceBody struct { Req *types.UpdateBootDevice `xml:"urn:vim25 UpdateBootDevice,omitempty"` - Res *types.UpdateBootDeviceResponse `xml:"urn:vim25 UpdateBootDeviceResponse,omitempty"` + Res *types.UpdateBootDeviceResponse `xml:"UpdateBootDeviceResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14485,7 +15505,7 @@ func UpdateBootDevice(ctx context.Context, r soap.RoundTripper, req *types.Updat type UpdateChildResourceConfigurationBody struct { Req *types.UpdateChildResourceConfiguration `xml:"urn:vim25 UpdateChildResourceConfiguration,omitempty"` - Res *types.UpdateChildResourceConfigurationResponse `xml:"urn:vim25 UpdateChildResourceConfigurationResponse,omitempty"` + Res *types.UpdateChildResourceConfigurationResponse `xml:"UpdateChildResourceConfigurationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14505,7 +15525,7 @@ func UpdateChildResourceConfiguration(ctx context.Context, r soap.RoundTripper, type UpdateClusterProfileBody struct { Req *types.UpdateClusterProfile `xml:"urn:vim25 UpdateClusterProfile,omitempty"` - Res *types.UpdateClusterProfileResponse `xml:"urn:vim25 UpdateClusterProfileResponse,omitempty"` + Res *types.UpdateClusterProfileResponse `xml:"UpdateClusterProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14525,7 +15545,7 @@ func UpdateClusterProfile(ctx context.Context, r soap.RoundTripper, req *types.U type UpdateConfigBody struct { Req *types.UpdateConfig `xml:"urn:vim25 UpdateConfig,omitempty"` - Res *types.UpdateConfigResponse `xml:"urn:vim25 UpdateConfigResponse,omitempty"` + Res *types.UpdateConfigResponse `xml:"UpdateConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14545,7 +15565,7 @@ func UpdateConfig(ctx context.Context, r soap.RoundTripper, req *types.UpdateCon type UpdateConsoleIpRouteConfigBody struct { Req *types.UpdateConsoleIpRouteConfig `xml:"urn:vim25 UpdateConsoleIpRouteConfig,omitempty"` - Res *types.UpdateConsoleIpRouteConfigResponse `xml:"urn:vim25 UpdateConsoleIpRouteConfigResponse,omitempty"` + Res *types.UpdateConsoleIpRouteConfigResponse `xml:"UpdateConsoleIpRouteConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14565,7 +15585,7 @@ func UpdateConsoleIpRouteConfig(ctx context.Context, r soap.RoundTripper, req *t type UpdateCounterLevelMappingBody struct { Req *types.UpdateCounterLevelMapping `xml:"urn:vim25 UpdateCounterLevelMapping,omitempty"` - Res *types.UpdateCounterLevelMappingResponse `xml:"urn:vim25 UpdateCounterLevelMappingResponse,omitempty"` + Res *types.UpdateCounterLevelMappingResponse `xml:"UpdateCounterLevelMappingResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14585,7 +15605,7 @@ func UpdateCounterLevelMapping(ctx context.Context, r soap.RoundTripper, req *ty type UpdateDVSHealthCheckConfig_TaskBody struct { Req *types.UpdateDVSHealthCheckConfig_Task `xml:"urn:vim25 UpdateDVSHealthCheckConfig_Task,omitempty"` - Res *types.UpdateDVSHealthCheckConfig_TaskResponse `xml:"urn:vim25 UpdateDVSHealthCheckConfig_TaskResponse,omitempty"` + Res *types.UpdateDVSHealthCheckConfig_TaskResponse `xml:"UpdateDVSHealthCheckConfig_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14605,7 +15625,7 @@ func UpdateDVSHealthCheckConfig_Task(ctx context.Context, r soap.RoundTripper, r type UpdateDVSLacpGroupConfig_TaskBody struct { Req *types.UpdateDVSLacpGroupConfig_Task `xml:"urn:vim25 UpdateDVSLacpGroupConfig_Task,omitempty"` - Res *types.UpdateDVSLacpGroupConfig_TaskResponse `xml:"urn:vim25 UpdateDVSLacpGroupConfig_TaskResponse,omitempty"` + Res *types.UpdateDVSLacpGroupConfig_TaskResponse `xml:"UpdateDVSLacpGroupConfig_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14625,7 +15645,7 @@ func UpdateDVSLacpGroupConfig_Task(ctx context.Context, r soap.RoundTripper, req type UpdateDateTimeBody struct { Req *types.UpdateDateTime `xml:"urn:vim25 UpdateDateTime,omitempty"` - Res *types.UpdateDateTimeResponse `xml:"urn:vim25 UpdateDateTimeResponse,omitempty"` + Res *types.UpdateDateTimeResponse `xml:"UpdateDateTimeResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14645,7 +15665,7 @@ func UpdateDateTime(ctx context.Context, r soap.RoundTripper, req *types.UpdateD type UpdateDateTimeConfigBody struct { Req *types.UpdateDateTimeConfig `xml:"urn:vim25 UpdateDateTimeConfig,omitempty"` - Res *types.UpdateDateTimeConfigResponse `xml:"urn:vim25 UpdateDateTimeConfigResponse,omitempty"` + Res *types.UpdateDateTimeConfigResponse `xml:"UpdateDateTimeConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14665,7 +15685,7 @@ func UpdateDateTimeConfig(ctx context.Context, r soap.RoundTripper, req *types.U type UpdateDefaultPolicyBody struct { Req *types.UpdateDefaultPolicy `xml:"urn:vim25 UpdateDefaultPolicy,omitempty"` - Res *types.UpdateDefaultPolicyResponse `xml:"urn:vim25 UpdateDefaultPolicyResponse,omitempty"` + Res *types.UpdateDefaultPolicyResponse `xml:"UpdateDefaultPolicyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14685,7 +15705,7 @@ func UpdateDefaultPolicy(ctx context.Context, r soap.RoundTripper, req *types.Up type UpdateDiskPartitionsBody struct { Req *types.UpdateDiskPartitions `xml:"urn:vim25 UpdateDiskPartitions,omitempty"` - Res *types.UpdateDiskPartitionsResponse `xml:"urn:vim25 UpdateDiskPartitionsResponse,omitempty"` + Res *types.UpdateDiskPartitionsResponse `xml:"UpdateDiskPartitionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14705,7 +15725,7 @@ func UpdateDiskPartitions(ctx context.Context, r soap.RoundTripper, req *types.U type UpdateDnsConfigBody struct { Req *types.UpdateDnsConfig `xml:"urn:vim25 UpdateDnsConfig,omitempty"` - Res *types.UpdateDnsConfigResponse `xml:"urn:vim25 UpdateDnsConfigResponse,omitempty"` + Res *types.UpdateDnsConfigResponse `xml:"UpdateDnsConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14725,7 +15745,7 @@ func UpdateDnsConfig(ctx context.Context, r soap.RoundTripper, req *types.Update type UpdateDvsCapabilityBody struct { Req *types.UpdateDvsCapability `xml:"urn:vim25 UpdateDvsCapability,omitempty"` - Res *types.UpdateDvsCapabilityResponse `xml:"urn:vim25 UpdateDvsCapabilityResponse,omitempty"` + Res *types.UpdateDvsCapabilityResponse `xml:"UpdateDvsCapabilityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14745,7 +15765,7 @@ func UpdateDvsCapability(ctx context.Context, r soap.RoundTripper, req *types.Up type UpdateExtensionBody struct { Req *types.UpdateExtension `xml:"urn:vim25 UpdateExtension,omitempty"` - Res *types.UpdateExtensionResponse `xml:"urn:vim25 UpdateExtensionResponse,omitempty"` + Res *types.UpdateExtensionResponse `xml:"UpdateExtensionResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14765,7 +15785,7 @@ func UpdateExtension(ctx context.Context, r soap.RoundTripper, req *types.Update type UpdateFlagsBody struct { Req *types.UpdateFlags `xml:"urn:vim25 UpdateFlags,omitempty"` - Res *types.UpdateFlagsResponse `xml:"urn:vim25 UpdateFlagsResponse,omitempty"` + Res *types.UpdateFlagsResponse `xml:"UpdateFlagsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14785,7 +15805,7 @@ func UpdateFlags(ctx context.Context, r soap.RoundTripper, req *types.UpdateFlag type UpdateGraphicsConfigBody struct { Req *types.UpdateGraphicsConfig `xml:"urn:vim25 UpdateGraphicsConfig,omitempty"` - Res *types.UpdateGraphicsConfigResponse `xml:"urn:vim25 UpdateGraphicsConfigResponse,omitempty"` + Res *types.UpdateGraphicsConfigResponse `xml:"UpdateGraphicsConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14805,7 +15825,7 @@ func UpdateGraphicsConfig(ctx context.Context, r soap.RoundTripper, req *types.U type UpdateHostCustomizations_TaskBody struct { Req *types.UpdateHostCustomizations_Task `xml:"urn:vim25 UpdateHostCustomizations_Task,omitempty"` - Res *types.UpdateHostCustomizations_TaskResponse `xml:"urn:vim25 UpdateHostCustomizations_TaskResponse,omitempty"` + Res *types.UpdateHostCustomizations_TaskResponse `xml:"UpdateHostCustomizations_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14825,7 +15845,7 @@ func UpdateHostCustomizations_Task(ctx context.Context, r soap.RoundTripper, req type UpdateHostImageAcceptanceLevelBody struct { Req *types.UpdateHostImageAcceptanceLevel `xml:"urn:vim25 UpdateHostImageAcceptanceLevel,omitempty"` - Res *types.UpdateHostImageAcceptanceLevelResponse `xml:"urn:vim25 UpdateHostImageAcceptanceLevelResponse,omitempty"` + Res *types.UpdateHostImageAcceptanceLevelResponse `xml:"UpdateHostImageAcceptanceLevelResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14845,7 +15865,7 @@ func UpdateHostImageAcceptanceLevel(ctx context.Context, r soap.RoundTripper, re type UpdateHostProfileBody struct { Req *types.UpdateHostProfile `xml:"urn:vim25 UpdateHostProfile,omitempty"` - Res *types.UpdateHostProfileResponse `xml:"urn:vim25 UpdateHostProfileResponse,omitempty"` + Res *types.UpdateHostProfileResponse `xml:"UpdateHostProfileResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14865,7 +15885,7 @@ func UpdateHostProfile(ctx context.Context, r soap.RoundTripper, req *types.Upda type UpdateHostSpecificationBody struct { Req *types.UpdateHostSpecification `xml:"urn:vim25 UpdateHostSpecification,omitempty"` - Res *types.UpdateHostSpecificationResponse `xml:"urn:vim25 UpdateHostSpecificationResponse,omitempty"` + Res *types.UpdateHostSpecificationResponse `xml:"UpdateHostSpecificationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14885,7 +15905,7 @@ func UpdateHostSpecification(ctx context.Context, r soap.RoundTripper, req *type type UpdateHostSubSpecificationBody struct { Req *types.UpdateHostSubSpecification `xml:"urn:vim25 UpdateHostSubSpecification,omitempty"` - Res *types.UpdateHostSubSpecificationResponse `xml:"urn:vim25 UpdateHostSubSpecificationResponse,omitempty"` + Res *types.UpdateHostSubSpecificationResponse `xml:"UpdateHostSubSpecificationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14905,7 +15925,7 @@ func UpdateHostSubSpecification(ctx context.Context, r soap.RoundTripper, req *t type UpdateInternetScsiAdvancedOptionsBody struct { Req *types.UpdateInternetScsiAdvancedOptions `xml:"urn:vim25 UpdateInternetScsiAdvancedOptions,omitempty"` - Res *types.UpdateInternetScsiAdvancedOptionsResponse `xml:"urn:vim25 UpdateInternetScsiAdvancedOptionsResponse,omitempty"` + Res *types.UpdateInternetScsiAdvancedOptionsResponse `xml:"UpdateInternetScsiAdvancedOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14925,7 +15945,7 @@ func UpdateInternetScsiAdvancedOptions(ctx context.Context, r soap.RoundTripper, type UpdateInternetScsiAliasBody struct { Req *types.UpdateInternetScsiAlias `xml:"urn:vim25 UpdateInternetScsiAlias,omitempty"` - Res *types.UpdateInternetScsiAliasResponse `xml:"urn:vim25 UpdateInternetScsiAliasResponse,omitempty"` + Res *types.UpdateInternetScsiAliasResponse `xml:"UpdateInternetScsiAliasResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14945,7 +15965,7 @@ func UpdateInternetScsiAlias(ctx context.Context, r soap.RoundTripper, req *type type UpdateInternetScsiAuthenticationPropertiesBody struct { Req *types.UpdateInternetScsiAuthenticationProperties `xml:"urn:vim25 UpdateInternetScsiAuthenticationProperties,omitempty"` - Res *types.UpdateInternetScsiAuthenticationPropertiesResponse `xml:"urn:vim25 UpdateInternetScsiAuthenticationPropertiesResponse,omitempty"` + Res *types.UpdateInternetScsiAuthenticationPropertiesResponse `xml:"UpdateInternetScsiAuthenticationPropertiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14965,7 +15985,7 @@ func UpdateInternetScsiAuthenticationProperties(ctx context.Context, r soap.Roun type UpdateInternetScsiDigestPropertiesBody struct { Req *types.UpdateInternetScsiDigestProperties `xml:"urn:vim25 UpdateInternetScsiDigestProperties,omitempty"` - Res *types.UpdateInternetScsiDigestPropertiesResponse `xml:"urn:vim25 UpdateInternetScsiDigestPropertiesResponse,omitempty"` + Res *types.UpdateInternetScsiDigestPropertiesResponse `xml:"UpdateInternetScsiDigestPropertiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -14985,7 +16005,7 @@ func UpdateInternetScsiDigestProperties(ctx context.Context, r soap.RoundTripper type UpdateInternetScsiDiscoveryPropertiesBody struct { Req *types.UpdateInternetScsiDiscoveryProperties `xml:"urn:vim25 UpdateInternetScsiDiscoveryProperties,omitempty"` - Res *types.UpdateInternetScsiDiscoveryPropertiesResponse `xml:"urn:vim25 UpdateInternetScsiDiscoveryPropertiesResponse,omitempty"` + Res *types.UpdateInternetScsiDiscoveryPropertiesResponse `xml:"UpdateInternetScsiDiscoveryPropertiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15005,7 +16025,7 @@ func UpdateInternetScsiDiscoveryProperties(ctx context.Context, r soap.RoundTrip type UpdateInternetScsiIPPropertiesBody struct { Req *types.UpdateInternetScsiIPProperties `xml:"urn:vim25 UpdateInternetScsiIPProperties,omitempty"` - Res *types.UpdateInternetScsiIPPropertiesResponse `xml:"urn:vim25 UpdateInternetScsiIPPropertiesResponse,omitempty"` + Res *types.UpdateInternetScsiIPPropertiesResponse `xml:"UpdateInternetScsiIPPropertiesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15025,7 +16045,7 @@ func UpdateInternetScsiIPProperties(ctx context.Context, r soap.RoundTripper, re type UpdateInternetScsiNameBody struct { Req *types.UpdateInternetScsiName `xml:"urn:vim25 UpdateInternetScsiName,omitempty"` - Res *types.UpdateInternetScsiNameResponse `xml:"urn:vim25 UpdateInternetScsiNameResponse,omitempty"` + Res *types.UpdateInternetScsiNameResponse `xml:"UpdateInternetScsiNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15045,7 +16065,7 @@ func UpdateInternetScsiName(ctx context.Context, r soap.RoundTripper, req *types type UpdateIpConfigBody struct { Req *types.UpdateIpConfig `xml:"urn:vim25 UpdateIpConfig,omitempty"` - Res *types.UpdateIpConfigResponse `xml:"urn:vim25 UpdateIpConfigResponse,omitempty"` + Res *types.UpdateIpConfigResponse `xml:"UpdateIpConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15065,7 +16085,7 @@ func UpdateIpConfig(ctx context.Context, r soap.RoundTripper, req *types.UpdateI type UpdateIpPoolBody struct { Req *types.UpdateIpPool `xml:"urn:vim25 UpdateIpPool,omitempty"` - Res *types.UpdateIpPoolResponse `xml:"urn:vim25 UpdateIpPoolResponse,omitempty"` + Res *types.UpdateIpPoolResponse `xml:"UpdateIpPoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15085,7 +16105,7 @@ func UpdateIpPool(ctx context.Context, r soap.RoundTripper, req *types.UpdateIpP type UpdateIpRouteConfigBody struct { Req *types.UpdateIpRouteConfig `xml:"urn:vim25 UpdateIpRouteConfig,omitempty"` - Res *types.UpdateIpRouteConfigResponse `xml:"urn:vim25 UpdateIpRouteConfigResponse,omitempty"` + Res *types.UpdateIpRouteConfigResponse `xml:"UpdateIpRouteConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15105,7 +16125,7 @@ func UpdateIpRouteConfig(ctx context.Context, r soap.RoundTripper, req *types.Up type UpdateIpRouteTableConfigBody struct { Req *types.UpdateIpRouteTableConfig `xml:"urn:vim25 UpdateIpRouteTableConfig,omitempty"` - Res *types.UpdateIpRouteTableConfigResponse `xml:"urn:vim25 UpdateIpRouteTableConfigResponse,omitempty"` + Res *types.UpdateIpRouteTableConfigResponse `xml:"UpdateIpRouteTableConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15125,7 +16145,7 @@ func UpdateIpRouteTableConfig(ctx context.Context, r soap.RoundTripper, req *typ type UpdateIpmiBody struct { Req *types.UpdateIpmi `xml:"urn:vim25 UpdateIpmi,omitempty"` - Res *types.UpdateIpmiResponse `xml:"urn:vim25 UpdateIpmiResponse,omitempty"` + Res *types.UpdateIpmiResponse `xml:"UpdateIpmiResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15145,7 +16165,7 @@ func UpdateIpmi(ctx context.Context, r soap.RoundTripper, req *types.UpdateIpmi) type UpdateKmipServerBody struct { Req *types.UpdateKmipServer `xml:"urn:vim25 UpdateKmipServer,omitempty"` - Res *types.UpdateKmipServerResponse `xml:"urn:vim25 UpdateKmipServerResponse,omitempty"` + Res *types.UpdateKmipServerResponse `xml:"UpdateKmipServerResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15165,7 +16185,7 @@ func UpdateKmipServer(ctx context.Context, r soap.RoundTripper, req *types.Updat type UpdateKmsSignedCsrClientCertBody struct { Req *types.UpdateKmsSignedCsrClientCert `xml:"urn:vim25 UpdateKmsSignedCsrClientCert,omitempty"` - Res *types.UpdateKmsSignedCsrClientCertResponse `xml:"urn:vim25 UpdateKmsSignedCsrClientCertResponse,omitempty"` + Res *types.UpdateKmsSignedCsrClientCertResponse `xml:"UpdateKmsSignedCsrClientCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15185,7 +16205,7 @@ func UpdateKmsSignedCsrClientCert(ctx context.Context, r soap.RoundTripper, req type UpdateLicenseBody struct { Req *types.UpdateLicense `xml:"urn:vim25 UpdateLicense,omitempty"` - Res *types.UpdateLicenseResponse `xml:"urn:vim25 UpdateLicenseResponse,omitempty"` + Res *types.UpdateLicenseResponse `xml:"UpdateLicenseResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15205,7 +16225,7 @@ func UpdateLicense(ctx context.Context, r soap.RoundTripper, req *types.UpdateLi type UpdateLicenseLabelBody struct { Req *types.UpdateLicenseLabel `xml:"urn:vim25 UpdateLicenseLabel,omitempty"` - Res *types.UpdateLicenseLabelResponse `xml:"urn:vim25 UpdateLicenseLabelResponse,omitempty"` + Res *types.UpdateLicenseLabelResponse `xml:"UpdateLicenseLabelResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15225,7 +16245,7 @@ func UpdateLicenseLabel(ctx context.Context, r soap.RoundTripper, req *types.Upd type UpdateLinkedChildrenBody struct { Req *types.UpdateLinkedChildren `xml:"urn:vim25 UpdateLinkedChildren,omitempty"` - Res *types.UpdateLinkedChildrenResponse `xml:"urn:vim25 UpdateLinkedChildrenResponse,omitempty"` + Res *types.UpdateLinkedChildrenResponse `xml:"UpdateLinkedChildrenResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15245,7 +16265,7 @@ func UpdateLinkedChildren(ctx context.Context, r soap.RoundTripper, req *types.U type UpdateLocalSwapDatastoreBody struct { Req *types.UpdateLocalSwapDatastore `xml:"urn:vim25 UpdateLocalSwapDatastore,omitempty"` - Res *types.UpdateLocalSwapDatastoreResponse `xml:"urn:vim25 UpdateLocalSwapDatastoreResponse,omitempty"` + Res *types.UpdateLocalSwapDatastoreResponse `xml:"UpdateLocalSwapDatastoreResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15265,7 +16285,7 @@ func UpdateLocalSwapDatastore(ctx context.Context, r soap.RoundTripper, req *typ type UpdateLockdownExceptionsBody struct { Req *types.UpdateLockdownExceptions `xml:"urn:vim25 UpdateLockdownExceptions,omitempty"` - Res *types.UpdateLockdownExceptionsResponse `xml:"urn:vim25 UpdateLockdownExceptionsResponse,omitempty"` + Res *types.UpdateLockdownExceptionsResponse `xml:"UpdateLockdownExceptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15285,7 +16305,7 @@ func UpdateLockdownExceptions(ctx context.Context, r soap.RoundTripper, req *typ type UpdateModuleOptionStringBody struct { Req *types.UpdateModuleOptionString `xml:"urn:vim25 UpdateModuleOptionString,omitempty"` - Res *types.UpdateModuleOptionStringResponse `xml:"urn:vim25 UpdateModuleOptionStringResponse,omitempty"` + Res *types.UpdateModuleOptionStringResponse `xml:"UpdateModuleOptionStringResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15305,7 +16325,7 @@ func UpdateModuleOptionString(ctx context.Context, r soap.RoundTripper, req *typ type UpdateNetworkConfigBody struct { Req *types.UpdateNetworkConfig `xml:"urn:vim25 UpdateNetworkConfig,omitempty"` - Res *types.UpdateNetworkConfigResponse `xml:"urn:vim25 UpdateNetworkConfigResponse,omitempty"` + Res *types.UpdateNetworkConfigResponse `xml:"UpdateNetworkConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15325,7 +16345,7 @@ func UpdateNetworkConfig(ctx context.Context, r soap.RoundTripper, req *types.Up type UpdateNetworkResourcePoolBody struct { Req *types.UpdateNetworkResourcePool `xml:"urn:vim25 UpdateNetworkResourcePool,omitempty"` - Res *types.UpdateNetworkResourcePoolResponse `xml:"urn:vim25 UpdateNetworkResourcePoolResponse,omitempty"` + Res *types.UpdateNetworkResourcePoolResponse `xml:"UpdateNetworkResourcePoolResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15345,7 +16365,7 @@ func UpdateNetworkResourcePool(ctx context.Context, r soap.RoundTripper, req *ty type UpdateOptionsBody struct { Req *types.UpdateOptions `xml:"urn:vim25 UpdateOptions,omitempty"` - Res *types.UpdateOptionsResponse `xml:"urn:vim25 UpdateOptionsResponse,omitempty"` + Res *types.UpdateOptionsResponse `xml:"UpdateOptionsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15365,7 +16385,7 @@ func UpdateOptions(ctx context.Context, r soap.RoundTripper, req *types.UpdateOp type UpdatePassthruConfigBody struct { Req *types.UpdatePassthruConfig `xml:"urn:vim25 UpdatePassthruConfig,omitempty"` - Res *types.UpdatePassthruConfigResponse `xml:"urn:vim25 UpdatePassthruConfigResponse,omitempty"` + Res *types.UpdatePassthruConfigResponse `xml:"UpdatePassthruConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15385,7 +16405,7 @@ func UpdatePassthruConfig(ctx context.Context, r soap.RoundTripper, req *types.U type UpdatePerfIntervalBody struct { Req *types.UpdatePerfInterval `xml:"urn:vim25 UpdatePerfInterval,omitempty"` - Res *types.UpdatePerfIntervalResponse `xml:"urn:vim25 UpdatePerfIntervalResponse,omitempty"` + Res *types.UpdatePerfIntervalResponse `xml:"UpdatePerfIntervalResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15405,7 +16425,7 @@ func UpdatePerfInterval(ctx context.Context, r soap.RoundTripper, req *types.Upd type UpdatePhysicalNicLinkSpeedBody struct { Req *types.UpdatePhysicalNicLinkSpeed `xml:"urn:vim25 UpdatePhysicalNicLinkSpeed,omitempty"` - Res *types.UpdatePhysicalNicLinkSpeedResponse `xml:"urn:vim25 UpdatePhysicalNicLinkSpeedResponse,omitempty"` + Res *types.UpdatePhysicalNicLinkSpeedResponse `xml:"UpdatePhysicalNicLinkSpeedResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15425,7 +16445,7 @@ func UpdatePhysicalNicLinkSpeed(ctx context.Context, r soap.RoundTripper, req *t type UpdatePortGroupBody struct { Req *types.UpdatePortGroup `xml:"urn:vim25 UpdatePortGroup,omitempty"` - Res *types.UpdatePortGroupResponse `xml:"urn:vim25 UpdatePortGroupResponse,omitempty"` + Res *types.UpdatePortGroupResponse `xml:"UpdatePortGroupResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15443,9 +16463,29 @@ func UpdatePortGroup(ctx context.Context, r soap.RoundTripper, req *types.Update return resBody.Res, nil } +type UpdateProductLockerLocation_TaskBody struct { + Req *types.UpdateProductLockerLocation_Task `xml:"urn:vim25 UpdateProductLockerLocation_Task,omitempty"` + Res *types.UpdateProductLockerLocation_TaskResponse `xml:"UpdateProductLockerLocation_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *UpdateProductLockerLocation_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func UpdateProductLockerLocation_Task(ctx context.Context, r soap.RoundTripper, req *types.UpdateProductLockerLocation_Task) (*types.UpdateProductLockerLocation_TaskResponse, error) { + var reqBody, resBody UpdateProductLockerLocation_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type UpdateProgressBody struct { Req *types.UpdateProgress `xml:"urn:vim25 UpdateProgress,omitempty"` - Res *types.UpdateProgressResponse `xml:"urn:vim25 UpdateProgressResponse,omitempty"` + Res *types.UpdateProgressResponse `xml:"UpdateProgressResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15465,7 +16505,7 @@ func UpdateProgress(ctx context.Context, r soap.RoundTripper, req *types.UpdateP type UpdateReferenceHostBody struct { Req *types.UpdateReferenceHost `xml:"urn:vim25 UpdateReferenceHost,omitempty"` - Res *types.UpdateReferenceHostResponse `xml:"urn:vim25 UpdateReferenceHostResponse,omitempty"` + Res *types.UpdateReferenceHostResponse `xml:"UpdateReferenceHostResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15485,7 +16525,7 @@ func UpdateReferenceHost(ctx context.Context, r soap.RoundTripper, req *types.Up type UpdateRulesetBody struct { Req *types.UpdateRuleset `xml:"urn:vim25 UpdateRuleset,omitempty"` - Res *types.UpdateRulesetResponse `xml:"urn:vim25 UpdateRulesetResponse,omitempty"` + Res *types.UpdateRulesetResponse `xml:"UpdateRulesetResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15505,7 +16545,7 @@ func UpdateRuleset(ctx context.Context, r soap.RoundTripper, req *types.UpdateRu type UpdateScsiLunDisplayNameBody struct { Req *types.UpdateScsiLunDisplayName `xml:"urn:vim25 UpdateScsiLunDisplayName,omitempty"` - Res *types.UpdateScsiLunDisplayNameResponse `xml:"urn:vim25 UpdateScsiLunDisplayNameResponse,omitempty"` + Res *types.UpdateScsiLunDisplayNameResponse `xml:"UpdateScsiLunDisplayNameResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15525,7 +16565,7 @@ func UpdateScsiLunDisplayName(ctx context.Context, r soap.RoundTripper, req *typ type UpdateSelfSignedClientCertBody struct { Req *types.UpdateSelfSignedClientCert `xml:"urn:vim25 UpdateSelfSignedClientCert,omitempty"` - Res *types.UpdateSelfSignedClientCertResponse `xml:"urn:vim25 UpdateSelfSignedClientCertResponse,omitempty"` + Res *types.UpdateSelfSignedClientCertResponse `xml:"UpdateSelfSignedClientCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15545,7 +16585,7 @@ func UpdateSelfSignedClientCert(ctx context.Context, r soap.RoundTripper, req *t type UpdateServiceConsoleVirtualNicBody struct { Req *types.UpdateServiceConsoleVirtualNic `xml:"urn:vim25 UpdateServiceConsoleVirtualNic,omitempty"` - Res *types.UpdateServiceConsoleVirtualNicResponse `xml:"urn:vim25 UpdateServiceConsoleVirtualNicResponse,omitempty"` + Res *types.UpdateServiceConsoleVirtualNicResponse `xml:"UpdateServiceConsoleVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15565,7 +16605,7 @@ func UpdateServiceConsoleVirtualNic(ctx context.Context, r soap.RoundTripper, re type UpdateServiceMessageBody struct { Req *types.UpdateServiceMessage `xml:"urn:vim25 UpdateServiceMessage,omitempty"` - Res *types.UpdateServiceMessageResponse `xml:"urn:vim25 UpdateServiceMessageResponse,omitempty"` + Res *types.UpdateServiceMessageResponse `xml:"UpdateServiceMessageResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15585,7 +16625,7 @@ func UpdateServiceMessage(ctx context.Context, r soap.RoundTripper, req *types.U type UpdateServicePolicyBody struct { Req *types.UpdateServicePolicy `xml:"urn:vim25 UpdateServicePolicy,omitempty"` - Res *types.UpdateServicePolicyResponse `xml:"urn:vim25 UpdateServicePolicyResponse,omitempty"` + Res *types.UpdateServicePolicyResponse `xml:"UpdateServicePolicyResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15605,7 +16645,7 @@ func UpdateServicePolicy(ctx context.Context, r soap.RoundTripper, req *types.Up type UpdateSoftwareInternetScsiEnabledBody struct { Req *types.UpdateSoftwareInternetScsiEnabled `xml:"urn:vim25 UpdateSoftwareInternetScsiEnabled,omitempty"` - Res *types.UpdateSoftwareInternetScsiEnabledResponse `xml:"urn:vim25 UpdateSoftwareInternetScsiEnabledResponse,omitempty"` + Res *types.UpdateSoftwareInternetScsiEnabledResponse `xml:"UpdateSoftwareInternetScsiEnabledResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15625,7 +16665,7 @@ func UpdateSoftwareInternetScsiEnabled(ctx context.Context, r soap.RoundTripper, type UpdateSystemResourcesBody struct { Req *types.UpdateSystemResources `xml:"urn:vim25 UpdateSystemResources,omitempty"` - Res *types.UpdateSystemResourcesResponse `xml:"urn:vim25 UpdateSystemResourcesResponse,omitempty"` + Res *types.UpdateSystemResourcesResponse `xml:"UpdateSystemResourcesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15645,7 +16685,7 @@ func UpdateSystemResources(ctx context.Context, r soap.RoundTripper, req *types. type UpdateSystemSwapConfigurationBody struct { Req *types.UpdateSystemSwapConfiguration `xml:"urn:vim25 UpdateSystemSwapConfiguration,omitempty"` - Res *types.UpdateSystemSwapConfigurationResponse `xml:"urn:vim25 UpdateSystemSwapConfigurationResponse,omitempty"` + Res *types.UpdateSystemSwapConfigurationResponse `xml:"UpdateSystemSwapConfigurationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15665,7 +16705,7 @@ func UpdateSystemSwapConfiguration(ctx context.Context, r soap.RoundTripper, req type UpdateSystemUsersBody struct { Req *types.UpdateSystemUsers `xml:"urn:vim25 UpdateSystemUsers,omitempty"` - Res *types.UpdateSystemUsersResponse `xml:"urn:vim25 UpdateSystemUsersResponse,omitempty"` + Res *types.UpdateSystemUsersResponse `xml:"UpdateSystemUsersResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15685,7 +16725,7 @@ func UpdateSystemUsers(ctx context.Context, r soap.RoundTripper, req *types.Upda type UpdateUserBody struct { Req *types.UpdateUser `xml:"urn:vim25 UpdateUser,omitempty"` - Res *types.UpdateUserResponse `xml:"urn:vim25 UpdateUserResponse,omitempty"` + Res *types.UpdateUserResponse `xml:"UpdateUserResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15705,7 +16745,7 @@ func UpdateUser(ctx context.Context, r soap.RoundTripper, req *types.UpdateUser) type UpdateVAppConfigBody struct { Req *types.UpdateVAppConfig `xml:"urn:vim25 UpdateVAppConfig,omitempty"` - Res *types.UpdateVAppConfigResponse `xml:"urn:vim25 UpdateVAppConfigResponse,omitempty"` + Res *types.UpdateVAppConfigResponse `xml:"UpdateVAppConfigResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15723,9 +16763,49 @@ func UpdateVAppConfig(ctx context.Context, r soap.RoundTripper, req *types.Updat return resBody.Res, nil } +type UpdateVStorageInfrastructureObjectPolicy_TaskBody struct { + Req *types.UpdateVStorageInfrastructureObjectPolicy_Task `xml:"urn:vim25 UpdateVStorageInfrastructureObjectPolicy_Task,omitempty"` + Res *types.UpdateVStorageInfrastructureObjectPolicy_TaskResponse `xml:"UpdateVStorageInfrastructureObjectPolicy_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *UpdateVStorageInfrastructureObjectPolicy_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func UpdateVStorageInfrastructureObjectPolicy_Task(ctx context.Context, r soap.RoundTripper, req *types.UpdateVStorageInfrastructureObjectPolicy_Task) (*types.UpdateVStorageInfrastructureObjectPolicy_TaskResponse, error) { + var reqBody, resBody UpdateVStorageInfrastructureObjectPolicy_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type UpdateVStorageObjectPolicy_TaskBody struct { + Req *types.UpdateVStorageObjectPolicy_Task `xml:"urn:vim25 UpdateVStorageObjectPolicy_Task,omitempty"` + Res *types.UpdateVStorageObjectPolicy_TaskResponse `xml:"UpdateVStorageObjectPolicy_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *UpdateVStorageObjectPolicy_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func UpdateVStorageObjectPolicy_Task(ctx context.Context, r soap.RoundTripper, req *types.UpdateVStorageObjectPolicy_Task) (*types.UpdateVStorageObjectPolicy_TaskResponse, error) { + var reqBody, resBody UpdateVStorageObjectPolicy_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type UpdateVVolVirtualMachineFiles_TaskBody struct { Req *types.UpdateVVolVirtualMachineFiles_Task `xml:"urn:vim25 UpdateVVolVirtualMachineFiles_Task,omitempty"` - Res *types.UpdateVVolVirtualMachineFiles_TaskResponse `xml:"urn:vim25 UpdateVVolVirtualMachineFiles_TaskResponse,omitempty"` + Res *types.UpdateVVolVirtualMachineFiles_TaskResponse `xml:"UpdateVVolVirtualMachineFiles_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15745,7 +16825,7 @@ func UpdateVVolVirtualMachineFiles_Task(ctx context.Context, r soap.RoundTripper type UpdateVirtualMachineFiles_TaskBody struct { Req *types.UpdateVirtualMachineFiles_Task `xml:"urn:vim25 UpdateVirtualMachineFiles_Task,omitempty"` - Res *types.UpdateVirtualMachineFiles_TaskResponse `xml:"urn:vim25 UpdateVirtualMachineFiles_TaskResponse,omitempty"` + Res *types.UpdateVirtualMachineFiles_TaskResponse `xml:"UpdateVirtualMachineFiles_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15765,7 +16845,7 @@ func UpdateVirtualMachineFiles_Task(ctx context.Context, r soap.RoundTripper, re type UpdateVirtualNicBody struct { Req *types.UpdateVirtualNic `xml:"urn:vim25 UpdateVirtualNic,omitempty"` - Res *types.UpdateVirtualNicResponse `xml:"urn:vim25 UpdateVirtualNicResponse,omitempty"` + Res *types.UpdateVirtualNicResponse `xml:"UpdateVirtualNicResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15785,7 +16865,7 @@ func UpdateVirtualNic(ctx context.Context, r soap.RoundTripper, req *types.Updat type UpdateVirtualSwitchBody struct { Req *types.UpdateVirtualSwitch `xml:"urn:vim25 UpdateVirtualSwitch,omitempty"` - Res *types.UpdateVirtualSwitchResponse `xml:"urn:vim25 UpdateVirtualSwitchResponse,omitempty"` + Res *types.UpdateVirtualSwitchResponse `xml:"UpdateVirtualSwitchResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15803,9 +16883,29 @@ func UpdateVirtualSwitch(ctx context.Context, r soap.RoundTripper, req *types.Up return resBody.Res, nil } +type UpdateVmfsUnmapBandwidthBody struct { + Req *types.UpdateVmfsUnmapBandwidth `xml:"urn:vim25 UpdateVmfsUnmapBandwidth,omitempty"` + Res *types.UpdateVmfsUnmapBandwidthResponse `xml:"UpdateVmfsUnmapBandwidthResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *UpdateVmfsUnmapBandwidthBody) Fault() *soap.Fault { return b.Fault_ } + +func UpdateVmfsUnmapBandwidth(ctx context.Context, r soap.RoundTripper, req *types.UpdateVmfsUnmapBandwidth) (*types.UpdateVmfsUnmapBandwidthResponse, error) { + var reqBody, resBody UpdateVmfsUnmapBandwidthBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type UpdateVmfsUnmapPriorityBody struct { Req *types.UpdateVmfsUnmapPriority `xml:"urn:vim25 UpdateVmfsUnmapPriority,omitempty"` - Res *types.UpdateVmfsUnmapPriorityResponse `xml:"urn:vim25 UpdateVmfsUnmapPriorityResponse,omitempty"` + Res *types.UpdateVmfsUnmapPriorityResponse `xml:"UpdateVmfsUnmapPriorityResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15825,7 +16925,7 @@ func UpdateVmfsUnmapPriority(ctx context.Context, r soap.RoundTripper, req *type type UpdateVsan_TaskBody struct { Req *types.UpdateVsan_Task `xml:"urn:vim25 UpdateVsan_Task,omitempty"` - Res *types.UpdateVsan_TaskResponse `xml:"urn:vim25 UpdateVsan_TaskResponse,omitempty"` + Res *types.UpdateVsan_TaskResponse `xml:"UpdateVsan_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15845,7 +16945,7 @@ func UpdateVsan_Task(ctx context.Context, r soap.RoundTripper, req *types.Update type UpgradeIoFilter_TaskBody struct { Req *types.UpgradeIoFilter_Task `xml:"urn:vim25 UpgradeIoFilter_Task,omitempty"` - Res *types.UpgradeIoFilter_TaskResponse `xml:"urn:vim25 UpgradeIoFilter_TaskResponse,omitempty"` + Res *types.UpgradeIoFilter_TaskResponse `xml:"UpgradeIoFilter_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15865,7 +16965,7 @@ func UpgradeIoFilter_Task(ctx context.Context, r soap.RoundTripper, req *types.U type UpgradeTools_TaskBody struct { Req *types.UpgradeTools_Task `xml:"urn:vim25 UpgradeTools_Task,omitempty"` - Res *types.UpgradeTools_TaskResponse `xml:"urn:vim25 UpgradeTools_TaskResponse,omitempty"` + Res *types.UpgradeTools_TaskResponse `xml:"UpgradeTools_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15885,7 +16985,7 @@ func UpgradeTools_Task(ctx context.Context, r soap.RoundTripper, req *types.Upgr type UpgradeVM_TaskBody struct { Req *types.UpgradeVM_Task `xml:"urn:vim25 UpgradeVM_Task,omitempty"` - Res *types.UpgradeVM_TaskResponse `xml:"urn:vim25 UpgradeVM_TaskResponse,omitempty"` + Res *types.UpgradeVM_TaskResponse `xml:"UpgradeVM_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15905,7 +17005,7 @@ func UpgradeVM_Task(ctx context.Context, r soap.RoundTripper, req *types.Upgrade type UpgradeVmLayoutBody struct { Req *types.UpgradeVmLayout `xml:"urn:vim25 UpgradeVmLayout,omitempty"` - Res *types.UpgradeVmLayoutResponse `xml:"urn:vim25 UpgradeVmLayoutResponse,omitempty"` + Res *types.UpgradeVmLayoutResponse `xml:"UpgradeVmLayoutResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15925,7 +17025,7 @@ func UpgradeVmLayout(ctx context.Context, r soap.RoundTripper, req *types.Upgrad type UpgradeVmfsBody struct { Req *types.UpgradeVmfs `xml:"urn:vim25 UpgradeVmfs,omitempty"` - Res *types.UpgradeVmfsResponse `xml:"urn:vim25 UpgradeVmfsResponse,omitempty"` + Res *types.UpgradeVmfsResponse `xml:"UpgradeVmfsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15945,7 +17045,7 @@ func UpgradeVmfs(ctx context.Context, r soap.RoundTripper, req *types.UpgradeVmf type UpgradeVsanObjectsBody struct { Req *types.UpgradeVsanObjects `xml:"urn:vim25 UpgradeVsanObjects,omitempty"` - Res *types.UpgradeVsanObjectsResponse `xml:"urn:vim25 UpgradeVsanObjectsResponse,omitempty"` + Res *types.UpgradeVsanObjectsResponse `xml:"UpgradeVsanObjectsResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15965,7 +17065,7 @@ func UpgradeVsanObjects(ctx context.Context, r soap.RoundTripper, req *types.Upg type UploadClientCertBody struct { Req *types.UploadClientCert `xml:"urn:vim25 UploadClientCert,omitempty"` - Res *types.UploadClientCertResponse `xml:"urn:vim25 UploadClientCertResponse,omitempty"` + Res *types.UploadClientCertResponse `xml:"UploadClientCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -15985,7 +17085,7 @@ func UploadClientCert(ctx context.Context, r soap.RoundTripper, req *types.Uploa type UploadKmipServerCertBody struct { Req *types.UploadKmipServerCert `xml:"urn:vim25 UploadKmipServerCert,omitempty"` - Res *types.UploadKmipServerCertResponse `xml:"urn:vim25 UploadKmipServerCertResponse,omitempty"` + Res *types.UploadKmipServerCertResponse `xml:"UploadKmipServerCertResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16003,9 +17103,29 @@ func UploadKmipServerCert(ctx context.Context, r soap.RoundTripper, req *types.U return resBody.Res, nil } +type VStorageObjectCreateSnapshot_TaskBody struct { + Req *types.VStorageObjectCreateSnapshot_Task `xml:"urn:vim25 VStorageObjectCreateSnapshot_Task,omitempty"` + Res *types.VStorageObjectCreateSnapshot_TaskResponse `xml:"VStorageObjectCreateSnapshot_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *VStorageObjectCreateSnapshot_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func VStorageObjectCreateSnapshot_Task(ctx context.Context, r soap.RoundTripper, req *types.VStorageObjectCreateSnapshot_Task) (*types.VStorageObjectCreateSnapshot_TaskResponse, error) { + var reqBody, resBody VStorageObjectCreateSnapshot_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ValidateCredentialsInGuestBody struct { Req *types.ValidateCredentialsInGuest `xml:"urn:vim25 ValidateCredentialsInGuest,omitempty"` - Res *types.ValidateCredentialsInGuestResponse `xml:"urn:vim25 ValidateCredentialsInGuestResponse,omitempty"` + Res *types.ValidateCredentialsInGuestResponse `xml:"ValidateCredentialsInGuestResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16023,9 +17143,29 @@ func ValidateCredentialsInGuest(ctx context.Context, r soap.RoundTripper, req *t return resBody.Res, nil } +type ValidateHCIConfigurationBody struct { + Req *types.ValidateHCIConfiguration `xml:"urn:vim25 ValidateHCIConfiguration,omitempty"` + Res *types.ValidateHCIConfigurationResponse `xml:"ValidateHCIConfigurationResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ValidateHCIConfigurationBody) Fault() *soap.Fault { return b.Fault_ } + +func ValidateHCIConfiguration(ctx context.Context, r soap.RoundTripper, req *types.ValidateHCIConfiguration) (*types.ValidateHCIConfigurationResponse, error) { + var reqBody, resBody ValidateHCIConfigurationBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ValidateHostBody struct { Req *types.ValidateHost `xml:"urn:vim25 ValidateHost,omitempty"` - Res *types.ValidateHostResponse `xml:"urn:vim25 ValidateHostResponse,omitempty"` + Res *types.ValidateHostResponse `xml:"ValidateHostResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16043,9 +17183,29 @@ func ValidateHost(ctx context.Context, r soap.RoundTripper, req *types.ValidateH return resBody.Res, nil } +type ValidateHostProfileComposition_TaskBody struct { + Req *types.ValidateHostProfileComposition_Task `xml:"urn:vim25 ValidateHostProfileComposition_Task,omitempty"` + Res *types.ValidateHostProfileComposition_TaskResponse `xml:"ValidateHostProfileComposition_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ValidateHostProfileComposition_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ValidateHostProfileComposition_Task(ctx context.Context, r soap.RoundTripper, req *types.ValidateHostProfileComposition_Task) (*types.ValidateHostProfileComposition_TaskResponse, error) { + var reqBody, resBody ValidateHostProfileComposition_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type ValidateMigrationBody struct { Req *types.ValidateMigration `xml:"urn:vim25 ValidateMigration,omitempty"` - Res *types.ValidateMigrationResponse `xml:"urn:vim25 ValidateMigrationResponse,omitempty"` + Res *types.ValidateMigrationResponse `xml:"ValidateMigrationResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16063,9 +17223,29 @@ func ValidateMigration(ctx context.Context, r soap.RoundTripper, req *types.Vali return resBody.Res, nil } +type ValidateStoragePodConfigBody struct { + Req *types.ValidateStoragePodConfig `xml:"urn:vim25 ValidateStoragePodConfig,omitempty"` + Res *types.ValidateStoragePodConfigResponse `xml:"ValidateStoragePodConfigResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ValidateStoragePodConfigBody) Fault() *soap.Fault { return b.Fault_ } + +func ValidateStoragePodConfig(ctx context.Context, r soap.RoundTripper, req *types.ValidateStoragePodConfig) (*types.ValidateStoragePodConfigResponse, error) { + var reqBody, resBody ValidateStoragePodConfigBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + type WaitForUpdatesBody struct { Req *types.WaitForUpdates `xml:"urn:vim25 WaitForUpdates,omitempty"` - Res *types.WaitForUpdatesResponse `xml:"urn:vim25 WaitForUpdatesResponse,omitempty"` + Res *types.WaitForUpdatesResponse `xml:"WaitForUpdatesResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16085,7 +17265,7 @@ func WaitForUpdates(ctx context.Context, r soap.RoundTripper, req *types.WaitFor type WaitForUpdatesExBody struct { Req *types.WaitForUpdatesEx `xml:"urn:vim25 WaitForUpdatesEx,omitempty"` - Res *types.WaitForUpdatesExResponse `xml:"urn:vim25 WaitForUpdatesExResponse,omitempty"` + Res *types.WaitForUpdatesExResponse `xml:"WaitForUpdatesExResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16105,7 +17285,7 @@ func WaitForUpdatesEx(ctx context.Context, r soap.RoundTripper, req *types.WaitF type XmlToCustomizationSpecItemBody struct { Req *types.XmlToCustomizationSpecItem `xml:"urn:vim25 XmlToCustomizationSpecItem,omitempty"` - Res *types.XmlToCustomizationSpecItemResponse `xml:"urn:vim25 XmlToCustomizationSpecItemResponse,omitempty"` + Res *types.XmlToCustomizationSpecItemResponse `xml:"XmlToCustomizationSpecItemResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16125,7 +17305,7 @@ func XmlToCustomizationSpecItem(ctx context.Context, r soap.RoundTripper, req *t type ZeroFillVirtualDisk_TaskBody struct { Req *types.ZeroFillVirtualDisk_Task `xml:"urn:vim25 ZeroFillVirtualDisk_Task,omitempty"` - Res *types.ZeroFillVirtualDisk_TaskResponse `xml:"urn:vim25 ZeroFillVirtualDisk_TaskResponse,omitempty"` + Res *types.ZeroFillVirtualDisk_TaskResponse `xml:"ZeroFillVirtualDisk_TaskResponse,omitempty"` Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` } @@ -16142,3 +17322,323 @@ func ZeroFillVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *typ return resBody.Res, nil } + +type ConfigureVcha_TaskBody struct { + Req *types.ConfigureVcha_Task `xml:"urn:vim25 configureVcha_Task,omitempty"` + Res *types.ConfigureVcha_TaskResponse `xml:"configureVcha_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ConfigureVcha_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ConfigureVcha_Task(ctx context.Context, r soap.RoundTripper, req *types.ConfigureVcha_Task) (*types.ConfigureVcha_TaskResponse, error) { + var reqBody, resBody ConfigureVcha_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type CreatePassiveNode_TaskBody struct { + Req *types.CreatePassiveNode_Task `xml:"urn:vim25 createPassiveNode_Task,omitempty"` + Res *types.CreatePassiveNode_TaskResponse `xml:"createPassiveNode_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CreatePassiveNode_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CreatePassiveNode_Task(ctx context.Context, r soap.RoundTripper, req *types.CreatePassiveNode_Task) (*types.CreatePassiveNode_TaskResponse, error) { + var reqBody, resBody CreatePassiveNode_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type CreateWitnessNode_TaskBody struct { + Req *types.CreateWitnessNode_Task `xml:"urn:vim25 createWitnessNode_Task,omitempty"` + Res *types.CreateWitnessNode_TaskResponse `xml:"createWitnessNode_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CreateWitnessNode_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func CreateWitnessNode_Task(ctx context.Context, r soap.RoundTripper, req *types.CreateWitnessNode_Task) (*types.CreateWitnessNode_TaskResponse, error) { + var reqBody, resBody CreateWitnessNode_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DeployVcha_TaskBody struct { + Req *types.DeployVcha_Task `xml:"urn:vim25 deployVcha_Task,omitempty"` + Res *types.DeployVcha_TaskResponse `xml:"deployVcha_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DeployVcha_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func DeployVcha_Task(ctx context.Context, r soap.RoundTripper, req *types.DeployVcha_Task) (*types.DeployVcha_TaskResponse, error) { + var reqBody, resBody DeployVcha_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type DestroyVcha_TaskBody struct { + Req *types.DestroyVcha_Task `xml:"urn:vim25 destroyVcha_Task,omitempty"` + Res *types.DestroyVcha_TaskResponse `xml:"destroyVcha_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *DestroyVcha_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func DestroyVcha_Task(ctx context.Context, r soap.RoundTripper, req *types.DestroyVcha_Task) (*types.DestroyVcha_TaskResponse, error) { + var reqBody, resBody DestroyVcha_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type FetchSoftwarePackagesBody struct { + Req *types.FetchSoftwarePackages `xml:"urn:vim25 fetchSoftwarePackages,omitempty"` + Res *types.FetchSoftwarePackagesResponse `xml:"fetchSoftwarePackagesResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *FetchSoftwarePackagesBody) Fault() *soap.Fault { return b.Fault_ } + +func FetchSoftwarePackages(ctx context.Context, r soap.RoundTripper, req *types.FetchSoftwarePackages) (*types.FetchSoftwarePackagesResponse, error) { + var reqBody, resBody FetchSoftwarePackagesBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type GetClusterModeBody struct { + Req *types.GetClusterMode `xml:"urn:vim25 getClusterMode,omitempty"` + Res *types.GetClusterModeResponse `xml:"getClusterModeResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *GetClusterModeBody) Fault() *soap.Fault { return b.Fault_ } + +func GetClusterMode(ctx context.Context, r soap.RoundTripper, req *types.GetClusterMode) (*types.GetClusterModeResponse, error) { + var reqBody, resBody GetClusterModeBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type GetVchaConfigBody struct { + Req *types.GetVchaConfig `xml:"urn:vim25 getVchaConfig,omitempty"` + Res *types.GetVchaConfigResponse `xml:"getVchaConfigResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *GetVchaConfigBody) Fault() *soap.Fault { return b.Fault_ } + +func GetVchaConfig(ctx context.Context, r soap.RoundTripper, req *types.GetVchaConfig) (*types.GetVchaConfigResponse, error) { + var reqBody, resBody GetVchaConfigBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type InitiateFailover_TaskBody struct { + Req *types.InitiateFailover_Task `xml:"urn:vim25 initiateFailover_Task,omitempty"` + Res *types.InitiateFailover_TaskResponse `xml:"initiateFailover_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *InitiateFailover_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func InitiateFailover_Task(ctx context.Context, r soap.RoundTripper, req *types.InitiateFailover_Task) (*types.InitiateFailover_TaskResponse, error) { + var reqBody, resBody InitiateFailover_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type InstallDateBody struct { + Req *types.InstallDate `xml:"urn:vim25 installDate,omitempty"` + Res *types.InstallDateResponse `xml:"installDateResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *InstallDateBody) Fault() *soap.Fault { return b.Fault_ } + +func InstallDate(ctx context.Context, r soap.RoundTripper, req *types.InstallDate) (*types.InstallDateResponse, error) { + var reqBody, resBody InstallDateBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type PrepareVcha_TaskBody struct { + Req *types.PrepareVcha_Task `xml:"urn:vim25 prepareVcha_Task,omitempty"` + Res *types.PrepareVcha_TaskResponse `xml:"prepareVcha_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *PrepareVcha_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func PrepareVcha_Task(ctx context.Context, r soap.RoundTripper, req *types.PrepareVcha_Task) (*types.PrepareVcha_TaskResponse, error) { + var reqBody, resBody PrepareVcha_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type QueryDatacenterConfigOptionDescriptorBody struct { + Req *types.QueryDatacenterConfigOptionDescriptor `xml:"urn:vim25 queryDatacenterConfigOptionDescriptor,omitempty"` + Res *types.QueryDatacenterConfigOptionDescriptorResponse `xml:"queryDatacenterConfigOptionDescriptorResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *QueryDatacenterConfigOptionDescriptorBody) Fault() *soap.Fault { return b.Fault_ } + +func QueryDatacenterConfigOptionDescriptor(ctx context.Context, r soap.RoundTripper, req *types.QueryDatacenterConfigOptionDescriptor) (*types.QueryDatacenterConfigOptionDescriptorResponse, error) { + var reqBody, resBody QueryDatacenterConfigOptionDescriptorBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type ReloadVirtualMachineFromPath_TaskBody struct { + Req *types.ReloadVirtualMachineFromPath_Task `xml:"urn:vim25 reloadVirtualMachineFromPath_Task,omitempty"` + Res *types.ReloadVirtualMachineFromPath_TaskResponse `xml:"reloadVirtualMachineFromPath_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *ReloadVirtualMachineFromPath_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func ReloadVirtualMachineFromPath_Task(ctx context.Context, r soap.RoundTripper, req *types.ReloadVirtualMachineFromPath_Task) (*types.ReloadVirtualMachineFromPath_TaskResponse, error) { + var reqBody, resBody ReloadVirtualMachineFromPath_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type SetClusterMode_TaskBody struct { + Req *types.SetClusterMode_Task `xml:"urn:vim25 setClusterMode_Task,omitempty"` + Res *types.SetClusterMode_TaskResponse `xml:"setClusterMode_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *SetClusterMode_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func SetClusterMode_Task(ctx context.Context, r soap.RoundTripper, req *types.SetClusterMode_Task) (*types.SetClusterMode_TaskResponse, error) { + var reqBody, resBody SetClusterMode_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type SetCustomValueBody struct { + Req *types.SetCustomValue `xml:"urn:vim25 setCustomValue,omitempty"` + Res *types.SetCustomValueResponse `xml:"setCustomValueResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *SetCustomValueBody) Fault() *soap.Fault { return b.Fault_ } + +func SetCustomValue(ctx context.Context, r soap.RoundTripper, req *types.SetCustomValue) (*types.SetCustomValueResponse, error) { + var reqBody, resBody SetCustomValueBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} + +type UnregisterVApp_TaskBody struct { + Req *types.UnregisterVApp_Task `xml:"urn:vim25 unregisterVApp_Task,omitempty"` + Res *types.UnregisterVApp_TaskResponse `xml:"unregisterVApp_TaskResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *UnregisterVApp_TaskBody) Fault() *soap.Fault { return b.Fault_ } + +func UnregisterVApp_Task(ctx context.Context, r soap.RoundTripper, req *types.UnregisterVApp_Task) (*types.UnregisterVApp_TaskResponse, error) { + var reqBody, resBody UnregisterVApp_TaskBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} diff --git a/vendor/github.com/vmware/govmomi/vim25/methods/service_content.go b/vendor/github.com/vmware/govmomi/vim25/methods/service_content.go index 634fbfbd9..401646598 100644 --- a/vendor/github.com/vmware/govmomi/vim25/methods/service_content.go +++ b/vendor/github.com/vmware/govmomi/vim25/methods/service_content.go @@ -24,14 +24,15 @@ import ( "github.com/vmware/govmomi/vim25/types" ) -var ServiceInstance = types.ManagedObjectReference{ +// copy of vim25.ServiceInstance to avoid import cycle +var serviceInstance = types.ManagedObjectReference{ Type: "ServiceInstance", Value: "ServiceInstance", } func GetServiceContent(ctx context.Context, r soap.RoundTripper) (types.ServiceContent, error) { req := types.RetrieveServiceContent{ - This: ServiceInstance, + This: serviceInstance, } res, err := RetrieveServiceContent(ctx, r, &req) @@ -44,7 +45,7 @@ func GetServiceContent(ctx context.Context, r soap.RoundTripper) (types.ServiceC func GetCurrentTime(ctx context.Context, r soap.RoundTripper) (*time.Time, error) { req := types.CurrentTime{ - This: ServiceInstance, + This: serviceInstance, } res, err := CurrentTime(ctx, r, &req) diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/mo.go b/vendor/github.com/vmware/govmomi/vim25/mo/mo.go index ede6e44d7..4f19988e3 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/mo.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/mo.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -164,6 +164,22 @@ func init() { t["CryptoManager"] = reflect.TypeOf((*CryptoManager)(nil)).Elem() } +type CryptoManagerHost struct { + CryptoManager +} + +func init() { + t["CryptoManagerHost"] = reflect.TypeOf((*CryptoManagerHost)(nil)).Elem() +} + +type CryptoManagerHostKMS struct { + CryptoManagerHost +} + +func init() { + t["CryptoManagerHostKMS"] = reflect.TypeOf((*CryptoManagerHostKMS)(nil)).Elem() +} + type CryptoManagerKmip struct { CryptoManager @@ -759,9 +775,10 @@ func init() { type HostGraphicsManager struct { ExtensibleManagedObject - GraphicsInfo []types.HostGraphicsInfo `mo:"graphicsInfo"` - GraphicsConfig *types.HostGraphicsConfig `mo:"graphicsConfig"` - SharedPassthruGpuTypes []string `mo:"sharedPassthruGpuTypes"` + GraphicsInfo []types.HostGraphicsInfo `mo:"graphicsInfo"` + GraphicsConfig *types.HostGraphicsConfig `mo:"graphicsConfig"` + SharedPassthruGpuTypes []string `mo:"sharedPassthruGpuTypes"` + SharedGpuCapabilities []types.HostSharedGpuCapabilities `mo:"sharedGpuCapabilities"` } func init() { @@ -853,6 +870,20 @@ func init() { t["HostNetworkSystem"] = reflect.TypeOf((*HostNetworkSystem)(nil)).Elem() } +type HostNvdimmSystem struct { + Self types.ManagedObjectReference + + NvdimmSystemInfo types.NvdimmSystemInfo `mo:"nvdimmSystemInfo"` +} + +func (m HostNvdimmSystem) Reference() types.ManagedObjectReference { + return m.Self +} + +func init() { + t["HostNvdimmSystem"] = reflect.TypeOf((*HostNvdimmSystem)(nil)).Elem() +} + type HostPatchManager struct { Self types.ManagedObjectReference } @@ -894,7 +925,10 @@ func init() { type HostProfile struct { Profile - ReferenceHost *types.ManagedObjectReference `mo:"referenceHost"` + ValidationState *string `mo:"validationState"` + ValidationStateUpdateTime *time.Time `mo:"validationStateUpdateTime"` + ValidationFailureInfo *types.HostProfileValidationFailureInfo `mo:"validationFailureInfo"` + ReferenceHost *types.ManagedObjectReference `mo:"referenceHost"` } func init() { @@ -962,18 +996,25 @@ func init() { type HostSystem struct { ManagedEntity - Runtime types.HostRuntimeInfo `mo:"runtime"` - Summary types.HostListSummary `mo:"summary"` - Hardware *types.HostHardwareInfo `mo:"hardware"` - Capability *types.HostCapability `mo:"capability"` - LicensableResource types.HostLicensableResourceInfo `mo:"licensableResource"` - ConfigManager types.HostConfigManager `mo:"configManager"` - Config *types.HostConfigInfo `mo:"config"` - Vm []types.ManagedObjectReference `mo:"vm"` - Datastore []types.ManagedObjectReference `mo:"datastore"` - Network []types.ManagedObjectReference `mo:"network"` - DatastoreBrowser types.ManagedObjectReference `mo:"datastoreBrowser"` - SystemResources *types.HostSystemResourceInfo `mo:"systemResources"` + Runtime types.HostRuntimeInfo `mo:"runtime"` + Summary types.HostListSummary `mo:"summary"` + Hardware *types.HostHardwareInfo `mo:"hardware"` + Capability *types.HostCapability `mo:"capability"` + LicensableResource types.HostLicensableResourceInfo `mo:"licensableResource"` + RemediationState *types.HostSystemRemediationState `mo:"remediationState"` + PrecheckRemediationResult *types.ApplyHostProfileConfigurationSpec `mo:"precheckRemediationResult"` + RemediationResult *types.ApplyHostProfileConfigurationResult `mo:"remediationResult"` + ComplianceCheckState *types.HostSystemComplianceCheckState `mo:"complianceCheckState"` + ComplianceCheckResult *types.ComplianceResult `mo:"complianceCheckResult"` + ConfigManager types.HostConfigManager `mo:"configManager"` + Config *types.HostConfigInfo `mo:"config"` + Vm []types.ManagedObjectReference `mo:"vm"` + Datastore []types.ManagedObjectReference `mo:"datastore"` + Network []types.ManagedObjectReference `mo:"network"` + DatastoreBrowser types.ManagedObjectReference `mo:"datastoreBrowser"` + SystemResources *types.HostSystemResourceInfo `mo:"systemResources"` + AnswerFileValidationState *types.AnswerFileStatusResult `mo:"answerFileValidationState"` + AnswerFileValidationResult *types.AnswerFileStatusResult `mo:"answerFileValidationResult"` } func (m *HostSystem) Entity() *ManagedEntity { @@ -1056,10 +1097,13 @@ func init() { type HttpNfcLease struct { Self types.ManagedObjectReference - InitializeProgress int32 `mo:"initializeProgress"` - Info *types.HttpNfcLeaseInfo `mo:"info"` - State types.HttpNfcLeaseState `mo:"state"` - Error *types.LocalizedMethodFault `mo:"error"` + InitializeProgress int32 `mo:"initializeProgress"` + TransferProgress int32 `mo:"transferProgress"` + Mode string `mo:"mode"` + Capabilities types.HttpNfcLeaseCapabilities `mo:"capabilities"` + Info *types.HttpNfcLeaseInfo `mo:"info"` + State types.HttpNfcLeaseState `mo:"state"` + Error *types.LocalizedMethodFault `mo:"error"` } func (m HttpNfcLease) Reference() types.ManagedObjectReference { diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go b/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go index e7ffc32ce..c470c0ac0 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go @@ -65,6 +65,22 @@ func ObjectContentToType(o types.ObjectContent) (interface{}, error) { return v.Elem().Interface(), nil } +// ApplyPropertyChange converts the response of a call to WaitForUpdates +// and applies it to the given managed object. +func ApplyPropertyChange(obj Reference, changes []types.PropertyChange) { + t := typeInfoForType(obj.Reference().Type) + v := reflect.ValueOf(obj) + + for _, p := range changes { + rv, ok := t.props[p.Name] + if !ok { + continue + } + + assignValue(v, rv, reflect.ValueOf(p.Val)) + } +} + // LoadRetrievePropertiesResponse converts the response of a call to // RetrieveProperties to one or more managed objects. func LoadRetrievePropertiesResponse(res *types.RetrievePropertiesResponse, dst interface{}) error { diff --git a/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go b/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go index 0c9e5b034..5276d0b82 100644 --- a/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go +++ b/vendor/github.com/vmware/govmomi/vim25/mo/type_info.go @@ -155,7 +155,9 @@ func (t *typeInfo) build(typ reflect.Type, fn string, fi []int) { } } -// assignValue assignes a value 'pv' to the struct pointed to by 'val', given a +var nilValue reflect.Value + +// assignValue assigns a value 'pv' to the struct pointed to by 'val', given a // slice of field indices. It recurses into the struct until it finds the field // specified by the indices. It creates new values for pointer types where // needed. @@ -172,6 +174,11 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) { rv := val.Field(fi[0]) fi = fi[1:] if len(fi) == 0 { + if pv == nilValue { + pv = reflect.Zero(rv.Type()) + rv.Set(pv) + return + } rt := rv.Type() pt := pv.Type() @@ -182,6 +189,24 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) { rt = rv.Type() } + // If the target type is a slice, but the source is not, deference any ArrayOfXYZ type + if rt.Kind() == reflect.Slice && pt.Kind() != reflect.Slice { + if pt.Kind() == reflect.Ptr { + pv = pv.Elem() + pt = pt.Elem() + } + + m := arrayOfRegexp.FindStringSubmatch(pt.Name()) + if len(m) > 0 { + pv = pv.FieldByName(m[1]) // ArrayOfXYZ type has single field named XYZ + pt = pv.Type() + + if !pv.IsValid() { + panic(fmt.Sprintf("expected %s type to have field %s", m[0], m[1])) + } + } + } + // If type is an interface, check if pv implements it. if rt.Kind() == reflect.Interface && !pt.Implements(rt) { // Check if pointer to pv implements it. @@ -193,6 +218,9 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) { } else { panic(fmt.Sprintf("type %s doesn't implement %s", pt.Name(), rt.Name())) } + } else if rt.Kind() == reflect.Struct && pt.Kind() == reflect.Ptr { + pv = pv.Elem() + pt = pv.Type() } if pt.AssignableTo(rt) { @@ -200,7 +228,7 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) { } else if rt.ConvertibleTo(pt) { rv.Set(pv.Convert(rt)) } else { - panic(fmt.Sprintf("cannot assign %s (%s) to %s (%s)", rt.Name(), rt.Kind(), pt.Name(), pt.Kind())) + panic(fmt.Sprintf("cannot assign %q (%s) to %q (%s)", rt.Name(), rt.Kind(), pt.Name(), pt.Kind())) } return @@ -211,23 +239,6 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) { var arrayOfRegexp = regexp.MustCompile("ArrayOf(.*)$") -func anyTypeToValue(t interface{}) reflect.Value { - rt := reflect.TypeOf(t) - rv := reflect.ValueOf(t) - - // Dereference if ArrayOfXYZ type - m := arrayOfRegexp.FindStringSubmatch(rt.Name()) - if len(m) > 0 { - // ArrayOfXYZ type has single field named XYZ - rv = rv.FieldByName(m[1]) - if !rv.IsValid() { - panic(fmt.Sprintf("expected %s type to have field %s", m[0], m[1])) - } - } - - return rv -} - // LoadObjectFromContent loads properties from the 'PropSet' field in the // specified ObjectContent value into the value it represents, which is // returned as a reflect.Value. @@ -240,7 +251,7 @@ func (t *typeInfo) LoadFromObjectContent(o types.ObjectContent) (reflect.Value, if !ok { continue } - assignValue(v, rv, anyTypeToValue(p.Val)) + assignValue(v, rv, reflect.ValueOf(p.Val)) } return v, nil diff --git a/vendor/github.com/vmware/govmomi/vim25/progress/reader.go b/vendor/github.com/vmware/govmomi/vim25/progress/reader.go index a981cb4e1..e37cd13cb 100644 --- a/vendor/github.com/vmware/govmomi/vim25/progress/reader.go +++ b/vendor/github.com/vmware/govmomi/vim25/progress/reader.go @@ -18,6 +18,7 @@ package progress import ( "container/list" + "context" "fmt" "io" "sync/atomic" @@ -25,11 +26,11 @@ import ( ) type readerReport struct { - t time.Time + pos int64 // Keep first to ensure 64-bit alignment + size int64 // Keep first to ensure 64-bit alignment + bps *uint64 // Keep first to ensure 64-bit alignment - pos int64 - size int64 - bps *uint64 + t time.Time err error } @@ -75,16 +76,16 @@ type reader struct { pos int64 size int64 + bps uint64 - bps uint64 - - ch chan<- Report + ch chan<- Report + ctx context.Context } -func NewReader(s Sinker, r io.Reader, size int64) *reader { +func NewReader(ctx context.Context, s Sinker, r io.Reader, size int64) *reader { pr := reader{ - r: r, - + r: r, + ctx: ctx, size: size, } @@ -99,11 +100,12 @@ func NewReader(s Sinker, r io.Reader, size int64) *reader { // underlying channel. func (r *reader) Read(b []byte) (int, error) { n, err := r.r.Read(b) - if err != nil { + r.pos += int64(n) + + if err != nil && err != io.EOF { return n, err } - r.pos += int64(n) q := readerReport{ t: time.Now(), pos: r.pos, @@ -111,7 +113,10 @@ func (r *reader) Read(b []byte) (int, error) { bps: &r.bps, } - r.ch <- q + select { + case r.ch <- q: + case <-r.ctx.Done(): + } return n, err } @@ -127,8 +132,11 @@ func (r *reader) Done(err error) { err: err, } - r.ch <- q - close(r.ch) + select { + case r.ch <- q: + close(r.ch) + case <-r.ctx.Done(): + } } // newBpsLoop returns a sink that monitors and stores throughput. @@ -150,7 +158,7 @@ func bpsLoop(ch <-chan Report, dst *uint64) { // Setup timer for front of list to become stale. if e := l.Front(); e != nil { - dt := time.Second - time.Now().Sub(e.Value.(readerReport).t) + dt := time.Second - time.Since(e.Value.(readerReport).t) tch = time.After(dt) } diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client.go b/vendor/github.com/vmware/govmomi/vim25/soap/client.go index 520929692..705bc46cb 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/client.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,12 +28,14 @@ import ( "fmt" "io" "io/ioutil" + "log" "net" "net/http" "net/http/cookiejar" "net/url" "os" "path/filepath" + "reflect" "regexp" "strings" "sync" @@ -53,15 +55,9 @@ type RoundTripper interface { } const ( - DefaultVimNamespace = "urn:vim25" - DefaultVimVersion = "6.5" - DefaultMinVimVersion = "5.5" + SessionCookieName = "vmware_soap_session" ) -type header struct { - Cookie string `xml:"vcSessionCookie,omitempty"` -} - type Client struct { http.Client @@ -69,20 +65,31 @@ type Client struct { k bool // Named after curl's -k flag d *debugContainer t *http.Transport - p *url.URL hostsMu sync.Mutex hosts map[string]string Namespace string // Vim namespace Version string // Vim version + Types types.Func UserAgent string - header *header + cookie string } var schemeMatch = regexp.MustCompile(`^\w+://`) +type errInvalidCACertificate struct { + File string +} + +func (e errInvalidCACertificate) Error() string { + return fmt.Sprintf( + "invalid certificate '%s', cannot be used as a trusted CA certificate", + e.File, + ) +} + // ParseURL is wrapper around url.Parse, where Scheme defaults to "https" and Path defaults to "/sdk" func ParseURL(s string) (*url.URL, error) { var err error @@ -117,6 +124,8 @@ func NewClient(u *url.URL, insecure bool) *Client { u: u, k: insecure, d: newDebug(), + + Types: types.TypeFunc(), } // Initialize http.RoundTripper on client, so we can customize it below @@ -147,35 +156,62 @@ func NewClient(u *url.URL, insecure bool) *Client { c.u = c.URL() c.u.User = nil - c.Namespace = DefaultVimNamespace - c.Version = DefaultVimVersion - return &c } // NewServiceClient creates a NewClient with the given URL.Path and namespace. func (c *Client) NewServiceClient(path string, namespace string) *Client { - u := c.URL() - u.Path = path + vc := c.URL() + u, err := url.Parse(path) + if err != nil { + log.Panicf("url.Parse(%q): %s", path, err) + } + if u.Host == "" { + u.Scheme = vc.Scheme + u.Host = vc.Host + } client := NewClient(u, c.k) + client.Namespace = "urn:" + namespace + client.Transport.(*http.Transport).TLSClientConfig = c.Transport.(*http.Transport).TLSClientConfig + if cert := c.Certificate(); cert != nil { + client.SetCertificate(*cert) + } - client.Namespace = namespace + // Copy the trusted thumbprints + c.hostsMu.Lock() + for k, v := range c.hosts { + client.hosts[k] = v + } + c.hostsMu.Unlock() // Copy the cookies client.Client.Jar.SetCookies(u, c.Client.Jar.Cookies(u)) // Set SOAP Header cookie for _, cookie := range client.Jar.Cookies(u) { - if cookie.Name == "vmware_soap_session" { - client.header = &header{ - Cookie: cookie.Value, - } - + if cookie.Name == SessionCookieName { + client.cookie = cookie.Value break } } + // Copy any query params (e.g. GOVMOMI_TUNNEL_PROXY_PORT used in testing) + client.u.RawQuery = vc.RawQuery + + client.UserAgent = c.UserAgent + + vimTypes := c.Types + client.Types = func(name string) (reflect.Type, bool) { + kind, ok := vimTypes(name) + if ok { + return kind, ok + } + // vim25/xml typeToString() does not have an option to include namespace prefix. + // Workaround this by re-trying the lookup with the namespace prefix. + return vimTypes(namespace + ":" + name) + } + return client } @@ -188,12 +224,16 @@ func (c *Client) SetRootCAs(file string) error { pool := x509.NewCertPool() for _, name := range filepath.SplitList(file) { - pem, err := ioutil.ReadFile(name) + pem, err := ioutil.ReadFile(filepath.Clean(name)) if err != nil { return err } - pool.AppendCertsFromPEM(pem) + if ok := pool.AppendCertsFromPEM(pem); !ok { + return errInvalidCACertificate{ + File: name, + } + } } c.t.TLSClientConfig.RootCAs = pool @@ -254,7 +294,7 @@ func (c *Client) LoadThumbprints(file string) error { } func (c *Client) loadThumbprints(name string) error { - f, err := os.Open(name) + f, err := os.Open(filepath.Clean(name)) if err != nil { if os.IsNotExist(err) { return nil @@ -323,7 +363,7 @@ func (c *Client) dialTLS(network string, addr string) (net.Conn, error) { if thumbprint != peer { _ = conn.Close() - return nil, fmt.Errorf("Host %q thumbprint does not match %q", addr, thumbprint) + return nil, fmt.Errorf("host %q thumbprint does not match %q", addr, thumbprint) } return conn, nil @@ -347,19 +387,33 @@ func splitHostPort(host string) (string, string) { const sdkTunnel = "sdkTunnel:8089" +func (c *Client) Certificate() *tls.Certificate { + certs := c.t.TLSClientConfig.Certificates + if len(certs) == 0 { + return nil + } + return &certs[0] +} + func (c *Client) SetCertificate(cert tls.Certificate) { t := c.Client.Transport.(*http.Transport) - // Extension certificate + // Extension or HoK certificate t.TLSClientConfig.Certificates = []tls.Certificate{cert} +} +// Tunnel returns a Client configured to proxy requests through vCenter's http port 80, +// to the SDK tunnel virtual host. Use of the SDK tunnel is required by LoginExtensionByCertificate() +// and optional for other methods. +func (c *Client) Tunnel() *Client { + tunnel := c.NewServiceClient(c.u.Path, c.Namespace) + t := tunnel.Client.Transport.(*http.Transport) // Proxy to vCenter host on port 80 - host, _ := splitHostPort(c.u.Host) - + host := tunnel.u.Hostname() // Should be no reason to change the default port other than testing key := "GOVMOMI_TUNNEL_PROXY_PORT" - port := c.URL().Query().Get(key) + port := tunnel.URL().Query().Get(key) if port == "" { port = os.Getenv(key) } @@ -368,20 +422,14 @@ func (c *Client) SetCertificate(cert tls.Certificate) { host += ":" + port } - c.p = &url.URL{ + t.Proxy = http.ProxyURL(&url.URL{ Scheme: "http", Host: host, - } - t.Proxy = func(r *http.Request) (*url.URL, error) { - // Only sdk requests should be proxied - if r.URL.Path == "/sdk" { - return c.p, nil - } - return http.ProxyFromEnvironment(r) - } + }) // Rewrite url Host to use the sdk tunnel, required for a certificate request. - c.u.Host = sdkTunnel + tunnel.u.Host = sdkTunnel + return tunnel } func (c *Client) URL() *url.URL { @@ -393,6 +441,7 @@ type marshaledClient struct { Cookies []*http.Cookie URL *url.URL Insecure bool + Version string } func (c *Client) MarshalJSON() ([]byte, error) { @@ -400,6 +449,7 @@ func (c *Client) MarshalJSON() ([]byte, error) { Cookies: c.Jar.Cookies(c.u), URL: c.u, Insecure: c.k, + Version: c.Version, } return json.Marshal(m) @@ -414,36 +464,106 @@ func (c *Client) UnmarshalJSON(b []byte) error { } *c = *NewClient(m.URL, m.Insecure) + c.Version = m.Version c.Jar.SetCookies(m.URL, m.Cookies) return nil } -func (c *Client) do(ctx context.Context, req *http.Request) (*http.Response, error) { - if nil == ctx || nil == ctx.Done() { // ctx.Done() is for ctx - return c.Client.Do(req) +type kindContext struct{} + +func (c *Client) Do(ctx context.Context, req *http.Request, f func(*http.Response) error) error { + if ctx == nil { + ctx = context.Background() } - - return c.Client.Do(req.WithContext(ctx)) -} - -func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error { - var err error - - reqEnv := Envelope{Body: reqBody} - resEnv := Envelope{Body: resBody} - - reqEnv.Header = c.header - // Create debugging context for this round trip d := c.d.newRoundTrip() if d.enabled() { defer d.done() } - b, err := xml.Marshal(reqEnv) + if c.UserAgent != "" { + req.Header.Set(`User-Agent`, c.UserAgent) + } + + ext := "" + if d.enabled() { + ext = d.debugRequest(req) + } + + tstart := time.Now() + res, err := c.Client.Do(req.WithContext(ctx)) + tstop := time.Now() + + if d.enabled() { + var name string + if kind, ok := ctx.Value(kindContext{}).(HasFault); ok { + name = fmt.Sprintf("%T", kind) + } else { + name = fmt.Sprintf("%s %s", req.Method, req.URL) + } + d.logf("%6dms (%s)", tstop.Sub(tstart)/time.Millisecond, name) + } + if err != nil { - panic(err) + return err + } + + defer res.Body.Close() + + if d.enabled() { + d.debugResponse(res, ext) + } + + return f(res) +} + +// Signer can be implemented by soap.Header.Security to sign requests. +// If the soap.Header.Security field is set to an implementation of Signer via WithHeader(), +// then Client.RoundTrip will call Sign() to marshal the SOAP request. +type Signer interface { + Sign(Envelope) ([]byte, error) +} + +type headerContext struct{} + +// WithHeader can be used to modify the outgoing request soap.Header fields. +func (c *Client) WithHeader(ctx context.Context, header Header) context.Context { + return context.WithValue(ctx, headerContext{}, header) +} + +func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error { + var err error + var b []byte + + reqEnv := Envelope{Body: reqBody} + resEnv := Envelope{Body: resBody} + + h, ok := ctx.Value(headerContext{}).(Header) + if !ok { + h = Header{} + } + + // We added support for OperationID before soap.Header was exported. + if id, ok := ctx.Value(types.ID{}).(string); ok { + h.ID = id + } + + h.Cookie = c.cookie + if h.Cookie != "" || h.ID != "" || h.Security != nil { + reqEnv.Header = &h // XML marshal header only if a field is set + } + + if signer, ok := h.Security.(Signer); ok { + b, err = signer.Sign(reqEnv) + if err != nil { + return err + } + } else { + b, err = xml.Marshal(reqEnv) + if err != nil { + panic(err) + } } rawReqBody := io.MultiReader(strings.NewReader(xml.Header), bytes.NewReader(b)) @@ -453,56 +573,36 @@ func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error } req.Header.Set(`Content-Type`, `text/xml; charset="utf-8"`) - soapAction := fmt.Sprintf("%s/%s", c.Namespace, c.Version) - req.Header.Set(`SOAPAction`, soapAction) - if c.UserAgent != "" { - req.Header.Set(`User-Agent`, c.UserAgent) + + action := h.Action + if action == "" { + action = fmt.Sprintf("%s/%s", c.Namespace, c.Version) } + req.Header.Set(`SOAPAction`, action) - if d.enabled() { - d.debugRequest(req) - } + return c.Do(context.WithValue(ctx, kindContext{}, resBody), req, func(res *http.Response) error { + switch res.StatusCode { + case http.StatusOK: + // OK + case http.StatusInternalServerError: + // Error, but typically includes a body explaining the error + default: + return errors.New(res.Status) + } - tstart := time.Now() - res, err := c.do(ctx, req) - tstop := time.Now() + dec := xml.NewDecoder(res.Body) + dec.TypeFunc = c.Types + err = dec.Decode(&resEnv) + if err != nil { + return err + } - if d.enabled() { - d.logf("%6dms (%T)", tstop.Sub(tstart)/time.Millisecond, resBody) - } + if f := resBody.Fault(); f != nil { + return WrapSoapFault(f) + } - if err != nil { return err - } - - if d.enabled() { - d.debugResponse(res) - } - - // Close response regardless of what happens next - defer res.Body.Close() - - switch res.StatusCode { - case http.StatusOK: - // OK - case http.StatusInternalServerError: - // Error, but typically includes a body explaining the error - default: - return errors.New(res.Status) - } - - dec := xml.NewDecoder(res.Body) - dec.TypeFunc = types.TypeFunc() - err = dec.Decode(&resEnv) - if err != nil { - return err - } - - if f := resBody.Fault(); f != nil { - return WrapSoapFault(f) - } - - return err + }) } func (c *Client) CloseIdleConnections() { @@ -542,11 +642,11 @@ var DefaultUpload = Upload{ } // Upload PUTs the local file to the given URL -func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error { +func (c *Client) Upload(ctx context.Context, f io.Reader, u *url.URL, param *Upload) error { var err error if param.Progress != nil { - pr := progress.NewReader(param.Progress, f, param.ContentLength) + pr := progress.NewReader(ctx, param.Progress, f, param.ContentLength) f = pr // Mark progress reader as done when returning from this function. @@ -560,6 +660,8 @@ func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error { return err } + req = req.WithContext(ctx) + req.ContentLength = param.ContentLength req.Header.Set("Content-Type", param.Type) @@ -576,6 +678,8 @@ func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error { return err } + defer res.Body.Close() + switch res.StatusCode { case http.StatusOK: case http.StatusCreated: @@ -587,7 +691,7 @@ func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error { } // UploadFile PUTs the local file to the given URL -func (c *Client) UploadFile(file string, u *url.URL, param *Upload) error { +func (c *Client) UploadFile(ctx context.Context, file string, u *url.URL, param *Upload) error { if param == nil { p := DefaultUpload // Copy since we set ContentLength param = &p @@ -598,7 +702,7 @@ func (c *Client) UploadFile(file string, u *url.URL, param *Upload) error { return err } - f, err := os.Open(file) + f, err := os.Open(filepath.Clean(file)) if err != nil { return err } @@ -606,7 +710,7 @@ func (c *Client) UploadFile(file string, u *url.URL, param *Upload) error { param.ContentLength = s.Size() - return c.Upload(f, u, param) + return c.Upload(ctx, f, u, param) } type Download struct { @@ -614,6 +718,7 @@ type Download struct { Headers map[string]string Ticket *http.Cookie Progress progress.Sinker + Writer io.Writer } var DefaultDownload = Download{ @@ -621,12 +726,14 @@ var DefaultDownload = Download{ } // DownloadRequest wraps http.Client.Do, returning the http.Response without checking its StatusCode -func (c *Client) DownloadRequest(u *url.URL, param *Download) (*http.Response, error) { +func (c *Client) DownloadRequest(ctx context.Context, u *url.URL, param *Download) (*http.Response, error) { req, err := http.NewRequest(param.Method, u.String(), nil) if err != nil { return nil, err } + req = req.WithContext(ctx) + for k, v := range param.Headers { req.Header.Add(k, v) } @@ -638,39 +745,9 @@ func (c *Client) DownloadRequest(u *url.URL, param *Download) (*http.Response, e return c.Client.Do(req) } -// directoryReader wraps an io.ReadCloser to support streaming download -// of a guest directory, stops reading once it sees the stream trailer. -// This is only useful when guest tools is the Go toolbox. -// The trailer is required since TransferFromGuest requires a Content-Length, -// which toolbox doesn't know ahead of time as the gzip'd tarball never touches the disk. -// We opted to wrap this here for now rather than guest.FileManager so -// DownloadFile can be also be used as-is to handle this use case. -type directoryReader struct { - io.ReadCloser -} - -var ( - gzipHeader = []byte{0x1f, 0x8b, 0x08} // rfc1952 {ID1, ID2, CM} - gzipHeaderLen = len(gzipHeader) -) - -func (r *directoryReader) Read(buf []byte) (int, error) { - nr, err := r.ReadCloser.Read(buf) - - // Stop reading if the last N bytes are the gzipTrailer - if nr >= gzipHeaderLen { - if bytes.Equal(buf[nr-gzipHeaderLen:nr], gzipHeader) { - nr -= gzipHeaderLen - err = io.EOF - } - } - - return nr, err -} - // Download GETs the remote file from the given URL -func (c *Client) Download(u *url.URL, param *Download) (io.ReadCloser, int64, error) { - res, err := c.DownloadRequest(u, param) +func (c *Client) Download(ctx context.Context, u *url.URL, param *Download) (io.ReadCloser, int64, error) { + res, err := c.DownloadRequest(ctx, u, param) if err != nil { return nil, 0, err } @@ -687,37 +764,22 @@ func (c *Client) Download(u *url.URL, param *Download) (io.ReadCloser, int64, er r := res.Body - if strings.HasSuffix(u.Path, "/") { - r = &directoryReader{ReadCloser: r} - } - return r, res.ContentLength, nil } -// DownloadFile GETs the given URL to a local file -func (c *Client) DownloadFile(file string, u *url.URL, param *Download) error { +func (c *Client) WriteFile(ctx context.Context, file string, src io.Reader, size int64, s progress.Sinker, w io.Writer) error { var err error - if param == nil { - param = &DefaultDownload - } - rc, contentLength, err := c.Download(u, param) - if err != nil { - return err - } - defer rc.Close() - - var r io.Reader = rc + r := src fh, err := os.Create(file) if err != nil { return err } - defer fh.Close() - if param.Progress != nil { - pr := progress.NewReader(param.Progress, r, contentLength) - r = pr + if s != nil { + pr := progress.NewReader(ctx, s, src, size) + src = pr // Mark progress reader as done when returning from this function. defer func() { @@ -725,17 +787,34 @@ func (c *Client) DownloadFile(file string, u *url.URL, param *Download) error { }() } - _, err = io.Copy(fh, r) - if err != nil { - return err + if w == nil { + w = fh + } else { + w = io.MultiWriter(w, fh) } - // Assign error before returning so that it gets picked up by the deferred - // function marking the progress reader as done. - err = fh.Close() - if err != nil { - return err + _, err = io.Copy(w, r) + + cerr := fh.Close() + + if err == nil { + err = cerr } - return nil + return err +} + +// DownloadFile GETs the given URL to a local file +func (c *Client) DownloadFile(ctx context.Context, file string, u *url.URL, param *Download) error { + var err error + if param == nil { + param = &DefaultDownload + } + + rc, contentLength, err := c.Download(ctx, u, param) + if err != nil { + return err + } + + return c.WriteFile(ctx, file, rc, contentLength, param.Progress, param.Writer) } diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/debug.go b/vendor/github.com/vmware/govmomi/vim25/soap/debug.go index 63518abca..3d4b57704 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/debug.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/debug.go @@ -69,42 +69,50 @@ func (d *debugRoundTrip) newFile(suffix string) io.WriteCloser { return debug.NewFile(fmt.Sprintf("%d-%04d.%s", d.cn, d.rn, suffix)) } -func (d *debugRoundTrip) debugRequest(req *http.Request) { +func (d *debugRoundTrip) ext(h http.Header) string { + const json = "application/json" + ext := "xml" + if h.Get("Accept") == json || h.Get("Content-Type") == json { + ext = "json" + } + return ext +} + +func (d *debugRoundTrip) debugRequest(req *http.Request) string { if d == nil { - return + return "" } - var wc io.WriteCloser - // Capture headers - wc = d.newFile("req.headers") + var wc io.WriteCloser = d.newFile("req.headers") b, _ := httputil.DumpRequest(req, false) wc.Write(b) wc.Close() + ext := d.ext(req.Header) // Capture body - wc = d.newFile("req.xml") + wc = d.newFile("req." + ext) req.Body = newTeeReader(req.Body, wc) // Delay closing until marked done d.cs = append(d.cs, wc) + + return ext } -func (d *debugRoundTrip) debugResponse(res *http.Response) { +func (d *debugRoundTrip) debugResponse(res *http.Response, ext string) { if d == nil { return } - var wc io.WriteCloser - // Capture headers - wc = d.newFile("res.headers") + var wc io.WriteCloser = d.newFile("res.headers") b, _ := httputil.DumpResponse(res, false) wc.Write(b) wc.Close() // Capture body - wc = d.newFile("res.xml") + wc = d.newFile("res." + ext) res.Body = newTeeReader(res.Body, wc) // Delay closing until marked done diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/error.go b/vendor/github.com/vmware/govmomi/vim25/soap/error.go index d89208522..46111556c 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/error.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/error.go @@ -39,7 +39,11 @@ func (s soapFaultError) Error() string { msg := s.fault.String if msg == "" { - msg = reflect.TypeOf(s.fault.Detail.Fault).Name() + if s.fault.Detail.Fault == nil { + msg = "unknown fault" + } else { + msg = reflect.TypeOf(s.fault.Detail.Fault).Name() + } } return fmt.Sprintf("%s: %s", s.fault.Code, msg) diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/soap.go b/vendor/github.com/vmware/govmomi/vim25/soap/soap.go index a8baa0122..a8dc121ba 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/soap.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/soap.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,9 +21,17 @@ import ( "github.com/vmware/govmomi/vim25/xml" ) +// Header includes optional soap Header fields. +type Header struct { + Action string `xml:"-"` // Action is the 'SOAPAction' HTTP header value. Defaults to "Client.Namespace/Client.Version". + Cookie string `xml:"vcSessionCookie,omitempty"` // Cookie is a vCenter session cookie that can be used with other SDK endpoints (e.g. pbm). + ID string `xml:"operationID,omitempty"` // ID is the operationID used by ESX/vCenter logging for correlation. + Security interface{} `xml:",omitempty"` // Security is used for SAML token authentication and request signing. +} + type Envelope struct { - XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` - Header interface{} `xml:",omitempty"` + XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` + Header *Header `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header,omitempty"` Body interface{} } diff --git a/vendor/github.com/vmware/govmomi/vim25/types/enum.go b/vendor/github.com/vmware/govmomi/vim25/types/enum.go index 02f7f3cb5..ed9dad1c4 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/enum.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/enum.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -82,6 +82,59 @@ func init() { t["AgentInstallFailedReason"] = reflect.TypeOf((*AgentInstallFailedReason)(nil)).Elem() } +type AlarmFilterSpecAlarmTypeByEntity string + +const ( + AlarmFilterSpecAlarmTypeByEntityEntityTypeAll = AlarmFilterSpecAlarmTypeByEntity("entityTypeAll") + AlarmFilterSpecAlarmTypeByEntityEntityTypeHost = AlarmFilterSpecAlarmTypeByEntity("entityTypeHost") + AlarmFilterSpecAlarmTypeByEntityEntityTypeVm = AlarmFilterSpecAlarmTypeByEntity("entityTypeVm") +) + +func init() { + t["AlarmFilterSpecAlarmTypeByEntity"] = reflect.TypeOf((*AlarmFilterSpecAlarmTypeByEntity)(nil)).Elem() +} + +type AlarmFilterSpecAlarmTypeByTrigger string + +const ( + AlarmFilterSpecAlarmTypeByTriggerTriggerTypeAll = AlarmFilterSpecAlarmTypeByTrigger("triggerTypeAll") + AlarmFilterSpecAlarmTypeByTriggerTriggerTypeEvent = AlarmFilterSpecAlarmTypeByTrigger("triggerTypeEvent") + AlarmFilterSpecAlarmTypeByTriggerTriggerTypeMetric = AlarmFilterSpecAlarmTypeByTrigger("triggerTypeMetric") +) + +func init() { + t["AlarmFilterSpecAlarmTypeByTrigger"] = reflect.TypeOf((*AlarmFilterSpecAlarmTypeByTrigger)(nil)).Elem() +} + +type AnswerFileValidationInfoStatus string + +const ( + AnswerFileValidationInfoStatusSuccess = AnswerFileValidationInfoStatus("success") + AnswerFileValidationInfoStatusFailed = AnswerFileValidationInfoStatus("failed") + AnswerFileValidationInfoStatusFailed_defaults = AnswerFileValidationInfoStatus("failed_defaults") +) + +func init() { + t["AnswerFileValidationInfoStatus"] = reflect.TypeOf((*AnswerFileValidationInfoStatus)(nil)).Elem() +} + +type ApplyHostProfileConfigurationResultStatus string + +const ( + ApplyHostProfileConfigurationResultStatusSuccess = ApplyHostProfileConfigurationResultStatus("success") + ApplyHostProfileConfigurationResultStatusFailed = ApplyHostProfileConfigurationResultStatus("failed") + ApplyHostProfileConfigurationResultStatusReboot_failed = ApplyHostProfileConfigurationResultStatus("reboot_failed") + ApplyHostProfileConfigurationResultStatusStateless_reboot_failed = ApplyHostProfileConfigurationResultStatus("stateless_reboot_failed") + ApplyHostProfileConfigurationResultStatusCheck_compliance_failed = ApplyHostProfileConfigurationResultStatus("check_compliance_failed") + ApplyHostProfileConfigurationResultStatusState_not_satisfied = ApplyHostProfileConfigurationResultStatus("state_not_satisfied") + ApplyHostProfileConfigurationResultStatusExit_maintenancemode_failed = ApplyHostProfileConfigurationResultStatus("exit_maintenancemode_failed") + ApplyHostProfileConfigurationResultStatusCanceled = ApplyHostProfileConfigurationResultStatus("canceled") +) + +func init() { + t["ApplyHostProfileConfigurationResultStatus"] = reflect.TypeOf((*ApplyHostProfileConfigurationResultStatus)(nil)).Elem() +} + type ArrayUpdateOperation string const ( @@ -206,6 +259,18 @@ func init() { t["CheckTestType"] = reflect.TypeOf((*CheckTestType)(nil)).Elem() } +type ClusterComputeResourceHCIWorkflowState string + +const ( + ClusterComputeResourceHCIWorkflowStateIn_progress = ClusterComputeResourceHCIWorkflowState("in_progress") + ClusterComputeResourceHCIWorkflowStateDone = ClusterComputeResourceHCIWorkflowState("done") + ClusterComputeResourceHCIWorkflowStateInvalid = ClusterComputeResourceHCIWorkflowState("invalid") +) + +func init() { + t["ClusterComputeResourceHCIWorkflowState"] = reflect.TypeOf((*ClusterComputeResourceHCIWorkflowState)(nil)).Elem() +} + type ClusterDasAamNodeStateDasState string const ( @@ -410,6 +475,7 @@ const ( ComplianceResultStatusCompliant = ComplianceResultStatus("compliant") ComplianceResultStatusNonCompliant = ComplianceResultStatus("nonCompliant") ComplianceResultStatusUnknown = ComplianceResultStatus("unknown") + ComplianceResultStatusRunning = ComplianceResultStatus("running") ) func init() { @@ -440,6 +506,20 @@ func init() { t["ConfigSpecOperation"] = reflect.TypeOf((*ConfigSpecOperation)(nil)).Elem() } +type CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason string + +const ( + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateMissingInCache = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("KeyStateMissingInCache") + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateClusterInvalid = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("KeyStateClusterInvalid") + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateClusterUnreachable = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("KeyStateClusterUnreachable") + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateMissingInKMS = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("KeyStateMissingInKMS") + CryptoManagerKmipCryptoKeyStatusKeyUnavailableReasonKeyStateNotActiveOrEnabled = CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason("KeyStateNotActiveOrEnabled") +) + +func init() { + t["CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatusKeyUnavailableReason)(nil)).Elem() +} + type CustomizationLicenseDataMode string const ( @@ -499,6 +579,17 @@ func init() { t["DVPortStatusVmDirectPathGen2InactiveReasonOther"] = reflect.TypeOf((*DVPortStatusVmDirectPathGen2InactiveReasonOther)(nil)).Elem() } +type DVSMacLimitPolicyType string + +const ( + DVSMacLimitPolicyTypeAllow = DVSMacLimitPolicyType("allow") + DVSMacLimitPolicyTypeDrop = DVSMacLimitPolicyType("drop") +) + +func init() { + t["DVSMacLimitPolicyType"] = reflect.TypeOf((*DVSMacLimitPolicyType)(nil)).Elem() +} + type DasConfigFaultDasConfigFaultReason string const ( @@ -932,6 +1023,17 @@ func init() { t["FileSystemMountInfoVStorageSupportStatus"] = reflect.TypeOf((*FileSystemMountInfoVStorageSupportStatus)(nil)).Elem() } +type FolderDesiredHostState string + +const ( + FolderDesiredHostStateMaintenance = FolderDesiredHostState("maintenance") + FolderDesiredHostStateNon_maintenance = FolderDesiredHostState("non_maintenance") +) + +func init() { + t["FolderDesiredHostState"] = reflect.TypeOf((*FolderDesiredHostState)(nil)).Elem() +} + type FtIssuesOnHostHostSelectionType string const ( @@ -1079,6 +1181,18 @@ func init() { t["HostCapabilityFtUnsupportedReason"] = reflect.TypeOf((*HostCapabilityFtUnsupportedReason)(nil)).Elem() } +type HostCapabilityUnmapMethodSupported string + +const ( + HostCapabilityUnmapMethodSupportedPriority = HostCapabilityUnmapMethodSupported("priority") + HostCapabilityUnmapMethodSupportedFixed = HostCapabilityUnmapMethodSupported("fixed") + HostCapabilityUnmapMethodSupportedDynamic = HostCapabilityUnmapMethodSupported("dynamic") +) + +func init() { + t["HostCapabilityUnmapMethodSupported"] = reflect.TypeOf((*HostCapabilityUnmapMethodSupported)(nil)).Elem() +} + type HostCapabilityVmDirectPathGen2UnsupportedReason string const ( @@ -1136,6 +1250,7 @@ const ( HostCpuPackageVendorUnknown = HostCpuPackageVendor("unknown") HostCpuPackageVendorIntel = HostCpuPackageVendor("intel") HostCpuPackageVendorAmd = HostCpuPackageVendor("amd") + HostCpuPackageVendorHygon = HostCpuPackageVendor("hygon") ) func init() { @@ -1186,8 +1301,12 @@ func init() { type HostDigestInfoDigestMethodType string const ( - HostDigestInfoDigestMethodTypeSHA1 = HostDigestInfoDigestMethodType("SHA1") - HostDigestInfoDigestMethodTypeMD5 = HostDigestInfoDigestMethodType("MD5") + HostDigestInfoDigestMethodTypeSHA1 = HostDigestInfoDigestMethodType("SHA1") + HostDigestInfoDigestMethodTypeMD5 = HostDigestInfoDigestMethodType("MD5") + HostDigestInfoDigestMethodTypeSHA256 = HostDigestInfoDigestMethodType("SHA256") + HostDigestInfoDigestMethodTypeSHA384 = HostDigestInfoDigestMethodType("SHA384") + HostDigestInfoDigestMethodTypeSHA512 = HostDigestInfoDigestMethodType("SHA512") + HostDigestInfoDigestMethodTypeSM3_256 = HostDigestInfoDigestMethodType("SM3_256") ) func init() { @@ -1261,6 +1380,7 @@ const ( HostFileSystemVolumeFileSystemTypeVsan = HostFileSystemVolumeFileSystemType("vsan") HostFileSystemVolumeFileSystemTypeVFFS = HostFileSystemVolumeFileSystemType("VFFS") HostFileSystemVolumeFileSystemTypeVVOL = HostFileSystemVolumeFileSystemType("VVOL") + HostFileSystemVolumeFileSystemTypePMEM = HostFileSystemVolumeFileSystemType("PMEM") HostFileSystemVolumeFileSystemTypeOTHER = HostFileSystemVolumeFileSystemType("OTHER") ) @@ -1720,6 +1840,28 @@ func init() { t["HostProfileManagerAnswerFileStatus"] = reflect.TypeOf((*HostProfileManagerAnswerFileStatus)(nil)).Elem() } +type HostProfileManagerCompositionResultResultElementStatus string + +const ( + HostProfileManagerCompositionResultResultElementStatusSuccess = HostProfileManagerCompositionResultResultElementStatus("success") + HostProfileManagerCompositionResultResultElementStatusError = HostProfileManagerCompositionResultResultElementStatus("error") +) + +func init() { + t["HostProfileManagerCompositionResultResultElementStatus"] = reflect.TypeOf((*HostProfileManagerCompositionResultResultElementStatus)(nil)).Elem() +} + +type HostProfileManagerCompositionValidationResultResultElementStatus string + +const ( + HostProfileManagerCompositionValidationResultResultElementStatusSuccess = HostProfileManagerCompositionValidationResultResultElementStatus("success") + HostProfileManagerCompositionValidationResultResultElementStatusError = HostProfileManagerCompositionValidationResultResultElementStatus("error") +) + +func init() { + t["HostProfileManagerCompositionValidationResultResultElementStatus"] = reflect.TypeOf((*HostProfileManagerCompositionValidationResultResultElementStatus)(nil)).Elem() +} + type HostProfileManagerTaskListRequirement string const ( @@ -1731,6 +1873,31 @@ func init() { t["HostProfileManagerTaskListRequirement"] = reflect.TypeOf((*HostProfileManagerTaskListRequirement)(nil)).Elem() } +type HostProfileValidationFailureInfoUpdateType string + +const ( + HostProfileValidationFailureInfoUpdateTypeHostBased = HostProfileValidationFailureInfoUpdateType("HostBased") + HostProfileValidationFailureInfoUpdateTypeImport = HostProfileValidationFailureInfoUpdateType("Import") + HostProfileValidationFailureInfoUpdateTypeEdit = HostProfileValidationFailureInfoUpdateType("Edit") + HostProfileValidationFailureInfoUpdateTypeCompose = HostProfileValidationFailureInfoUpdateType("Compose") +) + +func init() { + t["HostProfileValidationFailureInfoUpdateType"] = reflect.TypeOf((*HostProfileValidationFailureInfoUpdateType)(nil)).Elem() +} + +type HostProfileValidationState string + +const ( + HostProfileValidationStateReady = HostProfileValidationState("Ready") + HostProfileValidationStateRunning = HostProfileValidationState("Running") + HostProfileValidationStateFailed = HostProfileValidationState("Failed") +) + +func init() { + t["HostProfileValidationState"] = reflect.TypeOf((*HostProfileValidationState)(nil)).Elem() +} + type HostProtocolEndpointPEType string const ( @@ -1834,9 +2001,11 @@ func init() { type HostSystemIdentificationInfoIdentifier string const ( - HostSystemIdentificationInfoIdentifierAssetTag = HostSystemIdentificationInfoIdentifier("AssetTag") - HostSystemIdentificationInfoIdentifierServiceTag = HostSystemIdentificationInfoIdentifier("ServiceTag") - HostSystemIdentificationInfoIdentifierOemSpecificString = HostSystemIdentificationInfoIdentifier("OemSpecificString") + HostSystemIdentificationInfoIdentifierAssetTag = HostSystemIdentificationInfoIdentifier("AssetTag") + HostSystemIdentificationInfoIdentifierServiceTag = HostSystemIdentificationInfoIdentifier("ServiceTag") + HostSystemIdentificationInfoIdentifierOemSpecificString = HostSystemIdentificationInfoIdentifier("OemSpecificString") + HostSystemIdentificationInfoIdentifierEnclosureSerialNumberTag = HostSystemIdentificationInfoIdentifier("EnclosureSerialNumberTag") + HostSystemIdentificationInfoIdentifierSerialNumberTag = HostSystemIdentificationInfoIdentifier("SerialNumberTag") ) func init() { @@ -1856,6 +2025,32 @@ func init() { t["HostSystemPowerState"] = reflect.TypeOf((*HostSystemPowerState)(nil)).Elem() } +type HostSystemRemediationStateState string + +const ( + HostSystemRemediationStateStateRemediationReady = HostSystemRemediationStateState("remediationReady") + HostSystemRemediationStateStatePrecheckRemediationRunning = HostSystemRemediationStateState("precheckRemediationRunning") + HostSystemRemediationStateStatePrecheckRemediationComplete = HostSystemRemediationStateState("precheckRemediationComplete") + HostSystemRemediationStateStatePrecheckRemediationFailed = HostSystemRemediationStateState("precheckRemediationFailed") + HostSystemRemediationStateStateRemediationRunning = HostSystemRemediationStateState("remediationRunning") + HostSystemRemediationStateStateRemediationFailed = HostSystemRemediationStateState("remediationFailed") +) + +func init() { + t["HostSystemRemediationStateState"] = reflect.TypeOf((*HostSystemRemediationStateState)(nil)).Elem() +} + +type HostTpmAttestationInfoAcceptanceStatus string + +const ( + HostTpmAttestationInfoAcceptanceStatusNotAccepted = HostTpmAttestationInfoAcceptanceStatus("notAccepted") + HostTpmAttestationInfoAcceptanceStatusAccepted = HostTpmAttestationInfoAcceptanceStatus("accepted") +) + +func init() { + t["HostTpmAttestationInfoAcceptanceStatus"] = reflect.TypeOf((*HostTpmAttestationInfoAcceptanceStatus)(nil)).Elem() +} + type HostUnresolvedVmfsExtentUnresolvedReason string const ( @@ -1907,6 +2102,17 @@ func init() { t["HostVmciAccessManagerMode"] = reflect.TypeOf((*HostVmciAccessManagerMode)(nil)).Elem() } +type HostVmfsVolumeUnmapBandwidthPolicy string + +const ( + HostVmfsVolumeUnmapBandwidthPolicyFixed = HostVmfsVolumeUnmapBandwidthPolicy("fixed") + HostVmfsVolumeUnmapBandwidthPolicyDynamic = HostVmfsVolumeUnmapBandwidthPolicy("dynamic") +) + +func init() { + t["HostVmfsVolumeUnmapBandwidthPolicy"] = reflect.TypeOf((*HostVmfsVolumeUnmapBandwidthPolicy)(nil)).Elem() +} + type HostVmfsVolumeUnmapPriority string const ( @@ -1918,6 +2124,28 @@ func init() { t["HostVmfsVolumeUnmapPriority"] = reflect.TypeOf((*HostVmfsVolumeUnmapPriority)(nil)).Elem() } +type HttpNfcLeaseManifestEntryChecksumType string + +const ( + HttpNfcLeaseManifestEntryChecksumTypeSha1 = HttpNfcLeaseManifestEntryChecksumType("sha1") + HttpNfcLeaseManifestEntryChecksumTypeSha256 = HttpNfcLeaseManifestEntryChecksumType("sha256") +) + +func init() { + t["HttpNfcLeaseManifestEntryChecksumType"] = reflect.TypeOf((*HttpNfcLeaseManifestEntryChecksumType)(nil)).Elem() +} + +type HttpNfcLeaseMode string + +const ( + HttpNfcLeaseModePushOrGet = HttpNfcLeaseMode("pushOrGet") + HttpNfcLeaseModePull = HttpNfcLeaseMode("pull") +) + +func init() { + t["HttpNfcLeaseMode"] = reflect.TypeOf((*HttpNfcLeaseMode)(nil)).Elem() +} + type HttpNfcLeaseState string const ( @@ -2288,6 +2516,110 @@ func init() { t["NumVirtualCpusIncompatibleReason"] = reflect.TypeOf((*NumVirtualCpusIncompatibleReason)(nil)).Elem() } +type NvdimmInterleaveSetState string + +const ( + NvdimmInterleaveSetStateInvalid = NvdimmInterleaveSetState("invalid") + NvdimmInterleaveSetStateActive = NvdimmInterleaveSetState("active") +) + +func init() { + t["NvdimmInterleaveSetState"] = reflect.TypeOf((*NvdimmInterleaveSetState)(nil)).Elem() +} + +type NvdimmNamespaceDetailsHealthStatus string + +const ( + NvdimmNamespaceDetailsHealthStatusNormal = NvdimmNamespaceDetailsHealthStatus("normal") + NvdimmNamespaceDetailsHealthStatusMissing = NvdimmNamespaceDetailsHealthStatus("missing") + NvdimmNamespaceDetailsHealthStatusLabelMissing = NvdimmNamespaceDetailsHealthStatus("labelMissing") + NvdimmNamespaceDetailsHealthStatusInterleaveBroken = NvdimmNamespaceDetailsHealthStatus("interleaveBroken") + NvdimmNamespaceDetailsHealthStatusLabelInconsistent = NvdimmNamespaceDetailsHealthStatus("labelInconsistent") +) + +func init() { + t["NvdimmNamespaceDetailsHealthStatus"] = reflect.TypeOf((*NvdimmNamespaceDetailsHealthStatus)(nil)).Elem() +} + +type NvdimmNamespaceDetailsState string + +const ( + NvdimmNamespaceDetailsStateInvalid = NvdimmNamespaceDetailsState("invalid") + NvdimmNamespaceDetailsStateNotInUse = NvdimmNamespaceDetailsState("notInUse") + NvdimmNamespaceDetailsStateInUse = NvdimmNamespaceDetailsState("inUse") +) + +func init() { + t["NvdimmNamespaceDetailsState"] = reflect.TypeOf((*NvdimmNamespaceDetailsState)(nil)).Elem() +} + +type NvdimmNamespaceHealthStatus string + +const ( + NvdimmNamespaceHealthStatusNormal = NvdimmNamespaceHealthStatus("normal") + NvdimmNamespaceHealthStatusMissing = NvdimmNamespaceHealthStatus("missing") + NvdimmNamespaceHealthStatusLabelMissing = NvdimmNamespaceHealthStatus("labelMissing") + NvdimmNamespaceHealthStatusInterleaveBroken = NvdimmNamespaceHealthStatus("interleaveBroken") + NvdimmNamespaceHealthStatusLabelInconsistent = NvdimmNamespaceHealthStatus("labelInconsistent") + NvdimmNamespaceHealthStatusBttCorrupt = NvdimmNamespaceHealthStatus("bttCorrupt") + NvdimmNamespaceHealthStatusBadBlockSize = NvdimmNamespaceHealthStatus("badBlockSize") +) + +func init() { + t["NvdimmNamespaceHealthStatus"] = reflect.TypeOf((*NvdimmNamespaceHealthStatus)(nil)).Elem() +} + +type NvdimmNamespaceState string + +const ( + NvdimmNamespaceStateInvalid = NvdimmNamespaceState("invalid") + NvdimmNamespaceStateNotInUse = NvdimmNamespaceState("notInUse") + NvdimmNamespaceStateInUse = NvdimmNamespaceState("inUse") +) + +func init() { + t["NvdimmNamespaceState"] = reflect.TypeOf((*NvdimmNamespaceState)(nil)).Elem() +} + +type NvdimmNamespaceType string + +const ( + NvdimmNamespaceTypeBlockNamespace = NvdimmNamespaceType("blockNamespace") + NvdimmNamespaceTypePersistentNamespace = NvdimmNamespaceType("persistentNamespace") +) + +func init() { + t["NvdimmNamespaceType"] = reflect.TypeOf((*NvdimmNamespaceType)(nil)).Elem() +} + +type NvdimmNvdimmHealthInfoState string + +const ( + NvdimmNvdimmHealthInfoStateNormal = NvdimmNvdimmHealthInfoState("normal") + NvdimmNvdimmHealthInfoStateError = NvdimmNvdimmHealthInfoState("error") +) + +func init() { + t["NvdimmNvdimmHealthInfoState"] = reflect.TypeOf((*NvdimmNvdimmHealthInfoState)(nil)).Elem() +} + +type NvdimmRangeType string + +const ( + NvdimmRangeTypeVolatileRange = NvdimmRangeType("volatileRange") + NvdimmRangeTypePersistentRange = NvdimmRangeType("persistentRange") + NvdimmRangeTypeControlRange = NvdimmRangeType("controlRange") + NvdimmRangeTypeBlockRange = NvdimmRangeType("blockRange") + NvdimmRangeTypeVolatileVirtualDiskRange = NvdimmRangeType("volatileVirtualDiskRange") + NvdimmRangeTypeVolatileVirtualCDRange = NvdimmRangeType("volatileVirtualCDRange") + NvdimmRangeTypePersistentVirtualDiskRange = NvdimmRangeType("persistentVirtualDiskRange") + NvdimmRangeTypePersistentVirtualCDRange = NvdimmRangeType("persistentVirtualCDRange") +) + +func init() { + t["NvdimmRangeType"] = reflect.TypeOf((*NvdimmRangeType)(nil)).Elem() +} + type ObjectUpdateKind string const ( @@ -2491,6 +2823,20 @@ func init() { t["ProfileNumericComparator"] = reflect.TypeOf((*ProfileNumericComparator)(nil)).Elem() } +type ProfileParameterMetadataRelationType string + +const ( + ProfileParameterMetadataRelationTypeDynamic_relation = ProfileParameterMetadataRelationType("dynamic_relation") + ProfileParameterMetadataRelationTypeExtensible_relation = ProfileParameterMetadataRelationType("extensible_relation") + ProfileParameterMetadataRelationTypeLocalizable_relation = ProfileParameterMetadataRelationType("localizable_relation") + ProfileParameterMetadataRelationTypeStatic_relation = ProfileParameterMetadataRelationType("static_relation") + ProfileParameterMetadataRelationTypeValidation_relation = ProfileParameterMetadataRelationType("validation_relation") +) + +func init() { + t["ProfileParameterMetadataRelationType"] = reflect.TypeOf((*ProfileParameterMetadataRelationType)(nil)).Elem() +} + type PropertyChangeOp string const ( @@ -2611,6 +2957,8 @@ const ( ReplicationVmConfigFaultReasonForFaultReplicationNotEnabled = ReplicationVmConfigFaultReasonForFault("replicationNotEnabled") ReplicationVmConfigFaultReasonForFaultReplicationConfigurationFailed = ReplicationVmConfigFaultReasonForFault("replicationConfigurationFailed") ReplicationVmConfigFaultReasonForFaultEncryptedVm = ReplicationVmConfigFaultReasonForFault("encryptedVm") + ReplicationVmConfigFaultReasonForFaultInvalidThumbprint = ReplicationVmConfigFaultReasonForFault("invalidThumbprint") + ReplicationVmConfigFaultReasonForFaultIncompatibleDevice = ReplicationVmConfigFaultReasonForFault("incompatibleDevice") ) func init() { @@ -2628,6 +2976,7 @@ const ( ReplicationVmFaultReasonForFaultInvalidState = ReplicationVmFaultReasonForFault("invalidState") ReplicationVmFaultReasonForFaultInvalidInstanceId = ReplicationVmFaultReasonForFault("invalidInstanceId") ReplicationVmFaultReasonForFaultCloseDiskError = ReplicationVmFaultReasonForFault("closeDiskError") + ReplicationVmFaultReasonForFaultGroupExist = ReplicationVmFaultReasonForFault("groupExist") ) func init() { @@ -2688,10 +3037,11 @@ func init() { type ScsiDiskType string const ( - ScsiDiskTypeNative512 = ScsiDiskType("native512") - ScsiDiskTypeEmulated512 = ScsiDiskType("emulated512") - ScsiDiskTypeNative4k = ScsiDiskType("native4k") - ScsiDiskTypeUnknown = ScsiDiskType("unknown") + ScsiDiskTypeNative512 = ScsiDiskType("native512") + ScsiDiskTypeEmulated512 = ScsiDiskType("emulated512") + ScsiDiskTypeNative4k = ScsiDiskType("native4k") + ScsiDiskTypeSoftwareEmulated4k = ScsiDiskType("SoftwareEmulated4k") + ScsiDiskTypeUnknown = ScsiDiskType("unknown") ) func init() { @@ -3266,6 +3616,18 @@ func init() { t["VirtualDeviceConfigSpecOperation"] = reflect.TypeOf((*VirtualDeviceConfigSpecOperation)(nil)).Elem() } +type VirtualDeviceConnectInfoMigrateConnectOp string + +const ( + VirtualDeviceConnectInfoMigrateConnectOpConnect = VirtualDeviceConnectInfoMigrateConnectOp("connect") + VirtualDeviceConnectInfoMigrateConnectOpDisconnect = VirtualDeviceConnectInfoMigrateConnectOp("disconnect") + VirtualDeviceConnectInfoMigrateConnectOpUnset = VirtualDeviceConnectInfoMigrateConnectOp("unset") +) + +func init() { + t["VirtualDeviceConnectInfoMigrateConnectOp"] = reflect.TypeOf((*VirtualDeviceConnectInfoMigrateConnectOp)(nil)).Elem() +} + type VirtualDeviceConnectInfoStatus string const ( @@ -3365,6 +3727,18 @@ func init() { t["VirtualDiskMode"] = reflect.TypeOf((*VirtualDiskMode)(nil)).Elem() } +type VirtualDiskRuleSpecRuleType string + +const ( + VirtualDiskRuleSpecRuleTypeAffinity = VirtualDiskRuleSpecRuleType("affinity") + VirtualDiskRuleSpecRuleTypeAntiAffinity = VirtualDiskRuleSpecRuleType("antiAffinity") + VirtualDiskRuleSpecRuleTypeDisabled = VirtualDiskRuleSpecRuleType("disabled") +) + +func init() { + t["VirtualDiskRuleSpecRuleType"] = reflect.TypeOf((*VirtualDiskRuleSpecRuleType)(nil)).Elem() +} + type VirtualDiskSharing string const ( @@ -3530,6 +3904,17 @@ func init() { t["VirtualMachineConnectionState"] = reflect.TypeOf((*VirtualMachineConnectionState)(nil)).Elem() } +type VirtualMachineCryptoState string + +const ( + VirtualMachineCryptoStateUnlocked = VirtualMachineCryptoState("unlocked") + VirtualMachineCryptoStateLocked = VirtualMachineCryptoState("locked") +) + +func init() { + t["VirtualMachineCryptoState"] = reflect.TypeOf((*VirtualMachineCryptoState)(nil)).Elem() +} + type VirtualMachineDeviceRuntimeInfoVirtualEthernetCardRuntimeStateVmDirectPathGen2InactiveReasonOther string const ( @@ -3725,6 +4110,10 @@ const ( VirtualMachineGuestOsIdentifierWindowsHyperVGuest = VirtualMachineGuestOsIdentifier("windowsHyperVGuest") VirtualMachineGuestOsIdentifierFreebsdGuest = VirtualMachineGuestOsIdentifier("freebsdGuest") VirtualMachineGuestOsIdentifierFreebsd64Guest = VirtualMachineGuestOsIdentifier("freebsd64Guest") + VirtualMachineGuestOsIdentifierFreebsd11Guest = VirtualMachineGuestOsIdentifier("freebsd11Guest") + VirtualMachineGuestOsIdentifierFreebsd11_64Guest = VirtualMachineGuestOsIdentifier("freebsd11_64Guest") + VirtualMachineGuestOsIdentifierFreebsd12Guest = VirtualMachineGuestOsIdentifier("freebsd12Guest") + VirtualMachineGuestOsIdentifierFreebsd12_64Guest = VirtualMachineGuestOsIdentifier("freebsd12_64Guest") VirtualMachineGuestOsIdentifierRedhatGuest = VirtualMachineGuestOsIdentifier("redhatGuest") VirtualMachineGuestOsIdentifierRhel2Guest = VirtualMachineGuestOsIdentifier("rhel2Guest") VirtualMachineGuestOsIdentifierRhel3Guest = VirtualMachineGuestOsIdentifier("rhel3Guest") @@ -3737,18 +4126,21 @@ const ( VirtualMachineGuestOsIdentifierRhel6_64Guest = VirtualMachineGuestOsIdentifier("rhel6_64Guest") VirtualMachineGuestOsIdentifierRhel7Guest = VirtualMachineGuestOsIdentifier("rhel7Guest") VirtualMachineGuestOsIdentifierRhel7_64Guest = VirtualMachineGuestOsIdentifier("rhel7_64Guest") + VirtualMachineGuestOsIdentifierRhel8_64Guest = VirtualMachineGuestOsIdentifier("rhel8_64Guest") VirtualMachineGuestOsIdentifierCentosGuest = VirtualMachineGuestOsIdentifier("centosGuest") VirtualMachineGuestOsIdentifierCentos64Guest = VirtualMachineGuestOsIdentifier("centos64Guest") VirtualMachineGuestOsIdentifierCentos6Guest = VirtualMachineGuestOsIdentifier("centos6Guest") VirtualMachineGuestOsIdentifierCentos6_64Guest = VirtualMachineGuestOsIdentifier("centos6_64Guest") VirtualMachineGuestOsIdentifierCentos7Guest = VirtualMachineGuestOsIdentifier("centos7Guest") VirtualMachineGuestOsIdentifierCentos7_64Guest = VirtualMachineGuestOsIdentifier("centos7_64Guest") + VirtualMachineGuestOsIdentifierCentos8_64Guest = VirtualMachineGuestOsIdentifier("centos8_64Guest") VirtualMachineGuestOsIdentifierOracleLinuxGuest = VirtualMachineGuestOsIdentifier("oracleLinuxGuest") VirtualMachineGuestOsIdentifierOracleLinux64Guest = VirtualMachineGuestOsIdentifier("oracleLinux64Guest") VirtualMachineGuestOsIdentifierOracleLinux6Guest = VirtualMachineGuestOsIdentifier("oracleLinux6Guest") VirtualMachineGuestOsIdentifierOracleLinux6_64Guest = VirtualMachineGuestOsIdentifier("oracleLinux6_64Guest") VirtualMachineGuestOsIdentifierOracleLinux7Guest = VirtualMachineGuestOsIdentifier("oracleLinux7Guest") VirtualMachineGuestOsIdentifierOracleLinux7_64Guest = VirtualMachineGuestOsIdentifier("oracleLinux7_64Guest") + VirtualMachineGuestOsIdentifierOracleLinux8_64Guest = VirtualMachineGuestOsIdentifier("oracleLinux8_64Guest") VirtualMachineGuestOsIdentifierSuseGuest = VirtualMachineGuestOsIdentifier("suseGuest") VirtualMachineGuestOsIdentifierSuse64Guest = VirtualMachineGuestOsIdentifier("suse64Guest") VirtualMachineGuestOsIdentifierSlesGuest = VirtualMachineGuestOsIdentifier("slesGuest") @@ -3759,6 +4151,7 @@ const ( VirtualMachineGuestOsIdentifierSles11_64Guest = VirtualMachineGuestOsIdentifier("sles11_64Guest") VirtualMachineGuestOsIdentifierSles12Guest = VirtualMachineGuestOsIdentifier("sles12Guest") VirtualMachineGuestOsIdentifierSles12_64Guest = VirtualMachineGuestOsIdentifier("sles12_64Guest") + VirtualMachineGuestOsIdentifierSles15_64Guest = VirtualMachineGuestOsIdentifier("sles15_64Guest") VirtualMachineGuestOsIdentifierNld9Guest = VirtualMachineGuestOsIdentifier("nld9Guest") VirtualMachineGuestOsIdentifierOesGuest = VirtualMachineGuestOsIdentifier("oesGuest") VirtualMachineGuestOsIdentifierSjdsGuest = VirtualMachineGuestOsIdentifier("sjdsGuest") @@ -3789,6 +4182,7 @@ const ( VirtualMachineGuestOsIdentifierAsianux4_64Guest = VirtualMachineGuestOsIdentifier("asianux4_64Guest") VirtualMachineGuestOsIdentifierAsianux5_64Guest = VirtualMachineGuestOsIdentifier("asianux5_64Guest") VirtualMachineGuestOsIdentifierAsianux7_64Guest = VirtualMachineGuestOsIdentifier("asianux7_64Guest") + VirtualMachineGuestOsIdentifierAsianux8_64Guest = VirtualMachineGuestOsIdentifier("asianux8_64Guest") VirtualMachineGuestOsIdentifierOpensuseGuest = VirtualMachineGuestOsIdentifier("opensuseGuest") VirtualMachineGuestOsIdentifierOpensuse64Guest = VirtualMachineGuestOsIdentifier("opensuse64Guest") VirtualMachineGuestOsIdentifierFedoraGuest = VirtualMachineGuestOsIdentifier("fedoraGuest") @@ -3799,10 +4193,12 @@ const ( VirtualMachineGuestOsIdentifierOther26xLinuxGuest = VirtualMachineGuestOsIdentifier("other26xLinuxGuest") VirtualMachineGuestOsIdentifierOtherLinuxGuest = VirtualMachineGuestOsIdentifier("otherLinuxGuest") VirtualMachineGuestOsIdentifierOther3xLinuxGuest = VirtualMachineGuestOsIdentifier("other3xLinuxGuest") + VirtualMachineGuestOsIdentifierOther4xLinuxGuest = VirtualMachineGuestOsIdentifier("other4xLinuxGuest") VirtualMachineGuestOsIdentifierGenericLinuxGuest = VirtualMachineGuestOsIdentifier("genericLinuxGuest") VirtualMachineGuestOsIdentifierOther24xLinux64Guest = VirtualMachineGuestOsIdentifier("other24xLinux64Guest") VirtualMachineGuestOsIdentifierOther26xLinux64Guest = VirtualMachineGuestOsIdentifier("other26xLinux64Guest") VirtualMachineGuestOsIdentifierOther3xLinux64Guest = VirtualMachineGuestOsIdentifier("other3xLinux64Guest") + VirtualMachineGuestOsIdentifierOther4xLinux64Guest = VirtualMachineGuestOsIdentifier("other4xLinux64Guest") VirtualMachineGuestOsIdentifierOtherLinux64Guest = VirtualMachineGuestOsIdentifier("otherLinux64Guest") VirtualMachineGuestOsIdentifierSolaris6Guest = VirtualMachineGuestOsIdentifier("solaris6Guest") VirtualMachineGuestOsIdentifierSolaris7Guest = VirtualMachineGuestOsIdentifier("solaris7Guest") @@ -3831,10 +4227,13 @@ const ( VirtualMachineGuestOsIdentifierDarwin14_64Guest = VirtualMachineGuestOsIdentifier("darwin14_64Guest") VirtualMachineGuestOsIdentifierDarwin15_64Guest = VirtualMachineGuestOsIdentifier("darwin15_64Guest") VirtualMachineGuestOsIdentifierDarwin16_64Guest = VirtualMachineGuestOsIdentifier("darwin16_64Guest") + VirtualMachineGuestOsIdentifierDarwin17_64Guest = VirtualMachineGuestOsIdentifier("darwin17_64Guest") + VirtualMachineGuestOsIdentifierDarwin18_64Guest = VirtualMachineGuestOsIdentifier("darwin18_64Guest") VirtualMachineGuestOsIdentifierVmkernelGuest = VirtualMachineGuestOsIdentifier("vmkernelGuest") VirtualMachineGuestOsIdentifierVmkernel5Guest = VirtualMachineGuestOsIdentifier("vmkernel5Guest") VirtualMachineGuestOsIdentifierVmkernel6Guest = VirtualMachineGuestOsIdentifier("vmkernel6Guest") VirtualMachineGuestOsIdentifierVmkernel65Guest = VirtualMachineGuestOsIdentifier("vmkernel65Guest") + VirtualMachineGuestOsIdentifierAmazonlinux2_64Guest = VirtualMachineGuestOsIdentifier("amazonlinux2_64Guest") VirtualMachineGuestOsIdentifierOtherGuest = VirtualMachineGuestOsIdentifier("otherGuest") VirtualMachineGuestOsIdentifierOtherGuest64 = VirtualMachineGuestOsIdentifier("otherGuest64") ) @@ -4051,10 +4450,11 @@ func init() { type VirtualMachineTicketType string const ( - VirtualMachineTicketTypeMks = VirtualMachineTicketType("mks") - VirtualMachineTicketTypeDevice = VirtualMachineTicketType("device") - VirtualMachineTicketTypeGuestControl = VirtualMachineTicketType("guestControl") - VirtualMachineTicketTypeWebmks = VirtualMachineTicketType("webmks") + VirtualMachineTicketTypeMks = VirtualMachineTicketType("mks") + VirtualMachineTicketTypeDevice = VirtualMachineTicketType("device") + VirtualMachineTicketTypeGuestControl = VirtualMachineTicketType("guestControl") + VirtualMachineTicketTypeWebmks = VirtualMachineTicketType("webmks") + VirtualMachineTicketTypeGuestIntegrity = VirtualMachineTicketType("guestIntegrity") ) func init() { @@ -4262,6 +4662,17 @@ func init() { t["VirtualSerialPortEndPoint"] = reflect.TypeOf((*VirtualSerialPortEndPoint)(nil)).Elem() } +type VirtualVmxnet3VrdmaOptionDeviceProtocols string + +const ( + VirtualVmxnet3VrdmaOptionDeviceProtocolsRocev1 = VirtualVmxnet3VrdmaOptionDeviceProtocols("rocev1") + VirtualVmxnet3VrdmaOptionDeviceProtocolsRocev2 = VirtualVmxnet3VrdmaOptionDeviceProtocols("rocev2") +) + +func init() { + t["VirtualVmxnet3VrdmaOptionDeviceProtocols"] = reflect.TypeOf((*VirtualVmxnet3VrdmaOptionDeviceProtocols)(nil)).Elem() +} + type VmDasBeingResetEventReasonCode string const ( @@ -4319,6 +4730,8 @@ const ( VmFaultToleranceConfigIssueReasonForIssueCpuHwmmuUnsupported = VmFaultToleranceConfigIssueReasonForIssue("cpuHwmmuUnsupported") VmFaultToleranceConfigIssueReasonForIssueCpuHvDisabled = VmFaultToleranceConfigIssueReasonForIssue("cpuHvDisabled") VmFaultToleranceConfigIssueReasonForIssueHasEFIFirmware = VmFaultToleranceConfigIssueReasonForIssue("hasEFIFirmware") + VmFaultToleranceConfigIssueReasonForIssueTooManyVCPUs = VmFaultToleranceConfigIssueReasonForIssue("tooManyVCPUs") + VmFaultToleranceConfigIssueReasonForIssueTooMuchMemory = VmFaultToleranceConfigIssueReasonForIssue("tooMuchMemory") ) func init() { @@ -4464,3 +4877,15 @@ const ( func init() { t["WillLoseHAProtectionResolution"] = reflect.TypeOf((*WillLoseHAProtectionResolution)(nil)).Elem() } + +type VslmVStorageObjectControlFlag string + +const ( + VslmVStorageObjectControlFlagKeepAfterDeleteVm = VslmVStorageObjectControlFlag("keepAfterDeleteVm") + VslmVStorageObjectControlFlagDisableRelocation = VslmVStorageObjectControlFlag("disableRelocation") + VslmVStorageObjectControlFlagEnableChangedBlockTracking = VslmVStorageObjectControlFlag("enableChangedBlockTracking") +) + +func init() { + t["vslmVStorageObjectControlFlag"] = reflect.TypeOf((*VslmVStorageObjectControlFlag)(nil)).Elem() +} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go index 2364ed421..95c49f333 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,12 +16,28 @@ limitations under the License. package types -import "strings" +import ( + "reflect" + "strings" + "time" +) func NewBool(v bool) *bool { return &v } +func NewInt32(v int32) *int32 { + return &v +} + +func NewInt64(v int64) *int64 { + return &v +} + +func NewTime(v time.Time) *time.Time { + return &v +} + func NewReference(r ManagedObjectReference) *ManagedObjectReference { return &r } @@ -50,3 +66,30 @@ func (r *ManagedObjectReference) FromString(o string) bool { func (c *PerfCounterInfo) Name() string { return c.GroupInfo.GetElementDescription().Key + "." + c.NameInfo.GetElementDescription().Key + "." + string(c.RollupType) } + +func defaultResourceAllocationInfo() ResourceAllocationInfo { + return ResourceAllocationInfo{ + Reservation: NewInt64(0), + ExpandableReservation: NewBool(true), + Limit: NewInt64(-1), + Shares: &SharesInfo{ + Level: SharesLevelNormal, + }, + } +} + +// DefaultResourceConfigSpec returns a ResourceConfigSpec populated with the same default field values as vCenter. +// Note that the wsdl marks these fields as optional, but they are required to be set when creating a resource pool. +// They are only optional when updating a resource pool. +func DefaultResourceConfigSpec() ResourceConfigSpec { + return ResourceConfigSpec{ + CpuAllocation: defaultResourceAllocationInfo(), + MemoryAllocation: defaultResourceAllocationInfo(), + } +} + +func init() { + // Known 6.5 issue where this event type is sent even though it is internal. + // This workaround allows us to unmarshal and avoid NPEs. + t["HostSubSpecificationUpdateEvent"] = reflect.TypeOf((*HostEvent)(nil)).Elem() +} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/if.go b/vendor/github.com/vmware/govmomi/vim25/types/if.go index dbf594cfc..32e17f14c 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/if.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/if.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -214,6 +214,18 @@ func init() { t["BaseClusterAction"] = reflect.TypeOf((*ClusterAction)(nil)).Elem() } +func (b *ClusterComputeResourceValidationResultBase) GetClusterComputeResourceValidationResultBase() *ClusterComputeResourceValidationResultBase { + return b +} + +type BaseClusterComputeResourceValidationResultBase interface { + GetClusterComputeResourceValidationResultBase() *ClusterComputeResourceValidationResultBase +} + +func init() { + t["BaseClusterComputeResourceValidationResultBase"] = reflect.TypeOf((*ClusterComputeResourceValidationResultBase)(nil)).Elem() +} + func (b *ClusterDasAdmissionControlInfo) GetClusterDasAdmissionControlInfo() *ClusterDasAdmissionControlInfo { return b } @@ -786,6 +798,7 @@ func (b *DvsFilterConfig) GetDvsFilterConfig() *DvsFilterConfig { return b } type BaseDvsFilterConfig interface { GetDvsFilterConfig() *DvsFilterConfig + GetDvsTrafficFilterConfig() *DvsTrafficFilterConfig } func init() { @@ -828,12 +841,21 @@ func (b *DvsNetworkRuleQualifier) GetDvsNetworkRuleQualifier() *DvsNetworkRuleQu type BaseDvsNetworkRuleQualifier interface { GetDvsNetworkRuleQualifier() *DvsNetworkRuleQualifier + GetDvsIpNetworkRuleQualifier() *DvsIpNetworkRuleQualifier } func init() { t["BaseDvsNetworkRuleQualifier"] = reflect.TypeOf((*DvsNetworkRuleQualifier)(nil)).Elem() } +func (b *DvsIpNetworkRuleQualifier) GetDvsIpNetworkRuleQualifier() *DvsIpNetworkRuleQualifier { + return b +} + +type BaseDvsIpNetworkRuleQualifier interface { + GetDvsIpNetworkRuleQualifier() *DvsIpNetworkRuleQualifier +} + func (b *DvsTrafficFilterConfig) GetDvsTrafficFilterConfig() *DvsTrafficFilterConfig { return b } type BaseDvsTrafficFilterConfig interface { @@ -2360,16 +2382,6 @@ func init() { t["BaseReplicationVmFault"] = reflect.TypeOf((*ReplicationVmFault)(nil)).Elem() } -func (b *ResourceAllocationInfo) GetResourceAllocationInfo() *ResourceAllocationInfo { return b } - -type BaseResourceAllocationInfo interface { - GetResourceAllocationInfo() *ResourceAllocationInfo -} - -func init() { - t["BaseResourceAllocationInfo"] = reflect.TypeOf((*ResourceAllocationInfo)(nil)).Elem() -} - func (b *ResourceInUse) GetResourceInUse() *ResourceInUse { return b } type BaseResourceInUse interface { diff --git a/vendor/github.com/vmware/govmomi/vim25/types/internal.go b/vendor/github.com/vmware/govmomi/vim25/types/internal.go deleted file mode 100644 index 0c2693499..000000000 --- a/vendor/github.com/vmware/govmomi/vim25/types/internal.go +++ /dev/null @@ -1,266 +0,0 @@ -/* -Copyright (c) 2014 VMware, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package types - -import "reflect" - -type DynamicTypeMgrQueryMoInstances struct { - This ManagedObjectReference `xml:"_this"` - FilterSpec BaseDynamicTypeMgrFilterSpec `xml:"filterSpec,omitempty,typeattr"` -} - -type DynamicTypeMgrQueryMoInstancesResponse struct { - Returnval []DynamicTypeMgrMoInstance `xml:"urn:vim25 returnval"` -} - -type DynamicTypeEnumTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - Value []string `xml:"value,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeEnumTypeInfo"] = reflect.TypeOf((*DynamicTypeEnumTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrAllTypeInfo struct { - DynamicData - - ManagedTypeInfo []DynamicTypeMgrManagedTypeInfo `xml:"managedTypeInfo,omitempty"` - EnumTypeInfo []DynamicTypeEnumTypeInfo `xml:"enumTypeInfo,omitempty"` - DataTypeInfo []DynamicTypeMgrDataTypeInfo `xml:"dataTypeInfo,omitempty"` -} - -func init() { - t["DynamicTypeMgrAllTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrAllTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrAnnotation struct { - DynamicData - - Name string `xml:"name"` - Parameter []string `xml:"parameter,omitempty"` -} - -func init() { - t["DynamicTypeMgrAnnotation"] = reflect.TypeOf((*DynamicTypeMgrAnnotation)(nil)).Elem() -} - -type DynamicTypeMgrDataTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - Base []string `xml:"base,omitempty"` - Property []DynamicTypeMgrPropertyTypeInfo `xml:"property,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrDataTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrDataTypeInfo)(nil)).Elem() -} - -func (b *DynamicTypeMgrFilterSpec) GetDynamicTypeMgrFilterSpec() *DynamicTypeMgrFilterSpec { return b } - -type BaseDynamicTypeMgrFilterSpec interface { - GetDynamicTypeMgrFilterSpec() *DynamicTypeMgrFilterSpec -} - -type DynamicTypeMgrFilterSpec struct { - DynamicData -} - -func init() { - t["DynamicTypeMgrFilterSpec"] = reflect.TypeOf((*DynamicTypeMgrFilterSpec)(nil)).Elem() -} - -type DynamicTypeMgrManagedTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - Base []string `xml:"base,omitempty"` - Property []DynamicTypeMgrPropertyTypeInfo `xml:"property,omitempty"` - Method []DynamicTypeMgrMethodTypeInfo `xml:"method,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrManagedTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrManagedTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrMethodTypeInfo struct { - DynamicData - - Name string `xml:"name"` - WsdlName string `xml:"wsdlName"` - Version string `xml:"version"` - ParamTypeInfo []DynamicTypeMgrParamTypeInfo `xml:"paramTypeInfo,omitempty"` - ReturnTypeInfo *DynamicTypeMgrParamTypeInfo `xml:"returnTypeInfo,omitempty"` - Fault []string `xml:"fault,omitempty"` - PrivId string `xml:"privId,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrMethodTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrMethodTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrMoFilterSpec struct { - DynamicTypeMgrFilterSpec - - Id string `xml:"id,omitempty"` - TypeSubstr string `xml:"typeSubstr,omitempty"` -} - -func init() { - t["DynamicTypeMgrMoFilterSpec"] = reflect.TypeOf((*DynamicTypeMgrMoFilterSpec)(nil)).Elem() -} - -type DynamicTypeMgrMoInstance struct { - DynamicData - - Id string `xml:"id"` - MoType string `xml:"moType"` -} - -func init() { - t["DynamicTypeMgrMoInstance"] = reflect.TypeOf((*DynamicTypeMgrMoInstance)(nil)).Elem() -} - -type DynamicTypeMgrParamTypeInfo struct { - DynamicData - - Name string `xml:"name"` - Version string `xml:"version"` - Type string `xml:"type"` - PrivId string `xml:"privId,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -func init() { - t["DynamicTypeMgrParamTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrParamTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrPropertyTypeInfo struct { - DynamicData - - Name string `xml:"name"` - Version string `xml:"version"` - Type string `xml:"type"` - PrivId string `xml:"privId,omitempty"` - MsgIdFormat string `xml:"msgIdFormat,omitempty"` - Annotation []DynamicTypeMgrAnnotation `xml:"annotation,omitempty"` -} - -type DynamicTypeMgrQueryTypeInfo struct { - This ManagedObjectReference `xml:"_this"` - FilterSpec BaseDynamicTypeMgrFilterSpec `xml:"filterSpec,omitempty,typeattr"` -} - -type DynamicTypeMgrQueryTypeInfoResponse struct { - Returnval DynamicTypeMgrAllTypeInfo `xml:"urn:vim25 returnval"` -} - -func init() { - t["DynamicTypeMgrPropertyTypeInfo"] = reflect.TypeOf((*DynamicTypeMgrPropertyTypeInfo)(nil)).Elem() -} - -type DynamicTypeMgrTypeFilterSpec struct { - DynamicTypeMgrFilterSpec - - TypeSubstr string `xml:"typeSubstr,omitempty"` -} - -func init() { - t["DynamicTypeMgrTypeFilterSpec"] = reflect.TypeOf((*DynamicTypeMgrTypeFilterSpec)(nil)).Elem() -} - -type ReflectManagedMethodExecuterSoapArgument struct { - DynamicData - - Name string `xml:"name"` - Val string `xml:"val"` -} - -func init() { - t["ReflectManagedMethodExecuterSoapArgument"] = reflect.TypeOf((*ReflectManagedMethodExecuterSoapArgument)(nil)).Elem() -} - -type ReflectManagedMethodExecuterSoapFault struct { - DynamicData - - FaultMsg string `xml:"faultMsg"` - FaultDetail string `xml:"faultDetail,omitempty"` -} - -func init() { - t["ReflectManagedMethodExecuterSoapFault"] = reflect.TypeOf((*ReflectManagedMethodExecuterSoapFault)(nil)).Elem() -} - -type ReflectManagedMethodExecuterSoapResult struct { - DynamicData - - Response string `xml:"response,omitempty"` - Fault *ReflectManagedMethodExecuterSoapFault `xml:"fault,omitempty"` -} - -type RetrieveDynamicTypeManager struct { - This ManagedObjectReference `xml:"_this"` -} - -type RetrieveDynamicTypeManagerResponse struct { - Returnval *InternalDynamicTypeManager `xml:"urn:vim25 returnval"` -} - -type RetrieveManagedMethodExecuter struct { - This ManagedObjectReference `xml:"_this"` -} - -func init() { - t["RetrieveManagedMethodExecuter"] = reflect.TypeOf((*RetrieveManagedMethodExecuter)(nil)).Elem() -} - -type RetrieveManagedMethodExecuterResponse struct { - Returnval *ReflectManagedMethodExecuter `xml:"urn:vim25 returnval"` -} - -type InternalDynamicTypeManager struct { - ManagedObjectReference -} - -type ReflectManagedMethodExecuter struct { - ManagedObjectReference -} - -type ExecuteSoap struct { - This ManagedObjectReference `xml:"_this"` - Moid string `xml:"moid"` - Version string `xml:"version"` - Method string `xml:"method"` - Argument []ReflectManagedMethodExecuterSoapArgument `xml:"argument,omitempty"` -} - -type ExecuteSoapResponse struct { - Returnval *ReflectManagedMethodExecuterSoapResult `xml:"urn:vim25 returnval"` -} diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types.go b/vendor/github.com/vmware/govmomi/vim25/types/types.go index cb7035824..628a4cd6a 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/types.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/types.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,11 +17,27 @@ limitations under the License. package types import ( - "net/url" "reflect" "time" ) +type AbandonHciWorkflow AbandonHciWorkflowRequestType + +func init() { + t["AbandonHciWorkflow"] = reflect.TypeOf((*AbandonHciWorkflow)(nil)).Elem() +} + +type AbandonHciWorkflowRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["AbandonHciWorkflowRequestType"] = reflect.TypeOf((*AbandonHciWorkflowRequestType)(nil)).Elem() +} + +type AbandonHciWorkflowResponse struct { +} + type AbdicateDomOwnership AbdicateDomOwnershipRequestType func init() { @@ -897,6 +913,18 @@ func init() { t["AlarmExpression"] = reflect.TypeOf((*AlarmExpression)(nil)).Elem() } +type AlarmFilterSpec struct { + DynamicData + + Status []ManagedEntityStatus `xml:"status,omitempty"` + TypeEntity string `xml:"typeEntity,omitempty"` + TypeTrigger string `xml:"typeTrigger,omitempty"` +} + +func init() { + t["AlarmFilterSpec"] = reflect.TypeOf((*AlarmFilterSpec)(nil)).Elem() +} + type AlarmInfo struct { AlarmSpec @@ -1338,6 +1366,26 @@ type ApplyEntitiesConfig_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type ApplyEvcModeVMRequestType struct { + This ManagedObjectReference `xml:"_this"` + Mask []HostFeatureMask `xml:"mask,omitempty"` + CompleteMasks *bool `xml:"completeMasks"` +} + +func init() { + t["ApplyEvcModeVMRequestType"] = reflect.TypeOf((*ApplyEvcModeVMRequestType)(nil)).Elem() +} + +type ApplyEvcModeVM_Task ApplyEvcModeVMRequestType + +func init() { + t["ApplyEvcModeVM_Task"] = reflect.TypeOf((*ApplyEvcModeVM_Task)(nil)).Elem() +} + +type ApplyEvcModeVM_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type ApplyHostConfigRequestType struct { This ManagedObjectReference `xml:"_this"` Host ManagedObjectReference `xml:"host"` @@ -1359,6 +1407,20 @@ type ApplyHostConfig_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type ApplyHostProfileConfigurationResult struct { + DynamicData + + StartTime time.Time `xml:"startTime"` + CompleteTime time.Time `xml:"completeTime"` + Host ManagedObjectReference `xml:"host"` + Status string `xml:"status"` + Errors []LocalizedMethodFault `xml:"errors,omitempty"` +} + +func init() { + t["ApplyHostProfileConfigurationResult"] = reflect.TypeOf((*ApplyHostProfileConfigurationResult)(nil)).Elem() +} + type ApplyHostProfileConfigurationSpec struct { ProfileExecuteResult @@ -1387,6 +1449,7 @@ type ApplyProfile struct { ToReplaceWith *bool `xml:"toReplaceWith"` ToBeDeleted *bool `xml:"toBeDeleted"` CopyEnableStatus *bool `xml:"copyEnableStatus"` + Hidden *bool `xml:"hidden"` } func init() { @@ -1544,13 +1607,21 @@ func init() { } type ArrayOfAnyURI struct { - AnyURI []url.URL `xml:"anyURI,omitempty"` + AnyURI []string `xml:"anyURI,omitempty"` } func init() { t["ArrayOfAnyURI"] = reflect.TypeOf((*ArrayOfAnyURI)(nil)).Elem() } +type ArrayOfApplyHostProfileConfigurationResult struct { + ApplyHostProfileConfigurationResult []ApplyHostProfileConfigurationResult `xml:"ApplyHostProfileConfigurationResult,omitempty"` +} + +func init() { + t["ArrayOfApplyHostProfileConfigurationResult"] = reflect.TypeOf((*ArrayOfApplyHostProfileConfigurationResult)(nil)).Elem() +} + type ArrayOfApplyHostProfileConfigurationSpec struct { ApplyHostProfileConfigurationSpec []ApplyHostProfileConfigurationSpec `xml:"ApplyHostProfileConfigurationSpec,omitempty"` } @@ -1591,6 +1662,14 @@ func init() { t["ArrayOfAutoStartPowerInfo"] = reflect.TypeOf((*ArrayOfAutoStartPowerInfo)(nil)).Elem() } +type ArrayOfBase64Binary struct { + Base64Binary [][]byte `xml:"base64Binary,omitempty"` +} + +func init() { + t["ArrayOfBase64Binary"] = reflect.TypeOf((*ArrayOfBase64Binary)(nil)).Elem() +} + type ArrayOfBoolean struct { Boolean []bool `xml:"boolean,omitempty"` } @@ -1647,6 +1726,62 @@ func init() { t["ArrayOfClusterAttemptedVmInfo"] = reflect.TypeOf((*ArrayOfClusterAttemptedVmInfo)(nil)).Elem() } +type ArrayOfClusterComputeResourceDVSSetting struct { + ClusterComputeResourceDVSSetting []ClusterComputeResourceDVSSetting `xml:"ClusterComputeResourceDVSSetting,omitempty"` +} + +func init() { + t["ArrayOfClusterComputeResourceDVSSetting"] = reflect.TypeOf((*ArrayOfClusterComputeResourceDVSSetting)(nil)).Elem() +} + +type ArrayOfClusterComputeResourceDVSSettingDVPortgroupToServiceMapping struct { + ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping []ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping `xml:"ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping,omitempty"` +} + +func init() { + t["ArrayOfClusterComputeResourceDVSSettingDVPortgroupToServiceMapping"] = reflect.TypeOf((*ArrayOfClusterComputeResourceDVSSettingDVPortgroupToServiceMapping)(nil)).Elem() +} + +type ArrayOfClusterComputeResourceDvsProfile struct { + ClusterComputeResourceDvsProfile []ClusterComputeResourceDvsProfile `xml:"ClusterComputeResourceDvsProfile,omitempty"` +} + +func init() { + t["ArrayOfClusterComputeResourceDvsProfile"] = reflect.TypeOf((*ArrayOfClusterComputeResourceDvsProfile)(nil)).Elem() +} + +type ArrayOfClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping struct { + ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping []ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping `xml:"ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping,omitempty"` +} + +func init() { + t["ArrayOfClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping"] = reflect.TypeOf((*ArrayOfClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping)(nil)).Elem() +} + +type ArrayOfClusterComputeResourceHostConfigurationInput struct { + ClusterComputeResourceHostConfigurationInput []ClusterComputeResourceHostConfigurationInput `xml:"ClusterComputeResourceHostConfigurationInput,omitempty"` +} + +func init() { + t["ArrayOfClusterComputeResourceHostConfigurationInput"] = reflect.TypeOf((*ArrayOfClusterComputeResourceHostConfigurationInput)(nil)).Elem() +} + +type ArrayOfClusterComputeResourceHostVmkNicInfo struct { + ClusterComputeResourceHostVmkNicInfo []ClusterComputeResourceHostVmkNicInfo `xml:"ClusterComputeResourceHostVmkNicInfo,omitempty"` +} + +func init() { + t["ArrayOfClusterComputeResourceHostVmkNicInfo"] = reflect.TypeOf((*ArrayOfClusterComputeResourceHostVmkNicInfo)(nil)).Elem() +} + +type ArrayOfClusterComputeResourceValidationResultBase struct { + ClusterComputeResourceValidationResultBase []BaseClusterComputeResourceValidationResultBase `xml:"ClusterComputeResourceValidationResultBase,omitempty,typeattr"` +} + +func init() { + t["ArrayOfClusterComputeResourceValidationResultBase"] = reflect.TypeOf((*ArrayOfClusterComputeResourceValidationResultBase)(nil)).Elem() +} + type ArrayOfClusterDasAamNodeState struct { ClusterDasAamNodeState []ClusterDasAamNodeState `xml:"ClusterDasAamNodeState,omitempty"` } @@ -1927,6 +2062,14 @@ func init() { t["ArrayOfCryptoManagerKmipClusterStatus"] = reflect.TypeOf((*ArrayOfCryptoManagerKmipClusterStatus)(nil)).Elem() } +type ArrayOfCryptoManagerKmipCryptoKeyStatus struct { + CryptoManagerKmipCryptoKeyStatus []CryptoManagerKmipCryptoKeyStatus `xml:"CryptoManagerKmipCryptoKeyStatus,omitempty"` +} + +func init() { + t["ArrayOfCryptoManagerKmipCryptoKeyStatus"] = reflect.TypeOf((*ArrayOfCryptoManagerKmipCryptoKeyStatus)(nil)).Elem() +} + type ArrayOfCryptoManagerKmipServerStatus struct { CryptoManagerKmipServerStatus []CryptoManagerKmipServerStatus `xml:"CryptoManagerKmipServerStatus,omitempty"` } @@ -2031,6 +2174,14 @@ func init() { t["ArrayOfDasHeartbeatDatastoreInfo"] = reflect.TypeOf((*ArrayOfDasHeartbeatDatastoreInfo)(nil)).Elem() } +type ArrayOfDatacenterBasicConnectInfo struct { + DatacenterBasicConnectInfo []DatacenterBasicConnectInfo `xml:"DatacenterBasicConnectInfo,omitempty"` +} + +func init() { + t["ArrayOfDatacenterBasicConnectInfo"] = reflect.TypeOf((*ArrayOfDatacenterBasicConnectInfo)(nil)).Elem() +} + type ArrayOfDatacenterMismatchArgument struct { DatacenterMismatchArgument []DatacenterMismatchArgument `xml:"DatacenterMismatchArgument,omitempty"` } @@ -2471,6 +2622,22 @@ func init() { t["ArrayOfFaultToleranceDiskSpec"] = reflect.TypeOf((*ArrayOfFaultToleranceDiskSpec)(nil)).Elem() } +type ArrayOfFaultsByHost struct { + FaultsByHost []FaultsByHost `xml:"FaultsByHost,omitempty"` +} + +func init() { + t["ArrayOfFaultsByHost"] = reflect.TypeOf((*ArrayOfFaultsByHost)(nil)).Elem() +} + +type ArrayOfFaultsByVM struct { + FaultsByVM []FaultsByVM `xml:"FaultsByVM,omitempty"` +} + +func init() { + t["ArrayOfFaultsByVM"] = reflect.TypeOf((*ArrayOfFaultsByVM)(nil)).Elem() +} + type ArrayOfFcoeConfigVlanRange struct { FcoeConfigVlanRange []FcoeConfigVlanRange `xml:"FcoeConfigVlanRange,omitempty"` } @@ -2503,6 +2670,22 @@ func init() { t["ArrayOfFirewallProfileRulesetProfile"] = reflect.TypeOf((*ArrayOfFirewallProfileRulesetProfile)(nil)).Elem() } +type ArrayOfFolderFailedHostResult struct { + FolderFailedHostResult []FolderFailedHostResult `xml:"FolderFailedHostResult,omitempty"` +} + +func init() { + t["ArrayOfFolderFailedHostResult"] = reflect.TypeOf((*ArrayOfFolderFailedHostResult)(nil)).Elem() +} + +type ArrayOfFolderNewHostSpec struct { + FolderNewHostSpec []FolderNewHostSpec `xml:"FolderNewHostSpec,omitempty"` +} + +func init() { + t["ArrayOfFolderNewHostSpec"] = reflect.TypeOf((*ArrayOfFolderNewHostSpec)(nil)).Elem() +} + type ArrayOfGuestAliases struct { GuestAliases []GuestAliases `xml:"GuestAliases,omitempty"` } @@ -2687,6 +2870,14 @@ func init() { t["ArrayOfHostConnectInfoNetworkInfo"] = reflect.TypeOf((*ArrayOfHostConnectInfoNetworkInfo)(nil)).Elem() } +type ArrayOfHostConnectSpec struct { + HostConnectSpec []HostConnectSpec `xml:"HostConnectSpec,omitempty"` +} + +func init() { + t["ArrayOfHostConnectSpec"] = reflect.TypeOf((*ArrayOfHostConnectSpec)(nil)).Elem() +} + type ArrayOfHostCpuIdInfo struct { HostCpuIdInfo []HostCpuIdInfo `xml:"HostCpuIdInfo,omitempty"` } @@ -3295,6 +3486,14 @@ func init() { t["ArrayOfHostPowerPolicy"] = reflect.TypeOf((*ArrayOfHostPowerPolicy)(nil)).Elem() } +type ArrayOfHostProfileManagerCompositionResultResultElement struct { + HostProfileManagerCompositionResultResultElement []HostProfileManagerCompositionResultResultElement `xml:"HostProfileManagerCompositionResultResultElement,omitempty"` +} + +func init() { + t["ArrayOfHostProfileManagerCompositionResultResultElement"] = reflect.TypeOf((*ArrayOfHostProfileManagerCompositionResultResultElement)(nil)).Elem() +} + type ArrayOfHostProfileManagerCompositionValidationResultResultElement struct { HostProfileManagerCompositionValidationResultResultElement []HostProfileManagerCompositionValidationResultResultElement `xml:"HostProfileManagerCompositionValidationResultResultElement,omitempty"` } @@ -3415,6 +3614,14 @@ func init() { t["ArrayOfHostServiceConfig"] = reflect.TypeOf((*ArrayOfHostServiceConfig)(nil)).Elem() } +type ArrayOfHostSharedGpuCapabilities struct { + HostSharedGpuCapabilities []HostSharedGpuCapabilities `xml:"HostSharedGpuCapabilities,omitempty"` +} + +func init() { + t["ArrayOfHostSharedGpuCapabilities"] = reflect.TypeOf((*ArrayOfHostSharedGpuCapabilities)(nil)).Elem() +} + type ArrayOfHostSnmpDestination struct { HostSnmpDestination []HostSnmpDestination `xml:"HostSnmpDestination,omitempty"` } @@ -3703,6 +3910,14 @@ func init() { t["ArrayOfHttpNfcLeaseManifestEntry"] = reflect.TypeOf((*ArrayOfHttpNfcLeaseManifestEntry)(nil)).Elem() } +type ArrayOfHttpNfcLeaseSourceFile struct { + HttpNfcLeaseSourceFile []HttpNfcLeaseSourceFile `xml:"HttpNfcLeaseSourceFile,omitempty"` +} + +func init() { + t["ArrayOfHttpNfcLeaseSourceFile"] = reflect.TypeOf((*ArrayOfHttpNfcLeaseSourceFile)(nil)).Elem() +} + type ArrayOfID struct { ID []ID `xml:"ID,omitempty"` } @@ -3887,6 +4102,14 @@ func init() { t["ArrayOfLong"] = reflect.TypeOf((*ArrayOfLong)(nil)).Elem() } +type ArrayOfManagedEntityStatus struct { + ManagedEntityStatus []ManagedEntityStatus `xml:"ManagedEntityStatus,omitempty"` +} + +func init() { + t["ArrayOfManagedEntityStatus"] = reflect.TypeOf((*ArrayOfManagedEntityStatus)(nil)).Elem() +} + type ArrayOfManagedObjectReference struct { ManagedObjectReference []ManagedObjectReference `xml:"ManagedObjectReference,omitempty"` } @@ -3999,6 +4222,14 @@ func init() { t["ArrayOfNetStackInstanceProfile"] = reflect.TypeOf((*ArrayOfNetStackInstanceProfile)(nil)).Elem() } +type ArrayOfNsxHostVNicProfile struct { + NsxHostVNicProfile []NsxHostVNicProfile `xml:"NsxHostVNicProfile,omitempty"` +} + +func init() { + t["ArrayOfNsxHostVNicProfile"] = reflect.TypeOf((*ArrayOfNsxHostVNicProfile)(nil)).Elem() +} + type ArrayOfNumericRange struct { NumericRange []NumericRange `xml:"NumericRange,omitempty"` } @@ -4007,6 +4238,54 @@ func init() { t["ArrayOfNumericRange"] = reflect.TypeOf((*ArrayOfNumericRange)(nil)).Elem() } +type ArrayOfNvdimmDimmInfo struct { + NvdimmDimmInfo []NvdimmDimmInfo `xml:"NvdimmDimmInfo,omitempty"` +} + +func init() { + t["ArrayOfNvdimmDimmInfo"] = reflect.TypeOf((*ArrayOfNvdimmDimmInfo)(nil)).Elem() +} + +type ArrayOfNvdimmGuid struct { + NvdimmGuid []NvdimmGuid `xml:"NvdimmGuid,omitempty"` +} + +func init() { + t["ArrayOfNvdimmGuid"] = reflect.TypeOf((*ArrayOfNvdimmGuid)(nil)).Elem() +} + +type ArrayOfNvdimmInterleaveSetInfo struct { + NvdimmInterleaveSetInfo []NvdimmInterleaveSetInfo `xml:"NvdimmInterleaveSetInfo,omitempty"` +} + +func init() { + t["ArrayOfNvdimmInterleaveSetInfo"] = reflect.TypeOf((*ArrayOfNvdimmInterleaveSetInfo)(nil)).Elem() +} + +type ArrayOfNvdimmNamespaceDetails struct { + NvdimmNamespaceDetails []NvdimmNamespaceDetails `xml:"NvdimmNamespaceDetails,omitempty"` +} + +func init() { + t["ArrayOfNvdimmNamespaceDetails"] = reflect.TypeOf((*ArrayOfNvdimmNamespaceDetails)(nil)).Elem() +} + +type ArrayOfNvdimmNamespaceInfo struct { + NvdimmNamespaceInfo []NvdimmNamespaceInfo `xml:"NvdimmNamespaceInfo,omitempty"` +} + +func init() { + t["ArrayOfNvdimmNamespaceInfo"] = reflect.TypeOf((*ArrayOfNvdimmNamespaceInfo)(nil)).Elem() +} + +type ArrayOfNvdimmRegionInfo struct { + NvdimmRegionInfo []NvdimmRegionInfo `xml:"NvdimmRegionInfo,omitempty"` +} + +func init() { + t["ArrayOfNvdimmRegionInfo"] = reflect.TypeOf((*ArrayOfNvdimmRegionInfo)(nil)).Elem() +} + type ArrayOfObjectContent struct { ObjectContent []ObjectContent `xml:"ObjectContent,omitempty"` } @@ -4391,6 +4670,14 @@ func init() { t["ArrayOfProfileMetadata"] = reflect.TypeOf((*ArrayOfProfileMetadata)(nil)).Elem() } +type ArrayOfProfileMetadataProfileOperationMessage struct { + ProfileMetadataProfileOperationMessage []ProfileMetadataProfileOperationMessage `xml:"ProfileMetadataProfileOperationMessage,omitempty"` +} + +func init() { + t["ArrayOfProfileMetadataProfileOperationMessage"] = reflect.TypeOf((*ArrayOfProfileMetadataProfileOperationMessage)(nil)).Elem() +} + type ArrayOfProfileMetadataProfileSortSpec struct { ProfileMetadataProfileSortSpec []ProfileMetadataProfileSortSpec `xml:"ProfileMetadataProfileSortSpec,omitempty"` } @@ -4407,6 +4694,14 @@ func init() { t["ArrayOfProfileParameterMetadata"] = reflect.TypeOf((*ArrayOfProfileParameterMetadata)(nil)).Elem() } +type ArrayOfProfileParameterMetadataParameterRelationMetadata struct { + ProfileParameterMetadataParameterRelationMetadata []ProfileParameterMetadataParameterRelationMetadata `xml:"ProfileParameterMetadataParameterRelationMetadata,omitempty"` +} + +func init() { + t["ArrayOfProfileParameterMetadataParameterRelationMetadata"] = reflect.TypeOf((*ArrayOfProfileParameterMetadataParameterRelationMetadata)(nil)).Elem() +} + type ArrayOfProfilePolicy struct { ProfilePolicy []ProfilePolicy `xml:"ProfilePolicy,omitempty"` } @@ -4511,6 +4806,14 @@ func init() { t["ArrayOfResourceConfigSpec"] = reflect.TypeOf((*ArrayOfResourceConfigSpec)(nil)).Elem() } +type ArrayOfRetrieveVStorageObjSpec struct { + RetrieveVStorageObjSpec []RetrieveVStorageObjSpec `xml:"RetrieveVStorageObjSpec,omitempty"` +} + +func init() { + t["ArrayOfRetrieveVStorageObjSpec"] = reflect.TypeOf((*ArrayOfRetrieveVStorageObjSpec)(nil)).Elem() +} + type ArrayOfScheduledTaskDetail struct { ScheduledTaskDetail []ScheduledTaskDetail `xml:"ScheduledTaskDetail,omitempty"` } @@ -4903,6 +5206,30 @@ func init() { t["ArrayOfVMwareVspanSession"] = reflect.TypeOf((*ArrayOfVMwareVspanSession)(nil)).Elem() } +type ArrayOfVStorageObjectAssociations struct { + VStorageObjectAssociations []VStorageObjectAssociations `xml:"VStorageObjectAssociations,omitempty"` +} + +func init() { + t["ArrayOfVStorageObjectAssociations"] = reflect.TypeOf((*ArrayOfVStorageObjectAssociations)(nil)).Elem() +} + +type ArrayOfVStorageObjectAssociationsVmDiskAssociations struct { + VStorageObjectAssociationsVmDiskAssociations []VStorageObjectAssociationsVmDiskAssociations `xml:"VStorageObjectAssociationsVmDiskAssociations,omitempty"` +} + +func init() { + t["ArrayOfVStorageObjectAssociationsVmDiskAssociations"] = reflect.TypeOf((*ArrayOfVStorageObjectAssociationsVmDiskAssociations)(nil)).Elem() +} + +type ArrayOfVStorageObjectSnapshotInfoVStorageObjectSnapshot struct { + VStorageObjectSnapshotInfoVStorageObjectSnapshot []VStorageObjectSnapshotInfoVStorageObjectSnapshot `xml:"VStorageObjectSnapshotInfoVStorageObjectSnapshot,omitempty"` +} + +func init() { + t["ArrayOfVStorageObjectSnapshotInfoVStorageObjectSnapshot"] = reflect.TypeOf((*ArrayOfVStorageObjectSnapshotInfoVStorageObjectSnapshot)(nil)).Elem() +} + type ArrayOfVVolHostPE struct { VVolHostPE []VVolHostPE `xml:"VVolHostPE,omitempty"` } @@ -5007,6 +5334,14 @@ func init() { t["ArrayOfVirtualDiskId"] = reflect.TypeOf((*ArrayOfVirtualDiskId)(nil)).Elem() } +type ArrayOfVirtualDiskRuleSpec struct { + VirtualDiskRuleSpec []VirtualDiskRuleSpec `xml:"VirtualDiskRuleSpec,omitempty"` +} + +func init() { + t["ArrayOfVirtualDiskRuleSpec"] = reflect.TypeOf((*ArrayOfVirtualDiskRuleSpec)(nil)).Elem() +} + type ArrayOfVirtualMachineBootOptionsBootableDevice struct { VirtualMachineBootOptionsBootableDevice []BaseVirtualMachineBootOptionsBootableDevice `xml:"VirtualMachineBootOptionsBootableDevice,omitempty,typeattr"` } @@ -5223,6 +5558,14 @@ func init() { t["ArrayOfVirtualMachinePciSharedGpuPassthroughInfo"] = reflect.TypeOf((*ArrayOfVirtualMachinePciSharedGpuPassthroughInfo)(nil)).Elem() } +type ArrayOfVirtualMachineProfileDetailsDiskProfileDetails struct { + VirtualMachineProfileDetailsDiskProfileDetails []VirtualMachineProfileDetailsDiskProfileDetails `xml:"VirtualMachineProfileDetailsDiskProfileDetails,omitempty"` +} + +func init() { + t["ArrayOfVirtualMachineProfileDetailsDiskProfileDetails"] = reflect.TypeOf((*ArrayOfVirtualMachineProfileDetailsDiskProfileDetails)(nil)).Elem() +} + type ArrayOfVirtualMachineProfileSpec struct { VirtualMachineProfileSpec []BaseVirtualMachineProfileSpec `xml:"VirtualMachineProfileSpec,omitempty,typeattr"` } @@ -5231,6 +5574,14 @@ func init() { t["ArrayOfVirtualMachineProfileSpec"] = reflect.TypeOf((*ArrayOfVirtualMachineProfileSpec)(nil)).Elem() } +type ArrayOfVirtualMachinePropertyRelation struct { + VirtualMachinePropertyRelation []VirtualMachinePropertyRelation `xml:"VirtualMachinePropertyRelation,omitempty"` +} + +func init() { + t["ArrayOfVirtualMachinePropertyRelation"] = reflect.TypeOf((*ArrayOfVirtualMachinePropertyRelation)(nil)).Elem() +} + type ArrayOfVirtualMachineRelocateSpecDiskLocator struct { VirtualMachineRelocateSpecDiskLocator []VirtualMachineRelocateSpecDiskLocator `xml:"VirtualMachineRelocateSpecDiskLocator,omitempty"` } @@ -5519,6 +5870,14 @@ func init() { t["ArrayOfVslmTagEntry"] = reflect.TypeOf((*ArrayOfVslmTagEntry)(nil)).Elem() } +type ArrayOfVslmInfrastructureObjectPolicy struct { + VslmInfrastructureObjectPolicy []VslmInfrastructureObjectPolicy `xml:"vslmInfrastructureObjectPolicy,omitempty"` +} + +func init() { + t["ArrayOfvslmInfrastructureObjectPolicy"] = reflect.TypeOf((*ArrayOfVslmInfrastructureObjectPolicy)(nil)).Elem() +} + type ArrayUpdateSpec struct { DynamicData @@ -5866,10 +6225,15 @@ func init() { type BaseConfigInfo struct { DynamicData - Id ID `xml:"id"` - Name string `xml:"name"` - CreateTime time.Time `xml:"createTime"` - Backing BaseBaseConfigInfoBackingInfo `xml:"backing,typeattr"` + Id ID `xml:"id"` + Name string `xml:"name"` + CreateTime time.Time `xml:"createTime"` + KeepAfterDeleteVm *bool `xml:"keepAfterDeleteVm"` + RelocationDisabled *bool `xml:"relocationDisabled"` + NativeSnapshotSupported *bool `xml:"nativeSnapshotSupported"` + ChangedBlockTrackingEnabled *bool `xml:"changedBlockTrackingEnabled"` + Backing BaseBaseConfigInfoBackingInfo `xml:"backing,typeattr"` + Iofilter []string `xml:"iofilter,omitempty"` } func init() { @@ -5920,6 +6284,69 @@ func init() { t["BaseConfigInfoRawDiskMappingBackingInfo"] = reflect.TypeOf((*BaseConfigInfoRawDiskMappingBackingInfo)(nil)).Elem() } +type BatchAddHostsToClusterRequestType struct { + This ManagedObjectReference `xml:"_this"` + Cluster ManagedObjectReference `xml:"cluster"` + NewHosts []FolderNewHostSpec `xml:"newHosts,omitempty"` + ExistingHosts []ManagedObjectReference `xml:"existingHosts,omitempty"` + CompResSpec BaseComputeResourceConfigSpec `xml:"compResSpec,omitempty,typeattr"` + DesiredState string `xml:"desiredState,omitempty"` +} + +func init() { + t["BatchAddHostsToClusterRequestType"] = reflect.TypeOf((*BatchAddHostsToClusterRequestType)(nil)).Elem() +} + +type BatchAddHostsToCluster_Task BatchAddHostsToClusterRequestType + +func init() { + t["BatchAddHostsToCluster_Task"] = reflect.TypeOf((*BatchAddHostsToCluster_Task)(nil)).Elem() +} + +type BatchAddHostsToCluster_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type BatchAddStandaloneHostsRequestType struct { + This ManagedObjectReference `xml:"_this"` + NewHosts []FolderNewHostSpec `xml:"newHosts,omitempty"` + CompResSpec BaseComputeResourceConfigSpec `xml:"compResSpec,omitempty,typeattr"` + AddConnected bool `xml:"addConnected"` +} + +func init() { + t["BatchAddStandaloneHostsRequestType"] = reflect.TypeOf((*BatchAddStandaloneHostsRequestType)(nil)).Elem() +} + +type BatchAddStandaloneHosts_Task BatchAddStandaloneHostsRequestType + +func init() { + t["BatchAddStandaloneHosts_Task"] = reflect.TypeOf((*BatchAddStandaloneHosts_Task)(nil)).Elem() +} + +type BatchAddStandaloneHosts_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type BatchQueryConnectInfo BatchQueryConnectInfoRequestType + +func init() { + t["BatchQueryConnectInfo"] = reflect.TypeOf((*BatchQueryConnectInfo)(nil)).Elem() +} + +type BatchQueryConnectInfoRequestType struct { + This ManagedObjectReference `xml:"_this"` + HostSpecs []HostConnectSpec `xml:"hostSpecs,omitempty"` +} + +func init() { + t["BatchQueryConnectInfoRequestType"] = reflect.TypeOf((*BatchQueryConnectInfoRequestType)(nil)).Elem() +} + +type BatchQueryConnectInfoResponse struct { + Returnval []DatacenterBasicConnectInfo `xml:"returnval,omitempty"` +} + type BatchResult struct { DynamicData @@ -6635,6 +7062,8 @@ type Capability struct { UserShellAccessSupported bool `xml:"userShellAccessSupported"` SupportedEVCMode []EVCMode `xml:"supportedEVCMode,omitempty"` NetworkBackupAndRestoreSupported *bool `xml:"networkBackupAndRestoreSupported"` + FtDrsWithoutEvcSupported *bool `xml:"ftDrsWithoutEvcSupported"` + HciWorkflowSupported *bool `xml:"hciWorkflowSupported"` } func init() { @@ -6739,6 +7168,25 @@ func init() { type ChangeFileAttributesInGuestResponse struct { } +type ChangeKeyRequestType struct { + This ManagedObjectReference `xml:"_this"` + NewKey CryptoKeyPlain `xml:"newKey"` +} + +func init() { + t["ChangeKeyRequestType"] = reflect.TypeOf((*ChangeKeyRequestType)(nil)).Elem() +} + +type ChangeKey_Task ChangeKeyRequestType + +func init() { + t["ChangeKey_Task"] = reflect.TypeOf((*ChangeKey_Task)(nil)).Elem() +} + +type ChangeKey_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type ChangeLockdownMode ChangeLockdownModeRequestType func init() { @@ -6795,6 +7243,26 @@ func init() { type ChangeOwnerResponse struct { } +type ChangePassword ChangePasswordRequestType + +func init() { + t["ChangePassword"] = reflect.TypeOf((*ChangePassword)(nil)).Elem() +} + +type ChangePasswordRequestType struct { + This ManagedObjectReference `xml:"_this"` + User string `xml:"user"` + OldPassword string `xml:"oldPassword"` + NewPassword string `xml:"newPassword"` +} + +func init() { + t["ChangePasswordRequestType"] = reflect.TypeOf((*ChangePasswordRequestType)(nil)).Elem() +} + +type ChangePasswordResponse struct { +} + type ChangesInfoEventArgument struct { DynamicData @@ -6845,6 +7313,29 @@ type CheckAnswerFileStatus_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type CheckCloneRequestType struct { + This ManagedObjectReference `xml:"_this"` + Vm ManagedObjectReference `xml:"vm"` + Folder ManagedObjectReference `xml:"folder"` + Name string `xml:"name"` + Spec VirtualMachineCloneSpec `xml:"spec"` + TestType []string `xml:"testType,omitempty"` +} + +func init() { + t["CheckCloneRequestType"] = reflect.TypeOf((*CheckCloneRequestType)(nil)).Elem() +} + +type CheckClone_Task CheckCloneRequestType + +func init() { + t["CheckClone_Task"] = reflect.TypeOf((*CheckClone_Task)(nil)).Elem() +} + +type CheckClone_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CheckCompatibilityRequestType struct { This ManagedObjectReference `xml:"_this"` Vm ManagedObjectReference `xml:"vm"` @@ -6982,6 +7473,27 @@ type CheckHostPatch_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type CheckInstantCloneRequestType struct { + This ManagedObjectReference `xml:"_this"` + Vm ManagedObjectReference `xml:"vm"` + Spec VirtualMachineInstantCloneSpec `xml:"spec"` + TestType []string `xml:"testType,omitempty"` +} + +func init() { + t["CheckInstantCloneRequestType"] = reflect.TypeOf((*CheckInstantCloneRequestType)(nil)).Elem() +} + +type CheckInstantClone_Task CheckInstantCloneRequestType + +func init() { + t["CheckInstantClone_Task"] = reflect.TypeOf((*CheckInstantClone_Task)(nil)).Elem() +} + +type CheckInstantClone_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CheckLicenseFeature CheckLicenseFeatureRequestType func init() { @@ -7025,6 +7537,28 @@ type CheckMigrate_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type CheckPowerOnRequestType struct { + This ManagedObjectReference `xml:"_this"` + Vm ManagedObjectReference `xml:"vm"` + Host *ManagedObjectReference `xml:"host,omitempty"` + Pool *ManagedObjectReference `xml:"pool,omitempty"` + TestType []string `xml:"testType,omitempty"` +} + +func init() { + t["CheckPowerOnRequestType"] = reflect.TypeOf((*CheckPowerOnRequestType)(nil)).Elem() +} + +type CheckPowerOn_Task CheckPowerOnRequestType + +func init() { + t["CheckPowerOn_Task"] = reflect.TypeOf((*CheckPowerOn_Task)(nil)).Elem() +} + +type CheckPowerOn_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CheckProfileComplianceRequestType struct { This ManagedObjectReference `xml:"_this"` Entity []ManagedObjectReference `xml:"entity,omitempty"` @@ -7078,6 +7612,29 @@ func init() { t["CheckResult"] = reflect.TypeOf((*CheckResult)(nil)).Elem() } +type CheckVmConfigRequestType struct { + This ManagedObjectReference `xml:"_this"` + Spec VirtualMachineConfigSpec `xml:"spec"` + Vm *ManagedObjectReference `xml:"vm,omitempty"` + Host *ManagedObjectReference `xml:"host,omitempty"` + Pool *ManagedObjectReference `xml:"pool,omitempty"` + TestType []string `xml:"testType,omitempty"` +} + +func init() { + t["CheckVmConfigRequestType"] = reflect.TypeOf((*CheckVmConfigRequestType)(nil)).Elem() +} + +type CheckVmConfig_Task CheckVmConfigRequestType + +func init() { + t["CheckVmConfig_Task"] = reflect.TypeOf((*CheckVmConfig_Task)(nil)).Elem() +} + +type CheckVmConfig_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type ChoiceOption struct { OptionType @@ -7142,6 +7699,44 @@ func init() { type ClearSystemEventLogResponse struct { } +type ClearTriggeredAlarms ClearTriggeredAlarmsRequestType + +func init() { + t["ClearTriggeredAlarms"] = reflect.TypeOf((*ClearTriggeredAlarms)(nil)).Elem() +} + +type ClearTriggeredAlarmsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Filter AlarmFilterSpec `xml:"filter"` +} + +func init() { + t["ClearTriggeredAlarmsRequestType"] = reflect.TypeOf((*ClearTriggeredAlarmsRequestType)(nil)).Elem() +} + +type ClearTriggeredAlarmsResponse struct { +} + +type ClearVStorageObjectControlFlags ClearVStorageObjectControlFlagsRequestType + +func init() { + t["ClearVStorageObjectControlFlags"] = reflect.TypeOf((*ClearVStorageObjectControlFlags)(nil)).Elem() +} + +type ClearVStorageObjectControlFlagsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + ControlFlags []string `xml:"controlFlags,omitempty"` +} + +func init() { + t["ClearVStorageObjectControlFlagsRequestType"] = reflect.TypeOf((*ClearVStorageObjectControlFlagsRequestType)(nil)).Elem() +} + +type ClearVStorageObjectControlFlagsResponse struct { +} + type ClockSkew struct { HostConfigFault } @@ -7334,6 +7929,150 @@ func init() { t["ClusterComplianceCheckedEvent"] = reflect.TypeOf((*ClusterComplianceCheckedEvent)(nil)).Elem() } +type ClusterComputeResourceClusterConfigResult struct { + DynamicData + + FailedHosts []FolderFailedHostResult `xml:"failedHosts,omitempty"` + ConfiguredHosts []ManagedObjectReference `xml:"configuredHosts,omitempty"` +} + +func init() { + t["ClusterComputeResourceClusterConfigResult"] = reflect.TypeOf((*ClusterComputeResourceClusterConfigResult)(nil)).Elem() +} + +type ClusterComputeResourceDVSConfigurationValidation struct { + ClusterComputeResourceValidationResultBase + + IsDvsValid bool `xml:"isDvsValid"` + IsDvpgValid bool `xml:"isDvpgValid"` +} + +func init() { + t["ClusterComputeResourceDVSConfigurationValidation"] = reflect.TypeOf((*ClusterComputeResourceDVSConfigurationValidation)(nil)).Elem() +} + +type ClusterComputeResourceDVSSetting struct { + DynamicData + + DvSwitch ManagedObjectReference `xml:"dvSwitch"` + PnicDevices []string `xml:"pnicDevices,omitempty"` + DvPortgroupSetting []ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping `xml:"dvPortgroupSetting,omitempty"` +} + +func init() { + t["ClusterComputeResourceDVSSetting"] = reflect.TypeOf((*ClusterComputeResourceDVSSetting)(nil)).Elem() +} + +type ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping struct { + DynamicData + + DvPortgroup ManagedObjectReference `xml:"dvPortgroup"` + Service string `xml:"service"` +} + +func init() { + t["ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping"] = reflect.TypeOf((*ClusterComputeResourceDVSSettingDVPortgroupToServiceMapping)(nil)).Elem() +} + +type ClusterComputeResourceDvsProfile struct { + DynamicData + + DvsName string `xml:"dvsName,omitempty"` + DvSwitch *ManagedObjectReference `xml:"dvSwitch,omitempty"` + PnicDevices []string `xml:"pnicDevices,omitempty"` + DvPortgroupMapping []ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping `xml:"dvPortgroupMapping,omitempty"` +} + +func init() { + t["ClusterComputeResourceDvsProfile"] = reflect.TypeOf((*ClusterComputeResourceDvsProfile)(nil)).Elem() +} + +type ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping struct { + DynamicData + + DvPortgroupSpec *DVPortgroupConfigSpec `xml:"dvPortgroupSpec,omitempty"` + DvPortgroup *ManagedObjectReference `xml:"dvPortgroup,omitempty"` + Service string `xml:"service"` +} + +func init() { + t["ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping"] = reflect.TypeOf((*ClusterComputeResourceDvsProfileDVPortgroupSpecToServiceMapping)(nil)).Elem() +} + +type ClusterComputeResourceHCIConfigInfo struct { + DynamicData + + WorkflowState string `xml:"workflowState"` + DvsSetting []ClusterComputeResourceDVSSetting `xml:"dvsSetting,omitempty"` + ConfiguredHosts []ManagedObjectReference `xml:"configuredHosts,omitempty"` + HostConfigProfile *ClusterComputeResourceHostConfigurationProfile `xml:"hostConfigProfile,omitempty"` +} + +func init() { + t["ClusterComputeResourceHCIConfigInfo"] = reflect.TypeOf((*ClusterComputeResourceHCIConfigInfo)(nil)).Elem() +} + +type ClusterComputeResourceHCIConfigSpec struct { + DynamicData + + DvsProf []ClusterComputeResourceDvsProfile `xml:"dvsProf,omitempty"` + HostConfigProfile *ClusterComputeResourceHostConfigurationProfile `xml:"hostConfigProfile,omitempty"` + VSanConfigSpec *SDDCBase `xml:"vSanConfigSpec,omitempty"` + VcProf *ClusterComputeResourceVCProfile `xml:"vcProf,omitempty"` +} + +func init() { + t["ClusterComputeResourceHCIConfigSpec"] = reflect.TypeOf((*ClusterComputeResourceHCIConfigSpec)(nil)).Elem() +} + +type ClusterComputeResourceHostConfigurationInput struct { + DynamicData + + Host ManagedObjectReference `xml:"host"` + HostVmkNics []ClusterComputeResourceHostVmkNicInfo `xml:"hostVmkNics,omitempty"` + AllowedInNonMaintenanceMode *bool `xml:"allowedInNonMaintenanceMode"` +} + +func init() { + t["ClusterComputeResourceHostConfigurationInput"] = reflect.TypeOf((*ClusterComputeResourceHostConfigurationInput)(nil)).Elem() +} + +type ClusterComputeResourceHostConfigurationProfile struct { + DynamicData + + DateTimeConfig *HostDateTimeConfig `xml:"dateTimeConfig,omitempty"` + LockdownMode HostLockdownMode `xml:"lockdownMode,omitempty"` +} + +func init() { + t["ClusterComputeResourceHostConfigurationProfile"] = reflect.TypeOf((*ClusterComputeResourceHostConfigurationProfile)(nil)).Elem() +} + +type ClusterComputeResourceHostConfigurationValidation struct { + ClusterComputeResourceValidationResultBase + + Host ManagedObjectReference `xml:"host"` + IsDvsSettingValid *bool `xml:"isDvsSettingValid"` + IsVmknicSettingValid *bool `xml:"isVmknicSettingValid"` + IsNtpSettingValid *bool `xml:"isNtpSettingValid"` + IsLockdownModeValid *bool `xml:"isLockdownModeValid"` +} + +func init() { + t["ClusterComputeResourceHostConfigurationValidation"] = reflect.TypeOf((*ClusterComputeResourceHostConfigurationValidation)(nil)).Elem() +} + +type ClusterComputeResourceHostVmkNicInfo struct { + DynamicData + + NicSpec HostVirtualNicSpec `xml:"nicSpec"` + Service string `xml:"service"` +} + +func init() { + t["ClusterComputeResourceHostVmkNicInfo"] = reflect.TypeOf((*ClusterComputeResourceHostVmkNicInfo)(nil)).Elem() +} + type ClusterComputeResourceSummary struct { ComputeResourceSummary @@ -7351,6 +8090,27 @@ func init() { t["ClusterComputeResourceSummary"] = reflect.TypeOf((*ClusterComputeResourceSummary)(nil)).Elem() } +type ClusterComputeResourceVCProfile struct { + DynamicData + + ClusterSpec *ClusterConfigSpecEx `xml:"clusterSpec,omitempty"` + EvcModeKey string `xml:"evcModeKey,omitempty"` +} + +func init() { + t["ClusterComputeResourceVCProfile"] = reflect.TypeOf((*ClusterComputeResourceVCProfile)(nil)).Elem() +} + +type ClusterComputeResourceValidationResultBase struct { + DynamicData + + Info []LocalizableMessage `xml:"info,omitempty"` +} + +func init() { + t["ClusterComputeResourceValidationResultBase"] = reflect.TypeOf((*ClusterComputeResourceValidationResultBase)(nil)).Elem() +} + type ClusterConfigInfo struct { DynamicData @@ -7419,6 +8179,7 @@ type ClusterConfigSpecEx struct { GroupSpec []ClusterGroupSpec `xml:"groupSpec,omitempty"` InfraUpdateHaConfig *ClusterInfraUpdateHaConfigInfo `xml:"infraUpdateHaConfig,omitempty"` ProactiveDrsConfig *ClusterProactiveDrsConfigInfo `xml:"proactiveDrsConfig,omitempty"` + InHciWorkflow *bool `xml:"inHciWorkflow"` } func init() { @@ -8226,6 +8987,8 @@ type ClusterResourceUsageSummary struct { CpuCapacityMHz int32 `xml:"cpuCapacityMHz"` MemUsedMB int32 `xml:"memUsedMB"` MemCapacityMB int32 `xml:"memCapacityMB"` + PMemAvailableMB int64 `xml:"pMemAvailableMB,omitempty"` + PMemCapacityMB int64 `xml:"pMemCapacityMB,omitempty"` StorageUsedMB int64 `xml:"storageUsedMB"` StorageCapacityMB int64 `xml:"storageCapacityMB"` } @@ -8462,6 +9225,30 @@ func init() { t["ComplianceResult"] = reflect.TypeOf((*ComplianceResult)(nil)).Elem() } +type CompositeHostProfileRequestType struct { + This ManagedObjectReference `xml:"_this"` + Source ManagedObjectReference `xml:"source"` + Targets []ManagedObjectReference `xml:"targets,omitempty"` + ToBeMerged *HostApplyProfile `xml:"toBeMerged,omitempty"` + ToBeReplacedWith *HostApplyProfile `xml:"toBeReplacedWith,omitempty"` + ToBeDeleted *HostApplyProfile `xml:"toBeDeleted,omitempty"` + EnableStatusToBeCopied *HostApplyProfile `xml:"enableStatusToBeCopied,omitempty"` +} + +func init() { + t["CompositeHostProfileRequestType"] = reflect.TypeOf((*CompositeHostProfileRequestType)(nil)).Elem() +} + +type CompositeHostProfile_Task CompositeHostProfileRequestType + +func init() { + t["CompositeHostProfile_Task"] = reflect.TypeOf((*CompositeHostProfile_Task)(nil)).Elem() +} + +type CompositeHostProfile_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CompositePolicyOption struct { PolicyOption @@ -8594,32 +9381,33 @@ func init() { type ConfigTarget struct { DynamicData - NumCpus int32 `xml:"numCpus"` - NumCpuCores int32 `xml:"numCpuCores"` - NumNumaNodes int32 `xml:"numNumaNodes"` - SmcPresent *bool `xml:"smcPresent"` - Datastore []VirtualMachineDatastoreInfo `xml:"datastore,omitempty"` - Network []VirtualMachineNetworkInfo `xml:"network,omitempty"` - OpaqueNetwork []OpaqueNetworkTargetInfo `xml:"opaqueNetwork,omitempty"` - DistributedVirtualPortgroup []DistributedVirtualPortgroupInfo `xml:"distributedVirtualPortgroup,omitempty"` - DistributedVirtualSwitch []DistributedVirtualSwitchInfo `xml:"distributedVirtualSwitch,omitempty"` - CdRom []VirtualMachineCdromInfo `xml:"cdRom,omitempty"` - Serial []VirtualMachineSerialInfo `xml:"serial,omitempty"` - Parallel []VirtualMachineParallelInfo `xml:"parallel,omitempty"` - Sound []VirtualMachineSoundInfo `xml:"sound,omitempty"` - Usb []VirtualMachineUsbInfo `xml:"usb,omitempty"` - Floppy []VirtualMachineFloppyInfo `xml:"floppy,omitempty"` - LegacyNetworkInfo []VirtualMachineLegacyNetworkSwitchInfo `xml:"legacyNetworkInfo,omitempty"` - ScsiPassthrough []VirtualMachineScsiPassthroughInfo `xml:"scsiPassthrough,omitempty"` - ScsiDisk []VirtualMachineScsiDiskDeviceInfo `xml:"scsiDisk,omitempty"` - IdeDisk []VirtualMachineIdeDiskDeviceInfo `xml:"ideDisk,omitempty"` - MaxMemMBOptimalPerf int32 `xml:"maxMemMBOptimalPerf"` - ResourcePool *ResourcePoolRuntimeInfo `xml:"resourcePool,omitempty"` - AutoVmotion *bool `xml:"autoVmotion"` - PciPassthrough []BaseVirtualMachinePciPassthroughInfo `xml:"pciPassthrough,omitempty,typeattr"` - Sriov []VirtualMachineSriovInfo `xml:"sriov,omitempty"` - VFlashModule []VirtualMachineVFlashModuleInfo `xml:"vFlashModule,omitempty"` - SharedGpuPassthroughTypes []VirtualMachinePciSharedGpuPassthroughInfo `xml:"sharedGpuPassthroughTypes,omitempty"` + NumCpus int32 `xml:"numCpus"` + NumCpuCores int32 `xml:"numCpuCores"` + NumNumaNodes int32 `xml:"numNumaNodes"` + SmcPresent *bool `xml:"smcPresent"` + Datastore []VirtualMachineDatastoreInfo `xml:"datastore,omitempty"` + Network []VirtualMachineNetworkInfo `xml:"network,omitempty"` + OpaqueNetwork []OpaqueNetworkTargetInfo `xml:"opaqueNetwork,omitempty"` + DistributedVirtualPortgroup []DistributedVirtualPortgroupInfo `xml:"distributedVirtualPortgroup,omitempty"` + DistributedVirtualSwitch []DistributedVirtualSwitchInfo `xml:"distributedVirtualSwitch,omitempty"` + CdRom []VirtualMachineCdromInfo `xml:"cdRom,omitempty"` + Serial []VirtualMachineSerialInfo `xml:"serial,omitempty"` + Parallel []VirtualMachineParallelInfo `xml:"parallel,omitempty"` + Sound []VirtualMachineSoundInfo `xml:"sound,omitempty"` + Usb []VirtualMachineUsbInfo `xml:"usb,omitempty"` + Floppy []VirtualMachineFloppyInfo `xml:"floppy,omitempty"` + LegacyNetworkInfo []VirtualMachineLegacyNetworkSwitchInfo `xml:"legacyNetworkInfo,omitempty"` + ScsiPassthrough []VirtualMachineScsiPassthroughInfo `xml:"scsiPassthrough,omitempty"` + ScsiDisk []VirtualMachineScsiDiskDeviceInfo `xml:"scsiDisk,omitempty"` + IdeDisk []VirtualMachineIdeDiskDeviceInfo `xml:"ideDisk,omitempty"` + MaxMemMBOptimalPerf int32 `xml:"maxMemMBOptimalPerf"` + ResourcePool *ResourcePoolRuntimeInfo `xml:"resourcePool,omitempty"` + AutoVmotion *bool `xml:"autoVmotion"` + PciPassthrough []BaseVirtualMachinePciPassthroughInfo `xml:"pciPassthrough,omitempty,typeattr"` + Sriov []VirtualMachineSriovInfo `xml:"sriov,omitempty"` + VFlashModule []VirtualMachineVFlashModuleInfo `xml:"vFlashModule,omitempty"` + SharedGpuPassthroughTypes []VirtualMachinePciSharedGpuPassthroughInfo `xml:"sharedGpuPassthroughTypes,omitempty"` + AvailablePersistentMemoryReservationMB int64 `xml:"availablePersistentMemoryReservationMB,omitempty"` } func init() { @@ -8702,6 +9490,26 @@ type ConfigureEvcMode_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type ConfigureHCIRequestType struct { + This ManagedObjectReference `xml:"_this"` + ClusterSpec ClusterComputeResourceHCIConfigSpec `xml:"clusterSpec"` + HostInputs []ClusterComputeResourceHostConfigurationInput `xml:"hostInputs,omitempty"` +} + +func init() { + t["ConfigureHCIRequestType"] = reflect.TypeOf((*ConfigureHCIRequestType)(nil)).Elem() +} + +type ConfigureHCI_Task ConfigureHCIRequestType + +func init() { + t["ConfigureHCI_Task"] = reflect.TypeOf((*ConfigureHCI_Task)(nil)).Elem() +} + +type ConfigureHCI_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type ConfigureHostCacheRequestType struct { This ManagedObjectReference `xml:"_this"` Spec HostCacheConfigurationSpec `xml:"spec"` @@ -9349,6 +10157,31 @@ type CreateDirectoryResponse struct { Returnval string `xml:"returnval"` } +type CreateDiskFromSnapshotRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId ID `xml:"snapshotId"` + Name string `xml:"name"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` + Crypto BaseCryptoSpec `xml:"crypto,omitempty,typeattr"` + Path string `xml:"path,omitempty"` +} + +func init() { + t["CreateDiskFromSnapshotRequestType"] = reflect.TypeOf((*CreateDiskFromSnapshotRequestType)(nil)).Elem() +} + +type CreateDiskFromSnapshot_Task CreateDiskFromSnapshotRequestType + +func init() { + t["CreateDiskFromSnapshot_Task"] = reflect.TypeOf((*CreateDiskFromSnapshot_Task)(nil)).Elem() +} + +type CreateDiskFromSnapshot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CreateDiskRequestType struct { This ManagedObjectReference `xml:"_this"` Spec VslmCreateSpec `xml:"spec"` @@ -9562,6 +10395,44 @@ type CreateNasDatastoreResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type CreateNvdimmNamespaceRequestType struct { + This ManagedObjectReference `xml:"_this"` + CreateSpec NvdimmNamespaceCreateSpec `xml:"createSpec"` +} + +func init() { + t["CreateNvdimmNamespaceRequestType"] = reflect.TypeOf((*CreateNvdimmNamespaceRequestType)(nil)).Elem() +} + +type CreateNvdimmNamespace_Task CreateNvdimmNamespaceRequestType + +func init() { + t["CreateNvdimmNamespace_Task"] = reflect.TypeOf((*CreateNvdimmNamespace_Task)(nil)).Elem() +} + +type CreateNvdimmNamespace_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type CreateNvdimmPMemNamespaceRequestType struct { + This ManagedObjectReference `xml:"_this"` + CreateSpec NvdimmPMemNamespaceCreateSpec `xml:"createSpec"` +} + +func init() { + t["CreateNvdimmPMemNamespaceRequestType"] = reflect.TypeOf((*CreateNvdimmPMemNamespaceRequestType)(nil)).Elem() +} + +type CreateNvdimmPMemNamespace_Task CreateNvdimmPMemNamespaceRequestType + +func init() { + t["CreateNvdimmPMemNamespace_Task"] = reflect.TypeOf((*CreateNvdimmPMemNamespace_Task)(nil)).Elem() +} + +type CreateNvdimmPMemNamespace_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CreateObjectScheduledTask CreateObjectScheduledTaskRequestType func init() { @@ -10055,6 +10926,41 @@ func init() { t["CryptoKeyResult"] = reflect.TypeOf((*CryptoKeyResult)(nil)).Elem() } +type CryptoManagerHostEnable CryptoManagerHostEnableRequestType + +func init() { + t["CryptoManagerHostEnable"] = reflect.TypeOf((*CryptoManagerHostEnable)(nil)).Elem() +} + +type CryptoManagerHostEnableRequestType struct { + This ManagedObjectReference `xml:"_this"` + InitialKey CryptoKeyPlain `xml:"initialKey"` +} + +func init() { + t["CryptoManagerHostEnableRequestType"] = reflect.TypeOf((*CryptoManagerHostEnableRequestType)(nil)).Elem() +} + +type CryptoManagerHostEnableResponse struct { +} + +type CryptoManagerHostPrepare CryptoManagerHostPrepareRequestType + +func init() { + t["CryptoManagerHostPrepare"] = reflect.TypeOf((*CryptoManagerHostPrepare)(nil)).Elem() +} + +type CryptoManagerHostPrepareRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["CryptoManagerHostPrepareRequestType"] = reflect.TypeOf((*CryptoManagerHostPrepareRequestType)(nil)).Elem() +} + +type CryptoManagerHostPrepareResponse struct { +} + type CryptoManagerKmipCertificateInfo struct { DynamicData @@ -10085,6 +10991,21 @@ func init() { t["CryptoManagerKmipClusterStatus"] = reflect.TypeOf((*CryptoManagerKmipClusterStatus)(nil)).Elem() } +type CryptoManagerKmipCryptoKeyStatus struct { + DynamicData + + KeyId CryptoKeyId `xml:"keyId"` + KeyAvailable *bool `xml:"keyAvailable"` + Reason string `xml:"reason,omitempty"` + EncryptedVMs []ManagedObjectReference `xml:"encryptedVMs,omitempty"` + AffectedHosts []ManagedObjectReference `xml:"affectedHosts,omitempty"` + ReferencedByTags []string `xml:"referencedByTags,omitempty"` +} + +func init() { + t["CryptoManagerKmipCryptoKeyStatus"] = reflect.TypeOf((*CryptoManagerKmipCryptoKeyStatus)(nil)).Elem() +} + type CryptoManagerKmipServerCertInfo struct { DynamicData @@ -10176,6 +11097,24 @@ func init() { t["CryptoSpecShallowRecrypt"] = reflect.TypeOf((*CryptoSpecShallowRecrypt)(nil)).Elem() } +type CryptoUnlockRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["CryptoUnlockRequestType"] = reflect.TypeOf((*CryptoUnlockRequestType)(nil)).Elem() +} + +type CryptoUnlock_Task CryptoUnlockRequestType + +func init() { + t["CryptoUnlock_Task"] = reflect.TypeOf((*CryptoUnlock_Task)(nil)).Elem() +} + +type CryptoUnlock_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type CurrentTime CurrentTimeRequestType func init() { @@ -11073,32 +12012,33 @@ func init() { type DVSConfigInfo struct { DynamicData - Uuid string `xml:"uuid"` - Name string `xml:"name"` - NumStandalonePorts int32 `xml:"numStandalonePorts"` - NumPorts int32 `xml:"numPorts"` - MaxPorts int32 `xml:"maxPorts"` - UplinkPortPolicy BaseDVSUplinkPortPolicy `xml:"uplinkPortPolicy,typeattr"` - UplinkPortgroup []ManagedObjectReference `xml:"uplinkPortgroup,omitempty"` - DefaultPortConfig BaseDVPortSetting `xml:"defaultPortConfig,typeattr"` - Host []DistributedVirtualSwitchHostMember `xml:"host,omitempty"` - ProductInfo DistributedVirtualSwitchProductSpec `xml:"productInfo"` - TargetInfo *DistributedVirtualSwitchProductSpec `xml:"targetInfo,omitempty"` - ExtensionKey string `xml:"extensionKey,omitempty"` - VendorSpecificConfig []DistributedVirtualSwitchKeyedOpaqueBlob `xml:"vendorSpecificConfig,omitempty"` - Policy *DVSPolicy `xml:"policy,omitempty"` - Description string `xml:"description,omitempty"` - ConfigVersion string `xml:"configVersion"` - Contact DVSContactInfo `xml:"contact"` - SwitchIpAddress string `xml:"switchIpAddress,omitempty"` - CreateTime time.Time `xml:"createTime"` - NetworkResourceManagementEnabled *bool `xml:"networkResourceManagementEnabled"` - DefaultProxySwitchMaxNumPorts int32 `xml:"defaultProxySwitchMaxNumPorts,omitempty"` - HealthCheckConfig []BaseDVSHealthCheckConfig `xml:"healthCheckConfig,omitempty,typeattr"` - InfrastructureTrafficResourceConfig []DvsHostInfrastructureTrafficResource `xml:"infrastructureTrafficResourceConfig,omitempty"` - NetworkResourceControlVersion string `xml:"networkResourceControlVersion,omitempty"` - VmVnicNetworkResourcePool []DVSVmVnicNetworkResourcePool `xml:"vmVnicNetworkResourcePool,omitempty"` - PnicCapacityRatioForReservation int32 `xml:"pnicCapacityRatioForReservation,omitempty"` + Uuid string `xml:"uuid"` + Name string `xml:"name"` + NumStandalonePorts int32 `xml:"numStandalonePorts"` + NumPorts int32 `xml:"numPorts"` + MaxPorts int32 `xml:"maxPorts"` + UplinkPortPolicy BaseDVSUplinkPortPolicy `xml:"uplinkPortPolicy,typeattr"` + UplinkPortgroup []ManagedObjectReference `xml:"uplinkPortgroup,omitempty"` + DefaultPortConfig BaseDVPortSetting `xml:"defaultPortConfig,typeattr"` + Host []DistributedVirtualSwitchHostMember `xml:"host,omitempty"` + ProductInfo DistributedVirtualSwitchProductSpec `xml:"productInfo"` + TargetInfo *DistributedVirtualSwitchProductSpec `xml:"targetInfo,omitempty"` + ExtensionKey string `xml:"extensionKey,omitempty"` + VendorSpecificConfig []DistributedVirtualSwitchKeyedOpaqueBlob `xml:"vendorSpecificConfig,omitempty"` + Policy *DVSPolicy `xml:"policy,omitempty"` + Description string `xml:"description,omitempty"` + ConfigVersion string `xml:"configVersion"` + Contact DVSContactInfo `xml:"contact"` + SwitchIpAddress string `xml:"switchIpAddress,omitempty"` + CreateTime time.Time `xml:"createTime"` + NetworkResourceManagementEnabled *bool `xml:"networkResourceManagementEnabled"` + DefaultProxySwitchMaxNumPorts int32 `xml:"defaultProxySwitchMaxNumPorts,omitempty"` + HealthCheckConfig []BaseDVSHealthCheckConfig `xml:"healthCheckConfig,omitempty,typeattr"` + InfrastructureTrafficResourceConfig []DvsHostInfrastructureTrafficResource `xml:"infrastructureTrafficResourceConfig,omitempty"` + NetResourcePoolTrafficResourceConfig []DvsHostInfrastructureTrafficResource `xml:"netResourcePoolTrafficResourceConfig,omitempty"` + NetworkResourceControlVersion string `xml:"networkResourceControlVersion,omitempty"` + VmVnicNetworkResourcePool []DVSVmVnicNetworkResourcePool `xml:"vmVnicNetworkResourcePool,omitempty"` + PnicCapacityRatioForReservation int32 `xml:"pnicCapacityRatioForReservation,omitempty"` } func init() { @@ -11108,23 +12048,24 @@ func init() { type DVSConfigSpec struct { DynamicData - ConfigVersion string `xml:"configVersion,omitempty"` - Name string `xml:"name,omitempty"` - NumStandalonePorts int32 `xml:"numStandalonePorts,omitempty"` - MaxPorts int32 `xml:"maxPorts,omitempty"` - UplinkPortPolicy BaseDVSUplinkPortPolicy `xml:"uplinkPortPolicy,omitempty,typeattr"` - UplinkPortgroup []ManagedObjectReference `xml:"uplinkPortgroup,omitempty"` - DefaultPortConfig BaseDVPortSetting `xml:"defaultPortConfig,omitempty,typeattr"` - Host []DistributedVirtualSwitchHostMemberConfigSpec `xml:"host,omitempty"` - ExtensionKey string `xml:"extensionKey,omitempty"` - Description string `xml:"description,omitempty"` - Policy *DVSPolicy `xml:"policy,omitempty"` - VendorSpecificConfig []DistributedVirtualSwitchKeyedOpaqueBlob `xml:"vendorSpecificConfig,omitempty"` - Contact *DVSContactInfo `xml:"contact,omitempty"` - SwitchIpAddress string `xml:"switchIpAddress,omitempty"` - DefaultProxySwitchMaxNumPorts int32 `xml:"defaultProxySwitchMaxNumPorts,omitempty"` - InfrastructureTrafficResourceConfig []DvsHostInfrastructureTrafficResource `xml:"infrastructureTrafficResourceConfig,omitempty"` - NetworkResourceControlVersion string `xml:"networkResourceControlVersion,omitempty"` + ConfigVersion string `xml:"configVersion,omitempty"` + Name string `xml:"name,omitempty"` + NumStandalonePorts int32 `xml:"numStandalonePorts,omitempty"` + MaxPorts int32 `xml:"maxPorts,omitempty"` + UplinkPortPolicy BaseDVSUplinkPortPolicy `xml:"uplinkPortPolicy,omitempty,typeattr"` + UplinkPortgroup []ManagedObjectReference `xml:"uplinkPortgroup,omitempty"` + DefaultPortConfig BaseDVPortSetting `xml:"defaultPortConfig,omitempty,typeattr"` + Host []DistributedVirtualSwitchHostMemberConfigSpec `xml:"host,omitempty"` + ExtensionKey string `xml:"extensionKey,omitempty"` + Description string `xml:"description,omitempty"` + Policy *DVSPolicy `xml:"policy,omitempty"` + VendorSpecificConfig []DistributedVirtualSwitchKeyedOpaqueBlob `xml:"vendorSpecificConfig,omitempty"` + Contact *DVSContactInfo `xml:"contact,omitempty"` + SwitchIpAddress string `xml:"switchIpAddress,omitempty"` + DefaultProxySwitchMaxNumPorts int32 `xml:"defaultProxySwitchMaxNumPorts,omitempty"` + InfrastructureTrafficResourceConfig []DvsHostInfrastructureTrafficResource `xml:"infrastructureTrafficResourceConfig,omitempty"` + NetResourcePoolTrafficResourceConfig []DvsHostInfrastructureTrafficResource `xml:"netResourcePoolTrafficResourceConfig,omitempty"` + NetworkResourceControlVersion string `xml:"networkResourceControlVersion,omitempty"` } func init() { @@ -11182,6 +12123,7 @@ type DVSFeatureCapability struct { RollbackCapability *DVSRollbackCapability `xml:"rollbackCapability,omitempty"` BackupRestoreCapability *DVSBackupRestoreCapability `xml:"backupRestoreCapability,omitempty"` NetworkFilterSupported *bool `xml:"networkFilterSupported"` + MacLearningSupported *bool `xml:"macLearningSupported"` } func init() { @@ -11220,6 +12162,32 @@ func init() { t["DVSHostLocalPortInfo"] = reflect.TypeOf((*DVSHostLocalPortInfo)(nil)).Elem() } +type DVSMacLearningPolicy struct { + InheritablePolicy + + Enabled bool `xml:"enabled"` + AllowUnicastFlooding *bool `xml:"allowUnicastFlooding"` + Limit *int32 `xml:"limit"` + LimitPolicy string `xml:"limitPolicy,omitempty"` +} + +func init() { + t["DVSMacLearningPolicy"] = reflect.TypeOf((*DVSMacLearningPolicy)(nil)).Elem() +} + +type DVSMacManagementPolicy struct { + InheritablePolicy + + AllowPromiscuous *bool `xml:"allowPromiscuous"` + MacChanges *bool `xml:"macChanges"` + ForgedTransmits *bool `xml:"forgedTransmits"` + MacLearningPolicy *DVSMacLearningPolicy `xml:"macLearningPolicy,omitempty"` +} + +func init() { + t["DVSMacManagementPolicy"] = reflect.TypeOf((*DVSMacManagementPolicy)(nil)).Elem() +} + type DVSManagerDvsConfigTarget struct { DynamicData @@ -11308,6 +12276,7 @@ type DVSNetworkResourceManagementCapability struct { QosSupported bool `xml:"qosSupported"` UserDefinedNetworkResourcePoolsSupported bool `xml:"userDefinedNetworkResourcePoolsSupported"` NetworkResourceControlVersion3Supported *bool `xml:"networkResourceControlVersion3Supported"` + UserDefinedInfraTrafficPoolSupported *bool `xml:"userDefinedInfraTrafficPoolSupported"` } func init() { @@ -11331,7 +12300,7 @@ func init() { type DVSNetworkResourcePoolAllocationInfo struct { DynamicData - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` PriorityTag int32 `xml:"priorityTag,omitempty"` } @@ -11643,6 +12612,23 @@ func init() { t["DatabaseSizeParam"] = reflect.TypeOf((*DatabaseSizeParam)(nil)).Elem() } +type DatacenterBasicConnectInfo struct { + DynamicData + + Hostname string `xml:"hostname,omitempty"` + Error *LocalizedMethodFault `xml:"error,omitempty"` + ServerIp string `xml:"serverIp,omitempty"` + NumVm int32 `xml:"numVm,omitempty"` + NumPoweredOnVm int32 `xml:"numPoweredOnVm,omitempty"` + HostProductInfo *AboutInfo `xml:"hostProductInfo,omitempty"` + HardwareVendor string `xml:"hardwareVendor,omitempty"` + HardwareModel string `xml:"hardwareModel,omitempty"` +} + +func init() { + t["DatacenterBasicConnectInfo"] = reflect.TypeOf((*DatacenterBasicConnectInfo)(nil)).Elem() +} + type DatacenterConfigInfo struct { DynamicData @@ -11743,6 +12729,7 @@ type DatastoreCapability struct { VmfsSparseSupported *bool `xml:"vmfsSparseSupported"` VsanSparseSupported *bool `xml:"vsanSparseSupported"` UpitSupported *bool `xml:"upitSupported"` + VmdkExpandSupported *bool `xml:"vmdkExpandSupported"` } func init() { @@ -11914,6 +12901,7 @@ type DatastoreInfo struct { MaxMemoryFileSize int64 `xml:"maxMemoryFileSize,omitempty"` Timestamp *time.Time `xml:"timestamp"` ContainerId string `xml:"containerId,omitempty"` + AliasOf string `xml:"aliasOf,omitempty"` } func init() { @@ -12247,6 +13235,43 @@ func init() { type DeleteHostSubSpecificationResponse struct { } +type DeleteNvdimmBlockNamespacesRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["DeleteNvdimmBlockNamespacesRequestType"] = reflect.TypeOf((*DeleteNvdimmBlockNamespacesRequestType)(nil)).Elem() +} + +type DeleteNvdimmBlockNamespaces_Task DeleteNvdimmBlockNamespacesRequestType + +func init() { + t["DeleteNvdimmBlockNamespaces_Task"] = reflect.TypeOf((*DeleteNvdimmBlockNamespaces_Task)(nil)).Elem() +} + +type DeleteNvdimmBlockNamespaces_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type DeleteNvdimmNamespaceRequestType struct { + This ManagedObjectReference `xml:"_this"` + DeleteSpec NvdimmNamespaceDeleteSpec `xml:"deleteSpec"` +} + +func init() { + t["DeleteNvdimmNamespaceRequestType"] = reflect.TypeOf((*DeleteNvdimmNamespaceRequestType)(nil)).Elem() +} + +type DeleteNvdimmNamespace_Task DeleteNvdimmNamespaceRequestType + +func init() { + t["DeleteNvdimmNamespace_Task"] = reflect.TypeOf((*DeleteNvdimmNamespace_Task)(nil)).Elem() +} + +type DeleteNvdimmNamespace_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type DeleteRegistryKeyInGuest DeleteRegistryKeyInGuestRequestType func init() { @@ -12306,6 +13331,27 @@ func init() { type DeleteScsiLunStateResponse struct { } +type DeleteSnapshotRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId ID `xml:"snapshotId"` +} + +func init() { + t["DeleteSnapshotRequestType"] = reflect.TypeOf((*DeleteSnapshotRequestType)(nil)).Elem() +} + +type DeleteSnapshot_Task DeleteSnapshotRequestType + +func init() { + t["DeleteSnapshot_Task"] = reflect.TypeOf((*DeleteSnapshot_Task)(nil)).Elem() +} + +type DeleteSnapshot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type DeleteVStorageObjectRequestType struct { This ManagedObjectReference `xml:"_this"` Id ID `xml:"id"` @@ -14165,9 +15211,9 @@ func init() { type DvsHostInfrastructureTrafficResourceAllocation struct { DynamicData - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` } func init() { @@ -14846,7 +15892,7 @@ type DvsVnicAllocatedResource struct { Vm ManagedObjectReference `xml:"vm"` VnicKey string `xml:"vnicKey"` - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` } func init() { @@ -15336,6 +16382,22 @@ func init() { type EnableSmartCardAuthenticationResponse struct { } +type EncryptionKeyRequired struct { + InvalidState + + RequiredKey []CryptoKeyId `xml:"requiredKey,omitempty"` +} + +func init() { + t["EncryptionKeyRequired"] = reflect.TypeOf((*EncryptionKeyRequired)(nil)).Elem() +} + +type EncryptionKeyRequiredFault EncryptionKeyRequired + +func init() { + t["EncryptionKeyRequiredFault"] = reflect.TypeOf((*EncryptionKeyRequiredFault)(nil)).Elem() +} + type EnterLockdownMode EnterLockdownModeRequestType func init() { @@ -16105,6 +17167,26 @@ type ExtendDisk_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type ExtendHCIRequestType struct { + This ManagedObjectReference `xml:"_this"` + HostInputs []ClusterComputeResourceHostConfigurationInput `xml:"hostInputs,omitempty"` + VSanConfigSpec *SDDCBase `xml:"vSanConfigSpec,omitempty"` +} + +func init() { + t["ExtendHCIRequestType"] = reflect.TypeOf((*ExtendHCIRequestType)(nil)).Elem() +} + +type ExtendHCI_Task ExtendHCIRequestType + +func init() { + t["ExtendHCI_Task"] = reflect.TypeOf((*ExtendHCI_Task)(nil)).Elem() +} + +type ExtendHCI_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type ExtendVffs ExtendVffsRequestType func init() { @@ -16679,6 +17761,28 @@ func init() { t["FaultToleranceVmNotDasProtectedFault"] = reflect.TypeOf((*FaultToleranceVmNotDasProtectedFault)(nil)).Elem() } +type FaultsByHost struct { + DynamicData + + Host ManagedObjectReference `xml:"host"` + Faults []LocalizedMethodFault `xml:"faults,omitempty"` +} + +func init() { + t["FaultsByHost"] = reflect.TypeOf((*FaultsByHost)(nil)).Elem() +} + +type FaultsByVM struct { + DynamicData + + Vm ManagedObjectReference `xml:"vm"` + Faults []LocalizedMethodFault `xml:"faults,omitempty"` +} + +func init() { + t["FaultsByVM"] = reflect.TypeOf((*FaultsByVM)(nil)).Elem() +} + type FcoeConfig struct { DynamicData @@ -17352,6 +18456,29 @@ func init() { t["FloppyImageFileQuery"] = reflect.TypeOf((*FloppyImageFileQuery)(nil)).Elem() } +type FolderBatchAddHostsToClusterResult struct { + DynamicData + + HostsAddedToCluster []ManagedObjectReference `xml:"hostsAddedToCluster,omitempty"` + HostsFailedInventoryAdd []FolderFailedHostResult `xml:"hostsFailedInventoryAdd,omitempty"` + HostsFailedMoveToCluster []FolderFailedHostResult `xml:"hostsFailedMoveToCluster,omitempty"` +} + +func init() { + t["FolderBatchAddHostsToClusterResult"] = reflect.TypeOf((*FolderBatchAddHostsToClusterResult)(nil)).Elem() +} + +type FolderBatchAddStandaloneHostsResult struct { + DynamicData + + AddedHosts []ManagedObjectReference `xml:"addedHosts,omitempty"` + HostsFailedInventoryAdd []FolderFailedHostResult `xml:"hostsFailedInventoryAdd,omitempty"` +} + +func init() { + t["FolderBatchAddStandaloneHostsResult"] = reflect.TypeOf((*FolderBatchAddStandaloneHostsResult)(nil)).Elem() +} + type FolderEventArgument struct { EntityEventArgument @@ -17362,6 +18489,19 @@ func init() { t["FolderEventArgument"] = reflect.TypeOf((*FolderEventArgument)(nil)).Elem() } +type FolderFailedHostResult struct { + DynamicData + + HostName string `xml:"hostName,omitempty"` + Host *ManagedObjectReference `xml:"host,omitempty"` + Context LocalizableMessage `xml:"context"` + Fault LocalizedMethodFault `xml:"fault"` +} + +func init() { + t["FolderFailedHostResult"] = reflect.TypeOf((*FolderFailedHostResult)(nil)).Elem() +} + type FolderFileInfo struct { FileInfo } @@ -17378,6 +18518,17 @@ func init() { t["FolderFileQuery"] = reflect.TypeOf((*FolderFileQuery)(nil)).Elem() } +type FolderNewHostSpec struct { + DynamicData + + HostCnxSpec HostConnectSpec `xml:"hostCnxSpec"` + EsxLicense string `xml:"esxLicense,omitempty"` +} + +func init() { + t["FolderNewHostSpec"] = reflect.TypeOf((*FolderNewHostSpec)(nil)).Elem() +} + type FormatVffs FormatVffsRequestType func init() { @@ -18273,51 +19424,66 @@ func init() { type GuestOsDescriptor struct { DynamicData - Id string `xml:"id"` - Family string `xml:"family"` - FullName string `xml:"fullName"` - SupportedMaxCPUs int32 `xml:"supportedMaxCPUs"` - NumSupportedPhysicalSockets int32 `xml:"numSupportedPhysicalSockets,omitempty"` - NumSupportedCoresPerSocket int32 `xml:"numSupportedCoresPerSocket,omitempty"` - SupportedMinMemMB int32 `xml:"supportedMinMemMB"` - SupportedMaxMemMB int32 `xml:"supportedMaxMemMB"` - RecommendedMemMB int32 `xml:"recommendedMemMB"` - RecommendedColorDepth int32 `xml:"recommendedColorDepth"` - SupportedDiskControllerList []string `xml:"supportedDiskControllerList"` - RecommendedSCSIController string `xml:"recommendedSCSIController,omitempty"` - RecommendedDiskController string `xml:"recommendedDiskController"` - SupportedNumDisks int32 `xml:"supportedNumDisks"` - RecommendedDiskSizeMB int32 `xml:"recommendedDiskSizeMB"` - RecommendedCdromController string `xml:"recommendedCdromController,omitempty"` - SupportedEthernetCard []string `xml:"supportedEthernetCard"` - RecommendedEthernetCard string `xml:"recommendedEthernetCard,omitempty"` - SupportsSlaveDisk *bool `xml:"supportsSlaveDisk"` - CpuFeatureMask []HostCpuIdInfo `xml:"cpuFeatureMask,omitempty"` - SmcRequired *bool `xml:"smcRequired"` - SupportsWakeOnLan bool `xml:"supportsWakeOnLan"` - SupportsVMI *bool `xml:"supportsVMI"` - SupportsMemoryHotAdd *bool `xml:"supportsMemoryHotAdd"` - SupportsCpuHotAdd *bool `xml:"supportsCpuHotAdd"` - SupportsCpuHotRemove *bool `xml:"supportsCpuHotRemove"` - SupportedFirmware []string `xml:"supportedFirmware,omitempty"` - RecommendedFirmware string `xml:"recommendedFirmware,omitempty"` - SupportedUSBControllerList []string `xml:"supportedUSBControllerList,omitempty"` - RecommendedUSBController string `xml:"recommendedUSBController,omitempty"` - Supports3D *bool `xml:"supports3D"` - Recommended3D *bool `xml:"recommended3D"` - SmcRecommended *bool `xml:"smcRecommended"` - Ich7mRecommended *bool `xml:"ich7mRecommended"` - UsbRecommended *bool `xml:"usbRecommended"` - SupportLevel string `xml:"supportLevel,omitempty"` - SupportedForCreate *bool `xml:"supportedForCreate"` - VRAMSizeInKB *IntOption `xml:"vRAMSizeInKB,omitempty"` - NumSupportedFloppyDevices int32 `xml:"numSupportedFloppyDevices,omitempty"` - WakeOnLanEthernetCard []string `xml:"wakeOnLanEthernetCard,omitempty"` - SupportsPvscsiControllerForBoot *bool `xml:"supportsPvscsiControllerForBoot"` - DiskUuidEnabled *bool `xml:"diskUuidEnabled"` - SupportsHotPlugPCI *bool `xml:"supportsHotPlugPCI"` - SupportsSecureBoot *bool `xml:"supportsSecureBoot"` - DefaultSecureBoot *bool `xml:"defaultSecureBoot"` + Id string `xml:"id"` + Family string `xml:"family"` + FullName string `xml:"fullName"` + SupportedMaxCPUs int32 `xml:"supportedMaxCPUs"` + NumSupportedPhysicalSockets int32 `xml:"numSupportedPhysicalSockets,omitempty"` + NumSupportedCoresPerSocket int32 `xml:"numSupportedCoresPerSocket,omitempty"` + SupportedMinMemMB int32 `xml:"supportedMinMemMB"` + SupportedMaxMemMB int32 `xml:"supportedMaxMemMB"` + RecommendedMemMB int32 `xml:"recommendedMemMB"` + RecommendedColorDepth int32 `xml:"recommendedColorDepth"` + SupportedDiskControllerList []string `xml:"supportedDiskControllerList"` + RecommendedSCSIController string `xml:"recommendedSCSIController,omitempty"` + RecommendedDiskController string `xml:"recommendedDiskController"` + SupportedNumDisks int32 `xml:"supportedNumDisks"` + RecommendedDiskSizeMB int32 `xml:"recommendedDiskSizeMB"` + RecommendedCdromController string `xml:"recommendedCdromController,omitempty"` + SupportedEthernetCard []string `xml:"supportedEthernetCard"` + RecommendedEthernetCard string `xml:"recommendedEthernetCard,omitempty"` + SupportsSlaveDisk *bool `xml:"supportsSlaveDisk"` + CpuFeatureMask []HostCpuIdInfo `xml:"cpuFeatureMask,omitempty"` + SmcRequired *bool `xml:"smcRequired"` + SupportsWakeOnLan bool `xml:"supportsWakeOnLan"` + SupportsVMI *bool `xml:"supportsVMI"` + SupportsMemoryHotAdd *bool `xml:"supportsMemoryHotAdd"` + SupportsCpuHotAdd *bool `xml:"supportsCpuHotAdd"` + SupportsCpuHotRemove *bool `xml:"supportsCpuHotRemove"` + SupportedFirmware []string `xml:"supportedFirmware,omitempty"` + RecommendedFirmware string `xml:"recommendedFirmware,omitempty"` + SupportedUSBControllerList []string `xml:"supportedUSBControllerList,omitempty"` + RecommendedUSBController string `xml:"recommendedUSBController,omitempty"` + Supports3D *bool `xml:"supports3D"` + Recommended3D *bool `xml:"recommended3D"` + SmcRecommended *bool `xml:"smcRecommended"` + Ich7mRecommended *bool `xml:"ich7mRecommended"` + UsbRecommended *bool `xml:"usbRecommended"` + SupportLevel string `xml:"supportLevel,omitempty"` + SupportedForCreate *bool `xml:"supportedForCreate"` + VRAMSizeInKB *IntOption `xml:"vRAMSizeInKB,omitempty"` + NumSupportedFloppyDevices int32 `xml:"numSupportedFloppyDevices,omitempty"` + WakeOnLanEthernetCard []string `xml:"wakeOnLanEthernetCard,omitempty"` + SupportsPvscsiControllerForBoot *bool `xml:"supportsPvscsiControllerForBoot"` + DiskUuidEnabled *bool `xml:"diskUuidEnabled"` + SupportsHotPlugPCI *bool `xml:"supportsHotPlugPCI"` + SupportsSecureBoot *bool `xml:"supportsSecureBoot"` + DefaultSecureBoot *bool `xml:"defaultSecureBoot"` + PersistentMemorySupported *bool `xml:"persistentMemorySupported"` + SupportedMinPersistentMemoryMB int64 `xml:"supportedMinPersistentMemoryMB,omitempty"` + SupportedMaxPersistentMemoryMB int64 `xml:"supportedMaxPersistentMemoryMB,omitempty"` + RecommendedPersistentMemoryMB int64 `xml:"recommendedPersistentMemoryMB,omitempty"` + PersistentMemoryHotAddSupported *bool `xml:"persistentMemoryHotAddSupported"` + PersistentMemoryHotRemoveSupported *bool `xml:"persistentMemoryHotRemoveSupported"` + PersistentMemoryColdGrowthSupported *bool `xml:"persistentMemoryColdGrowthSupported"` + PersistentMemoryColdGrowthGranularityMB int64 `xml:"persistentMemoryColdGrowthGranularityMB,omitempty"` + PersistentMemoryHotGrowthSupported *bool `xml:"persistentMemoryHotGrowthSupported"` + PersistentMemoryHotGrowthGranularityMB int64 `xml:"persistentMemoryHotGrowthGranularityMB,omitempty"` + NumRecommendedPhysicalSockets int32 `xml:"numRecommendedPhysicalSockets,omitempty"` + NumRecommendedCoresPerSocket int32 `xml:"numRecommendedCoresPerSocket,omitempty"` + VvtdSupported *BoolOption `xml:"vvtdSupported,omitempty"` + VbsSupported *BoolOption `xml:"vbsSupported,omitempty"` + SupportsTPM20 *bool `xml:"supportsTPM20"` } func init() { @@ -19205,6 +20371,8 @@ type HostCapability struct { DeltaDiskBackingsSupported *bool `xml:"deltaDiskBackingsSupported"` PerVMNetworkTrafficShapingSupported *bool `xml:"perVMNetworkTrafficShapingSupported"` TpmSupported *bool `xml:"tpmSupported"` + TpmVersion string `xml:"tpmVersion,omitempty"` + TxtEnabled *bool `xml:"txtEnabled"` SupportedCpuFeature []HostCpuIdInfo `xml:"supportedCpuFeature,omitempty"` VirtualExecUsageSupported *bool `xml:"virtualExecUsageSupported"` StorageIORMSupported *bool `xml:"storageIORMSupported"` @@ -19242,6 +20410,8 @@ type HostCapability struct { MarkAsSsdSupported *bool `xml:"markAsSsdSupported"` MarkAsLocalSupported *bool `xml:"markAsLocalSupported"` SmartCardAuthenticationSupported *bool `xml:"smartCardAuthenticationSupported"` + PMemSupported *bool `xml:"pMemSupported"` + PMemSnapshotSupported *bool `xml:"pMemSnapshotSupported"` CryptoSupported *bool `xml:"cryptoSupported"` OneKVolumeAPIsSupported *bool `xml:"oneKVolumeAPIsSupported"` GatewayOnNicSupported *bool `xml:"gatewayOnNicSupported"` @@ -19257,6 +20427,16 @@ type HostCapability struct { EncryptionVFlashSupported *bool `xml:"encryptionVFlashSupported"` EncryptionCBRCSupported *bool `xml:"encryptionCBRCSupported"` EncryptionHBRSupported *bool `xml:"encryptionHBRSupported"` + FtEfiSupported *bool `xml:"ftEfiSupported"` + UnmapMethodSupported string `xml:"unmapMethodSupported,omitempty"` + MaxMemMBPerFtVm int32 `xml:"maxMemMBPerFtVm,omitempty"` + VirtualMmuUsageIgnored *bool `xml:"virtualMmuUsageIgnored"` + VirtualExecUsageIgnored *bool `xml:"virtualExecUsageIgnored"` + VmCreateDateSupported *bool `xml:"vmCreateDateSupported"` + Vmfs3EOLSupported *bool `xml:"vmfs3EOLSupported"` + FtVmcpSupported *bool `xml:"ftVmcpSupported"` + QuickBootSupported *bool `xml:"quickBootSupported"` + MarkPerenniallyReservedSupported *bool `xml:"markPerenniallyReservedSupported"` } func init() { @@ -19277,6 +20457,26 @@ func init() { t["HostCertificateManagerCertificateInfo"] = reflect.TypeOf((*HostCertificateManagerCertificateInfo)(nil)).Elem() } +type HostClearVStorageObjectControlFlags HostClearVStorageObjectControlFlagsRequestType + +func init() { + t["HostClearVStorageObjectControlFlags"] = reflect.TypeOf((*HostClearVStorageObjectControlFlags)(nil)).Elem() +} + +type HostClearVStorageObjectControlFlagsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + ControlFlags []string `xml:"controlFlags,omitempty"` +} + +func init() { + t["HostClearVStorageObjectControlFlagsRequestType"] = reflect.TypeOf((*HostClearVStorageObjectControlFlagsRequestType)(nil)).Elem() +} + +type HostClearVStorageObjectControlFlagsResponse struct { +} + type HostCloneVStorageObjectRequestType struct { This ManagedObjectReference `xml:"_this"` Id ID `xml:"id"` @@ -19536,6 +20736,7 @@ type HostConfigInfo struct { GraphicsInfo []HostGraphicsInfo `xml:"graphicsInfo,omitempty"` SharedPassthruGpuTypes []string `xml:"sharedPassthruGpuTypes,omitempty"` GraphicsConfig *HostGraphicsConfig `xml:"graphicsConfig,omitempty"` + SharedGpuCapabilities []HostSharedGpuCapabilities `xml:"sharedGpuCapabilities,omitempty"` IoFilterInfo []HostIoFilterInfo `xml:"ioFilterInfo,omitempty"` SriovDevicePool []BaseHostSriovDevicePoolInfo `xml:"sriovDevicePool,omitempty,typeattr"` } @@ -19584,6 +20785,7 @@ type HostConfigManager struct { VsanInternalSystem *ManagedObjectReference `xml:"vsanInternalSystem,omitempty"` CertificateManager *ManagedObjectReference `xml:"certificateManager,omitempty"` CryptoManager *ManagedObjectReference `xml:"cryptoManager,omitempty"` + NvdimmSystem *ManagedObjectReference `xml:"nvdimmSystem,omitempty"` } func init() { @@ -20331,12 +21533,13 @@ func init() { type HostDnsConfig struct { DynamicData - Dhcp bool `xml:"dhcp"` - VirtualNicDevice string `xml:"virtualNicDevice,omitempty"` - HostName string `xml:"hostName"` - DomainName string `xml:"domainName"` - Address []string `xml:"address,omitempty"` - SearchDomain []string `xml:"searchDomain,omitempty"` + Dhcp bool `xml:"dhcp"` + VirtualNicDevice string `xml:"virtualNicDevice,omitempty"` + Ipv6VirtualNicDevice string `xml:"ipv6VirtualNicDevice,omitempty"` + HostName string `xml:"hostName"` + DomainName string `xml:"domainName"` + Address []string `xml:"address,omitempty"` + SearchDomain []string `xml:"searchDomain,omitempty"` } func init() { @@ -20346,7 +21549,8 @@ func init() { type HostDnsConfigSpec struct { HostDnsConfig - VirtualNicConnection *HostVirtualNicConnection `xml:"virtualNicConnection,omitempty"` + VirtualNicConnection *HostVirtualNicConnection `xml:"virtualNicConnection,omitempty"` + VirtualNicConnectionV6 *HostVirtualNicConnection `xml:"virtualNicConnectionV6,omitempty"` } func init() { @@ -20363,6 +21567,17 @@ func init() { t["HostEnableAdminFailedEvent"] = reflect.TypeOf((*HostEnableAdminFailedEvent)(nil)).Elem() } +type HostEnterMaintenanceResult struct { + DynamicData + + VmFaults []FaultsByVM `xml:"vmFaults,omitempty"` + HostFaults []FaultsByHost `xml:"hostFaults,omitempty"` +} + +func init() { + t["HostEnterMaintenanceResult"] = reflect.TypeOf((*HostEnterMaintenanceResult)(nil)).Elem() +} + type HostEsxAgentHostManagerConfigInfo struct { DynamicData @@ -20808,6 +22023,7 @@ type HostHardwareInfo struct { CpuFeature []HostCpuIdInfo `xml:"cpuFeature,omitempty"` BiosInfo *HostBIOSInfo `xml:"biosInfo,omitempty"` ReliableMemoryInfo *HostReliableMemoryInfo `xml:"reliableMemoryInfo,omitempty"` + PersistentMemoryInfo *HostPersistentMemoryInfo `xml:"persistentMemoryInfo,omitempty"` } func init() { @@ -21547,6 +22763,7 @@ type HostListSummary struct { MaxEVCModeKey string `xml:"maxEVCModeKey,omitempty"` CurrentEVCModeKey string `xml:"currentEVCModeKey,omitempty"` Gateway *HostListSummaryGatewaySummary `xml:"gateway,omitempty"` + TpmAttestation *HostTpmAttestationInfo `xml:"tpmAttestation,omitempty"` } func init() { @@ -21571,6 +22788,7 @@ type HostListSummaryQuickStats struct { OverallMemoryUsage int32 `xml:"overallMemoryUsage,omitempty"` DistributedCpuFairness int32 `xml:"distributedCpuFairness,omitempty"` DistributedMemoryFairness int32 `xml:"distributedMemoryFairness,omitempty"` + AvailablePMemCapacity int32 `xml:"availablePMemCapacity,omitempty"` Uptime int32 `xml:"uptime,omitempty"` } @@ -22366,10 +23584,11 @@ func init() { type HostNumaNode struct { DynamicData - TypeId byte `xml:"typeId"` - CpuID []int16 `xml:"cpuID"` - MemoryRangeBegin int64 `xml:"memoryRangeBegin"` - MemoryRangeLength int64 `xml:"memoryRangeLength"` + TypeId byte `xml:"typeId"` + CpuID []int16 `xml:"cpuID"` + MemoryRangeBegin int64 `xml:"memoryRangeBegin"` + MemoryRangeLength int64 `xml:"memoryRangeLength"` + PciId []string `xml:"pciId,omitempty"` } func init() { @@ -22412,13 +23631,14 @@ func init() { type HostOpaqueSwitch struct { DynamicData - Key string `xml:"key"` - Name string `xml:"name,omitempty"` - Pnic []string `xml:"pnic,omitempty"` - PnicZone []HostOpaqueSwitchPhysicalNicZone `xml:"pnicZone,omitempty"` - Status string `xml:"status,omitempty"` - Vtep []HostVirtualNic `xml:"vtep,omitempty"` - ExtraConfig []BaseOptionValue `xml:"extraConfig,omitempty,typeattr"` + Key string `xml:"key"` + Name string `xml:"name,omitempty"` + Pnic []string `xml:"pnic,omitempty"` + PnicZone []HostOpaqueSwitchPhysicalNicZone `xml:"pnicZone,omitempty"` + Status string `xml:"status,omitempty"` + Vtep []HostVirtualNic `xml:"vtep,omitempty"` + ExtraConfig []BaseOptionValue `xml:"extraConfig,omitempty,typeattr"` + FeatureCapability []HostFeatureCapability `xml:"featureCapability,omitempty"` } func init() { @@ -22444,6 +23664,17 @@ func init() { t["HostOvercommittedEvent"] = reflect.TypeOf((*HostOvercommittedEvent)(nil)).Elem() } +type HostPMemVolume struct { + HostFileSystemVolume + + Uuid string `xml:"uuid"` + Version string `xml:"version"` +} + +func init() { + t["HostPMemVolume"] = reflect.TypeOf((*HostPMemVolume)(nil)).Elem() +} + type HostParallelScsiHba struct { HostHostBusAdapter } @@ -22584,12 +23815,23 @@ func init() { t["HostPciPassthruInfo"] = reflect.TypeOf((*HostPciPassthruInfo)(nil)).Elem() } +type HostPersistentMemoryInfo struct { + DynamicData + + CapacityInMB int64 `xml:"capacityInMB,omitempty"` + VolumeUUID string `xml:"volumeUUID,omitempty"` +} + +func init() { + t["HostPersistentMemoryInfo"] = reflect.TypeOf((*HostPersistentMemoryInfo)(nil)).Elem() +} + type HostPlacedVirtualNicIdentifier struct { DynamicData Vm ManagedObjectReference `xml:"vm"` VnicKey string `xml:"vnicKey"` - Reservation int32 `xml:"reservation,omitempty"` + Reservation *int32 `xml:"reservation"` } func init() { @@ -22856,6 +24098,40 @@ func init() { t["HostProfileHostBasedConfigSpec"] = reflect.TypeOf((*HostProfileHostBasedConfigSpec)(nil)).Elem() } +type HostProfileManagerCompositionResult struct { + DynamicData + + Errors []LocalizableMessage `xml:"errors,omitempty"` + Results []HostProfileManagerCompositionResultResultElement `xml:"results,omitempty"` +} + +func init() { + t["HostProfileManagerCompositionResult"] = reflect.TypeOf((*HostProfileManagerCompositionResult)(nil)).Elem() +} + +type HostProfileManagerCompositionResultResultElement struct { + DynamicData + + Target ManagedObjectReference `xml:"target"` + Status string `xml:"status"` + Errors []LocalizableMessage `xml:"errors,omitempty"` +} + +func init() { + t["HostProfileManagerCompositionResultResultElement"] = reflect.TypeOf((*HostProfileManagerCompositionResultResultElement)(nil)).Elem() +} + +type HostProfileManagerCompositionValidationResult struct { + DynamicData + + Results []HostProfileManagerCompositionValidationResultResultElement `xml:"results,omitempty"` + Errors []LocalizableMessage `xml:"errors,omitempty"` +} + +func init() { + t["HostProfileManagerCompositionValidationResult"] = reflect.TypeOf((*HostProfileManagerCompositionValidationResult)(nil)).Elem() +} + type HostProfileManagerCompositionValidationResultResultElement struct { DynamicData @@ -22898,6 +24174,23 @@ func init() { t["HostProfileManagerHostToConfigSpecMap"] = reflect.TypeOf((*HostProfileManagerHostToConfigSpecMap)(nil)).Elem() } +type HostProfileResetValidationState HostProfileResetValidationStateRequestType + +func init() { + t["HostProfileResetValidationState"] = reflect.TypeOf((*HostProfileResetValidationState)(nil)).Elem() +} + +type HostProfileResetValidationStateRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["HostProfileResetValidationStateRequestType"] = reflect.TypeOf((*HostProfileResetValidationStateRequestType)(nil)).Elem() +} + +type HostProfileResetValidationStateResponse struct { +} + type HostProfileSerializedHostProfileSpec struct { ProfileSerializedCreateSpec @@ -22909,6 +24202,22 @@ func init() { t["HostProfileSerializedHostProfileSpec"] = reflect.TypeOf((*HostProfileSerializedHostProfileSpec)(nil)).Elem() } +type HostProfileValidationFailureInfo struct { + DynamicData + + Name string `xml:"name"` + Annotation string `xml:"annotation"` + UpdateType string `xml:"updateType"` + Host *ManagedObjectReference `xml:"host,omitempty"` + ApplyProfile *HostApplyProfile `xml:"applyProfile,omitempty"` + Failures []ProfileUpdateFailedUpdateFailure `xml:"failures,omitempty"` + Faults []LocalizedMethodFault `xml:"faults,omitempty"` +} + +func init() { + t["HostProfileValidationFailureInfo"] = reflect.TypeOf((*HostProfileValidationFailureInfo)(nil)).Elem() +} + type HostProfilesEntityCustomizations struct { DynamicData } @@ -23127,12 +24436,75 @@ func init() { t["HostResignatureRescanResult"] = reflect.TypeOf((*HostResignatureRescanResult)(nil)).Elem() } +type HostRetrieveVStorageInfrastructureObjectPolicy HostRetrieveVStorageInfrastructureObjectPolicyRequestType + +func init() { + t["HostRetrieveVStorageInfrastructureObjectPolicy"] = reflect.TypeOf((*HostRetrieveVStorageInfrastructureObjectPolicy)(nil)).Elem() +} + +type HostRetrieveVStorageInfrastructureObjectPolicyRequestType struct { + This ManagedObjectReference `xml:"_this"` + Datastore ManagedObjectReference `xml:"datastore"` +} + +func init() { + t["HostRetrieveVStorageInfrastructureObjectPolicyRequestType"] = reflect.TypeOf((*HostRetrieveVStorageInfrastructureObjectPolicyRequestType)(nil)).Elem() +} + +type HostRetrieveVStorageInfrastructureObjectPolicyResponse struct { + Returnval []VslmInfrastructureObjectPolicy `xml:"returnval,omitempty"` +} + type HostRetrieveVStorageObject HostRetrieveVStorageObjectRequestType func init() { t["HostRetrieveVStorageObject"] = reflect.TypeOf((*HostRetrieveVStorageObject)(nil)).Elem() } +type HostRetrieveVStorageObjectMetadata HostRetrieveVStorageObjectMetadataRequestType + +func init() { + t["HostRetrieveVStorageObjectMetadata"] = reflect.TypeOf((*HostRetrieveVStorageObjectMetadata)(nil)).Elem() +} + +type HostRetrieveVStorageObjectMetadataRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId *ID `xml:"snapshotId,omitempty"` + Prefix string `xml:"prefix,omitempty"` +} + +func init() { + t["HostRetrieveVStorageObjectMetadataRequestType"] = reflect.TypeOf((*HostRetrieveVStorageObjectMetadataRequestType)(nil)).Elem() +} + +type HostRetrieveVStorageObjectMetadataResponse struct { + Returnval []KeyValue `xml:"returnval,omitempty"` +} + +type HostRetrieveVStorageObjectMetadataValue HostRetrieveVStorageObjectMetadataValueRequestType + +func init() { + t["HostRetrieveVStorageObjectMetadataValue"] = reflect.TypeOf((*HostRetrieveVStorageObjectMetadataValue)(nil)).Elem() +} + +type HostRetrieveVStorageObjectMetadataValueRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId *ID `xml:"snapshotId,omitempty"` + Key string `xml:"key"` +} + +func init() { + t["HostRetrieveVStorageObjectMetadataValueRequestType"] = reflect.TypeOf((*HostRetrieveVStorageObjectMetadataValueRequestType)(nil)).Elem() +} + +type HostRetrieveVStorageObjectMetadataValueResponse struct { + Returnval string `xml:"returnval"` +} + type HostRetrieveVStorageObjectRequestType struct { This ManagedObjectReference `xml:"_this"` Id ID `xml:"id"` @@ -23403,6 +24775,40 @@ func init() { t["HostServiceTicket"] = reflect.TypeOf((*HostServiceTicket)(nil)).Elem() } +type HostSetVStorageObjectControlFlags HostSetVStorageObjectControlFlagsRequestType + +func init() { + t["HostSetVStorageObjectControlFlags"] = reflect.TypeOf((*HostSetVStorageObjectControlFlags)(nil)).Elem() +} + +type HostSetVStorageObjectControlFlagsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + ControlFlags []string `xml:"controlFlags,omitempty"` +} + +func init() { + t["HostSetVStorageObjectControlFlagsRequestType"] = reflect.TypeOf((*HostSetVStorageObjectControlFlagsRequestType)(nil)).Elem() +} + +type HostSetVStorageObjectControlFlagsResponse struct { +} + +type HostSharedGpuCapabilities struct { + DynamicData + + Vgpu string `xml:"vgpu"` + DiskSnapshotSupported bool `xml:"diskSnapshotSupported"` + MemorySnapshotSupported bool `xml:"memorySnapshotSupported"` + SuspendSupported bool `xml:"suspendSupported"` + MigrateSupported bool `xml:"migrateSupported"` +} + +func init() { + t["HostSharedGpuCapabilities"] = reflect.TypeOf((*HostSharedGpuCapabilities)(nil)).Elem() +} + type HostShortNameInconsistentEvent struct { HostDasEvent @@ -23508,6 +24914,14 @@ func init() { t["HostSpecification"] = reflect.TypeOf((*HostSpecification)(nil)).Elem() } +type HostSpecificationChangedEvent struct { + HostEvent +} + +func init() { + t["HostSpecificationChangedEvent"] = reflect.TypeOf((*HostSpecificationChangedEvent)(nil)).Elem() +} + type HostSpecificationOperationFailed struct { VimFault @@ -23524,6 +24938,24 @@ func init() { t["HostSpecificationOperationFailedFault"] = reflect.TypeOf((*HostSpecificationOperationFailedFault)(nil)).Elem() } +type HostSpecificationRequireEvent struct { + HostEvent +} + +func init() { + t["HostSpecificationRequireEvent"] = reflect.TypeOf((*HostSpecificationRequireEvent)(nil)).Elem() +} + +type HostSpecificationUpdateEvent struct { + HostEvent + + HostSpec HostSpecification `xml:"hostSpec"` +} + +func init() { + t["HostSpecificationUpdateEvent"] = reflect.TypeOf((*HostSpecificationUpdateEvent)(nil)).Elem() +} + type HostSriovConfig struct { HostPciPassthruConfig @@ -23677,12 +25109,33 @@ type HostSubSpecification struct { Name string `xml:"name"` CreatedTime time.Time `xml:"createdTime"` Data []byte `xml:"data,omitempty"` + BinaryData []byte `xml:"binaryData,omitempty"` } func init() { t["HostSubSpecification"] = reflect.TypeOf((*HostSubSpecification)(nil)).Elem() } +type HostSubSpecificationDeleteEvent struct { + HostEvent + + SubSpecName string `xml:"subSpecName"` +} + +func init() { + t["HostSubSpecificationDeleteEvent"] = reflect.TypeOf((*HostSubSpecificationDeleteEvent)(nil)).Elem() +} + +type HostSubSpecificationUpdateEvent struct { + HostEvent + + HostSubSpec HostSubSpecification `xml:"hostSubSpec"` +} + +func init() { + t["HostSubSpecificationUpdateEvent"] = reflect.TypeOf((*HostSubSpecificationUpdateEvent)(nil)).Elem() +} + type HostSyncFailedEvent struct { HostEvent @@ -23693,6 +25146,17 @@ func init() { t["HostSyncFailedEvent"] = reflect.TypeOf((*HostSyncFailedEvent)(nil)).Elem() } +type HostSystemComplianceCheckState struct { + DynamicData + + State string `xml:"state"` + CheckTime time.Time `xml:"checkTime"` +} + +func init() { + t["HostSystemComplianceCheckState"] = reflect.TypeOf((*HostSystemComplianceCheckState)(nil)).Elem() +} + type HostSystemHealthInfo struct { DynamicData @@ -23721,6 +25185,7 @@ type HostSystemInfo struct { Model string `xml:"model"` Uuid string `xml:"uuid"` OtherIdentifyingInfo []HostSystemIdentificationInfo `xml:"otherIdentifyingInfo,omitempty"` + SerialNumber string `xml:"serialNumber,omitempty"` } func init() { @@ -23737,6 +25202,17 @@ func init() { t["HostSystemReconnectSpec"] = reflect.TypeOf((*HostSystemReconnectSpec)(nil)).Elem() } +type HostSystemRemediationState struct { + DynamicData + + State string `xml:"state"` + OperationTime time.Time `xml:"operationTime"` +} + +func init() { + t["HostSystemRemediationState"] = reflect.TypeOf((*HostSystemRemediationState)(nil)).Elem() +} + type HostSystemResourceInfo struct { DynamicData @@ -23811,6 +25287,18 @@ func init() { t["HostTargetTransport"] = reflect.TypeOf((*HostTargetTransport)(nil)).Elem() } +type HostTpmAttestationInfo struct { + DynamicData + + Time time.Time `xml:"time"` + Status HostTpmAttestationInfoAcceptanceStatus `xml:"status"` + Message *LocalizableMessage `xml:"message,omitempty"` +} + +func init() { + t["HostTpmAttestationInfo"] = reflect.TypeOf((*HostTpmAttestationInfo)(nil)).Elem() +} + type HostTpmAttestationReport struct { DynamicData @@ -23856,7 +25344,8 @@ func init() { type HostTpmEventDetails struct { DynamicData - DataHash []byte `xml:"dataHash"` + DataHash []byte `xml:"dataHash"` + DataHashMethod string `xml:"dataHashMethod,omitempty"` } func init() { @@ -23974,6 +25463,28 @@ func init() { t["HostUnresolvedVmfsVolumeResolveStatus"] = reflect.TypeOf((*HostUnresolvedVmfsVolumeResolveStatus)(nil)).Elem() } +type HostUpdateVStorageObjectMetadataRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + Metadata []KeyValue `xml:"metadata,omitempty"` + DeleteKeys []string `xml:"deleteKeys,omitempty"` +} + +func init() { + t["HostUpdateVStorageObjectMetadataRequestType"] = reflect.TypeOf((*HostUpdateVStorageObjectMetadataRequestType)(nil)).Elem() +} + +type HostUpdateVStorageObjectMetadata_Task HostUpdateVStorageObjectMetadataRequestType + +func init() { + t["HostUpdateVStorageObjectMetadata_Task"] = reflect.TypeOf((*HostUpdateVStorageObjectMetadata_Task)(nil)).Elem() +} + +type HostUpdateVStorageObjectMetadata_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type HostUpgradeFailedEvent struct { HostEvent } @@ -24132,6 +25643,114 @@ func init() { t["HostVMotionNetConfig"] = reflect.TypeOf((*HostVMotionNetConfig)(nil)).Elem() } +type HostVStorageObjectCreateDiskFromSnapshotRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId ID `xml:"snapshotId"` + Name string `xml:"name"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` + Crypto BaseCryptoSpec `xml:"crypto,omitempty,typeattr"` + Path string `xml:"path,omitempty"` +} + +func init() { + t["HostVStorageObjectCreateDiskFromSnapshotRequestType"] = reflect.TypeOf((*HostVStorageObjectCreateDiskFromSnapshotRequestType)(nil)).Elem() +} + +type HostVStorageObjectCreateDiskFromSnapshot_Task HostVStorageObjectCreateDiskFromSnapshotRequestType + +func init() { + t["HostVStorageObjectCreateDiskFromSnapshot_Task"] = reflect.TypeOf((*HostVStorageObjectCreateDiskFromSnapshot_Task)(nil)).Elem() +} + +type HostVStorageObjectCreateDiskFromSnapshot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type HostVStorageObjectCreateSnapshotRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + Description string `xml:"description"` +} + +func init() { + t["HostVStorageObjectCreateSnapshotRequestType"] = reflect.TypeOf((*HostVStorageObjectCreateSnapshotRequestType)(nil)).Elem() +} + +type HostVStorageObjectCreateSnapshot_Task HostVStorageObjectCreateSnapshotRequestType + +func init() { + t["HostVStorageObjectCreateSnapshot_Task"] = reflect.TypeOf((*HostVStorageObjectCreateSnapshot_Task)(nil)).Elem() +} + +type HostVStorageObjectCreateSnapshot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type HostVStorageObjectDeleteSnapshotRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId ID `xml:"snapshotId"` +} + +func init() { + t["HostVStorageObjectDeleteSnapshotRequestType"] = reflect.TypeOf((*HostVStorageObjectDeleteSnapshotRequestType)(nil)).Elem() +} + +type HostVStorageObjectDeleteSnapshot_Task HostVStorageObjectDeleteSnapshotRequestType + +func init() { + t["HostVStorageObjectDeleteSnapshot_Task"] = reflect.TypeOf((*HostVStorageObjectDeleteSnapshot_Task)(nil)).Elem() +} + +type HostVStorageObjectDeleteSnapshot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type HostVStorageObjectRetrieveSnapshotInfo HostVStorageObjectRetrieveSnapshotInfoRequestType + +func init() { + t["HostVStorageObjectRetrieveSnapshotInfo"] = reflect.TypeOf((*HostVStorageObjectRetrieveSnapshotInfo)(nil)).Elem() +} + +type HostVStorageObjectRetrieveSnapshotInfoRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` +} + +func init() { + t["HostVStorageObjectRetrieveSnapshotInfoRequestType"] = reflect.TypeOf((*HostVStorageObjectRetrieveSnapshotInfoRequestType)(nil)).Elem() +} + +type HostVStorageObjectRetrieveSnapshotInfoResponse struct { + Returnval VStorageObjectSnapshotInfo `xml:"returnval"` +} + +type HostVStorageObjectRevertRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId ID `xml:"snapshotId"` +} + +func init() { + t["HostVStorageObjectRevertRequestType"] = reflect.TypeOf((*HostVStorageObjectRevertRequestType)(nil)).Elem() +} + +type HostVStorageObjectRevert_Task HostVStorageObjectRevertRequestType + +func init() { + t["HostVStorageObjectRevert_Task"] = reflect.TypeOf((*HostVStorageObjectRevert_Task)(nil)).Elem() +} + +type HostVStorageObjectRevert_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type HostVfatVolume struct { HostFileSystemVolume } @@ -24198,6 +25817,7 @@ type HostVirtualNicConnection struct { Portgroup string `xml:"portgroup,omitempty"` DvPort *DistributedVirtualSwitchPortConnection `xml:"dvPort,omitempty"` + OpNetwork *HostVirtualNicOpaqueNetworkSpec `xml:"opNetwork,omitempty"` } func init() { @@ -24384,13 +26004,14 @@ func init() { type HostVmfsSpec struct { DynamicData - Extent HostScsiDiskPartition `xml:"extent"` - BlockSizeMb int32 `xml:"blockSizeMb,omitempty"` - MajorVersion int32 `xml:"majorVersion"` - VolumeName string `xml:"volumeName"` - BlockSize int32 `xml:"blockSize,omitempty"` - UnmapGranularity int32 `xml:"unmapGranularity,omitempty"` - UnmapPriority string `xml:"unmapPriority,omitempty"` + Extent HostScsiDiskPartition `xml:"extent"` + BlockSizeMb int32 `xml:"blockSizeMb,omitempty"` + MajorVersion int32 `xml:"majorVersion"` + VolumeName string `xml:"volumeName"` + BlockSize int32 `xml:"blockSize,omitempty"` + UnmapGranularity int32 `xml:"unmapGranularity,omitempty"` + UnmapPriority string `xml:"unmapPriority,omitempty"` + UnmapBandwidthSpec *VmfsUnmapBandwidthSpec `xml:"unmapBandwidthSpec,omitempty"` } func init() { @@ -24400,20 +26021,21 @@ func init() { type HostVmfsVolume struct { HostFileSystemVolume - BlockSizeMb int32 `xml:"blockSizeMb"` - BlockSize int32 `xml:"blockSize,omitempty"` - UnmapGranularity int32 `xml:"unmapGranularity,omitempty"` - UnmapPriority string `xml:"unmapPriority,omitempty"` - MaxBlocks int32 `xml:"maxBlocks"` - MajorVersion int32 `xml:"majorVersion"` - Version string `xml:"version"` - Uuid string `xml:"uuid"` - Extent []HostScsiDiskPartition `xml:"extent"` - VmfsUpgradable bool `xml:"vmfsUpgradable"` - ForceMountedInfo *HostForceMountedInfo `xml:"forceMountedInfo,omitempty"` - Ssd *bool `xml:"ssd"` - Local *bool `xml:"local"` - ScsiDiskType string `xml:"scsiDiskType,omitempty"` + BlockSizeMb int32 `xml:"blockSizeMb"` + BlockSize int32 `xml:"blockSize,omitempty"` + UnmapGranularity int32 `xml:"unmapGranularity,omitempty"` + UnmapPriority string `xml:"unmapPriority,omitempty"` + UnmapBandwidthSpec *VmfsUnmapBandwidthSpec `xml:"unmapBandwidthSpec,omitempty"` + MaxBlocks int32 `xml:"maxBlocks"` + MajorVersion int32 `xml:"majorVersion"` + Version string `xml:"version"` + Uuid string `xml:"uuid"` + Extent []HostScsiDiskPartition `xml:"extent"` + VmfsUpgradable bool `xml:"vmfsUpgradable"` + ForceMountedInfo *HostForceMountedInfo `xml:"forceMountedInfo,omitempty"` + Ssd *bool `xml:"ssd"` + Local *bool `xml:"local"` + ScsiDiskType string `xml:"scsiDiskType,omitempty"` } func init() { @@ -24554,6 +26176,23 @@ func init() { t["HourlyTaskScheduler"] = reflect.TypeOf((*HourlyTaskScheduler)(nil)).Elem() } +type HttpFault struct { + VimFault + + StatusCode int32 `xml:"statusCode"` + StatusMessage string `xml:"statusMessage"` +} + +func init() { + t["HttpFault"] = reflect.TypeOf((*HttpFault)(nil)).Elem() +} + +type HttpFaultFault HttpFault + +func init() { + t["HttpFaultFault"] = reflect.TypeOf((*HttpFaultFault)(nil)).Elem() +} + type HttpNfcLeaseAbort HttpNfcLeaseAbortRequestType func init() { @@ -24572,6 +26211,17 @@ func init() { type HttpNfcLeaseAbortResponse struct { } +type HttpNfcLeaseCapabilities struct { + DynamicData + + PullModeSupported bool `xml:"pullModeSupported"` + CorsSupported bool `xml:"corsSupported"` +} + +func init() { + t["HttpNfcLeaseCapabilities"] = reflect.TypeOf((*HttpNfcLeaseCapabilities)(nil)).Elem() +} + type HttpNfcLeaseComplete HttpNfcLeaseCompleteRequestType func init() { @@ -24666,6 +26316,8 @@ type HttpNfcLeaseManifestEntry struct { Key string `xml:"key"` Sha1 string `xml:"sha1"` + Checksum string `xml:"checksum,omitempty"` + ChecksumType string `xml:"checksumType,omitempty"` Size int64 `xml:"size"` Disk bool `xml:"disk"` Capacity int64 `xml:"capacity,omitempty"` @@ -24694,6 +26346,59 @@ func init() { type HttpNfcLeaseProgressResponse struct { } +type HttpNfcLeasePullFromUrlsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Files []HttpNfcLeaseSourceFile `xml:"files,omitempty"` +} + +func init() { + t["HttpNfcLeasePullFromUrlsRequestType"] = reflect.TypeOf((*HttpNfcLeasePullFromUrlsRequestType)(nil)).Elem() +} + +type HttpNfcLeasePullFromUrls_Task HttpNfcLeasePullFromUrlsRequestType + +func init() { + t["HttpNfcLeasePullFromUrls_Task"] = reflect.TypeOf((*HttpNfcLeasePullFromUrls_Task)(nil)).Elem() +} + +type HttpNfcLeasePullFromUrls_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type HttpNfcLeaseSetManifestChecksumType HttpNfcLeaseSetManifestChecksumTypeRequestType + +func init() { + t["HttpNfcLeaseSetManifestChecksumType"] = reflect.TypeOf((*HttpNfcLeaseSetManifestChecksumType)(nil)).Elem() +} + +type HttpNfcLeaseSetManifestChecksumTypeRequestType struct { + This ManagedObjectReference `xml:"_this"` + DeviceUrlsToChecksumTypes []KeyValue `xml:"deviceUrlsToChecksumTypes,omitempty"` +} + +func init() { + t["HttpNfcLeaseSetManifestChecksumTypeRequestType"] = reflect.TypeOf((*HttpNfcLeaseSetManifestChecksumTypeRequestType)(nil)).Elem() +} + +type HttpNfcLeaseSetManifestChecksumTypeResponse struct { +} + +type HttpNfcLeaseSourceFile struct { + DynamicData + + TargetDeviceId string `xml:"targetDeviceId"` + Url string `xml:"url"` + MemberName string `xml:"memberName,omitempty"` + Create bool `xml:"create"` + SslThumbprint string `xml:"sslThumbprint,omitempty"` + HttpHeaders []KeyValue `xml:"httpHeaders,omitempty"` + Size int64 `xml:"size,omitempty"` +} + +func init() { + t["HttpNfcLeaseSourceFile"] = reflect.TypeOf((*HttpNfcLeaseSourceFile)(nil)).Elem() +} + type ID struct { DynamicData @@ -25278,6 +26983,25 @@ func init() { type InstallSmartCardTrustAnchorResponse struct { } +type InstantCloneRequestType struct { + This ManagedObjectReference `xml:"_this"` + Spec VirtualMachineInstantCloneSpec `xml:"spec"` +} + +func init() { + t["InstantCloneRequestType"] = reflect.TypeOf((*InstantCloneRequestType)(nil)).Elem() +} + +type InstantClone_Task InstantCloneRequestType + +func init() { + t["InstantClone_Task"] = reflect.TypeOf((*InstantClone_Task)(nil)).Elem() +} + +type InstantClone_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type InsufficientAgentVmsDeployed struct { InsufficientResourcesFault @@ -26983,6 +28707,22 @@ func init() { t["KeyAnyValue"] = reflect.TypeOf((*KeyAnyValue)(nil)).Elem() } +type KeyNotFound struct { + VimFault + + Key string `xml:"key"` +} + +func init() { + t["KeyNotFound"] = reflect.TypeOf((*KeyNotFound)(nil)).Elem() +} + +type KeyNotFoundFault KeyNotFound + +func init() { + t["KeyNotFoundFault"] = reflect.TypeOf((*KeyNotFoundFault)(nil)).Elem() +} + type KeyProviderId struct { DynamicData @@ -27456,7 +29196,7 @@ type LimitExceeded struct { VimFault Property string `xml:"property,omitempty"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -27624,7 +29364,7 @@ func init() { type ListKeysRequestType struct { This ManagedObjectReference `xml:"_this"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -27643,7 +29383,7 @@ func init() { type ListKmipServersRequestType struct { This ManagedObjectReference `xml:"_this"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -28395,6 +30135,45 @@ func init() { type MarkForRemovalResponse struct { } +type MarkPerenniallyReserved MarkPerenniallyReservedRequestType + +func init() { + t["MarkPerenniallyReserved"] = reflect.TypeOf((*MarkPerenniallyReserved)(nil)).Elem() +} + +type MarkPerenniallyReservedExRequestType struct { + This ManagedObjectReference `xml:"_this"` + LunUuid []string `xml:"lunUuid,omitempty"` + State bool `xml:"state"` +} + +func init() { + t["MarkPerenniallyReservedExRequestType"] = reflect.TypeOf((*MarkPerenniallyReservedExRequestType)(nil)).Elem() +} + +type MarkPerenniallyReservedEx_Task MarkPerenniallyReservedExRequestType + +func init() { + t["MarkPerenniallyReservedEx_Task"] = reflect.TypeOf((*MarkPerenniallyReservedEx_Task)(nil)).Elem() +} + +type MarkPerenniallyReservedEx_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type MarkPerenniallyReservedRequestType struct { + This ManagedObjectReference `xml:"_this"` + LunUuid string `xml:"lunUuid"` + State bool `xml:"state"` +} + +func init() { + t["MarkPerenniallyReservedRequestType"] = reflect.TypeOf((*MarkPerenniallyReservedRequestType)(nil)).Elem() +} + +type MarkPerenniallyReservedResponse struct { +} + type MemoryFileFormatNotSupportedByDatastore struct { UnsupportedDatastore @@ -29452,7 +31231,7 @@ func init() { type NamespaceLimitReached struct { VimFault - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` } func init() { @@ -29904,6 +31683,7 @@ type NetworkProfile struct { Dvswitch []DvsProfile `xml:"dvswitch,omitempty"` DvsServiceConsoleNic []DvsServiceConsoleVNicProfile `xml:"dvsServiceConsoleNic,omitempty"` DvsHostNic []DvsHostVNicProfile `xml:"dvsHostNic,omitempty"` + NsxHostNic []NsxHostVNicProfile `xml:"nsxHostNic,omitempty"` NetStackInstance []NetStackInstanceProfile `xml:"netStackInstance,omitempty"` } @@ -29936,7 +31716,7 @@ type NetworkSummary struct { Network *ManagedObjectReference `xml:"network,omitempty"` Name string `xml:"name"` Accessible bool `xml:"accessible"` - IpPoolName string `xml:"ipPoolName,omitempty"` + IpPoolName string `xml:"ipPoolName"` IpPoolId int32 `xml:"ipPoolId,omitempty"` } @@ -30814,6 +32594,17 @@ func init() { t["NotUserConfigurablePropertyFault"] = reflect.TypeOf((*NotUserConfigurablePropertyFault)(nil)).Elem() } +type NsxHostVNicProfile struct { + ApplyProfile + + Key string `xml:"key"` + IpConfig IpAddressProfile `xml:"ipConfig"` +} + +func init() { + t["NsxHostVNicProfile"] = reflect.TypeOf((*NsxHostVNicProfile)(nil)).Elem() +} + type NumPortsProfile struct { ApplyProfile } @@ -30900,6 +32691,189 @@ func init() { t["NumericRange"] = reflect.TypeOf((*NumericRange)(nil)).Elem() } +type NvdimmDimmInfo struct { + DynamicData + + DimmHandle int32 `xml:"dimmHandle"` + HealthInfo NvdimmHealthInfo `xml:"healthInfo"` + TotalCapacity int64 `xml:"totalCapacity"` + PersistentCapacity int64 `xml:"persistentCapacity"` + AvailablePersistentCapacity int64 `xml:"availablePersistentCapacity"` + VolatileCapacity int64 `xml:"volatileCapacity"` + AvailableVolatileCapacity int64 `xml:"availableVolatileCapacity"` + BlockCapacity int64 `xml:"blockCapacity"` + RegionInfo []NvdimmRegionInfo `xml:"regionInfo,omitempty"` + RepresentationString string `xml:"representationString"` +} + +func init() { + t["NvdimmDimmInfo"] = reflect.TypeOf((*NvdimmDimmInfo)(nil)).Elem() +} + +type NvdimmGuid struct { + DynamicData + + Uuid string `xml:"uuid"` +} + +func init() { + t["NvdimmGuid"] = reflect.TypeOf((*NvdimmGuid)(nil)).Elem() +} + +type NvdimmHealthInfo struct { + DynamicData + + HealthStatus string `xml:"healthStatus"` + HealthInformation string `xml:"healthInformation"` + StateFlagInfo []string `xml:"stateFlagInfo,omitempty"` + DimmTemperature int32 `xml:"dimmTemperature"` + DimmTemperatureThreshold int32 `xml:"dimmTemperatureThreshold"` + SpareBlocksPercentage int32 `xml:"spareBlocksPercentage"` + SpareBlockThreshold int32 `xml:"spareBlockThreshold"` + DimmLifespanPercentage int32 `xml:"dimmLifespanPercentage"` + EsTemperature int32 `xml:"esTemperature,omitempty"` + EsTemperatureThreshold int32 `xml:"esTemperatureThreshold,omitempty"` + EsLifespanPercentage int32 `xml:"esLifespanPercentage,omitempty"` +} + +func init() { + t["NvdimmHealthInfo"] = reflect.TypeOf((*NvdimmHealthInfo)(nil)).Elem() +} + +type NvdimmInterleaveSetInfo struct { + DynamicData + + SetId int32 `xml:"setId"` + RangeType string `xml:"rangeType"` + BaseAddress int64 `xml:"baseAddress"` + Size int64 `xml:"size"` + AvailableSize int64 `xml:"availableSize"` + DeviceList []int32 `xml:"deviceList,omitempty"` + State string `xml:"state"` +} + +func init() { + t["NvdimmInterleaveSetInfo"] = reflect.TypeOf((*NvdimmInterleaveSetInfo)(nil)).Elem() +} + +type NvdimmNamespaceCreateSpec struct { + DynamicData + + FriendlyName string `xml:"friendlyName,omitempty"` + BlockSize int64 `xml:"blockSize"` + BlockCount int64 `xml:"blockCount"` + Type string `xml:"type"` + LocationID int32 `xml:"locationID"` +} + +func init() { + t["NvdimmNamespaceCreateSpec"] = reflect.TypeOf((*NvdimmNamespaceCreateSpec)(nil)).Elem() +} + +type NvdimmNamespaceDeleteSpec struct { + DynamicData + + Uuid string `xml:"uuid"` +} + +func init() { + t["NvdimmNamespaceDeleteSpec"] = reflect.TypeOf((*NvdimmNamespaceDeleteSpec)(nil)).Elem() +} + +type NvdimmNamespaceDetails struct { + DynamicData + + Uuid string `xml:"uuid"` + FriendlyName string `xml:"friendlyName"` + Size int64 `xml:"size"` + Type string `xml:"type"` + NamespaceHealthStatus string `xml:"namespaceHealthStatus"` + InterleavesetID int32 `xml:"interleavesetID"` + State string `xml:"state"` +} + +func init() { + t["NvdimmNamespaceDetails"] = reflect.TypeOf((*NvdimmNamespaceDetails)(nil)).Elem() +} + +type NvdimmNamespaceInfo struct { + DynamicData + + Uuid string `xml:"uuid"` + FriendlyName string `xml:"friendlyName"` + BlockSize int64 `xml:"blockSize"` + BlockCount int64 `xml:"blockCount"` + Type string `xml:"type"` + NamespaceHealthStatus string `xml:"namespaceHealthStatus"` + LocationID int32 `xml:"locationID"` + State string `xml:"state"` +} + +func init() { + t["NvdimmNamespaceInfo"] = reflect.TypeOf((*NvdimmNamespaceInfo)(nil)).Elem() +} + +type NvdimmPMemNamespaceCreateSpec struct { + DynamicData + + FriendlyName string `xml:"friendlyName,omitempty"` + Size int64 `xml:"size"` + InterleavesetID int32 `xml:"interleavesetID"` +} + +func init() { + t["NvdimmPMemNamespaceCreateSpec"] = reflect.TypeOf((*NvdimmPMemNamespaceCreateSpec)(nil)).Elem() +} + +type NvdimmRegionInfo struct { + DynamicData + + RegionId int32 `xml:"regionId"` + SetId int32 `xml:"setId"` + RangeType string `xml:"rangeType"` + StartAddr int64 `xml:"startAddr"` + Size int64 `xml:"size"` + Offset int64 `xml:"offset"` +} + +func init() { + t["NvdimmRegionInfo"] = reflect.TypeOf((*NvdimmRegionInfo)(nil)).Elem() +} + +type NvdimmSummary struct { + DynamicData + + NumDimms int32 `xml:"numDimms"` + HealthStatus string `xml:"healthStatus"` + TotalCapacity int64 `xml:"totalCapacity"` + PersistentCapacity int64 `xml:"persistentCapacity"` + BlockCapacity int64 `xml:"blockCapacity"` + AvailableCapacity int64 `xml:"availableCapacity"` + NumInterleavesets int32 `xml:"numInterleavesets"` + NumNamespaces int32 `xml:"numNamespaces"` +} + +func init() { + t["NvdimmSummary"] = reflect.TypeOf((*NvdimmSummary)(nil)).Elem() +} + +type NvdimmSystemInfo struct { + DynamicData + + Summary *NvdimmSummary `xml:"summary,omitempty"` + Dimms []int32 `xml:"dimms,omitempty"` + DimmInfo []NvdimmDimmInfo `xml:"dimmInfo,omitempty"` + InterleaveSet []int32 `xml:"interleaveSet,omitempty"` + ISetInfo []NvdimmInterleaveSetInfo `xml:"iSetInfo,omitempty"` + Namespace []NvdimmGuid `xml:"namespace,omitempty"` + NsInfo []NvdimmNamespaceInfo `xml:"nsInfo,omitempty"` + NsDetails []NvdimmNamespaceDetails `xml:"nsDetails,omitempty"` +} + +func init() { + t["NvdimmSystemInfo"] = reflect.TypeOf((*NvdimmSystemInfo)(nil)).Elem() +} + type ObjectContent struct { DynamicData @@ -32640,6 +34614,16 @@ func init() { t["OvfXmlFormatFault"] = reflect.TypeOf((*OvfXmlFormatFault)(nil)).Elem() } +type PMemDatastoreInfo struct { + DatastoreInfo + + Pmem HostPMemVolume `xml:"pmem"` +} + +func init() { + t["PMemDatastoreInfo"] = reflect.TypeOf((*PMemDatastoreInfo)(nil)).Elem() +} + type ParaVirtualSCSIController struct { VirtualSCSIController } @@ -32696,6 +34680,20 @@ func init() { t["PassiveNodeNetworkSpec"] = reflect.TypeOf((*PassiveNodeNetworkSpec)(nil)).Elem() } +type PasswordExpired struct { + InvalidLogin +} + +func init() { + t["PasswordExpired"] = reflect.TypeOf((*PasswordExpired)(nil)).Elem() +} + +type PasswordExpiredFault PasswordExpired + +func init() { + t["PasswordExpiredFault"] = reflect.TypeOf((*PasswordExpiredFault)(nil)).Elem() +} + type PasswordField struct { DynamicData @@ -33214,6 +35212,7 @@ type PhysicalNic struct { ResourcePoolSchedulerAllowed *bool `xml:"resourcePoolSchedulerAllowed"` ResourcePoolSchedulerDisallowedReason []string `xml:"resourcePoolSchedulerDisallowedReason,omitempty"` AutoNegotiateSupported *bool `xml:"autoNegotiateSupported"` + EnhancedNetworkingStackSupported *bool `xml:"enhancedNetworkingStackSupported"` } func init() { @@ -33343,8 +35342,9 @@ func init() { type PhysicalNicSpec struct { DynamicData - Ip *HostIpConfig `xml:"ip,omitempty"` - LinkSpeed *PhysicalNicLinkInfo `xml:"linkSpeed,omitempty"` + Ip *HostIpConfig `xml:"ip,omitempty"` + LinkSpeed *PhysicalNicLinkInfo `xml:"linkSpeed,omitempty"` + EnableEnhancedNetworkingStack *bool `xml:"enableEnhancedNetworkingStack"` } func init() { @@ -34031,18 +36031,30 @@ func init() { type ProfileMetadata struct { DynamicData - Key string `xml:"key"` - ProfileTypeName string `xml:"profileTypeName,omitempty"` - Description *ExtendedDescription `xml:"description,omitempty"` - SortSpec []ProfileMetadataProfileSortSpec `xml:"sortSpec,omitempty"` - ProfileCategory string `xml:"profileCategory,omitempty"` - ProfileComponent string `xml:"profileComponent,omitempty"` + Key string `xml:"key"` + ProfileTypeName string `xml:"profileTypeName,omitempty"` + Description *ExtendedDescription `xml:"description,omitempty"` + SortSpec []ProfileMetadataProfileSortSpec `xml:"sortSpec,omitempty"` + ProfileCategory string `xml:"profileCategory,omitempty"` + ProfileComponent string `xml:"profileComponent,omitempty"` + OperationMessages []ProfileMetadataProfileOperationMessage `xml:"operationMessages,omitempty"` } func init() { t["ProfileMetadata"] = reflect.TypeOf((*ProfileMetadata)(nil)).Elem() } +type ProfileMetadataProfileOperationMessage struct { + DynamicData + + OperationName string `xml:"operationName"` + Message LocalizableMessage `xml:"message"` +} + +func init() { + t["ProfileMetadataProfileOperationMessage"] = reflect.TypeOf((*ProfileMetadataProfileOperationMessage)(nil)).Elem() +} + type ProfileMetadataProfileSortSpec struct { DynamicData @@ -34057,19 +36069,34 @@ func init() { type ProfileParameterMetadata struct { DynamicData - Id ExtendedElementDescription `xml:"id"` - Type string `xml:"type"` - Optional bool `xml:"optional"` - DefaultValue AnyType `xml:"defaultValue,omitempty,typeattr"` - Hidden *bool `xml:"hidden"` - SecuritySensitive *bool `xml:"securitySensitive"` - ReadOnly *bool `xml:"readOnly"` + Id ExtendedElementDescription `xml:"id"` + Type string `xml:"type"` + Optional bool `xml:"optional"` + DefaultValue AnyType `xml:"defaultValue,omitempty,typeattr"` + Hidden *bool `xml:"hidden"` + SecuritySensitive *bool `xml:"securitySensitive"` + ReadOnly *bool `xml:"readOnly"` + ParameterRelations []ProfileParameterMetadataParameterRelationMetadata `xml:"parameterRelations,omitempty"` } func init() { t["ProfileParameterMetadata"] = reflect.TypeOf((*ProfileParameterMetadata)(nil)).Elem() } +type ProfileParameterMetadataParameterRelationMetadata struct { + DynamicData + + RelationTypes []string `xml:"relationTypes,omitempty"` + Values []AnyType `xml:"values,omitempty,typeattr"` + Path *ProfilePropertyPath `xml:"path,omitempty"` + MinCount int32 `xml:"minCount"` + MaxCount int32 `xml:"maxCount"` +} + +func init() { + t["ProfileParameterMetadataParameterRelationMetadata"] = reflect.TypeOf((*ProfileParameterMetadataParameterRelationMetadata)(nil)).Elem() +} + type ProfilePolicy struct { DynamicData @@ -34129,9 +36156,10 @@ func init() { type ProfilePropertyPath struct { DynamicData - ProfilePath string `xml:"profilePath"` - PolicyId string `xml:"policyId,omitempty"` - ParameterId string `xml:"parameterId,omitempty"` + ProfilePath string `xml:"profilePath"` + PolicyId string `xml:"policyId,omitempty"` + ParameterId string `xml:"parameterId,omitempty"` + PolicyOptionId string `xml:"policyOptionId,omitempty"` } func init() { @@ -34182,7 +36210,8 @@ func init() { type ProfileUpdateFailed struct { VimFault - Failure []ProfileUpdateFailedUpdateFailure `xml:"failure"` + Failure []ProfileUpdateFailedUpdateFailure `xml:"failure"` + Warnings []ProfileUpdateFailedUpdateFailure `xml:"warnings,omitempty"` } func init() { @@ -34231,7 +36260,7 @@ type PropertyChange struct { Name string `xml:"name"` Op PropertyChangeOp `xml:"op"` - Val AnyType `xml:"val,omitempty,typeattr"` + Val AnyType `xml:"val,typeattr"` } func init() { @@ -34345,7 +36374,7 @@ func init() { } type QueryAssignedLicensesResponse struct { - Returnval []LicenseAssignmentManagerLicenseAssignment `xml:"returnval"` + Returnval []LicenseAssignmentManagerLicenseAssignment `xml:"returnval,omitempty"` } type QueryAvailableDisksForVmfs QueryAvailableDisksForVmfsRequestType @@ -34759,6 +36788,26 @@ type QueryConnectionInfoViaSpecResponse struct { Returnval HostConnectInfo `xml:"returnval"` } +type QueryCryptoKeyStatus QueryCryptoKeyStatusRequestType + +func init() { + t["QueryCryptoKeyStatus"] = reflect.TypeOf((*QueryCryptoKeyStatus)(nil)).Elem() +} + +type QueryCryptoKeyStatusRequestType struct { + This ManagedObjectReference `xml:"_this"` + KeyIds []CryptoKeyId `xml:"keyIds,omitempty"` + CheckKeyBitMap int32 `xml:"checkKeyBitMap"` +} + +func init() { + t["QueryCryptoKeyStatusRequestType"] = reflect.TypeOf((*QueryCryptoKeyStatusRequestType)(nil)).Elem() +} + +type QueryCryptoKeyStatusResponse struct { + Returnval []CryptoManagerKmipCryptoKeyStatus `xml:"returnval,omitempty"` +} + type QueryDatastorePerformanceSummary QueryDatastorePerformanceSummaryRequestType func init() { @@ -35254,6 +37303,25 @@ type QueryHostStatusResponse struct { Returnval VsanHostClusterStatus `xml:"returnval"` } +type QueryHostsWithAttachedLun QueryHostsWithAttachedLunRequestType + +func init() { + t["QueryHostsWithAttachedLun"] = reflect.TypeOf((*QueryHostsWithAttachedLun)(nil)).Elem() +} + +type QueryHostsWithAttachedLunRequestType struct { + This ManagedObjectReference `xml:"_this"` + LunUuid string `xml:"lunUuid"` +} + +func init() { + t["QueryHostsWithAttachedLunRequestType"] = reflect.TypeOf((*QueryHostsWithAttachedLunRequestType)(nil)).Elem() +} + +type QueryHostsWithAttachedLunResponse struct { + Returnval []ManagedObjectReference `xml:"returnval,omitempty"` +} + type QueryIORMConfigOption QueryIORMConfigOptionRequestType func init() { @@ -35828,6 +37896,24 @@ type QueryPolicyMetadataResponse struct { Returnval []ProfilePolicyMetadata `xml:"returnval,omitempty"` } +type QueryProductLockerLocation QueryProductLockerLocationRequestType + +func init() { + t["QueryProductLockerLocation"] = reflect.TypeOf((*QueryProductLockerLocation)(nil)).Elem() +} + +type QueryProductLockerLocationRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["QueryProductLockerLocationRequestType"] = reflect.TypeOf((*QueryProductLockerLocationRequestType)(nil)).Elem() +} + +type QueryProductLockerLocationResponse struct { + Returnval string `xml:"returnval"` +} + type QueryProfileStructure QueryProfileStructureRequestType func init() { @@ -36332,7 +38418,7 @@ func init() { type QueryVsanObjectUuidsByFilterRequestType struct { This ManagedObjectReference `xml:"_this"` Uuids []string `xml:"uuids,omitempty"` - Limit int32 `xml:"limit,omitempty"` + Limit *int32 `xml:"limit"` Version int32 `xml:"version,omitempty"` } @@ -37403,6 +39489,25 @@ func init() { type RefreshStorageDrsRecommendationResponse struct { } +type RefreshStorageDrsRecommendationsForPodRequestType struct { + This ManagedObjectReference `xml:"_this"` + Pod ManagedObjectReference `xml:"pod"` +} + +func init() { + t["RefreshStorageDrsRecommendationsForPodRequestType"] = reflect.TypeOf((*RefreshStorageDrsRecommendationsForPodRequestType)(nil)).Elem() +} + +type RefreshStorageDrsRecommendationsForPod_Task RefreshStorageDrsRecommendationsForPodRequestType + +func init() { + t["RefreshStorageDrsRecommendationsForPod_Task"] = reflect.TypeOf((*RefreshStorageDrsRecommendationsForPod_Task)(nil)).Elem() +} + +type RefreshStorageDrsRecommendationsForPod_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type RefreshStorageInfo RefreshStorageInfoRequestType func init() { @@ -38530,16 +40635,20 @@ func init() { type ReplicationConfigSpec struct { DynamicData - Generation int64 `xml:"generation"` - VmReplicationId string `xml:"vmReplicationId"` - Destination string `xml:"destination"` - Port int32 `xml:"port"` - Rpo int64 `xml:"rpo"` - QuiesceGuestEnabled bool `xml:"quiesceGuestEnabled"` - Paused bool `xml:"paused"` - OppUpdatesEnabled bool `xml:"oppUpdatesEnabled"` - NetCompressionEnabled *bool `xml:"netCompressionEnabled"` - Disk []ReplicationInfoDiskSettings `xml:"disk,omitempty"` + Generation int64 `xml:"generation"` + VmReplicationId string `xml:"vmReplicationId"` + Destination string `xml:"destination"` + Port int32 `xml:"port"` + Rpo int64 `xml:"rpo"` + QuiesceGuestEnabled bool `xml:"quiesceGuestEnabled"` + Paused bool `xml:"paused"` + OppUpdatesEnabled bool `xml:"oppUpdatesEnabled"` + NetCompressionEnabled *bool `xml:"netCompressionEnabled"` + NetEncryptionEnabled *bool `xml:"netEncryptionEnabled"` + EncryptionDestination string `xml:"encryptionDestination,omitempty"` + EncryptionPort int32 `xml:"encryptionPort,omitempty"` + RemoteCertificateThumbprint string `xml:"remoteCertificateThumbprint,omitempty"` + Disk []ReplicationInfoDiskSettings `xml:"disk,omitempty"` } func init() { @@ -39065,11 +41174,11 @@ type ResolveMultipleUnresolvedVmfsVolumesResponse struct { type ResourceAllocationInfo struct { DynamicData - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` ExpandableReservation *bool `xml:"expandableReservation"` - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` - OverheadLimit int64 `xml:"overheadLimit,omitempty"` + OverheadLimit *int64 `xml:"overheadLimit"` } func init() { @@ -39100,11 +41209,11 @@ func init() { type ResourceConfigSpec struct { DynamicData - Entity *ManagedObjectReference `xml:"entity,omitempty"` - ChangeVersion string `xml:"changeVersion,omitempty"` - LastModified *time.Time `xml:"lastModified"` - CpuAllocation BaseResourceAllocationInfo `xml:"cpuAllocation,typeattr"` - MemoryAllocation BaseResourceAllocationInfo `xml:"memoryAllocation,typeattr"` + Entity *ManagedObjectReference `xml:"entity,omitempty"` + ChangeVersion string `xml:"changeVersion,omitempty"` + LastModified *time.Time `xml:"lastModified"` + CpuAllocation ResourceAllocationInfo `xml:"cpuAllocation"` + MemoryAllocation ResourceAllocationInfo `xml:"memoryAllocation"` } func init() { @@ -39857,6 +41966,26 @@ type RetrieveServiceContentResponse struct { Returnval ServiceContent `xml:"returnval"` } +type RetrieveSnapshotInfo RetrieveSnapshotInfoRequestType + +func init() { + t["RetrieveSnapshotInfo"] = reflect.TypeOf((*RetrieveSnapshotInfo)(nil)).Elem() +} + +type RetrieveSnapshotInfoRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` +} + +func init() { + t["RetrieveSnapshotInfoRequestType"] = reflect.TypeOf((*RetrieveSnapshotInfoRequestType)(nil)).Elem() +} + +type RetrieveSnapshotInfoResponse struct { + Returnval VStorageObjectSnapshotInfo `xml:"returnval"` +} + type RetrieveUserGroups RetrieveUserGroupsRequestType func init() { @@ -39882,12 +42011,61 @@ type RetrieveUserGroupsResponse struct { Returnval []BaseUserSearchResult `xml:"returnval,omitempty,typeattr"` } +type RetrieveVStorageInfrastructureObjectPolicy RetrieveVStorageInfrastructureObjectPolicyRequestType + +func init() { + t["RetrieveVStorageInfrastructureObjectPolicy"] = reflect.TypeOf((*RetrieveVStorageInfrastructureObjectPolicy)(nil)).Elem() +} + +type RetrieveVStorageInfrastructureObjectPolicyRequestType struct { + This ManagedObjectReference `xml:"_this"` + Datastore ManagedObjectReference `xml:"datastore"` +} + +func init() { + t["RetrieveVStorageInfrastructureObjectPolicyRequestType"] = reflect.TypeOf((*RetrieveVStorageInfrastructureObjectPolicyRequestType)(nil)).Elem() +} + +type RetrieveVStorageInfrastructureObjectPolicyResponse struct { + Returnval []VslmInfrastructureObjectPolicy `xml:"returnval,omitempty"` +} + +type RetrieveVStorageObjSpec struct { + DynamicData + + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` +} + +func init() { + t["RetrieveVStorageObjSpec"] = reflect.TypeOf((*RetrieveVStorageObjSpec)(nil)).Elem() +} + type RetrieveVStorageObject RetrieveVStorageObjectRequestType func init() { t["RetrieveVStorageObject"] = reflect.TypeOf((*RetrieveVStorageObject)(nil)).Elem() } +type RetrieveVStorageObjectAssociations RetrieveVStorageObjectAssociationsRequestType + +func init() { + t["RetrieveVStorageObjectAssociations"] = reflect.TypeOf((*RetrieveVStorageObjectAssociations)(nil)).Elem() +} + +type RetrieveVStorageObjectAssociationsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Ids []RetrieveVStorageObjSpec `xml:"ids,omitempty"` +} + +func init() { + t["RetrieveVStorageObjectAssociationsRequestType"] = reflect.TypeOf((*RetrieveVStorageObjectAssociationsRequestType)(nil)).Elem() +} + +type RetrieveVStorageObjectAssociationsResponse struct { + Returnval []VStorageObjectAssociations `xml:"returnval,omitempty"` +} + type RetrieveVStorageObjectRequestType struct { This ManagedObjectReference `xml:"_this"` Id ID `xml:"id"` @@ -39962,6 +42140,27 @@ type RevertToSnapshot_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } +type RevertVStorageObjectRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + SnapshotId ID `xml:"snapshotId"` +} + +func init() { + t["RevertVStorageObjectRequestType"] = reflect.TypeOf((*RevertVStorageObjectRequestType)(nil)).Elem() +} + +type RevertVStorageObject_Task RevertVStorageObjectRequestType + +func init() { + t["RevertVStorageObject_Task"] = reflect.TypeOf((*RevertVStorageObject_Task)(nil)).Elem() +} + +type RevertVStorageObject_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type RewindCollector RewindCollectorRequestType func init() { @@ -40147,6 +42346,14 @@ func init() { t["SAMLTokenAuthentication"] = reflect.TypeOf((*SAMLTokenAuthentication)(nil)).Elem() } +type SDDCBase struct { + DynamicData +} + +func init() { + t["SDDCBase"] = reflect.TypeOf((*SDDCBase)(nil)).Elem() +} + type SSLDisabledFault struct { HostConnectFault } @@ -40433,25 +42640,26 @@ func init() { type ScsiLun struct { HostDevice - Key string `xml:"key,omitempty"` - Uuid string `xml:"uuid"` - Descriptor []ScsiLunDescriptor `xml:"descriptor,omitempty"` - CanonicalName string `xml:"canonicalName,omitempty"` - DisplayName string `xml:"displayName,omitempty"` - LunType string `xml:"lunType"` - Vendor string `xml:"vendor,omitempty"` - Model string `xml:"model,omitempty"` - Revision string `xml:"revision,omitempty"` - ScsiLevel int32 `xml:"scsiLevel,omitempty"` - SerialNumber string `xml:"serialNumber,omitempty"` - DurableName *ScsiLunDurableName `xml:"durableName,omitempty"` - AlternateName []ScsiLunDurableName `xml:"alternateName,omitempty"` - StandardInquiry []byte `xml:"standardInquiry,omitempty"` - QueueDepth int32 `xml:"queueDepth,omitempty"` - OperationalState []string `xml:"operationalState"` - Capabilities *ScsiLunCapabilities `xml:"capabilities,omitempty"` - VStorageSupport string `xml:"vStorageSupport,omitempty"` - ProtocolEndpoint *bool `xml:"protocolEndpoint"` + Key string `xml:"key,omitempty"` + Uuid string `xml:"uuid"` + Descriptor []ScsiLunDescriptor `xml:"descriptor,omitempty"` + CanonicalName string `xml:"canonicalName,omitempty"` + DisplayName string `xml:"displayName,omitempty"` + LunType string `xml:"lunType"` + Vendor string `xml:"vendor,omitempty"` + Model string `xml:"model,omitempty"` + Revision string `xml:"revision,omitempty"` + ScsiLevel int32 `xml:"scsiLevel,omitempty"` + SerialNumber string `xml:"serialNumber,omitempty"` + DurableName *ScsiLunDurableName `xml:"durableName,omitempty"` + AlternateName []ScsiLunDurableName `xml:"alternateName,omitempty"` + StandardInquiry []byte `xml:"standardInquiry,omitempty"` + QueueDepth int32 `xml:"queueDepth,omitempty"` + OperationalState []string `xml:"operationalState"` + Capabilities *ScsiLunCapabilities `xml:"capabilities,omitempty"` + VStorageSupport string `xml:"vStorageSupport,omitempty"` + ProtocolEndpoint *bool `xml:"protocolEndpoint"` + PerenniallyReserved *bool `xml:"perenniallyReserved"` } func init() { @@ -40846,6 +43054,7 @@ type ServiceContent struct { HealthUpdateManager *ManagedObjectReference `xml:"healthUpdateManager,omitempty"` FailoverClusterConfigurator *ManagedObjectReference `xml:"failoverClusterConfigurator,omitempty"` FailoverClusterManager *ManagedObjectReference `xml:"failoverClusterManager,omitempty"` + StorageQueryManager *ManagedObjectReference `xml:"storageQueryManager,omitempty"` } func init() { @@ -41273,6 +43482,26 @@ func init() { type SetTaskStateResponse struct { } +type SetVStorageObjectControlFlags SetVStorageObjectControlFlagsRequestType + +func init() { + t["SetVStorageObjectControlFlags"] = reflect.TypeOf((*SetVStorageObjectControlFlags)(nil)).Elem() +} + +type SetVStorageObjectControlFlagsRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + ControlFlags []string `xml:"controlFlags,omitempty"` +} + +func init() { + t["SetVStorageObjectControlFlagsRequestType"] = reflect.TypeOf((*SetVStorageObjectControlFlagsRequestType)(nil)).Elem() +} + +type SetVStorageObjectControlFlagsResponse struct { +} + type SetVirtualDiskUuid SetVirtualDiskUuidRequestType func init() { @@ -42303,6 +44532,7 @@ type StorageDrsVmConfigInfo struct { Behavior string `xml:"behavior,omitempty"` IntraVmAffinity *bool `xml:"intraVmAffinity"` IntraVmAntiAffinity *VirtualDiskAntiAffinityRuleSpec `xml:"intraVmAntiAffinity,omitempty"` + VirtualDiskRules []VirtualDiskRuleSpec `xml:"virtualDiskRules,omitempty"` } func init() { @@ -42322,9 +44552,9 @@ func init() { type StorageIOAllocationInfo struct { DynamicData - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` Shares *SharesInfo `xml:"shares,omitempty"` - Reservation int32 `xml:"reservation,omitempty"` + Reservation *int32 `xml:"reservation"` } func init() { @@ -44978,6 +47208,25 @@ func init() { type UpdatePortGroupResponse struct { } +type UpdateProductLockerLocationRequestType struct { + This ManagedObjectReference `xml:"_this"` + Path string `xml:"path"` +} + +func init() { + t["UpdateProductLockerLocationRequestType"] = reflect.TypeOf((*UpdateProductLockerLocationRequestType)(nil)).Elem() +} + +type UpdateProductLockerLocation_Task UpdateProductLockerLocationRequestType + +func init() { + t["UpdateProductLockerLocation_Task"] = reflect.TypeOf((*UpdateProductLockerLocation_Task)(nil)).Elem() +} + +type UpdateProductLockerLocation_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type UpdateProgress UpdateProgressRequestType func init() { @@ -45247,6 +47496,46 @@ func init() { type UpdateVAppConfigResponse struct { } +type UpdateVStorageInfrastructureObjectPolicyRequestType struct { + This ManagedObjectReference `xml:"_this"` + Spec VslmInfrastructureObjectPolicySpec `xml:"spec"` +} + +func init() { + t["UpdateVStorageInfrastructureObjectPolicyRequestType"] = reflect.TypeOf((*UpdateVStorageInfrastructureObjectPolicyRequestType)(nil)).Elem() +} + +type UpdateVStorageInfrastructureObjectPolicy_Task UpdateVStorageInfrastructureObjectPolicyRequestType + +func init() { + t["UpdateVStorageInfrastructureObjectPolicy_Task"] = reflect.TypeOf((*UpdateVStorageInfrastructureObjectPolicy_Task)(nil)).Elem() +} + +type UpdateVStorageInfrastructureObjectPolicy_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type UpdateVStorageObjectPolicyRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` +} + +func init() { + t["UpdateVStorageObjectPolicyRequestType"] = reflect.TypeOf((*UpdateVStorageObjectPolicyRequestType)(nil)).Elem() +} + +type UpdateVStorageObjectPolicy_Task UpdateVStorageObjectPolicyRequestType + +func init() { + t["UpdateVStorageObjectPolicy_Task"] = reflect.TypeOf((*UpdateVStorageObjectPolicy_Task)(nil)).Elem() +} + +type UpdateVStorageObjectPolicy_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type UpdateVVolVirtualMachineFilesRequestType struct { This ManagedObjectReference `xml:"_this"` FailoverPair []DatastoreVVolContainerFailoverPair `xml:"failoverPair,omitempty"` @@ -45344,6 +47633,25 @@ func init() { type UpdateVirtualSwitchResponse struct { } +type UpdateVmfsUnmapBandwidth UpdateVmfsUnmapBandwidthRequestType + +func init() { + t["UpdateVmfsUnmapBandwidth"] = reflect.TypeOf((*UpdateVmfsUnmapBandwidth)(nil)).Elem() +} + +type UpdateVmfsUnmapBandwidthRequestType struct { + This ManagedObjectReference `xml:"_this"` + VmfsUuid string `xml:"vmfsUuid"` + UnmapBandwidthSpec VmfsUnmapBandwidthSpec `xml:"unmapBandwidthSpec"` +} + +func init() { + t["UpdateVmfsUnmapBandwidthRequestType"] = reflect.TypeOf((*UpdateVmfsUnmapBandwidthRequestType)(nil)).Elem() +} + +type UpdateVmfsUnmapBandwidthResponse struct { +} + type UpdateVmfsUnmapPriority UpdateVmfsUnmapPriorityRequestType func init() { @@ -46394,6 +48702,7 @@ type VMwareDVSPortSetting struct { IpfixEnabled *BoolPolicy `xml:"ipfixEnabled,omitempty"` TxUplink *BoolPolicy `xml:"txUplink,omitempty"` LacpPolicy *VMwareUplinkLacpPolicy `xml:"lacpPolicy,omitempty"` + MacManagementPolicy *DVSMacManagementPolicy `xml:"macManagementPolicy,omitempty"` } func init() { @@ -46407,6 +48716,7 @@ type VMwareDVSPortgroupPolicy struct { UplinkTeamingOverrideAllowed bool `xml:"uplinkTeamingOverrideAllowed"` SecurityPolicyOverrideAllowed bool `xml:"securityPolicyOverrideAllowed"` IpfixOverrideAllowed *bool `xml:"ipfixOverrideAllowed"` + MacManagementOverrideAllowed *bool `xml:"macManagementOverrideAllowed"` } func init() { @@ -46482,6 +48792,7 @@ type VMwareDVSVspanCapability struct { RemoteDestSupported bool `xml:"remoteDestSupported"` EncapRemoteSourceSupported bool `xml:"encapRemoteSourceSupported"` ErspanProtocolSupported *bool `xml:"erspanProtocolSupported"` + MirrorNetstackSupported *bool `xml:"mirrorNetstackSupported"` } func init() { @@ -46643,28 +48954,13 @@ type VMwareVspanSession struct { ErspanId int32 `xml:"erspanId,omitempty"` ErspanCOS int32 `xml:"erspanCOS,omitempty"` ErspanGraNanosec *bool `xml:"erspanGraNanosec"` + Netstack string `xml:"netstack,omitempty"` } func init() { t["VMwareVspanSession"] = reflect.TypeOf((*VMwareVspanSession)(nil)).Elem() } -type VRPEditSpec struct { - DynamicData - - VrpId string `xml:"vrpId"` - Description string `xml:"description,omitempty"` - CpuAllocation *VrpResourceAllocationInfo `xml:"cpuAllocation,omitempty"` - MemoryAllocation *VrpResourceAllocationInfo `xml:"memoryAllocation,omitempty"` - AddedHubs []ManagedObjectReference `xml:"addedHubs,omitempty"` - RemovedHubs []ManagedObjectReference `xml:"removedHubs,omitempty"` - ChangeVersion int64 `xml:"changeVersion,omitempty"` -} - -func init() { - t["VRPEditSpec"] = reflect.TypeOf((*VRPEditSpec)(nil)).Elem() -} - type VStorageObject struct { DynamicData @@ -46675,6 +48971,29 @@ func init() { t["VStorageObject"] = reflect.TypeOf((*VStorageObject)(nil)).Elem() } +type VStorageObjectAssociations struct { + DynamicData + + Id ID `xml:"id"` + VmDiskAssociations []VStorageObjectAssociationsVmDiskAssociations `xml:"vmDiskAssociations,omitempty"` + Fault *LocalizedMethodFault `xml:"fault,omitempty"` +} + +func init() { + t["VStorageObjectAssociations"] = reflect.TypeOf((*VStorageObjectAssociations)(nil)).Elem() +} + +type VStorageObjectAssociationsVmDiskAssociations struct { + DynamicData + + VmId string `xml:"vmId"` + DiskKey int32 `xml:"diskKey"` +} + +func init() { + t["VStorageObjectAssociationsVmDiskAssociations"] = reflect.TypeOf((*VStorageObjectAssociationsVmDiskAssociations)(nil)).Elem() +} + type VStorageObjectConfigInfo struct { BaseConfigInfo @@ -46687,6 +49006,50 @@ func init() { t["VStorageObjectConfigInfo"] = reflect.TypeOf((*VStorageObjectConfigInfo)(nil)).Elem() } +type VStorageObjectCreateSnapshotRequestType struct { + This ManagedObjectReference `xml:"_this"` + Id ID `xml:"id"` + Datastore ManagedObjectReference `xml:"datastore"` + Description string `xml:"description"` +} + +func init() { + t["VStorageObjectCreateSnapshotRequestType"] = reflect.TypeOf((*VStorageObjectCreateSnapshotRequestType)(nil)).Elem() +} + +type VStorageObjectCreateSnapshot_Task VStorageObjectCreateSnapshotRequestType + +func init() { + t["VStorageObjectCreateSnapshot_Task"] = reflect.TypeOf((*VStorageObjectCreateSnapshot_Task)(nil)).Elem() +} + +type VStorageObjectCreateSnapshot_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type VStorageObjectSnapshotInfo struct { + DynamicData + + Snapshots []VStorageObjectSnapshotInfoVStorageObjectSnapshot `xml:"snapshots,omitempty"` +} + +func init() { + t["VStorageObjectSnapshotInfo"] = reflect.TypeOf((*VStorageObjectSnapshotInfo)(nil)).Elem() +} + +type VStorageObjectSnapshotInfoVStorageObjectSnapshot struct { + DynamicData + + Id *ID `xml:"id,omitempty"` + BackingObjectId string `xml:"backingObjectId,omitempty"` + CreateTime time.Time `xml:"createTime"` + Description string `xml:"description"` +} + +func init() { + t["VStorageObjectSnapshotInfoVStorageObjectSnapshot"] = reflect.TypeOf((*VStorageObjectSnapshotInfoVStorageObjectSnapshot)(nil)).Elem() +} + type VStorageObjectStateInfo struct { DynamicData @@ -46749,12 +49112,57 @@ func init() { type ValidateCredentialsInGuestResponse struct { } +type ValidateHCIConfiguration ValidateHCIConfigurationRequestType + +func init() { + t["ValidateHCIConfiguration"] = reflect.TypeOf((*ValidateHCIConfiguration)(nil)).Elem() +} + +type ValidateHCIConfigurationRequestType struct { + This ManagedObjectReference `xml:"_this"` + HciConfigSpec *ClusterComputeResourceHCIConfigSpec `xml:"hciConfigSpec,omitempty"` + Hosts []ManagedObjectReference `xml:"hosts,omitempty"` +} + +func init() { + t["ValidateHCIConfigurationRequestType"] = reflect.TypeOf((*ValidateHCIConfigurationRequestType)(nil)).Elem() +} + +type ValidateHCIConfigurationResponse struct { + Returnval []BaseClusterComputeResourceValidationResultBase `xml:"returnval,omitempty,typeattr"` +} + type ValidateHost ValidateHostRequestType func init() { t["ValidateHost"] = reflect.TypeOf((*ValidateHost)(nil)).Elem() } +type ValidateHostProfileCompositionRequestType struct { + This ManagedObjectReference `xml:"_this"` + Source ManagedObjectReference `xml:"source"` + Targets []ManagedObjectReference `xml:"targets,omitempty"` + ToBeMerged *HostApplyProfile `xml:"toBeMerged,omitempty"` + ToReplaceWith *HostApplyProfile `xml:"toReplaceWith,omitempty"` + ToBeDeleted *HostApplyProfile `xml:"toBeDeleted,omitempty"` + EnableStatusToBeCopied *HostApplyProfile `xml:"enableStatusToBeCopied,omitempty"` + ErrorOnly *bool `xml:"errorOnly"` +} + +func init() { + t["ValidateHostProfileCompositionRequestType"] = reflect.TypeOf((*ValidateHostProfileCompositionRequestType)(nil)).Elem() +} + +type ValidateHostProfileComposition_Task ValidateHostProfileCompositionRequestType + +func init() { + t["ValidateHostProfileComposition_Task"] = reflect.TypeOf((*ValidateHostProfileComposition_Task)(nil)).Elem() +} + +type ValidateHostProfileComposition_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + type ValidateHostRequestType struct { This ManagedObjectReference `xml:"_this"` OvfDescriptor string `xml:"ovfDescriptor"` @@ -46793,6 +49201,26 @@ type ValidateMigrationResponse struct { Returnval []BaseEvent `xml:"returnval,omitempty,typeattr"` } +type ValidateStoragePodConfig ValidateStoragePodConfigRequestType + +func init() { + t["ValidateStoragePodConfig"] = reflect.TypeOf((*ValidateStoragePodConfig)(nil)).Elem() +} + +type ValidateStoragePodConfigRequestType struct { + This ManagedObjectReference `xml:"_this"` + Pod ManagedObjectReference `xml:"pod"` + Spec StorageDrsConfigSpec `xml:"spec"` +} + +func init() { + t["ValidateStoragePodConfigRequestType"] = reflect.TypeOf((*ValidateStoragePodConfigRequestType)(nil)).Elem() +} + +type ValidateStoragePodConfigResponse struct { + Returnval *LocalizedMethodFault `xml:"returnval,omitempty"` +} + type VasaProviderContainerSpec struct { DynamicData @@ -46950,6 +49378,7 @@ func init() { type VimVasaProvider struct { DynamicData + Uid string `xml:"uid,omitempty"` Url string `xml:"url"` Name string `xml:"name,omitempty"` SelfSignedCertificate string `xml:"selfSignedCertificate,omitempty"` @@ -47258,6 +49687,7 @@ func init() { type VirtualDeviceConnectInfo struct { DynamicData + MigrateConnect string `xml:"migrateConnect,omitempty"` StartConnected bool `xml:"startConnected"` AllowGuestControl bool `xml:"allowGuestControl"` Connected bool `xml:"connected"` @@ -47416,14 +49846,15 @@ func init() { type VirtualDisk struct { VirtualDevice - CapacityInKB int64 `xml:"capacityInKB"` - CapacityInBytes int64 `xml:"capacityInBytes,omitempty"` - Shares *SharesInfo `xml:"shares,omitempty"` - StorageIOAllocation *StorageIOAllocationInfo `xml:"storageIOAllocation,omitempty"` - DiskObjectId string `xml:"diskObjectId,omitempty"` - VFlashCacheConfigInfo *VirtualDiskVFlashCacheConfigInfo `xml:"vFlashCacheConfigInfo,omitempty"` - Iofilter []string `xml:"iofilter,omitempty"` - VDiskId *ID `xml:"vDiskId,omitempty"` + CapacityInKB int64 `xml:"capacityInKB"` + CapacityInBytes int64 `xml:"capacityInBytes,omitempty"` + Shares *SharesInfo `xml:"shares,omitempty"` + StorageIOAllocation *StorageIOAllocationInfo `xml:"storageIOAllocation,omitempty"` + DiskObjectId string `xml:"diskObjectId,omitempty"` + VFlashCacheConfigInfo *VirtualDiskVFlashCacheConfigInfo `xml:"vFlashCacheConfigInfo,omitempty"` + Iofilter []string `xml:"iofilter,omitempty"` + VDiskId *ID `xml:"vDiskId,omitempty"` + NativeUnmanagedLinkedClone *bool `xml:"nativeUnmanagedLinkedClone"` } func init() { @@ -47557,6 +49988,32 @@ func init() { t["VirtualDiskId"] = reflect.TypeOf((*VirtualDiskId)(nil)).Elem() } +type VirtualDiskLocalPMemBackingInfo struct { + VirtualDeviceFileBackingInfo + + DiskMode string `xml:"diskMode"` + Uuid string `xml:"uuid,omitempty"` + VolumeUUID string `xml:"volumeUUID,omitempty"` + ContentId string `xml:"contentId,omitempty"` +} + +func init() { + t["VirtualDiskLocalPMemBackingInfo"] = reflect.TypeOf((*VirtualDiskLocalPMemBackingInfo)(nil)).Elem() +} + +type VirtualDiskLocalPMemBackingOption struct { + VirtualDeviceFileBackingOption + + DiskMode ChoiceOption `xml:"diskMode"` + Growable bool `xml:"growable"` + HotGrowable bool `xml:"hotGrowable"` + Uuid bool `xml:"uuid"` +} + +func init() { + t["VirtualDiskLocalPMemBackingOption"] = reflect.TypeOf((*VirtualDiskLocalPMemBackingOption)(nil)).Elem() +} + type VirtualDiskModeNotSupported struct { DeviceNotSupported @@ -47627,6 +50084,8 @@ type VirtualDiskRawDiskMappingVer1BackingInfo struct { ContentId string `xml:"contentId,omitempty"` ChangeId string `xml:"changeId,omitempty"` Parent *VirtualDiskRawDiskMappingVer1BackingInfo `xml:"parent,omitempty"` + DeltaDiskFormat string `xml:"deltaDiskFormat,omitempty"` + DeltaGrainSize int32 `xml:"deltaGrainSize,omitempty"` Sharing string `xml:"sharing,omitempty"` } @@ -47671,6 +50130,17 @@ func init() { t["VirtualDiskRawDiskVer2BackingOption"] = reflect.TypeOf((*VirtualDiskRawDiskVer2BackingOption)(nil)).Elem() } +type VirtualDiskRuleSpec struct { + ClusterRuleInfo + + DiskRuleType string `xml:"diskRuleType"` + DiskId []int32 `xml:"diskId,omitempty"` +} + +func init() { + t["VirtualDiskRuleSpec"] = reflect.TypeOf((*VirtualDiskRuleSpec)(nil)).Elem() +} + type VirtualDiskSeSparseBackingInfo struct { VirtualDeviceFileBackingInfo @@ -47957,9 +50427,9 @@ func init() { type VirtualEthernetCardResourceAllocation struct { DynamicData - Reservation int64 `xml:"reservation,omitempty"` + Reservation *int64 `xml:"reservation"` Share SharesInfo `xml:"share"` - Limit int64 `xml:"limit,omitempty"` + Limit *int64 `xml:"limit"` } func init() { @@ -48079,6 +50549,8 @@ type VirtualHardwareOption struct { NumSupportedWwnPorts *IntOption `xml:"numSupportedWwnPorts,omitempty"` NumSupportedWwnNodes *IntOption `xml:"numSupportedWwnNodes,omitempty"` ResourceConfigOption *ResourceConfigOption `xml:"resourceConfigOption,omitempty"` + NumNVDIMMControllers *IntOption `xml:"numNVDIMMControllers,omitempty"` + NumTPMDevices *IntOption `xml:"numTPMDevices,omitempty"` } func init() { @@ -48188,7 +50660,7 @@ func init() { type VirtualMachineAffinityInfo struct { DynamicData - AffinitySet []int32 `xml:"affinitySet,omitempty"` + AffinitySet []int32 `xml:"affinitySet"` } func init() { @@ -48258,44 +50730,48 @@ func init() { type VirtualMachineCapability struct { DynamicData - SnapshotOperationsSupported bool `xml:"snapshotOperationsSupported"` - MultipleSnapshotsSupported bool `xml:"multipleSnapshotsSupported"` - SnapshotConfigSupported bool `xml:"snapshotConfigSupported"` - PoweredOffSnapshotsSupported bool `xml:"poweredOffSnapshotsSupported"` - MemorySnapshotsSupported bool `xml:"memorySnapshotsSupported"` - RevertToSnapshotSupported bool `xml:"revertToSnapshotSupported"` - QuiescedSnapshotsSupported bool `xml:"quiescedSnapshotsSupported"` - DisableSnapshotsSupported bool `xml:"disableSnapshotsSupported"` - LockSnapshotsSupported bool `xml:"lockSnapshotsSupported"` - ConsolePreferencesSupported bool `xml:"consolePreferencesSupported"` - CpuFeatureMaskSupported bool `xml:"cpuFeatureMaskSupported"` - S1AcpiManagementSupported bool `xml:"s1AcpiManagementSupported"` - SettingScreenResolutionSupported bool `xml:"settingScreenResolutionSupported"` - ToolsAutoUpdateSupported bool `xml:"toolsAutoUpdateSupported"` - VmNpivWwnSupported bool `xml:"vmNpivWwnSupported"` - NpivWwnOnNonRdmVmSupported bool `xml:"npivWwnOnNonRdmVmSupported"` - VmNpivWwnDisableSupported *bool `xml:"vmNpivWwnDisableSupported"` - VmNpivWwnUpdateSupported *bool `xml:"vmNpivWwnUpdateSupported"` - SwapPlacementSupported bool `xml:"swapPlacementSupported"` - ToolsSyncTimeSupported bool `xml:"toolsSyncTimeSupported"` - VirtualMmuUsageSupported bool `xml:"virtualMmuUsageSupported"` - DiskSharesSupported bool `xml:"diskSharesSupported"` - BootOptionsSupported bool `xml:"bootOptionsSupported"` - BootRetryOptionsSupported *bool `xml:"bootRetryOptionsSupported"` - SettingVideoRamSizeSupported bool `xml:"settingVideoRamSizeSupported"` - SettingDisplayTopologySupported *bool `xml:"settingDisplayTopologySupported"` - RecordReplaySupported *bool `xml:"recordReplaySupported"` - ChangeTrackingSupported *bool `xml:"changeTrackingSupported"` - MultipleCoresPerSocketSupported *bool `xml:"multipleCoresPerSocketSupported"` - HostBasedReplicationSupported *bool `xml:"hostBasedReplicationSupported"` - GuestAutoLockSupported *bool `xml:"guestAutoLockSupported"` - MemoryReservationLockSupported *bool `xml:"memoryReservationLockSupported"` - FeatureRequirementSupported *bool `xml:"featureRequirementSupported"` - PoweredOnMonitorTypeChangeSupported *bool `xml:"poweredOnMonitorTypeChangeSupported"` - SeSparseDiskSupported *bool `xml:"seSparseDiskSupported"` - NestedHVSupported *bool `xml:"nestedHVSupported"` - VPMCSupported *bool `xml:"vPMCSupported"` - SecureBootSupported *bool `xml:"secureBootSupported"` + SnapshotOperationsSupported bool `xml:"snapshotOperationsSupported"` + MultipleSnapshotsSupported bool `xml:"multipleSnapshotsSupported"` + SnapshotConfigSupported bool `xml:"snapshotConfigSupported"` + PoweredOffSnapshotsSupported bool `xml:"poweredOffSnapshotsSupported"` + MemorySnapshotsSupported bool `xml:"memorySnapshotsSupported"` + RevertToSnapshotSupported bool `xml:"revertToSnapshotSupported"` + QuiescedSnapshotsSupported bool `xml:"quiescedSnapshotsSupported"` + DisableSnapshotsSupported bool `xml:"disableSnapshotsSupported"` + LockSnapshotsSupported bool `xml:"lockSnapshotsSupported"` + ConsolePreferencesSupported bool `xml:"consolePreferencesSupported"` + CpuFeatureMaskSupported bool `xml:"cpuFeatureMaskSupported"` + S1AcpiManagementSupported bool `xml:"s1AcpiManagementSupported"` + SettingScreenResolutionSupported bool `xml:"settingScreenResolutionSupported"` + ToolsAutoUpdateSupported bool `xml:"toolsAutoUpdateSupported"` + VmNpivWwnSupported bool `xml:"vmNpivWwnSupported"` + NpivWwnOnNonRdmVmSupported bool `xml:"npivWwnOnNonRdmVmSupported"` + VmNpivWwnDisableSupported *bool `xml:"vmNpivWwnDisableSupported"` + VmNpivWwnUpdateSupported *bool `xml:"vmNpivWwnUpdateSupported"` + SwapPlacementSupported bool `xml:"swapPlacementSupported"` + ToolsSyncTimeSupported bool `xml:"toolsSyncTimeSupported"` + VirtualMmuUsageSupported bool `xml:"virtualMmuUsageSupported"` + DiskSharesSupported bool `xml:"diskSharesSupported"` + BootOptionsSupported bool `xml:"bootOptionsSupported"` + BootRetryOptionsSupported *bool `xml:"bootRetryOptionsSupported"` + SettingVideoRamSizeSupported bool `xml:"settingVideoRamSizeSupported"` + SettingDisplayTopologySupported *bool `xml:"settingDisplayTopologySupported"` + RecordReplaySupported *bool `xml:"recordReplaySupported"` + ChangeTrackingSupported *bool `xml:"changeTrackingSupported"` + MultipleCoresPerSocketSupported *bool `xml:"multipleCoresPerSocketSupported"` + HostBasedReplicationSupported *bool `xml:"hostBasedReplicationSupported"` + GuestAutoLockSupported *bool `xml:"guestAutoLockSupported"` + MemoryReservationLockSupported *bool `xml:"memoryReservationLockSupported"` + FeatureRequirementSupported *bool `xml:"featureRequirementSupported"` + PoweredOnMonitorTypeChangeSupported *bool `xml:"poweredOnMonitorTypeChangeSupported"` + SeSparseDiskSupported *bool `xml:"seSparseDiskSupported"` + NestedHVSupported *bool `xml:"nestedHVSupported"` + VPMCSupported *bool `xml:"vPMCSupported"` + SecureBootSupported *bool `xml:"secureBootSupported"` + PerVmEvcSupported *bool `xml:"perVmEvcSupported"` + VirtualMmuUsageIgnored *bool `xml:"virtualMmuUsageIgnored"` + VirtualExecUsageIgnored *bool `xml:"virtualExecUsageIgnored"` + DiskOnlySnapshotOnSuspendedVMSupported *bool `xml:"diskOnlySnapshotOnSuspendedVMSupported"` } func init() { @@ -48337,6 +50813,7 @@ type VirtualMachineConfigInfo struct { GuestFullName string `xml:"guestFullName"` Version string `xml:"version"` Uuid string `xml:"uuid"` + CreateDate *time.Time `xml:"createDate"` InstanceUuid string `xml:"instanceUuid,omitempty"` NpivNodeWorldWideName []int64 `xml:"npivNodeWorldWideName,omitempty"` NpivPortWorldWideName []int64 `xml:"npivPortWorldWideName,omitempty"` @@ -48356,8 +50833,8 @@ type VirtualMachineConfigInfo struct { ConsolePreferences *VirtualMachineConsolePreferences `xml:"consolePreferences,omitempty"` DefaultPowerOps VirtualMachineDefaultPowerOpInfo `xml:"defaultPowerOps"` Hardware VirtualHardware `xml:"hardware"` - CpuAllocation BaseResourceAllocationInfo `xml:"cpuAllocation,omitempty,typeattr"` - MemoryAllocation BaseResourceAllocationInfo `xml:"memoryAllocation,omitempty,typeattr"` + CpuAllocation *ResourceAllocationInfo `xml:"cpuAllocation,omitempty"` + MemoryAllocation *ResourceAllocationInfo `xml:"memoryAllocation,omitempty"` LatencySensitivity *LatencySensitivity `xml:"latencySensitivity,omitempty"` MemoryHotAddEnabled *bool `xml:"memoryHotAddEnabled"` CpuHotAddEnabled *bool `xml:"cpuHotAddEnabled"` @@ -48426,17 +50903,18 @@ func init() { type VirtualMachineConfigOption struct { DynamicData - Version string `xml:"version"` - Description string `xml:"description"` - GuestOSDescriptor []GuestOsDescriptor `xml:"guestOSDescriptor"` - GuestOSDefaultIndex int32 `xml:"guestOSDefaultIndex"` - HardwareOptions VirtualHardwareOption `xml:"hardwareOptions"` - Capabilities VirtualMachineCapability `xml:"capabilities"` - Datastore DatastoreOption `xml:"datastore"` - DefaultDevice []BaseVirtualDevice `xml:"defaultDevice,omitempty,typeattr"` - SupportedMonitorType []string `xml:"supportedMonitorType"` - SupportedOvfEnvironmentTransport []string `xml:"supportedOvfEnvironmentTransport,omitempty"` - SupportedOvfInstallTransport []string `xml:"supportedOvfInstallTransport,omitempty"` + Version string `xml:"version"` + Description string `xml:"description"` + GuestOSDescriptor []GuestOsDescriptor `xml:"guestOSDescriptor"` + GuestOSDefaultIndex int32 `xml:"guestOSDefaultIndex"` + HardwareOptions VirtualHardwareOption `xml:"hardwareOptions"` + Capabilities VirtualMachineCapability `xml:"capabilities"` + Datastore DatastoreOption `xml:"datastore"` + DefaultDevice []BaseVirtualDevice `xml:"defaultDevice,omitempty,typeattr"` + SupportedMonitorType []string `xml:"supportedMonitorType"` + SupportedOvfEnvironmentTransport []string `xml:"supportedOvfEnvironmentTransport,omitempty"` + SupportedOvfInstallTransport []string `xml:"supportedOvfInstallTransport,omitempty"` + PropertyRelations []VirtualMachinePropertyRelation `xml:"propertyRelations,omitempty"` } func init() { @@ -48465,6 +50943,7 @@ type VirtualMachineConfigSpec struct { ChangeVersion string `xml:"changeVersion,omitempty"` Name string `xml:"name,omitempty"` Version string `xml:"version,omitempty"` + CreateDate *time.Time `xml:"createDate"` Uuid string `xml:"uuid,omitempty"` InstanceUuid string `xml:"instanceUuid,omitempty"` NpivNodeWorldWideName []int64 `xml:"npivNodeWorldWideName,omitempty"` @@ -48493,8 +50972,8 @@ type VirtualMachineConfigSpec struct { VirtualICH7MPresent *bool `xml:"virtualICH7MPresent"` VirtualSMCPresent *bool `xml:"virtualSMCPresent"` DeviceChange []BaseVirtualDeviceConfigSpec `xml:"deviceChange,omitempty,typeattr"` - CpuAllocation BaseResourceAllocationInfo `xml:"cpuAllocation,omitempty,typeattr"` - MemoryAllocation BaseResourceAllocationInfo `xml:"memoryAllocation,omitempty,typeattr"` + CpuAllocation *ResourceAllocationInfo `xml:"cpuAllocation,omitempty"` + MemoryAllocation *ResourceAllocationInfo `xml:"memoryAllocation,omitempty"` LatencySensitivity *LatencySensitivity `xml:"latencySensitivity,omitempty"` CpuAffinity *VirtualMachineAffinityInfo `xml:"cpuAffinity,omitempty"` MemoryAffinity *VirtualMachineAffinityInfo `xml:"memoryAffinity,omitempty"` @@ -48548,6 +51027,8 @@ type VirtualMachineConfigSummary struct { InstallBootRequired *bool `xml:"installBootRequired"` FtInfo BaseFaultToleranceConfigInfo `xml:"ftInfo,omitempty,typeattr"` ManagedBy *ManagedByInfo `xml:"managedBy,omitempty"` + TpmPresent *bool `xml:"tpmPresent"` + NumVmiopBackings int32 `xml:"numVmiopBackings,omitempty"` } func init() { @@ -48634,6 +51115,7 @@ type VirtualMachineDefinedProfileSpec struct { ProfileId string `xml:"profileId"` ReplicationSpec *ReplicationSpec `xml:"replicationSpec,omitempty"` ProfileData *VirtualMachineProfileRawData `xml:"profileData,omitempty"` + ProfileParams []KeyValue `xml:"profileParams,omitempty"` } func init() { @@ -48662,11 +51144,13 @@ func init() { type VirtualMachineDeviceRuntimeInfoVirtualEthernetCardRuntimeState struct { VirtualMachineDeviceRuntimeInfoDeviceRuntimeState - VmDirectPathGen2Active bool `xml:"vmDirectPathGen2Active"` - VmDirectPathGen2InactiveReasonVm []string `xml:"vmDirectPathGen2InactiveReasonVm,omitempty"` - VmDirectPathGen2InactiveReasonOther []string `xml:"vmDirectPathGen2InactiveReasonOther,omitempty"` - VmDirectPathGen2InactiveReasonExtended string `xml:"vmDirectPathGen2InactiveReasonExtended,omitempty"` - ReservationStatus string `xml:"reservationStatus,omitempty"` + VmDirectPathGen2Active bool `xml:"vmDirectPathGen2Active"` + VmDirectPathGen2InactiveReasonVm []string `xml:"vmDirectPathGen2InactiveReasonVm,omitempty"` + VmDirectPathGen2InactiveReasonOther []string `xml:"vmDirectPathGen2InactiveReasonOther,omitempty"` + VmDirectPathGen2InactiveReasonExtended string `xml:"vmDirectPathGen2InactiveReasonExtended,omitempty"` + ReservationStatus string `xml:"reservationStatus,omitempty"` + AttachmentStatus string `xml:"attachmentStatus,omitempty"` + FeatureRequirement []VirtualMachineFeatureRequirement `xml:"featureRequirement,omitempty"` } func init() { @@ -48848,6 +51332,8 @@ type VirtualMachineFlagInfo struct { RecordReplayEnabled *bool `xml:"recordReplayEnabled"` FaultToleranceType string `xml:"faultToleranceType,omitempty"` CbrcCacheEnabled *bool `xml:"cbrcCacheEnabled"` + VvtdEnabled *bool `xml:"vvtdEnabled"` + VbsEnabled *bool `xml:"vbsEnabled"` } func init() { @@ -48944,6 +51430,19 @@ func init() { t["VirtualMachineImportSpec"] = reflect.TypeOf((*VirtualMachineImportSpec)(nil)).Elem() } +type VirtualMachineInstantCloneSpec struct { + DynamicData + + Name string `xml:"name"` + Location VirtualMachineRelocateSpec `xml:"location"` + Config []BaseOptionValue `xml:"config,omitempty,typeattr"` + BiosUuid string `xml:"biosUuid,omitempty"` +} + +func init() { + t["VirtualMachineInstantCloneSpec"] = reflect.TypeOf((*VirtualMachineInstantCloneSpec)(nil)).Elem() +} + type VirtualMachineLegacyNetworkSwitchInfo struct { DynamicData @@ -49100,6 +51599,28 @@ func init() { t["VirtualMachinePciSharedGpuPassthroughInfo"] = reflect.TypeOf((*VirtualMachinePciSharedGpuPassthroughInfo)(nil)).Elem() } +type VirtualMachineProfileDetails struct { + DynamicData + + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` + DiskProfileDetails []VirtualMachineProfileDetailsDiskProfileDetails `xml:"diskProfileDetails,omitempty"` +} + +func init() { + t["VirtualMachineProfileDetails"] = reflect.TypeOf((*VirtualMachineProfileDetails)(nil)).Elem() +} + +type VirtualMachineProfileDetailsDiskProfileDetails struct { + DynamicData + + DiskId int32 `xml:"diskId"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` +} + +func init() { + t["VirtualMachineProfileDetailsDiskProfileDetails"] = reflect.TypeOf((*VirtualMachineProfileDetailsDiskProfileDetails)(nil)).Elem() +} + type VirtualMachineProfileRawData struct { DynamicData @@ -49119,6 +51640,17 @@ func init() { t["VirtualMachineProfileSpec"] = reflect.TypeOf((*VirtualMachineProfileSpec)(nil)).Elem() } +type VirtualMachinePropertyRelation struct { + DynamicData + + Key DynamicProperty `xml:"key"` + Relations []DynamicProperty `xml:"relations,omitempty"` +} + +func init() { + t["VirtualMachinePropertyRelation"] = reflect.TypeOf((*VirtualMachinePropertyRelation)(nil)).Elem() +} + type VirtualMachineQuestionInfo struct { DynamicData @@ -49225,6 +51757,8 @@ type VirtualMachineRuntimeInfo struct { Paused *bool `xml:"paused"` SnapshotInBackground *bool `xml:"snapshotInBackground"` QuiescedForkParent *bool `xml:"quiescedForkParent"` + InstantCloneFrozen *bool `xml:"instantCloneFrozen"` + CryptoState string `xml:"cryptoState,omitempty"` } func init() { @@ -49561,6 +52095,58 @@ func init() { t["VirtualMachineWipeResult"] = reflect.TypeOf((*VirtualMachineWipeResult)(nil)).Elem() } +type VirtualNVDIMM struct { + VirtualDevice + + CapacityInMB int64 `xml:"capacityInMB"` +} + +func init() { + t["VirtualNVDIMM"] = reflect.TypeOf((*VirtualNVDIMM)(nil)).Elem() +} + +type VirtualNVDIMMBackingInfo struct { + VirtualDeviceFileBackingInfo + + Parent *VirtualNVDIMMBackingInfo `xml:"parent,omitempty"` + ChangeId string `xml:"changeId,omitempty"` +} + +func init() { + t["VirtualNVDIMMBackingInfo"] = reflect.TypeOf((*VirtualNVDIMMBackingInfo)(nil)).Elem() +} + +type VirtualNVDIMMController struct { + VirtualController +} + +func init() { + t["VirtualNVDIMMController"] = reflect.TypeOf((*VirtualNVDIMMController)(nil)).Elem() +} + +type VirtualNVDIMMControllerOption struct { + VirtualControllerOption + + NumNVDIMMControllers IntOption `xml:"numNVDIMMControllers"` +} + +func init() { + t["VirtualNVDIMMControllerOption"] = reflect.TypeOf((*VirtualNVDIMMControllerOption)(nil)).Elem() +} + +type VirtualNVDIMMOption struct { + VirtualDeviceOption + + CapacityInMB LongOption `xml:"capacityInMB"` + Growable bool `xml:"growable"` + HotGrowable bool `xml:"hotGrowable"` + GranularityInMB int64 `xml:"granularityInMB"` +} + +func init() { + t["VirtualNVDIMMOption"] = reflect.TypeOf((*VirtualNVDIMMOption)(nil)).Elem() +} + type VirtualNVMEController struct { VirtualController } @@ -49615,6 +52201,7 @@ type VirtualPCIControllerOption struct { NumParaVirtualSCSIControllers *IntOption `xml:"numParaVirtualSCSIControllers,omitempty"` NumSATAControllers *IntOption `xml:"numSATAControllers,omitempty"` NumNVMEControllers *IntOption `xml:"numNVMEControllers,omitempty"` + NumVmxnet3VrdmaEthernetCards *IntOption `xml:"numVmxnet3VrdmaEthernetCards,omitempty"` } func init() { @@ -49816,39 +52403,6 @@ func init() { t["VirtualPointingDeviceOption"] = reflect.TypeOf((*VirtualPointingDeviceOption)(nil)).Elem() } -type VirtualResourcePoolSpec struct { - DynamicData - - VrpId string `xml:"vrpId,omitempty"` - VrpName string `xml:"vrpName,omitempty"` - Description string `xml:"description,omitempty"` - CpuAllocation VrpResourceAllocationInfo `xml:"cpuAllocation"` - MemoryAllocation VrpResourceAllocationInfo `xml:"memoryAllocation"` - RpList []ManagedObjectReference `xml:"rpList,omitempty"` - HubList []ManagedObjectReference `xml:"hubList,omitempty"` - RootVRP *bool `xml:"rootVRP"` - StaticVRP *bool `xml:"staticVRP"` - ChangeVersion int64 `xml:"changeVersion,omitempty"` -} - -func init() { - t["VirtualResourcePoolSpec"] = reflect.TypeOf((*VirtualResourcePoolSpec)(nil)).Elem() -} - -type VirtualResourcePoolUsage struct { - DynamicData - - VrpId string `xml:"vrpId"` - CpuReservationMhz int64 `xml:"cpuReservationMhz"` - MemReservationMB int64 `xml:"memReservationMB"` - CpuReservationUsedMhz int64 `xml:"cpuReservationUsedMhz"` - MemReservationUsedMB int64 `xml:"memReservationUsedMB"` -} - -func init() { - t["VirtualResourcePoolUsage"] = reflect.TypeOf((*VirtualResourcePoolUsage)(nil)).Elem() -} - type VirtualSATAController struct { VirtualController } @@ -50163,6 +52717,27 @@ func init() { t["VirtualSwitchSelectionProfile"] = reflect.TypeOf((*VirtualSwitchSelectionProfile)(nil)).Elem() } +type VirtualTPM struct { + VirtualDevice + + EndorsementKeyCertificateSigningRequest [][]byte `xml:"endorsementKeyCertificateSigningRequest,omitempty"` + EndorsementKeyCertificate [][]byte `xml:"endorsementKeyCertificate,omitempty"` +} + +func init() { + t["VirtualTPM"] = reflect.TypeOf((*VirtualTPM)(nil)).Elem() +} + +type VirtualTPMOption struct { + VirtualDeviceOption + + SupportedFirmware []string `xml:"supportedFirmware,omitempty"` +} + +func init() { + t["VirtualTPMOption"] = reflect.TypeOf((*VirtualTPMOption)(nil)).Elem() +} + type VirtualUSB struct { VirtualDevice @@ -50357,6 +52932,8 @@ func init() { type VirtualVmxnet3Vrdma struct { VirtualVmxnet3 + + DeviceProtocol string `xml:"deviceProtocol,omitempty"` } func init() { @@ -50365,6 +52942,8 @@ func init() { type VirtualVmxnet3VrdmaOption struct { VirtualVmxnet3Option + + DeviceProtocol *ChoiceOption `xml:"deviceProtocol,omitempty"` } func init() { @@ -52110,8 +54689,12 @@ func init() { type VmfsConfigOption struct { DynamicData - BlockSizeOption int32 `xml:"blockSizeOption"` - UnmapGranularityOption []int32 `xml:"unmapGranularityOption,omitempty"` + BlockSizeOption int32 `xml:"blockSizeOption"` + UnmapGranularityOption []int32 `xml:"unmapGranularityOption,omitempty"` + UnmapBandwidthFixedValue *LongOption `xml:"unmapBandwidthFixedValue,omitempty"` + UnmapBandwidthDynamicMin *LongOption `xml:"unmapBandwidthDynamicMin,omitempty"` + UnmapBandwidthDynamicMax *LongOption `xml:"unmapBandwidthDynamicMax,omitempty"` + UnmapBandwidthIncrement int64 `xml:"unmapBandwidthIncrement,omitempty"` } func init() { @@ -52240,6 +54823,19 @@ func init() { t["VmfsMountFaultFault"] = reflect.TypeOf((*VmfsMountFaultFault)(nil)).Elem() } +type VmfsUnmapBandwidthSpec struct { + DynamicData + + Policy string `xml:"policy"` + FixedValue int64 `xml:"fixedValue"` + DynamicMin int64 `xml:"dynamicMin"` + DynamicMax int64 `xml:"dynamicMax"` +} + +func init() { + t["VmfsUnmapBandwidthSpec"] = reflect.TypeOf((*VmfsUnmapBandwidthSpec)(nil)).Elem() +} + type VmotionInterfaceNotEnabled struct { HostPowerOpFailed } @@ -52267,7 +54863,7 @@ func init() { type VmwareDistributedVirtualSwitchTrunkVlanSpec struct { VmwareDistributedVirtualSwitchVlanSpec - VlanId []NumericRange `xml:"vlanId"` + VlanId []NumericRange `xml:"vlanId,omitempty"` } func init() { @@ -52348,16 +54944,6 @@ func init() { t["VramLimitLicenseFault"] = reflect.TypeOf((*VramLimitLicenseFault)(nil)).Elem() } -type VrpResourceAllocationInfo struct { - ResourceAllocationInfo - - ReservationLimit int64 `xml:"reservationLimit,omitempty"` -} - -func init() { - t["VrpResourceAllocationInfo"] = reflect.TypeOf((*VrpResourceAllocationInfo)(nil)).Elem() -} - type VsanClusterConfigInfo struct { DynamicData @@ -52886,7 +55472,9 @@ func init() { type VslmCloneSpec struct { VslmMigrateSpec - Name string `xml:"name"` + Name string `xml:"name"` + KeepAfterDeleteVm *bool `xml:"keepAfterDeleteVm"` + Metadata []KeyValue `xml:"metadata,omitempty"` } func init() { @@ -52896,9 +55484,12 @@ func init() { type VslmCreateSpec struct { DynamicData - Name string `xml:"name"` - BackingSpec BaseVslmCreateSpecBackingSpec `xml:"backingSpec,typeattr"` - CapacityInMB int64 `xml:"capacityInMB"` + Name string `xml:"name"` + KeepAfterDeleteVm *bool `xml:"keepAfterDeleteVm"` + BackingSpec BaseVslmCreateSpecBackingSpec `xml:"backingSpec,typeattr"` + CapacityInMB int64 `xml:"capacityInMB"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` + Metadata []KeyValue `xml:"metadata,omitempty"` } func init() { @@ -52909,6 +55500,7 @@ type VslmCreateSpecBackingSpec struct { DynamicData Datastore ManagedObjectReference `xml:"datastore"` + Path string `xml:"path,omitempty"` } func init() { @@ -52939,8 +55531,9 @@ func init() { type VslmMigrateSpec struct { DynamicData - BackingSpec BaseVslmCreateSpecBackingSpec `xml:"backingSpec,typeattr"` - Consolidate *bool `xml:"consolidate"` + BackingSpec BaseVslmCreateSpecBackingSpec `xml:"backingSpec,typeattr"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` + Consolidate *bool `xml:"consolidate"` } func init() { @@ -53332,3 +55925,332 @@ func init() { type ZeroFillVirtualDisk_TaskResponse struct { Returnval ManagedObjectReference `xml:"returnval"` } + +type ConfigureVchaRequestType struct { + This ManagedObjectReference `xml:"_this"` + ConfigSpec VchaClusterConfigSpec `xml:"configSpec"` +} + +func init() { + t["configureVchaRequestType"] = reflect.TypeOf((*ConfigureVchaRequestType)(nil)).Elem() +} + +type ConfigureVcha_Task ConfigureVchaRequestType + +func init() { + t["configureVcha_Task"] = reflect.TypeOf((*ConfigureVcha_Task)(nil)).Elem() +} + +type ConfigureVcha_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type CreatePassiveNodeRequestType struct { + This ManagedObjectReference `xml:"_this"` + PassiveDeploymentSpec PassiveNodeDeploymentSpec `xml:"passiveDeploymentSpec"` + SourceVcSpec SourceNodeSpec `xml:"sourceVcSpec"` +} + +func init() { + t["createPassiveNodeRequestType"] = reflect.TypeOf((*CreatePassiveNodeRequestType)(nil)).Elem() +} + +type CreatePassiveNode_Task CreatePassiveNodeRequestType + +func init() { + t["createPassiveNode_Task"] = reflect.TypeOf((*CreatePassiveNode_Task)(nil)).Elem() +} + +type CreatePassiveNode_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type CreateWitnessNodeRequestType struct { + This ManagedObjectReference `xml:"_this"` + WitnessDeploymentSpec BaseNodeDeploymentSpec `xml:"witnessDeploymentSpec,typeattr"` + SourceVcSpec SourceNodeSpec `xml:"sourceVcSpec"` +} + +func init() { + t["createWitnessNodeRequestType"] = reflect.TypeOf((*CreateWitnessNodeRequestType)(nil)).Elem() +} + +type CreateWitnessNode_Task CreateWitnessNodeRequestType + +func init() { + t["createWitnessNode_Task"] = reflect.TypeOf((*CreateWitnessNode_Task)(nil)).Elem() +} + +type CreateWitnessNode_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type DeployVchaRequestType struct { + This ManagedObjectReference `xml:"_this"` + DeploymentSpec VchaClusterDeploymentSpec `xml:"deploymentSpec"` +} + +func init() { + t["deployVchaRequestType"] = reflect.TypeOf((*DeployVchaRequestType)(nil)).Elem() +} + +type DeployVcha_Task DeployVchaRequestType + +func init() { + t["deployVcha_Task"] = reflect.TypeOf((*DeployVcha_Task)(nil)).Elem() +} + +type DeployVcha_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type DestroyVchaRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["destroyVchaRequestType"] = reflect.TypeOf((*DestroyVchaRequestType)(nil)).Elem() +} + +type DestroyVcha_Task DestroyVchaRequestType + +func init() { + t["destroyVcha_Task"] = reflect.TypeOf((*DestroyVcha_Task)(nil)).Elem() +} + +type DestroyVcha_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type FetchSoftwarePackages FetchSoftwarePackagesRequestType + +func init() { + t["fetchSoftwarePackages"] = reflect.TypeOf((*FetchSoftwarePackages)(nil)).Elem() +} + +type FetchSoftwarePackagesRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["fetchSoftwarePackagesRequestType"] = reflect.TypeOf((*FetchSoftwarePackagesRequestType)(nil)).Elem() +} + +type FetchSoftwarePackagesResponse struct { + Returnval []SoftwarePackage `xml:"returnval,omitempty"` +} + +type GetClusterMode GetClusterModeRequestType + +func init() { + t["getClusterMode"] = reflect.TypeOf((*GetClusterMode)(nil)).Elem() +} + +type GetClusterModeRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["getClusterModeRequestType"] = reflect.TypeOf((*GetClusterModeRequestType)(nil)).Elem() +} + +type GetClusterModeResponse struct { + Returnval string `xml:"returnval"` +} + +type GetVchaConfig GetVchaConfigRequestType + +func init() { + t["getVchaConfig"] = reflect.TypeOf((*GetVchaConfig)(nil)).Elem() +} + +type GetVchaConfigRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["getVchaConfigRequestType"] = reflect.TypeOf((*GetVchaConfigRequestType)(nil)).Elem() +} + +type GetVchaConfigResponse struct { + Returnval VchaClusterConfigInfo `xml:"returnval"` +} + +type InitiateFailoverRequestType struct { + This ManagedObjectReference `xml:"_this"` + Planned bool `xml:"planned"` +} + +func init() { + t["initiateFailoverRequestType"] = reflect.TypeOf((*InitiateFailoverRequestType)(nil)).Elem() +} + +type InitiateFailover_Task InitiateFailoverRequestType + +func init() { + t["initiateFailover_Task"] = reflect.TypeOf((*InitiateFailover_Task)(nil)).Elem() +} + +type InitiateFailover_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type InstallDate InstallDateRequestType + +func init() { + t["installDate"] = reflect.TypeOf((*InstallDate)(nil)).Elem() +} + +type InstallDateRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["installDateRequestType"] = reflect.TypeOf((*InstallDateRequestType)(nil)).Elem() +} + +type InstallDateResponse struct { + Returnval time.Time `xml:"returnval"` +} + +type PrepareVchaRequestType struct { + This ManagedObjectReference `xml:"_this"` + NetworkSpec VchaClusterNetworkSpec `xml:"networkSpec"` +} + +func init() { + t["prepareVchaRequestType"] = reflect.TypeOf((*PrepareVchaRequestType)(nil)).Elem() +} + +type PrepareVcha_Task PrepareVchaRequestType + +func init() { + t["prepareVcha_Task"] = reflect.TypeOf((*PrepareVcha_Task)(nil)).Elem() +} + +type PrepareVcha_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type QueryDatacenterConfigOptionDescriptor QueryDatacenterConfigOptionDescriptorRequestType + +func init() { + t["queryDatacenterConfigOptionDescriptor"] = reflect.TypeOf((*QueryDatacenterConfigOptionDescriptor)(nil)).Elem() +} + +type QueryDatacenterConfigOptionDescriptorRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["queryDatacenterConfigOptionDescriptorRequestType"] = reflect.TypeOf((*QueryDatacenterConfigOptionDescriptorRequestType)(nil)).Elem() +} + +type QueryDatacenterConfigOptionDescriptorResponse struct { + Returnval []VirtualMachineConfigOptionDescriptor `xml:"returnval,omitempty"` +} + +type ReloadVirtualMachineFromPathRequestType struct { + This ManagedObjectReference `xml:"_this"` + ConfigurationPath string `xml:"configurationPath"` +} + +func init() { + t["reloadVirtualMachineFromPathRequestType"] = reflect.TypeOf((*ReloadVirtualMachineFromPathRequestType)(nil)).Elem() +} + +type ReloadVirtualMachineFromPath_Task ReloadVirtualMachineFromPathRequestType + +func init() { + t["reloadVirtualMachineFromPath_Task"] = reflect.TypeOf((*ReloadVirtualMachineFromPath_Task)(nil)).Elem() +} + +type ReloadVirtualMachineFromPath_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type SetClusterModeRequestType struct { + This ManagedObjectReference `xml:"_this"` + Mode string `xml:"mode"` +} + +func init() { + t["setClusterModeRequestType"] = reflect.TypeOf((*SetClusterModeRequestType)(nil)).Elem() +} + +type SetClusterMode_Task SetClusterModeRequestType + +func init() { + t["setClusterMode_Task"] = reflect.TypeOf((*SetClusterMode_Task)(nil)).Elem() +} + +type SetClusterMode_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type SetCustomValue SetCustomValueRequestType + +func init() { + t["setCustomValue"] = reflect.TypeOf((*SetCustomValue)(nil)).Elem() +} + +type SetCustomValueRequestType struct { + This ManagedObjectReference `xml:"_this"` + Key string `xml:"key"` + Value string `xml:"value"` +} + +func init() { + t["setCustomValueRequestType"] = reflect.TypeOf((*SetCustomValueRequestType)(nil)).Elem() +} + +type SetCustomValueResponse struct { +} + +type UnregisterVAppRequestType struct { + This ManagedObjectReference `xml:"_this"` +} + +func init() { + t["unregisterVAppRequestType"] = reflect.TypeOf((*UnregisterVAppRequestType)(nil)).Elem() +} + +type UnregisterVApp_Task UnregisterVAppRequestType + +func init() { + t["unregisterVApp_Task"] = reflect.TypeOf((*UnregisterVApp_Task)(nil)).Elem() +} + +type UnregisterVApp_TaskResponse struct { + Returnval ManagedObjectReference `xml:"returnval"` +} + +type VersionURI string + +func init() { + t["versionURI"] = reflect.TypeOf((*VersionURI)(nil)).Elem() +} + +type VslmInfrastructureObjectPolicy struct { + DynamicData + + Name string `xml:"name"` + BackingObjectId string `xml:"backingObjectId"` + ProfileId string `xml:"profileId"` + Error *LocalizedMethodFault `xml:"error,omitempty"` +} + +func init() { + t["vslmInfrastructureObjectPolicy"] = reflect.TypeOf((*VslmInfrastructureObjectPolicy)(nil)).Elem() +} + +type VslmInfrastructureObjectPolicySpec struct { + DynamicData + + Datastore ManagedObjectReference `xml:"datastore"` + Profile []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` +} + +func init() { + t["vslmInfrastructureObjectPolicySpec"] = reflect.TypeOf((*VslmInfrastructureObjectPolicySpec)(nil)).Elem() +} diff --git a/vendor/golang.org/x/mobile/AUTHORS b/vendor/golang.org/x/mobile/AUTHORS new file mode 100644 index 000000000..15167cd74 --- /dev/null +++ b/vendor/golang.org/x/mobile/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/mobile/CONTRIBUTORS b/vendor/golang.org/x/mobile/CONTRIBUTORS new file mode 100644 index 000000000..1c4577e96 --- /dev/null +++ b/vendor/golang.org/x/mobile/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/mobile/LICENSE b/vendor/golang.org/x/mobile/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/mobile/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/mobile/PATENTS b/vendor/golang.org/x/mobile/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/mobile/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/mobile/event/key/code_string.go b/vendor/golang.org/x/mobile/event/key/code_string.go new file mode 100644 index 000000000..6af78b306 --- /dev/null +++ b/vendor/golang.org/x/mobile/event/key/code_string.go @@ -0,0 +1,60 @@ +// Code generated by "stringer -type=Code"; DO NOT EDIT + +package key + +import "fmt" + +const ( + _Code_name_0 = "CodeUnknown" + _Code_name_1 = "CodeACodeBCodeCCodeDCodeECodeFCodeGCodeHCodeICodeJCodeKCodeLCodeMCodeNCodeOCodePCodeQCodeRCodeSCodeTCodeUCodeVCodeWCodeXCodeYCodeZCode1Code2Code3Code4Code5Code6Code7Code8Code9Code0CodeReturnEnterCodeEscapeCodeDeleteBackspaceCodeTabCodeSpacebarCodeHyphenMinusCodeEqualSignCodeLeftSquareBracketCodeRightSquareBracketCodeBackslash" + _Code_name_2 = "CodeSemicolonCodeApostropheCodeGraveAccentCodeCommaCodeFullStopCodeSlashCodeCapsLockCodeF1CodeF2CodeF3CodeF4CodeF5CodeF6CodeF7CodeF8CodeF9CodeF10CodeF11CodeF12" + _Code_name_3 = "CodePauseCodeInsertCodeHomeCodePageUpCodeDeleteForwardCodeEndCodePageDownCodeRightArrowCodeLeftArrowCodeDownArrowCodeUpArrowCodeKeypadNumLockCodeKeypadSlashCodeKeypadAsteriskCodeKeypadHyphenMinusCodeKeypadPlusSignCodeKeypadEnterCodeKeypad1CodeKeypad2CodeKeypad3CodeKeypad4CodeKeypad5CodeKeypad6CodeKeypad7CodeKeypad8CodeKeypad9CodeKeypad0CodeKeypadFullStop" + _Code_name_4 = "CodeKeypadEqualSignCodeF13CodeF14CodeF15CodeF16CodeF17CodeF18CodeF19CodeF20CodeF21CodeF22CodeF23CodeF24" + _Code_name_5 = "CodeHelp" + _Code_name_6 = "CodeMuteCodeVolumeUpCodeVolumeDown" + _Code_name_7 = "CodeLeftControlCodeLeftShiftCodeLeftAltCodeLeftGUICodeRightControlCodeRightShiftCodeRightAltCodeRightGUI" + _Code_name_8 = "CodeCompose" +) + +var ( + _Code_index_0 = [...]uint8{0, 11} + _Code_index_1 = [...]uint16{0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 195, 205, 224, 231, 243, 258, 271, 292, 314, 327} + _Code_index_2 = [...]uint8{0, 13, 27, 42, 51, 63, 72, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 145, 152, 159} + _Code_index_3 = [...]uint16{0, 9, 19, 27, 37, 54, 61, 73, 87, 100, 113, 124, 141, 156, 174, 195, 213, 228, 239, 250, 261, 272, 283, 294, 305, 316, 327, 338, 356} + _Code_index_4 = [...]uint8{0, 19, 26, 33, 40, 47, 54, 61, 68, 75, 82, 89, 96, 103} + _Code_index_5 = [...]uint8{0, 8} + _Code_index_6 = [...]uint8{0, 8, 20, 34} + _Code_index_7 = [...]uint8{0, 15, 28, 39, 50, 66, 80, 92, 104} + _Code_index_8 = [...]uint8{0, 11} +) + +func (i Code) String() string { + switch { + case i == 0: + return _Code_name_0 + case 4 <= i && i <= 49: + i -= 4 + return _Code_name_1[_Code_index_1[i]:_Code_index_1[i+1]] + case 51 <= i && i <= 69: + i -= 51 + return _Code_name_2[_Code_index_2[i]:_Code_index_2[i+1]] + case 72 <= i && i <= 99: + i -= 72 + return _Code_name_3[_Code_index_3[i]:_Code_index_3[i+1]] + case 103 <= i && i <= 115: + i -= 103 + return _Code_name_4[_Code_index_4[i]:_Code_index_4[i+1]] + case i == 117: + return _Code_name_5 + case 127 <= i && i <= 129: + i -= 127 + return _Code_name_6[_Code_index_6[i]:_Code_index_6[i+1]] + case 224 <= i && i <= 231: + i -= 224 + return _Code_name_7[_Code_index_7[i]:_Code_index_7[i+1]] + case i == 65536: + return _Code_name_8 + default: + return fmt.Sprintf("Code(%d)", i) + } +} diff --git a/vendor/golang.org/x/mobile/event/key/key.go b/vendor/golang.org/x/mobile/event/key/key.go new file mode 100644 index 000000000..d70f1c343 --- /dev/null +++ b/vendor/golang.org/x/mobile/event/key/key.go @@ -0,0 +1,270 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:generate stringer -type=Code + +// Package key defines an event for physical keyboard keys. +// +// On-screen software keyboards do not send key events. +// +// See the golang.org/x/mobile/app package for details on the event model. +package key + +import ( + "fmt" + "strings" +) + +// Event is a key event. +type Event struct { + // Rune is the meaning of the key event as determined by the + // operating system. The mapping is determined by system-dependent + // current layout, modifiers, lock-states, etc. + // + // If non-negative, it is a Unicode codepoint: pressing the 'a' key + // generates different Runes 'a' or 'A' (but the same Code) depending on + // the state of the shift key. + // + // If -1, the key does not generate a Unicode codepoint. To distinguish + // them, look at Code. + Rune rune + + // Code is the identity of the physical key relative to a notional + // "standard" keyboard, independent of current layout, modifiers, + // lock-states, etc + // + // For standard key codes, its value matches USB HID key codes. + // Compare its value to uint32-typed constants in this package, such + // as CodeLeftShift and CodeEscape. + // + // Pressing the regular '2' key and number-pad '2' key (with Num-Lock) + // generate different Codes (but the same Rune). + Code Code + + // Modifiers is a bitmask representing a set of modifier keys: ModShift, + // ModAlt, etc. + Modifiers Modifiers + + // Direction is the direction of the key event: DirPress, DirRelease, + // or DirNone (for key repeats). + Direction Direction + + // TODO: add a Device ID, for multiple input devices? + // TODO: add a time.Time? +} + +func (e Event) String() string { + if e.Rune >= 0 { + return fmt.Sprintf("key.Event{%q (%v), %v, %v}", e.Rune, e.Code, e.Modifiers, e.Direction) + } + return fmt.Sprintf("key.Event{(%v), %v, %v}", e.Code, e.Modifiers, e.Direction) +} + +// Direction is the direction of the key event. +type Direction uint8 + +const ( + DirNone Direction = 0 + DirPress Direction = 1 + DirRelease Direction = 2 +) + +// Modifiers is a bitmask representing a set of modifier keys. +type Modifiers uint32 + +const ( + ModShift Modifiers = 1 << 0 + ModControl Modifiers = 1 << 1 + ModAlt Modifiers = 1 << 2 + ModMeta Modifiers = 1 << 3 // called "Command" on OS X +) + +// Code is the identity of a key relative to a notional "standard" keyboard. +type Code uint32 + +// Physical key codes. +// +// For standard key codes, its value matches USB HID key codes. +// TODO: add missing codes. +const ( + CodeUnknown Code = 0 + + CodeA Code = 4 + CodeB Code = 5 + CodeC Code = 6 + CodeD Code = 7 + CodeE Code = 8 + CodeF Code = 9 + CodeG Code = 10 + CodeH Code = 11 + CodeI Code = 12 + CodeJ Code = 13 + CodeK Code = 14 + CodeL Code = 15 + CodeM Code = 16 + CodeN Code = 17 + CodeO Code = 18 + CodeP Code = 19 + CodeQ Code = 20 + CodeR Code = 21 + CodeS Code = 22 + CodeT Code = 23 + CodeU Code = 24 + CodeV Code = 25 + CodeW Code = 26 + CodeX Code = 27 + CodeY Code = 28 + CodeZ Code = 29 + + Code1 Code = 30 + Code2 Code = 31 + Code3 Code = 32 + Code4 Code = 33 + Code5 Code = 34 + Code6 Code = 35 + Code7 Code = 36 + Code8 Code = 37 + Code9 Code = 38 + Code0 Code = 39 + + CodeReturnEnter Code = 40 + CodeEscape Code = 41 + CodeDeleteBackspace Code = 42 + CodeTab Code = 43 + CodeSpacebar Code = 44 + CodeHyphenMinus Code = 45 // - + CodeEqualSign Code = 46 // = + CodeLeftSquareBracket Code = 47 // [ + CodeRightSquareBracket Code = 48 // ] + CodeBackslash Code = 49 // \ + CodeSemicolon Code = 51 // ; + CodeApostrophe Code = 52 // ' + CodeGraveAccent Code = 53 // ` + CodeComma Code = 54 // , + CodeFullStop Code = 55 // . + CodeSlash Code = 56 // / + CodeCapsLock Code = 57 + + CodeF1 Code = 58 + CodeF2 Code = 59 + CodeF3 Code = 60 + CodeF4 Code = 61 + CodeF5 Code = 62 + CodeF6 Code = 63 + CodeF7 Code = 64 + CodeF8 Code = 65 + CodeF9 Code = 66 + CodeF10 Code = 67 + CodeF11 Code = 68 + CodeF12 Code = 69 + + CodePause Code = 72 + CodeInsert Code = 73 + CodeHome Code = 74 + CodePageUp Code = 75 + CodeDeleteForward Code = 76 + CodeEnd Code = 77 + CodePageDown Code = 78 + + CodeRightArrow Code = 79 + CodeLeftArrow Code = 80 + CodeDownArrow Code = 81 + CodeUpArrow Code = 82 + + CodeKeypadNumLock Code = 83 + CodeKeypadSlash Code = 84 // / + CodeKeypadAsterisk Code = 85 // * + CodeKeypadHyphenMinus Code = 86 // - + CodeKeypadPlusSign Code = 87 // + + CodeKeypadEnter Code = 88 + CodeKeypad1 Code = 89 + CodeKeypad2 Code = 90 + CodeKeypad3 Code = 91 + CodeKeypad4 Code = 92 + CodeKeypad5 Code = 93 + CodeKeypad6 Code = 94 + CodeKeypad7 Code = 95 + CodeKeypad8 Code = 96 + CodeKeypad9 Code = 97 + CodeKeypad0 Code = 98 + CodeKeypadFullStop Code = 99 // . + CodeKeypadEqualSign Code = 103 // = + + CodeF13 Code = 104 + CodeF14 Code = 105 + CodeF15 Code = 106 + CodeF16 Code = 107 + CodeF17 Code = 108 + CodeF18 Code = 109 + CodeF19 Code = 110 + CodeF20 Code = 111 + CodeF21 Code = 112 + CodeF22 Code = 113 + CodeF23 Code = 114 + CodeF24 Code = 115 + + CodeHelp Code = 117 + + CodeMute Code = 127 + CodeVolumeUp Code = 128 + CodeVolumeDown Code = 129 + + CodeLeftControl Code = 224 + CodeLeftShift Code = 225 + CodeLeftAlt Code = 226 + CodeLeftGUI Code = 227 + CodeRightControl Code = 228 + CodeRightShift Code = 229 + CodeRightAlt Code = 230 + CodeRightGUI Code = 231 + + // The following codes are not part of the standard USB HID Usage IDs for + // keyboards. See http://www.usb.org/developers/hidpage/Hut1_12v2.pdf + // + // Usage IDs are uint16s, so these non-standard values start at 0x10000. + + // CodeCompose is the Code for a compose key, sometimes called a multi key, + // used to input non-ASCII characters such as ñ being composed of n and ~. + // + // See https://en.wikipedia.org/wiki/Compose_key + CodeCompose Code = 0x10000 +) + +// TODO: Given we use runes outside the unicode space, should we provide a +// printing function? Related: it's a little unfortunate that printing a +// key.Event with %v gives not very readable output like: +// {100 7 key.Modifiers() Press} + +var mods = [...]struct { + m Modifiers + s string +}{ + {ModShift, "Shift"}, + {ModControl, "Control"}, + {ModAlt, "Alt"}, + {ModMeta, "Meta"}, +} + +func (m Modifiers) String() string { + var match []string + for _, mod := range mods { + if mod.m&m != 0 { + match = append(match, mod.s) + } + } + return "key.Modifiers(" + strings.Join(match, "|") + ")" +} + +func (d Direction) String() string { + switch d { + case DirNone: + return "None" + case DirPress: + return "Press" + case DirRelease: + return "Release" + default: + return fmt.Sprintf("key.Direction(%d)", d) + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index fdb69eaed..8167e4b34 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -544,10 +544,11 @@ github.com/ulikunitz/xz github.com/ulikunitz/xz/internal/hash github.com/ulikunitz/xz/internal/xlog github.com/ulikunitz/xz/lzma -# github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 +# github.com/vmware/govmomi v0.21.0 github.com/vmware/govmomi github.com/vmware/govmomi/find github.com/vmware/govmomi/list +github.com/vmware/govmomi/nfc github.com/vmware/govmomi/object github.com/vmware/govmomi/property github.com/vmware/govmomi/session @@ -664,6 +665,8 @@ golang.org/x/exp/cmd/apidiff # golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f golang.org/x/lint golang.org/x/lint/golint +# golang.org/x/mobile v0.0.0-20191130191448-5c0e7e404af8 +golang.org/x/mobile/event/key # golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 golang.org/x/net/context golang.org/x/net/context/ctxhttp From 6a2d73a0e99decdc9d7d6786c755f89107b81203 Mon Sep 17 00:00:00 2001 From: Moss <moss@hashicorp.com> Date: Wed, 8 Jan 2020 15:28:26 -0800 Subject: [PATCH 262/266] Add missing doc variable description --- builder/vsphere/iso/step_create.go | 3 ++- .../builder/vsphere/iso/_CreateConfig-not-required.html.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/vsphere/iso/step_create.go b/builder/vsphere/iso/step_create.go index 41eca92c8..b6e80aacf 100644 --- a/builder/vsphere/iso/step_create.go +++ b/builder/vsphere/iso/step_create.go @@ -6,6 +6,7 @@ package iso import ( "context" "fmt" + "github.com/hashicorp/packer/builder/vsphere/common" "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/multistep" @@ -30,7 +31,7 @@ type CreateConfig struct { DiskSize int64 `mapstructure:"disk_size"` // Enable VMDK thin provisioning for VM. Defaults to `false`. DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` - + // Set network VM will be connected to. Network string `mapstructure:"network"` // Set VM network card type. Example `vmxnet3`. NetworkCard string `mapstructure:"network_card"` diff --git a/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md b/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md index a9cd1ff2f..09e632ee9 100644 --- a/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md +++ b/website/source/partials/builder/vsphere/iso/_CreateConfig-not-required.html.md @@ -17,7 +17,8 @@ - `disk_thin_provisioned` (bool) - Enable VMDK thin provisioning for VM. Defaults to `false`. -- `network` (string) - Network +- `network` (string) - Set network VM will be connected to. + - `network_card` (string) - Set VM network card type. Example `vmxnet3`. - `usb_controller` (bool) - Create USB controller for virtual machine. Defaults to `false`. From f84634aff3d6f28a17430c19305c74e39048d13e Mon Sep 17 00:00:00 2001 From: Megan Marsh <megan@hashicorp.com> Date: Mon, 13 Jan 2020 11:43:02 -0800 Subject: [PATCH 263/266] small log line improvements --- builder/vsphere/iso/step_add_cdrom.go | 2 +- builder/vsphere/iso/step_remote_upload.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/vsphere/iso/step_add_cdrom.go b/builder/vsphere/iso/step_add_cdrom.go index 6838e5209..f5742c0f8 100644 --- a/builder/vsphere/iso/step_add_cdrom.go +++ b/builder/vsphere/iso/step_add_cdrom.go @@ -47,7 +47,7 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste } } - ui.Say("Mount ISO images...") + ui.Say("Mounting ISO images...") if len(s.Config.ISOPaths) > 0 { for _, path := range s.Config.ISOPaths { if err := vm.AddCdrom(s.Config.CdromType, path); err != nil { diff --git a/builder/vsphere/iso/step_remote_upload.go b/builder/vsphere/iso/step_remote_upload.go index 398a25b11..ac395a66b 100644 --- a/builder/vsphere/iso/step_remote_upload.go +++ b/builder/vsphere/iso/step_remote_upload.go @@ -34,7 +34,7 @@ func (s *StepRemoteUpload) Run(_ context.Context, state multistep.StateBag) mult ui.Say(fmt.Sprintf("Uploading %s to %s", filename, remotePath)) if exists := ds.FileExists(remotePath); exists == true { - ui.Say("File already upload") + ui.Say("File already uploaded; continuing") state.Put("iso_remote_path", fullRemotePath) return multistep.ActionContinue } From 9459e2233bd37aebf44e1c953223d8a1b32eb962 Mon Sep 17 00:00:00 2001 From: Megan Marsh <megan@hashicorp.com> Date: Mon, 13 Jan 2020 11:51:36 -0800 Subject: [PATCH 264/266] fix config loading to work with HCL2 --- builder/vsphere/iso/builder.go | 3 +-- builder/vsphere/iso/config.go | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/builder/vsphere/iso/builder.go b/builder/vsphere/iso/builder.go index 0cae03611..7c809a746 100644 --- a/builder/vsphere/iso/builder.go +++ b/builder/vsphere/iso/builder.go @@ -19,11 +19,10 @@ type Builder struct { func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { - c, warnings, errs := NewConfig(raws...) + warnings, errs := b.config.Prepare() if errs != nil { return warnings, nil, errs } - b.config = c return warnings, nil, nil } diff --git a/builder/vsphere/iso/config.go b/builder/vsphere/iso/config.go index e5c060519..dd04c8052 100644 --- a/builder/vsphere/iso/config.go +++ b/builder/vsphere/iso/config.go @@ -38,8 +38,7 @@ type Config struct { ctx interpolate.Context } -func NewConfig(raws ...interface{}) (*Config, []string, error) { - c := new(Config) +func (c *Config) Prepare(raws ...interface{}) ([]string, error) { err := config.Decode(c, &config.DecodeOpts{ Interpolate: true, InterpolateContext: &c.ctx, @@ -50,7 +49,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { }, }, raws...) if err != nil { - return nil, nil, err + return nil, err } warnings := make([]string, 0) @@ -75,8 +74,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) if len(errs.Errors) > 0 { - return nil, nil, errs + return nil, errs } - return c, nil, nil + return nil, nil } From dfb45e86ccf50ba57f2c0f3422bc4e5bff0f7831 Mon Sep 17 00:00:00 2001 From: Megan Marsh <megan@hashicorp.com> Date: Mon, 13 Jan 2020 12:33:56 -0800 Subject: [PATCH 265/266] remove unused file, set up prepare() properly to work with HCL2 in vsphere-clone builder --- .idea/dictionaries/project.xml | 20 -------------------- builder/vsphere/clone/builder.go | 6 ++---- builder/vsphere/clone/config.go | 9 ++++----- builder/vsphere/iso/builder.go | 3 +-- 4 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 .idea/dictionaries/project.xml diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml deleted file mode 100644 index f77b8be28..000000000 --- a/.idea/dictionaries/project.xml +++ /dev/null @@ -1,20 +0,0 @@ -<component name="ProjectDictionaryState"> - <dictionary name="project"> - <words> - <w>abcdefghijklmnopqrstuvwxyz</w> - <w>cdrom</w> - <w>cdroms</w> - <w>datastore</w> - <w>datastores</w> - <w>esxi</w> - <w>hashicorp</w> - <w>mozilla</w> - <w>sata</w> - <w>scancode</w> - <w>vcenter</w> - <w>vmware</w> - <w>vmxnet</w> - <w>vsphere</w> - </words> - </dictionary> -</component> diff --git a/builder/vsphere/clone/builder.go b/builder/vsphere/clone/builder.go index 48e1681c0..4c33f76aa 100644 --- a/builder/vsphere/clone/builder.go +++ b/builder/vsphere/clone/builder.go @@ -12,25 +12,23 @@ import ( ) type Builder struct { - config *Config + config Config runner multistep.Runner } func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { - c, warnings, errs := NewConfig(raws...) + warnings, errs := b.config.Prepare() if errs != nil { return warnings, nil, errs } - b.config = c return warnings, nil, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) - state.Put("comm", &b.config.Comm) state.Put("hook", hook) state.Put("ui", ui) diff --git a/builder/vsphere/clone/config.go b/builder/vsphere/clone/config.go index f03685a82..a473301be 100644 --- a/builder/vsphere/clone/config.go +++ b/builder/vsphere/clone/config.go @@ -35,14 +35,13 @@ type Config struct { ctx interpolate.Context } -func NewConfig(raws ...interface{}) (*Config, []string, error) { - c := new(Config) +func (c *Config) Prepare(raws ...interface{}) ([]string, error) { err := config.Decode(c, &config.DecodeOpts{ Interpolate: true, InterpolateContext: &c.ctx, }, raws...) if err != nil { - return nil, nil, err + return nil, err } errs := new(packer.MultiError) @@ -56,8 +55,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) if len(errs.Errors) > 0 { - return nil, nil, errs + return nil, errs } - return c, nil, nil + return nil, nil } diff --git a/builder/vsphere/iso/builder.go b/builder/vsphere/iso/builder.go index 7c809a746..5c33d10f6 100644 --- a/builder/vsphere/iso/builder.go +++ b/builder/vsphere/iso/builder.go @@ -12,7 +12,7 @@ import ( ) type Builder struct { - config *Config + config Config runner multistep.Runner } @@ -29,7 +29,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) - state.Put("comm", &b.config.Comm) state.Put("hook", hook) state.Put("ui", ui) From 82f03fca7ca41533012608b074a3bf398772333d Mon Sep 17 00:00:00 2001 From: Megan Marsh <megan@hashicorp.com> Date: Mon, 13 Jan 2020 15:52:05 -0800 Subject: [PATCH 266/266] fix to work with hcl2; update tests --- builder/vsphere/clone/builder.go | 6 +++--- builder/vsphere/clone/config_test.go | 12 ++++++++---- builder/vsphere/iso/builder.go | 7 ++++--- builder/vsphere/iso/config.go | 4 ++-- helper/config/decode.go | 5 +++++ 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/builder/vsphere/clone/builder.go b/builder/vsphere/clone/builder.go index 4c33f76aa..8eb7a2e2a 100644 --- a/builder/vsphere/clone/builder.go +++ b/builder/vsphere/clone/builder.go @@ -19,12 +19,12 @@ type Builder struct { func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { - warnings, errs := b.config.Prepare() + warnings, errs := b.config.Prepare(raws...) if errs != nil { - return warnings, nil, errs + return nil, warnings, errs } - return warnings, nil, nil + return nil, warnings, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { diff --git a/builder/vsphere/clone/config_test.go b/builder/vsphere/clone/config_test.go index a7de982c7..a1da7013d 100644 --- a/builder/vsphere/clone/config_test.go +++ b/builder/vsphere/clone/config_test.go @@ -6,7 +6,8 @@ import ( ) func TestCloneConfig_MinimalConfig(t *testing.T) { - _, warns, errs := NewConfig(minimalConfig()) + c := new(Config) + warns, errs := c.Prepare(minimalConfig()) testConfigOk(t, warns, errs) } @@ -15,7 +16,8 @@ func TestCloneConfig_MandatoryParameters(t *testing.T) { for _, param := range params { raw := minimalConfig() raw[param] = "" - _, warns, err := NewConfig(raw) + c := new(Config) + warns, err := c.Prepare(raw) testConfigErr(t, param, warns, err) } } @@ -23,7 +25,8 @@ func TestCloneConfig_MandatoryParameters(t *testing.T) { func TestCloneConfig_Timeout(t *testing.T) { raw := minimalConfig() raw["shutdown_timeout"] = "3m" - conf, warns, err := NewConfig(raw) + conf := new(Config) + warns, err := conf.Prepare(raw) testConfigOk(t, warns, err) if conf.ShutdownConfig.Timeout != 3*time.Minute { t.Fatalf("shutdown_timeout sould be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout) @@ -34,7 +37,8 @@ func TestCloneConfig_RAMReservation(t *testing.T) { raw := minimalConfig() raw["RAM_reservation"] = 1000 raw["RAM_reserve_all"] = true - _, warns, err := NewConfig(raw) + c := new(Config) + warns, err := c.Prepare(raw) testConfigErr(t, "RAM_reservation", warns, err) } diff --git a/builder/vsphere/iso/builder.go b/builder/vsphere/iso/builder.go index 5c33d10f6..d1882fa26 100644 --- a/builder/vsphere/iso/builder.go +++ b/builder/vsphere/iso/builder.go @@ -2,6 +2,7 @@ package iso import ( "context" + "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/builder/vsphere/common" "github.com/hashicorp/packer/builder/vsphere/driver" @@ -19,12 +20,12 @@ type Builder struct { func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { - warnings, errs := b.config.Prepare() + warnings, errs := b.config.Prepare(raws...) if errs != nil { - return warnings, nil, errs + return nil, warnings, errs } - return warnings, nil, nil + return nil, warnings, nil } func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { diff --git a/builder/vsphere/iso/config.go b/builder/vsphere/iso/config.go index dd04c8052..e3c297fa4 100644 --- a/builder/vsphere/iso/config.go +++ b/builder/vsphere/iso/config.go @@ -74,8 +74,8 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) { errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare()...) if len(errs.Errors) > 0 { - return nil, errs + return warnings, errs } - return nil, nil + return warnings, nil } diff --git a/helper/config/decode.go b/helper/config/decode.go index 5205bf266..ba022e7e3 100644 --- a/helper/config/decode.go +++ b/helper/config/decode.go @@ -3,6 +3,7 @@ package config import ( "encoding/json" "fmt" + "log" "reflect" "sort" "strings" @@ -158,6 +159,9 @@ func DetectContextData(raws ...interface{}) (map[interface{}]interface{}, []inte // In provisioners, the last value pulled from raws is the placeholder data // for build-specific variables. Pull these out to add to interpolation // context. + if len(raws) == 0 { + return nil, raws + } // Internally, our tests may cause this to be read as a map[string]string placeholderData := raws[len(raws)-1] @@ -201,6 +205,7 @@ func DetectContext(raws ...interface{}) (*interpolate.Context, error) { for _, r := range raws { if err := mapstructure.Decode(r, &s); err != nil { + log.Printf("Error detecting context: %s", err) return nil, err } }