- Updated vmware/govmomi godep (Needs for vsan support)

- Fix unmount for vsanDatastore
- Add support for vsan datastore
This commit is contained in:
Abrar Shivani
2016-07-18 23:20:30 -07:00
parent 2301ab7e0e
commit 87e7535e94
31 changed files with 658 additions and 200 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -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"`
}

View File

@@ -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
}