id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c169800
schema.TypeBool, Optional: true, Description: "Controls whether or not the virtual network adapter is allowed to send network traffic with a different MAC address than that of its own.", }, "allow_mac_changes": { Type: schema.TypeBool, Optional: true, Description: "Controls whether or not the Media Access Control (MAC) address can be changed.", }, // HostNetworkTrafficShapingPolicy "shaping_average_bandwidth": { Type: schema.TypeInt, Optional: true, Description: "The average bandwidth in bits per second if traffic shaping is enabled.", }, "shaping_burst_size": { Type: schema.TypeInt, Optional: true, Description: "The maximum burst size allowed in bytes if traffic shaping is enabled.", }, "shaping_enabled": { Type: schema.TypeBool, Optional: true, Description: "Enable traffic shaping on this virtual switch or port group.", }, "shaping_peak_bandwidth": { Type: schema.TypeInt, Optional: true, Description: "The peak bandwidth during bursts in bits per second if traffic shaping is enabled.", }, } }
c169801
// These fields are deprecated and are set only to make things work. They are // not exposed to Terraform. obj.CheckSpeed = "minimum" obj.Speed = 10 obj.CheckDuplex = structure.BoolPtr(false) obj.FullDuplex = structure.BoolPtr(false) obj.CheckErrorPercent = structure.BoolPtr(false) obj.Percentage = 0 return obj }
c169802
d.Set("check_beacon", obj.CheckBeacon) } return nil }
c169803
structure.SliceInterfacesToStrings(activeNics.([]interface{})) obj.StandbyNic = structure.SliceInterfacesToStrings(standbyNics.([]interface{})) return obj }
c169804
err != nil { return err } if err := d.Set("standby_nics", structure.SliceStringsToInterfaces(obj.StandbyNic)); err != nil { return err } return nil }
c169805
obj.FailureCriteria = expandHostNicFailureCriteria(d) obj.NicOrder = expandHostNicOrderPolicy(d) // These fields are deprecated and are set only to make things work. They are // not exposed to Terraform. obj.ReversePolicy = structure.BoolPtr(true) return obj }
c169806
nil { d.Set("notify_switches", obj.NotifySwitches) } d.Set("teaming_policy", obj.Policy) if err := flattenHostNicFailureCriteria(d, obj.FailureCriteria); err != nil { return err } if err := flattenHostNicOrderPolicy(d, obj.NicOrder); err != nil { return err } return nil }
c169807
= structure.BoolPtr(v.(bool)) } if v, ok := d.GetOkExists("allow_mac_changes"); ok { obj.MacChanges = structure.BoolPtr(v.(bool)) } return obj }
c169808
d.Set("allow_forged_transmits", *obj.ForgedTransmits) } if obj.MacChanges != nil { d.Set("allow_mac_changes", *obj.MacChanges) } return nil }
c169809
BurstSize: int64(d.Get("shaping_burst_size").(int)), PeakBandwidth: int64(d.Get("shaping_peak_bandwidth").(int)), } if v, ok := d.GetOkExists("shaping_enabled"); ok { obj.Enabled = structure.BoolPtr(v.(bool)) } return obj }
c169810
obj.AverageBandwidth) d.Set("shaping_burst_size", obj.BurstSize) d.Set("shaping_peak_bandwidth", obj.PeakBandwidth) return nil }
c169811
expandHostNicTeamingPolicy(d), ShapingPolicy: expandHostNetworkTrafficShapingPolicy(d), } return obj }
c169812
{ return err } if err := flattenHostNetworkTrafficShapingPolicy(d, obj.ShapingPolicy); err != nil { return err } return nil }
c169813
[]string{ hostNasVolumeSecurityTypeAuthSys, hostNasVolumeSecurityTypeSecKrb5, hostNasVolumeSecurityTypeSecKrb5i, }, false, ), }, "type": { Type: schema.TypeString, Default: "NFS", Description: "The type of NAS volume. Can be one of NFS (to denote v3) or NFS41 (to denote NFS v4.1).", ForceNew: true, Optional: true, ValidateFunc: validation.StringInSlice( []string{ string(types.HostFileSystemVolumeFileSystemTypeNFS), string(types.HostFileSystemVolumeFileSystemTypeNFS41), }, false, ), }, "protocol_endpoint": { Type: schema.TypeString, Description: "Indicates that this NAS volume is a protocol endpoint. This field is only populated if the host supports virtual datastores.", Computed: true, }, } }
c169814
RemoteHostNames: structure.SliceInterfacesToStrings(d.Get("remote_hosts").([]interface{})), RemotePath: d.Get("remote_path").(string), SecurityType: d.Get("security_type").(string), Type: d.Get("type").(string), } return obj }
c169815
obj.SecurityType) d.Set("protocol_endpoint", obj.ProtocolEndpoint) if err := d.Set("remote_hosts", obj.RemoteHostNames); err != nil { return err } return nil }
c169816
types.HostFileSystemVolumeFileSystemTypeNFS, types.HostFileSystemVolumeFileSystemTypeNFS41: return true } return false }
c169817
d.Get("port_config_reset_at_disconnect").(bool), NetworkResourcePoolOverrideAllowed: structure.GetBoolPtr(d, "network_resource_pool_override_allowed"), TrafficFilterOverrideAllowed: structure.GetBoolPtr(d, "traffic_filter_override_allowed"), }, VlanOverrideAllowed: d.Get("vlan_override_allowed").(bool), UplinkTeamingOverrideAllowed: d.Get("uplink_teaming_override_allowed").(bool), SecurityPolicyOverrideAllowed: d.Get("security_policy_override_allowed").(bool), IpfixOverrideAllowed: structure.GetBoolPtr(d, "netflow_override_allowed"), } return obj }
c169818
structure.SetBoolPtr(d, "network_resource_pool_override_allowed", obj.NetworkResourcePoolOverrideAllowed) structure.SetBoolPtr(d, "traffic_filter_override_allowed", obj.TrafficFilterOverrideAllowed) structure.SetBoolPtr(d, "netflow_override_allowed", obj.IpfixOverrideAllowed) return nil }
c169819
d.Get("type").(string), Policy: expandVMwareDVSPortgroupPolicy(d), AutoExpand: structure.GetBoolPtr(d, "auto_expand"), VmVnicNetworkResourcePoolKey: d.Get("network_resource_pool_key").(string), } return obj }
c169820
d.Set("type", obj.Type) structure.SetBoolPtr(d, "auto_expand", obj.AutoExpand) d.Set("network_resource_pool_key", obj.VmVnicNetworkResourcePoolKey) if err := flattenVMwareDVSPortSetting(d, obj.DefaultPortConfig.(*types.VMwareDVSPortSetting)); err != nil { return err } if err := flattenVMwareDVSPortgroupPolicy(d, obj.Policy.(*types.VMwareDVSPortgroupPolicy)); err != nil { return err } return nil }
c169821
}, Host: structure.SliceInterfacesToManagedObjectReferences(d.Get("host_system_ids").(*schema.Set).List(), "HostSystem"), } return obj, nil }
c169822
return structure.SetBatch(d, map[string]interface{}{ "host_system_ids": hostIDs, }) }
c169823
name string) (string, error) { clusterID := cluster.Reference().Value return strings.Join([]string{clusterID, name}, ":"), nil }
c169824
:= clustercomputeresource.FromID(client, clusterID) if err != nil { return nil, "", fmt.Errorf("cannot locate cluster: %s", err) } return cluster, name, nil }
c169825
fmt.Sprintf("%s.%d.%s", cNetifKeyPrefix, n, key) }
c169826
mask = net.CIDRMask(m, 128) } if ip.Mask(mask).Equal(gw.Mask(mask)) { return true } return false }
c169827
structure.SliceInterfacesToStrings(d.Get(cKeyPrefix + "." + "dns_suffix_list").([]interface{})), DnsServerList: structure.SliceInterfacesToStrings(d.Get(cKeyPrefix + "." + "dns_server_list").([]interface{})), } return obj }
c169828
"domain").(string), TimeZone: d.Get(cLinuxKeyPrefix + "." + "time_zone").(string), HwClockUTC: structure.GetBoolPtr(d, cLinuxKeyPrefix+"."+"hw_clock_utc"), } return obj }
c169829
CommandList: structure.SliceInterfacesToStrings(d.Get(cWindowsKeyPrefix + "." + "run_once_command_list").([]interface{})), } if len(obj.CommandList) < 1 { return nil } return obj }
c169830
} if v, ok := d.GetOk(cWindowsKeyPrefix + "." + "admin_password"); ok { obj.Password = &types.CustomizationPassword{ Value: v.(string), PlainText: true, } } return obj }
c169831
if v, ok := d.GetOk(cWindowsKeyPrefix + "." + "domain_admin_password"); ok { obj.DomainAdminPassword = &types.CustomizationPassword{ Value: v.(string), PlainText: true, } } return obj }
c169832
OrgName: d.Get(cWindowsKeyPrefix + "." + "organization_name").(string), ComputerName: &types.CustomizationFixedName{ Name: d.Get(cWindowsKeyPrefix + "." + "computer_name").(string), }, ProductId: d.Get(cWindowsKeyPrefix + "." + "product_key").(string), } return obj }
c169833
expandCustomizationGuiRunOnce(d), Identification: expandCustomizationIdentification(d), } return obj }
c169834
{ obj := &types.CustomizationSysprepText{ Value: d.Get(cKeyPrefix + "." + "windows_sysprep_text").(string), } return obj }
c169835
&types.CustomizationFixedIpV6{ IpAddress: addr, SubnetMask: int32(mask), }, }, } if gwAdd && gwOk && matchGateway(addr, mask, gw) { obj.Gateway = []string{gw} gwFound = true } return obj, gwFound }
c169836
obj.Gateway = []string{v4gw} v4gwFound = true } default: obj.Ip = &types.CustomizationDhcpIpGenerator{} } obj.DnsServerList = structure.SliceInterfacesToStrings(d.Get(netifKey("dns_server_list", n)).([]interface{})) obj.DnsDomain = d.Get(netifKey("dns_domain", n)).(string) obj.IpV6Spec, v6gwFound = expandCustomizationIPSettingsIPV6AddressSpec(d, n, v6gwAdd) return obj, v4gwFound, v6gwFound }
c169837
adapter, v4gwFound, v6gwFound = expandCustomizationIPSettings(d, i, !v4gwFound, !v6gwFound) obj := types.CustomizationAdapterMapping{ Adapter: adapter, } result[i] = obj } return result }
c169838
family), GlobalIPSettings: expandCustomizationGlobalIPSettings(d), NicSettingMap: expandSliceOfCustomizationAdapterMapping(d), } return obj }
c169839
in VM customization options for Linux operating systems") case family == string(types.VirtualMachineGuestOsFamilyWindowsGuest) && !windowsExists && !sysprepExists: return errors.New("one of windows_options or windows_sysprep_text must exist in VM customization options for Windows operating systems") } return nil }
c169840
Default: string(types.LinkDiscoveryProtocolConfigProtocolTypeCdp), ValidateFunc: validation.StringInSlice(linkDiscoveryProtocolConfigProtocolAllowedValues, false), }, // HostVirtualSwitchBondBridge "network_adapters": { Type: schema.TypeList, Required: true, Description: "The list of network adapters to bind to this virtual switch.", Elem: &schema.Schema{Type: schema.TypeString}, }, } }
c169841
{ obj := &types.HostVirtualSwitchBeaconConfig{ Interval: int32(d.Get("beacon_interval").(int)), } return obj }
c169842
d.Set("beacon_interval", obj.Interval) return nil }
c169843
Operation: d.Get("link_discovery_operation").(string), Protocol: d.Get("link_discovery_protocol").(string), } return obj }
c169844
obj.Operation) d.Set("link_discovery_protocol", obj.Protocol) return nil }
c169845
obj.Beacon = expandHostVirtualSwitchBeaconConfig(d) obj.LinkDiscoveryProtocolConfig = expandLinkDiscoveryProtocolConfig(d) return obj }
c169846
nil { return err } if err := flattenLinkDiscoveryProtocolConfig(d, obj.LinkDiscoveryProtocolConfig); err != nil { return err } return nil }
c169847
true, Description: "The number of ports that this virtual switch is configured to use.", Default: 128, ValidateFunc: validation.IntBetween(0, 1024), }, } structure.MergeSchema(s, schemaHostVirtualSwitchBondBridge()) structure.MergeSchema(s, schemaHostNetworkPolicy()) return s }
c169848
no NICs, we need to nil-out Bridge, as a // HostVirtualSwitchBondBridge with no NICs is an invalid config. if len(obj.Bridge.(*types.HostVirtualSwitchBondBridge).NicDevice) < 1 { obj.Bridge = nil } return obj }
c169849
flattenHostVirtualSwitchBondBridge(d, obj.Bridge.(*types.HostVirtualSwitchBondBridge)); err != nil { return err } } if err := flattenHostNetworkPolicy(d, obj.Policy); err != nil { return err } return nil }
c169850
string) { d.SetId(fmt.Sprintf("%s:%s:%s", hostVirtualSwitchIDPrefix, hsID, name)) }
c169851
return splitHostVirtualSwitchID(d.Id()) }
c169852
\"sdrs_intra_vm_affinity\": %s", err) } obj := &types.StorageDrsVmConfigInfo{ Behavior: d.Get("sdrs_automation_level").(string), Enabled: enabled, IntraVmAffinity: intraVMAffinity, Vm: types.NewReference(vm.Reference()), } return obj, nil }
c169853
setting attribute \"sdrs_enabled\": %s", err) } if err := structure.SetBoolStringPtr(d, "sdrs_intra_vm_affinity", obj.IntraVmAffinity); err != nil { return fmt.Errorf("error setting attribute \"sdrs_automation_level\": %s", err) } return nil }
c169854
properties of virtual machine: %s", err) } vmID := props.Config.Uuid return strings.Join([]string{podID, vmID}, ":"), nil }
c169855
} for _, info := range props.PodStorageDrsEntry.StorageDrsConfig.VmConfig { if *info.Vm == vm.Reference() { log.Printf("[DEBUG] Found storage DRS config info for VM %q in datastore cluster %q", vm.Name(), pod.Name()) return &info, nil } } log.Printf("[DEBUG] No storage DRS config info found for VM %q in datastore cluster %q", vm.Name(), pod.Name()) return nil, nil }
c169856
true, Default: networkInterfaceSubresourceTypeVmxnet3, Description: "The controller type. Can be one of e1000, e1000e, or vmxnet3.", ValidateFunc: validation.StringInSlice(networkInterfaceSubresourceTypeAllowedValues, false), }, "use_static_mac": { Type: schema.TypeBool, Optional: true, Description: "If true, the mac_address field is treated as a static MAC address and set accordingly.", }, "mac_address": { Type: schema.TypeString, Optional: true, Computed: true, Description: "The MAC address of this network interface. Can only be manually set if use_static_mac is true.", }, } structure.MergeSchema(s, subresourceSchema()) return s }
c169857
srtype: subresourceTypeNetworkInterface, data: d, olddata: old, rdd: rdd, }, } sr.Index = idx return sr }
c169858
r := NewNetworkInterfaceSubresource(c, d, nm, nil, ni) if err := r.ValidateDiff(); err != nil { return fmt.Errorf("%s: %s", r.Addr(), err) } } log.Printf("[DEBUG] NetworkInterfaceDiffOperation: Diff validation complete") return nil }
c169859
devices = devSort.Sort log.Printf("[DEBUG] ReadNetworkInterfaceTypes: Network devices order after sort: %s", DeviceListString(devices)) var out []string for _, device := range devices { out = append(out, virtualEthernetCardString(device.(types.BaseVirtualEthernetCard))) } log.Printf("[DEBUG] ReadNetworkInterfaceTypes: Network types returned: %+v", out) return out, nil }
c169860
case *types.VirtualPCNet32: return types.BaseVirtualDevice(t) case *types.VirtualSriovEthernetCard: return types.BaseVirtualDevice(t) case *types.VirtualVmxnet2: return types.BaseVirtualDevice(t) case *types.VirtualVmxnet3: return types.BaseVirtualDevice(t) } panic(fmt.Errorf("unknown ethernet card type %T", v)) }
c169861
{ return bve, nil } return nil, fmt.Errorf("device is not a network device (%T)", v) }
c169862
return networkInterfaceSubresourceTypeSriov case *types.VirtualVmxnet2: return networkInterfaceSubresourceTypeVmxnet2 case *types.VirtualVmxnet3: return networkInterfaceSubresourceTypeVmxnet3 } return networkInterfaceSubresourceTypeUnknown }
c169863
// Set the rest of the settings here. if r.Get("use_static_mac").(bool) { card.AddressType = string(types.VirtualEthernetCardMacTypeManual) card.MacAddress = r.Get("mac_address").(string) } version := viapi.ParseVersionFromClient(r.client) if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) { alloc := &types.VirtualEthernetCardResourceAllocation{ Limit: structure.Int64Ptr(int64(r.Get("bandwidth_limit").(int))), Reservation: structure.Int64Ptr(int64(r.Get("bandwidth_reservation").(int))), Share: types.SharesInfo{ Shares: int32(r.Get("bandwidth_share_count").(int)), Level: types.SharesLevel(r.Get("bandwidth_share_level").(string)), }, } card.ResourceAllocation = alloc } // Done here. Save ID, push the device to the new device list and return. if err := r.SaveDevIDs(device, ctlr); err != nil { return nil, err } dspec, err := object.VirtualDeviceList{device}.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd) if err != nil { return nil, err } spec = append(spec, dspec...) log.Printf("[DEBUG] %s: Device config operations from create: %s", r, DeviceChangeString(spec)) log.Printf("[DEBUG] %s: Create finished", r) return spec, nil }
c169864
nil { return err } netID = pg.Reference().Value default: return fmt.Errorf("unknown network interface backing %T", card.Backing) } r.Set("network_id", netID) r.Set("use_static_mac", card.AddressType == string(types.VirtualEthernetCardMacTypeManual)) r.Set("mac_address", card.MacAddress) version := viapi.ParseVersionFromClient(r.client) if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) { if card.ResourceAllocation != nil { r.Set("bandwidth_limit", card.ResourceAllocation.Limit) r.Set("bandwidth_reservation", card.ResourceAllocation.Reservation) r.Set("bandwidth_share_count", card.ResourceAllocation.Share.Shares) r.Set("bandwidth_share_level", card.ResourceAllocation.Share.Level) } } // Save the device key and address data ctlr, err := findControllerForDevice(l, vd) if err != nil { return err } if err := r.SaveDevIDs(vd, ctlr); err != nil { return err } log.Printf("[DEBUG] %s: Read finished (key and device address may have changed)", r) return nil }
c169865
VMware tools is not running, this operation requires a reboot if r.rdd.Get("vmware_tools_status").(string) != string(types.VirtualMachineToolsRunningStatusGuestToolsRunning) { r.SetRestart("<device delete>") } bvd := baseVirtualEthernetCardToBaseVirtualDevice(device) spec, err := object.VirtualDeviceList{bvd}.ConfigSpec(types.VirtualDeviceConfigSpecOperationRemove) if err != nil { return nil, err } log.Printf("[DEBUG] %s: Device config operations from update: %s", r, DeviceChangeString(spec)) log.Printf("[DEBUG] %s: Delete completed", r) return spec, nil }
c169866
higher. version := viapi.ParseVersionFromClient(r.client) if version.Older(viapi.VSphereVersion{Product: version.Product, Major: 6}) { if err := r.restrictResourceAllocationSettings(); err != nil { return err } } log.Printf("[DEBUG] %s: Diff validation complete", r) return nil }
c169867
return 0, fmt.Errorf("device at key %d has no unit number", d.Key) } if *d.UnitNumber > high { high = *d.UnitNumber } } return int(high - networkInterfacePciDeviceOffset + 1), nil }
c169868
context.WithTimeout(context.Background(), defaultAPITimeout) defer cancel() return hs.ConfigManager().StorageSystem(ctx) }
c169869
:= finder.ObjectReference(ctx, result.Reference()) if err != nil { return nil, err } // Should be safe to return here. If our reference returned here and is not a // VM, then we have bigger problems and to be honest we should be panicking // anyway. log.Printf("[DEBUG] VM %q found for UUID %q", vm.(*object.VirtualMachine).InventoryPath, uuid) return vm.(*object.VirtualMachine), nil }
c169870
nil, err } if result == nil { return nil, newUUIDNotFoundError(fmt.Sprintf("virtual machine with UUID %q not found", uuid)) } return result, nil }
c169871
view: %s", err) } }() var vms, results []mo.VirtualMachine err = v.Retrieve(ctx, []string{"VirtualMachine"}, []string{"config.uuid"}, &results) if err != nil { return nil, err } for _, result := range results { if result.Config == nil { continue } if result.Config.Uuid == uuid { vms = append(vms, result) } } switch { case len(vms) < 1: return nil, newUUIDNotFoundError(fmt.Sprintf("virtual machine with UUID %q not found", uuid)) case len(vms) > 1: return nil, fmt.Errorf("multiple virtual machines with UUID %q found", uuid) } return object.NewReference(client.Client, vms[0].Self), nil }
c169872
mo.VirtualMachine if err := vm.Properties(ctx, vm.Reference(), nil, &props); err != nil { return nil, err } return &props, nil }
c169873
continue } return true } return false }) if err != nil { // Provide a friendly error message if we timed out waiting for a routable IP. if ctx.Err() == context.DeadlineExceeded { return errors.New("timeout waiting for an available IP address") } return err } log.Printf("[DEBUG] IP address is now available for VM %q", vm.InventoryPath) return nil }
c169874
continue } if !routable { // We are done. The rest of this block concerns itself with // checking for a routable address, but the waiter has been // flagged to not wait for one. return true } var mask net.IPMask if ip.To4() != nil { mask = net.CIDRMask(int(addr.PrefixLength), 32) } else { mask = net.CIDRMask(int(addr.PrefixLength), 128) } if ip.Mask(mask).Equal(v4gw.Mask(mask)) || ip.Mask(mask).Equal(v6gw.Mask(mask)) { return true } } } } } } return false }) if err != nil { // Provide a friendly error message if we timed out waiting for a routable IP. if ctx.Err() == context.DeadlineExceeded { return errors.New("timeout waiting for an available IP address") } return err } log.Printf("[DEBUG] IP address(es) is/are now available for VM %q", vm.InventoryPath) return nil }
c169875
!= nil { if !viapi.IsManagedObjectNotFoundError(err) { return nil, err } task, err = f.CreateVM(ctx, s, p, h) } else { task, err = vc.CreateChildVM(ctx, s, h) } if err != nil { return nil, err } tctx, tcancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer tcancel() result, err := task.WaitForResult(tctx, nil) if err != nil { return nil, err } log.Printf("[DEBUG] Virtual machine %q: creation complete (MOID: %q)", fmt.Sprintf("%s/%s", f.InventoryPath, s.Name), result.Result.(types.ManagedObjectReference).Value) return FromMOID(c, result.Result.(types.ManagedObjectReference).Value) }
c169876
} result, err := task.WaitForResult(ctx, nil) if err != nil { if ctx.Err() == context.DeadlineExceeded { err = errors.New("timeout waiting for clone to complete") } return nil, err } log.Printf("[DEBUG] Virtual machine %q: clone complete (MOID: %q)", fmt.Sprintf("%s/%s", f.InventoryPath, name), result.Result.(types.ManagedObjectReference).Value) return FromMOID(c, result.Result.(types.ManagedObjectReference).Value) }
c169877
return err } tctx, tcancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer tcancel() return task.Wait(tctx) }
c169878
:= folder.VirtualMachineFolderFromObject(client, vm, relative) if err != nil { return err } return folder.MoveObjectTo(vm.Reference(), f) }
c169879
a friendly error message if we timed out waiting for the migration. if ctx.Err() == context.DeadlineExceeded { return errors.New("timeout waiting for migration to complete") } } return nil }
c169880
if err != nil { return MOIDForUUIDResult{}, err } return MOIDForUUIDResult{ UUID: uuid, MOID: vm.Reference().Value, }, nil }
c169881
MOIDForUUIDResult{}, err } return MOIDForUUIDResult{ UUID: props.Config.Uuid, MOID: vm.Reference().Value, }, nil }
c169882
err != nil { return nil, err } results = append(results, result) } return results, nil }
c169883
err != nil { return nil, err } results = append(results, result) } return results, nil }
c169884
{ var moids []string for _, ref := range refs { moids = append(moids, ref.Value) } return UUIDsForMOIDs(client, moids) }
c169885
moids = append(moids, result.MOID) } return moids }
c169886
refs = append(refs, types.ManagedObjectReference{ Type: "VirtualMachine", Value: result.MOID, }) } return refs }
c169887
uuids = append(uuids, result.UUID) } return uuids }
c169888
return nil, NewMissingPortGroupReferenceError( fmt.Sprintf( "portgroup lookup by key returned nil result for DVS UUID %q and portgroup key %q", dvsUUID, pgKey, ), ) } return FromMOID(client, resp.Returnval.Reference().Value) }
c169889
defer cancel() ds, err := finder.ObjectReference(ctx, ref) if err != nil { return nil, err } // Should be safe to return here. If our reference returned here and is not a // DistributedVirtualPortgroup, then we have bigger problems and to be // honest we should be panicking anyway. return ds.(*object.DistributedVirtualPortgroup), nil }
c169890
return nil, err } if net.Reference().Type != "DistributedVirtualPortgroup" { return nil, fmt.Errorf("network at path %q is not a portgroup (type %s)", name, net.Reference().Type) } return FromMOID(client, net.Reference().Value) }
c169891
if err := pg.Properties(ctx, pg.Reference(), nil, &props); err != nil { return nil, err } return &props, nil }
c169892
err := methods.CreateDVPortgroup_Task(ctx, client, req) if err != nil { return nil, err } return object.NewTask(client.Client, resp.Returnval.Reference()), nil }
c169893
err := ds.Properties(ctx, ds.Reference(), nil, &props); err != nil { return nil, err } return &props, nil }
c169894
:= folder.DatastoreFolderFromObject(client, ds, relative) if err != nil { return err } return folder.MoveObjectTo(ds.Reference(), f) }
c169895
if err != nil { return err } f, err := folder.DatastoreFolderFromObject(client, hs, relative) if err != nil { return err } return folder.MoveObjectTo(ds.Reference(), f) }
c169896
cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() return ds.Browser(ctx) }
c169897
for _, bfi := range result.File { files = append(files, bfi.GetFileInfo()) } return files, nil }
c169898
specific search", name, ds) } if len(files) < 1 { return false, nil } return path.Base(name) == files[0].Path, nil }
c169899
false) ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout) defer cancel() if dc != nil { finder.SetDatacenter(dc) } return finder.VirtualApp(ctx, name) }