Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
87e7535e
Commit
87e7535e
authored
Jul 18, 2016
by
Abrar Shivani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Updated vmware/govmomi godep (Needs for vsan support)
- Fix unmount for vsanDatastore - Add support for vsan datastore
parent
2301ab7e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
658 additions
and
200 deletions
+658
-200
Godeps.json
Godeps/Godeps.json
+30
-30
vsphere.go
pkg/cloudprovider/providers/vsphere/vsphere.go
+100
-35
vsphere_volume.go
pkg/volume/vsphere_volume/vsphere_volume.go
+4
-2
CHANGELOG.md
vendor/github.com/vmware/govmomi/CHANGELOG.md
+30
-0
CONTRIBUTING.md
vendor/github.com/vmware/govmomi/CONTRIBUTING.md
+3
-4
CONTRIBUTORS
vendor/github.com/vmware/govmomi/CONTRIBUTORS
+4
-2
Makefile
vendor/github.com/vmware/govmomi/Makefile
+4
-8
finder.go
vendor/github.com/vmware/govmomi/find/finder.go
+47
-2
cluster_compute_resource.go
...hub.com/vmware/govmomi/object/cluster_compute_resource.go
+0
-2
common.go
vendor/github.com/vmware/govmomi/object/common.go
+41
-1
compute_resource.go
vendor/github.com/vmware/govmomi/object/compute_resource.go
+0
-2
datastore.go
vendor/github.com/vmware/govmomi/object/datastore.go
+42
-7
distributed_virtual_portgroup.go
...om/vmware/govmomi/object/distributed_virtual_portgroup.go
+0
-7
distributed_virtual_switch.go
...b.com/vmware/govmomi/object/distributed_virtual_switch.go
+0
-2
folder.go
vendor/github.com/vmware/govmomi/object/folder.go
+14
-2
host_config_manager.go
...r/github.com/vmware/govmomi/object/host_config_manager.go
+11
-0
host_datastore_system.go
...github.com/vmware/govmomi/object/host_datastore_system.go
+15
-0
host_service_system.go
...r/github.com/vmware/govmomi/object/host_service_system.go
+87
-0
host_storage_system.go
...r/github.com/vmware/govmomi/object/host_storage_system.go
+65
-0
host_system.go
vendor/github.com/vmware/govmomi/object/host_system.go
+0
-20
namespace_manager.go
vendor/github.com/vmware/govmomi/object/namespace_manager.go
+75
-0
network.go
vendor/github.com/vmware/govmomi/object/network.go
+0
-8
resource_pool.go
vendor/github.com/vmware/govmomi/object/resource_pool.go
+0
-23
virtual_app.go
vendor/github.com/vmware/govmomi/object/virtual_app.go
+0
-21
virtual_disk_manager.go
.../github.com/vmware/govmomi/object/virtual_disk_manager.go
+24
-0
virtual_machine.go
vendor/github.com/vmware/govmomi/object/virtual_machine.go
+0
-21
manager.go
vendor/github.com/vmware/govmomi/session/manager.go
+14
-0
ancestors.go
vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go
+20
-0
extra.go
vendor/github.com/vmware/govmomi/vim25/mo/extra.go
+4
-0
soap.go
vendor/github.com/vmware/govmomi/vim25/soap/soap.go
+1
-1
helpers.go
vendor/github.com/vmware/govmomi/vim25/types/helpers.go
+23
-0
No files found.
Godeps/Godeps.json
View file @
87e7535e
...
...
@@ -2015,78 +2015,78 @@
},
{
"ImportPath"
:
"github.com/vmware/govmomi"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/find"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/list"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/object"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/property"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/session"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/task"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/debug"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/methods"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/mo"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/progress"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/soap"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/types"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/vmware/govmomi/vim25/xml"
,
"Comment"
:
"v0.
6.2
"
,
"Rev"
:
"
9051bd6b44125d9472e0c148b5965692ab283d4a
"
"Comment"
:
"v0.
8.0-9-gb5ee639
"
,
"Rev"
:
"
b5ee639d7aa4b8dbb48ab4f75dddc19f71b5c514
"
},
{
"ImportPath"
:
"github.com/xiang90/probing"
,
...
...
pkg/cloudprovider/providers/vsphere/vsphere.go
View file @
87e7535e
This diff is collapsed.
Click to expand it.
pkg/volume/vsphere_volume/vsphere_volume.go
View file @
87e7535e
...
...
@@ -292,11 +292,13 @@ func (v *vsphereVolumeUnmounter) TearDownAt(dir string) error {
return
fmt
.
Errorf
(
"directory %s is not mounted"
,
dir
)
}
mountPath
:=
refs
[
0
]
// Assumption: No file or folder is named starting with '[' in datastore
volumePath
:=
mountPath
[
strings
.
LastIndex
(
mountPath
,
"["
)
:
]
// space between datastore and vmdk name in volumePath is encoded as '\040' when returned by GetMountRefs().
// volumePath eg: "[local] xxx.vmdk" provided to attach/mount
// replacing \040 with space to match the actual volumePath
mountPath
:=
strings
.
Replace
(
path
.
Base
(
refs
[
0
]),
"
\\
040"
,
" "
,
-
1
)
v
.
volPath
=
mountPath
v
.
volPath
=
strings
.
Replace
(
volumePath
,
"
\\
040"
,
" "
,
-
1
)
glog
.
V
(
4
)
.
Infof
(
"Found volume %s mounted to %s"
,
v
.
volPath
,
dir
)
// Reload list of references, there might be SetUpAt finished in the meantime
...
...
vendor/github.com/vmware/govmomi/CHANGELOG.md
View file @
87e7535e
# changelog
### 0.8.0 (2016-06-30)
*
Add session.Manager.AcquireLocalTicket
*
Include StoragePod in Finder.FolderList
*
Add Finder methods for finding by ManagedObjectReference: Element, ObjectReference
*
Add mo.ManagedObjectReference methods: Reference, String, FromString
*
Add support using SessionManagerGenericServiceTicket.HostName for Datastore HTTP access
### 0.7.1 (2016-06-03)
*
Fix object.ObjectName method
### 0.7.0 (2016-06-02)
*
Move InventoryPath field to object.Common
*
Add HostDatastoreSystem.CreateLocalDatastore method
*
Add DatastoreNamespaceManager methods: CreateDirectory, DeleteDirectory
*
Add HostServiceSystem
*
Add HostStorageSystem methods: MarkAsSdd, MarkAsNonSdd, MarkAsLocal, MarkAsNonLocal
*
Add HostStorageSystem.RescanAllHba method
### 0.6.2 (2016-05-11)
*
Get complete file details in Datastore.Stat
...
...
vendor/github.com/vmware/govmomi/CONTRIBUTING.md
View file @
87e7535e
...
...
@@ -9,10 +9,8 @@ Change _$USER_ below to your github username if they are not the same.
```
shell
export
GOPATH
=
$HOME
/govmomi
mkdir
-p
$GOPATH
/src/github.com/vmware
cd
$GOPATH
/src/github.com/vmware
git clone git@github.com:vmware/govmomi.git
cd
govmomi
go get github.com/vmware/govmomi
cd
$GOPATH
/src/github.com/vmware/govmomi
git config push.default nothing
# anything to avoid pushing to vmware/govmomi by default
git remote rename origin vmware
git remote add
$USER
git@github.com:
$USER
/govmomi.git
...
...
@@ -26,6 +24,7 @@ This is a rough outline of what a contributor's workflow looks like:
-
Create a topic branch from where you want to base your work.
-
Make commits of logical units.
-
Make sure your commit messages are in the proper format (see below).
-
Update CHANGELOG.md and/or govc/CHANGELOG.md when appropriate.
-
Push your changes to a topic branch in your fork of the repository.
-
Submit a pull request to vmware/govmomi.
...
...
vendor/github.com/vmware/govmomi/CONTRIBUTORS
View file @
87e7535e
...
...
@@ -10,10 +10,12 @@ Arran Walker <arran.walker@zopa.com>
Austin Parker <aparker@apprenda.com>
Bob Killen <killen.bob@gmail.com>
Bruce Downs <bdowns@vmware.com>
Clint Greenwood <cgreenwood@vmware.com> <clint.greenwood@gmail.com>
Cédric Blomart <cblomart@gmail.com>
Christian Höltje <docwhat@gerf.org>
Clint Greenwood <cgreenwood@vmware.com> <clint.greenwood@gmail.com>
Danny Lockard <danny.lockard@banno.com>
Dave Tucker <dave@dtucker.co.uk>
David Stark <dave@davidstark.name>
Doug MacEachern <dougm@vmware.com>
Eloy Coto <eloy.coto@gmail.com>
Eric Yutao <eric.yutao@gmail.com>
...
...
@@ -31,8 +33,8 @@ Pieter Noordhuis <pnoordhuis@vmware.com> <pcnoordhuis@gmail.com>
runner.mei <runner.mei@gmail.com>
S.Çağlar Onur <conur@vmware.com>
Sergey Ignatov <sergey.ignatov@jetbrains.com>
Takaaki Furukawa <takaaki.frkw@gmail.com> <takaaki.furukawa@mail.rakuten.com>
Steve Purcell <steve@sanityinc.com>
Takaaki Furukawa <takaaki.frkw@gmail.com> <takaaki.furukawa@mail.rakuten.com>
Yang Yang <yangy@vmware.com>
Yuya Kusakabe <yuya.kusakabe@gmail.com>
Zach Tucker <ztucker@vmware.com>
...
...
vendor/github.com/vmware/govmomi/Makefile
View file @
87e7535e
...
...
@@ -4,21 +4,17 @@ all: check test
check
:
goimports govet
vendor
:
go get golang.org/x/tools/cmd/goimports
go get github.com/davecgh/go-spew/spew
go get golang.org/x/net/context
goimports
:
vendor
goimports
:
@
echo
checking go imports...
@
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
.
test
:
vendor
test
:
go
test
-v
$(TEST_OPTS)
./...
install
:
vendor
install
:
go
install
github.com/vmware/govmomi/govc
vendor/github.com/vmware/govmomi/find/finder.go
View file @
87e7535e
...
...
@@ -25,6 +25,7 @@ import (
"github.com/vmware/govmomi/property"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"
)
...
...
@@ -192,6 +193,48 @@ func (f *Finder) managedObjectList(ctx context.Context, path string, tl bool) ([
return
f
.
find
(
ctx
,
fn
,
tl
,
path
)
}
// Element returns an Element for the given ManagedObjectReference
// This method is only useful for looking up the InventoryPath of a ManagedObjectReference.
func
(
f
*
Finder
)
Element
(
ctx
context
.
Context
,
ref
types
.
ManagedObjectReference
)
(
*
list
.
Element
,
error
)
{
rl
:=
func
(
_
context
.
Context
)
(
object
.
Reference
,
error
)
{
return
ref
,
nil
}
e
,
err
:=
f
.
find
(
ctx
,
rl
,
false
,
"."
)
if
err
!=
nil
{
return
nil
,
err
}
if
len
(
e
)
==
0
{
return
nil
,
&
NotFoundError
{
ref
.
Type
,
ref
.
Value
}
}
if
len
(
e
)
>
1
{
panic
(
"ManagedObjectReference must be unique"
)
}
return
&
e
[
0
],
nil
}
// ObjectReference converts the given ManagedObjectReference to a type from the object package via object.NewReference
// with the object.Common.InventoryPath field set.
func
(
f
*
Finder
)
ObjectReference
(
ctx
context
.
Context
,
ref
types
.
ManagedObjectReference
)
(
object
.
Reference
,
error
)
{
e
,
err
:=
f
.
Element
(
ctx
,
ref
)
if
err
!=
nil
{
return
nil
,
err
}
r
:=
object
.
NewReference
(
f
.
client
,
ref
)
type
common
interface
{
SetInventoryPath
(
string
)
}
r
.
(
common
)
.
SetInventoryPath
(
e
.
Path
)
return
r
,
nil
}
func
(
f
*
Finder
)
ManagedObjectList
(
ctx
context
.
Context
,
path
string
)
([]
list
.
Element
,
error
)
{
return
f
.
managedObjectList
(
ctx
,
path
,
false
)
}
...
...
@@ -210,7 +253,9 @@ func (f *Finder) DatacenterList(ctx context.Context, path string) ([]*object.Dat
for
_
,
e
:=
range
es
{
ref
:=
e
.
Object
.
Reference
()
if
ref
.
Type
==
"Datacenter"
{
dcs
=
append
(
dcs
,
object
.
NewDatacenter
(
f
.
client
,
ref
))
dc
:=
object
.
NewDatacenter
(
f
.
client
,
ref
)
dc
.
InventoryPath
=
e
.
Path
dcs
=
append
(
dcs
,
dc
)
}
}
...
...
@@ -772,7 +817,7 @@ func (f *Finder) FolderList(ctx context.Context, path string) ([]*object.Folder,
for
_
,
e
:=
range
es
{
switch
o
:=
e
.
Object
.
(
type
)
{
case
mo
.
Folder
:
case
mo
.
Folder
,
mo
.
StoragePod
:
folder
:=
object
.
NewFolder
(
f
.
client
,
o
.
Reference
())
folder
.
InventoryPath
=
e
.
Path
folders
=
append
(
folders
,
folder
)
...
...
vendor/github.com/vmware/govmomi/object/cluster_compute_resource.go
View file @
87e7535e
...
...
@@ -25,8 +25,6 @@ import (
type
ClusterComputeResource
struct
{
ComputeResource
InventoryPath
string
}
func
NewClusterComputeResource
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
ClusterComputeResource
{
...
...
vendor/github.com/vmware/govmomi/object/common.go
View file @
87e7535e
...
...
@@ -19,10 +19,12 @@ package object
import
(
"errors"
"fmt"
"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/types"
"golang.org/x/net/context"
)
...
...
@@ -33,12 +35,20 @@ var (
// Common contains the fields and functions common to all objects.
type
Common
struct
{
InventoryPath
string
c
*
vim25
.
Client
r
types
.
ManagedObjectReference
}
func
(
c
Common
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
c
.
Reference
())
ref
:=
fmt
.
Sprintf
(
"%v"
,
c
.
Reference
())
if
c
.
InventoryPath
==
""
{
return
ref
}
return
fmt
.
Sprintf
(
"%s @ %s"
,
ref
,
c
.
InventoryPath
)
}
func
NewCommon
(
c
*
vim25
.
Client
,
r
types
.
ManagedObjectReference
)
Common
{
...
...
@@ -53,6 +63,36 @@ func (c Common) Client() *vim25.Client {
return
c
.
c
}
// Name returns the base name of the InventoryPath field
func
(
c
Common
)
Name
()
string
{
if
c
.
InventoryPath
==
""
{
return
""
}
return
path
.
Base
(
c
.
InventoryPath
)
}
func
(
c
*
Common
)
SetInventoryPath
(
p
string
)
{
c
.
InventoryPath
=
p
}
// ObjectName returns the base name of the InventoryPath field if set,
// otherwise fetches the mo.ManagedEntity.Name field via the property collector.
func
(
c
Common
)
ObjectName
(
ctx
context
.
Context
)
(
string
,
error
)
{
var
o
mo
.
ManagedEntity
name
:=
c
.
Name
()
if
name
!=
""
{
return
name
,
nil
}
err
:=
c
.
Properties
(
ctx
,
c
.
Reference
(),
[]
string
{
"name"
},
&
o
)
if
err
!=
nil
{
return
""
,
err
}
return
o
.
Name
,
nil
}
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
)
}
...
...
vendor/github.com/vmware/govmomi/object/compute_resource.go
View file @
87e7535e
...
...
@@ -29,8 +29,6 @@ import (
type
ComputeResource
struct
{
Common
InventoryPath
string
}
func
NewComputeResource
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
ComputeResource
{
...
...
vendor/github.com/vmware/govmomi/object/datastore.go
View file @
87e7535e
...
...
@@ -20,6 +20,7 @@ import (
"fmt"
"io"
"math/rand"
"os"
"path"
"strings"
...
...
@@ -57,8 +58,6 @@ func (e DatastoreNoSuchFileError) Error() string {
type
Datastore
struct
{
Common
InventoryPath
string
}
func
NewDatastore
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
Datastore
{
...
...
@@ -67,10 +66,6 @@ func NewDatastore(c *vim25.Client, ref types.ManagedObjectReference) *Datastore
}
}
func
(
d
Datastore
)
Name
()
string
{
return
path
.
Base
(
d
.
InventoryPath
)
}
func
(
d
Datastore
)
Path
(
path
string
)
string
{
name
:=
d
.
Name
()
if
name
==
""
{
...
...
@@ -116,6 +111,42 @@ func (d Datastore) Browser(ctx context.Context) (*HostDatastoreBrowser, error) {
return
NewHostDatastoreBrowser
(
d
.
c
,
do
.
Browser
),
nil
}
func
(
d
Datastore
)
useServiceTicketHostName
(
name
string
)
bool
{
// No need if talking directly to ESX.
if
!
d
.
c
.
IsVC
()
{
return
false
}
// If version happens to be < 5.1
if
name
==
""
{
return
false
}
// If the HostSystem is using DHCP on a network without dynamic DNS,
// HostSystem.Config.Network.DnsConfig.HostName is set to "localhost" by default.
// This resolves to "localhost.localdomain" by default via /etc/hosts on ESX.
// In that case, we will stick with the HostSystem.Name which is the IP address that
// was used to connect the host to VC.
if
name
==
"localhost.localdomain"
{
return
false
}
// Still possible to have HostName that don't resolve via DNS,
// so we default to false.
key
:=
"GOVMOMI_USE_SERVICE_TICKET_HOSTNAME"
val
:=
d
.
c
.
URL
()
.
Query
()
.
Get
(
key
)
if
val
==
""
{
val
=
os
.
Getenv
(
key
)
}
if
val
==
"1"
||
val
==
"true"
{
return
true
}
return
false
}
// ServiceTicket obtains a ticket via AcquireGenericServiceTicket and returns it an http.Cookie with the url.URL
// that can be used along with the ticket cookie to access the given path.
func
(
d
Datastore
)
ServiceTicket
(
ctx
context
.
Context
,
path
string
,
method
string
)
(
*
url
.
URL
,
*
http
.
Cookie
,
error
)
{
...
...
@@ -142,7 +173,7 @@ func (d Datastore) ServiceTicket(ctx context.Context, path string, method string
// Pick a random attached host
host
:=
hosts
[
rand
.
Intn
(
len
(
hosts
))]
name
,
err
:=
host
.
Name
(
ctx
)
name
,
err
:=
host
.
Object
Name
(
ctx
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
@@ -167,6 +198,10 @@ func (d Datastore) ServiceTicket(ctx context.Context, path string, method string
Value
:
ticket
.
Id
,
}
if
d
.
useServiceTicketHostName
(
ticket
.
HostName
)
{
u
.
Host
=
ticket
.
HostName
}
return
u
,
cookie
,
nil
}
...
...
vendor/github.com/vmware/govmomi/object/distributed_virtual_portgroup.go
View file @
87e7535e
...
...
@@ -17,8 +17,6 @@ limitations under the License.
package
object
import
(
"path"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
...
...
@@ -27,8 +25,6 @@ import (
type
DistributedVirtualPortgroup
struct
{
Common
InventoryPath
string
}
func
NewDistributedVirtualPortgroup
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
DistributedVirtualPortgroup
{
...
...
@@ -36,9 +32,6 @@ func NewDistributedVirtualPortgroup(c *vim25.Client, ref types.ManagedObjectRefe
Common
:
NewCommon
(
c
,
ref
),
}
}
func
(
p
DistributedVirtualPortgroup
)
Name
()
string
{
return
path
.
Base
(
p
.
InventoryPath
)
}
// EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this DistributedVirtualPortgroup
func
(
p
DistributedVirtualPortgroup
)
EthernetCardBackingInfo
(
ctx
context
.
Context
)
(
types
.
BaseVirtualDeviceBackingInfo
,
error
)
{
...
...
vendor/github.com/vmware/govmomi/object/distributed_virtual_switch.go
View file @
87e7535e
...
...
@@ -25,8 +25,6 @@ import (
type
DistributedVirtualSwitch
struct
{
Common
InventoryPath
string
}
func
NewDistributedVirtualSwitch
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
DistributedVirtualSwitch
{
...
...
vendor/github.com/vmware/govmomi/object/folder.go
View file @
87e7535e
...
...
@@ -26,8 +26,6 @@ import (
type
Folder
struct
{
Common
InventoryPath
string
}
func
NewFolder
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
Folder
{
...
...
@@ -113,6 +111,20 @@ func (f Folder) CreateFolder(ctx context.Context, name string) (*Folder, error)
return
NewFolder
(
f
.
c
,
res
.
Returnval
),
err
}
func
(
f
Folder
)
CreateStoragePod
(
ctx
context
.
Context
,
name
string
)
(
*
StoragePod
,
error
)
{
req
:=
types
.
CreateStoragePod
{
This
:
f
.
Reference
(),
Name
:
name
,
}
res
,
err
:=
methods
.
CreateStoragePod
(
ctx
,
f
.
c
,
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewStoragePod
(
f
.
c
,
res
.
Returnval
),
err
}
func
(
f
Folder
)
AddStandaloneHost
(
ctx
context
.
Context
,
spec
types
.
HostConnectSpec
,
addConnected
bool
,
license
*
string
,
compResSpec
*
types
.
BaseComputeResourceConfigSpec
)
(
*
Task
,
error
)
{
req
:=
types
.
AddStandaloneHost_Task
{
This
:
f
.
Reference
(),
...
...
vendor/github.com/vmware/govmomi/object/host_config_manager.go
View file @
87e7535e
...
...
@@ -120,3 +120,14 @@ func (m HostConfigManager) OptionManager(ctx context.Context) (*OptionManager, e
return
NewOptionManager
(
m
.
c
,
*
h
.
ConfigManager
.
AdvancedOption
),
nil
}
func
(
m
HostConfigManager
)
ServiceSystem
(
ctx
context
.
Context
)
(
*
HostServiceSystem
,
error
)
{
var
h
mo
.
HostSystem
err
:=
m
.
Properties
(
ctx
,
m
.
Reference
(),
[]
string
{
"configManager.serviceSystem"
},
&
h
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewHostServiceSystem
(
m
.
c
,
*
h
.
ConfigManager
.
ServiceSystem
),
nil
}
vendor/github.com/vmware/govmomi/object/host_datastore_system.go
View file @
87e7535e
...
...
@@ -33,6 +33,21 @@ func NewHostDatastoreSystem(c *vim25.Client, ref types.ManagedObjectReference) *
}
}
func
(
s
HostDatastoreSystem
)
CreateLocalDatastore
(
ctx
context
.
Context
,
name
string
,
path
string
)
(
*
Datastore
,
error
)
{
req
:=
types
.
CreateLocalDatastore
{
This
:
s
.
Reference
(),
Name
:
name
,
Path
:
path
,
}
res
,
err
:=
methods
.
CreateLocalDatastore
(
ctx
,
s
.
Client
(),
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewDatastore
(
s
.
Client
(),
res
.
Returnval
),
nil
}
func
(
s
HostDatastoreSystem
)
CreateNasDatastore
(
ctx
context
.
Context
,
spec
types
.
HostNasVolumeSpec
)
(
*
Datastore
,
error
)
{
req
:=
types
.
CreateNasDatastore
{
This
:
s
.
Reference
(),
...
...
vendor/github.com/vmware/govmomi/object/host_service_system.go
0 → 100644
View file @
87e7535e
/*
Copyright (c) 2016 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
(
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"
)
type
HostServiceSystem
struct
{
Common
}
func
NewHostServiceSystem
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
HostServiceSystem
{
return
&
HostServiceSystem
{
Common
:
NewCommon
(
c
,
ref
),
}
}
func
(
s
HostServiceSystem
)
Service
(
ctx
context
.
Context
)
([]
types
.
HostService
,
error
)
{
var
ss
mo
.
HostServiceSystem
err
:=
s
.
Properties
(
ctx
,
s
.
Reference
(),
[]
string
{
"serviceInfo.service"
},
&
ss
)
if
err
!=
nil
{
return
nil
,
err
}
return
ss
.
ServiceInfo
.
Service
,
nil
}
func
(
s
HostServiceSystem
)
Start
(
ctx
context
.
Context
,
id
string
)
error
{
req
:=
types
.
StartService
{
This
:
s
.
Reference
(),
Id
:
id
,
}
_
,
err
:=
methods
.
StartService
(
ctx
,
s
.
Client
(),
&
req
)
return
err
}
func
(
s
HostServiceSystem
)
Stop
(
ctx
context
.
Context
,
id
string
)
error
{
req
:=
types
.
StopService
{
This
:
s
.
Reference
(),
Id
:
id
,
}
_
,
err
:=
methods
.
StopService
(
ctx
,
s
.
Client
(),
&
req
)
return
err
}
func
(
s
HostServiceSystem
)
Restart
(
ctx
context
.
Context
,
id
string
)
error
{
req
:=
types
.
RestartService
{
This
:
s
.
Reference
(),
Id
:
id
,
}
_
,
err
:=
methods
.
RestartService
(
ctx
,
s
.
Client
(),
&
req
)
return
err
}
func
(
s
HostServiceSystem
)
UpdatePolicy
(
ctx
context
.
Context
,
id
string
,
policy
string
)
error
{
req
:=
types
.
UpdateServicePolicy
{
This
:
s
.
Reference
(),
Id
:
id
,
Policy
:
policy
,
}
_
,
err
:=
methods
.
UpdateServicePolicy
(
ctx
,
s
.
Client
(),
&
req
)
return
err
}
vendor/github.com/vmware/govmomi/object/host_storage_system.go
View file @
87e7535e
...
...
@@ -78,3 +78,68 @@ func (s HostStorageSystem) UpdateDiskPartitionInfo(ctx context.Context, devicePa
_
,
err
:=
methods
.
UpdateDiskPartitions
(
ctx
,
s
.
c
,
&
req
)
return
err
}
func
(
s
HostStorageSystem
)
RescanAllHba
(
ctx
context
.
Context
)
error
{
req
:=
types
.
RescanAllHba
{
This
:
s
.
Reference
(),
}
_
,
err
:=
methods
.
RescanAllHba
(
ctx
,
s
.
c
,
&
req
)
return
err
}
func
(
s
HostStorageSystem
)
MarkAsSsd
(
ctx
context
.
Context
,
uuid
string
)
(
*
Task
,
error
)
{
req
:=
types
.
MarkAsSsd_Task
{
This
:
s
.
Reference
(),
ScsiDiskUuid
:
uuid
,
}
res
,
err
:=
methods
.
MarkAsSsd_Task
(
ctx
,
s
.
c
,
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewTask
(
s
.
c
,
res
.
Returnval
),
nil
}
func
(
s
HostStorageSystem
)
MarkAsNonSsd
(
ctx
context
.
Context
,
uuid
string
)
(
*
Task
,
error
)
{
req
:=
types
.
MarkAsNonSsd_Task
{
This
:
s
.
Reference
(),
ScsiDiskUuid
:
uuid
,
}
res
,
err
:=
methods
.
MarkAsNonSsd_Task
(
ctx
,
s
.
c
,
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewTask
(
s
.
c
,
res
.
Returnval
),
nil
}
func
(
s
HostStorageSystem
)
MarkAsLocal
(
ctx
context
.
Context
,
uuid
string
)
(
*
Task
,
error
)
{
req
:=
types
.
MarkAsLocal_Task
{
This
:
s
.
Reference
(),
ScsiDiskUuid
:
uuid
,
}
res
,
err
:=
methods
.
MarkAsLocal_Task
(
ctx
,
s
.
c
,
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewTask
(
s
.
c
,
res
.
Returnval
),
nil
}
func
(
s
HostStorageSystem
)
MarkAsNonLocal
(
ctx
context
.
Context
,
uuid
string
)
(
*
Task
,
error
)
{
req
:=
types
.
MarkAsNonLocal_Task
{
This
:
s
.
Reference
(),
ScsiDiskUuid
:
uuid
,
}
res
,
err
:=
methods
.
MarkAsNonLocal_Task
(
ctx
,
s
.
c
,
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewTask
(
s
.
c
,
res
.
Returnval
),
nil
}
vendor/github.com/vmware/govmomi/object/host_system.go
View file @
87e7535e
...
...
@@ -29,15 +29,6 @@ import (
type
HostSystem
struct
{
Common
InventoryPath
string
}
func
(
h
HostSystem
)
String
()
string
{
if
h
.
InventoryPath
==
""
{
return
h
.
Common
.
String
()
}
return
fmt
.
Sprintf
(
"%v @ %v"
,
h
.
Common
,
h
.
InventoryPath
)
}
func
NewHostSystem
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
HostSystem
{
...
...
@@ -46,17 +37,6 @@ func NewHostSystem(c *vim25.Client, ref types.ManagedObjectReference) *HostSyste
}
}
func
(
h
HostSystem
)
Name
(
ctx
context
.
Context
)
(
string
,
error
)
{
var
mh
mo
.
HostSystem
err
:=
h
.
Properties
(
ctx
,
h
.
Reference
(),
[]
string
{
"name"
},
&
mh
)
if
err
!=
nil
{
return
""
,
err
}
return
mh
.
Name
,
nil
}
func
(
h
HostSystem
)
ConfigManager
()
*
HostConfigManager
{
return
NewHostConfigManager
(
h
.
c
,
h
.
Reference
())
}
...
...
vendor/github.com/vmware/govmomi/object/namespace_manager.go
0 → 100644
View file @
87e7535e
/*
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
(
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"
)
type
DatastoreNamespaceManager
struct
{
Common
}
func
NewDatastoreNamespaceManager
(
c
*
vim25
.
Client
)
*
DatastoreNamespaceManager
{
n
:=
DatastoreNamespaceManager
{
Common
:
NewCommon
(
c
,
*
c
.
ServiceContent
.
DatastoreNamespaceManager
),
}
return
&
n
}
// CreateDirectory creates a top-level directory on the given vsan datastore, using
// the given user display name hint and opaque storage policy.
func
(
nm
DatastoreNamespaceManager
)
CreateDirectory
(
ctx
context
.
Context
,
ds
*
Datastore
,
displayName
string
,
policy
string
)
(
string
,
error
)
{
req
:=
&
types
.
CreateDirectory
{
This
:
nm
.
Reference
(),
Datastore
:
ds
.
Reference
(),
DisplayName
:
displayName
,
Policy
:
policy
,
}
resp
,
err
:=
methods
.
CreateDirectory
(
ctx
,
nm
.
c
,
req
)
if
err
!=
nil
{
return
""
,
err
}
return
resp
.
Returnval
,
nil
}
// DeleteDirectory deletes the given top-level directory from a vsan datastore.
func
(
nm
DatastoreNamespaceManager
)
DeleteDirectory
(
ctx
context
.
Context
,
dc
*
Datacenter
,
datastorePath
string
)
error
{
req
:=
&
types
.
DeleteDirectory
{
This
:
nm
.
Reference
(),
DatastorePath
:
datastorePath
,
}
if
dc
!=
nil
{
ref
:=
dc
.
Reference
()
req
.
Datacenter
=
&
ref
}
if
_
,
err
:=
methods
.
DeleteDirectory
(
ctx
,
nm
.
c
,
req
);
err
!=
nil
{
return
err
}
return
nil
}
vendor/github.com/vmware/govmomi/object/network.go
View file @
87e7535e
...
...
@@ -17,8 +17,6 @@ limitations under the License.
package
object
import
(
"path"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"
...
...
@@ -26,8 +24,6 @@ import (
type
Network
struct
{
Common
InventoryPath
string
}
func
NewNetwork
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
Network
{
...
...
@@ -36,10 +32,6 @@ func NewNetwork(c *vim25.Client, ref types.ManagedObjectReference) *Network {
}
}
func
(
n
Network
)
Name
()
string
{
return
path
.
Base
(
n
.
InventoryPath
)
}
// EthernetCardBackingInfo returns the VirtualDeviceBackingInfo for this Network
func
(
n
Network
)
EthernetCardBackingInfo
(
_
context
.
Context
)
(
types
.
BaseVirtualDeviceBackingInfo
,
error
)
{
name
:=
n
.
Name
()
...
...
vendor/github.com/vmware/govmomi/object/resource_pool.go
View file @
87e7535e
...
...
@@ -17,26 +17,14 @@ limitations under the License.
package
object
import
(
"fmt"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"
)
type
ResourcePool
struct
{
Common
InventoryPath
string
}
func
(
p
ResourcePool
)
String
()
string
{
if
p
.
InventoryPath
==
""
{
return
p
.
Common
.
String
()
}
return
fmt
.
Sprintf
(
"%v @ %v"
,
p
.
Common
,
p
.
InventoryPath
)
}
func
NewResourcePool
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
ResourcePool
{
...
...
@@ -45,17 +33,6 @@ func NewResourcePool(c *vim25.Client, ref types.ManagedObjectReference) *Resourc
}
}
func
(
p
ResourcePool
)
Name
(
ctx
context
.
Context
)
(
string
,
error
)
{
var
o
mo
.
ResourcePool
err
:=
p
.
Properties
(
ctx
,
p
.
Reference
(),
[]
string
{
"name"
},
&
o
)
if
err
!=
nil
{
return
""
,
err
}
return
o
.
Name
,
nil
}
func
(
p
ResourcePool
)
ImportVApp
(
ctx
context
.
Context
,
spec
types
.
BaseImportSpec
,
folder
*
Folder
,
host
*
HostSystem
)
(
*
HttpNfcLease
,
error
)
{
req
:=
types
.
ImportVApp
{
This
:
p
.
Reference
(),
...
...
vendor/github.com/vmware/govmomi/object/virtual_app.go
View file @
87e7535e
...
...
@@ -17,13 +17,10 @@ limitations under the License.
package
object
import
(
"fmt"
"golang.org/x/net/context"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
)
...
...
@@ -37,24 +34,6 @@ func NewVirtualApp(c *vim25.Client, ref types.ManagedObjectReference) *VirtualAp
}
}
func
(
p
VirtualApp
)
String
()
string
{
if
p
.
InventoryPath
==
""
{
return
p
.
Common
.
String
()
}
return
fmt
.
Sprintf
(
"%v @ %v"
,
p
.
Common
,
p
.
InventoryPath
)
}
func
(
p
VirtualApp
)
Name
(
ctx
context
.
Context
)
(
string
,
error
)
{
var
o
mo
.
VirtualApp
err
:=
p
.
Properties
(
ctx
,
p
.
Reference
(),
[]
string
{
"name"
},
&
o
)
if
err
!=
nil
{
return
""
,
err
}
return
o
.
Name
,
nil
}
func
(
p
VirtualApp
)
CreateChildVM_Task
(
ctx
context
.
Context
,
config
types
.
VirtualMachineConfigSpec
,
host
*
HostSystem
)
(
*
Task
,
error
)
{
req
:=
types
.
CreateChildVM_Task
{
This
:
p
.
Reference
(),
...
...
vendor/github.com/vmware/govmomi/object/virtual_disk_manager.go
View file @
87e7535e
...
...
@@ -143,3 +143,27 @@ func (m VirtualDiskManager) DeleteVirtualDisk(ctx context.Context, name string,
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
{
This
:
m
.
Reference
(),
Name
:
name
,
}
if
dc
!=
nil
{
ref
:=
dc
.
Reference
()
req
.
Datacenter
=
&
ref
}
res
,
err
:=
methods
.
QueryVirtualDiskUuid
(
ctx
,
m
.
c
,
&
req
)
if
err
!=
nil
{
return
""
,
err
}
if
res
==
nil
{
return
""
,
nil
}
return
res
.
Returnval
,
nil
}
vendor/github.com/vmware/govmomi/object/virtual_machine.go
View file @
87e7535e
...
...
@@ -18,7 +18,6 @@ package object
import
(
"errors"
"fmt"
"net"
"github.com/vmware/govmomi/property"
...
...
@@ -35,15 +34,6 @@ const (
type
VirtualMachine
struct
{
Common
InventoryPath
string
}
func
(
v
VirtualMachine
)
String
()
string
{
if
v
.
InventoryPath
==
""
{
return
v
.
Common
.
String
()
}
return
fmt
.
Sprintf
(
"%v @ %v"
,
v
.
Common
,
v
.
InventoryPath
)
}
func
NewVirtualMachine
(
c
*
vim25
.
Client
,
ref
types
.
ManagedObjectReference
)
*
VirtualMachine
{
...
...
@@ -52,17 +42,6 @@ func NewVirtualMachine(c *vim25.Client, ref types.ManagedObjectReference) *Virtu
}
}
func
(
v
VirtualMachine
)
Name
(
ctx
context
.
Context
)
(
string
,
error
)
{
var
o
mo
.
VirtualMachine
err
:=
v
.
Properties
(
ctx
,
v
.
Reference
(),
[]
string
{
"name"
},
&
o
)
if
err
!=
nil
{
return
""
,
err
}
return
o
.
Name
,
nil
}
func
(
v
VirtualMachine
)
PowerState
(
ctx
context
.
Context
)
(
types
.
VirtualMachinePowerState
,
error
)
{
var
o
mo
.
VirtualMachine
...
...
vendor/github.com/vmware/govmomi/session/manager.go
View file @
87e7535e
...
...
@@ -161,3 +161,17 @@ func (sm *Manager) AcquireGenericServiceTicket(ctx context.Context, spec types.B
return
&
res
.
Returnval
,
nil
}
func
(
sm
*
Manager
)
AcquireLocalTicket
(
ctx
context
.
Context
,
userName
string
)
(
*
types
.
SessionManagerLocalTicket
,
error
)
{
req
:=
types
.
AcquireLocalTicket
{
This
:
sm
.
Reference
(),
UserName
:
userName
,
}
res
,
err
:=
methods
.
AcquireLocalTicket
(
ctx
,
sm
.
client
,
&
req
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
res
.
Returnval
,
nil
}
vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go
View file @
87e7535e
...
...
@@ -17,6 +17,8 @@ limitations under the License.
package
mo
import
(
"fmt"
"github.com/vmware/govmomi/vim25/soap"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"
...
...
@@ -76,6 +78,24 @@ func Ancestors(ctx context.Context, rt soap.RoundTripper, pc, obj types.ManagedO
// Find entity we're looking for given the last entity in the current tree.
for
_
,
iface
:=
range
ifaces
{
me
:=
iface
.
(
IsManagedEntity
)
.
GetManagedEntity
()
if
me
.
Name
==
""
{
// The types below have their own 'Name' field, so ManagedEntity.Name (me.Name) is empty.
// We only hit this case when the 'obj' param is one of these types.
// In most cases, 'obj' is a Folder so Name isn't collected in this call.
switch
x
:=
iface
.
(
type
)
{
case
Network
:
me
.
Name
=
x
.
Name
case
DistributedVirtualSwitch
:
me
.
Name
=
x
.
Name
case
DistributedVirtualPortgroup
:
me
.
Name
=
x
.
Name
default
:
// ManagedEntity always has a Name, if we hit this point we missed a case above.
panic
(
fmt
.
Sprintf
(
"%#v Name is empty"
,
me
.
Reference
()))
}
}
if
me
.
Parent
==
nil
{
out
=
append
(
out
,
me
)
break
...
...
vendor/github.com/vmware/govmomi/vim25/mo/extra.go
View file @
87e7535e
...
...
@@ -36,6 +36,10 @@ func (m DistributedVirtualSwitch) GetManagedEntity() ManagedEntity {
return
m
.
ManagedEntity
}
func
(
m
DistributedVirtualPortgroup
)
GetManagedEntity
()
ManagedEntity
{
return
m
.
ManagedEntity
}
func
(
m
Folder
)
GetManagedEntity
()
ManagedEntity
{
return
m
.
ManagedEntity
}
...
...
vendor/github.com/vmware/govmomi/vim25/soap/soap.go
View file @
87e7535e
...
...
@@ -36,7 +36,7 @@ type Fault struct {
Code
string
`xml:"faultcode"`
String
string
`xml:"faultstring"`
Detail
struct
{
Fault
types
.
AnyType
`xml:",any"`
Fault
types
.
AnyType
`xml:",any
,typeattr
"`
}
`xml:"detail"`
}
...
...
vendor/github.com/vmware/govmomi/vim25/types/helpers.go
View file @
87e7535e
...
...
@@ -16,6 +16,8 @@ limitations under the License.
package
types
import
"strings"
func
NewBool
(
v
bool
)
*
bool
{
return
&
v
}
...
...
@@ -23,3 +25,24 @@ func NewBool(v bool) *bool {
func
NewReference
(
r
ManagedObjectReference
)
*
ManagedObjectReference
{
return
&
r
}
func
(
r
ManagedObjectReference
)
Reference
()
ManagedObjectReference
{
return
r
}
func
(
r
ManagedObjectReference
)
String
()
string
{
return
strings
.
Join
([]
string
{
r
.
Type
,
r
.
Value
},
":"
)
}
func
(
r
*
ManagedObjectReference
)
FromString
(
o
string
)
bool
{
s
:=
strings
.
SplitN
(
o
,
":"
,
2
)
if
len
(
s
)
<
2
{
return
false
}
r
.
Type
=
s
[
0
]
r
.
Value
=
s
[
1
]
return
true
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment