mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-25 19:05:13 +00:00
godeps: update vmware/govmomi to v0.20 release
This commit is contained in:
35
vendor/github.com/vmware/govmomi/simulator/folder.go
generated
vendored
35
vendor/github.com/vmware/govmomi/simulator/folder.go
generated
vendored
@@ -23,7 +23,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/vim25/methods"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
@@ -177,6 +177,9 @@ func (f *Folder) CreateStoragePod(c *types.CreateStoragePod) soap.HasFault {
|
||||
|
||||
pod.Name = c.Name
|
||||
pod.ChildType = []string{"Datastore"}
|
||||
pod.Summary = new(types.StoragePodSummary)
|
||||
pod.PodStorageDrsEntry = new(types.PodStorageDrsEntry)
|
||||
pod.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Enabled = true
|
||||
|
||||
f.putChild(pod)
|
||||
|
||||
@@ -191,7 +194,10 @@ func (f *Folder) CreateStoragePod(c *types.CreateStoragePod) soap.HasFault {
|
||||
}
|
||||
|
||||
func (p *StoragePod) MoveIntoFolderTask(c *types.MoveIntoFolder_Task) soap.HasFault {
|
||||
return (&Folder{Folder: p.Folder}).MoveIntoFolderTask(c)
|
||||
f := &Folder{Folder: p.Folder}
|
||||
res := f.MoveIntoFolderTask(c)
|
||||
p.ChildEntity = append(p.ChildEntity, f.ChildEntity...)
|
||||
return res
|
||||
}
|
||||
|
||||
func (f *Folder) CreateDatacenter(ctx *Context, c *types.CreateDatacenter) soap.HasFault {
|
||||
@@ -250,9 +256,26 @@ type createVM struct {
|
||||
register bool
|
||||
}
|
||||
|
||||
// hostsWithDatastore returns hosts that have access to the given datastore path
|
||||
func hostsWithDatastore(hosts []types.ManagedObjectReference, path string) []types.ManagedObjectReference {
|
||||
attached := hosts[:0]
|
||||
var p object.DatastorePath
|
||||
p.FromString(path)
|
||||
|
||||
for _, host := range hosts {
|
||||
h := Map.Get(host).(*HostSystem)
|
||||
if Map.FindByName(p.Datastore, h.Datastore) != nil {
|
||||
attached = append(attached, host)
|
||||
}
|
||||
}
|
||||
|
||||
return attached
|
||||
}
|
||||
|
||||
func (c *createVM) Run(task *Task) (types.AnyType, types.BaseMethodFault) {
|
||||
vm, err := NewVirtualMachine(c.Folder.Self, &c.req.Config)
|
||||
if err != nil {
|
||||
c.Folder.removeChild(vm)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -270,7 +293,7 @@ func (c *createVM) Run(task *Task) (types.AnyType, types.BaseMethodFault) {
|
||||
hosts = cr.Host
|
||||
}
|
||||
|
||||
// Assuming for now that all hosts have access to the datastore
|
||||
hosts = hostsWithDatastore(hosts, c.req.Config.Files.VmPathName)
|
||||
host := hosts[rand.Intn(len(hosts))]
|
||||
vm.Runtime.Host = &host
|
||||
} else {
|
||||
@@ -290,13 +313,13 @@ func (c *createVM) Run(task *Task) (types.AnyType, types.BaseMethodFault) {
|
||||
|
||||
err = vm.create(&c.req.Config, c.register)
|
||||
if err != nil {
|
||||
c.Folder.removeChild(vm)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.Folder.putChild(vm)
|
||||
|
||||
host := Map.Get(*vm.Runtime.Host).(*HostSystem)
|
||||
Map.AppendReference(host, &host.Vm, vm.Self)
|
||||
vm.EnvironmentBrowser = *hostParent(&host.HostSystem).EnvironmentBrowser
|
||||
|
||||
for i := range vm.Datastore {
|
||||
ds := Map.Get(vm.Datastore[i]).(*Datastore)
|
||||
@@ -333,6 +356,8 @@ func (c *createVM) Run(task *Task) (types.AnyType, types.BaseMethodFault) {
|
||||
},
|
||||
)
|
||||
|
||||
vm.RefreshStorageInfo(c.ctx, nil)
|
||||
|
||||
return vm.Reference(), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user