diff --git a/pkg/controller/plan/adapter/vsphere/builder.go b/pkg/controller/plan/adapter/vsphere/builder.go index 86dffca4d..8b8e77610 100644 --- a/pkg/controller/plan/adapter/vsphere/builder.go +++ b/pkg/controller/plan/adapter/vsphere/builder.go @@ -578,7 +578,7 @@ func (r *Builder) mapNetworks(vm *model.VM, object *cnv.VirtualMachineSpec) (err needed := []vsphere.NIC{} for _, nic := range vm.NICs { switch network.Variant { - case vsphere.NetDvPortGroup: + case vsphere.NetDvPortGroup, vsphere.OpaqueNetwork: if nic.Network.ID == network.Key { needed = append(needed, nic) } diff --git a/pkg/controller/provider/container/vsphere/collector.go b/pkg/controller/provider/container/vsphere/collector.go index f7df8e7e5..6f6a759f8 100644 --- a/pkg/controller/provider/container/vsphere/collector.go +++ b/pkg/controller/provider/container/vsphere/collector.go @@ -42,6 +42,7 @@ const ( ComputeResource = "ComputeResource" Host = "HostSystem" Network = "Network" + OpaqueNetwork = "OpaqueNetwork" DVPortGroup = "DistributedVirtualPortgroup" DVSwitch = "VmwareDistributedVirtualSwitch" Datastore = "Datastore" @@ -83,7 +84,8 @@ const ( fThumbprint = "summary.config.sslThumbprint" fMgtServerIp = "summary.managementServerIp" // Network - fTag = "tag" + fTag = "tag" + fSummary = "summary" // PortGroup fDVSwitch = "config.distributedVirtualSwitch" fKey = "key" @@ -671,6 +673,15 @@ func (r *Collector) propertySpec() []types.PropertySpec { fTag, }, }, + { + Type: OpaqueNetwork, + PathSet: []string{ + fName, + fParent, + fTag, + fSummary, + }, + }, { Type: DVPortGroup, PathSet: []string{ @@ -823,6 +834,15 @@ func (r *Collector) selectAdapter(u types.ObjectUpdate) (Adapter, bool) { }, }, } + case OpaqueNetwork: + adapter = &NetworkAdapter{ + model: model.Network{ + Base: model.Base{ + Variant: model.OpaqueNetwork, + ID: u.Obj.Value, + }, + }, + } case DVPortGroup: adapter = &NetworkAdapter{ model: model.Network{ diff --git a/pkg/controller/provider/container/vsphere/model.go b/pkg/controller/provider/container/vsphere/model.go index 2de398c2e..b5e1eec59 100644 --- a/pkg/controller/provider/container/vsphere/model.go +++ b/pkg/controller/provider/container/vsphere/model.go @@ -390,6 +390,10 @@ func (v *NetworkAdapter) Apply(u types.ObjectUpdate) { } case fDVSwitch: v.model.DVSwitch = v.Ref(p.Val) + case fSummary: + if s, cast := p.Val.(types.OpaqueNetworkSummary); cast { + v.model.Key = s.OpaqueNetworkId + } } } } @@ -704,6 +708,8 @@ func (v *VmAdapter) Apply(u types.ObjectUpdate) { } case *types.VirtualEthernetCardDistributedVirtualPortBackingInfo: network = backing.Port.PortgroupKey + case *types.VirtualEthernetCardOpaqueNetworkBackingInfo: + network = backing.OpaqueNetworkId } devList = append( diff --git a/pkg/controller/provider/model/vsphere/model.go b/pkg/controller/provider/model/vsphere/model.go index 46db9be92..f8ae2ebf6 100644 --- a/pkg/controller/provider/model/vsphere/model.go +++ b/pkg/controller/provider/model/vsphere/model.go @@ -10,6 +10,7 @@ const ( // Network. NetStandard = "Standard" NetDvPortGroup = "DvPortGroup" + OpaqueNetwork = "OpaqueNetwork" NetDvSwitch = "DvSwitch" // Cluster. ComputeResource = "ComputeResource" diff --git a/pkg/controller/provider/web/vsphere/network.go b/pkg/controller/provider/web/vsphere/network.go index 00b234d01..65f12e23f 100644 --- a/pkg/controller/provider/web/vsphere/network.go +++ b/pkg/controller/provider/web/vsphere/network.go @@ -191,6 +191,8 @@ func (r *Network) With(m *model.Network) { case model.NetDvPortGroup: r.DVSwitch = &m.DVSwitch r.Key = m.Key + case model.OpaqueNetwork: + r.Key = m.Key case model.NetDvSwitch: r.Host = m.Host }