_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q170200 | findControllerForDevice | validation | func findControllerForDevice(l object.VirtualDeviceList, bvd types.BaseVirtualDevice) (types.BaseVirtualController, error) {
vd := bvd.GetVirtualDevice()
ctlr := l.FindByKey(vd.ControllerKey)
if ctlr == nil {
return nil, fmt.Errorf("could not find controller key %d for device %d", vd.ControllerKey, vd.Key)
}
r... | go | {
"resource": ""
} |
q170201 | FindVirtualDeviceByAddr | validation | func (r *Subresource) FindVirtualDeviceByAddr(l object.VirtualDeviceList) (types.BaseVirtualDevice, error) {
log.Printf("[DEBUG] FindVirtualDevice: Looking for device with address %s", r.DevAddr())
ct, cb, du, err := splitDevAddr(r.DevAddr())
if err != nil {
return nil, err
}
// find the controller
csf := find... | go | {
"resource": ""
} |
q170202 | FindVirtualDevice | validation | func (r *Subresource) FindVirtualDevice(l object.VirtualDeviceList) (types.BaseVirtualDevice, error) {
if key := r.Get("key").(int); key > 0 {
log.Printf("[DEBUG] FindVirtualDevice: Looking for device with key %d", key)
if dev := l.FindByKey(int32(key)); dev != nil {
log.Printf("[DEBUG] FindVirtualDevice: Devic... | go | {
"resource": ""
} |
q170203 | String | validation | func (r *Subresource) String() string {
devaddr := r.Get("device_address").(string)
if devaddr == "" {
devaddr = "<new device>"
}
return fmt.Sprintf("%s (key %d at %s)", r.Addr(), r.Get("key").(int), devaddr)
} | go | {
"resource": ""
} |
q170204 | swapSCSIDevice | validation | func swapSCSIDevice(l object.VirtualDeviceList, device types.BaseVirtualSCSIController, ct string, st string) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] swapSCSIDevice: Swapping SCSI device for one of controller type %s: %s", ct, l.Name(device.(types.BaseVirtualDevice)))
var spec []types.BaseV... | go | {
"resource": ""
} |
q170205 | NormalizeSCSIBus | validation | func NormalizeSCSIBus(l object.VirtualDeviceList, ct string, count int, st string) (object.VirtualDeviceList, []types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] NormalizeSCSIBus: Normalizing first %d controllers on SCSI bus to device type %s", count, ct)
var spec []types.BaseVirtualDeviceConfigSpec
ct... | go | {
"resource": ""
} |
q170206 | setSCSIBusSharing | validation | func setSCSIBusSharing(l *object.VirtualDeviceList, ctlr types.BaseVirtualSCSIController, st string) ([]types.BaseVirtualDeviceConfigSpec, error) {
var cspec []types.BaseVirtualDeviceConfigSpec
if ctlr.GetVirtualSCSIController().SharedBus != types.VirtualSCSISharing(st) {
ctlr.GetVirtualSCSIController().SharedBus =... | go | {
"resource": ""
} |
q170207 | createSCSIController | validation | func createSCSIController(l *object.VirtualDeviceList, ct string, st string) ([]types.BaseVirtualDeviceConfigSpec, error) {
nc, err := l.CreateSCSIController(ct)
if err != nil {
return nil, err
}
nc.(types.BaseVirtualSCSIController).GetVirtualSCSIController().SharedBus = types.VirtualSCSISharing(st)
cspec, err :... | go | {
"resource": ""
} |
q170208 | ReadSCSIBusType | validation | func ReadSCSIBusType(l object.VirtualDeviceList, count int) string {
ctlrs := make([]types.BaseVirtualSCSIController, count)
for _, dev := range l {
if sc, ok := dev.(types.BaseVirtualSCSIController); ok && sc.GetVirtualSCSIController().BusNumber < int32(count) {
ctlrs[sc.GetVirtualSCSIController().BusNumber] = ... | go | {
"resource": ""
} |
q170209 | ReadSCSIBusSharing | validation | func ReadSCSIBusSharing(l object.VirtualDeviceList, count int) string {
ctlrs := make([]types.BaseVirtualSCSIController, count)
for _, dev := range l {
if sc, ok := dev.(types.BaseVirtualSCSIController); ok && sc.GetVirtualSCSIController().BusNumber < int32(count) {
ctlrs[sc.GetVirtualSCSIController().BusNumber]... | go | {
"resource": ""
} |
q170210 | pickSCSIController | validation | func pickSCSIController(l object.VirtualDeviceList, bus int) (types.BaseVirtualController, error) {
log.Printf("[DEBUG] pickSCSIController: Looking for SCSI controller at bus number %d", bus)
l = l.Select(func(device types.BaseVirtualDevice) bool {
switch d := device.(type) {
case types.BaseVirtualSCSIController:... | go | {
"resource": ""
} |
q170211 | ControllerForCreateUpdate | validation | func (r *Subresource) ControllerForCreateUpdate(l object.VirtualDeviceList, ct string, bus int) (types.BaseVirtualController, error) {
log.Printf("[DEBUG] ControllerForCreateUpdate: Looking for controller type %s", ct)
var ctlr types.BaseVirtualController
var err error
switch ct {
case SubresourceControllerTypeIDE... | go | {
"resource": ""
} |
q170212 | applyDeviceChange | validation | func applyDeviceChange(l object.VirtualDeviceList, cs []types.BaseVirtualDeviceConfigSpec) object.VirtualDeviceList {
log.Printf("[DEBUG] applyDeviceChange: Applying changes: %s", DeviceChangeString(cs))
log.Printf("[DEBUG] applyDeviceChange: Device list before changes: %s", DeviceListString(l))
for _, s := range cs... | go | {
"resource": ""
} |
q170213 | DeviceListString | validation | func DeviceListString(l object.VirtualDeviceList) string {
var names []string
for _, d := range l {
if d == nil {
names = append(names, "<nil>")
} else {
names = append(names, l.Name(d))
}
}
return strings.Join(names, ",")
} | go | {
"resource": ""
} |
q170214 | DeviceChangeString | validation | func DeviceChangeString(specs []types.BaseVirtualDeviceConfigSpec) string {
var strs []string
for _, v := range specs {
spec := v.GetVirtualDeviceConfigSpec()
strs = append(strs, fmt.Sprintf("(%s: %T at key %d)", string(spec.Operation), spec.Device, spec.Device.GetVirtualDevice().Key))
}
return strings.Join(str... | go | {
"resource": ""
} |
q170215 | subresourceListString | validation | func subresourceListString(data []interface{}) string {
var strs []string
for _, v := range data {
if v == nil {
strs = append(strs, "(<nil>)")
continue
}
m := v.(map[string]interface{})
devaddr := m["device_address"].(string)
if devaddr == "" {
devaddr = "<new device>"
}
strs = append(strs, fm... | go | {
"resource": ""
} |
q170216 | scsiControllerListString | validation | func scsiControllerListString(ctlrs []types.BaseVirtualSCSIController) string {
var l object.VirtualDeviceList
for _, ctlr := range ctlrs {
if ctlr == nil {
l = append(l, types.BaseVirtualDevice(nil))
} else {
l = append(l, ctlr.(types.BaseVirtualDevice))
}
}
return DeviceListString(l)
} | go | {
"resource": ""
} |
q170217 | AppendDeviceChangeSpec | validation | func AppendDeviceChangeSpec(
spec []types.BaseVirtualDeviceConfigSpec,
ops ...types.BaseVirtualDeviceConfigSpec,
) []types.BaseVirtualDeviceConfigSpec {
for _, op := range ops {
c := copystructure.Must(copystructure.Copy(op)).(types.BaseVirtualDeviceConfigSpec)
spec = append(spec, c)
}
return spec
} | go | {
"resource": ""
} |
q170218 | expandClusterDependencyRuleInfo | validation | func expandClusterDependencyRuleInfo(d *schema.ResourceData) (*types.ClusterDependencyRuleInfo, error) {
obj := &types.ClusterDependencyRuleInfo{
ClusterRuleInfo: types.ClusterRuleInfo{
Enabled: structure.GetBool(d, "enabled"),
Mandatory: structure.GetBool(d, "mandatory"),
Name: d.Get("name").(... | go | {
"resource": ""
} |
q170219 | flattenClusterDependencyRuleInfo | validation | func flattenClusterDependencyRuleInfo(d *schema.ResourceData, obj *types.ClusterDependencyRuleInfo) error {
return structure.SetBatch(d, map[string]interface{}{
"enabled": obj.Enabled,
"mandatory": obj.Mandatory,
"name": obj.Name,
"dependency_vm_group_name": ... | go | {
"resource": ""
} |
q170220 | resourceVSphereComputeClusterVMDependencyRuleParseID | validation | func resourceVSphereComputeClusterVMDependencyRuleParseID(id string) (string, int32, error) {
parts := strings.SplitN(id, ":", 3)
if len(parts) < 2 {
return "", 0, fmt.Errorf("bad ID %q", id)
}
key, err := strconv.Atoi(parts[1])
if err != nil {
return "", 0, fmt.Errorf("bad key in ID %q: %s", parts[1], err)
... | go | {
"resource": ""
} |
q170221 | resourceVSphereComputeClusterVMDependencyRuleFetchObjects | validation | func resourceVSphereComputeClusterVMDependencyRuleFetchObjects(
meta interface{},
clusterID string,
key int32,
) (*object.ClusterComputeResource, int32, error) {
client, err := resourceVSphereComputeClusterVMDependencyRuleClient(meta)
if err != nil {
return nil, 0, err
}
cluster, err := clustercomputeresource... | go | {
"resource": ""
} |
q170222 | resourceVSphereDatastoreClusterApplyCreate | validation | func resourceVSphereDatastoreClusterApplyCreate(d *schema.ResourceData, meta interface{}) (*object.StoragePod, error) {
log.Printf("[DEBUG] %s: Processing datastore cluster creation", resourceVSphereDatastoreClusterIDString(d))
client := meta.(*VSphereClient).vimClient
if err := viapi.ValidateVirtualCenter(client); ... | go | {
"resource": ""
} |
q170223 | resourceVSphereDatastoreClusterApplyTags | validation | func resourceVSphereDatastoreClusterApplyTags(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
tagsClient, err := tagsClientIfDefined(d, meta)
if err != nil {
return err
}
// Apply any pending tags now
if tagsClient == nil {
log.Printf("[DEBUG] %s: Tags unsupported on this connection,... | go | {
"resource": ""
} |
q170224 | resourceVSphereDatastoreClusterReadTags | validation | func resourceVSphereDatastoreClusterReadTags(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
if tagsClient, _ := meta.(*VSphereClient).TagsClient(); tagsClient != nil {
log.Printf("[DEBUG] %s: Reading tags", resourceVSphereDatastoreClusterIDString(d))
if err := readTagsForResource(tagsCli... | go | {
"resource": ""
} |
q170225 | resourceVSphereDatastoreClusterApplyCustomAttributes | validation | func resourceVSphereDatastoreClusterApplyCustomAttributes(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
client := meta.(*VSphereClient).vimClient
// Verify a proper vCenter before proceeding if custom attributes are defined
attrsProcessor, err := customattribute.GetDiffProcessorIfAttribut... | go | {
"resource": ""
} |
q170226 | resourceVSphereDatastoreClusterReadCustomAttributes | validation | func resourceVSphereDatastoreClusterReadCustomAttributes(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
client := meta.(*VSphereClient).vimClient
// Read custom attributes
if customattribute.IsSupported(client) {
log.Printf("[DEBUG] %s: Reading custom attributes", resourceVSphereDatastor... | go | {
"resource": ""
} |
q170227 | resourceVSphereDatastoreClusterApplySDRSConfig | validation | func resourceVSphereDatastoreClusterApplySDRSConfig(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
// This is a no-op if there is no SDRS config changed
if !resourceVSphereDatastoreClusterHasSDRSConfigChange(d) {
log.Printf("[DEBUG] %s: No SDRS configuration attributes have changed", reso... | go | {
"resource": ""
} |
q170228 | resourceVSphereDatastoreClusterHasSDRSConfigChange | validation | func resourceVSphereDatastoreClusterHasSDRSConfigChange(d *schema.ResourceData) bool {
for k := range resourceVSphereDatastoreCluster().Schema {
switch {
case resourceVSphereDatastoreClusterHasSDRSConfigChangeExcluded(k):
continue
case d.HasChange(k):
return true
}
}
return false
} | go | {
"resource": ""
} |
q170229 | resourceVSphereDatastoreClusterGetPod | validation | func resourceVSphereDatastoreClusterGetPod(d structure.ResourceIDStringer, meta interface{}) (*object.StoragePod, error) {
log.Printf("[DEBUG] %s: Fetching StoragePod object from resource ID", resourceVSphereDatastoreClusterIDString(d))
client := meta.(*VSphereClient).vimClient
if err := viapi.ValidateVirtualCenter(... | go | {
"resource": ""
} |
q170230 | resourceVSphereDatastoreClusterGetPodFromPath | validation | func resourceVSphereDatastoreClusterGetPodFromPath(meta interface{}, path string, dcID string) (*object.StoragePod, error) {
client := meta.(*VSphereClient).vimClient
var dc *object.Datacenter
if dcID != "" {
var err error
dc, err = datacenterFromID(client, dcID)
if err != nil {
return nil, fmt.Errorf("cann... | go | {
"resource": ""
} |
q170231 | resourceVSphereDatastoreClusterSaveNameAndPath | validation | func resourceVSphereDatastoreClusterSaveNameAndPath(d *schema.ResourceData, pod *object.StoragePod) error {
log.Printf(
"[DEBUG] %s: Saving name and path data for datastore cluster %q",
resourceVSphereDatastoreClusterIDString(d),
pod.InventoryPath,
)
if err := d.Set("name", pod.Name()); err != nil {
return ... | go | {
"resource": ""
} |
q170232 | resourceVSphereDatastoreClusterApplyNameChange | validation | func resourceVSphereDatastoreClusterApplyNameChange(
d *schema.ResourceData,
meta interface{},
pod *object.StoragePod,
) (*object.StoragePod, error) {
log.Printf(
"[DEBUG] %s: Applying any name changes (old path = %q)",
resourceVSphereDatastoreClusterIDString(d),
pod.InventoryPath,
)
var changed bool
var ... | go | {
"resource": ""
} |
q170233 | resourceVSphereDatastoreClusterApplyFolderChange | validation | func resourceVSphereDatastoreClusterApplyFolderChange(
d *schema.ResourceData,
meta interface{},
pod *object.StoragePod,
) (*object.StoragePod, error) {
log.Printf(
"[DEBUG] %s: Applying any folder changes (old path = %q)",
resourceVSphereDatastoreClusterIDString(d),
pod.InventoryPath,
)
var changed bool
... | go | {
"resource": ""
} |
q170234 | resourceVSphereDatastoreClusterValidateEmptyCluster | validation | func resourceVSphereDatastoreClusterValidateEmptyCluster(d structure.ResourceIDStringer, pod *object.StoragePod) error {
log.Printf("[DEBUG] %s: Checking to ensure that datastore cluster is empty", resourceVSphereDatastoreClusterIDString(d))
ne, err := storagepod.HasChildren(pod)
if err != nil {
return fmt.Errorf(... | go | {
"resource": ""
} |
q170235 | resourceVSphereDatastoreClusterApplyDelete | validation | func resourceVSphereDatastoreClusterApplyDelete(d *schema.ResourceData, pod *object.StoragePod) error {
log.Printf("[DEBUG] %s: Proceeding with datastore cluster deletion", resourceVSphereDatastoreClusterIDString(d))
if err := storagepod.Delete(pod); err != nil {
return err
}
d.SetId("")
return nil
} | go | {
"resource": ""
} |
q170236 | resourceVSphereDatastoreClusterFlattenSDRSData | validation | func resourceVSphereDatastoreClusterFlattenSDRSData(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
log.Printf("[DEBUG] %s: Saving datastore cluster attributes", resourceVSphereDatastoreClusterIDString(d))
client := meta.(*VSphereClient).vimClient
if err := viapi.ValidateVirtualCenter(clien... | go | {
"resource": ""
} |
q170237 | expandStorageDrsPodConfigSpec | validation | func expandStorageDrsPodConfigSpec(d *schema.ResourceData, version viapi.VSphereVersion) *types.StorageDrsPodConfigSpec {
obj := &types.StorageDrsPodConfigSpec{
DefaultIntraVmAffinity: structure.GetBool(d, "sdrs_default_intra_vm_affinity"),
DefaultVmBehavior: d.Get("sdrs_automation_level").(string),
Enabled... | go | {
"resource": ""
} |
q170238 | flattenStorageDrsPodConfigInfo | validation | func flattenStorageDrsPodConfigInfo(d *schema.ResourceData, obj types.StorageDrsPodConfigInfo, version viapi.VSphereVersion) error {
attrs := map[string]interface{}{
"sdrs_default_intra_vm_affinity": obj.DefaultIntraVmAffinity,
"sdrs_automation_level": obj.DefaultVmBehavior,
"sdrs_enabled": ... | go | {
"resource": ""
} |
q170239 | expandStorageDrsAutomationConfig | validation | func expandStorageDrsAutomationConfig(d *schema.ResourceData) *types.StorageDrsAutomationConfig {
obj := &types.StorageDrsAutomationConfig{
IoLoadBalanceAutomationMode: d.Get("sdrs_io_balance_automation_level").(string),
PolicyEnforcementAutomationMode: d.Get("sdrs_policy_enforcement_automation_level").(string... | go | {
"resource": ""
} |
q170240 | flattenStorageDrsAutomationConfig | validation | func flattenStorageDrsAutomationConfig(d *schema.ResourceData, obj *types.StorageDrsAutomationConfig) error {
attrs := map[string]interface{}{
"sdrs_io_balance_automation_level": obj.IoLoadBalanceAutomationMode,
"sdrs_policy_enforcement_automation_level": obj.PolicyEnforcementAutomationMode,
"sdrs_rule_e... | go | {
"resource": ""
} |
q170241 | expandStorageDrsIoLoadBalanceConfig | validation | func expandStorageDrsIoLoadBalanceConfig(d *schema.ResourceData, version viapi.VSphereVersion) *types.StorageDrsIoLoadBalanceConfig {
obj := &types.StorageDrsIoLoadBalanceConfig{
IoLatencyThreshold: int32(d.Get("sdrs_io_latency_threshold").(int)),
IoLoadImbalanceThreshold: int32(d.Get("sdrs_io_load_imbalance... | go | {
"resource": ""
} |
q170242 | flattenStorageDrsIoLoadBalanceConfig | validation | func flattenStorageDrsIoLoadBalanceConfig(
d *schema.ResourceData,
obj *types.StorageDrsIoLoadBalanceConfig,
version viapi.VSphereVersion,
) error {
attrs := map[string]interface{}{
"sdrs_io_latency_threshold": obj.IoLatencyThreshold,
"sdrs_io_load_imbalance_threshold": obj.IoLoadImbalanceThreshold,
}
... | go | {
"resource": ""
} |
q170243 | expandStorageDrsSpaceLoadBalanceConfig | validation | func expandStorageDrsSpaceLoadBalanceConfig(
d *schema.ResourceData,
version viapi.VSphereVersion,
) *types.StorageDrsSpaceLoadBalanceConfig {
obj := &types.StorageDrsSpaceLoadBalanceConfig{
MinSpaceUtilizationDifference: int32(d.Get("sdrs_free_space_utilization_difference").(int)),
SpaceUtilizationThreshold: ... | go | {
"resource": ""
} |
q170244 | flattenStorageDrsSpaceLoadBalanceConfig | validation | func flattenStorageDrsSpaceLoadBalanceConfig(
d *schema.ResourceData,
obj *types.StorageDrsSpaceLoadBalanceConfig,
version viapi.VSphereVersion,
) error {
attrs := map[string]interface{}{
"sdrs_free_space_utilization_difference": obj.MinSpaceUtilizationDifference,
"sdrs_free_space_threshold_mode": obj.S... | go | {
"resource": ""
} |
q170245 | expandStorageDrsOptionSpec | validation | func expandStorageDrsOptionSpec(d *schema.ResourceData) []types.StorageDrsOptionSpec {
var opts []types.StorageDrsOptionSpec
m := d.Get("sdrs_advanced_options").(map[string]interface{})
for k, v := range m {
opts = append(opts, types.StorageDrsOptionSpec{
Option: &types.OptionValue{
Key: k,
Value: ty... | go | {
"resource": ""
} |
q170246 | flattenStorageDrsOptionSpec | validation | func flattenStorageDrsOptionSpec(d *schema.ResourceData, opts []types.BaseOptionValue) error {
m := make(map[string]interface{})
for _, opt := range opts {
m[opt.GetOptionValue().Key] = opt.GetOptionValue().Value
}
return d.Set("sdrs_advanced_options", m)
} | go | {
"resource": ""
} |
q170247 | resourceVSphereFolderMigrateState | validation | func resourceVSphereFolderMigrateState(version int, os *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
// Guard against a nil state.
if os == nil {
return nil, nil
}
// Guard against empty state, can't do anything with it
if os.Empty() {
return os, nil
}
var migrateFunc func... | go | {
"resource": ""
} |
q170248 | resourceVSphereFolderMigrateStateV1 | validation | func resourceVSphereFolderMigrateStateV1(s *terraform.InstanceState, meta interface{}) error {
// Our path for migration here is pretty much the same as our import path, so
// we just leverage that functionality.
//
// We just need the path and the datacenter to proceed. We don't have an
// analog in for existing_... | go | {
"resource": ""
} |
q170249 | getDatacenter | validation | func getDatacenter(c *govmomi.Client, dc string) (*object.Datacenter, error) {
finder := find.NewFinder(c.Client, true)
t := c.ServiceContent.About.ApiType
switch t {
case "HostAgent":
return finder.DefaultDatacenter(context.TODO())
case "VirtualCenter":
if dc != "" {
return finder.Datacenter(context.TODO()... | go | {
"resource": ""
} |
q170250 | datacenterFromID | validation | func datacenterFromID(client *govmomi.Client, id string) (*object.Datacenter, error) {
finder := find.NewFinder(client.Client, false)
ref := types.ManagedObjectReference{
Type: "Datacenter",
Value: id,
}
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
defer cancel()
ds, err := f... | go | {
"resource": ""
} |
q170251 | NewDiskSubresource | validation | func NewDiskSubresource(client *govmomi.Client, rdd resourceDataDiff, d, old map[string]interface{}, idx int) *DiskSubresource {
sr := &DiskSubresource{
Subresource: &Subresource{
schema: DiskSubresourceSchema(),
client: client,
srtype: subresourceTypeDisk,
data: d,
olddata: old,
rdd: rdd... | go | {
"resource": ""
} |
q170252 | DiskApplyOperation | validation | func DiskApplyOperation(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) (object.VirtualDeviceList, []types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] DiskApplyOperation: Beginning apply operation")
o, n := d.GetChange(subresourceTypeDisk)
ods := o.([]interface{})
nds := n.([]in... | go | {
"resource": ""
} |
q170253 | diskApplyOperationDelete | validation | func diskApplyOperationDelete(
index int,
oldData map[string]interface{},
newDataSet []interface{},
c *govmomi.Client,
d *schema.ResourceData,
l *object.VirtualDeviceList,
spec *[]types.BaseVirtualDeviceConfigSpec,
) error {
didx := -1
for ni, ne := range newDataSet {
newData := ne.(map[string]interface{})
... | go | {
"resource": ""
} |
q170254 | diskApplyOperationCreateUpdate | validation | func diskApplyOperationCreateUpdate(
index int,
newData map[string]interface{},
oldDataSet []interface{},
c *govmomi.Client,
d *schema.ResourceData,
l *object.VirtualDeviceList,
spec *[]types.BaseVirtualDeviceConfigSpec,
updates *[]interface{},
) error {
var name string
var err error
if name, err = diskLabel... | go | {
"resource": ""
} |
q170255 | DiskMigrateRelocateOperation | validation | func DiskMigrateRelocateOperation(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) ([]types.VirtualMachineRelocateSpecDiskLocator, bool, error) {
log.Printf("[DEBUG] DiskMigrateRelocateOperation: Generating any necessary disk relocate specs")
ods, nds := d.GetChange(subresourceTypeDisk)
var re... | go | {
"resource": ""
} |
q170256 | DiskCloneRelocateOperation | validation | func DiskCloneRelocateOperation(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) ([]types.VirtualMachineRelocateSpecDiskLocator, error) {
log.Printf("[DEBUG] DiskCloneRelocateOperation: Generating full disk relocate spec list")
devices := SelectDisks(l, d.Get("scsi_controller_count").(int))
log... | go | {
"resource": ""
} |
q170257 | DiskImportOperation | validation | func DiskImportOperation(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) error {
log.Printf("[DEBUG] DiskImportOperation: Performing pre-read import and validation of virtual disks")
devices := SelectDisks(l, d.Get("scsi_controller_count").(int))
// Sort the device list, in case it's not sorte... | go | {
"resource": ""
} |
q170258 | ReadDiskAttrsForDataSource | validation | func ReadDiskAttrsForDataSource(l object.VirtualDeviceList, count int) ([]map[string]interface{}, error) {
log.Printf("[DEBUG] ReadDiskAttrsForDataSource: Fetching select attributes for disks across %d SCSI controllers", count)
devices := SelectDisks(l, count)
log.Printf("[DEBUG] ReadDiskAttrsForDataSource: Disk dev... | go | {
"resource": ""
} |
q170259 | Create | validation | func (r *DiskSubresource) Create(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] %s: Creating disk", r)
var spec []types.BaseVirtualDeviceConfigSpec
disk, err := r.createDisk(l)
if err != nil {
return nil, fmt.Errorf("error creating disk: %s", err)
}
// We now hav... | go | {
"resource": ""
} |
q170260 | Read | validation | func (r *DiskSubresource) Read(l object.VirtualDeviceList) error {
log.Printf("[DEBUG] %s: Reading state", r)
disk, err := r.findVirtualDisk(l, true)
if err != nil {
return fmt.Errorf("cannot find disk device: %s", err)
}
unit, ctlr, err := r.findControllerInfo(l, disk)
if err != nil {
return err
}
r.Set("u... | go | {
"resource": ""
} |
q170261 | Update | validation | func (r *DiskSubresource) Update(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] %s: Beginning update", r)
disk, err := r.findVirtualDisk(l, false)
if err != nil {
return nil, fmt.Errorf("cannot find disk device: %s", err)
}
// Has the unit number changed?
if r.Ha... | go | {
"resource": ""
} |
q170262 | Delete | validation | func (r *DiskSubresource) Delete(l object.VirtualDeviceList) ([]types.BaseVirtualDeviceConfigSpec, error) {
log.Printf("[DEBUG] %s: Beginning delete", r)
disk, err := r.findVirtualDisk(l, false)
if err != nil {
return nil, fmt.Errorf("cannot find disk device: %s", err)
}
deleteSpec, err := object.VirtualDeviceLi... | go | {
"resource": ""
} |
q170263 | DiffExisting | validation | func (r *DiskSubresource) DiffExisting() error {
log.Printf("[DEBUG] %s: Beginning normalization of existing disk", r)
name, err := diskLabelOrName(r.data)
if err != nil {
return err
}
// Prevent a backward migration of label -> name. TODO: Remove this after
// 2.0.
olabel, nlabel := r.GetChange("label")
if o... | go | {
"resource": ""
} |
q170264 | DiffGeneral | validation | func (r *DiskSubresource) DiffGeneral() error {
log.Printf("[DEBUG] %s: Beginning diff validation", r)
name, err := diskLabelOrName(r.data)
if err != nil {
return err
}
// Enforce the maximum unit number, which is the current value of
// scsi_controller_count * 15 - 1.
ctlrCount := r.rdd.Get("scsi_controller_... | go | {
"resource": ""
} |
q170265 | normalizeDiskDatastore | validation | func (r *DiskSubresource) normalizeDiskDatastore() error {
podID := r.rdd.Get("datastore_cluster_id").(string)
dsID, _ := r.GetChange("datastore_id")
if podID == "" {
// We don't have a storage pod, just set the old ID and exit. We don't need
// to worry about whether or not the storage pod is computed here as ... | go | {
"resource": ""
} |
q170266 | Relocate | validation | func (r *DiskSubresource) Relocate(l object.VirtualDeviceList, clone bool) (types.VirtualMachineRelocateSpecDiskLocator, error) {
log.Printf("[DEBUG] %s: Starting relocate generation", r)
disk, err := r.findVirtualDisk(l, clone)
var relocate types.VirtualMachineRelocateSpecDiskLocator
if err != nil {
return reloc... | go | {
"resource": ""
} |
q170267 | String | validation | func (r *DiskSubresource) String() string {
p := diskPathOrName(r.data)
if p == "" {
p = "<unknown>"
}
return fmt.Sprintf("%s (%s)", r.Subresource.String(), p)
} | go | {
"resource": ""
} |
q170268 | expandDiskSettings | validation | func (r *DiskSubresource) expandDiskSettings(disk *types.VirtualDisk) error {
// Backing settings
b := disk.Backing.(*types.VirtualDiskFlatVer2BackingInfo)
b.DiskMode = r.GetWithRestart("disk_mode").(string)
b.WriteThrough = structure.BoolPtr(r.GetWithRestart("write_through").(bool))
// Only use disk_sharing if w... | go | {
"resource": ""
} |
q170269 | createDisk | validation | func (r *DiskSubresource) createDisk(l object.VirtualDeviceList) (*types.VirtualDisk, error) {
disk := new(types.VirtualDisk)
disk.Backing = new(types.VirtualDiskFlatVer2BackingInfo)
// Only assign backing info if a datastore cluster is not specified. If one
// is, skip this step.
if r.rdd.Get("datastore_cluster_... | go | {
"resource": ""
} |
q170270 | assignDisk | validation | func (r *DiskSubresource) assignDisk(l object.VirtualDeviceList, disk *types.VirtualDisk) (types.BaseVirtualController, error) {
number := r.Get("unit_number").(int)
// Figure out the bus number, and look up the SCSI controller that matches
// that. You can attach 15 disks to a SCSI controller, and we allow a maximu... | go | {
"resource": ""
} |
q170271 | findControllerInfo | validation | func (r *Subresource) findControllerInfo(l object.VirtualDeviceList, disk *types.VirtualDisk) (int, types.BaseVirtualController, error) {
ctlr := l.FindByKey(disk.ControllerKey)
if ctlr == nil {
return -1, nil, fmt.Errorf("could not find disk controller with key %d for disk key %d", disk.ControllerKey, disk.Key)
}... | go | {
"resource": ""
} |
q170272 | diskRelocateListString | validation | func diskRelocateListString(relocators []types.VirtualMachineRelocateSpecDiskLocator) string {
var out []string
for _, relocate := range relocators {
out = append(out, diskRelocateString(relocate))
}
return strings.Join(out, ",")
} | go | {
"resource": ""
} |
q170273 | diskRelocateString | validation | func diskRelocateString(relocate types.VirtualMachineRelocateSpecDiskLocator) string {
key := relocate.DiskId
var locstring string
if backing, ok := relocate.DiskBackingInfo.(*types.VirtualDiskFlatVer2BackingInfo); ok && backing != nil {
locstring = backing.FileName
} else {
locstring = relocate.Datastore.Value... | go | {
"resource": ""
} |
q170274 | Less | validation | func (l virtualDeviceListSorter) Less(i, j int) bool {
li := l.Sort[i]
lj := l.Sort[j]
liCtlr := l.DeviceList.FindByKey(li.GetVirtualDevice().ControllerKey)
ljCtlr := l.DeviceList.FindByKey(lj.GetVirtualDevice().ControllerKey)
if liCtlr == nil || ljCtlr == nil {
panic(errors.New("virtualDeviceListSorter cannot b... | go | {
"resource": ""
} |
q170275 | Swap | validation | func (l virtualDeviceListSorter) Swap(i, j int) {
l.Sort[i], l.Sort[j] = l.Sort[j], l.Sort[i]
} | go | {
"resource": ""
} |
q170276 | Less | validation | func (s virtualDiskSubresourceSorter) Less(i, j int) bool {
mi := s[i].(map[string]interface{})
mj := s[j].(map[string]interface{})
return mi["unit_number"].(int) < mj["unit_number"].(int)
} | go | {
"resource": ""
} |
q170277 | Swap | validation | func (s virtualDiskSubresourceSorter) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
} | go | {
"resource": ""
} |
q170278 | datastorePathHasBase | validation | func datastorePathHasBase(p, b string) bool {
dp := &object.DatastorePath{}
if ok := dp.FromString(p); !ok {
return false
}
return path.Base(dp.Path) == path.Base(b)
} | go | {
"resource": ""
} |
q170279 | findVirtualDisk | validation | func (r *DiskSubresource) findVirtualDisk(l object.VirtualDeviceList, fallback bool) (*types.VirtualDisk, error) {
device, err := r.findVirtualDiskByUUIDOrAddress(l, fallback)
if err != nil {
return nil, err
}
return device.(*types.VirtualDisk), nil
} | go | {
"resource": ""
} |
q170280 | diskCapacityInGiB | validation | func diskCapacityInGiB(disk *types.VirtualDisk) int {
if disk.CapacityInBytes > 0 {
return int(structure.ByteToGiB(disk.CapacityInBytes).(int64))
}
log.Printf(
"[DEBUG] diskCapacityInGiB: capacityInBytes missing for for %s, falling back to capacityInKB",
object.VirtualDeviceList{}.Name(disk),
)
return int(st... | go | {
"resource": ""
} |
q170281 | hostNetworkSystemFromHostSystem | validation | func hostNetworkSystemFromHostSystem(hs *object.HostSystem) (*object.HostNetworkSystem, error) {
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
defer cancel()
return hs.ConfigManager().NetworkSystem(ctx)
} | go | {
"resource": ""
} |
q170282 | hostNetworkSystemFromHostSystemID | validation | func hostNetworkSystemFromHostSystemID(client *govmomi.Client, hsID string) (*object.HostNetworkSystem, error) {
hs, err := hostsystem.FromID(client, hsID)
if err != nil {
return nil, err
}
return hostNetworkSystemFromHostSystem(hs)
} | go | {
"resource": ""
} |
q170283 | hostVSwitchFromName | validation | func hostVSwitchFromName(client *govmomi.Client, ns *object.HostNetworkSystem, name string) (*types.HostVirtualSwitch, error) {
var mns mo.HostNetworkSystem
pc := client.PropertyCollector()
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
defer cancel()
if err := pc.RetrieveOne(ctx, ns.R... | go | {
"resource": ""
} |
q170284 | hostPortGroupFromName | validation | func hostPortGroupFromName(client *govmomi.Client, ns *object.HostNetworkSystem, name string) (*types.HostPortGroup, error) {
var mns mo.HostNetworkSystem
pc := client.PropertyCollector()
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
defer cancel()
if err := pc.RetrieveOne(ctx, ns.Ref... | go | {
"resource": ""
} |
q170285 | networkObjectFromHostSystem | validation | func networkObjectFromHostSystem(client *govmomi.Client, hs *object.HostSystem, name string) (*object.Network, error) {
// Validate vCenter as this function is only relevant there
if err := viapi.ValidateVirtualCenter(client); err != nil {
return nil, err
}
finder := find.NewFinder(client.Client, false)
ctx, can... | go | {
"resource": ""
} |
q170286 | resourceVSphereLicenseUpdate | validation | func resourceVSphereLicenseUpdate(d *schema.ResourceData, meta interface{}) error {
log.Println("[INFO] Running the update method")
client := meta.(*VSphereClient).vimClient
manager := license.NewManager(client.Client)
if key, ok := d.GetOk("license_key"); ok {
licenseKey := key.(string)
if !isKeyPresent(lice... | go | {
"resource": ""
} |
q170287 | isKeyPresent | validation | func isKeyPresent(key string, manager *license.Manager) bool {
infoList, _ := manager.List(context.TODO())
for _, info := range infoList {
if info.LicenseKey == key {
return true
}
}
return false
} | go | {
"resource": ""
} |
q170288 | UpdateLabel | validation | func UpdateLabel(ctx context.Context, m *license.Manager, licenseKey string, key string, val string) error {
req := types.UpdateLicenseLabel{
This: m.Reference(),
LicenseKey: licenseKey,
LabelKey: key,
LabelValue: val,
}
_, err := methods.UpdateLicenseLabel(ctx, m.Client(), &req)
return err
} | go | {
"resource": ""
} |
q170289 | DecodeError | validation | func DecodeError(info types.LicenseManagerLicenseInfo) error {
for _, property := range info.Properties {
if property.Key == "diagnostic" {
return errors.New(property.Value.(string))
}
}
return nil
} | go | {
"resource": ""
} |
q170290 | resourceVSphereVAppContainerApplyTags | validation | func resourceVSphereVAppContainerApplyTags(d *schema.ResourceData, meta interface{}, va *object.VirtualApp) error {
tagsClient, err := tagsClientIfDefined(d, meta)
if err != nil {
return err
}
// Apply any pending tags now.
if tagsClient == nil {
log.Printf("[DEBUG] %s: Tags unsupported on this connection, sk... | go | {
"resource": ""
} |
q170291 | resourceVSphereVAppContainerReadTags | validation | func resourceVSphereVAppContainerReadTags(d *schema.ResourceData, meta interface{}, va *object.VirtualApp) error {
if tagsClient, _ := meta.(*VSphereClient).TagsClient(); tagsClient != nil {
log.Printf("[DEBUG] %s: Reading tags", resourceVSphereVAppContainerIDString(d))
if err := readTagsForResource(tagsClient, va... | go | {
"resource": ""
} |
q170292 | expandClusterVMHostRuleInfo | validation | func expandClusterVMHostRuleInfo(d *schema.ResourceData) (*types.ClusterVmHostRuleInfo, error) {
obj := &types.ClusterVmHostRuleInfo{
ClusterRuleInfo: types.ClusterRuleInfo{
Enabled: structure.GetBool(d, "enabled"),
Mandatory: structure.GetBool(d, "mandatory"),
Name: d.Get("name").(string),
... | go | {
"resource": ""
} |
q170293 | flattenClusterVMHostRuleInfo | validation | func flattenClusterVMHostRuleInfo(d *schema.ResourceData, obj *types.ClusterVmHostRuleInfo) error {
return structure.SetBatch(d, map[string]interface{}{
"enabled": obj.Enabled,
"mandatory": obj.Mandatory,
"name": obj.Name,
"affinity_host_group_... | go | {
"resource": ""
} |
q170294 | resourceVSphereVirtualMachineMigrateState | validation | func resourceVSphereVirtualMachineMigrateState(version int, os *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
// Guard against a nil state.
if os == nil {
return nil, nil
}
// Guard against empty state, can't do anything with it
if os.Empty() {
return os, nil
}
var migrateF... | go | {
"resource": ""
} |
q170295 | migrateVSphereVirtualMachineStateV3 | validation | func migrateVSphereVirtualMachineStateV3(is *terraform.InstanceState, meta interface{}) error {
// All we really preserve from the old state is the UUID of the virtual
// machine. We leverage some of the special parts of the import functionality
// - namely validating disks, and flagging the VM as imported in the st... | go | {
"resource": ""
} |
q170296 | NewEnvironmentBrowser | validation | func NewEnvironmentBrowser(c *vim25.Client, ref types.ManagedObjectReference) *EnvironmentBrowser {
return &EnvironmentBrowser{
Common: object.NewCommon(c, ref),
}
} | go | {
"resource": ""
} |
q170297 | DefaultDevices | validation | func (b *EnvironmentBrowser) DefaultDevices(ctx context.Context, key string, host *object.HostSystem) (object.VirtualDeviceList, error) {
var eb mo.EnvironmentBrowser
err := b.Properties(ctx, b.Reference(), nil, &eb)
if err != nil {
return nil, err
}
req := types.QueryConfigOption{
This: b.Reference(),
Key... | go | {
"resource": ""
} |
q170298 | OSFamily | validation | func (b *EnvironmentBrowser) OSFamily(ctx context.Context, guest string) (string, error) {
var eb mo.EnvironmentBrowser
err := b.Properties(ctx, b.Reference(), nil, &eb)
if err != nil {
return "", err
}
req := types.QueryConfigOption{
This: b.Reference(),
}
res, err := methods.QueryConfigOption(ctx, b.Clie... | go | {
"resource": ""
} |
q170299 | QueryConfigOptionDescriptor | validation | func (b *EnvironmentBrowser) QueryConfigOptionDescriptor(ctx context.Context) ([]types.VirtualMachineConfigOptionDescriptor, error) {
req := types.QueryConfigOptionDescriptor{
This: b.Reference(),
}
res, err := methods.QueryConfigOptionDescriptor(ctx, b.Client(), &req)
if err != nil {
return nil, err
}
return... | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.