min and max values.
+ // A partial range specifies one or the other, min or max.
PbmBuiltinGenericTypeVMW_RANGE = PbmBuiltinGenericType("VMW_RANGE")
- PbmBuiltinGenericTypeVMW_SET = PbmBuiltinGenericType("VMW_SET")
+ // Indicates a single value or a discrete set of values
+ // (`PbmCapabilityDiscreteSet`).
+ PbmBuiltinGenericTypeVMW_SET = PbmBuiltinGenericType("VMW_SET")
)
func init() {
types.Add("pbm:PbmBuiltinGenericType", reflect.TypeOf((*PbmBuiltinGenericType)(nil)).Elem())
}
+// The `PbmBuiltinType_enum` enumerated type defines datatypes
+// for storage profiles.
+//
+// Property metadata
+// (`PbmCapabilityPropertyMetadata`) uses the builtin types
+// to define data types for storage capabilities and requirements.
+// It may also specify the semantics that are applied to a collection
+// of builtin type values. See `PbmCapabilityTypeInfo`.
+// These semantics are specified as a generic builtin type.
+// See `PbmCapabilityGenericTypeInfo`.
+// The type information determines how capability constraints are interpreted
+// `PbmCapabilityPropertyInstance.value`).
type PbmBuiltinType string
const (
- PbmBuiltinTypeXSD_LONG = PbmBuiltinType("XSD_LONG")
- PbmBuiltinTypeXSD_SHORT = PbmBuiltinType("XSD_SHORT")
- PbmBuiltinTypeXSD_INTEGER = PbmBuiltinType("XSD_INTEGER")
- PbmBuiltinTypeXSD_INT = PbmBuiltinType("XSD_INT")
- PbmBuiltinTypeXSD_STRING = PbmBuiltinType("XSD_STRING")
- PbmBuiltinTypeXSD_BOOLEAN = PbmBuiltinType("XSD_BOOLEAN")
- PbmBuiltinTypeXSD_DOUBLE = PbmBuiltinType("XSD_DOUBLE")
+ // Unsigned long value.
+ //
+ // This datatype supports the following constraint values.
+ // - Single value
+ // - Full or partial range of values (`PbmCapabilityRange`)
+ // - Discrete set of values (`PbmCapabilityDiscreteSet`)
+ PbmBuiltinTypeXSD_LONG = PbmBuiltinType("XSD_LONG")
+ // Datatype not supported.
+ PbmBuiltinTypeXSD_SHORT = PbmBuiltinType("XSD_SHORT")
+ // Datatype not supported.
+ //
+ // Use XSD\_INT instead.
+ PbmBuiltinTypeXSD_INTEGER = PbmBuiltinType("XSD_INTEGER")
+ // Integer value.
+ //
+ // This datatype supports the following constraint values.
+ // - Single value
+ // - Full or partial range of values (`PbmCapabilityRange`)
+ // - Discrete set of values (`PbmCapabilityDiscreteSet`)
+ PbmBuiltinTypeXSD_INT = PbmBuiltinType("XSD_INT")
+ // String value.
+ //
+ // This datatype supports a single value
+ // or a discrete set of values (`PbmCapabilityDiscreteSet`).
+ PbmBuiltinTypeXSD_STRING = PbmBuiltinType("XSD_STRING")
+ // Boolean value.
+ PbmBuiltinTypeXSD_BOOLEAN = PbmBuiltinType("XSD_BOOLEAN")
+ // Double precision floating point value.
+ //
+ // This datatype supports the following
+ // constraint values.
+ // - Single value
+ // - Full or partial range of values (`PbmCapabilityRange`)
+ // - Discrete set of values (`PbmCapabilityDiscreteSet`)
+ PbmBuiltinTypeXSD_DOUBLE = PbmBuiltinType("XSD_DOUBLE")
+ // Date and time value.
PbmBuiltinTypeXSD_DATETIME = PbmBuiltinType("XSD_DATETIME")
+ // Timespan value (`PbmCapabilityTimeSpan`).
+ //
+ // This datatype supports
+ // the following constraint values.
+ // - Single value
+ // - Full or partial range of values (`PbmCapabilityRange`)
+ // - Discrete set of values (`PbmCapabilityDiscreteSet`)
PbmBuiltinTypeVMW_TIMESPAN = PbmBuiltinType("VMW_TIMESPAN")
PbmBuiltinTypeVMW_POLICY = PbmBuiltinType("VMW_POLICY")
)
@@ -64,6 +129,10 @@ func init() {
types.Add("pbm:PbmBuiltinType", reflect.TypeOf((*PbmBuiltinType)(nil)).Elem())
}
+// List of operators that are supported for constructing policy.
+//
+// Currently only tag based properties can use this operator.
+// Other operators can be added as required.
type PbmCapabilityOperator string
const (
@@ -74,52 +143,96 @@ func init() {
types.Add("pbm:PbmCapabilityOperator", reflect.TypeOf((*PbmCapabilityOperator)(nil)).Elem())
}
+// The `PbmCapabilityTimeUnitType_enum` enumeration type
+// defines the supported list of time units for profiles that specify
+// time span capabilities and constraints.
+//
+// See `PbmCapabilityTimeSpan`.
type PbmCapabilityTimeUnitType string
const (
+ // Constraints and capabilities expressed in units of seconds.
PbmCapabilityTimeUnitTypeSECONDS = PbmCapabilityTimeUnitType("SECONDS")
+ // Constraints and capabilities expressed in units of minutes.
PbmCapabilityTimeUnitTypeMINUTES = PbmCapabilityTimeUnitType("MINUTES")
- PbmCapabilityTimeUnitTypeHOURS = PbmCapabilityTimeUnitType("HOURS")
- PbmCapabilityTimeUnitTypeDAYS = PbmCapabilityTimeUnitType("DAYS")
- PbmCapabilityTimeUnitTypeWEEKS = PbmCapabilityTimeUnitType("WEEKS")
- PbmCapabilityTimeUnitTypeMONTHS = PbmCapabilityTimeUnitType("MONTHS")
- PbmCapabilityTimeUnitTypeYEARS = PbmCapabilityTimeUnitType("YEARS")
+ // Constraints and capabilities expressed in units of hours.
+ PbmCapabilityTimeUnitTypeHOURS = PbmCapabilityTimeUnitType("HOURS")
+ // Constraints and capabilities expressed in units of days.
+ PbmCapabilityTimeUnitTypeDAYS = PbmCapabilityTimeUnitType("DAYS")
+ // Constraints and capabilities expressed in units of weeks.
+ PbmCapabilityTimeUnitTypeWEEKS = PbmCapabilityTimeUnitType("WEEKS")
+ // Constraints and capabilities expressed in units of months.
+ PbmCapabilityTimeUnitTypeMONTHS = PbmCapabilityTimeUnitType("MONTHS")
+ // Constraints and capabilities expressed in units of years.
+ PbmCapabilityTimeUnitTypeYEARS = PbmCapabilityTimeUnitType("YEARS")
)
func init() {
types.Add("pbm:PbmCapabilityTimeUnitType", reflect.TypeOf((*PbmCapabilityTimeUnitType)(nil)).Elem())
}
+// The `PbmComplianceResultComplianceTaskStatus_enum`
+// enumeration type defines the set of task status for compliance
+// operations.
+//
+// See `PbmComplianceResult` and
+// `PbmRollupComplianceResult`.
type PbmComplianceResultComplianceTaskStatus string
const (
+ // Compliance calculation is in progress.
PbmComplianceResultComplianceTaskStatusInProgress = PbmComplianceResultComplianceTaskStatus("inProgress")
- PbmComplianceResultComplianceTaskStatusSuccess = PbmComplianceResultComplianceTaskStatus("success")
- PbmComplianceResultComplianceTaskStatusFailed = PbmComplianceResultComplianceTaskStatus("failed")
+ // Compliance calculation has succeeded.
+ PbmComplianceResultComplianceTaskStatusSuccess = PbmComplianceResultComplianceTaskStatus("success")
+ // Compliance calculation failed due to some exception.
+ PbmComplianceResultComplianceTaskStatusFailed = PbmComplianceResultComplianceTaskStatus("failed")
)
func init() {
types.Add("pbm:PbmComplianceResultComplianceTaskStatus", reflect.TypeOf((*PbmComplianceResultComplianceTaskStatus)(nil)).Elem())
}
+// The `PbmComplianceStatus_enum`
+// enumeration type defines the set of status values
+// for compliance operations.
+//
+// See `PbmComplianceResult` and
+// `PbmRollupComplianceResult`.
type PbmComplianceStatus string
const (
- PbmComplianceStatusCompliant = PbmComplianceStatus("compliant")
- PbmComplianceStatusNonCompliant = PbmComplianceStatus("nonCompliant")
- PbmComplianceStatusUnknown = PbmComplianceStatus("unknown")
+ // Entity is in compliance.
+ PbmComplianceStatusCompliant = PbmComplianceStatus("compliant")
+ // Entity is out of compliance.
+ PbmComplianceStatusNonCompliant = PbmComplianceStatus("nonCompliant")
+ // Compliance status of the entity is not known.
+ PbmComplianceStatusUnknown = PbmComplianceStatus("unknown")
+ // Compliance computation is not applicable for this entity,
+ // because it does not have any storage requirements that
+ // apply to the object-based datastore on which this entity is placed.
PbmComplianceStatusNotApplicable = PbmComplianceStatus("notApplicable")
- PbmComplianceStatusOutOfDate = PbmComplianceStatus("outOfDate")
+ // This is the same as `PbmComplianceResult.mismatch`
+ // variable.
+ //
+ // Compliance status becomes out-of-date when the profile
+ // associated with the entity is edited and not applied. The compliance
+ // status will remain in out-of-date compliance status until the latest
+ // policy is applied to the entity.
+ PbmComplianceStatusOutOfDate = PbmComplianceStatus("outOfDate")
)
func init() {
types.Add("pbm:PbmComplianceStatus", reflect.TypeOf((*PbmComplianceStatus)(nil)).Elem())
}
+// This enum corresponds to the keystores used by
+// sps.
type PbmDebugManagerKeystoreName string
const (
- PbmDebugManagerKeystoreNameSMS = PbmDebugManagerKeystoreName("SMS")
+ // Refers to SMS keystore
+ PbmDebugManagerKeystoreNameSMS = PbmDebugManagerKeystoreName("SMS")
+ // Refers to TRUSTED\_ROOTS keystore.
PbmDebugManagerKeystoreNameTRUSTED_ROOTS = PbmDebugManagerKeystoreName("TRUSTED_ROOTS")
)
@@ -127,12 +240,30 @@ func init() {
types.Add("pbm:PbmDebugManagerKeystoreName", reflect.TypeOf((*PbmDebugManagerKeystoreName)(nil)).Elem())
}
+// The enumeration type defines the set of health status values for an entity
+// that is part of entity health operation.
type PbmHealthStatusForEntity string
const (
- PbmHealthStatusForEntityRed = PbmHealthStatusForEntity("red")
- PbmHealthStatusForEntityYellow = PbmHealthStatusForEntity("yellow")
- PbmHealthStatusForEntityGreen = PbmHealthStatusForEntity("green")
+ // For file share: 'red' if the file server for this file share is in error
+ // state or any of its backing vSAN objects are degraded.
+ //
+ // For FCD: 'red' if the datastore on which the FCD resides is not
+ // accessible from any of the hosts it is mounted.
+ PbmHealthStatusForEntityRed = PbmHealthStatusForEntity("red")
+ // For file share: 'yellow' if some backing objects are repairing, i.e.
+ //
+ // warning state.
+ // For FCD: 'yellow' if the datastore on which the entity resides is
+ // accessible only from some of the hosts it is mounted but not all.
+ PbmHealthStatusForEntityYellow = PbmHealthStatusForEntity("yellow")
+ // For file share: 'green' if the file server for this file share is
+ // running properly and all its backing vSAN objects are healthy.
+ //
+ // For FCD: 'green' if the datastore on which the entity resides
+ // is accessible from all the hosts it is mounted.
+ PbmHealthStatusForEntityGreen = PbmHealthStatusForEntity("green")
+ // If the health status of a file share is unknown, not valid for FCD.
PbmHealthStatusForEntityUnknown = PbmHealthStatusForEntity("unknown")
)
@@ -140,6 +271,11 @@ func init() {
types.Add("pbm:PbmHealthStatusForEntity", reflect.TypeOf((*PbmHealthStatusForEntity)(nil)).Elem())
}
+// Recognized types of an IO Filter.
+//
+// String constant used in `IofilterInfo#filterType`.
+// These should match(upper case) the IO Filter classes as defined by IO Filter framework.
+// See https://opengrok.eng.vmware.com/source/xref/vmcore-main.perforce.1666/bora/scons/apps/esx/iofilterApps.sc#33
type PbmIofilterInfoFilterType string
const (
@@ -156,6 +292,7 @@ func init() {
types.Add("pbm:PbmIofilterInfoFilterType", reflect.TypeOf((*PbmIofilterInfoFilterType)(nil)).Elem())
}
+// Denotes the line of service of a schema.
type PbmLineOfServiceInfoLineOfServiceEnum string
const (
@@ -174,28 +311,43 @@ func init() {
types.Add("pbm:PbmLineOfServiceInfoLineOfServiceEnum", reflect.TypeOf((*PbmLineOfServiceInfoLineOfServiceEnum)(nil)).Elem())
}
+// This enum corresponds to the different packages whose logging
+// is configured independently by sps service.
type PbmLoggingConfigurationComponent string
const (
- PbmLoggingConfigurationComponentPbm = PbmLoggingConfigurationComponent("pbm")
- PbmLoggingConfigurationComponentVslm = PbmLoggingConfigurationComponent("vslm")
- PbmLoggingConfigurationComponentSms = PbmLoggingConfigurationComponent("sms")
- PbmLoggingConfigurationComponentSpbm = PbmLoggingConfigurationComponent("spbm")
- PbmLoggingConfigurationComponentSps = PbmLoggingConfigurationComponent("sps")
- PbmLoggingConfigurationComponentHttpclient_header = PbmLoggingConfigurationComponent("httpclient_header")
+ // Modifies logging level of com.vmware.pbm package.
+ PbmLoggingConfigurationComponentPbm = PbmLoggingConfigurationComponent("pbm")
+ // Modifies logging level of com.vmware.vslm package.
+ PbmLoggingConfigurationComponentVslm = PbmLoggingConfigurationComponent("vslm")
+ // Modifies logging level of com.vmware.vim.sms package.
+ PbmLoggingConfigurationComponentSms = PbmLoggingConfigurationComponent("sms")
+ // Modifies logging level of com.vmware.spbm package.
+ PbmLoggingConfigurationComponentSpbm = PbmLoggingConfigurationComponent("spbm")
+ // Modifies logging level of com.vmware.sps package.
+ PbmLoggingConfigurationComponentSps = PbmLoggingConfigurationComponent("sps")
+ // Modifies logging level of httpclient wire header.
+ PbmLoggingConfigurationComponentHttpclient_header = PbmLoggingConfigurationComponent("httpclient_header")
+ // Modifies logging level of httpclient wire content.
PbmLoggingConfigurationComponentHttpclient_content = PbmLoggingConfigurationComponent("httpclient_content")
- PbmLoggingConfigurationComponentVmomi = PbmLoggingConfigurationComponent("vmomi")
+ // Modifies logging level of com.vmware.vim.vmomi package.
+ PbmLoggingConfigurationComponentVmomi = PbmLoggingConfigurationComponent("vmomi")
)
func init() {
types.Add("pbm:PbmLoggingConfigurationComponent", reflect.TypeOf((*PbmLoggingConfigurationComponent)(nil)).Elem())
}
+// This enum corresponds to the different log levels supported
+// by sps service.
type PbmLoggingConfigurationLogLevel string
const (
- PbmLoggingConfigurationLogLevelINFO = PbmLoggingConfigurationLogLevel("INFO")
+ // Refers to INFO level logging
+ PbmLoggingConfigurationLogLevelINFO = PbmLoggingConfigurationLogLevel("INFO")
+ // Refers to DEBUG level logging.
PbmLoggingConfigurationLogLevelDEBUG = PbmLoggingConfigurationLogLevel("DEBUG")
+ // Refers to TRACE level logging.
PbmLoggingConfigurationLogLevelTRACE = PbmLoggingConfigurationLogLevel("TRACE")
)
@@ -203,42 +355,76 @@ func init() {
types.Add("pbm:PbmLoggingConfigurationLogLevel", reflect.TypeOf((*PbmLoggingConfigurationLogLevel)(nil)).Elem())
}
+// The `PbmObjectType_enum` enumerated type
+// defines vSphere Server object types that are known
+// to the Storage Policy Server.
+//
+// See `PbmServerObjectRef*.*PbmServerObjectRef.objectType`.
type PbmObjectType string
const (
- PbmObjectTypeVirtualMachine = PbmObjectType("virtualMachine")
+ // Indicates a virtual machine, not including the disks, identified by the virtual machine
+ // identifier _virtual-machine-mor_.
+ PbmObjectTypeVirtualMachine = PbmObjectType("virtualMachine")
+ // Indicates the virtual machine and all its disks, identified by the virtual machine
+ // identifier _virtual-machine-mor_.
PbmObjectTypeVirtualMachineAndDisks = PbmObjectType("virtualMachineAndDisks")
- PbmObjectTypeVirtualDiskId = PbmObjectType("virtualDiskId")
- PbmObjectTypeVirtualDiskUUID = PbmObjectType("virtualDiskUUID")
- PbmObjectTypeDatastore = PbmObjectType("datastore")
- PbmObjectTypeVsanObjectId = PbmObjectType("vsanObjectId")
- PbmObjectTypeFileShareId = PbmObjectType("fileShareId")
- PbmObjectTypeUnknown = PbmObjectType("unknown")
+ // Indicates a virtual disk, identified by disk key
+ // (_virtual-machine-mor_:_disk-key_).
+ PbmObjectTypeVirtualDiskId = PbmObjectType("virtualDiskId")
+ // Indicates a virtual disk, identified by UUID - for First Class Storage Object support.
+ PbmObjectTypeVirtualDiskUUID = PbmObjectType("virtualDiskUUID")
+ // Indicates a datastore.
+ PbmObjectTypeDatastore = PbmObjectType("datastore")
+ // Indicates a VSAN object
+ PbmObjectTypeVsanObjectId = PbmObjectType("vsanObjectId")
+ // Indicates a file service
+ PbmObjectTypeFileShareId = PbmObjectType("fileShareId")
+ // Unknown object type.
+ PbmObjectTypeUnknown = PbmObjectType("unknown")
)
func init() {
types.Add("pbm:PbmObjectType", reflect.TypeOf((*PbmObjectType)(nil)).Elem())
}
+// The `PbmOperation_enum` enumerated type
+// defines the provisioning operation being performed on the entity like FCD, virtual machine.
type PbmOperation string
const (
- PbmOperationCREATE = PbmOperation("CREATE")
- PbmOperationREGISTER = PbmOperation("REGISTER")
+ // Indicates create operation of an entity.
+ PbmOperationCREATE = PbmOperation("CREATE")
+ // Indicates register operation of an entity.
+ PbmOperationREGISTER = PbmOperation("REGISTER")
+ // Indicates reconfigure operation of an entity.
PbmOperationRECONFIGURE = PbmOperation("RECONFIGURE")
- PbmOperationMIGRATE = PbmOperation("MIGRATE")
- PbmOperationCLONE = PbmOperation("CLONE")
+ // Indicates migrate operation of an entity.
+ PbmOperationMIGRATE = PbmOperation("MIGRATE")
+ // Indicates clone operation of an entity.
+ PbmOperationCLONE = PbmOperation("CLONE")
)
func init() {
types.Add("pbm:PbmOperation", reflect.TypeOf((*PbmOperation)(nil)).Elem())
}
+// Volume allocation type constants.
type PbmPolicyAssociationVolumeAllocationType string
const (
- PbmPolicyAssociationVolumeAllocationTypeFullyInitialized = PbmPolicyAssociationVolumeAllocationType("FullyInitialized")
- PbmPolicyAssociationVolumeAllocationTypeReserveSpace = PbmPolicyAssociationVolumeAllocationType("ReserveSpace")
+ // Space required is fully allocated and initialized.
+ //
+ // It is wiped clean of any previous content on the
+ // physical media. Gives faster runtime IO performance.
+ PbmPolicyAssociationVolumeAllocationTypeFullyInitialized = PbmPolicyAssociationVolumeAllocationType("FullyInitialized")
+ // Space required is fully allocated.
+ //
+ // It may contain
+ // stale data on the physical media.
+ PbmPolicyAssociationVolumeAllocationTypeReserveSpace = PbmPolicyAssociationVolumeAllocationType("ReserveSpace")
+ // Space required is allocated and zeroed on demand
+ // as the space is used.
PbmPolicyAssociationVolumeAllocationTypeConserveSpaceWhenPossible = PbmPolicyAssociationVolumeAllocationType("ConserveSpaceWhenPossible")
)
@@ -246,11 +432,30 @@ func init() {
types.Add("pbm:PbmPolicyAssociationVolumeAllocationType", reflect.TypeOf((*PbmPolicyAssociationVolumeAllocationType)(nil)).Elem())
}
+// The `PbmProfileCategoryEnum_enum`
+// enumerated type defines the profile categories for a capability-based
+// storage profile.
+//
+// See
+// `PbmCapabilityProfile`.
type PbmProfileCategoryEnum string
const (
- PbmProfileCategoryEnumREQUIREMENT = PbmProfileCategoryEnum("REQUIREMENT")
- PbmProfileCategoryEnumRESOURCE = PbmProfileCategoryEnum("RESOURCE")
+ // Indicates a storage requirement.
+ //
+ // Requirements are based on
+ // storage capabilities.
+ PbmProfileCategoryEnumREQUIREMENT = PbmProfileCategoryEnum("REQUIREMENT")
+ // Indicates a storage capability.
+ //
+ // Storage capabilities
+ // are defined by storage providers.
+ PbmProfileCategoryEnumRESOURCE = PbmProfileCategoryEnum("RESOURCE")
+ // Indicates a data service policy that can be embedded into
+ // another storage policy.
+ //
+ // Policies of this type can't be assigned to
+ // Virtual Machines or Virtual Disks.
PbmProfileCategoryEnumDATA_SERVICE_POLICY = PbmProfileCategoryEnum("DATA_SERVICE_POLICY")
)
@@ -258,9 +463,14 @@ func init() {
types.Add("pbm:PbmProfileCategoryEnum", reflect.TypeOf((*PbmProfileCategoryEnum)(nil)).Elem())
}
+// The `PbmProfileResourceTypeEnum_enum` enumerated type defines the set of resource
+// types that are supported for profile management.
+//
+// See `PbmProfileResourceType`.
type PbmProfileResourceTypeEnum string
const (
+ // Indicates resources that support storage profiles.
PbmProfileResourceTypeEnumSTORAGE = PbmProfileResourceTypeEnum("STORAGE")
)
@@ -268,12 +478,21 @@ func init() {
types.Add("pbm:PbmProfileResourceTypeEnum", reflect.TypeOf((*PbmProfileResourceTypeEnum)(nil)).Elem())
}
+// System pre-created profile types.
type PbmSystemCreatedProfileType string
const (
- PbmSystemCreatedProfileTypeVsanDefaultProfile = PbmSystemCreatedProfileType("VsanDefaultProfile")
- PbmSystemCreatedProfileTypeVVolDefaultProfile = PbmSystemCreatedProfileType("VVolDefaultProfile")
- PbmSystemCreatedProfileTypePmemDefaultProfile = PbmSystemCreatedProfileType("PmemDefaultProfile")
+ // Indicates the system pre-created editable VSAN default profile.
+ PbmSystemCreatedProfileTypeVsanDefaultProfile = PbmSystemCreatedProfileType("VsanDefaultProfile")
+ // Indicates the system pre-created non-editable default profile
+ // for VVOL datastores.
+ PbmSystemCreatedProfileTypeVVolDefaultProfile = PbmSystemCreatedProfileType("VVolDefaultProfile")
+ // Indicates the system pre-created non-editable default profile
+ // for PMem datastores
+ PbmSystemCreatedProfileTypePmemDefaultProfile = PbmSystemCreatedProfileType("PmemDefaultProfile")
+ // Indicates the system pre-created non-editable VMC default profile.
+ PbmSystemCreatedProfileTypeVmcManagementProfile = PbmSystemCreatedProfileType("VmcManagementProfile")
+ // Indicates the system pre-created non-editable VSANMAX default profile.
PbmSystemCreatedProfileTypeVsanMaxDefaultProfile = PbmSystemCreatedProfileType("VsanMaxDefaultProfile")
)
@@ -281,25 +500,39 @@ func init() {
types.Add("pbm:PbmSystemCreatedProfileType", reflect.TypeOf((*PbmSystemCreatedProfileType)(nil)).Elem())
}
+// The `PbmVmOperation_enum` enumerated type
+// defines the provisioning operation being performed on the virtual machine.
type PbmVmOperation string
const (
- PbmVmOperationCREATE = PbmVmOperation("CREATE")
+ // Indicates create operation of a virtual machine.
+ PbmVmOperationCREATE = PbmVmOperation("CREATE")
+ // Indicates reconfigure operation of a virtual machine.
PbmVmOperationRECONFIGURE = PbmVmOperation("RECONFIGURE")
- PbmVmOperationMIGRATE = PbmVmOperation("MIGRATE")
- PbmVmOperationCLONE = PbmVmOperation("CLONE")
+ // Indicates migrate operation of a virtual machine.
+ PbmVmOperationMIGRATE = PbmVmOperation("MIGRATE")
+ // Indicates clone operation of a virtual machine.
+ PbmVmOperationCLONE = PbmVmOperation("CLONE")
)
func init() {
types.Add("pbm:PbmVmOperation", reflect.TypeOf((*PbmVmOperation)(nil)).Elem())
}
+// The `PbmVvolType_enum` enumeration type
+// defines VVOL types.
+//
+// VvolType's are referenced to specify which objectType
+// to fetch for default capability.
type PbmVvolType string
const (
+ // meta-data volume
PbmVvolTypeConfig = PbmVvolType("Config")
- PbmVvolTypeData = PbmVvolType("Data")
- PbmVvolTypeSwap = PbmVvolType("Swap")
+ // vmdk volume
+ PbmVvolTypeData = PbmVvolType("Data")
+ // swap volume
+ PbmVvolTypeSwap = PbmVvolType("Swap")
)
func init() {
diff --git a/vendor/github.com/vmware/govmomi/pbm/types/if.go b/vendor/github.com/vmware/govmomi/pbm/types/if.go
index a740a25dab..4008dffff7 100644
--- a/vendor/github.com/vmware/govmomi/pbm/types/if.go
+++ b/vendor/github.com/vmware/govmomi/pbm/types/if.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
+Copyright (c) 2014-2023 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.
diff --git a/vendor/github.com/vmware/govmomi/pbm/types/types.go b/vendor/github.com/vmware/govmomi/pbm/types/types.go
index 1687df447d..4c6f72caec 100644
--- a/vendor/github.com/vmware/govmomi/pbm/types/types.go
+++ b/vendor/github.com/vmware/govmomi/pbm/types/types.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2014-2022 VMware, Inc. All Rights Reserved.
+Copyright (c) 2014-2023 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.
@@ -23,246 +23,304 @@ import (
"github.com/vmware/govmomi/vim25/types"
)
+// A boxed array of `PbmCapabilityConstraintInstance`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityConstraintInstance struct {
- PbmCapabilityConstraintInstance []PbmCapabilityConstraintInstance `xml:"PbmCapabilityConstraintInstance,omitempty"`
+ PbmCapabilityConstraintInstance []PbmCapabilityConstraintInstance `xml:"PbmCapabilityConstraintInstance,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityConstraintInstance", reflect.TypeOf((*ArrayOfPbmCapabilityConstraintInstance)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityInstance`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityInstance struct {
- PbmCapabilityInstance []PbmCapabilityInstance `xml:"PbmCapabilityInstance,omitempty"`
+ PbmCapabilityInstance []PbmCapabilityInstance `xml:"PbmCapabilityInstance,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityInstance", reflect.TypeOf((*ArrayOfPbmCapabilityInstance)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityMetadata`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityMetadata struct {
- PbmCapabilityMetadata []PbmCapabilityMetadata `xml:"PbmCapabilityMetadata,omitempty"`
+ PbmCapabilityMetadata []PbmCapabilityMetadata `xml:"PbmCapabilityMetadata,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityMetadata", reflect.TypeOf((*ArrayOfPbmCapabilityMetadata)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityMetadataPerCategory`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityMetadataPerCategory struct {
- PbmCapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"PbmCapabilityMetadataPerCategory,omitempty"`
+ PbmCapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"PbmCapabilityMetadataPerCategory,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityMetadataPerCategory", reflect.TypeOf((*ArrayOfPbmCapabilityMetadataPerCategory)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityPropertyInstance`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityPropertyInstance struct {
- PbmCapabilityPropertyInstance []PbmCapabilityPropertyInstance `xml:"PbmCapabilityPropertyInstance,omitempty"`
+ PbmCapabilityPropertyInstance []PbmCapabilityPropertyInstance `xml:"PbmCapabilityPropertyInstance,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityPropertyInstance", reflect.TypeOf((*ArrayOfPbmCapabilityPropertyInstance)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityPropertyMetadata`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityPropertyMetadata struct {
- PbmCapabilityPropertyMetadata []PbmCapabilityPropertyMetadata `xml:"PbmCapabilityPropertyMetadata,omitempty"`
+ PbmCapabilityPropertyMetadata []PbmCapabilityPropertyMetadata `xml:"PbmCapabilityPropertyMetadata,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityPropertyMetadata", reflect.TypeOf((*ArrayOfPbmCapabilityPropertyMetadata)(nil)).Elem())
}
+// A boxed array of `PbmCapabilitySchema`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilitySchema struct {
- PbmCapabilitySchema []PbmCapabilitySchema `xml:"PbmCapabilitySchema,omitempty"`
+ PbmCapabilitySchema []PbmCapabilitySchema `xml:"PbmCapabilitySchema,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilitySchema", reflect.TypeOf((*ArrayOfPbmCapabilitySchema)(nil)).Elem())
}
+// A boxed array of `PbmCapabilitySubProfile`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilitySubProfile struct {
- PbmCapabilitySubProfile []PbmCapabilitySubProfile `xml:"PbmCapabilitySubProfile,omitempty"`
+ PbmCapabilitySubProfile []PbmCapabilitySubProfile `xml:"PbmCapabilitySubProfile,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilitySubProfile", reflect.TypeOf((*ArrayOfPbmCapabilitySubProfile)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityVendorNamespaceInfo`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityVendorNamespaceInfo struct {
- PbmCapabilityVendorNamespaceInfo []PbmCapabilityVendorNamespaceInfo `xml:"PbmCapabilityVendorNamespaceInfo,omitempty"`
+ PbmCapabilityVendorNamespaceInfo []PbmCapabilityVendorNamespaceInfo `xml:"PbmCapabilityVendorNamespaceInfo,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityVendorNamespaceInfo", reflect.TypeOf((*ArrayOfPbmCapabilityVendorNamespaceInfo)(nil)).Elem())
}
+// A boxed array of `PbmCapabilityVendorResourceTypeInfo`. To be used in `Any` placeholders.
type ArrayOfPbmCapabilityVendorResourceTypeInfo struct {
- PbmCapabilityVendorResourceTypeInfo []PbmCapabilityVendorResourceTypeInfo `xml:"PbmCapabilityVendorResourceTypeInfo,omitempty"`
+ PbmCapabilityVendorResourceTypeInfo []PbmCapabilityVendorResourceTypeInfo `xml:"PbmCapabilityVendorResourceTypeInfo,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCapabilityVendorResourceTypeInfo", reflect.TypeOf((*ArrayOfPbmCapabilityVendorResourceTypeInfo)(nil)).Elem())
}
+// A boxed array of `PbmCompliancePolicyStatus`. To be used in `Any` placeholders.
type ArrayOfPbmCompliancePolicyStatus struct {
- PbmCompliancePolicyStatus []PbmCompliancePolicyStatus `xml:"PbmCompliancePolicyStatus,omitempty"`
+ PbmCompliancePolicyStatus []PbmCompliancePolicyStatus `xml:"PbmCompliancePolicyStatus,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmCompliancePolicyStatus", reflect.TypeOf((*ArrayOfPbmCompliancePolicyStatus)(nil)).Elem())
}
+// A boxed array of `PbmComplianceResult`. To be used in `Any` placeholders.
type ArrayOfPbmComplianceResult struct {
- PbmComplianceResult []PbmComplianceResult `xml:"PbmComplianceResult,omitempty"`
+ PbmComplianceResult []PbmComplianceResult `xml:"PbmComplianceResult,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmComplianceResult", reflect.TypeOf((*ArrayOfPbmComplianceResult)(nil)).Elem())
}
+// A boxed array of `PbmDatastoreSpaceStatistics`. To be used in `Any` placeholders.
type ArrayOfPbmDatastoreSpaceStatistics struct {
- PbmDatastoreSpaceStatistics []PbmDatastoreSpaceStatistics `xml:"PbmDatastoreSpaceStatistics,omitempty"`
+ PbmDatastoreSpaceStatistics []PbmDatastoreSpaceStatistics `xml:"PbmDatastoreSpaceStatistics,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmDatastoreSpaceStatistics", reflect.TypeOf((*ArrayOfPbmDatastoreSpaceStatistics)(nil)).Elem())
}
+// A boxed array of `PbmDefaultProfileInfo`. To be used in `Any` placeholders.
type ArrayOfPbmDefaultProfileInfo struct {
- PbmDefaultProfileInfo []PbmDefaultProfileInfo `xml:"PbmDefaultProfileInfo,omitempty"`
+ PbmDefaultProfileInfo []PbmDefaultProfileInfo `xml:"PbmDefaultProfileInfo,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmDefaultProfileInfo", reflect.TypeOf((*ArrayOfPbmDefaultProfileInfo)(nil)).Elem())
}
+// A boxed array of `PbmFaultNoPermissionEntityPrivileges`. To be used in `Any` placeholders.
+type ArrayOfPbmFaultNoPermissionEntityPrivileges struct {
+ PbmFaultNoPermissionEntityPrivileges []PbmFaultNoPermissionEntityPrivileges `xml:"PbmFaultNoPermissionEntityPrivileges,omitempty" json:"_value"`
+}
+
+func init() {
+ types.Add("pbm:ArrayOfPbmFaultNoPermissionEntityPrivileges", reflect.TypeOf((*ArrayOfPbmFaultNoPermissionEntityPrivileges)(nil)).Elem())
+}
+
+// A boxed array of `PbmLoggingConfiguration`. To be used in `Any` placeholders.
+type ArrayOfPbmLoggingConfiguration struct {
+ PbmLoggingConfiguration []PbmLoggingConfiguration `xml:"PbmLoggingConfiguration,omitempty" json:"_value"`
+}
+
+func init() {
+ types.Add("pbm:ArrayOfPbmLoggingConfiguration", reflect.TypeOf((*ArrayOfPbmLoggingConfiguration)(nil)).Elem())
+}
+
+// A boxed array of `PbmPlacementCompatibilityResult`. To be used in `Any` placeholders.
type ArrayOfPbmPlacementCompatibilityResult struct {
- PbmPlacementCompatibilityResult []PbmPlacementCompatibilityResult `xml:"PbmPlacementCompatibilityResult,omitempty"`
+ PbmPlacementCompatibilityResult []PbmPlacementCompatibilityResult `xml:"PbmPlacementCompatibilityResult,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmPlacementCompatibilityResult", reflect.TypeOf((*ArrayOfPbmPlacementCompatibilityResult)(nil)).Elem())
}
+// A boxed array of `PbmPlacementHub`. To be used in `Any` placeholders.
type ArrayOfPbmPlacementHub struct {
- PbmPlacementHub []PbmPlacementHub `xml:"PbmPlacementHub,omitempty"`
+ PbmPlacementHub []PbmPlacementHub `xml:"PbmPlacementHub,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmPlacementHub", reflect.TypeOf((*ArrayOfPbmPlacementHub)(nil)).Elem())
}
+// A boxed array of `PbmPlacementMatchingResources`. To be used in `Any` placeholders.
type ArrayOfPbmPlacementMatchingResources struct {
- PbmPlacementMatchingResources []BasePbmPlacementMatchingResources `xml:"PbmPlacementMatchingResources,omitempty,typeattr"`
+ PbmPlacementMatchingResources []BasePbmPlacementMatchingResources `xml:"PbmPlacementMatchingResources,omitempty,typeattr" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmPlacementMatchingResources", reflect.TypeOf((*ArrayOfPbmPlacementMatchingResources)(nil)).Elem())
}
+// A boxed array of `PbmPlacementRequirement`. To be used in `Any` placeholders.
type ArrayOfPbmPlacementRequirement struct {
- PbmPlacementRequirement []BasePbmPlacementRequirement `xml:"PbmPlacementRequirement,omitempty,typeattr"`
+ PbmPlacementRequirement []BasePbmPlacementRequirement `xml:"PbmPlacementRequirement,omitempty,typeattr" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmPlacementRequirement", reflect.TypeOf((*ArrayOfPbmPlacementRequirement)(nil)).Elem())
}
+// A boxed array of `PbmPlacementResourceUtilization`. To be used in `Any` placeholders.
type ArrayOfPbmPlacementResourceUtilization struct {
- PbmPlacementResourceUtilization []PbmPlacementResourceUtilization `xml:"PbmPlacementResourceUtilization,omitempty"`
+ PbmPlacementResourceUtilization []PbmPlacementResourceUtilization `xml:"PbmPlacementResourceUtilization,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmPlacementResourceUtilization", reflect.TypeOf((*ArrayOfPbmPlacementResourceUtilization)(nil)).Elem())
}
+// A boxed array of `PbmProfile`. To be used in `Any` placeholders.
type ArrayOfPbmProfile struct {
- PbmProfile []BasePbmProfile `xml:"PbmProfile,omitempty,typeattr"`
+ PbmProfile []BasePbmProfile `xml:"PbmProfile,omitempty,typeattr" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmProfile", reflect.TypeOf((*ArrayOfPbmProfile)(nil)).Elem())
}
+// A boxed array of `PbmProfileId`. To be used in `Any` placeholders.
type ArrayOfPbmProfileId struct {
- PbmProfileId []PbmProfileId `xml:"PbmProfileId,omitempty"`
+ PbmProfileId []PbmProfileId `xml:"PbmProfileId,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmProfileId", reflect.TypeOf((*ArrayOfPbmProfileId)(nil)).Elem())
}
+// A boxed array of `PbmProfileOperationOutcome`. To be used in `Any` placeholders.
type ArrayOfPbmProfileOperationOutcome struct {
- PbmProfileOperationOutcome []PbmProfileOperationOutcome `xml:"PbmProfileOperationOutcome,omitempty"`
+ PbmProfileOperationOutcome []PbmProfileOperationOutcome `xml:"PbmProfileOperationOutcome,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmProfileOperationOutcome", reflect.TypeOf((*ArrayOfPbmProfileOperationOutcome)(nil)).Elem())
}
+// A boxed array of `PbmProfileResourceType`. To be used in `Any` placeholders.
type ArrayOfPbmProfileResourceType struct {
- PbmProfileResourceType []PbmProfileResourceType `xml:"PbmProfileResourceType,omitempty"`
+ PbmProfileResourceType []PbmProfileResourceType `xml:"PbmProfileResourceType,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmProfileResourceType", reflect.TypeOf((*ArrayOfPbmProfileResourceType)(nil)).Elem())
}
+// A boxed array of `PbmProfileType`. To be used in `Any` placeholders.
type ArrayOfPbmProfileType struct {
- PbmProfileType []PbmProfileType `xml:"PbmProfileType,omitempty"`
+ PbmProfileType []PbmProfileType `xml:"PbmProfileType,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmProfileType", reflect.TypeOf((*ArrayOfPbmProfileType)(nil)).Elem())
}
+// A boxed array of `PbmQueryProfileResult`. To be used in `Any` placeholders.
type ArrayOfPbmQueryProfileResult struct {
- PbmQueryProfileResult []PbmQueryProfileResult `xml:"PbmQueryProfileResult,omitempty"`
+ PbmQueryProfileResult []PbmQueryProfileResult `xml:"PbmQueryProfileResult,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmQueryProfileResult", reflect.TypeOf((*ArrayOfPbmQueryProfileResult)(nil)).Elem())
}
+// A boxed array of `PbmQueryReplicationGroupResult`. To be used in `Any` placeholders.
type ArrayOfPbmQueryReplicationGroupResult struct {
- PbmQueryReplicationGroupResult []PbmQueryReplicationGroupResult `xml:"PbmQueryReplicationGroupResult,omitempty"`
+ PbmQueryReplicationGroupResult []PbmQueryReplicationGroupResult `xml:"PbmQueryReplicationGroupResult,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmQueryReplicationGroupResult", reflect.TypeOf((*ArrayOfPbmQueryReplicationGroupResult)(nil)).Elem())
}
+// A boxed array of `PbmRollupComplianceResult`. To be used in `Any` placeholders.
type ArrayOfPbmRollupComplianceResult struct {
- PbmRollupComplianceResult []PbmRollupComplianceResult `xml:"PbmRollupComplianceResult,omitempty"`
+ PbmRollupComplianceResult []PbmRollupComplianceResult `xml:"PbmRollupComplianceResult,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmRollupComplianceResult", reflect.TypeOf((*ArrayOfPbmRollupComplianceResult)(nil)).Elem())
}
+// A boxed array of `PbmServerObjectRef`. To be used in `Any` placeholders.
type ArrayOfPbmServerObjectRef struct {
- PbmServerObjectRef []PbmServerObjectRef `xml:"PbmServerObjectRef,omitempty"`
+ PbmServerObjectRef []PbmServerObjectRef `xml:"PbmServerObjectRef,omitempty" json:"_value"`
}
func init() {
types.Add("pbm:ArrayOfPbmServerObjectRef", reflect.TypeOf((*ArrayOfPbmServerObjectRef)(nil)).Elem())
}
+// The `PbmAboutInfo` data object stores identifying data
+// about the Storage Policy Server.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmAboutInfo struct {
types.DynamicData
- Name string `xml:"name"`
- Version string `xml:"version"`
- InstanceUuid string `xml:"instanceUuid"`
+ // Name of the server.
+ Name string `xml:"name" json:"name"`
+ // Version number.
+ Version string `xml:"version" json:"version"`
+ // Globally unique identifier associated with this server instance.
+ InstanceUuid string `xml:"instanceUuid" json:"instanceUuid"`
}
func init() {
types.Add("pbm:PbmAboutInfo", reflect.TypeOf((*PbmAboutInfo)(nil)).Elem())
}
+// An AlreadyExists fault is thrown when an attempt is made to add an element to
+// a collection, if the element's key, name, or identifier already exists in
+// that collection.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmAlreadyExists struct {
PbmFault
- Name string `xml:"name,omitempty"`
+ Name string `xml:"name,omitempty" json:"name,omitempty"`
}
func init() {
@@ -281,10 +339,13 @@ func init() {
types.Add("pbm:PbmAssignDefaultRequirementProfile", reflect.TypeOf((*PbmAssignDefaultRequirementProfile)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmAssignDefaultRequirementProfile`.
type PbmAssignDefaultRequirementProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Profile PbmProfileId `xml:"profile"`
- Datastores []PbmPlacementHub `xml:"datastores"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // The profile that needs to be made default profile.
+ Profile PbmProfileId `xml:"profile" json:"profile"`
+ // The datastores for which the profile needs to be made as default profile.
+ Datastores []PbmPlacementHub `xml:"datastores" json:"datastores"`
}
func init() {
@@ -294,16 +355,26 @@ func init() {
type PbmAssignDefaultRequirementProfileResponse struct {
}
+// Constraints on the properties for a single occurrence of a capability.
+//
+// All properties must satisfy their respective constraints to be compliant.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityConstraintInstance struct {
types.DynamicData
- PropertyInstance []PbmCapabilityPropertyInstance `xml:"propertyInstance"`
+ // Property instance array for this constraint
+ PropertyInstance []PbmCapabilityPropertyInstance `xml:"propertyInstance" json:"propertyInstance"`
}
func init() {
types.Add("pbm:PbmCapabilityConstraintInstance", reflect.TypeOf((*PbmCapabilityConstraintInstance)(nil)).Elem())
}
+// The `PbmCapabilityConstraints` data object is the base
+// object for capability subprofile constraints.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityConstraints struct {
types.DynamicData
}
@@ -312,69 +383,161 @@ func init() {
types.Add("pbm:PbmCapabilityConstraints", reflect.TypeOf((*PbmCapabilityConstraints)(nil)).Elem())
}
+// A property value with description.
+//
+// It can be repeated under DiscreteSet.
+// E.g., set of tags, each with description and tag name.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityDescription struct {
types.DynamicData
- Description PbmExtendedElementDescription `xml:"description"`
- Value types.AnyType `xml:"value,typeattr"`
+ // Description of the property value
+ Description PbmExtendedElementDescription `xml:"description" json:"description"`
+ // Values for the set.
+ //
+ // must be one of the supported datatypes as
+ // defined in `PbmBuiltinType_enum`
+ // Must only contain unique values to comply with the Set semantics
+ Value types.AnyType `xml:"value,typeattr" json:"value"`
}
func init() {
types.Add("pbm:PbmCapabilityDescription", reflect.TypeOf((*PbmCapabilityDescription)(nil)).Elem())
}
+// The `PbmCapabilityDiscreteSet` data object defines a set of values
+// for storage profile property instances (`PbmCapabilityPropertyInstance`).
+//
+// Use the discrete set type to define a set of values of a supported builtin type
+// (`PbmBuiltinType_enum`), for example a set of integers
+// (XSD\_INT) or a set of unsigned long values (XSD\_LONG).
+// See `PbmBuiltinGenericType_enum*.*VMW_SET`.
+//
+// A discrete set of values is declared as an array of xsd:anyType values.
+// - When you define a property instance for a storage profile requirement
+// and pass an array of values to the Server, you must set the array elements
+// to values of the appropriate datatype.
+// - When you read a discrete set from a property instance for a storage profile
+// capability, you must cast the xsd:anyType array element values
+// to the appropriate datatype.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityDiscreteSet struct {
types.DynamicData
- Values []types.AnyType `xml:"values,typeattr"`
+ // Array of values for the set.
+ //
+ // The values must be one of the supported datatypes
+ // as defined in `PbmBuiltinType_enum` or `PbmBuiltinGenericType_enum`.
+ Values []types.AnyType `xml:"values,typeattr" json:"values"`
}
func init() {
types.Add("pbm:PbmCapabilityDiscreteSet", reflect.TypeOf((*PbmCapabilityDiscreteSet)(nil)).Elem())
}
+// Generic type definition for capabilities.
+//
+// Indicates how a collection of values of a specific datatype
+// (`PbmCapabilityTypeInfo.typeName`)
+// will be interpreted.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityGenericTypeInfo struct {
PbmCapabilityTypeInfo
- GenericTypeName string `xml:"genericTypeName"`
+ // Name of the generic type.
+ //
+ // Must correspond to one of the values defined in
+ // `PbmBuiltinGenericType_enum`.
+ GenericTypeName string `xml:"genericTypeName" json:"genericTypeName"`
}
func init() {
types.Add("pbm:PbmCapabilityGenericTypeInfo", reflect.TypeOf((*PbmCapabilityGenericTypeInfo)(nil)).Elem())
}
+// The `PbmCapabilityInstance` data object defines a storage capability instance.
+//
+// Metadata for the capability is described in `PbmCapabilityMetadata`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityInstance struct {
types.DynamicData
- Id PbmCapabilityMetadataUniqueId `xml:"id"`
- Constraint []PbmCapabilityConstraintInstance `xml:"constraint"`
+ // Identifier for the capability.
+ //
+ // The identifier value corresponds to
+ // `PbmCapabilityMetadata*.*PbmCapabilityMetadata.id`.
+ Id PbmCapabilityMetadataUniqueId `xml:"id" json:"id"`
+ // Constraints on the properties that comprise this capability.
+ //
+ // Each entry represents a constraint on one or more of the properties that
+ // constitute this capability. A datum must meet one of the
+ // constraints to be compliant.
+ Constraint []PbmCapabilityConstraintInstance `xml:"constraint" json:"constraint"`
}
func init() {
types.Add("pbm:PbmCapabilityInstance", reflect.TypeOf((*PbmCapabilityInstance)(nil)).Elem())
}
+// Metadata for a single unique setting defined by a provider.
+//
+// A simple setting is a setting with one property.
+// A complex setting contains more than one property.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityMetadata struct {
types.DynamicData
- Id PbmCapabilityMetadataUniqueId `xml:"id"`
- Summary PbmExtendedElementDescription `xml:"summary"`
- Mandatory *bool `xml:"mandatory"`
- Hint *bool `xml:"hint"`
- KeyId string `xml:"keyId,omitempty"`
- AllowMultipleConstraints *bool `xml:"allowMultipleConstraints"`
- PropertyMetadata []PbmCapabilityPropertyMetadata `xml:"propertyMetadata"`
+ // Unique identifier for the capability.
+ Id PbmCapabilityMetadataUniqueId `xml:"id" json:"id"`
+ // Capability name and description
+ Summary PbmExtendedElementDescription `xml:"summary" json:"summary"`
+ // Indicates whether incorporating given capability is mandatory during creation of
+ // profile.
+ Mandatory *bool `xml:"mandatory" json:"mandatory,omitempty"`
+ // The flag hint dictates the interpretation of constraints specified for this capability
+ // in a storage policy profile.
+ //
+ // If hint is false, then constraints will affect placement.
+ // If hint is true, constraints will not affect placement,
+ // but will still be passed to provisioning operations if the provider understands the
+ // relevant namespace. Optional property, false if not set.
+ Hint *bool `xml:"hint" json:"hint,omitempty"`
+ // Property Id of the key property, if this capability represents a key
+ // value pair.
+ //
+ // Value is empty string if not set.
+ KeyId string `xml:"keyId,omitempty" json:"keyId,omitempty"`
+ // Flag to indicate if multiple constraints are allowed in the capability
+ // instance.
+ //
+ // False if not set.
+ AllowMultipleConstraints *bool `xml:"allowMultipleConstraints" json:"allowMultipleConstraints,omitempty"`
+ // Metadata for the properties that comprise this capability.
+ PropertyMetadata []PbmCapabilityPropertyMetadata `xml:"propertyMetadata" json:"propertyMetadata"`
}
func init() {
types.Add("pbm:PbmCapabilityMetadata", reflect.TypeOf((*PbmCapabilityMetadata)(nil)).Elem())
}
+// The `PbmCapabilityMetadataPerCategory`
+// data object defines capability metadata for a profile subcategory.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityMetadataPerCategory struct {
types.DynamicData
- SubCategory string `xml:"subCategory"`
- CapabilityMetadata []PbmCapabilityMetadata `xml:"capabilityMetadata"`
+ // Profile subcategory to which the capability metadata belongs.
+ //
+ // The subcategory is specified by the storage provider.
+ SubCategory string `xml:"subCategory" json:"subCategory"`
+ // Capability metadata for this category
+ CapabilityMetadata []PbmCapabilityMetadata `xml:"capabilityMetadata" json:"capabilityMetadata"`
}
func init() {
@@ -384,60 +547,162 @@ func init() {
type PbmCapabilityMetadataUniqueId struct {
types.DynamicData
- Namespace string `xml:"namespace"`
- Id string `xml:"id"`
+ // Namespace to which this capability belongs.
+ //
+ // Must be the same as
+ // { @link CapabilityObjectSchema#namespace } defined for this
+ // capability
+ Namespace string `xml:"namespace" json:"namespace"`
+ // unique identifier for this capability within given namespace
+ Id string `xml:"id" json:"id"`
}
func init() {
types.Add("pbm:PbmCapabilityMetadataUniqueId", reflect.TypeOf((*PbmCapabilityMetadataUniqueId)(nil)).Elem())
}
+// Name space information for the capability metadata schema.
+//
+// NOTE: Name spaces are required to be globally unique across resource types.
+// A same vendor can register multiple name spaces for same resource type or
+// for different resource type, but the schema namespace URL must be unique
+// for each of these cases.
+// A CapabilityMetadata object is uniquely identified based on the namespace
+// it belongs to and it's unique identifier within that namespace.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityNamespaceInfo struct {
types.DynamicData
- Version string `xml:"version"`
- Namespace string `xml:"namespace"`
- Info *PbmExtendedElementDescription `xml:"info,omitempty"`
+ // Schema version
+ Version string `xml:"version" json:"version"`
+ // Schema namespace.
+ Namespace string `xml:"namespace" json:"namespace"`
+ Info *PbmExtendedElementDescription `xml:"info,omitempty" json:"info,omitempty"`
}
func init() {
types.Add("pbm:PbmCapabilityNamespaceInfo", reflect.TypeOf((*PbmCapabilityNamespaceInfo)(nil)).Elem())
}
+// The `PbmCapabilityProfile` data object defines
+// capability-based profiles.
+//
+// A capability-based profile is derived
+// from tag-based storage capabilities or from vSAN storage capabilities.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityProfile struct {
PbmProfile
- ProfileCategory string `xml:"profileCategory"`
- ResourceType PbmProfileResourceType `xml:"resourceType"`
- Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr"`
- GenerationId int64 `xml:"generationId,omitempty"`
- IsDefault bool `xml:"isDefault"`
- SystemCreatedProfileType string `xml:"systemCreatedProfileType,omitempty"`
- LineOfService string `xml:"lineOfService,omitempty"`
+ // Indicates whether the profile is requirement
+ // profile, a resource profile or a data service profile.
+ //
+ // The profileCategory
+ // is a string value that corresponds to one of the
+ // `PbmProfileCategoryEnum_enum` values.
+ // - REQUIREMENT profile - Defines the storage constraints applied
+ // to virtual machine placement. Requirements are defined by
+ // the user and can be associated with virtual machines and virtual
+ // disks. During provisioning, you can use a requirements profile
+ // for compliance and placement checking to support
+ // selection and configuration of resources.
+ // - RESOURCE profile - Specifies system-defined storage capabilities.
+ // You cannot modify a resource profile. You cannot associate a resource
+ // profile with vSphere entities, use it during provisioning, or target
+ // entities for resource selection or configuration.
+ // This type of profile gives the user visibility into the capabilities
+ // supported by the storage provider.
+ //
+ // DATA\_SERVICE\_POLICY - Indicates a data service policy that can
+ // be embedded into another storage policy. Policies of this type can't
+ // be assigned to Virtual Machines or Virtual Disks. This policy cannot
+ // be used for compliance checking.
+ ProfileCategory string `xml:"profileCategory" json:"profileCategory"`
+ // Type of the target resource to which the capability information applies.
+ //
+ // A fixed enum that defines resource types for which capabilities can be defined
+ // see `PbmProfileResourceType`, `PbmProfileResourceTypeEnum_enum`
+ ResourceType PbmProfileResourceType `xml:"resourceType" json:"resourceType"`
+ // Subprofiles that describe storage requirements or storage provider capabilities,
+ // depending on the profile category (REQUIREMENT or RESOURCE).
+ Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr" json:"constraints"`
+ // Generation ID is used to communicate the current version of the profile to VASA
+ // providers.
+ //
+ // It is only applicable to REQUIREMENT profile types. Every time a
+ // requirement profile is edited, the Server will increment the generationId. You
+ // do not need to set the generationID. When an object is created (or
+ // reconfigured), the Server will send the requirement profile content, profile ID and
+ // the generationID to VASA provider.
+ GenerationId int64 `xml:"generationId,omitempty" json:"generationId,omitempty"`
+ // Deprecated since it is not supported.
+ //
+ // Not supported in this release.
+ IsDefault bool `xml:"isDefault" json:"isDefault"`
+ // Indicates the type of system pre-created default profile.
+ //
+ // This will be set only for system pre-created default profiles. And
+ // this is not set for RESOURCE profiles.
+ SystemCreatedProfileType string `xml:"systemCreatedProfileType,omitempty" json:"systemCreatedProfileType,omitempty"`
+ // This property is set only for data service policy.
+ //
+ // Indicates the line of service
+ // `PbmLineOfServiceInfoLineOfServiceEnum_enum` of the data service policy.
+ LineOfService string `xml:"lineOfService,omitempty" json:"lineOfService,omitempty"`
}
func init() {
types.Add("pbm:PbmCapabilityProfile", reflect.TypeOf((*PbmCapabilityProfile)(nil)).Elem())
}
+// The `PbmCapabilityProfileCreateSpec` describes storage requirements.
+//
+// Use this data object to create a `PbmCapabilityProfile`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityProfileCreateSpec struct {
types.DynamicData
- Name string `xml:"name"`
- Description string `xml:"description,omitempty"`
- Category string `xml:"category,omitempty"`
- ResourceType PbmProfileResourceType `xml:"resourceType"`
- Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr"`
+ // Name of the capability based profile to be created.
+ //
+ // The maximum length of the name is 80 characters.
+ Name string `xml:"name" json:"name"`
+ // Text description associated with the profile.
+ Description string `xml:"description,omitempty" json:"description,omitempty"`
+ // Category specifies the type of policy to be created.
+ //
+ // This can be REQUIREMENT from
+ // `PbmProfileCategoryEnum_enum`
+ // or null when creating a storage policy. And it can be DATA\_SERVICE\_POLICY from
+ // `PbmProfileCategoryEnum_enum`
+ // when creating a data service policy. RESOURCE from `PbmProfileCategoryEnum_enum`
+ // is not allowed as resource profile is created by the system.
+ Category string `xml:"category,omitempty" json:"category,omitempty"`
+ // Deprecated as of vSphere API 6.5.
+ //
+ // Specifies the type of resource to which the profile applies.
+ //
+ // The only legal value is STORAGE - deprecated.
+ ResourceType PbmProfileResourceType `xml:"resourceType" json:"resourceType"`
+ // Set of subprofiles that define the storage requirements.
+ //
+ // A subprofile corresponds to a rule set in the vSphere Web Client.
+ Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr" json:"constraints"`
}
func init() {
types.Add("pbm:PbmCapabilityProfileCreateSpec", reflect.TypeOf((*PbmCapabilityProfileCreateSpec)(nil)).Elem())
}
+// Fault used when a datastore doesnt match the capability profile property instance in requirements profile.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityProfilePropertyMismatchFault struct {
PbmPropertyMismatchFault
- ResourcePropertyInstance PbmCapabilityPropertyInstance `xml:"resourcePropertyInstance"`
+ // The property instance in the resource profile that does not match.
+ ResourcePropertyInstance PbmCapabilityPropertyInstance `xml:"resourcePropertyInstance" json:"resourcePropertyInstance"`
}
func init() {
@@ -450,118 +715,347 @@ func init() {
types.Add("pbm:PbmCapabilityProfilePropertyMismatchFaultFault", reflect.TypeOf((*PbmCapabilityProfilePropertyMismatchFaultFault)(nil)).Elem())
}
+// The `PbmCapabilityProfileUpdateSpec` data object
+// contains data that you use to update a storage profile.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityProfileUpdateSpec struct {
types.DynamicData
- Name string `xml:"name,omitempty"`
- Description string `xml:"description,omitempty"`
- Constraints BasePbmCapabilityConstraints `xml:"constraints,omitempty,typeattr"`
+ // Specifies a new profile name.
+ Name string `xml:"name,omitempty" json:"name,omitempty"`
+ // Specifies a new profile description.
+ Description string `xml:"description,omitempty" json:"description,omitempty"`
+ // Specifies one or more subprofiles.
+ //
+ // A subprofile defines one or more
+ // storage requirements.
+ Constraints BasePbmCapabilityConstraints `xml:"constraints,omitempty,typeattr" json:"constraints,omitempty"`
}
func init() {
types.Add("pbm:PbmCapabilityProfileUpdateSpec", reflect.TypeOf((*PbmCapabilityProfileUpdateSpec)(nil)).Elem())
}
+// The `PbmCapabilityPropertyInstance` data object describes a virtual machine
+// storage requirement.
+//
+// A storage requirement is based on the storage capability
+// described in the `PbmCapabilityPropertyMetadata` and in the
+// datastore profile property instance.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityPropertyInstance struct {
types.DynamicData
- Id string `xml:"id"`
- Operator string `xml:"operator,omitempty"`
- Value types.AnyType `xml:"value,typeattr"`
+ // Requirement property identifier.
+ //
+ // This identifier corresponds to the
+ // storage capability metadata identifier
+ // (`PbmCapabilityPropertyMetadata*.*PbmCapabilityPropertyMetadata.id`).
+ Id string `xml:"id" json:"id"`
+ // Operator for the values.
+ //
+ // Currently only support NOT operator for
+ // tag namespace
+ // See operator definition in (`PbmCapabilityOperator_enum`).
+ Operator string `xml:"operator,omitempty" json:"operator,omitempty"`
+ // Property value.
+ //
+ // You must specify the value.
+ // A property value is one value or a collection of values.
+ // - A single property value is expressed as a scalar value.
+ // - A collection of values is expressed as a `PbmCapabilityDiscreteSet`
+ // or a `PbmCapabilityRange` of values.
+ //
+ // The datatype of each value must be one of the
+ // `PbmBuiltinType_enum` datatypes.
+ // If the property consists of a collection of values,
+ // the interpretation of those values is determined by the
+ // `PbmCapabilityGenericTypeInfo`.
+ //
+ // Type information for a property instance is described in the property metadata
+ // (`PbmCapabilityPropertyMetadata*.*PbmCapabilityPropertyMetadata.type`).
+ Value types.AnyType `xml:"value,typeattr" json:"value"`
}
func init() {
types.Add("pbm:PbmCapabilityPropertyInstance", reflect.TypeOf((*PbmCapabilityPropertyInstance)(nil)).Elem())
}
+// The `PbmCapabilityPropertyMetadata` data object describes storage capability.
+//
+// An instance of property metadata may apply to many property instances
+// (`PbmCapabilityPropertyInstance`).
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityPropertyMetadata struct {
types.DynamicData
- Id string `xml:"id"`
- Summary PbmExtendedElementDescription `xml:"summary"`
- Mandatory bool `xml:"mandatory"`
- Type BasePbmCapabilityTypeInfo `xml:"type,omitempty,typeattr"`
- DefaultValue types.AnyType `xml:"defaultValue,omitempty,typeattr"`
- AllowedValue types.AnyType `xml:"allowedValue,omitempty,typeattr"`
- RequirementsTypeHint string `xml:"requirementsTypeHint,omitempty"`
+ // Property identifier.
+ //
+ // Should be unique within the definition of the
+ // capability. Property instances refer to this identifier
+ // (`PbmCapabilityPropertyInstance*.*PbmCapabilityPropertyInstance.id`).
+ Id string `xml:"id" json:"id"`
+ // Property name and description.
+ // - The summary.label property
+ // (`PbmExtendedElementDescription.label`)
+ // contains property 'name' in server locale.
+ // - The summary.summary property
+ // (`PbmExtendedElementDescription.summary`)
+ // contains property 'description' in server locale.
+ // - The summary.messageCatalogKeyPrefix property
+ // (`PbmExtendedElementDescription.messageCatalogKeyPrefix`)
+ // contains unique prefix for this property within given message catalog.
+ // Prefix format: <capability\_unique\_identifier.<property\_id
+ // capability\_unique\_identifier -- string representation of
+ // `PbmCapabilityMetadataUniqueId` which globally identifies given
+ // capability metadata definition uniquely.
+ // property\_id -- 'id' of this property `PbmCapabilityPropertyMetadata.id`
+ // Eg www.emc.com.storage.Recovery.Recovery\_site
+ // www.emc.com.storage.Recovery.RPO
+ // www.emc.com.storage.Recovery.RTO
+ Summary PbmExtendedElementDescription `xml:"summary" json:"summary"`
+ // Indicates whether incorporating given capability is mandatory during creation of
+ // profile.
+ Mandatory bool `xml:"mandatory" json:"mandatory"`
+ // Type information for the capability.
+ //
+ // The type of a property value
+ // (`PbmCapabilityPropertyInstance*.*PbmCapabilityPropertyInstance.value`)
+ // is specified as a builtin datatype and may also specify the interpretation of a
+ // collection of values of that datatype.
+ // - `PbmCapabilityPropertyMetadata.type*.*PbmCapabilityTypeInfo.typeName`
+ // specifies the `PbmBuiltinType_enum`.
+ // - `PbmCapabilityPropertyMetadata.type*.*PbmCapabilityGenericTypeInfo.genericTypeName`
+ // indicates how a collection of values of the specified datatype will be interpreted
+ // (`PbmBuiltinGenericType_enum`).
+ Type BasePbmCapabilityTypeInfo `xml:"type,omitempty,typeattr" json:"type,omitempty"`
+ // Default value, if any, that the property will assume when not
+ // constrained by requirements.
+ //
+ // This object must be of the
+ // `PbmCapabilityPropertyMetadata.type`
+ // defined for the property.
+ DefaultValue types.AnyType `xml:"defaultValue,omitempty,typeattr" json:"defaultValue,omitempty"`
+ // All legal values that the property may take on, across all
+ // implementations of the property.
+ //
+ // This definition of legal values is not
+ // determined by any particular resource configuration; rather it is
+ // inherent to the definition of the property. If undefined, then any value
+ // of the correct type is legal. This object must be a generic container for
+ // the `PbmCapabilityPropertyMetadata.type`
+ // defined for the property;
+ // see `PbmBuiltinGenericType_enum`
+ // for the supported generic container types.
+ AllowedValue types.AnyType `xml:"allowedValue,omitempty,typeattr" json:"allowedValue,omitempty"`
+ // A hint for data-driven systems that assist in authoring requirements
+ // constraints.
+ //
+ // Acceptable values defined by
+ // `PbmBuiltinGenericType_enum`.
+ // A property will typically only have constraints of a given type in
+ // requirement profiles, even if it is likely to use constraints of
+ // different types across capability profiles. This value, if specified,
+ // specifies the expected kind of constraint used in requirement profiles.
+ // Considerations for using this information:
+ // - This is only a hint; any properly formed constraint
+ // (see `PbmCapabilityPropertyInstance.value`)
+ // is still valid for a requirement profile.
+ // - If VMW\_SET is hinted, then a single value matching the property metadata type is
+ // also an expected form of constraint, as the latter is an allowed convenience
+ // for expressing a single-member set.
+ // - If this hint is not specified, then the authoring system may default to a form of
+ // constraint determined by its own criteria.
+ RequirementsTypeHint string `xml:"requirementsTypeHint,omitempty" json:"requirementsTypeHint,omitempty"`
}
func init() {
types.Add("pbm:PbmCapabilityPropertyMetadata", reflect.TypeOf((*PbmCapabilityPropertyMetadata)(nil)).Elem())
}
+// The `PbmCapabilityRange` data object defines a range of values for storage property
+// instances (`PbmCapabilityPropertyInstance`).
+//
+// Use the range type to define a range of values of a supported builtin type,
+// for example range<int>, range<long>, or range<timespan>.
+// You can specify a partial range by omitting one of the properties, min or max.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityRange struct {
types.DynamicData
- Min types.AnyType `xml:"min,typeattr"`
- Max types.AnyType `xml:"max,typeattr"`
+ // Minimum value of range.
+ //
+ // Must be one of the supported
+ // datatypes as defined in `PbmBuiltinType_enum`.
+ // Must be the same datatype as min.
+ Min types.AnyType `xml:"min,typeattr" json:"min"`
+ // Maximum value of range.
+ //
+ // Must be one of the supported
+ // datatypes as defined in `PbmBuiltinType_enum`.
+ // Must be the same datatype as max.
+ Max types.AnyType `xml:"max,typeattr" json:"max"`
}
func init() {
types.Add("pbm:PbmCapabilityRange", reflect.TypeOf((*PbmCapabilityRange)(nil)).Elem())
}
+// Capability Schema information
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilitySchema struct {
types.DynamicData
- VendorInfo PbmCapabilitySchemaVendorInfo `xml:"vendorInfo"`
- NamespaceInfo PbmCapabilityNamespaceInfo `xml:"namespaceInfo"`
- LineOfService BasePbmLineOfServiceInfo `xml:"lineOfService,omitempty,typeattr"`
- CapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"capabilityMetadataPerCategory"`
+ VendorInfo PbmCapabilitySchemaVendorInfo `xml:"vendorInfo" json:"vendorInfo"`
+ NamespaceInfo PbmCapabilityNamespaceInfo `xml:"namespaceInfo" json:"namespaceInfo"`
+ // Service type for the schema.
+ //
+ // Do not use Category as each service needs to have its own schema version.
+ //
+ // If omitted, this schema specifies persistence capabilities.
+ LineOfService BasePbmLineOfServiceInfo `xml:"lineOfService,omitempty,typeattr" json:"lineOfService,omitempty"`
+ // Capability metadata organized by category
+ CapabilityMetadataPerCategory []PbmCapabilityMetadataPerCategory `xml:"capabilityMetadataPerCategory" json:"capabilityMetadataPerCategory"`
}
func init() {
types.Add("pbm:PbmCapabilitySchema", reflect.TypeOf((*PbmCapabilitySchema)(nil)).Elem())
}
+// Information about vendor/owner of the capability metadata schema
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilitySchemaVendorInfo struct {
types.DynamicData
- VendorUuid string `xml:"vendorUuid"`
- Info PbmExtendedElementDescription `xml:"info"`
+ // Unique identifier for the vendor who owns the given capability
+ // schema definition
+ VendorUuid string `xml:"vendorUuid" json:"vendorUuid"`
+ // Captures name and description information about the vendor/owner of
+ // the schema.
+ // - The summary.label property
+ // (`PbmExtendedElementDescription.label`)
+ // contains vendor name information in server locale.
+ // - The summary.summary property
+ // (`PbmExtendedElementDescription.summary`)
+ // contains vendor description string in server locale.
+ // - The summary.messageCatalogKeyPrefix property
+ // (`PbmExtendedElementDescription.messageCatalogKeyPrefix`)
+ // contains unique prefix for the vendor information within given message
+ // catalog.
+ Info PbmExtendedElementDescription `xml:"info" json:"info"`
}
func init() {
types.Add("pbm:PbmCapabilitySchemaVendorInfo", reflect.TypeOf((*PbmCapabilitySchemaVendorInfo)(nil)).Elem())
}
+// A `PbmCapabilitySubProfile`
+// is a section within a profile that aggregates one or more capability
+// instances.
+//
+// Capability instances define storage constraints.
+//
+// All constraints within a subprofile are ANDed by default.
+// When you perform compliance checking on a virtual machine or virtual
+// disk, all of the constraints must be satisfied by the storage capabilities.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilitySubProfile struct {
types.DynamicData
- Name string `xml:"name"`
- Capability []PbmCapabilityInstance `xml:"capability"`
- ForceProvision *bool `xml:"forceProvision"`
+ // Subprofile name.
+ Name string `xml:"name" json:"name"`
+ // List of capability instances.
+ Capability []PbmCapabilityInstance `xml:"capability" json:"capability"`
+ // Indicates whether the source policy profile allows creating a virtual machine
+ // or virtual disk that may be non-compliant.
+ ForceProvision *bool `xml:"forceProvision" json:"forceProvision,omitempty"`
}
func init() {
types.Add("pbm:PbmCapabilitySubProfile", reflect.TypeOf((*PbmCapabilitySubProfile)(nil)).Elem())
}
+// The `PbmCapabilitySubProfileConstraints` data object defines a group
+// of storage subprofiles.
+//
+// Subprofile usage depends on the type of profile
+// (`PbmCapabilityProfile*.*PbmCapabilityProfile.profileCategory`).
+// - For a REQUIREMENTS profile, each subprofile defines storage requirements.
+// A Storage Policy API requirements subprofile corresponds to a vSphere Web Client
+// rule set.
+// - For a RESOURCE profile, each subprofile defines storage capabilities.
+// Storage capabilities are read-only.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilitySubProfileConstraints struct {
PbmCapabilityConstraints
- SubProfiles []PbmCapabilitySubProfile `xml:"subProfiles"`
+ // Aggregation of one or more subprofiles.
+ //
+ // The relationship among all subprofiles is "OR". When you perform
+ // compliance checking on a profile that contains more than one subprofile,
+ // a non-compliant result for any one of the subprofiles will produce a
+ // non-compliant result for the operation.
+ SubProfiles []PbmCapabilitySubProfile `xml:"subProfiles" json:"subProfiles"`
}
func init() {
types.Add("pbm:PbmCapabilitySubProfileConstraints", reflect.TypeOf((*PbmCapabilitySubProfileConstraints)(nil)).Elem())
}
+// The `PbmCapabilityTimeSpan` data object defines a time value and time unit,
+// for example 10 hours or 5 minutes.
+//
+// See
+// `PbmBuiltinType_enum*.*VMW_TIMESPAN`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityTimeSpan struct {
types.DynamicData
- Value int32 `xml:"value"`
- Unit string `xml:"unit"`
+ // Time value.
+ //
+ // Must be a positive integer.
+ Value int32 `xml:"value" json:"value"`
+ // Unit value for time.
+ //
+ // The string value must correspond
+ // to one of the `PbmCapabilityTimeUnitType_enum` values.
+ Unit string `xml:"unit" json:"unit"`
}
func init() {
types.Add("pbm:PbmCapabilityTimeSpan", reflect.TypeOf((*PbmCapabilityTimeSpan)(nil)).Elem())
}
+// The `PbmCapabilityTypeInfo` data object defines the datatype for a requirement
+// or capability property.
+//
+// See `PbmCapabilityPropertyMetadata`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCapabilityTypeInfo struct {
types.DynamicData
- TypeName string `xml:"typeName"`
+ // Datatype for a property.
+ //
+ // Must be one of the types defined
+ // in `PbmBuiltinType_enum`.
+ //
+ // A property value might consist of a collection of values of the specified
+ // datatype. The interpretation of the collection is determined by the
+ // generic type (`PbmCapabilityGenericTypeInfo.genericTypeName`).
+ // The generic type indicates how a collection of values
+ // of the specified datatype will be interpreted. See the descriptions of the
+ // `PbmBuiltinType_enum` definitions.
+ TypeName string `xml:"typeName" json:"typeName"`
}
func init() {
@@ -571,8 +1065,8 @@ func init() {
type PbmCapabilityVendorNamespaceInfo struct {
types.DynamicData
- VendorInfo PbmCapabilitySchemaVendorInfo `xml:"vendorInfo"`
- NamespaceInfo PbmCapabilityNamespaceInfo `xml:"namespaceInfo"`
+ VendorInfo PbmCapabilitySchemaVendorInfo `xml:"vendorInfo" json:"vendorInfo"`
+ NamespaceInfo PbmCapabilityNamespaceInfo `xml:"namespaceInfo" json:"namespaceInfo"`
}
func init() {
@@ -582,8 +1076,14 @@ func init() {
type PbmCapabilityVendorResourceTypeInfo struct {
types.DynamicData
- ResourceType string `xml:"resourceType"`
- VendorNamespaceInfo []PbmCapabilityVendorNamespaceInfo `xml:"vendorNamespaceInfo"`
+ // Resource type for which given vendor has registered given namespace
+ // along with capability metadata that belongs to the namespace.
+ //
+ // Must match one of the values for enum `PbmProfileResourceTypeEnum_enum`
+ ResourceType string `xml:"resourceType" json:"resourceType"`
+ // List of all vendorInfo -- namespaceInfo tuples that are registered for
+ // given resource type
+ VendorNamespaceInfo []PbmCapabilityVendorNamespaceInfo `xml:"vendorNamespaceInfo" json:"vendorNamespaceInfo"`
}
func init() {
@@ -596,10 +1096,16 @@ func init() {
types.Add("pbm:PbmCheckCompatibility", reflect.TypeOf((*PbmCheckCompatibility)(nil)).Elem())
}
+// The parameters of `PbmPlacementSolver.PbmCheckCompatibility`.
type PbmCheckCompatibilityRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"`
- Profile PbmProfileId `xml:"profile"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Candidate list of hubs, either datastores or storage pods or a
+ // mix. If this parameter is not specified, the Server uses all
+ // of the datastores and storage pods for placement compatibility
+ // checking.
+ HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty" json:"hubsToSearch,omitempty"`
+ // Storage requirement profile.
+ Profile PbmProfileId `xml:"profile" json:"profile"`
}
func init() {
@@ -607,7 +1113,7 @@ func init() {
}
type PbmCheckCompatibilityResponse struct {
- Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty"`
+ Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmCheckCompatibilityWithSpec PbmCheckCompatibilityWithSpecRequestType
@@ -616,10 +1122,15 @@ func init() {
types.Add("pbm:PbmCheckCompatibilityWithSpec", reflect.TypeOf((*PbmCheckCompatibilityWithSpec)(nil)).Elem())
}
+// The parameters of `PbmPlacementSolver.PbmCheckCompatibilityWithSpec`.
type PbmCheckCompatibilityWithSpecRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"`
- ProfileSpec PbmCapabilityProfileCreateSpec `xml:"profileSpec"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Candidate list of hubs, either datastores or storage pods
+ // or a mix. If this parameter is not specified, the Server uses all of the
+ // datastores and storage pods for placement compatibility checking.
+ HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty" json:"hubsToSearch,omitempty"`
+ // Specification for a capability based profile.
+ ProfileSpec PbmCapabilityProfileCreateSpec `xml:"profileSpec" json:"profileSpec"`
}
func init() {
@@ -627,7 +1138,7 @@ func init() {
}
type PbmCheckCompatibilityWithSpecResponse struct {
- Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty"`
+ Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmCheckCompliance PbmCheckComplianceRequestType
@@ -636,10 +1147,31 @@ func init() {
types.Add("pbm:PbmCheckCompliance", reflect.TypeOf((*PbmCheckCompliance)(nil)).Elem())
}
+// The parameters of `PbmComplianceManager.PbmCheckCompliance`.
type PbmCheckComplianceRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entities []PbmServerObjectRef `xml:"entities"`
- Profile *PbmProfileId `xml:"profile,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // One or more references to storage entities.
+ // You can specify virtual machines and virtual disks
+ // A maximum of 1000 virtual machines and/or virtual disks can be specified
+ // in a call. The results of calling the checkCompliance API with
+ // more than a 1000 entities is undefined.
+ // - If the list of entities also contains datastores, the Server
+ // will ignore the datastores.
+ // - If the list contains valid and invalid entities, the Server ignores
+ // the invalid entities and returns results for the valid entities.
+ // Invalid entities are entities that are not in the vCenter inventory.
+ // - If the list contains only datastores, the method throws
+ // an InvalidArgument fault.
+ // - If the list contains virtual machines and disks and the entities
+ // are invalid or have been deleted by the time of the request, the method
+ // throws an InvalidArgument fault.
+ //
+ // If an entity does not have an associated storage profile, the entity
+ // is removed from the list.
+ Entities []PbmServerObjectRef `xml:"entities" json:"entities"`
+ // Not used. If specified, the Server ignores the value.
+ // The Server uses the profiles associated with the specified entities.
+ Profile *PbmProfileId `xml:"profile,omitempty" json:"profile,omitempty"`
}
func init() {
@@ -647,7 +1179,7 @@ func init() {
}
type PbmCheckComplianceResponse struct {
- Returnval []PbmComplianceResult `xml:"returnval,omitempty"`
+ Returnval []PbmComplianceResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmCheckRequirements PbmCheckRequirementsRequestType
@@ -656,11 +1188,27 @@ func init() {
types.Add("pbm:PbmCheckRequirements", reflect.TypeOf((*PbmCheckRequirements)(nil)).Elem())
}
+// The parameters of `PbmPlacementSolver.PbmCheckRequirements`.
type PbmCheckRequirementsRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"`
- PlacementSubjectRef *PbmServerObjectRef `xml:"placementSubjectRef,omitempty"`
- PlacementSubjectRequirement []BasePbmPlacementRequirement `xml:"placementSubjectRequirement,omitempty,typeattr"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Candidate list of hubs, either datastores or storage pods
+ // or a mix. If this parameter is not specified, the Server uses all of the
+ // datastores and storage pods for placement compatibility checking.
+ HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty" json:"hubsToSearch,omitempty"`
+ // reference to the object being placed. Should be null when a new
+ // object is being provisioned. Should be specified when placement compatibility is being checked
+ // for an existing object. Supported objects are
+ // `virtualMachine`,
+ // `virtualMachineAndDisks`,
+ // `virtualDiskId`,
+ // `virtualDiskUUID`
+ PlacementSubjectRef *PbmServerObjectRef `xml:"placementSubjectRef,omitempty" json:"placementSubjectRef,omitempty"`
+ // Requirements including the policy requirements, compute
+ // requirements and capacity requirements. It is invalid to specify no requirements. It is also
+ // invalid to specify duplicate requirements or multiple conflicting requirements such as
+ // specifying both `PbmPlacementCapabilityConstraintsRequirement` and
+ // `PbmPlacementCapabilityProfileRequirement`.
+ PlacementSubjectRequirement []BasePbmPlacementRequirement `xml:"placementSubjectRequirement,omitempty,typeattr" json:"placementSubjectRequirement,omitempty"`
}
func init() {
@@ -668,7 +1216,7 @@ func init() {
}
type PbmCheckRequirementsResponse struct {
- Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty"`
+ Returnval []PbmPlacementCompatibilityResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmCheckRollupCompliance PbmCheckRollupComplianceRequestType
@@ -677,9 +1225,14 @@ func init() {
types.Add("pbm:PbmCheckRollupCompliance", reflect.TypeOf((*PbmCheckRollupCompliance)(nil)).Elem())
}
+// The parameters of `PbmComplianceManager.PbmCheckRollupCompliance`.
type PbmCheckRollupComplianceRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entity []PbmServerObjectRef `xml:"entity"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // One or more references to virtual machines.
+ // A maximum of 1000 virtual machines can be specified
+ // in a call. The results of calling the checkRollupCompliance API with
+ // more than a 1000 entities is undefined.
+ Entity []PbmServerObjectRef `xml:"entity" json:"entity"`
}
func init() {
@@ -687,13 +1240,17 @@ func init() {
}
type PbmCheckRollupComplianceResponse struct {
- Returnval []PbmRollupComplianceResult `xml:"returnval,omitempty"`
+ Returnval []PbmRollupComplianceResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
+// Super class for all compatibility check faults.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCompatibilityCheckFault struct {
PbmFault
- Hub PbmPlacementHub `xml:"hub"`
+ // Placement Hub
+ Hub PbmPlacementHub `xml:"hub" json:"hub"`
}
func init() {
@@ -706,43 +1263,124 @@ func init() {
types.Add("pbm:PbmCompatibilityCheckFaultFault", reflect.TypeOf((*PbmCompatibilityCheckFaultFault)(nil)).Elem())
}
+// Additional information on the effects of backend resources and
+// operations on the storage object.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmComplianceOperationalStatus struct {
types.DynamicData
- Healthy *bool `xml:"healthy"`
- OperationETA *time.Time `xml:"operationETA"`
- OperationProgress int64 `xml:"operationProgress,omitempty"`
- Transitional *bool `xml:"transitional"`
+ // Whether the object is currently affected by the failure of backend
+ // storage resources.
+ //
+ // Optional property.
+ Healthy *bool `xml:"healthy" json:"healthy,omitempty"`
+ // Estimated completion time of a backend operation affecting the object.
+ //
+ // If set, then "transitional" will be true.
+ // Optional property.
+ OperationETA *time.Time `xml:"operationETA" json:"operationETA,omitempty"`
+ // Percent progress of a backend operation affecting the object.
+ //
+ // If set, then "transitional" will be true.
+ // Optional property.
+ OperationProgress int64 `xml:"operationProgress,omitempty" json:"operationProgress,omitempty"`
+ // Whether an object is undergoing a backend operation that may affect
+ // its performance.
+ //
+ // This may be a rebalancing the resources of a healthy
+ // object or recovery tasks for an unhealthy object.
+ // Optional property.
+ Transitional *bool `xml:"transitional" json:"transitional,omitempty"`
}
func init() {
types.Add("pbm:PbmComplianceOperationalStatus", reflect.TypeOf((*PbmComplianceOperationalStatus)(nil)).Elem())
}
+// The `PbmCompliancePolicyStatus` data object provides information
+// when compliance checking produces non-compliant results.
+//
+// See
+// `PbmComplianceResult*.*PbmComplianceResult.violatedPolicies`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmCompliancePolicyStatus struct {
types.DynamicData
- ExpectedValue PbmCapabilityInstance `xml:"expectedValue"`
- CurrentValue *PbmCapabilityInstance `xml:"currentValue,omitempty"`
+ // Expected storage capability values of profile policies defined
+ // by a storage provider.
+ ExpectedValue PbmCapabilityInstance `xml:"expectedValue" json:"expectedValue"`
+ // Current storage requirement values of the profile policies
+ // specified for the virtual machine or virtual disk.
+ CurrentValue *PbmCapabilityInstance `xml:"currentValue,omitempty" json:"currentValue,omitempty"`
}
func init() {
types.Add("pbm:PbmCompliancePolicyStatus", reflect.TypeOf((*PbmCompliancePolicyStatus)(nil)).Elem())
}
+// The `PbmComplianceResult` data object describes the results of profile compliance
+// checking for a virtual machine or virtual disk.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmComplianceResult struct {
types.DynamicData
- CheckTime time.Time `xml:"checkTime"`
- Entity PbmServerObjectRef `xml:"entity"`
- Profile *PbmProfileId `xml:"profile,omitempty"`
- ComplianceTaskStatus string `xml:"complianceTaskStatus,omitempty"`
- ComplianceStatus string `xml:"complianceStatus"`
- Mismatch bool `xml:"mismatch"`
- ViolatedPolicies []PbmCompliancePolicyStatus `xml:"violatedPolicies,omitempty"`
- ErrorCause []types.LocalizedMethodFault `xml:"errorCause,omitempty"`
- OperationalStatus *PbmComplianceOperationalStatus `xml:"operationalStatus,omitempty"`
- Info *PbmExtendedElementDescription `xml:"info,omitempty"`
+ // Time when the compliance was checked.
+ CheckTime time.Time `xml:"checkTime" json:"checkTime"`
+ // Virtual machine or virtual disk for which compliance was checked.
+ Entity PbmServerObjectRef `xml:"entity" json:"entity"`
+ // Requirement profile with which the compliance was checked.
+ Profile *PbmProfileId `xml:"profile,omitempty" json:"profile,omitempty"`
+ // Status of the current running compliance operation.
+ //
+ // If there is no
+ // compliance check operation triggered, this indicates the last compliance
+ // task status. complianceTaskStatus is a string value that
+ // corresponds to one of the
+ // `PbmComplianceResultComplianceTaskStatus_enum` values.
+ ComplianceTaskStatus string `xml:"complianceTaskStatus,omitempty" json:"complianceTaskStatus,omitempty"`
+ // Status of the compliance operation.
+ //
+ // complianceStatus is a
+ // string value that corresponds to one of the
+ // `PbmComplianceStatus_enum` values.
+ //
+ // When you perform compliance checking on an entity whose associated profile
+ // contains more than one subprofile (
+ // `PbmCapabilityProfile` .
+ // `PbmCapabilityProfile.constraints`), a compliant
+ // result for any one of the subprofiles will produce a compliant result
+ // for the operation.
+ ComplianceStatus string `xml:"complianceStatus" json:"complianceStatus"`
+ // Deprecated as of vSphere 2016, use
+ // `PbmComplianceStatus_enum` to
+ // know if a mismatch has occurred. If
+ // `PbmComplianceResult.complianceStatus` value
+ // is outOfDate, mismatch has occurred.
+ //
+ // Set to true if there is a profile version mismatch between the Storage
+ // Profile Server and the storage provider.
+ //
+ // If you receive a result that
+ // indicates a mismatch, you must use the vSphere API to update the profile
+ // associated with the virtual machine or virtual disk.
+ Mismatch bool `xml:"mismatch" json:"mismatch"`
+ // Values for capabilities that are known to be non-compliant with the specified constraints.
+ ViolatedPolicies []PbmCompliancePolicyStatus `xml:"violatedPolicies,omitempty" json:"violatedPolicies,omitempty"`
+ // This property is set if the compliance task fails with errors.
+ //
+ // There can be
+ // more than one error since a policy containing multiple blobs can return
+ // multiple failures, one for each blob.
+ ErrorCause []types.LocalizedMethodFault `xml:"errorCause,omitempty" json:"errorCause,omitempty"`
+ // Additional information on the effects of backend resources and
+ // operations on the storage object.
+ OperationalStatus *PbmComplianceOperationalStatus `xml:"operationalStatus,omitempty" json:"operationalStatus,omitempty"`
+ // Informational localized messages provided by the VASA provider in
+ // addition to the violatedPolicy.
+ Info *PbmExtendedElementDescription `xml:"info,omitempty" json:"info,omitempty"`
}
func init() {
@@ -755,9 +1393,11 @@ func init() {
types.Add("pbm:PbmCreate", reflect.TypeOf((*PbmCreate)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmCreate`.
type PbmCreateRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- CreateSpec PbmCapabilityProfileCreateSpec `xml:"createSpec"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Capability-based profile specification.
+ CreateSpec PbmCapabilityProfileCreateSpec `xml:"createSpec" json:"createSpec"`
}
func init() {
@@ -765,48 +1405,87 @@ func init() {
}
type PbmCreateResponse struct {
- Returnval PbmProfileId `xml:"returnval"`
+ Returnval PbmProfileId `xml:"returnval" json:"returnval"`
}
+// DataServiceToProfilesMap maps the data service policy to the parent storage policies
+// if referred.
+//
+// This is returned from the API call
+// `ProfileManager#queryParentStoragePolicies(ProfileId[])`
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmDataServiceToPoliciesMap struct {
types.DynamicData
- DataServicePolicy PbmProfileId `xml:"dataServicePolicy"`
- ParentStoragePolicies []PbmProfileId `xml:"parentStoragePolicies,omitempty"`
- Fault *types.LocalizedMethodFault `xml:"fault,omitempty"`
+ // Denotes a Data Service Policy Id.
+ DataServicePolicy PbmProfileId `xml:"dataServicePolicy" json:"dataServicePolicy"`
+ // Storage Policies that refer to the Data Service Policy given by
+ // `PbmDataServiceToPoliciesMap.dataServicePolicy`.
+ ParentStoragePolicies []PbmProfileId `xml:"parentStoragePolicies,omitempty" json:"parentStoragePolicies,omitempty"`
+ // The fault is set in case of error conditions and this property will
+ // have the reason.
+ Fault *types.LocalizedMethodFault `xml:"fault,omitempty" json:"fault,omitempty"`
}
func init() {
types.Add("pbm:PbmDataServiceToPoliciesMap", reflect.TypeOf((*PbmDataServiceToPoliciesMap)(nil)).Elem())
}
+// Space stats for datastore
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmDatastoreSpaceStatistics struct {
types.DynamicData
- ProfileId string `xml:"profileId,omitempty"`
- PhysicalTotalInMB int64 `xml:"physicalTotalInMB"`
- PhysicalFreeInMB int64 `xml:"physicalFreeInMB"`
- PhysicalUsedInMB int64 `xml:"physicalUsedInMB"`
- LogicalLimitInMB int64 `xml:"logicalLimitInMB,omitempty"`
- LogicalFreeInMB int64 `xml:"logicalFreeInMB"`
- LogicalUsedInMB int64 `xml:"logicalUsedInMB"`
+ // Capability profile id.
+ //
+ // It is null when the statistics are for the entire
+ // datastore.
+ ProfileId string `xml:"profileId,omitempty" json:"profileId,omitempty"`
+ // Total physical space in MB.
+ PhysicalTotalInMB int64 `xml:"physicalTotalInMB" json:"physicalTotalInMB"`
+ // Total physical free space in MB.
+ PhysicalFreeInMB int64 `xml:"physicalFreeInMB" json:"physicalFreeInMB"`
+ // Used physical storage space in MB.
+ PhysicalUsedInMB int64 `xml:"physicalUsedInMB" json:"physicalUsedInMB"`
+ // Logical space limit set by the storage admin in MB.
+ //
+ // Omitted if there is no Logical space limit.
+ LogicalLimitInMB int64 `xml:"logicalLimitInMB,omitempty" json:"logicalLimitInMB,omitempty"`
+ // Free logical storage space in MB.
+ LogicalFreeInMB int64 `xml:"logicalFreeInMB" json:"logicalFreeInMB"`
+ // Used logical storage space in MB.
+ LogicalUsedInMB int64 `xml:"logicalUsedInMB" json:"logicalUsedInMB"`
}
func init() {
types.Add("pbm:PbmDatastoreSpaceStatistics", reflect.TypeOf((*PbmDatastoreSpaceStatistics)(nil)).Elem())
}
+// Not supported in this release.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmDefaultCapabilityProfile struct {
PbmCapabilityProfile
- VvolType []string `xml:"vvolType"`
- ContainerId string `xml:"containerId"`
+ // Not supported in this release.
+ VvolType []string `xml:"vvolType" json:"vvolType"`
+ // Not supported in this release.
+ ContainerId string `xml:"containerId" json:"containerId"`
}
func init() {
types.Add("pbm:PbmDefaultCapabilityProfile", reflect.TypeOf((*PbmDefaultCapabilityProfile)(nil)).Elem())
}
+// Warning fault used to indicate that the vendor specific datastore matches the tag in the
+// requirements profile that does not have a vendor specific rule set.
+//
+// In such case,
+// an empty blob is sent to the vendor specific datastore and the default profile would apply.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmDefaultProfileAppliesFault struct {
PbmCompatibilityCheckFault
}
@@ -821,11 +1500,20 @@ func init() {
types.Add("pbm:PbmDefaultProfileAppliesFaultFault", reflect.TypeOf((*PbmDefaultProfileAppliesFaultFault)(nil)).Elem())
}
+// Data structure that stores the default profile for datastores.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmDefaultProfileInfo struct {
types.DynamicData
- Datastores []PbmPlacementHub `xml:"datastores"`
- DefaultProfile BasePbmProfile `xml:"defaultProfile,omitempty,typeattr"`
+ // Datastores
+ Datastores []PbmPlacementHub `xml:"datastores" json:"datastores"`
+ // Default requirements profile.
+ //
+ // It is set to null if the datastores are not associated with any default profile.
+ DefaultProfile BasePbmProfile `xml:"defaultProfile,omitempty,typeattr" json:"defaultProfile,omitempty"`
+ // NoPermission fault if default profile is not permitted.
+ MethodFault *types.LocalizedMethodFault `xml:"methodFault,omitempty" json:"methodFault,omitempty"`
}
func init() {
@@ -838,9 +1526,11 @@ func init() {
types.Add("pbm:PbmDelete", reflect.TypeOf((*PbmDelete)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmDelete`.
type PbmDeleteRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- ProfileId []PbmProfileId `xml:"profileId"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Array of profile identifiers.
+ ProfileId []PbmProfileId `xml:"profileId" json:"profileId"`
}
func init() {
@@ -848,13 +1538,18 @@ func init() {
}
type PbmDeleteResponse struct {
- Returnval []PbmProfileOperationOutcome `xml:"returnval,omitempty"`
+ Returnval []PbmProfileOperationOutcome `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
+// A DuplicateName exception is thrown because a name already exists
+// in the same name space.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmDuplicateName struct {
PbmFault
- Name string `xml:"name"`
+ // The name that is already bound in the name space.
+ Name string `xml:"name" json:"name"`
}
func init() {
@@ -870,17 +1565,38 @@ func init() {
type PbmExtendedElementDescription struct {
types.DynamicData
- Label string `xml:"label"`
- Summary string `xml:"summary"`
- Key string `xml:"key"`
- MessageCatalogKeyPrefix string `xml:"messageCatalogKeyPrefix"`
- MessageArg []types.KeyAnyValue `xml:"messageArg,omitempty"`
+ // Display label.
+ Label string `xml:"label" json:"label"`
+ // Summary description.
+ Summary string `xml:"summary" json:"summary"`
+ // Enumeration or literal ID being described.
+ Key string `xml:"key" json:"key"`
+ // Key to the localized message string in the catalog.
+ //
+ // If the localized string contains parameters, values to the
+ // parameters will be provided in #messageArg.
+ // E.g: If the message in the catalog is
+ // "IP address is {address}", value for "address"
+ // will be provided by #messageArg.
+ // Both summary and label in ElementDescription will have a corresponding
+ // entry in the message catalog with the keys
+ // .summary and .label
+ // respectively.
+ // ElementDescription.summary and ElementDescription.label will contain
+ // the strings in server locale.
+ MessageCatalogKeyPrefix string `xml:"messageCatalogKeyPrefix" json:"messageCatalogKeyPrefix"`
+ // Provides named arguments that can be used to localize the
+ // message in the catalog.
+ MessageArg []types.KeyAnyValue `xml:"messageArg,omitempty" json:"messageArg,omitempty"`
}
func init() {
types.Add("pbm:PbmExtendedElementDescription", reflect.TypeOf((*PbmExtendedElementDescription)(nil)).Elem())
}
+// The super class for all pbm faults.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmFault struct {
types.MethodFault
}
@@ -895,6 +1611,10 @@ func init() {
types.Add("pbm:PbmFaultFault", reflect.TypeOf((*PbmFaultFault)(nil)).Elem())
}
+// Thrown when login fails due to token not provided or token could not be
+// validated.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmFaultInvalidLogin struct {
PbmFault
}
@@ -909,17 +1629,51 @@ func init() {
types.Add("pbm:PbmFaultInvalidLoginFault", reflect.TypeOf((*PbmFaultInvalidLoginFault)(nil)).Elem())
}
+// Thrown when an operation is denied because of a privilege
+// not held on a storage profile.
+//
+// This structure may be used only with operations rendered under `/pbm`.
+type PbmFaultNoPermission struct {
+ types.SecurityError
+
+ // List of profile ids and missing privileges for each profile
+ MissingPrivileges []PbmFaultNoPermissionEntityPrivileges `xml:"missingPrivileges,omitempty" json:"missingPrivileges,omitempty"`
+}
+
+func init() {
+ types.Add("pbm:PbmFaultNoPermission", reflect.TypeOf((*PbmFaultNoPermission)(nil)).Elem())
+}
+
type PbmFaultNoPermissionEntityPrivileges struct {
types.DynamicData
- ProfileId *PbmProfileId `xml:"profileId,omitempty"`
- PrivilegeIds []string `xml:"privilegeIds,omitempty"`
+ ProfileId *PbmProfileId `xml:"profileId,omitempty" json:"profileId,omitempty"`
+ PrivilegeIds []string `xml:"privilegeIds,omitempty" json:"privilegeIds,omitempty"`
}
func init() {
types.Add("pbm:PbmFaultNoPermissionEntityPrivileges", reflect.TypeOf((*PbmFaultNoPermissionEntityPrivileges)(nil)).Elem())
}
+type PbmFaultNoPermissionFault PbmFaultNoPermission
+
+func init() {
+ types.Add("pbm:PbmFaultNoPermissionFault", reflect.TypeOf((*PbmFaultNoPermissionFault)(nil)).Elem())
+}
+
+// A NotFound error occurs when a referenced component of a managed
+// object cannot be found.
+//
+// The referenced component can be a data
+// object type (such as a role or permission) or a primitive
+// (such as a string).
+//
+// For example, if the missing referenced component is a data object, such as
+// VirtualSwitch, the NotFound error is
+// thrown. The NotFound error is also thrown if the data object is found, but the referenced name
+// (for example, "vswitch0") is not.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmFaultNotFound struct {
PbmFault
}
@@ -954,10 +1708,19 @@ func init() {
types.Add("pbm:PbmFetchCapabilityMetadata", reflect.TypeOf((*PbmFetchCapabilityMetadata)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmFetchCapabilityMetadata`.
type PbmFetchCapabilityMetadataRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- ResourceType *PbmProfileResourceType `xml:"resourceType,omitempty"`
- VendorUuid string `xml:"vendorUuid,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Type of profile resource. The Server supports the "STORAGE" resource
+ // type only. If not specified, this method will return capability metadata for the storage
+ // resources. Any other resourceType is considered invalid.
+ ResourceType *PbmProfileResourceType `xml:"resourceType,omitempty" json:"resourceType,omitempty"`
+ // Unique identifier for the vendor/owner of capability
+ // metadata. The specified vendor ID must match
+ // `PbmCapabilitySchemaVendorInfo*.*PbmCapabilitySchemaVendorInfo.vendorUuid`.
+ // If omitted, the Server searchs all capability metadata registered with the system. If a
+ // vendorUuid unknown to the Server is specified, empty results will be returned.
+ VendorUuid string `xml:"vendorUuid,omitempty" json:"vendorUuid,omitempty"`
}
func init() {
@@ -965,7 +1728,7 @@ func init() {
}
type PbmFetchCapabilityMetadataResponse struct {
- Returnval []PbmCapabilityMetadataPerCategory `xml:"returnval,omitempty"`
+ Returnval []PbmCapabilityMetadataPerCategory `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmFetchCapabilitySchema PbmFetchCapabilitySchemaRequestType
@@ -974,10 +1737,20 @@ func init() {
types.Add("pbm:PbmFetchCapabilitySchema", reflect.TypeOf((*PbmFetchCapabilitySchema)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmFetchCapabilitySchema`.
type PbmFetchCapabilitySchemaRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- VendorUuid string `xml:"vendorUuid,omitempty"`
- LineOfService []string `xml:"lineOfService,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Unique identifier for the vendor/owner of capability metadata.
+ // If omitted, the server searchs all capability metadata registered
+ // with the system. The specified vendor ID must match
+ // `PbmCapabilitySchemaVendorInfo*.*PbmCapabilitySchemaVendorInfo.vendorUuid`.
+ VendorUuid string `xml:"vendorUuid,omitempty" json:"vendorUuid,omitempty"`
+ // Optional line of service that must match `PbmLineOfServiceInfoLineOfServiceEnum_enum`.
+ // If specified, the capability schema objects
+ // are returned for the given lineOfServices. If null, then all
+ // capability schema objects that may or may not have data service capabilities
+ // are returned.
+ LineOfService []string `xml:"lineOfService,omitempty" json:"lineOfService,omitempty"`
}
func init() {
@@ -985,7 +1758,7 @@ func init() {
}
type PbmFetchCapabilitySchemaResponse struct {
- Returnval []PbmCapabilitySchema `xml:"returnval,omitempty"`
+ Returnval []PbmCapabilitySchema `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmFetchComplianceResult PbmFetchComplianceResultRequestType
@@ -994,10 +1767,24 @@ func init() {
types.Add("pbm:PbmFetchComplianceResult", reflect.TypeOf((*PbmFetchComplianceResult)(nil)).Elem())
}
+// The parameters of `PbmComplianceManager.PbmFetchComplianceResult`.
type PbmFetchComplianceResultRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entities []PbmServerObjectRef `xml:"entities"`
- Profile *PbmProfileId `xml:"profile,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // One or more references to storage entities.
+ // A maximum of 1000 virtual machines and/or virtual disks can be specified
+ // in a call. The results of calling the fetchComplianceResult API with
+ // more than a 1000 entities is undefined.
+ // - If the list of entities also contains datastores, the Server
+ // will ignore the datastores.
+ // - If the list contains valid and invalid entities, the Server ignores
+ // the invalid entities and returns results for the valid entities.
+ // Invalid entities are entities that are not in the vCenter inventory.
+ // - If the list contains only datastores, the method throws
+ // an InvalidArgument fault.
+ Entities []PbmServerObjectRef `xml:"entities" json:"entities"`
+ // Not used. if specified, the Server ignores the value.
+ // The Server uses the profiles associated with the specified entities.
+ Profile *PbmProfileId `xml:"profile,omitempty" json:"profile,omitempty"`
}
func init() {
@@ -1005,14 +1792,22 @@ func init() {
}
type PbmFetchComplianceResultResponse struct {
- Returnval []PbmComplianceResult `xml:"returnval,omitempty"`
+ Returnval []PbmComplianceResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
+// The `PbmFetchEntityHealthStatusSpec` data object contains
+// the arguments required for
+// `PbmComplianceManager.PbmFetchEntityHealthStatusExt`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmFetchEntityHealthStatusSpec struct {
types.DynamicData
- ObjectRef PbmServerObjectRef `xml:"objectRef"`
- BackingId string `xml:"backingId,omitempty"`
+ // `PbmServerObjectRef` for which the healthStatus is required
+ ObjectRef PbmServerObjectRef `xml:"objectRef" json:"objectRef"`
+ // BackingId for the ServerObjectRef
+ // BackingId is mandatory for FCD on vSAN
+ BackingId string `xml:"backingId,omitempty" json:"backingId,omitempty"`
}
func init() {
@@ -1026,7 +1821,7 @@ func init() {
}
type PbmFetchResourceTypeRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
}
func init() {
@@ -1034,7 +1829,7 @@ func init() {
}
type PbmFetchResourceTypeResponse struct {
- Returnval []PbmProfileResourceType `xml:"returnval,omitempty"`
+ Returnval []PbmProfileResourceType `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmFetchRollupComplianceResult PbmFetchRollupComplianceResultRequestType
@@ -1043,9 +1838,14 @@ func init() {
types.Add("pbm:PbmFetchRollupComplianceResult", reflect.TypeOf((*PbmFetchRollupComplianceResult)(nil)).Elem())
}
+// The parameters of `PbmComplianceManager.PbmFetchRollupComplianceResult`.
type PbmFetchRollupComplianceResultRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entity []PbmServerObjectRef `xml:"entity"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // One or more virtual machines.
+ // A maximum of 1000 virtual machines can be specified
+ // in a call. The results of calling the fetchRollupComplianceResult API with
+ // more than a 1000 entity objects is undefined.
+ Entity []PbmServerObjectRef `xml:"entity" json:"entity"`
}
func init() {
@@ -1053,7 +1853,7 @@ func init() {
}
type PbmFetchRollupComplianceResultResponse struct {
- Returnval []PbmRollupComplianceResult `xml:"returnval,omitempty"`
+ Returnval []PbmRollupComplianceResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmFetchVendorInfo PbmFetchVendorInfoRequestType
@@ -1062,9 +1862,13 @@ func init() {
types.Add("pbm:PbmFetchVendorInfo", reflect.TypeOf((*PbmFetchVendorInfo)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmFetchVendorInfo`.
type PbmFetchVendorInfoRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- ResourceType *PbmProfileResourceType `xml:"resourceType,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Specifies the resource type. The Server supports the STORAGE resource
+ // type only. If not specified, server defaults to STORAGE resource type. Any other
+ // resourceType is considered invalid.
+ ResourceType *PbmProfileResourceType `xml:"resourceType,omitempty" json:"resourceType,omitempty"`
}
func init() {
@@ -1072,7 +1876,7 @@ func init() {
}
type PbmFetchVendorInfoResponse struct {
- Returnval []PbmCapabilityVendorResourceTypeInfo `xml:"returnval,omitempty"`
+ Returnval []PbmCapabilityVendorResourceTypeInfo `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmFindApplicableDefaultProfile PbmFindApplicableDefaultProfileRequestType
@@ -1081,9 +1885,12 @@ func init() {
types.Add("pbm:PbmFindApplicableDefaultProfile", reflect.TypeOf((*PbmFindApplicableDefaultProfile)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmFindApplicableDefaultProfile`.
type PbmFindApplicableDefaultProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Datastores []PbmPlacementHub `xml:"datastores"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Datastores for which the default profile is found out. Note that
+ // the datastore pods/clusters are not supported.
+ Datastores []PbmPlacementHub `xml:"datastores" json:"datastores"`
}
func init() {
@@ -1091,9 +1898,13 @@ func init() {
}
type PbmFindApplicableDefaultProfileResponse struct {
- Returnval []BasePbmProfile `xml:"returnval,omitempty,typeattr"`
+ Returnval []BasePbmProfile `xml:"returnval,omitempty,typeattr" json:"returnval,omitempty"`
}
+// Warning fault used to indicate that the vendor specific datastore matches the tag in the
+// requirements profile but doesnt match the vendor specific rule set in the requirements profile.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmIncompatibleVendorSpecificRuleSet struct {
PbmCapabilityProfilePropertyMismatchFault
}
@@ -1108,10 +1919,19 @@ func init() {
types.Add("pbm:PbmIncompatibleVendorSpecificRuleSetFault", reflect.TypeOf((*PbmIncompatibleVendorSpecificRuleSetFault)(nil)).Elem())
}
+// LegacyHubsNotSupported fault is thrown to indicate the legacy hubs that are not supported.
+//
+// For storage, legacy hubs or datastores are VMFS and NFS datastores.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmLegacyHubsNotSupported struct {
PbmFault
- Hubs []PbmPlacementHub `xml:"hubs"`
+ // Legacy hubs that are not supported.
+ //
+ // Only datastores will be populated in this fault. Datastore clusters
+ // are not allowed.
+ Hubs []PbmPlacementHub `xml:"hubs" json:"hubs"`
}
func init() {
@@ -1124,12 +1944,21 @@ func init() {
types.Add("pbm:PbmLegacyHubsNotSupportedFault", reflect.TypeOf((*PbmLegacyHubsNotSupportedFault)(nil)).Elem())
}
+// Describes Line of Service of a capability provider.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmLineOfServiceInfo struct {
types.DynamicData
- LineOfService string `xml:"lineOfService"`
- Name PbmExtendedElementDescription `xml:"name"`
- Description *PbmExtendedElementDescription `xml:"description,omitempty"`
+ // `PbmLineOfServiceInfoLineOfServiceEnum_enum` - must be one of the values
+ // for enum `PbmLineOfServiceInfoLineOfServiceEnum_enum`.
+ LineOfService string `xml:"lineOfService" json:"lineOfService"`
+ // Name of the service - for informational
+ // purposes only.
+ Name PbmExtendedElementDescription `xml:"name" json:"name"`
+ // Description of the service - for informational
+ // purposes only.
+ Description *PbmExtendedElementDescription `xml:"description,omitempty" json:"description,omitempty"`
}
func init() {
@@ -1139,18 +1968,22 @@ func init() {
type PbmLoggingConfiguration struct {
types.DynamicData
- Component string `xml:"component"`
- LogLevel string `xml:"logLevel"`
+ Component string `xml:"component" json:"component"`
+ LogLevel string `xml:"logLevel" json:"logLevel"`
}
func init() {
types.Add("pbm:PbmLoggingConfiguration", reflect.TypeOf((*PbmLoggingConfiguration)(nil)).Elem())
}
+// NonExistentHubs is thrown to indicate that some non existent datastores are used.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmNonExistentHubs struct {
PbmFault
- Hubs []PbmPlacementHub `xml:"hubs"`
+ // Legacy hubs that do not exist.
+ Hubs []PbmPlacementHub `xml:"hubs" json:"hubs"`
}
func init() {
@@ -1163,72 +1996,140 @@ func init() {
types.Add("pbm:PbmNonExistentHubsFault", reflect.TypeOf((*PbmNonExistentHubsFault)(nil)).Elem())
}
+// Describes the data services provided by the storage arrays.
+//
+// In addition to storing bits, some VASA providers may also want to separate
+// their capabilities into lines of service to let vSphere manage finer grain
+// policies. For example an array may support replication natively, and may
+// want vSphere policies to be defined for the replication aspect separately
+// and compose them with persistence related policies.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPersistenceBasedDataServiceInfo struct {
PbmLineOfServiceInfo
- CompatiblePersistenceSchemaNamespace []string `xml:"compatiblePersistenceSchemaNamespace,omitempty"`
+ // This property should be set with compatible schema namespaces exposed by
+ // the vendor provider.
+ //
+ // If not specified, vSphere assumes all Data Service
+ // provider schemas are compatible with all persistence provider namespaces
+ // advertised by the VASA provider.
+ CompatiblePersistenceSchemaNamespace []string `xml:"compatiblePersistenceSchemaNamespace,omitempty" json:"compatiblePersistenceSchemaNamespace,omitempty"`
}
func init() {
types.Add("pbm:PbmPersistenceBasedDataServiceInfo", reflect.TypeOf((*PbmPersistenceBasedDataServiceInfo)(nil)).Elem())
}
+// Requirement type containing capability constraints
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementCapabilityConstraintsRequirement struct {
PbmPlacementRequirement
- Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr"`
+ // Capability constraints
+ Constraints BasePbmCapabilityConstraints `xml:"constraints,typeattr" json:"constraints"`
}
func init() {
types.Add("pbm:PbmPlacementCapabilityConstraintsRequirement", reflect.TypeOf((*PbmPlacementCapabilityConstraintsRequirement)(nil)).Elem())
}
+// A Requirement for a particular `PbmCapabilityProfile`.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementCapabilityProfileRequirement struct {
PbmPlacementRequirement
- ProfileId PbmProfileId `xml:"profileId"`
+ // Reference to the capability profile being used as a requirement
+ ProfileId PbmProfileId `xml:"profileId" json:"profileId"`
}
func init() {
types.Add("pbm:PbmPlacementCapabilityProfileRequirement", reflect.TypeOf((*PbmPlacementCapabilityProfileRequirement)(nil)).Elem())
}
+// The `PbmPlacementCompatibilityResult` data object
+// contains the compatibility result of a placement request.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementCompatibilityResult struct {
types.DynamicData
- Hub PbmPlacementHub `xml:"hub"`
- MatchingResources []BasePbmPlacementMatchingResources `xml:"matchingResources,omitempty,typeattr"`
- HowMany int64 `xml:"howMany,omitempty"`
- Utilization []PbmPlacementResourceUtilization `xml:"utilization,omitempty"`
- Warning []types.LocalizedMethodFault `xml:"warning,omitempty"`
- Error []types.LocalizedMethodFault `xml:"error,omitempty"`
+ // The Datastore or StoragePod under consideration
+ // as a location for virtual machine files.
+ Hub PbmPlacementHub `xml:"hub" json:"hub"`
+ // Resources that match the policy.
+ //
+ // If populated, signifies that there are
+ // specific resources that match the policy for `PbmPlacementCompatibilityResult.hub`. If null,
+ // signifies that all resources (for example, hosts connected to the
+ // datastore or storage pod) are compatible.
+ MatchingResources []BasePbmPlacementMatchingResources `xml:"matchingResources,omitempty,typeattr" json:"matchingResources,omitempty"`
+ // How many objects of the kind requested can be provisioned on this
+ // `PbmPlacementCompatibilityResult.hub`.
+ HowMany int64 `xml:"howMany,omitempty" json:"howMany,omitempty"`
+ // This field is not populated if there is no size in the query, i.e.
+ //
+ // if the request carries only policy and no size requirements, this
+ // will not be populated.
+ Utilization []PbmPlacementResourceUtilization `xml:"utilization,omitempty" json:"utilization,omitempty"`
+ // Array of faults that describe issues that may affect profile compatibility.
+ //
+ // Users should consider these issues before using this Datastore
+ // or StoragePod and a connected Hosts.
+ Warning []types.LocalizedMethodFault `xml:"warning,omitempty" json:"warning,omitempty"`
+ // Array of faults that prevent this datastore or storage pod from being compatible with the
+ // specified profile, including if no host connected to this `PbmPlacementCompatibilityResult.hub` is compatible.
+ Error []types.LocalizedMethodFault `xml:"error,omitempty" json:"error,omitempty"`
}
func init() {
types.Add("pbm:PbmPlacementCompatibilityResult", reflect.TypeOf((*PbmPlacementCompatibilityResult)(nil)).Elem())
}
+// A `PbmPlacementHub` data object identifies a storage location
+// where virtual machine files can be placed.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementHub struct {
types.DynamicData
- HubType string `xml:"hubType"`
- HubId string `xml:"hubId"`
+ // Type of the hub.
+ //
+ // Currently ManagedObject is the only supported type.
+ HubType string `xml:"hubType" json:"hubType"`
+ // Hub identifier; a ManagedObjectReference to a datastore or a storage pod.
+ HubId string `xml:"hubId" json:"hubId"`
}
func init() {
types.Add("pbm:PbmPlacementHub", reflect.TypeOf((*PbmPlacementHub)(nil)).Elem())
}
+// Describes the collection of replication related resources that satisfy a
+// policy, for a specific datastore.
+//
+// This class is returned only when the policy contains replication capabilities.
+// For a storage pod, only those replication groups that are common across
+// all datastores in the storage pod are considered compatible.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementMatchingReplicationResources struct {
PbmPlacementMatchingResources
- ReplicationGroup []types.ReplicationGroupId `xml:"replicationGroup,omitempty"`
+ // Replication groups that match the policy.
+ ReplicationGroup []types.ReplicationGroupId `xml:"replicationGroup,omitempty" json:"replicationGroup,omitempty"`
}
func init() {
types.Add("pbm:PbmPlacementMatchingReplicationResources", reflect.TypeOf((*PbmPlacementMatchingReplicationResources)(nil)).Elem())
}
+// Describes the collection of resources (for example, hosts) that satisfy a
+// policy, for a specific datastore.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementMatchingResources struct {
types.DynamicData
}
@@ -1237,6 +2138,9 @@ func init() {
types.Add("pbm:PbmPlacementMatchingResources", reflect.TypeOf((*PbmPlacementMatchingResources)(nil)).Elem())
}
+// Defines a constraint for placing objects onto `PbmPlacementHub`s.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementRequirement struct {
types.DynamicData
}
@@ -1245,82 +2149,156 @@ func init() {
types.Add("pbm:PbmPlacementRequirement", reflect.TypeOf((*PbmPlacementRequirement)(nil)).Elem())
}
+// Describes the resource utilization metrics of a datastore.
+//
+// These results are not to be treated as a guaranteed availability,
+// they are useful to estimate the effects of a change of policy
+// or the effects of a provisioning action.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPlacementResourceUtilization struct {
types.DynamicData
- Name PbmExtendedElementDescription `xml:"name"`
- Description PbmExtendedElementDescription `xml:"description"`
- AvailableBefore int64 `xml:"availableBefore,omitempty"`
- AvailableAfter int64 `xml:"availableAfter,omitempty"`
- Total int64 `xml:"total,omitempty"`
+ // Name of the resource.
+ Name PbmExtendedElementDescription `xml:"name" json:"name"`
+ // Description of the resource.
+ Description PbmExtendedElementDescription `xml:"description" json:"description"`
+ // Currently available (i.e.
+ //
+ // before the provisioning step).
+ AvailableBefore int64 `xml:"availableBefore,omitempty" json:"availableBefore,omitempty"`
+ // Available after the provisioning step.
+ AvailableAfter int64 `xml:"availableAfter,omitempty" json:"availableAfter,omitempty"`
+ // Total resource availability
+ Total int64 `xml:"total,omitempty" json:"total,omitempty"`
}
func init() {
types.Add("pbm:PbmPlacementResourceUtilization", reflect.TypeOf((*PbmPlacementResourceUtilization)(nil)).Elem())
}
+// The `PbmProfile` data object is the base object
+// for storage capability profiles.
+//
+// This object defines metadata
+// for the profile. The derived capability profile represents the
+// user's intent for selection and configuration of storage resources
+// and/or services that support deployment of virtual machines
+// and virtual disks.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmProfile struct {
types.DynamicData
- ProfileId PbmProfileId `xml:"profileId"`
- Name string `xml:"name"`
- Description string `xml:"description,omitempty"`
- CreationTime time.Time `xml:"creationTime"`
- CreatedBy string `xml:"createdBy"`
- LastUpdatedTime time.Time `xml:"lastUpdatedTime"`
- LastUpdatedBy string `xml:"lastUpdatedBy"`
+ // Unique identifier for the profile.
+ ProfileId PbmProfileId `xml:"profileId" json:"profileId"`
+ Name string `xml:"name" json:"name"`
+ // Profile description.
+ Description string `xml:"description,omitempty" json:"description,omitempty"`
+ // Time stamp of profile creation.
+ CreationTime time.Time `xml:"creationTime" json:"creationTime"`
+ // User name of the profile creator.
+ //
+ // Set during creation time.
+ CreatedBy string `xml:"createdBy" json:"createdBy"`
+ // Time stamp of latest modification to the profile.
+ LastUpdatedTime time.Time `xml:"lastUpdatedTime" json:"lastUpdatedTime"`
+ // Name of the user performing the latest modification of the profile.
+ LastUpdatedBy string `xml:"lastUpdatedBy" json:"lastUpdatedBy"`
}
func init() {
types.Add("pbm:PbmProfile", reflect.TypeOf((*PbmProfile)(nil)).Elem())
}
+// Profile unique identifier.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmProfileId struct {
types.DynamicData
- UniqueId string `xml:"uniqueId"`
+ // Unique identifier of the profile.
+ UniqueId string `xml:"uniqueId" json:"uniqueId"`
}
func init() {
types.Add("pbm:PbmProfileId", reflect.TypeOf((*PbmProfileId)(nil)).Elem())
}
+// The `PbmProfileOperationOutcome` data object describes the result
+// of a `PbmProfileProfileManager` operation.
+//
+// If there was an
+// error during the operation, the object identifies the fault.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmProfileOperationOutcome struct {
types.DynamicData
- ProfileId PbmProfileId `xml:"profileId"`
- Fault *types.LocalizedMethodFault `xml:"fault,omitempty"`
+ // Identifies the profile specified for the operation.
+ ProfileId PbmProfileId `xml:"profileId" json:"profileId"`
+ // One of the `PbmFault` objects.
+ Fault *types.LocalizedMethodFault `xml:"fault,omitempty" json:"fault,omitempty"`
}
func init() {
types.Add("pbm:PbmProfileOperationOutcome", reflect.TypeOf((*PbmProfileOperationOutcome)(nil)).Elem())
}
+// The `PbmProfileResourceType` data object defines the vSphere resource type
+// that is supported for profile management.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmProfileResourceType struct {
types.DynamicData
- ResourceType string `xml:"resourceType"`
+ // Type of resource to which capability information applies.
+ //
+ // resourceType is a string value that corresponds to
+ // a `PbmProfileResourceTypeEnum_enum` enumeration value.
+ // Only the STORAGE resource type is supported.
+ ResourceType string `xml:"resourceType" json:"resourceType"`
}
func init() {
types.Add("pbm:PbmProfileResourceType", reflect.TypeOf((*PbmProfileResourceType)(nil)).Elem())
}
+// The `PbmProfileType` identifier is defined by storage providers
+// to distinguish between different types of profiles plugged into the system.
+//
+// An example of a system supported profile type is "CapabilityBasedProfileType"
+// which will be the type used for all capability-based profiles created by
+// the system using capability metadata information published to the system.
+//
+// For internal use only.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmProfileType struct {
types.DynamicData
- UniqueId string `xml:"uniqueId"`
+ // Unique type identifier for this profile type.
+ //
+ // eg "CapabilityBased", or other.
+ UniqueId string `xml:"uniqueId" json:"uniqueId"`
}
func init() {
types.Add("pbm:PbmProfileType", reflect.TypeOf((*PbmProfileType)(nil)).Elem())
}
+// Fault used to indicate which property instance in requirements profile that does not
+// match.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmPropertyMismatchFault struct {
PbmCompatibilityCheckFault
- CapabilityInstanceId PbmCapabilityMetadataUniqueId `xml:"capabilityInstanceId"`
- RequirementPropertyInstance PbmCapabilityPropertyInstance `xml:"requirementPropertyInstance"`
+ // Id of the CapabilityInstance in requirements profile that
+ // does not match.
+ CapabilityInstanceId PbmCapabilityMetadataUniqueId `xml:"capabilityInstanceId" json:"capabilityInstanceId"`
+ // The property instance in requirement profile that does not match.
+ RequirementPropertyInstance PbmCapabilityPropertyInstance `xml:"requirementPropertyInstance" json:"requirementPropertyInstance"`
}
func init() {
@@ -1339,9 +2317,11 @@ func init() {
types.Add("pbm:PbmQueryAssociatedEntities", reflect.TypeOf((*PbmQueryAssociatedEntities)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryAssociatedEntities`.
type PbmQueryAssociatedEntitiesRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Profiles []PbmProfileId `xml:"profiles,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Storage policy array.
+ Profiles []PbmProfileId `xml:"profiles,omitempty" json:"profiles,omitempty"`
}
func init() {
@@ -1349,7 +2329,7 @@ func init() {
}
type PbmQueryAssociatedEntitiesResponse struct {
- Returnval []PbmQueryProfileResult `xml:"returnval,omitempty"`
+ Returnval []PbmQueryProfileResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryAssociatedEntity PbmQueryAssociatedEntityRequestType
@@ -1358,10 +2338,16 @@ func init() {
types.Add("pbm:PbmQueryAssociatedEntity", reflect.TypeOf((*PbmQueryAssociatedEntity)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryAssociatedEntity`.
type PbmQueryAssociatedEntityRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Profile PbmProfileId `xml:"profile"`
- EntityType string `xml:"entityType,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Profile identifier.
+ Profile PbmProfileId `xml:"profile" json:"profile"`
+ // If specified, the method returns only those entities
+ // which match the type. The entityType string value must match
+ // one of the `PbmObjectType_enum` values.
+ // If not specified, the method returns all entities associated with the profile.
+ EntityType string `xml:"entityType,omitempty" json:"entityType,omitempty"`
}
func init() {
@@ -1369,7 +2355,7 @@ func init() {
}
type PbmQueryAssociatedEntityResponse struct {
- Returnval []PbmServerObjectRef `xml:"returnval,omitempty"`
+ Returnval []PbmServerObjectRef `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryAssociatedProfile PbmQueryAssociatedProfileRequestType
@@ -1378,9 +2364,11 @@ func init() {
types.Add("pbm:PbmQueryAssociatedProfile", reflect.TypeOf((*PbmQueryAssociatedProfile)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryAssociatedProfile`.
type PbmQueryAssociatedProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entity PbmServerObjectRef `xml:"entity"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Reference to a virtual machine, virtual disk, or datastore.
+ Entity PbmServerObjectRef `xml:"entity" json:"entity"`
}
func init() {
@@ -1388,7 +2376,7 @@ func init() {
}
type PbmQueryAssociatedProfileResponse struct {
- Returnval []PbmProfileId `xml:"returnval,omitempty"`
+ Returnval []PbmProfileId `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryAssociatedProfiles PbmQueryAssociatedProfilesRequestType
@@ -1397,9 +2385,11 @@ func init() {
types.Add("pbm:PbmQueryAssociatedProfiles", reflect.TypeOf((*PbmQueryAssociatedProfiles)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryAssociatedProfiles`.
type PbmQueryAssociatedProfilesRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entities []PbmServerObjectRef `xml:"entities"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Array of server object references.
+ Entities []PbmServerObjectRef `xml:"entities" json:"entities"`
}
func init() {
@@ -1407,7 +2397,7 @@ func init() {
}
type PbmQueryAssociatedProfilesResponse struct {
- Returnval []PbmQueryProfileResult `xml:"returnval,omitempty"`
+ Returnval []PbmQueryProfileResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryByRollupComplianceStatus PbmQueryByRollupComplianceStatusRequestType
@@ -1416,9 +2406,11 @@ func init() {
types.Add("pbm:PbmQueryByRollupComplianceStatus", reflect.TypeOf((*PbmQueryByRollupComplianceStatus)(nil)).Elem())
}
+// The parameters of `PbmComplianceManager.PbmQueryByRollupComplianceStatus`.
type PbmQueryByRollupComplianceStatusRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Status string `xml:"status"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // `PbmComplianceStatus_enum`
+ Status string `xml:"status" json:"status"`
}
func init() {
@@ -1426,7 +2418,7 @@ func init() {
}
type PbmQueryByRollupComplianceStatusResponse struct {
- Returnval []PbmServerObjectRef `xml:"returnval,omitempty"`
+ Returnval []PbmServerObjectRef `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryDefaultRequirementProfile PbmQueryDefaultRequirementProfileRequestType
@@ -1435,9 +2427,11 @@ func init() {
types.Add("pbm:PbmQueryDefaultRequirementProfile", reflect.TypeOf((*PbmQueryDefaultRequirementProfile)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryDefaultRequirementProfile`.
type PbmQueryDefaultRequirementProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Hub PbmPlacementHub `xml:"hub"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Placement hub (i.e. datastore).
+ Hub PbmPlacementHub `xml:"hub" json:"hub"`
}
func init() {
@@ -1445,7 +2439,7 @@ func init() {
}
type PbmQueryDefaultRequirementProfileResponse struct {
- Returnval *PbmProfileId `xml:"returnval,omitempty"`
+ Returnval *PbmProfileId `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryDefaultRequirementProfiles PbmQueryDefaultRequirementProfilesRequestType
@@ -1454,9 +2448,13 @@ func init() {
types.Add("pbm:PbmQueryDefaultRequirementProfiles", reflect.TypeOf((*PbmQueryDefaultRequirementProfiles)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryDefaultRequirementProfiles`.
type PbmQueryDefaultRequirementProfilesRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Datastores []PbmPlacementHub `xml:"datastores"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // The datastores for which the default profiles are requested. For
+ // legacy datastores we set
+ // `DefaultProfileInfo.defaultProfile` to `null`.
+ Datastores []PbmPlacementHub `xml:"datastores" json:"datastores"`
}
func init() {
@@ -1464,7 +2462,7 @@ func init() {
}
type PbmQueryDefaultRequirementProfilesResponse struct {
- Returnval []PbmDefaultProfileInfo `xml:"returnval"`
+ Returnval []PbmDefaultProfileInfo `xml:"returnval" json:"returnval"`
}
type PbmQueryMatchingHub PbmQueryMatchingHubRequestType
@@ -1473,10 +2471,15 @@ func init() {
types.Add("pbm:PbmQueryMatchingHub", reflect.TypeOf((*PbmQueryMatchingHub)(nil)).Elem())
}
+// The parameters of `PbmPlacementSolver.PbmQueryMatchingHub`.
type PbmQueryMatchingHubRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"`
- Profile PbmProfileId `xml:"profile"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Candidate list of hubs, either datastores or storage pods or a
+ // mix. If this parameter is not specified, the Server uses all
+ // of the datastores and storage pods.
+ HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty" json:"hubsToSearch,omitempty"`
+ // Storage requirement profile.
+ Profile PbmProfileId `xml:"profile" json:"profile"`
}
func init() {
@@ -1484,7 +2487,7 @@ func init() {
}
type PbmQueryMatchingHubResponse struct {
- Returnval []PbmPlacementHub `xml:"returnval,omitempty"`
+ Returnval []PbmPlacementHub `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryMatchingHubWithSpec PbmQueryMatchingHubWithSpecRequestType
@@ -1493,10 +2496,15 @@ func init() {
types.Add("pbm:PbmQueryMatchingHubWithSpec", reflect.TypeOf((*PbmQueryMatchingHubWithSpec)(nil)).Elem())
}
+// The parameters of `PbmPlacementSolver.PbmQueryMatchingHubWithSpec`.
type PbmQueryMatchingHubWithSpecRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty"`
- CreateSpec PbmCapabilityProfileCreateSpec `xml:"createSpec"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Candidate list of hubs, either datastores or storage
+ // pods or a mix. If this parameter is not specified, the Server uses
+ // all of the datastores and storage pods for placement compatibility checking.
+ HubsToSearch []PbmPlacementHub `xml:"hubsToSearch,omitempty" json:"hubsToSearch,omitempty"`
+ // Storage profile creation specification.
+ CreateSpec PbmCapabilityProfileCreateSpec `xml:"createSpec" json:"createSpec"`
}
func init() {
@@ -1504,7 +2512,7 @@ func init() {
}
type PbmQueryMatchingHubWithSpecResponse struct {
- Returnval []PbmPlacementHub `xml:"returnval,omitempty"`
+ Returnval []PbmPlacementHub `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQueryProfile PbmQueryProfileRequestType
@@ -1513,10 +2521,16 @@ func init() {
types.Add("pbm:PbmQueryProfile", reflect.TypeOf((*PbmQueryProfile)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQueryProfile`.
type PbmQueryProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- ResourceType PbmProfileResourceType `xml:"resourceType"`
- ProfileCategory string `xml:"profileCategory,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Type of resource. You can specify only STORAGE.
+ ResourceType PbmProfileResourceType `xml:"resourceType" json:"resourceType"`
+ // Profile category. The string value must correspond
+ // to one of the `PbmProfileCategoryEnum_enum` values.
+ // If you do not specify a profile category, the method returns profiles in all
+ // categories.
+ ProfileCategory string `xml:"profileCategory,omitempty" json:"profileCategory,omitempty"`
}
func init() {
@@ -1524,27 +2538,48 @@ func init() {
}
type PbmQueryProfileResponse struct {
- Returnval []PbmProfileId `xml:"returnval,omitempty"`
+ Returnval []PbmProfileId `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
+// The `PbmQueryProfileResult` data object
+// identifies a virtual machine, virtual disk, or datastore
+// and it lists the identifier(s) for the associated profile(s).
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmQueryProfileResult struct {
types.DynamicData
- Object PbmServerObjectRef `xml:"object"`
- ProfileId []PbmProfileId `xml:"profileId,omitempty"`
- Fault *types.LocalizedMethodFault `xml:"fault,omitempty"`
+ // Reference to the virtual machine, virtual disk, or
+ // datastore on which the query was performed.
+ Object PbmServerObjectRef `xml:"object" json:"object"`
+ // Array of identifiers for profiles which are associated with object.
+ ProfileId []PbmProfileId `xml:"profileId,omitempty" json:"profileId,omitempty"`
+ // Fault associated with the query, if there is one.
+ Fault *types.LocalizedMethodFault `xml:"fault,omitempty" json:"fault,omitempty"`
}
func init() {
types.Add("pbm:PbmQueryProfileResult", reflect.TypeOf((*PbmQueryProfileResult)(nil)).Elem())
}
+// The `PbmQueryReplicationGroupResult` data object
+// identifies a virtual machine, or a virtual disk and lists the identifier(s) for the associated
+// replication group.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmQueryReplicationGroupResult struct {
types.DynamicData
- Object PbmServerObjectRef `xml:"object"`
- ReplicationGroupId *types.ReplicationGroupId `xml:"replicationGroupId,omitempty"`
- Fault *types.LocalizedMethodFault `xml:"fault,omitempty"`
+ // Reference to the virtual machine or virtual disk on which the query was performed.
+ //
+ // If the
+ // query was performed for a virtual machine and all it's disks, this will reference each disk
+ // and the virtual machine config individually.
+ Object PbmServerObjectRef `xml:"object" json:"object"`
+ // Replication group identifier which is associated with object.
+ ReplicationGroupId *types.ReplicationGroupId `xml:"replicationGroupId,omitempty" json:"replicationGroupId,omitempty"`
+ // Fault associated with the query, if there is one.
+ Fault *types.LocalizedMethodFault `xml:"fault,omitempty" json:"fault,omitempty"`
}
func init() {
@@ -1557,9 +2592,15 @@ func init() {
types.Add("pbm:PbmQueryReplicationGroups", reflect.TypeOf((*PbmQueryReplicationGroups)(nil)).Elem())
}
+// The parameters of `PbmReplicationManager.PbmQueryReplicationGroups`.
type PbmQueryReplicationGroupsRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Entities []PbmServerObjectRef `xml:"entities,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Array of server object references. Valid types are
+ // `virtualMachine`,
+ // `virtualMachineAndDisks`,
+ // `virtualDiskId`,
+ // `virtualDiskUUID`
+ Entities []PbmServerObjectRef `xml:"entities,omitempty" json:"entities,omitempty"`
}
func init() {
@@ -1567,7 +2608,7 @@ func init() {
}
type PbmQueryReplicationGroupsResponse struct {
- Returnval []PbmQueryReplicationGroupResult `xml:"returnval,omitempty"`
+ Returnval []PbmQueryReplicationGroupResult `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmQuerySpaceStatsForStorageContainer PbmQuerySpaceStatsForStorageContainerRequestType
@@ -1576,10 +2617,15 @@ func init() {
types.Add("pbm:PbmQuerySpaceStatsForStorageContainer", reflect.TypeOf((*PbmQuerySpaceStatsForStorageContainer)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmQuerySpaceStatsForStorageContainer`.
type PbmQuerySpaceStatsForStorageContainerRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Datastore PbmServerObjectRef `xml:"datastore"`
- CapabilityProfileId []PbmProfileId `xml:"capabilityProfileId,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Entity for which space statistics are being requested i.e datastore.
+ Datastore PbmServerObjectRef `xml:"datastore" json:"datastore"`
+ // \- capability profile Ids.
+ // If omitted, the statistics for the container
+ // as a whole would be returned.
+ CapabilityProfileId []PbmProfileId `xml:"capabilityProfileId,omitempty" json:"capabilityProfileId,omitempty"`
}
func init() {
@@ -1587,7 +2633,7 @@ func init() {
}
type PbmQuerySpaceStatsForStorageContainerResponse struct {
- Returnval []PbmDatastoreSpaceStatistics `xml:"returnval,omitempty"`
+ Returnval []PbmDatastoreSpaceStatistics `xml:"returnval,omitempty" json:"returnval,omitempty"`
}
type PbmResetDefaultRequirementProfile PbmResetDefaultRequirementProfileRequestType
@@ -1596,9 +2642,11 @@ func init() {
types.Add("pbm:PbmResetDefaultRequirementProfile", reflect.TypeOf((*PbmResetDefaultRequirementProfile)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmResetDefaultRequirementProfile`.
type PbmResetDefaultRequirementProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- Profile *PbmProfileId `xml:"profile,omitempty"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Profile to reset.
+ Profile *PbmProfileId `xml:"profile,omitempty" json:"profile,omitempty"`
}
func init() {
@@ -1615,7 +2663,7 @@ func init() {
}
type PbmResetVSanDefaultProfileRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
}
func init() {
@@ -1625,11 +2673,20 @@ func init() {
type PbmResetVSanDefaultProfileResponse struct {
}
+// A ResourceInUse fault indicating that some error has occurred because a
+// resource was in use.
+//
+// Information about the resource that is in use may
+// be supplied.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmResourceInUse struct {
PbmFault
- Type string `xml:"type,omitempty"`
- Name string `xml:"name,omitempty"`
+ // Type of resource that is in use.
+ Type string `xml:"type,omitempty" json:"type,omitempty"`
+ // Name of the instance of the resource that is in use.
+ Name string `xml:"name,omitempty" json:"name,omitempty"`
}
func init() {
@@ -1648,9 +2705,11 @@ func init() {
types.Add("pbm:PbmRetrieveContent", reflect.TypeOf((*PbmRetrieveContent)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmRetrieveContent`.
type PbmRetrieveContentRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- ProfileIds []PbmProfileId `xml:"profileIds"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Array of storage profile identifiers.
+ ProfileIds []PbmProfileId `xml:"profileIds" json:"profileIds"`
}
func init() {
@@ -1658,7 +2717,7 @@ func init() {
}
type PbmRetrieveContentResponse struct {
- Returnval []BasePbmProfile `xml:"returnval,typeattr"`
+ Returnval []BasePbmProfile `xml:"returnval,typeattr" json:"returnval"`
}
type PbmRetrieveServiceContent PbmRetrieveServiceContentRequestType
@@ -1668,7 +2727,7 @@ func init() {
}
type PbmRetrieveServiceContentRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
}
func init() {
@@ -1676,47 +2735,154 @@ func init() {
}
type PbmRetrieveServiceContentResponse struct {
- Returnval PbmServiceInstanceContent `xml:"returnval"`
+ Returnval PbmServiceInstanceContent `xml:"returnval" json:"returnval"`
}
+// The `PbmRollupComplianceResult` data object identifies the virtual machine
+// for which rollup compliance was checked, and it contains the overall status
+// and a list of compliance result objects.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmRollupComplianceResult struct {
types.DynamicData
- OldestCheckTime time.Time `xml:"oldestCheckTime"`
- Entity PbmServerObjectRef `xml:"entity"`
- OverallComplianceStatus string `xml:"overallComplianceStatus"`
- OverallComplianceTaskStatus string `xml:"overallComplianceTaskStatus,omitempty"`
- Result []PbmComplianceResult `xml:"result,omitempty"`
- ErrorCause []types.LocalizedMethodFault `xml:"errorCause,omitempty"`
- ProfileMismatch bool `xml:"profileMismatch"`
+ // Indicates the earliest time that compliance was checked for any
+ // of the entities in the rollup compliance check.
+ //
+ // The compliance
+ // check time for a single entity is represented in the
+ // `PbmComplianceResult*.*PbmComplianceResult.checkTime`
+ // property. If the `PbmComplianceResult.checkTime`
+ // property is unset for any of the objects in the results
+ // array, the oldestCheckTime property will be unset.
+ OldestCheckTime time.Time `xml:"oldestCheckTime" json:"oldestCheckTime"`
+ // Virtual machine for which the rollup compliance was checked.
+ Entity PbmServerObjectRef `xml:"entity" json:"entity"`
+ // Overall compliance status of the virtual machine and its virtual disks.
+ //
+ // overallComplianceStatus is a string value that
+ // corresponds to one of the
+ // `PbmComplianceResult*.*PbmComplianceResult.complianceStatus`
+ // values.
+ //
+ // The overall compliance status is determined by the following rules, applied in the order
+ // listed:
+ // - If all the entities are compliant, the overall status is
+ // compliant.
+ // - Else if any entity's status is outOfDate, the overall status is
+ // outOfDate.
+ // - Else if any entity's status is nonCompliant, the overall status is
+ // nonCompliant.
+ // - Else if any entity's status is unknown, the overall status is
+ // unknown.
+ // - Else if any entity's status is notApplicable, the overall status is
+ // notApplicable.
+ OverallComplianceStatus string `xml:"overallComplianceStatus" json:"overallComplianceStatus"`
+ // Overall compliance task status of the virtual machine and its virtual
+ // disks.
+ //
+ // overallComplianceTaskStatus is a string value that
+ // corresponds to one of the `PbmComplianceResult`.
+ // `PbmComplianceResult.complianceTaskStatus` values.
+ OverallComplianceTaskStatus string `xml:"overallComplianceTaskStatus,omitempty" json:"overallComplianceTaskStatus,omitempty"`
+ // Individual compliance results that make up the rollup.
+ Result []PbmComplianceResult `xml:"result,omitempty" json:"result,omitempty"`
+ // This property is set if the overall compliance task fails with some error.
+ //
+ // This
+ // property indicates the causes of error. If there are multiple failures, it stores
+ // these failure in this array.
+ ErrorCause []types.LocalizedMethodFault `xml:"errorCause,omitempty" json:"errorCause,omitempty"`
+ // Deprecated as of vSphere 2016, use
+ // `PbmRollupComplianceResult.overallComplianceStatus`
+ // to know if profile mismatch has occurred. If
+ // overallComplianceStatus value is outOfDate, it means
+ // profileMismatch has occurred.
+ //
+ // True if and only if `PbmComplianceResult`.
+ //
+ // `PbmComplianceResult.mismatch` is true for at least one
+ // entity in the rollup compliance check.
+ ProfileMismatch bool `xml:"profileMismatch" json:"profileMismatch"`
}
func init() {
types.Add("pbm:PbmRollupComplianceResult", reflect.TypeOf((*PbmRollupComplianceResult)(nil)).Elem())
}
+// The `PbmServerObjectRef` data object identifies
+// a virtual machine,
+// virtual disk attached to a virtual machine,
+// a first class storage object
+// or a datastore.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmServerObjectRef struct {
types.DynamicData
- ObjectType string `xml:"objectType"`
- Key string `xml:"key"`
- ServerUuid string `xml:"serverUuid,omitempty"`
+ // Type of vSphere Server object.
+ //
+ // The value of the objectType string
+ // corresponds to one of the `PbmObjectType_enum`
+ // enumerated type values.
+ ObjectType string `xml:"objectType" json:"objectType"`
+ // Unique identifier for the object.
+ //
+ // The value of key depends
+ // on the objectType.
+ //
+ //
+ // | `*PbmObjectType** | *`key value** |
| virtualMachine | _virtual-machine-MOR_ |
| virtualDiskId | + //_virtual-disk-MOR_:_VirtualDisk.key_ |
| datastore | _datastore-MOR_ |
| MOR = ManagedObjectReference | |
ServiceContent.about.instanceUuid
+ // property in the vSphere API.
+ ServerUuid string `xml:"serverUuid,omitempty" json:"serverUuid,omitempty"`
}
func init() {
types.Add("pbm:PbmServerObjectRef", reflect.TypeOf((*PbmServerObjectRef)(nil)).Elem())
}
+// The `PbmServiceInstanceContent` data object defines properties for the
+// `PbmServiceInstance` managed object.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmServiceInstanceContent struct {
types.DynamicData
- AboutInfo PbmAboutInfo `xml:"aboutInfo"`
- SessionManager types.ManagedObjectReference `xml:"sessionManager"`
- CapabilityMetadataManager types.ManagedObjectReference `xml:"capabilityMetadataManager"`
- ProfileManager types.ManagedObjectReference `xml:"profileManager"`
- ComplianceManager types.ManagedObjectReference `xml:"complianceManager"`
- PlacementSolver types.ManagedObjectReference `xml:"placementSolver"`
- ReplicationManager *types.ManagedObjectReference `xml:"replicationManager,omitempty"`
+ // Contains information that identifies the Storage Policy service.
+ AboutInfo PbmAboutInfo `xml:"aboutInfo" json:"aboutInfo"`
+ // For internal use.
+ //
+ // Refers instance of `PbmSessionManager`.
+ SessionManager types.ManagedObjectReference `xml:"sessionManager" json:"sessionManager"`
+ // For internal use.
+ //
+ // Refers instance of `PbmCapabilityMetadataManager`.
+ CapabilityMetadataManager types.ManagedObjectReference `xml:"capabilityMetadataManager" json:"capabilityMetadataManager"`
+ // Provides access to the Storage Policy ProfileManager.
+ //
+ // Refers instance of `PbmProfileProfileManager`.
+ ProfileManager types.ManagedObjectReference `xml:"profileManager" json:"profileManager"`
+ // Provides access to the Storage Policy ComplianceManager.
+ //
+ // Refers instance of `PbmComplianceManager`.
+ ComplianceManager types.ManagedObjectReference `xml:"complianceManager" json:"complianceManager"`
+ // Provides access to the Storage Policy PlacementSolver.
+ //
+ // Refers instance of `PbmPlacementSolver`.
+ PlacementSolver types.ManagedObjectReference `xml:"placementSolver" json:"placementSolver"`
+ // Provides access to the Storage Policy ReplicationManager.
+ //
+ // Refers instance of `PbmReplicationManager`.
+ ReplicationManager *types.ManagedObjectReference `xml:"replicationManager,omitempty" json:"replicationManager,omitempty"`
}
func init() {
@@ -1729,10 +2895,13 @@ func init() {
types.Add("pbm:PbmUpdate", reflect.TypeOf((*PbmUpdate)(nil)).Elem())
}
+// The parameters of `PbmProfileProfileManager.PbmUpdate`.
type PbmUpdateRequestType struct {
- This types.ManagedObjectReference `xml:"_this"`
- ProfileId PbmProfileId `xml:"profileId"`
- UpdateSpec PbmCapabilityProfileUpdateSpec `xml:"updateSpec"`
+ This types.ManagedObjectReference `xml:"_this" json:"_this"`
+ // Profile identifier.
+ ProfileId PbmProfileId `xml:"profileId" json:"profileId"`
+ // Capability-based update specification.
+ UpdateSpec PbmCapabilityProfileUpdateSpec `xml:"updateSpec" json:"updateSpec"`
}
func init() {
@@ -1742,6 +2911,10 @@ func init() {
type PbmUpdateResponse struct {
}
+// Information about a supported data service provided using
+// vSphere APIs for IO Filtering (VAIO) data service provider.
+//
+// This structure may be used only with operations rendered under `/pbm`.
type PbmVaioDataServiceInfo struct {
PbmLineOfServiceInfo
}
diff --git a/vendor/github.com/vmware/govmomi/property/collector.go b/vendor/github.com/vmware/govmomi/property/collector.go
index 8798ceacbf..16bf222669 100644
--- a/vendor/github.com/vmware/govmomi/property/collector.go
+++ b/vendor/github.com/vmware/govmomi/property/collector.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2015 VMware, Inc. All Rights Reserved.
+Copyright (c) 2015-2023 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
+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,
@@ -31,7 +31,6 @@ import (
//
// For more information, see:
// http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvmodl.query.PropertyCollector.html
-//
type Collector struct {
roundTripper soap.RoundTripper
reference types.ManagedObjectReference
diff --git a/vendor/github.com/vmware/govmomi/session/cache/session.go b/vendor/github.com/vmware/govmomi/session/cache/session.go
new file mode 100644
index 0000000000..c6c3955c17
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/session/cache/session.go
@@ -0,0 +1,365 @@
+/*
+Copyright (c) 2020 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 cache
+
+import (
+ "context"
+ "crypto/sha1"
+ "encoding/json"
+ "fmt"
+ "net/url"
+ "os"
+ "os/user"
+ "path/filepath"
+
+ "github.com/vmware/govmomi/session"
+ "github.com/vmware/govmomi/vapi/rest"
+ "github.com/vmware/govmomi/vim25"
+ "github.com/vmware/govmomi/vim25/soap"
+ "github.com/vmware/govmomi/vim25/types"
+)
+
+// Client interface to support client session caching
+type Client interface {
+ json.Marshaler
+ json.Unmarshaler
+
+ Valid() bool
+ Path() string
+}
+
+// Session provides methods to cache authenticated vim25.Client and rest.Client sessions.
+// Use of session cache avoids the expense of creating and deleting vSphere sessions.
+// It also helps avoid the problem of "leaking sessions", as Session.Login will only
+// create a new authenticated session if the cached session does not exist or is invalid.
+// By default, username/password authentication is used to create new sessions.
+// The Session.Login{SOAP,REST} fields can be set to use other methods,
+// such as SAML token authentication (see govc session.login for example).
+//
+// When Reauth is set to true, Login skips loading file cache and performs username/password
+// authentication, which is helpful in the case that the password in URL is different than
+// previously cached session. Comparing to `Passthrough`, the file cache will be updated after
+// authentication is done.
+type Session struct {
+ URL *url.URL // URL of a vCenter or ESXi instance
+ DirSOAP string // DirSOAP cache directory. Defaults to "$HOME/.govmomi/sessions"
+ DirREST string // DirREST cache directory. Defaults to "$HOME/.govmomi/rest_sessions"
+ Insecure bool // Insecure param for soap.NewClient (tls.Config.InsecureSkipVerify)
+ Passthrough bool // Passthrough disables caching when set to true
+ Reauth bool // Reauth skips loading of cached sessions when set to true
+
+ LoginSOAP func(context.Context, *vim25.Client) error // LoginSOAP defaults to session.Manager.Login()
+ LoginREST func(context.Context, *rest.Client) error // LoginREST defaults to rest.Client.Login()
+}
+
+var (
+ home = os.Getenv("GOVMOMI_HOME")
+)
+
+func init() {
+ if home == "" {
+ dir, err := os.UserHomeDir()
+ if err != nil {
+ dir = os.Getenv("HOME")
+ }
+ home = filepath.Join(dir, ".govmomi")
+ }
+}
+
+// Endpoint returns a copy of the Session.URL with Password, Query and Fragment removed.
+func (s *Session) Endpoint() *url.URL {
+ if s.URL == nil {
+ return nil
+ }
+ p := &url.URL{
+ Scheme: s.URL.Scheme,
+ Host: s.URL.Host,
+ Path: s.URL.Path,
+ }
+ if u := s.URL.User; u != nil {
+ p.User = url.User(u.Username()) // Remove password
+ }
+ return p
+}
+
+// key is a digest of the URL scheme + username + host + Client.Path()
+func (s *Session) key(path string) string {
+ p := s.Endpoint()
+ p.Path = path
+
+ // Key session file off of full URI and insecure setting.
+ // Hash key to get a predictable, canonical format.
+ key := fmt.Sprintf("%s#insecure=%t", p.String(), s.Insecure)
+ return fmt.Sprintf("%040x", sha1.Sum([]byte(key)))
+}
+
+func (s *Session) file(p string) string {
+ dir := ""
+
+ switch p {
+ case rest.Path:
+ dir = s.DirREST
+ if dir == "" {
+ dir = filepath.Join(home, "rest_sessions")
+ }
+ default:
+ dir = s.DirSOAP
+ if dir == "" {
+ dir = filepath.Join(home, "sessions")
+ }
+ }
+
+ return filepath.Join(dir, s.key(p))
+}
+
+// Save a Client in the file cache.
+// Session will not be saved if Session.Passthrough is true.
+func (s *Session) Save(c Client) error {
+ if s.Passthrough {
+ return nil
+ }
+
+ p := s.file(c.Path())
+
+ err := os.MkdirAll(filepath.Dir(p), 0700)
+ if err != nil {
+ return err
+ }
+
+ f, err := os.OpenFile(p, os.O_CREATE|os.O_WRONLY, 0600)
+ if err != nil {
+ return err
+ }
+
+ err = json.NewEncoder(f).Encode(c)
+ if err != nil {
+ _ = f.Close()
+ return err
+ }
+
+ return f.Close()
+}
+
+func (s *Session) get(c Client) (bool, error) {
+ f, err := os.Open(s.file(c.Path()))
+ if err != nil {
+ if os.IsNotExist(err) {
+ return false, nil
+ }
+
+ return false, err
+ }
+
+ dec := json.NewDecoder(f)
+ err = dec.Decode(c)
+ if err != nil {
+ _ = f.Close()
+ return false, err
+ }
+
+ return c.Valid(), f.Close()
+}
+
+func localTicket(ctx context.Context, m *session.Manager) (*url.Userinfo, error) {
+ name := os.Getenv("USER")
+ u, err := user.Current()
+ if err == nil {
+ name = u.Username
+ }
+
+ ticket, err := m.AcquireLocalTicket(ctx, name)
+ if err != nil {
+ return nil, err
+ }
+
+ password, err := os.ReadFile(ticket.PasswordFilePath)
+ if err != nil {
+ return nil, err
+ }
+
+ return url.UserPassword(ticket.UserName, string(password)), nil
+}
+
+func (s *Session) loginSOAP(ctx context.Context, c *vim25.Client) error {
+ m := session.NewManager(c)
+ u := s.URL.User
+ name := u.Username()
+
+ if name == "" && !c.IsVC() {
+ // If no username is provided, try to acquire a local ticket.
+ // When invoked remotely, ESX returns an InvalidRequestFault.
+ // So, rather than return an error here, fallthrough to Login() with the original User to
+ // to avoid what would be a confusing error message.
+ luser, lerr := localTicket(ctx, m)
+ if lerr == nil {
+ // We are running directly on an ESX or Workstation host and can use the ticket with Login()
+ u = luser
+ name = u.Username()
+ }
+ }
+ if name == "" {
+ // ServiceContent does not require authentication
+ return nil
+ }
+
+ return m.Login(ctx, u)
+}
+
+func (s *Session) loginREST(ctx context.Context, c *rest.Client) error {
+ return c.Login(ctx, s.URL.User)
+}
+
+func soapSessionValid(ctx context.Context, client *vim25.Client) (bool, error) {
+ m := session.NewManager(client)
+ u, err := m.UserSession(ctx)
+ if err != nil {
+ if soap.IsSoapFault(err) {
+ fault := soap.ToSoapFault(err).VimFault()
+ // If the PropertyCollector is not found, the saved session for this URL is not valid
+ if _, ok := fault.(types.ManagedObjectNotFound); ok {
+ return false, nil
+ }
+ }
+
+ return false, err
+ }
+
+ return u != nil, nil
+}
+
+func restSessionValid(ctx context.Context, client *rest.Client) (bool, error) {
+ s, err := client.Session(ctx)
+ if err != nil {
+ return false, err
+ }
+ return s != nil, nil
+}
+
+// Load a Client from the file cache.
+// Returns false if no cache exists or is invalid.
+// An error is returned if the file cannot be opened or is not json encoded.
+// After loading the Client from the file:
+// Returns true if the session is still valid, false otherwise indicating the client requires authentication.
+// An error is returned if the session ID cannot be validated.
+// Returns false if Session.Passthrough is true.
+func (s *Session) Load(ctx context.Context, c Client, config func(*soap.Client) error) (bool, error) {
+ if s.Passthrough || s.Reauth {
+ return false, nil
+ }
+
+ ok, err := s.get(c)
+ if err != nil {
+ return false, err
+
+ }
+ if !ok {
+ return false, nil
+ }
+
+ switch client := c.(type) {
+ case *vim25.Client:
+ if config != nil {
+ if err := config(client.Client); err != nil {
+ return false, err
+ }
+ }
+ return soapSessionValid(ctx, client)
+ case *rest.Client:
+ if config != nil {
+ if err := config(client.Client); err != nil {
+ return false, err
+ }
+ }
+ return restSessionValid(ctx, client)
+ default:
+ panic(fmt.Sprintf("unsupported client type=%T", client))
+ }
+}
+
+// Login returns a cached session via Load() if valid.
+// Otherwise, creates a new authenticated session and saves to the cache.
+// The config func can be used to apply soap.Client configuration, such as TLS settings.
+// When Session.Passthrough is true, Login will always create a new session.
+func (s *Session) Login(ctx context.Context, c Client, config func(*soap.Client) error) error {
+ ok, err := s.Load(ctx, c, config)
+ if err != nil {
+ return err
+ }
+ if ok {
+ return nil
+ }
+
+ sc := soap.NewClient(s.URL, s.Insecure)
+
+ if config != nil {
+ err = config(sc)
+ if err != nil {
+ return err
+ }
+ }
+
+ switch client := c.(type) {
+ case *vim25.Client:
+ vc, err := vim25.NewClient(ctx, sc)
+ if err != nil {
+ return err
+ }
+
+ login := s.loginSOAP
+ if s.LoginSOAP != nil {
+ login = s.LoginSOAP
+ }
+ if err = login(ctx, vc); err != nil {
+ return err
+ }
+
+ *client = *vc
+ c = client
+ case *rest.Client:
+ client.Client = sc.NewServiceClient(rest.Path, "")
+
+ login := s.loginREST
+ if s.LoginREST != nil {
+ login = s.LoginREST
+ }
+ if err = login(ctx, client); err != nil {
+ return err
+ }
+
+ c = client
+ default:
+ panic(fmt.Sprintf("unsupported client type=%T", client))
+ }
+
+ return s.Save(c)
+}
+
+// Login calls the Logout method for the given Client if Session.Passthrough is true.
+// Otherwise returns nil.
+func (s *Session) Logout(ctx context.Context, c Client) error {
+ if s.Passthrough {
+ switch client := c.(type) {
+ case *vim25.Client:
+ return session.NewManager(client).Logout(ctx)
+ case *rest.Client:
+ return client.Logout(ctx)
+ default:
+ panic(fmt.Sprintf("unsupported client type=%T", client))
+ }
+ }
+ return nil
+}
diff --git a/vendor/github.com/vmware/govmomi/session/manager.go b/vendor/github.com/vmware/govmomi/session/manager.go
index 8689acd504..e2d70a2f60 100644
--- a/vendor/github.com/vmware/govmomi/session/manager.go
+++ b/vendor/github.com/vmware/govmomi/session/manager.go
@@ -18,7 +18,6 @@ package session
import (
"context"
- "io/ioutil"
"net/url"
"os"
"strings"
@@ -47,7 +46,7 @@ func Secret(value string) (string, error) {
if len(value) == 0 {
return value, nil
}
- contents, err := ioutil.ReadFile(value)
+ contents, err := os.ReadFile(value)
if err != nil {
if os.IsPermission(err) {
return "", err
diff --git a/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go b/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go
index 12f910b2e4..cf99285369 100644
--- a/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go
+++ b/vendor/github.com/vmware/govmomi/simulator/cluster_compute_resource.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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.
@@ -66,10 +66,11 @@ func (add *addHost) Run(task *Task) (types.AnyType, types.BaseMethodFault) {
}
host := NewHostSystem(template)
- host.configure(spec, add.req.AsConnected)
+ host.configure(task.ctx, spec, add.req.AsConnected)
task.ctx.Map.PutEntity(cr, task.ctx.Map.NewEntity(host))
host.Summary.Host = &host.Self
+ host.Config.Host = host.Self
cr.Host = append(cr.Host, host.Reference())
addComputeResource(cr.Summary.GetComputeResourceSummary(), host)
@@ -85,6 +86,24 @@ func (c *ClusterComputeResource) AddHostTask(ctx *Context, add *types.AddHost_Ta
}
}
+func (c *ClusterComputeResource) update(cfg *types.ClusterConfigInfoEx, cspec *types.ClusterConfigSpecEx) types.BaseMethodFault {
+ if cspec.DasConfig != nil {
+ if val := cspec.DasConfig.Enabled; val != nil {
+ cfg.DasConfig.Enabled = val
+ }
+ if val := cspec.DasConfig.AdmissionControlEnabled; val != nil {
+ cfg.DasConfig.AdmissionControlEnabled = val
+ }
+ }
+ if cspec.DrsConfig != nil {
+ if val := cspec.DrsConfig.Enabled; val != nil {
+ cfg.DrsConfig.Enabled = val
+ }
+ }
+
+ return nil
+}
+
func (c *ClusterComputeResource) updateRules(cfg *types.ClusterConfigInfoEx, cspec *types.ClusterConfigSpecEx) types.BaseMethodFault {
for _, spec := range cspec.RulesSpec {
var i int
@@ -327,6 +346,7 @@ func (c *ClusterComputeResource) ReconfigureComputeResourceTask(ctx *Context, re
}
updates := []func(*types.ClusterConfigInfoEx, *types.ClusterConfigSpecEx) types.BaseMethodFault{
+ c.update,
c.updateRules,
c.updateGroups,
c.updateOverridesDAS,
@@ -350,6 +370,40 @@ func (c *ClusterComputeResource) ReconfigureComputeResourceTask(ctx *Context, re
}
}
+func (c *ClusterComputeResource) MoveIntoTask(ctx *Context, req *types.MoveInto_Task) soap.HasFault {
+ task := CreateTask(c, "moveInto", func(*Task) (types.AnyType, types.BaseMethodFault) {
+ for _, ref := range req.Host {
+ host := ctx.Map.Get(ref).(*HostSystem)
+
+ if *host.Parent == c.Self {
+ return nil, new(types.DuplicateName) // host already in this cluster
+ }
+
+ switch parent := ctx.Map.Get(*host.Parent).(type) {
+ case *ClusterComputeResource:
+ if !host.Runtime.InMaintenanceMode {
+ return nil, new(types.InvalidState)
+ }
+
+ RemoveReference(&parent.Host, ref)
+ case *mo.ComputeResource:
+ ctx.Map.Remove(ctx, parent.Self)
+ }
+
+ c.Host = append(c.Host, ref)
+ host.Parent = &c.Self
+ }
+
+ return nil, nil
+ })
+
+ return &methods.MoveInto_TaskBody{
+ Res: &types.MoveInto_TaskResponse{
+ Returnval: task.Run(ctx),
+ },
+ }
+}
+
func (c *ClusterComputeResource) PlaceVm(ctx *Context, req *types.PlaceVm) soap.HasFault {
body := new(methods.PlaceVmBody)
diff --git a/vendor/github.com/vmware/govmomi/simulator/container.go b/vendor/github.com/vmware/govmomi/simulator/container.go
index 96f4fd10cc..f39ef99702 100644
--- a/vendor/github.com/vmware/govmomi/simulator/container.go
+++ b/vendor/github.com/vmware/govmomi/simulator/container.go
@@ -18,29 +18,32 @@ package simulator
import (
"archive/tar"
+ "bufio"
"bytes"
- "encoding/hex"
+ "context"
"encoding/json"
+ "errors"
"fmt"
"io"
"log"
- "net/http"
+ "net"
"os"
"os/exec"
"path"
"regexp"
- "strconv"
"strings"
+ "sync"
"time"
-
- "github.com/google/uuid"
-
- "github.com/vmware/govmomi/vim25/methods"
- "github.com/vmware/govmomi/vim25/types"
)
var (
- shell = "/bin/sh"
+ shell = "/bin/sh"
+ eventWatch eventWatcher
+)
+
+const (
+ deleteWithContainer = "lifecycle=container"
+ createdByVcsim = "createdBy=vcsim"
)
func init() {
@@ -49,10 +52,26 @@ func init() {
}
}
+type eventWatcher struct {
+ sync.Mutex
+
+ stdin io.WriteCloser
+ stdout io.ReadCloser
+ process *os.Process
+
+ // watches is a map of container IDs to container objects
+ watches map[string]*container
+}
+
// container provides methods to manage a container within a simulator VM lifecycle.
type container struct {
+ sync.Mutex
+
id string
name string
+
+ cancelWatch context.CancelFunc
+ changes chan struct{}
}
type networkSettings struct {
@@ -62,524 +81,753 @@ type networkSettings struct {
MacAddress string
}
-// inspect applies container network settings to vm.Guest properties.
-func (c *container) inspect(vm *VirtualMachine) error {
- if c.id == "" {
- return nil
+type containerDetails struct {
+ State struct {
+ Running bool
+ Paused bool
}
+ NetworkSettings struct {
+ networkSettings
+ Networks map[string]networkSettings
+ }
+}
- var objects []struct {
- State struct {
- Running bool
- Paused bool
- }
- NetworkSettings struct {
- networkSettings
- Networks map[string]networkSettings
- }
+type unknownContainer error
+type uninitializedContainer error
+
+var sanitizeNameRx = regexp.MustCompile(`[\(\)\s]`)
+
+func sanitizeName(name string) string {
+ return sanitizeNameRx.ReplaceAllString(name, "-")
+}
+
+func constructContainerName(name, uid string) string {
+ return fmt.Sprintf("vcsim-%s-%s", sanitizeName(name), uid)
+}
+
+func constructVolumeName(containerName, uid, volumeName string) string {
+ return constructContainerName(containerName, uid) + "--" + sanitizeName(volumeName)
+}
+
+func extractNameAndUid(containerName string) (name string, uid string, err error) {
+ parts := strings.Split(strings.TrimPrefix(containerName, "vcsim-"), "-")
+ if len(parts) != 2 {
+ err = fmt.Errorf("container name does not match expected vcsim-name-uid format: %s", containerName)
+ return
}
- cmd := exec.Command("docker", "inspect", c.id)
- out, err := cmd.Output()
+ return parts[0], parts[1], nil
+}
+
+func prefixToMask(prefix int) string {
+ mask := net.CIDRMask(prefix, 32)
+ return fmt.Sprintf("%d.%d.%d.%d", mask[0], mask[1], mask[2], mask[3])
+}
+
+type tarEntry struct {
+ header *tar.Header
+ content []byte
+}
+
+// From https://docs.docker.com/engine/reference/commandline/cp/ :
+// > It is not possible to copy certain system files such as resources under /proc, /sys, /dev, tmpfs, and mounts created by the user in the container.
+// > However, you can still copy such files by manually running tar in docker exec.
+func copyToGuest(id string, dest string, length int64, reader io.Reader) error {
+ cmd := exec.Command("docker", "exec", "-i", id, "tar", "Cxf", path.Dir(dest), "-")
+ cmd.Stderr = os.Stderr
+ stdin, err := cmd.StdinPipe()
if err != nil {
return err
}
- if err = json.NewDecoder(bytes.NewReader(out)).Decode(&objects); err != nil {
+
+ err = cmd.Start()
+ if err != nil {
return err
}
- vm.Config.Annotation = strings.Join(cmd.Args, " ")
- vm.logPrintf("%s: %s", vm.Config.Annotation, string(out))
-
- for _, o := range objects {
- s := o.NetworkSettings.networkSettings
+ tw := tar.NewWriter(stdin)
+ _ = tw.WriteHeader(&tar.Header{
+ Name: path.Base(dest),
+ Size: length,
+ Mode: 0444,
+ ModTime: time.Now(),
+ })
- for _, n := range o.NetworkSettings.Networks {
- s = n
- break
- }
+ _, err = io.Copy(tw, reader)
- if o.State.Paused {
- vm.Runtime.PowerState = types.VirtualMachinePowerStateSuspended
- } else if o.State.Running {
- vm.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOn
- } else {
- vm.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOff
- }
+ twErr := tw.Close()
+ stdinErr := stdin.Close()
- vm.Guest.IpAddress = s.IPAddress
- vm.Summary.Guest.IpAddress = s.IPAddress
-
- if len(vm.Guest.Net) != 0 {
- net := &vm.Guest.Net[0]
- net.IpAddress = []string{s.IPAddress}
- net.MacAddress = s.MacAddress
- net.IpConfig = &types.NetIpConfigInfo{
- IpAddress: []types.NetIpConfigInfoIpAddress{{
- IpAddress: s.IPAddress,
- PrefixLength: int32(s.IPPrefixLen),
- State: string(types.NetIpConfigInfoIpAddressStatusPreferred),
- }},
- }
- }
+ waitErr := cmd.Wait()
- for _, d := range vm.Config.Hardware.Device {
- if eth, ok := d.(types.BaseVirtualEthernetCard); ok {
- eth.GetVirtualEthernetCard().MacAddress = s.MacAddress
- break
- }
- }
+ if err != nil || twErr != nil || stdinErr != nil || waitErr != nil {
+ return fmt.Errorf("copy: {%s}, tw: {%s}, stdin: {%s}, wait: {%s}", err, twErr, stdinErr, waitErr)
}
return nil
}
-func (c *container) prepareGuestOperation(
- vm *VirtualMachine,
- auth types.BaseGuestAuthentication) types.BaseMethodFault {
-
- if c.id == "" {
- return new(types.GuestOperationsUnavailable)
+func copyFromGuest(id string, src string, sink func(int64, io.Reader) error) error {
+ cmd := exec.Command("docker", "exec", id, "tar", "Ccf", path.Dir(src), "-", path.Base(src))
+ cmd.Stderr = os.Stderr
+ stdout, err := cmd.StdoutPipe()
+ if err != nil {
+ return err
}
- if vm.Runtime.PowerState != types.VirtualMachinePowerStatePoweredOn {
- return &types.InvalidPowerState{
- RequestedState: types.VirtualMachinePowerStatePoweredOn,
- ExistingState: vm.Runtime.PowerState,
- }
+ if err = cmd.Start(); err != nil {
+ return err
}
- switch creds := auth.(type) {
- case *types.NamePasswordAuthentication:
- if creds.Username == "" || creds.Password == "" {
- return new(types.InvalidGuestLogin)
- }
- default:
- return new(types.InvalidGuestLogin)
+
+ tr := tar.NewReader(stdout)
+ header, err := tr.Next()
+ if err != nil {
+ return err
}
- return nil
-}
-var sanitizeNameRx = regexp.MustCompile(`[\(\)\s]`)
+ err = sink(header.Size, tr)
+ waitErr := cmd.Wait()
-func sanitizeName(name string) string {
- return sanitizeNameRx.ReplaceAllString(name, "-")
+ if err != nil || waitErr != nil {
+ return fmt.Errorf("err: {%s}, wait: {%s}", err, waitErr)
+ }
+
+ return nil
}
-// createDMI writes BIOS UUID DMI files to a container volume
-func (c *container) createDMI(vm *VirtualMachine, name string) error {
+// createVolume creates a volume populated with the provided files
+// If the header.Size is omitted or set to zero, then len(content+1) is used.
+// Docker appears to treat this volume create command as idempotent so long as it's identical
+// to an existing volume, so we can use this both for creating volumes inline in container create (for labelling) and
+// for population after.
+// returns:
+//
+// uid - string
+// err - error or nil
+func createVolume(volumeName string, labels []string, files []tarEntry) (string, error) {
image := os.Getenv("VCSIM_BUSYBOX")
if image == "" {
image = "busybox"
}
- cmd := exec.Command("docker", "run", "--rm", "-i", "-v", name+":"+"/"+name, image, "tar", "-C", "/"+name, "-xf", "-")
+ name := sanitizeName(volumeName)
+ uid := ""
+
+ // label the volume if specified - this requires the volume be created before use
+ if len(labels) > 0 {
+ run := []string{"volume", "create"}
+ for i := range labels {
+ run = append(run, "--label", labels[i])
+ }
+ run = append(run, name)
+ cmd := exec.Command("docker", run...)
+ out, err := cmd.Output()
+ if err != nil {
+ return "", err
+ }
+ uid = strings.TrimSpace(string(out))
+
+ if name == "" {
+ name = uid
+ }
+ }
+
+ run := []string{"run", "--rm", "-i"}
+ run = append(run, "-v", name+":/"+name)
+ run = append(run, image, "tar", "-C", "/"+name, "-xf", "-")
+ cmd := exec.Command("docker", run...)
stdin, err := cmd.StdinPipe()
if err != nil {
- return err
+ return uid, err
}
err = cmd.Start()
if err != nil {
- return err
+ return uid, err
}
tw := tar.NewWriter(stdin)
- dmi := []struct {
- name string
- val func(uuid.UUID) string
- }{
- {"product_uuid", productUUID},
- {"product_serial", productSerial},
- }
+ for _, file := range files {
+ header := file.header
- for _, file := range dmi {
- val := file.val(vm.uid)
- _ = tw.WriteHeader(&tar.Header{
- Name: file.name,
- Size: int64(len(val) + 1),
- Mode: 0444,
- ModTime: time.Now(),
- })
- _, _ = fmt.Fprintln(tw, val)
+ if header.Size == 0 && len(file.content) > 0 {
+ header.Size = int64(len(file.content))
+ }
+
+ if header.ModTime.IsZero() {
+ header.ModTime = time.Now()
+ }
+
+ if header.Mode == 0 {
+ header.Mode = 0444
+ }
+
+ tarErr := tw.WriteHeader(header)
+ if tarErr == nil {
+ _, tarErr = tw.Write(file.content)
+ }
}
- _ = tw.Close()
- _ = stdin.Close()
+ err = nil
+ twErr := tw.Close()
+ stdinErr := stdin.Close()
+ if twErr != nil || stdinErr != nil {
+ err = fmt.Errorf("tw: {%s}, stdin: {%s}", twErr, stdinErr)
+ }
- if err := cmd.Wait(); err != nil {
+ if waitErr := cmd.Wait(); waitErr != nil {
stderr := ""
- if xerr, ok := err.(*exec.ExitError); ok {
+ if xerr, ok := waitErr.(*exec.ExitError); ok {
stderr = string(xerr.Stderr)
}
- log.Printf("%s %s: %s %s", vm.Name, cmd.Args, err, stderr)
- return err
+ log.Printf("%s %s: %s %s", name, cmd.Args, waitErr, stderr)
+
+ err = fmt.Errorf("%s, wait: {%s}", err, waitErr)
+ return uid, err
}
- return nil
+ return uid, err
}
-var (
- toolsRunning = []types.PropertyChange{
- {Name: "guest.toolsStatus", Val: types.VirtualMachineToolsStatusToolsOk},
- {Name: "guest.toolsRunningStatus", Val: string(types.VirtualMachineToolsRunningStatusGuestToolsRunning)},
+func getBridge(bridgeName string) (string, error) {
+ // {"CreatedAt":"2023-07-11 19:22:25.45027052 +0000 UTC","Driver":"bridge","ID":"fe52c7502c5d","IPv6":"false","Internal":"false","Labels":"goodbye=,hello=","Name":"testnet","Scope":"local"}
+ // podman has distinctly different fields at v4.4.1 so commented out fields that don't match. We only actually care about ID
+ type bridgeNet struct {
+ // CreatedAt string
+ Driver string
+ ID string
+ // IPv6 string
+ // Internal string
+ // Labels string
+ Name string
+ // Scope string
+ }
+
+ // if the underlay bridge already exists, return that
+ // we don't check for a specific label or similar so that it's possible to use a bridge created by other frameworks for composite testing
+ var bridge bridgeNet
+ cmd := exec.Command("docker", "network", "ls", "--format={{json .}}", "-f", fmt.Sprintf("name=%s$", bridgeName))
+ out, err := cmd.Output()
+ if err != nil {
+ log.Printf("vcsim %s: %s, %s", cmd.Args, err, out)
+ return "", err
}
- toolsNotRunning = []types.PropertyChange{
- {Name: "guest.toolsStatus", Val: types.VirtualMachineToolsStatusToolsNotRunning},
- {Name: "guest.toolsRunningStatus", Val: string(types.VirtualMachineToolsRunningStatusGuestToolsNotRunning)},
+ // unfortunately docker returns an empty string not an empty json doc and podman returns '[]'
+ // podman also returns an array of matches even when there's only one, so we normalize.
+ str := strings.TrimSpace(string(out))
+ str = strings.TrimPrefix(str, "[")
+ str = strings.TrimSuffix(str, "]")
+ if len(str) == 0 {
+ return "", nil
}
-)
-// start runs the container if specified by the RUN.container extraConfig property.
-func (c *container) start(ctx *Context, vm *VirtualMachine) {
- if c.id != "" {
- start := "start"
- if vm.Runtime.PowerState == types.VirtualMachinePowerStateSuspended {
- start = "unpause"
- }
- cmd := exec.Command("docker", start, c.id)
- err := cmd.Run()
- if err != nil {
- log.Printf("%s %s: %s", vm.Name, cmd.Args, err)
- } else {
- ctx.Map.Update(vm, toolsRunning)
- }
- return
+ err = json.Unmarshal([]byte(str), &bridge)
+ if err != nil {
+ log.Printf("vcsim %s: %s, %s", cmd.Args, err, str)
+ return "", err
}
- var args []string
- var env []string
+ return bridge.ID, nil
+}
- for _, opt := range vm.Config.ExtraConfig {
- val := opt.GetOptionValue()
- if val.Key == "RUN.container" {
- run := val.Value.(string)
- err := json.Unmarshal([]byte(run), &args)
- if err != nil {
- args = []string{run}
- }
+// createBridge creates a bridge network if one does not already exist
+// returns:
+//
+// uid - string
+// err - error or nil
+func createBridge(bridgeName string, labels ...string) (string, error) {
- continue
- }
- if strings.HasPrefix(val.Key, "guestinfo.") {
- key := strings.Replace(strings.ToUpper(val.Key), ".", "_", -1)
- env = append(env, "--env", fmt.Sprintf("VMX_%s=%s", key, val.Value.(string)))
- }
+ id, err := getBridge(bridgeName)
+ if err != nil {
+ return "", err
}
- if len(args) == 0 {
- return
+ if id != "" {
+ return id, nil
}
- if len(env) != 0 {
- // Configure env as the data access method for cloud-init-vmware-guestinfo
- env = append(env, "--env", "VMX_GUESTINFO=true")
+
+ run := []string{"network", "create", "--label", createdByVcsim}
+ for i := range labels {
+ run = append(run, "--label", labels[i])
}
+ run = append(run, bridgeName)
- c.name = fmt.Sprintf("vcsim-%s-%s", sanitizeName(vm.Name), vm.uid)
- run := append([]string{"docker", "run", "-d", "--name", c.name}, env...)
+ cmd := exec.Command("docker", run...)
+ out, err := cmd.Output()
+ if err != nil {
+ log.Printf("vcsim %s: %s: %s", cmd.Args, out, err)
+ return "", err
+ }
- if err := c.createDMI(vm, c.name); err != nil {
- return
+ // docker returns the ID regardless of whether you supply a name when creating the network, however
+ // podman returns the pretty name, so we have to normalize
+ id, err = getBridge(bridgeName)
+ if err != nil {
+ return "", err
}
- run = append(run, "-v", fmt.Sprintf("%s:%s:ro", c.name, "/sys/class/dmi/id"))
- args = append(run, args...)
- cmd := exec.Command(shell, "-c", strings.Join(args, " "))
+ return id, nil
+}
+
+// create
+// - name - pretty name, eg. vm name
+// - id - uuid or similar - this is merged into container name rather than dictating containerID
+// - networks - set of bridges to connect the container to
+// - volumes - colon separated tuple of volume name to mount path. Passed directly to docker via -v so mount options can be postfixed.
+// - env - array of environment vairables in name=value form
+// - optsAndImage - pass-though options and must include at least the container image to use, including tag if necessary
+// - args - the command+args to pass to the container
+func create(ctx *Context, name string, id string, networks []string, volumes []string, ports []string, env []string, image string, args []string) (*container, error) {
+ if len(image) == 0 {
+ return nil, errors.New("cannot create container backing without an image")
+ }
+
+ var c container
+ c.name = constructContainerName(name, id)
+ c.changes = make(chan struct{})
+
+ for i := range volumes {
+ // we'll pre-create anonymous volumes, simply for labelling consistency
+ volName := strings.Split(volumes[i], ":")
+ createVolume(volName[0], []string{deleteWithContainer, "container=" + c.name}, nil)
+ }
+
+ // assemble env
+ var dockerNet []string
+ var dockerVol []string
+ var dockerPort []string
+ var dockerEnv []string
+
+ for i := range env {
+ dockerEnv = append(dockerEnv, "--env", env[i])
+ }
+
+ for i := range volumes {
+ dockerVol = append(dockerVol, "-v", volumes[i])
+ }
+
+ for i := range ports {
+ dockerPort = append(dockerPort, "-p", ports[i])
+ }
+
+ for i := range networks {
+ dockerNet = append(dockerNet, "--network", networks[i])
+ }
+
+ run := []string{"docker", "create", "--name", c.name}
+ run = append(run, dockerNet...)
+ run = append(run, dockerVol...)
+ run = append(run, dockerPort...)
+ run = append(run, dockerEnv...)
+ run = append(run, image)
+ run = append(run, args...)
+
+ // this combines all the run options into a single string that's passed to /bin/bash -c as the single argument to force bash parsing.
+ // TODO: make this configurable behaviour so users also have the option of not escaping everything for bash
+ cmd := exec.Command(shell, "-c", strings.Join(run, " "))
out, err := cmd.Output()
if err != nil {
stderr := ""
if xerr, ok := err.(*exec.ExitError); ok {
stderr = string(xerr.Stderr)
}
- log.Printf("%s %s: %s %s", vm.Name, cmd.Args, err, stderr)
- return
+ log.Printf("%s %s: %s %s", name, cmd.Args, err, stderr)
+
+ return nil, err
}
- ctx.Map.Update(vm, toolsRunning)
c.id = strings.TrimSpace(string(out))
- vm.logPrintf("%s %s: %s", cmd.Path, cmd.Args, c.id)
- if err = c.inspect(vm); err != nil {
- log.Printf("%s inspect %s: %s", vm.Name, c.id, err)
- }
-
- // Start watching the container resource.
- go c.watchContainer(vm)
+ return &c, nil
}
-// watchContainer monitors the underlying container and updates the VM
-// properties based on the container status. This occurs until either
-// the container or the VM is removed.
-func (c *container) watchContainer(vm *VirtualMachine) {
+// createVolume takes the specified files and writes them into a volume named for the container.
+func (c *container) createVolume(name string, labels []string, files []tarEntry) (string, error) {
+ return createVolume(c.name+"--"+name, append(labels, "container="+c.name), files)
+}
- inspectInterval := time.Duration(5 * time.Second)
- if d, err := time.ParseDuration(os.Getenv("VCSIM_INSPECT_INTERVAL")); err == nil {
- inspectInterval = d
+// inspect retrieves and parses container properties into directly usable struct
+// returns:
+//
+// out - the stdout of the command
+// detail - basic struct populated with container details
+// err:
+// * if c.id is empty, or docker returns "No such object", will return an uninitializedContainer error
+// * err from either execution or parsing of json output
+func (c *container) inspect() (out []byte, detail containerDetails, err error) {
+ c.Lock()
+ id := c.id
+ c.Unlock()
+
+ if id == "" {
+ err = uninitializedContainer(errors.New("inspect of uninitialized container"))
+ return
}
- var (
- ctx = SpoofContext()
- done = make(chan struct{})
- ticker = time.NewTicker(inspectInterval)
- )
+ var details []containerDetails
- stopUpdatingVmFromContainer := func() {
- ticker.Stop()
- close(done)
+ cmd := exec.Command("docker", "inspect", c.id)
+ out, err = cmd.Output()
+ if eErr, ok := err.(*exec.ExitError); ok {
+ if strings.Contains(string(eErr.Stderr), "No such object") {
+ err = uninitializedContainer(errors.New("inspect of uninitialized container"))
+ }
}
- destroyVm := func() {
- // If the container cannot be found then destroy this VM.
- taskRef := vm.DestroyTask(ctx, &types.Destroy_Task{
- This: vm.Self,
- }).(*methods.Destroy_TaskBody).Res.Returnval
- task := ctx.Map.Get(taskRef).(*Task)
+ if err != nil {
+ return
+ }
- // Wait for the task to complete and see if there is an error.
- task.Wait()
- if task.Info.Error != nil {
- vm.logPrintf("failed to destroy vm: err=%v", *task.Info.Error)
- }
+ if err = json.NewDecoder(bytes.NewReader(out)).Decode(&details); err != nil {
+ return
}
- updateVmFromContainer := func() {
- // Exit the monitor loop if the VM was removed from the API side.
- if c.id == "" {
- stopUpdatingVmFromContainer()
- return
- }
+ if len(details) != 1 {
+ err = fmt.Errorf("multiple containers (%d) match ID: %s", len(details), c.id)
+ return
+ }
- if err := c.inspect(vm); err != nil {
- // If there is an error inspecting the container because it no
- // longer exists, then destroy the VM as well. Please note the
- // reason this logic does not invoke stopUpdatingVmFromContainer
- // is because that will be handled the next time this function
- // is entered and c.id is empty.
- if err, ok := err.(*exec.ExitError); ok {
- if strings.Contains(string(err.Stderr), "No such object") {
- destroyVm()
- }
- }
- }
+ detail = details[0]
+ return
+}
+
+// start
+// - if the container already exists, start it or unpause it.
+func (c *container) start(ctx *Context) error {
+ c.Lock()
+ id := c.id
+ c.Unlock()
+
+ if id == "" {
+ return uninitializedContainer(errors.New("start of uninitialized container"))
}
- // Update the VM from the container at regular intervals until the done
- // channel is closed.
- for {
- select {
- case <-ticker.C:
- ctx.WithLock(vm, updateVmFromContainer)
- case <-done:
- return
- }
+ start := "start"
+ _, detail, err := c.inspect()
+ if err != nil {
+ return err
}
-}
-// stop the container (if any) for the given vm.
-func (c *container) stop(ctx *Context, vm *VirtualMachine) {
- if c.id == "" {
- return
+ if detail.State.Paused {
+ start = "unpause"
}
- cmd := exec.Command("docker", "stop", c.id)
- err := cmd.Run()
+ cmd := exec.Command("docker", start, c.id)
+ err = cmd.Run()
if err != nil {
- log.Printf("%s %s: %s", vm.Name, cmd.Args, err)
- } else {
- ctx.Map.Update(vm, toolsNotRunning)
+ log.Printf("%s %s: %s", c.name, cmd.Args, err)
}
+
+ return err
}
// pause the container (if any) for the given vm.
-func (c *container) pause(ctx *Context, vm *VirtualMachine) {
- if c.id == "" {
- return
+func (c *container) pause(ctx *Context) error {
+ c.Lock()
+ id := c.id
+ c.Unlock()
+
+ if id == "" {
+ return uninitializedContainer(errors.New("pause of uninitialized container"))
}
cmd := exec.Command("docker", "pause", c.id)
err := cmd.Run()
if err != nil {
- log.Printf("%s %s: %s", vm.Name, cmd.Args, err)
- } else {
- ctx.Map.Update(vm, toolsNotRunning)
+ log.Printf("%s %s: %s", c.name, cmd.Args, err)
}
+
+ return err
}
// restart the container (if any) for the given vm.
-func (c *container) restart(ctx *Context, vm *VirtualMachine) {
- if c.id == "" {
- return
+func (c *container) restart(ctx *Context) error {
+ c.Lock()
+ id := c.id
+ c.Unlock()
+
+ if id == "" {
+ return uninitializedContainer(errors.New("restart of uninitialized container"))
}
cmd := exec.Command("docker", "restart", c.id)
err := cmd.Run()
if err != nil {
- log.Printf("%s %s: %s", vm.Name, cmd.Args, err)
- } else {
- ctx.Map.Update(vm, toolsRunning)
+ log.Printf("%s %s: %s", c.name, cmd.Args, err)
}
+
+ return err
}
-// remove the container (if any) for the given vm.
-func (c *container) remove(vm *VirtualMachine) {
- if c.id == "" {
- return
- }
+// stop the container (if any) for the given vm.
+func (c *container) stop(ctx *Context) error {
+ c.Lock()
+ id := c.id
+ c.Unlock()
- args := [][]string{
- {"rm", "-v", "-f", c.id},
- {"volume", "rm", "-f", c.name},
+ if id == "" {
+ return uninitializedContainer(errors.New("stop of uninitialized container"))
}
- for i := range args {
- cmd := exec.Command("docker", args[i]...)
- err := cmd.Run()
- if err != nil {
- log.Printf("%s %s: %s", vm.Name, cmd.Args, err)
- }
+ cmd := exec.Command("docker", "stop", c.id)
+ err := cmd.Run()
+ if err != nil {
+ log.Printf("%s %s: %s", c.name, cmd.Args, err)
}
- c.id = ""
+ return err
}
-func (c *container) exec(ctx *Context, vm *VirtualMachine, auth types.BaseGuestAuthentication, args []string) (string, types.BaseMethodFault) {
- fault := vm.run.prepareGuestOperation(vm, auth)
- if fault != nil {
- return "", fault
+// exec invokes the specified command, with executable being the first of the args, in the specified container
+// returns
+//
+// string - combined stdout and stderr from command
+// err
+// * uninitializedContainer error - if c.id is empty
+// * err from cmd execution
+func (c *container) exec(ctx *Context, args []string) (string, error) {
+ c.Lock()
+ id := c.id
+ c.Unlock()
+
+ if id == "" {
+ return "", uninitializedContainer(errors.New("exec into uninitialized container"))
}
- args = append([]string{"exec", vm.run.id}, args...)
+ args = append([]string{"exec", c.id}, args...)
cmd := exec.Command("docker", args...)
-
res, err := cmd.CombinedOutput()
if err != nil {
- log.Printf("%s: %s (%s)", vm.Self, cmd.Args, string(res))
- return "", new(types.GuestOperationsFault)
+ log.Printf("%s: %s (%s)", c.name, cmd.Args, string(res))
+ return "", err
}
return strings.TrimSpace(string(res)), nil
}
-// From https://docs.docker.com/engine/reference/commandline/cp/ :
-// > It is not possible to copy certain system files such as resources under /proc, /sys, /dev, tmpfs, and mounts created by the user in the container.
-// > However, you can still copy such files by manually running tar in docker exec.
-func guestUpload(id string, file string, r *http.Request) error {
- cmd := exec.Command("docker", "exec", "-i", id, "tar", "Cxf", path.Dir(file), "-")
- cmd.Stderr = os.Stderr
- stdin, err := cmd.StdinPipe()
+// remove the container (if any) for the given vm. Considers removal of an uninitialized container success.
+// Also removes volumes and networks that indicate they are lifecycle coupled with this container.
+// returns:
+//
+// err - joined err from deletion of container and any volumes or networks that have coupled lifecycle
+func (c *container) remove(ctx *Context) error {
+ c.Lock()
+ defer c.Unlock()
+
+ if c.id == "" {
+ // consider absence success
+ return nil
+ }
+
+ cmd := exec.Command("docker", "rm", "-v", "-f", c.id)
+ err := cmd.Run()
if err != nil {
+ log.Printf("%s %s: %s", c.name, cmd.Args, err)
return err
}
- if err = cmd.Start(); err != nil {
- return err
+
+ cmd = exec.Command("docker", "volume", "ls", "-q", "--filter", "label=container="+c.name, "--filter", "label="+deleteWithContainer)
+ volumesToReap, lsverr := cmd.Output()
+ if lsverr != nil {
+ log.Printf("%s %s: %s", c.name, cmd.Args, lsverr)
}
+ log.Printf("%s volumes: %s", c.name, volumesToReap)
- tw := tar.NewWriter(stdin)
- _ = tw.WriteHeader(&tar.Header{
- Name: path.Base(file),
- Size: r.ContentLength,
- Mode: 0444,
- ModTime: time.Now(),
- })
+ var rmverr error
+ if len(volumesToReap) > 0 {
+ run := []string{"volume", "rm", "-f"}
+ run = append(run, strings.Split(string(volumesToReap), "\n")...)
+ cmd = exec.Command("docker", run...)
+ out, rmverr := cmd.Output()
+ if rmverr != nil {
+ log.Printf("%s %s: %s, %s", c.name, cmd.Args, rmverr, out)
+ }
+ }
+
+ cmd = exec.Command("docker", "network", "ls", "-q", "--filter", "label=container="+c.name, "--filter", "label="+deleteWithContainer)
+ networksToReap, lsnerr := cmd.Output()
+ if lsnerr != nil {
+ log.Printf("%s %s: %s", c.name, cmd.Args, lsnerr)
+ }
- _, _ = io.Copy(tw, r.Body)
+ var rmnerr error
+ if len(networksToReap) > 0 {
+ run := []string{"network", "rm", "-f"}
+ run = append(run, strings.Split(string(volumesToReap), "\n")...)
+ cmd = exec.Command("docker", run...)
+ rmnerr = cmd.Run()
+ if rmnerr != nil {
+ log.Printf("%s %s: %s", c.name, cmd.Args, rmnerr)
+ }
+ }
- _ = tw.Close()
- _ = stdin.Close()
- _ = r.Body.Close()
+ if err != nil || lsverr != nil || rmverr != nil || lsnerr != nil || rmnerr != nil {
+ return fmt.Errorf("err: {%s}, lsverr: {%s}, rmverr: {%s}, lsnerr:{%s}, rmerr: {%s}", err, lsverr, rmverr, lsnerr, rmnerr)
+ }
- return cmd.Wait()
+ if c.cancelWatch != nil {
+ c.cancelWatch()
+ eventWatch.ignore(c)
+ }
+ c.id = ""
+ return nil
}
-func guestDownload(id string, file string, w http.ResponseWriter) error {
- cmd := exec.Command("docker", "exec", id, "tar", "Ccf", path.Dir(file), "-", path.Base(file))
- cmd.Stderr = os.Stderr
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- return err
+// updated is a simple trigger allowing a caller to indicate that something has likely changed about the container
+// and interested parties should re-inspect as needed.
+func (c *container) updated() {
+ consolidationWindow := 250 * time.Millisecond
+ if d, err := time.ParseDuration(os.Getenv("VCSIM_EVENT_CONSOLIDATION_WINDOW")); err == nil {
+ consolidationWindow = d
}
- if err = cmd.Start(); err != nil {
- return err
+
+ select {
+ case c.changes <- struct{}{}:
+ time.Sleep(consolidationWindow)
+ // as this is only a hint to avoid waiting for the full inspect interval, we don't care about accumulating
+ // multiple triggers. We do pause to allow large numbers of sequential updates to consolidate
+ default:
}
+}
- tr := tar.NewReader(stdout)
- header, err := tr.Next()
- if err != nil {
- return err
+// watchContainer monitors the underlying container and updates
+// properties based on the container status. This occurs until either
+// the container or the VM is removed.
+// returns:
+//
+// err - uninitializedContainer error - if c.id is empty
+func (c *container) watchContainer(ctx context.Context, updateFn func(*containerDetails, *container) error) error {
+ c.Lock()
+ defer c.Unlock()
+
+ if c.id == "" {
+ return uninitializedContainer(errors.New("Attempt to watch uninitialized container"))
}
- w.Header().Set("Content-Length", strconv.FormatInt(header.Size, 10))
- _, _ = io.Copy(w, tr)
+ eventWatch.watch(c)
+
+ cancelCtx, cancelFunc := context.WithCancel(ctx)
+ c.cancelWatch = cancelFunc
+
+ // Update the VM from the container at regular intervals until the done
+ // channel is closed.
+ go func() {
+ inspectInterval := 10 * time.Second
+ if d, err := time.ParseDuration(os.Getenv("VCSIM_INSPECT_INTERVAL")); err == nil {
+ inspectInterval = d
+ }
+ ticker := time.NewTicker(inspectInterval)
+
+ update := func() {
+ _, details, err := c.inspect()
+ var rmErr error
+ var removing bool
+ if _, ok := err.(uninitializedContainer); ok {
+ removing = true
+ rmErr = c.remove(SpoofContext())
+ }
+
+ updateErr := updateFn(&details, c)
+ // if we don't succeed we want to re-try
+ if removing && rmErr == nil && updateErr == nil {
+ ticker.Stop()
+ return
+ }
+ if updateErr != nil {
+ log.Printf("vcsim container watch: %s %s", c.id, updateErr)
+ }
+ }
+
+ for {
+ select {
+ case <-c.changes:
+ update()
+ case <-ticker.C:
+ update()
+ case <-cancelCtx.Done():
+ return
+ }
+ }
+ }()
- return cmd.Wait()
+ return nil
}
-const guestPrefix = "/guestFile/"
+func (w *eventWatcher) watch(c *container) {
+ w.Lock()
+ defer w.Unlock()
-// ServeGuest handles container guest file upload/download
-func ServeGuest(w http.ResponseWriter, r *http.Request) {
- // Real vCenter form: /guestFile?id=139&token=...
- // vcsim form: /guestFile/tmp/foo/bar?id=ebc8837b8cb6&token=...
+ if w.watches == nil {
+ w.watches = make(map[string]*container)
+ }
- id := r.URL.Query().Get("id")
- file := strings.TrimPrefix(r.URL.Path, guestPrefix[:len(guestPrefix)-1])
- var err error
+ w.watches[c.id] = c
- switch r.Method {
- case http.MethodPut:
- err = guestUpload(id, file, r)
- case http.MethodGet:
- err = guestDownload(id, file, w)
- default:
- w.WriteHeader(http.StatusMethodNotAllowed)
- return
+ if w.stdin == nil {
+ cmd := exec.Command("docker", "events", "--format", "'{{.ID}}'", "--filter", "Type=container")
+ w.stdout, _ = cmd.StdoutPipe()
+ w.stdin, _ = cmd.StdinPipe()
+ err := cmd.Start()
+ if err != nil {
+ log.Printf("docker event watcher: %s %s", cmd.Args, err)
+ w.stdin = nil
+ w.stdout = nil
+ w.process = nil
+
+ return
+ }
+
+ w.process = cmd.Process
+
+ go w.monitor()
}
+}
- if err != nil {
- log.Printf("%s %s: %s", r.Method, r.URL, err)
- w.WriteHeader(http.StatusInternalServerError)
+func (w *eventWatcher) ignore(c *container) {
+ w.Lock()
+
+ delete(w.watches, c.id)
+
+ if len(w.watches) == 0 && w.stdin != nil {
+ w.stop()
}
+
+ w.Unlock()
}
-// productSerial returns the uuid in /sys/class/dmi/id/product_serial format
-func productSerial(id uuid.UUID) string {
- var dst [len(id)*2 + len(id) - 1]byte
-
- j := 0
- for i := 0; i < len(id); i++ {
- hex.Encode(dst[j:j+2], id[i:i+1])
- j += 3
- if j < len(dst) {
- s := j - 1
- if s == len(dst)/2 {
- dst[s] = '-'
- } else {
- dst[s] = ' '
- }
- }
+func (w *eventWatcher) monitor() {
+ w.Lock()
+ watches := len(w.watches)
+ w.Unlock()
+
+ if watches == 0 {
+ return
}
- return fmt.Sprintf("VMware-%s", string(dst[:]))
+ scanner := bufio.NewScanner(w.stdout)
+ for scanner.Scan() {
+ id := strings.TrimSpace(scanner.Text())
+
+ w.Lock()
+ container := w.watches[id]
+ w.Unlock()
+
+ if container != nil {
+ // this is called in a routine to allow an event consolidation window
+ go container.updated()
+ }
+ }
}
-// productUUID returns the uuid in /sys/class/dmi/id/product_uuid format
-func productUUID(id uuid.UUID) string {
- var dst [36]byte
-
- hex.Encode(dst[0:2], id[3:4])
- hex.Encode(dst[2:4], id[2:3])
- hex.Encode(dst[4:6], id[1:2])
- hex.Encode(dst[6:8], id[0:1])
- dst[8] = '-'
- hex.Encode(dst[9:11], id[5:6])
- hex.Encode(dst[11:13], id[4:5])
- dst[13] = '-'
- hex.Encode(dst[14:16], id[7:8])
- hex.Encode(dst[16:18], id[6:7])
- dst[18] = '-'
- hex.Encode(dst[19:23], id[8:10])
- dst[23] = '-'
- hex.Encode(dst[24:], id[10:])
-
- return strings.ToUpper(string(dst[:]))
+func (w *eventWatcher) stop() {
+ if w.stdin != nil {
+ w.stdin.Close()
+ w.stdin = nil
+ }
+ if w.stdout != nil {
+ w.stdout.Close()
+ w.stdout = nil
+ }
+ w.process.Kill()
}
diff --git a/vendor/github.com/vmware/govmomi/simulator/container_host_system.go b/vendor/github.com/vmware/govmomi/simulator/container_host_system.go
new file mode 100644
index 0000000000..c3d283abb7
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/simulator/container_host_system.go
@@ -0,0 +1,351 @@
+/*
+Copyright (c) 2023-2023 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 simulator
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/vmware/govmomi/units"
+ "github.com/vmware/govmomi/vim25/methods"
+ "github.com/vmware/govmomi/vim25/types"
+)
+
+const (
+ advOptPrefixPnicToUnderlayPrefix = "RUN.underlay."
+ advOptContainerBackingImage = "RUN.container"
+ defaultUnderlayBridgeName = "vcsim-underlay"
+)
+
+type simHost struct {
+ host *HostSystem
+ c *container
+}
+
+// createSimHostMounts iterates over the provide filesystem mount info, creating docker volumes. It does _not_ delete volumes
+// already created if creation of one fails.
+// Returns:
+// volume mounts: mount options suitable to pass directly to docker
+// exec commands: a set of commands to run in the sim host after creation
+// error: if construction of the above outputs fails
+func createSimHostMounts(ctx *Context, containerName string, mounts []types.HostFileSystemMountInfo) ([]string, [][]string, error) {
+ var dockerVol []string
+ var symlinkCmds [][]string
+
+ for i := range mounts {
+ info := &mounts[i]
+ name := info.Volume.GetHostFileSystemVolume().Name
+
+ // NOTE: if we ever need persistence cross-invocation we can look at encoding the disk info as a label
+ labels := []string{"name=" + name, "container=" + containerName, deleteWithContainer}
+ dockerUuid, err := createVolume("", labels, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ uuid := volumeIDtoHostVolumeUUID(dockerUuid)
+ name = strings.Replace(name, uuidToken, uuid, -1)
+
+ switch vol := info.Volume.(type) {
+ case *types.HostVmfsVolume:
+ vol.BlockSizeMb = 1
+ vol.BlockSize = units.KB
+ vol.UnmapGranularity = units.KB
+ vol.UnmapPriority = "low"
+ vol.MajorVersion = 6
+ vol.Version = "6.82"
+ vol.Uuid = uuid
+ vol.HostFileSystemVolume.Name = name
+ for e := range vol.Extent {
+ vol.Extent[e].DiskName = "____simulated_volume_____"
+ if vol.Extent[e].Partition == 0 {
+ // HACK: this should be unique within the diskname, but for now this will suffice
+ // partitions start at 1
+ vol.Extent[e].Partition = int32(e + 1)
+ }
+ }
+ vol.Ssd = types.NewBool(true)
+ vol.Local = types.NewBool(true)
+ case *types.HostVfatVolume:
+ vol.HostFileSystemVolume.Name = name
+ }
+
+ info.VStorageSupport = "vStorageUnsupported"
+
+ info.MountInfo.Path = "/vmfs/volumes/" + uuid
+ info.MountInfo.Mounted = types.NewBool(true)
+ info.MountInfo.Accessible = types.NewBool(true)
+ if info.MountInfo.AccessMode == "" {
+ info.MountInfo.AccessMode = "readWrite"
+ }
+
+ opt := "rw"
+ if info.MountInfo.AccessMode == "readOnly" {
+ opt = "ro"
+ }
+
+ dockerVol = append(dockerVol, fmt.Sprintf("%s:/vmfs/volumes/%s:%s", dockerUuid, uuid, opt))
+
+ // create symlinks from /vmfs/volumes/ for the Volume Name - the direct mount (path) is only the uuid
+ // ? can we do this via a script in the ESX image instead of via exec?
+ // ? are the volume names exposed in any manner inside the host? They must be because these mounts exist but where does that come from? Chicken and egg problem? ConfigStore?
+ symlinkCmds = append(symlinkCmds, []string{"ln", "-s", fmt.Sprintf("/vmfs/volumes/%s", uuid), fmt.Sprintf("/vmfs/volumes/%s", name)})
+ if strings.HasPrefix(name, "OSDATA") {
+ symlinkCmds = append(symlinkCmds, []string{"mkdir", "-p", "/var/lib/vmware"})
+ symlinkCmds = append(symlinkCmds, []string{"ln", "-s", fmt.Sprintf("/vmfs/volumes/%s", uuid), "/var/lib/vmware/osdata"})
+ }
+ }
+
+ return dockerVol, symlinkCmds, nil
+}
+
+// createSimHostNetworks creates the networks for the host if not already created. Because we expect multiple hosts on the same network to act as a cluster
+// it's likely that only the first host will create networks.
+// This includes:
+// * bridge network per-pNIC
+// * bridge network per-DVS
+//
+// Returns:
+// * array of networks to attach to
+// * array of commands to run
+// * error
+//
+// TODO: implement bridge network per DVS - not needed until container backed VMs are "created" on container backed "hosts"
+func createSimHostNetworks(ctx *Context, containerName string, networkInfo *types.HostNetworkInfo, advOpts *OptionManager) ([]string, [][]string, error) {
+ var dockerNet []string
+ var cmds [][]string
+
+ existingNets := make(map[string]string)
+
+ // a pnic does not have an IP so this is purely a connectivity statement, not a network identity, however this is not how docker works
+ // so we're going to end up with a veth (our pnic) that does have an IP assigned. That IP will end up being used in a NetConfig structure associated
+ // with the pNIC. See HostSystem.getNetConfigInterface.
+ for i := range networkInfo.Pnic {
+ pnicName := networkInfo.Pnic[i].Device
+
+ bridge := getPnicUnderlay(advOpts, pnicName)
+
+ if pnic, attached := existingNets[bridge]; attached {
+ return nil, nil, fmt.Errorf("cannot attach multiple pNICs to the same underlay: %s and %s both attempting to connect to %s for %s", pnic, pnicName, bridge, containerName)
+ }
+
+ _, err := createBridge(bridge)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ dockerNet = append(dockerNet, bridge)
+ existingNets[bridge] = pnicName
+ }
+
+ return dockerNet, cmds, nil
+}
+
+func getPnicUnderlay(advOpts *OptionManager, pnicName string) string {
+ queryRes := advOpts.QueryOptions(&types.QueryOptions{Name: advOptPrefixPnicToUnderlayPrefix + pnicName}).(*methods.QueryOptionsBody).Res
+ return queryRes.Returnval[0].GetOptionValue().Value.(string)
+}
+
+// createSimulationHostcreates a simHost binding if the host.ConfigManager.AdvancedOption set contains a key "RUN.container".
+// If the set does not contain that key, this returns nil.
+// Methods on the simHost type are written to check for nil object so the return from this call can be blindly
+// assigned and invoked without the caller caring about whether a binding for a backing container was warranted.
+//
+// The created simhost is based off of the details of the supplied host system.
+// VMFS locations are created based on FileSystemMountInfo
+// Bridge networks are created to simulate underlay networks - one per pNIC. You cannot connect two pNICs to the same underlay.
+//
+// On Network connectivity - initially this is using docker network constructs. This means we cannot easily use nested "ip netns" so we cannot
+// have a perfect representation of the ESX structure: pnic(veth)->vswtich(bridge)->{vmk,vnic}(veth)
+// Instead we have the following:
+// * bridge network per underlay - everything connects directly to the underlay
+// * VMs/CRXs connect to the underlay dictated by the Uplink pNIC attached to their vSwitch
+// * hostd vmknic gets the "host" container IP - we don't currently support multiple vmknics with different IPs
+// * no support for mocking VLANs
+func createSimulationHost(ctx *Context, host *HostSystem) (*simHost, error) {
+ sh := &simHost{
+ host: host,
+ }
+
+ advOpts := ctx.Map.Get(host.ConfigManager.AdvancedOption.Reference()).(*OptionManager)
+ fault := advOpts.QueryOptions(&types.QueryOptions{Name: "RUN.container"}).(*methods.QueryOptionsBody).Fault()
+ if fault != nil {
+ if _, ok := fault.VimFault().(*types.InvalidName); ok {
+ return nil, nil
+ }
+ return nil, fmt.Errorf("errror retrieving container backing from host config manager: %+v", fault.VimFault())
+ }
+
+ // assemble env
+ var dockerEnv []string
+
+ var execCmds [][]string
+
+ var err error
+
+ hName := host.Summary.Config.Name
+ hUuid := host.Summary.Hardware.Uuid
+ containerName := constructContainerName(hName, hUuid)
+
+ // create volumes and mounts
+ dockerVol, volCmds, err := createSimHostMounts(ctx, containerName, host.Config.FileSystemVolume.MountInfo)
+ if err != nil {
+ return nil, err
+ }
+ execCmds = append(execCmds, volCmds...)
+
+ // create networks
+ dockerNet, netCmds, err := createSimHostNetworks(ctx, containerName, host.Config.Network, advOpts)
+ if err != nil {
+ return nil, err
+ }
+ execCmds = append(execCmds, netCmds...)
+
+ // create the container
+ sh.c, err = create(ctx, hName, hUuid, dockerNet, dockerVol, nil, dockerEnv, "alpine", []string{"sleep", "infinity"})
+ if err != nil {
+ return nil, err
+ }
+
+ // start the container
+ err = sh.c.start(ctx)
+ if err != nil {
+ return nil, err
+ }
+
+ // run post-creation steps
+ for _, cmd := range execCmds {
+ _, err := sh.c.exec(ctx, cmd)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ _, detail, err := sh.c.inspect()
+
+ for i := range host.Config.Network.Pnic {
+ pnic := &host.Config.Network.Pnic[i]
+ bridge := getPnicUnderlay(advOpts, pnic.Device)
+ settings := detail.NetworkSettings.Networks[bridge]
+
+ // it doesn't really make sense at an ESX level to set this information as IP bindings are associated with
+ // vnics (VMs) or vmknics (daemons such as hostd).
+ // However it's a useful location to stash this info in a manner that can be retrieved at a later date.
+ pnic.Spec.Ip.IpAddress = settings.IPAddress
+ pnic.Spec.Ip.SubnetMask = prefixToMask(settings.IPPrefixLen)
+
+ pnic.Mac = settings.MacAddress
+ }
+
+ // update the active "management" nicType with the container IP for vmnic0
+ netconfig, err := host.getNetConfigInterface(ctx, "management")
+ if err != nil {
+ return nil, err
+ }
+ netconfig.vmk.Spec.Ip.IpAddress = netconfig.uplink.Spec.Ip.IpAddress
+ netconfig.vmk.Spec.Ip.SubnetMask = netconfig.uplink.Spec.Ip.SubnetMask
+ netconfig.vmk.Spec.Mac = netconfig.uplink.Mac
+
+ return sh, nil
+}
+
+// remove destroys the container associated with the host and any volumes with labels specifying their lifecycle
+// is coupled with the container
+func (sh *simHost) remove(ctx *Context) error {
+ if sh == nil {
+ return nil
+ }
+
+ return sh.c.remove(ctx)
+}
+
+// volumeIDtoHostVolumeUUID takes the 64 char docker uuid and converts it into a 32char ESX form of 8-8-4-12
+// Perhaps we should do this using an md5 rehash, but instead we just take the first 32char for ease of cross-reference.
+func volumeIDtoHostVolumeUUID(id string) string {
+ return fmt.Sprintf("%s-%s-%s-%s", id[0:8], id[8:16], id[16:20], id[20:32])
+}
+
+// By reference to physical system, partition numbering tends to work out like this:
+// 1. EFI System (100 MB)
+// Free space (1.97 MB)
+// 5. Basic Data (4 GB) (bootbank1)
+// 6. Basic Data (4 GB) (bootbank2)
+// 7. VMFSL (119.9 GB) (os-data)
+// 8. VMFS (1 TB) (datastore1)
+// I assume the jump from 1 -> 5 harks back to the primary/logical partitions from MBT days
+const uuidToken = "%__UUID__%"
+
+var defaultSimVolumes = []types.HostFileSystemMountInfo{
+ {
+ MountInfo: types.HostMountInfo{
+ AccessMode: "readWrite",
+ },
+ Volume: &types.HostVmfsVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "VMFS",
+ Name: "datastore1",
+ Capacity: 1 * units.TB,
+ },
+ Extent: []types.HostScsiDiskPartition{
+ {
+ Partition: 8,
+ },
+ },
+ },
+ },
+ {
+ MountInfo: types.HostMountInfo{
+ AccessMode: "readWrite",
+ },
+ Volume: &types.HostVmfsVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "OTHER",
+ Name: "OSDATA-%__UUID__%",
+ Capacity: 128 * units.GB,
+ },
+ Extent: []types.HostScsiDiskPartition{
+ {
+ Partition: 7,
+ },
+ },
+ },
+ },
+ {
+ MountInfo: types.HostMountInfo{
+ AccessMode: "readOnly",
+ },
+ Volume: &types.HostVfatVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "OTHER",
+ Name: "BOOTBANK1",
+ Capacity: 4 * units.GB,
+ },
+ },
+ },
+ {
+ MountInfo: types.HostMountInfo{
+ AccessMode: "readOnly",
+ },
+ Volume: &types.HostVfatVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "OTHER",
+ Name: "BOOTBANK2",
+ Capacity: 4 * units.GB,
+ },
+ },
+ },
+}
diff --git a/vendor/github.com/vmware/govmomi/simulator/container_virtual_machine.go b/vendor/github.com/vmware/govmomi/simulator/container_virtual_machine.go
new file mode 100644
index 0000000000..a44ad8b977
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/simulator/container_virtual_machine.go
@@ -0,0 +1,511 @@
+/*
+Copyright (c) 2023-2023 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 simulator
+
+import (
+ "archive/tar"
+ "context"
+ "encoding/hex"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "log"
+ "net/http"
+ "strconv"
+ "strings"
+
+ "github.com/google/uuid"
+
+ "github.com/vmware/govmomi/vim25/methods"
+ "github.com/vmware/govmomi/vim25/types"
+)
+
+const ContainerBackingOptionKey = "RUN.container"
+
+var (
+ toolsRunning = []types.PropertyChange{
+ {Name: "guest.toolsStatus", Val: types.VirtualMachineToolsStatusToolsOk},
+ {Name: "guest.toolsRunningStatus", Val: string(types.VirtualMachineToolsRunningStatusGuestToolsRunning)},
+ }
+
+ toolsNotRunning = []types.PropertyChange{
+ {Name: "guest.toolsStatus", Val: types.VirtualMachineToolsStatusToolsNotRunning},
+ {Name: "guest.toolsRunningStatus", Val: string(types.VirtualMachineToolsRunningStatusGuestToolsNotRunning)},
+ }
+)
+
+type simVM struct {
+ vm *VirtualMachine
+ c *container
+}
+
+// createSimulationVM inspects the provided VirtualMachine and creates a simVM binding for it if
+// the vm.Config.ExtraConfig set contains a key "RUN.container".
+// If the ExtraConfig set does not contain that key, this returns nil.
+// Methods on the simVM type are written to check for nil object so the return from this call can be blindly
+// assigned and invoked without the caller caring about whether a binding for a backing container was warranted.
+func createSimulationVM(vm *VirtualMachine) *simVM {
+ svm := &simVM{
+ vm: vm,
+ }
+
+ for _, opt := range vm.Config.ExtraConfig {
+ val := opt.GetOptionValue()
+ if val.Key == ContainerBackingOptionKey {
+ return svm
+ }
+ }
+
+ return nil
+}
+
+// applies container network settings to vm.Guest properties.
+func (svm *simVM) syncNetworkConfigToVMGuestProperties() error {
+ if svm == nil {
+ return nil
+ }
+
+ out, detail, err := svm.c.inspect()
+ if err != nil {
+ return err
+ }
+
+ svm.vm.Config.Annotation = "inspect"
+ svm.vm.logPrintf("%s: %s", svm.vm.Config.Annotation, string(out))
+
+ netS := detail.NetworkSettings.networkSettings
+
+ // ? Why is this valid - we're taking the first entry while iterating over a MAP
+ for _, n := range detail.NetworkSettings.Networks {
+ netS = n
+ break
+ }
+
+ if detail.State.Paused {
+ svm.vm.Runtime.PowerState = types.VirtualMachinePowerStateSuspended
+ } else if detail.State.Running {
+ svm.vm.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOn
+ } else {
+ svm.vm.Runtime.PowerState = types.VirtualMachinePowerStatePoweredOff
+ }
+
+ svm.vm.Guest.IpAddress = netS.IPAddress
+ svm.vm.Summary.Guest.IpAddress = netS.IPAddress
+
+ if len(svm.vm.Guest.Net) != 0 {
+ net := &svm.vm.Guest.Net[0]
+ net.IpAddress = []string{netS.IPAddress}
+ net.MacAddress = netS.MacAddress
+ net.IpConfig = &types.NetIpConfigInfo{
+ IpAddress: []types.NetIpConfigInfoIpAddress{{
+ IpAddress: netS.IPAddress,
+ PrefixLength: int32(netS.IPPrefixLen),
+ State: string(types.NetIpConfigInfoIpAddressStatusPreferred),
+ }},
+ }
+ }
+
+ for _, d := range svm.vm.Config.Hardware.Device {
+ if eth, ok := d.(types.BaseVirtualEthernetCard); ok {
+ eth.GetVirtualEthernetCard().MacAddress = netS.MacAddress
+ break
+ }
+ }
+
+ return nil
+}
+
+func (svm *simVM) prepareGuestOperation(auth types.BaseGuestAuthentication) types.BaseMethodFault {
+ if svm == nil || svm.c == nil || svm.c.id == "" {
+ return new(types.GuestOperationsUnavailable)
+ }
+
+ if svm.vm.Runtime.PowerState != types.VirtualMachinePowerStatePoweredOn {
+ return &types.InvalidPowerState{
+ RequestedState: types.VirtualMachinePowerStatePoweredOn,
+ ExistingState: svm.vm.Runtime.PowerState,
+ }
+ }
+
+ switch creds := auth.(type) {
+ case *types.NamePasswordAuthentication:
+ if creds.Username == "" || creds.Password == "" {
+ return new(types.InvalidGuestLogin)
+ }
+ default:
+ return new(types.InvalidGuestLogin)
+ }
+
+ return nil
+}
+
+// populateDMI writes BIOS UUID DMI files to a container volume
+func (svm *simVM) populateDMI() error {
+ if svm.c == nil {
+ return nil
+ }
+
+ files := []tarEntry{
+ {
+ &tar.Header{
+ Name: "product_uuid",
+ Mode: 0444,
+ },
+ []byte(productUUID(svm.vm.uid)),
+ },
+ {
+ &tar.Header{
+ Name: "product_serial",
+ Mode: 0444,
+ },
+ []byte(productSerial(svm.vm.uid)),
+ },
+ }
+
+ _, err := svm.c.createVolume("dmi", []string{deleteWithContainer}, files)
+ return err
+}
+
+// start runs the container if specified by the RUN.container extraConfig property.
+// lazily creates a container backing if specified by an ExtraConfig property with key "RUN.container"
+func (svm *simVM) start(ctx *Context) error {
+ if svm == nil {
+ return nil
+ }
+
+ if svm.c != nil && svm.c.id != "" {
+ err := svm.c.start(ctx)
+ if err != nil {
+ log.Printf("%s %s: %s", svm.vm.Name, "start", err)
+ } else {
+ ctx.Map.Update(svm.vm, toolsRunning)
+ }
+
+ return err
+ }
+
+ var args []string
+ var env []string
+ var ports []string
+ mountDMI := true
+
+ for _, opt := range svm.vm.Config.ExtraConfig {
+ val := opt.GetOptionValue()
+ if val.Key == ContainerBackingOptionKey {
+ run := val.Value.(string)
+ err := json.Unmarshal([]byte(run), &args)
+ if err != nil {
+ args = []string{run}
+ }
+
+ continue
+ }
+
+ if val.Key == "RUN.mountdmi" {
+ var mount bool
+ err := json.Unmarshal([]byte(val.Value.(string)), &mount)
+ if err == nil {
+ mountDMI = mount
+ }
+
+ continue
+ }
+
+ if strings.HasPrefix(val.Key, "RUN.port.") {
+ // ? would this not make more sense as a set of tuples in the value?
+ // or inlined into the RUN.container freeform string as is the case with the nginx volume in the examples?
+ sKey := strings.Split(val.Key, ".")
+ containerPort := sKey[len(sKey)-1]
+ ports = append(ports, fmt.Sprintf("%s:%s", val.Value.(string), containerPort))
+
+ continue
+ }
+
+ if strings.HasPrefix(val.Key, "RUN.env.") {
+ sKey := strings.Split(val.Key, ".")
+ envKey := sKey[len(sKey)-1]
+ env = append(env, fmt.Sprintf("%s=%s", envKey, val.Value.(string)))
+ }
+
+ if strings.HasPrefix(val.Key, "guestinfo.") {
+ key := strings.Replace(strings.ToUpper(val.Key), ".", "_", -1)
+ env = append(env, fmt.Sprintf("VMX_%s=%s", key, val.Value.(string)))
+
+ continue
+ }
+ }
+
+ if len(args) == 0 {
+ // not an error - it's simply a simVM that shouldn't be backed by a container
+ return nil
+ }
+
+ if len(env) != 0 {
+ // Configure env as the data access method for cloud-init-vmware-guestinfo
+ env = append(env, "VMX_GUESTINFO=true")
+ }
+
+ volumes := []string{}
+ if mountDMI {
+ volumes = append(volumes, constructVolumeName(svm.vm.Name, svm.vm.uid.String(), "dmi")+":/sys/class/dmi/id")
+ }
+
+ var err error
+ svm.c, err = create(ctx, svm.vm.Name, svm.vm.uid.String(), nil, volumes, ports, env, args[0], args[1:])
+ if err != nil {
+ return err
+ }
+
+ if mountDMI {
+ // not combined with the test assembling volumes because we want to have the container name first.
+ // cannot add a label to a volume after creation, so if we want to associate with the container ID the
+ // container must come first
+ err = svm.populateDMI()
+ if err != nil {
+ return err
+ }
+ }
+
+ err = svm.c.start(ctx)
+ if err != nil {
+ log.Printf("%s %s: %s %s", svm.vm.Name, "start", args, err)
+ return err
+ }
+
+ ctx.Map.Update(svm.vm, toolsRunning)
+
+ svm.vm.logPrintf("%s: %s", args, svm.c.id)
+
+ if err = svm.syncNetworkConfigToVMGuestProperties(); err != nil {
+ log.Printf("%s inspect %s: %s", svm.vm.Name, svm.c.id, err)
+ }
+
+ callback := func(details *containerDetails, c *container) error {
+ spoofctx := SpoofContext()
+
+ if c.id == "" && svm.vm != nil {
+ // If the container cannot be found then destroy this VM unless the VM is no longer configured for container backing (svm.vm == nil)
+ taskRef := svm.vm.DestroyTask(spoofctx, &types.Destroy_Task{This: svm.vm.Self}).(*methods.Destroy_TaskBody).Res.Returnval
+ task, ok := spoofctx.Map.Get(taskRef).(*Task)
+ if !ok {
+ panic(fmt.Sprintf("couldn't retrieve task for moref %+q while deleting VM %s", taskRef, svm.vm.Name))
+ }
+
+ // Wait for the task to complete and see if there is an error.
+ task.Wait()
+ if task.Info.Error != nil {
+ msg := fmt.Sprintf("failed to destroy vm: err=%v", *task.Info.Error)
+ svm.vm.logPrintf(msg)
+
+ return errors.New(msg)
+ }
+ }
+
+ return svm.syncNetworkConfigToVMGuestProperties()
+ }
+
+ // Start watching the container resource.
+ err = svm.c.watchContainer(context.Background(), callback)
+ if _, ok := err.(uninitializedContainer); ok {
+ // the container has been deleted before we could watch, despite successful launch so clean up.
+ callback(nil, svm.c)
+
+ // successful launch so nil the error
+ return nil
+ }
+
+ return err
+}
+
+// stop the container (if any) for the given vm.
+func (svm *simVM) stop(ctx *Context) error {
+ if svm == nil || svm.c == nil {
+ return nil
+ }
+
+ err := svm.c.stop(ctx)
+ if err != nil {
+ log.Printf("%s %s: %s", svm.vm.Name, "stop", err)
+
+ return err
+ }
+
+ ctx.Map.Update(svm.vm, toolsNotRunning)
+
+ return nil
+}
+
+// pause the container (if any) for the given vm.
+func (svm *simVM) pause(ctx *Context) error {
+ if svm == nil || svm.c == nil {
+ return nil
+ }
+
+ err := svm.c.pause(ctx)
+ if err != nil {
+ log.Printf("%s %s: %s", svm.vm.Name, "pause", err)
+
+ return err
+ }
+
+ ctx.Map.Update(svm.vm, toolsNotRunning)
+
+ return nil
+}
+
+// restart the container (if any) for the given vm.
+func (svm *simVM) restart(ctx *Context) error {
+ if svm == nil || svm.c == nil {
+ return nil
+ }
+
+ err := svm.c.restart(ctx)
+ if err != nil {
+ log.Printf("%s %s: %s", svm.vm.Name, "restart", err)
+
+ return err
+ }
+
+ ctx.Map.Update(svm.vm, toolsRunning)
+
+ return nil
+}
+
+// remove the container (if any) for the given vm.
+func (svm *simVM) remove(ctx *Context) error {
+ if svm == nil || svm.c == nil {
+ return nil
+ }
+
+ err := svm.c.remove(ctx)
+ if err != nil {
+ log.Printf("%s %s: %s", svm.vm.Name, "remove", err)
+
+ return err
+ }
+
+ return nil
+}
+
+func (svm *simVM) exec(ctx *Context, auth types.BaseGuestAuthentication, args []string) (string, types.BaseMethodFault) {
+ if svm == nil || svm.c == nil {
+ return "", nil
+ }
+
+ fault := svm.prepareGuestOperation(auth)
+ if fault != nil {
+ return "", fault
+ }
+
+ out, err := svm.c.exec(ctx, args)
+ if err != nil {
+ log.Printf("%s: %s (%s)", svm.vm.Name, args, string(out))
+ return "", new(types.GuestOperationsFault)
+ }
+
+ return strings.TrimSpace(string(out)), nil
+}
+
+func guestUpload(id string, file string, r *http.Request) error {
+ // TODO: decide behaviour for no container
+ err := copyToGuest(id, file, r.ContentLength, r.Body)
+ _ = r.Body.Close()
+ return err
+}
+
+func guestDownload(id string, file string, w http.ResponseWriter) error {
+ // TODO: decide behaviour for no container
+ sink := func(len int64, r io.Reader) error {
+ w.Header().Set("Content-Length", strconv.FormatInt(len, 10))
+ _, err := io.Copy(w, r)
+ return err
+ }
+
+ err := copyFromGuest(id, file, sink)
+ return err
+}
+
+const guestPrefix = "/guestFile/"
+
+// ServeGuest handles container guest file upload/download
+func ServeGuest(w http.ResponseWriter, r *http.Request) {
+ // Real vCenter form: /guestFile?id=139&token=...
+ // vcsim form: /guestFile/tmp/foo/bar?id=ebc8837b8cb6&token=...
+
+ id := r.URL.Query().Get("id")
+ file := strings.TrimPrefix(r.URL.Path, guestPrefix[:len(guestPrefix)-1])
+ var err error
+
+ switch r.Method {
+ case http.MethodPut:
+ err = guestUpload(id, file, r)
+ case http.MethodGet:
+ err = guestDownload(id, file, w)
+ default:
+ w.WriteHeader(http.StatusMethodNotAllowed)
+ return
+ }
+
+ if err != nil {
+ log.Printf("%s %s: %s", r.Method, r.URL, err)
+ w.WriteHeader(http.StatusInternalServerError)
+ }
+}
+
+// productSerial returns the uuid in /sys/class/dmi/id/product_serial format
+func productSerial(id uuid.UUID) string {
+ var dst [len(id)*2 + len(id) - 1]byte
+
+ j := 0
+ for i := 0; i < len(id); i++ {
+ hex.Encode(dst[j:j+2], id[i:i+1])
+ j += 3
+ if j < len(dst) {
+ s := j - 1
+ if s == len(dst)/2 {
+ dst[s] = '-'
+ } else {
+ dst[s] = ' '
+ }
+ }
+ }
+
+ return fmt.Sprintf("VMware-%s", string(dst[:]))
+}
+
+// productUUID returns the uuid in /sys/class/dmi/id/product_uuid format
+func productUUID(id uuid.UUID) string {
+ var dst [36]byte
+
+ hex.Encode(dst[0:2], id[3:4])
+ hex.Encode(dst[2:4], id[2:3])
+ hex.Encode(dst[4:6], id[1:2])
+ hex.Encode(dst[6:8], id[0:1])
+ dst[8] = '-'
+ hex.Encode(dst[9:11], id[5:6])
+ hex.Encode(dst[11:13], id[4:5])
+ dst[13] = '-'
+ hex.Encode(dst[14:16], id[7:8])
+ hex.Encode(dst[16:18], id[6:7])
+ dst[18] = '-'
+ hex.Encode(dst[19:23], id[8:10])
+ dst[23] = '-'
+ hex.Encode(dst[24:], id[10:])
+
+ return strings.ToUpper(string(dst[:]))
+}
diff --git a/vendor/github.com/vmware/govmomi/simulator/dataset.go b/vendor/github.com/vmware/govmomi/simulator/dataset.go
new file mode 100644
index 0000000000..0a1b0627ee
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/simulator/dataset.go
@@ -0,0 +1,65 @@
+/*
+Copyright (c) 2023-2023 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 simulator
+
+import (
+ "github.com/vmware/govmomi/vapi/vm/dataset"
+)
+
+type DataSet struct {
+ *dataset.Info
+ ID string
+ Entries map[string]string
+}
+
+func copyDataSetsForVmClone(src map[string]*DataSet) map[string]*DataSet {
+ copy := make(map[string]*DataSet, len(src))
+ for k, v := range src {
+ if v.OmitFromSnapshotAndClone {
+ continue
+ }
+ copy[k] = copyDataSet(v)
+ }
+ return copy
+}
+
+func copyDataSet(src *DataSet) *DataSet {
+ if src == nil {
+ return nil
+ }
+ copy := &DataSet{
+ Info: &dataset.Info{
+ Name: src.Name,
+ Description: src.Description,
+ Host: src.Host,
+ Guest: src.Guest,
+ Used: src.Used,
+ OmitFromSnapshotAndClone: src.OmitFromSnapshotAndClone,
+ },
+ ID: src.ID,
+ Entries: copyEntries(src.Entries),
+ }
+ return copy
+}
+
+func copyEntries(src map[string]string) map[string]string {
+ copy := make(map[string]string, len(src))
+ for k, v := range src {
+ copy[k] = v
+ }
+ return copy
+}
diff --git a/vendor/github.com/vmware/govmomi/simulator/datastore.go b/vendor/github.com/vmware/govmomi/simulator/datastore.go
index f341bdd174..277674afef 100644
--- a/vendor/github.com/vmware/govmomi/simulator/datastore.go
+++ b/vendor/github.com/vmware/govmomi/simulator/datastore.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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.
@@ -83,6 +83,7 @@ func (ds *Datastore) RefreshDatastore(*types.RefreshDatastore) soap.HasFault {
info.Timestamp = types.NewTime(time.Now())
+ r.Res = &types.RefreshDatastoreResponse{}
return r
}
diff --git a/vendor/github.com/vmware/govmomi/simulator/doc.go b/vendor/github.com/vmware/govmomi/simulator/doc.go
index 441e9a0e7f..61635c32c1 100644
--- a/vendor/github.com/vmware/govmomi/simulator/doc.go
+++ b/vendor/github.com/vmware/govmomi/simulator/doc.go
@@ -17,6 +17,6 @@ limitations under the License.
/*
Package simulator is a mock framework for the vSphere API.
-See also: https://github.com/vmware/govmomi/blob/master/vcsim/README.md
+See also: https://github.com/vmware/govmomi/blob/main/vcsim/README.md
*/
package simulator
diff --git a/vendor/github.com/vmware/govmomi/simulator/environment_browser.go b/vendor/github.com/vmware/govmomi/simulator/environment_browser.go
index 4f8ba8ed9e..31b50939ab 100644
--- a/vendor/github.com/vmware/govmomi/simulator/environment_browser.go
+++ b/vendor/github.com/vmware/govmomi/simulator/environment_browser.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2019 VMware, Inc. All Rights Reserved.
+Copyright (c) 2019-2023 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
+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,
@@ -29,7 +29,10 @@ import (
type EnvironmentBrowser struct {
mo.EnvironmentBrowser
- types.QueryConfigOptionResponse
+ QueryConfigTargetResponse types.QueryConfigTargetResponse
+ QueryConfigOptionResponse types.QueryConfigOptionResponse
+ QueryConfigOptionDescriptorResponse types.QueryConfigOptionDescriptorResponse
+ QueryTargetCapabilitiesResponse types.QueryTargetCapabilitiesResponse
}
func newEnvironmentBrowser() *types.ManagedObjectReference {
@@ -135,7 +138,13 @@ func (b *EnvironmentBrowser) QueryConfigOptionEx(req *types.QueryConfigOptionEx)
func (b *EnvironmentBrowser) QueryConfigOptionDescriptor(ctx *Context, req *types.QueryConfigOptionDescriptor) soap.HasFault {
body := &methods.QueryConfigOptionDescriptorBody{
- Res: new(types.QueryConfigOptionDescriptorResponse),
+ Res: &types.QueryConfigOptionDescriptorResponse{
+ Returnval: b.QueryConfigOptionDescriptorResponse.Returnval,
+ },
+ }
+
+ if body.Res.Returnval != nil {
+ return body
}
body.Res.Returnval = []types.VirtualMachineConfigOptionDescriptor{{
@@ -154,12 +163,18 @@ func (b *EnvironmentBrowser) QueryConfigOptionDescriptor(ctx *Context, req *type
func (b *EnvironmentBrowser) QueryConfigTarget(ctx *Context, req *types.QueryConfigTarget) soap.HasFault {
body := &methods.QueryConfigTargetBody{
Res: &types.QueryConfigTargetResponse{
- Returnval: &types.ConfigTarget{
- SmcPresent: types.NewBool(false),
- },
+ Returnval: b.QueryConfigTargetResponse.Returnval,
},
}
- target := body.Res.Returnval
+
+ if body.Res.Returnval != nil {
+ return body
+ }
+
+ target := &types.ConfigTarget{
+ SmcPresent: types.NewBool(false),
+ }
+ body.Res.Returnval = target
var hosts []types.ManagedObjectReference
if req.Host == nil {
@@ -233,3 +248,22 @@ func (b *EnvironmentBrowser) QueryConfigTarget(ctx *Context, req *types.QueryCon
return body
}
+
+func (b *EnvironmentBrowser) QueryTargetCapabilities(ctx *Context, req *types.QueryTargetCapabilities) soap.HasFault {
+ body := &methods.QueryTargetCapabilitiesBody{
+ Res: &types.QueryTargetCapabilitiesResponse{
+ Returnval: b.QueryTargetCapabilitiesResponse.Returnval,
+ },
+ }
+
+ if body.Res.Returnval != nil {
+ return body
+ }
+
+ body.Res.Returnval = &types.HostCapability{
+ VmotionSupported: true,
+ MaintenanceModeSupported: true,
+ }
+
+ return body
+}
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go b/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go
index d76459be9e..38cd244418 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/authorization_manager.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,7 +20,7 @@ import "github.com/vmware/govmomi/vim25/types"
// RoleList is the default template for the AuthorizationManager roleList property.
// Capture method:
-// govc object.collect -s -dump AuthorizationManager:ha-authmgr roleList
+// govc object.collect -s -dump AuthorizationManager:ha-authmgr roleList
var RoleList = []types.AuthorizationRole{
{
RoleId: -6,
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go b/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go
index c0f95eff9c..374cd9518c 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/datacenter.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -23,7 +23,7 @@ import (
// Datacenter is the default template for Datacenter properties.
// Capture method:
-// govc datacenter.info -dump
+// govc datacenter.info -dump
var Datacenter = mo.Datacenter{
ManagedEntity: mo.ManagedEntity{
ExtensibleManagedObject: mo.ExtensibleManagedObject{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/event_manager.go b/vendor/github.com/vmware/govmomi/simulator/esx/event_manager.go
index 0a572770f7..f231a3f905 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/event_manager.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/event_manager.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2018 VMware, Inc. All Rights Reserved.
+Copyright (c) 2018-2023 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
+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,
@@ -20,7 +20,7 @@ import "github.com/vmware/govmomi/vim25/types"
// EventInfo is the default template for the EventManager description.eventInfo property.
// Capture method:
-// govc object.collect -s -dump EventManager:ha-eventmgr description.eventInfo
+// govc object.collect -s -dump EventManager:ha-eventmgr description.eventInfo
// The captured list has been manually pruned and FullFormat fields changed to use Go's template variable syntax.
var EventInfo = []types.EventDescriptionEventDetail{
{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_config_filesystemvolume.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_config_filesystemvolume.go
new file mode 100644
index 0000000000..01c62d0a48
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_config_filesystemvolume.go
@@ -0,0 +1,144 @@
+/*
+Copyright (c) 2017-2023 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 esx
+
+import (
+ "github.com/vmware/govmomi/units"
+ "github.com/vmware/govmomi/vim25/types"
+)
+
+// HostConfigInfo is the default template for the HostSystem config property.
+// Capture method:
+// govc object.collect -s -dump HostSystem:ha-host config.fileSystemVolume
+// - slightly modified for uuids and DiskName
+var HostFileSystemVolumeInfo = types.HostFileSystemVolumeInfo{
+ VolumeTypeList: []string{"VMFS", "NFS", "NFS41", "vsan", "VVOL", "VFFS", "OTHER", "PMEM"},
+ MountInfo: []types.HostFileSystemMountInfo{
+ {
+ MountInfo: types.HostMountInfo{
+ Path: "/vmfs/volumes/deadbeef-01234567-89ab-cdef00000003",
+ AccessMode: "readWrite",
+ Mounted: types.NewBool(true),
+ Accessible: types.NewBool(true),
+ InaccessibleReason: "",
+ MountFailedReason: "",
+ },
+ Volume: &types.HostVmfsVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "VMFS",
+ Name: "datastore1",
+ Capacity: 3.5 * units.TB,
+ },
+ BlockSizeMb: 1,
+ BlockSize: units.KB,
+ UnmapGranularity: units.KB,
+ UnmapPriority: "low",
+ UnmapBandwidthSpec: (*types.VmfsUnmapBandwidthSpec)(nil),
+ MaxBlocks: 61 * units.MB,
+ MajorVersion: 6,
+ Version: "6.82",
+ Uuid: "deadbeef-01234567-89ab-cdef00000003",
+ Extent: []types.HostScsiDiskPartition{
+ {
+ DiskName: "____simulated_volumes_____",
+ Partition: 8,
+ },
+ },
+ VmfsUpgradable: false,
+ ForceMountedInfo: (*types.HostForceMountedInfo)(nil),
+ Ssd: types.NewBool(true),
+ Local: types.NewBool(true),
+ ScsiDiskType: "",
+ },
+ VStorageSupport: "vStorageUnsupported",
+ },
+ {
+ MountInfo: types.HostMountInfo{
+ Path: "/vmfs/volumes/deadbeef-01234567-89ab-cdef00000002",
+ AccessMode: "readWrite",
+ Mounted: types.NewBool(true),
+ Accessible: types.NewBool(true),
+ InaccessibleReason: "",
+ MountFailedReason: "",
+ },
+ Volume: &types.HostVmfsVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "OTHER",
+ Name: "OSDATA-deadbeef-01234567-89ab-cdef00000002",
+ Capacity: 128 * units.GB,
+ },
+ BlockSizeMb: 1,
+ BlockSize: units.KB,
+ UnmapGranularity: 0,
+ UnmapPriority: "",
+ UnmapBandwidthSpec: (*types.VmfsUnmapBandwidthSpec)(nil),
+ MaxBlocks: 256 * units.KB,
+ MajorVersion: 1,
+ Version: "1.00",
+ Uuid: "deadbeef-01234567-89ab-cdef00000002",
+ Extent: []types.HostScsiDiskPartition{
+ {
+ DiskName: "____simulated_volumes_____",
+ Partition: 7,
+ },
+ },
+ VmfsUpgradable: false,
+ ForceMountedInfo: (*types.HostForceMountedInfo)(nil),
+ Ssd: types.NewBool(true),
+ Local: types.NewBool(true),
+ ScsiDiskType: "",
+ },
+ VStorageSupport: "vStorageUnsupported",
+ },
+ {
+ MountInfo: types.HostMountInfo{
+ Path: "/vmfs/volumes/deadbeef-01234567-89ab-cdef00000001",
+ AccessMode: "readOnly",
+ Mounted: types.NewBool(true),
+ Accessible: types.NewBool(true),
+ InaccessibleReason: "",
+ MountFailedReason: "",
+ },
+ Volume: &types.HostVfatVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "OTHER",
+ Name: "BOOTBANK1",
+ Capacity: 4 * units.GB,
+ },
+ },
+ VStorageSupport: "",
+ },
+ {
+ MountInfo: types.HostMountInfo{
+ Path: "/vmfs/volumes/deadbeef-01234567-89ab-cdef00000000",
+ AccessMode: "readOnly",
+ Mounted: types.NewBool(true),
+ Accessible: types.NewBool(true),
+ InaccessibleReason: "",
+ MountFailedReason: "",
+ },
+ Volume: &types.HostVfatVolume{
+ HostFileSystemVolume: types.HostFileSystemVolume{
+ Type: "OTHER",
+ Name: "BOOTBANK2",
+ Capacity: 4 * units.GB,
+ },
+ },
+ VStorageSupport: "",
+ },
+ },
+}
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go
index fd7877b28c..d56c3b607b 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_config_info.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,7 +20,7 @@ import "github.com/vmware/govmomi/vim25/types"
// HostConfigInfo is the default template for the HostSystem config property.
// Capture method:
-// govc object.collect -s -dump HostSystem:ha-host config
+// govc object.collect -s -dump HostSystem:ha-host config
var HostConfigInfo = types.HostConfigInfo{
Host: types.ManagedObjectReference{Type: "HostSystem", Value: "ha-host"},
Product: types.AboutInfo{
@@ -50,6 +50,7 @@ var HostConfigInfo = types.HostConfigInfo{
ConsoleReservation: (*types.ServiceConsoleReservationInfo)(nil),
VirtualMachineReservation: (*types.VirtualMachineMemoryReservationInfo)(nil),
StorageDevice: &HostStorageDeviceInfo,
+ FileSystemVolume: &HostFileSystemVolumeInfo,
SystemFile: nil,
Network: &types.HostNetworkInfo{
Vswitch: []types.HostVirtualSwitch{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go
index 11c1285aad..46c5dea7e2 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_firewall_system.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,7 +20,7 @@ import "github.com/vmware/govmomi/vim25/types"
// HostFirewallInfo is the default template for the HostSystem config.firewall property.
// Capture method:
-// govc object.collect -s -dump HostSystem:ha-host config.firewall
+// govc object.collect -s -dump HostSystem:ha-host config.firewall
var HostFirewallInfo = types.HostFirewallInfo{
DynamicData: types.DynamicData{},
DefaultPolicy: types.HostFirewallDefaultPolicy{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go
index aa633ad34b..a30303fa78 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_hardware_info.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -24,7 +24,8 @@ import (
// HostHardwareInfo is the default template for the HostSystem hardware property.
// Capture method:
-// govc object.collect -s -dump HostSystem:ha-host hardware
+//
+// govc object.collect -s -dump HostSystem:ha-host hardware
var HostHardwareInfo = &types.HostHardwareInfo{
SystemInfo: types.HostSystemInfo{
Vendor: "VMware, Inc.",
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go
index 9d1ae32dd4..79033344f4 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_storage_device_info.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,7 +20,8 @@ import "github.com/vmware/govmomi/vim25/types"
// HostStorageDeviceInfo is the default template for the HostSystem config.storageDevice property.
// Capture method:
-// govc object.collect -s -dump HostSystem:ha-host config.storageDevice
+//
+// govc object.collect -s -dump HostSystem:ha-host config.storageDevice
var HostStorageDeviceInfo = types.HostStorageDeviceInfo{
HostBusAdapter: []types.BaseHostHostBusAdapter{
&types.HostParallelScsiHba{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go b/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go
index 26cd1962f6..2cd0c685d4 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/host_system.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -25,7 +25,8 @@ import (
// HostSystem is the default template for HostSystem properties.
// Capture method:
-// govc host.info -dump
+//
+// govc host.info -dump
var HostSystem = mo.HostSystem{
ManagedEntity: mo.ManagedEntity{
ExtensibleManagedObject: mo.ExtensibleManagedObject{
@@ -52,7 +53,7 @@ var HostSystem = mo.HostSystem{
DynamicData: types.DynamicData{},
ConnectionState: "connected",
PowerState: "poweredOn",
- StandbyMode: "",
+ StandbyMode: "none",
InMaintenanceMode: false,
BootTime: (*time.Time)(nil),
HealthSystemRuntime: &types.HealthSystemRuntime{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go b/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go
index 532f0ad5b9..52ce6568bd 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,7 +20,8 @@ import "github.com/vmware/govmomi/vim25/types"
// PerfCounter is the default template for the PerformanceManager perfCounter property.
// Capture method:
-// govc object.collect -s -dump PerformanceManager:ha-perfmgr perfCounter
+//
+// govc object.collect -s -dump PerformanceManager:ha-perfmgr perfCounter
var PerfCounter = []types.PerfCounterInfo{
{
Key: 0,
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager_data.go b/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager_data.go
index 8d0eaca304..45c641e7f0 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager_data.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/performance_manager_data.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2018-2023 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
+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,
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go b/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go
index 90382dd326..2373311aaa 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/resource_pool.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -25,7 +25,8 @@ import (
// ResourcePool is the default template for ResourcePool properties.
// Capture method:
-// govc pool.info "*" -dump
+//
+// govc pool.info "*" -dump
var ResourcePool = mo.ResourcePool{
ManagedEntity: mo.ManagedEntity{
ExtensibleManagedObject: mo.ExtensibleManagedObject{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go b/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go
index 3aefd1d812..1541de11a6 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/root_folder.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -23,7 +23,8 @@ import (
// RootFolder is the default template for the ServiceContent rootFolder property.
// Capture method:
-// govc folder.info -dump /
+//
+// govc folder.info -dump /
var RootFolder = mo.Folder{
ManagedEntity: mo.ManagedEntity{
ExtensibleManagedObject: mo.ExtensibleManagedObject{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go b/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go
index cc8938f878..bb10eeaa55 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/service_content.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,7 +20,8 @@ import "github.com/vmware/govmomi/vim25/types"
// ServiceContent is the default template for the ServiceInstance content property.
// Capture method:
-// govc object.collect -s -dump - content
+//
+// govc object.collect -s -dump - content
var ServiceContent = types.ServiceContent{
RootFolder: types.ManagedObjectReference{Type: "Folder", Value: "ha-folder-root"},
PropertyCollector: types.ManagedObjectReference{Type: "PropertyCollector", Value: "ha-property-collector"},
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/setting.go b/vendor/github.com/vmware/govmomi/simulator/esx/setting.go
index 757dfc039c..54ec6ead07 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/setting.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/setting.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -21,13 +21,20 @@ import "github.com/vmware/govmomi/vim25/types"
// HardwareVersion is the default VirtualMachine.Config.Version
var HardwareVersion = "vmx-13"
-// Setting is captured from ESX's HostSystem.configManager.advancedOption
+// AdvancedOptions is captured from ESX's HostSystem.configManager.advancedOption
// Capture method:
-// govc object.collect -s -dump $(govc object.collect -s HostSystem:ha-host configManager.advancedOption) setting
-var Setting = []types.BaseOptionValue{
+//
+// govc object.collect -s -dump $(govc object.collect -s HostSystem:ha-host configManager.advancedOption) setting
+var AdvancedOptions = []types.BaseOptionValue{
// This list is currently pruned to include a single option for testing
&types.OptionValue{
Key: "Config.HostAgent.log.level",
Value: "info",
},
}
+
+// Setting is captured from ESX's HostSystem.ServiceContent.setting
+// Capture method:
+//
+// govc object.collect -s -dump OptionManager:HostAgentSettings setting
+var Setting = []types.BaseOptionValue{}
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/task_manager.go b/vendor/github.com/vmware/govmomi/simulator/esx/task_manager.go
index b429ad4902..1b09aff0bd 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/task_manager.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/task_manager.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017-2018 VMware, Inc. All Rights Reserved.
+Copyright (c) 2018-2023 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
+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,
@@ -20,7 +20,8 @@ import "github.com/vmware/govmomi/vim25/types"
// Description is the default template for the TaskManager description property.
// Capture method:
-// govc object.collect -s -dump TaskManager:ha-taskmgr description
+//
+// govc object.collect -s -dump TaskManager:ha-taskmgr description
var Description = types.TaskDescription{
MethodInfo: []types.BaseElementDescription{
&types.ElementDescription{
diff --git a/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go b/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go
index 628d7e053d..a229ddceb8 100644
--- a/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go
+++ b/vendor/github.com/vmware/govmomi/simulator/esx/virtual_device.go
@@ -1,11 +1,11 @@
/*
-Copyright (c) 2017 VMware, Inc. All Rights Reserved.
+Copyright (c) 2017-2023 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
+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,
@@ -20,8 +20,9 @@ import "github.com/vmware/govmomi/vim25/types"
// VirtualDevice is the default set of VirtualDevice types created for a VirtualMachine
// Capture method:
-// govc vm.create foo
-// govc object.collect -s -dump vm/foo config.hardware.device
+//
+// govc vm.create foo
+// govc object.collect -s -dump vm/foo config.hardware.device
var VirtualDevice = []types.BaseVirtualDevice{
&types.VirtualIDEController{
VirtualController: types.VirtualController{
diff --git a/vendor/github.com/vmware/govmomi/simulator/guest_id.go b/vendor/github.com/vmware/govmomi/simulator/guest_id.go
index 87cf4aaf83..ce107a81de 100644
--- a/vendor/github.com/vmware/govmomi/simulator/guest_id.go
+++ b/vendor/github.com/vmware/govmomi/simulator/guest_id.go
@@ -53,9 +53,22 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
types.VirtualMachineGuestOsIdentifierWindows9Guest,
types.VirtualMachineGuestOsIdentifierWindows9_64Guest,
types.VirtualMachineGuestOsIdentifierWindows9Server64Guest,
+ types.VirtualMachineGuestOsIdentifierWindows11_64Guest,
+ types.VirtualMachineGuestOsIdentifierWindows12_64Guest,
types.VirtualMachineGuestOsIdentifierWindowsHyperVGuest,
+ types.VirtualMachineGuestOsIdentifierWindows2019srv_64Guest,
+ types.VirtualMachineGuestOsIdentifierWindows2019srvNext_64Guest,
+ types.VirtualMachineGuestOsIdentifierWindows2022srvNext_64Guest,
types.VirtualMachineGuestOsIdentifierFreebsdGuest,
types.VirtualMachineGuestOsIdentifierFreebsd64Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd11Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd11_64Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd12Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd12_64Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd13Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd13_64Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd14Guest,
+ types.VirtualMachineGuestOsIdentifierFreebsd14_64Guest,
types.VirtualMachineGuestOsIdentifierRedhatGuest,
types.VirtualMachineGuestOsIdentifierRhel2Guest,
types.VirtualMachineGuestOsIdentifierRhel3Guest,
@@ -68,18 +81,24 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
types.VirtualMachineGuestOsIdentifierRhel6_64Guest,
types.VirtualMachineGuestOsIdentifierRhel7Guest,
types.VirtualMachineGuestOsIdentifierRhel7_64Guest,
+ types.VirtualMachineGuestOsIdentifierRhel8_64Guest,
+ types.VirtualMachineGuestOsIdentifierRhel9_64Guest,
types.VirtualMachineGuestOsIdentifierCentosGuest,
types.VirtualMachineGuestOsIdentifierCentos64Guest,
types.VirtualMachineGuestOsIdentifierCentos6Guest,
types.VirtualMachineGuestOsIdentifierCentos6_64Guest,
types.VirtualMachineGuestOsIdentifierCentos7Guest,
types.VirtualMachineGuestOsIdentifierCentos7_64Guest,
+ types.VirtualMachineGuestOsIdentifierCentos8_64Guest,
+ types.VirtualMachineGuestOsIdentifierCentos9_64Guest,
types.VirtualMachineGuestOsIdentifierOracleLinuxGuest,
types.VirtualMachineGuestOsIdentifierOracleLinux64Guest,
types.VirtualMachineGuestOsIdentifierOracleLinux6Guest,
types.VirtualMachineGuestOsIdentifierOracleLinux6_64Guest,
types.VirtualMachineGuestOsIdentifierOracleLinux7Guest,
types.VirtualMachineGuestOsIdentifierOracleLinux7_64Guest,
+ types.VirtualMachineGuestOsIdentifierOracleLinux8_64Guest,
+ types.VirtualMachineGuestOsIdentifierOracleLinux9_64Guest,
types.VirtualMachineGuestOsIdentifierSuseGuest,
types.VirtualMachineGuestOsIdentifierSuse64Guest,
types.VirtualMachineGuestOsIdentifierSlesGuest,
@@ -90,6 +109,8 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
types.VirtualMachineGuestOsIdentifierSles11_64Guest,
types.VirtualMachineGuestOsIdentifierSles12Guest,
types.VirtualMachineGuestOsIdentifierSles12_64Guest,
+ types.VirtualMachineGuestOsIdentifierSles15_64Guest,
+ types.VirtualMachineGuestOsIdentifierSles16_64Guest,
types.VirtualMachineGuestOsIdentifierNld9Guest,
types.VirtualMachineGuestOsIdentifierOesGuest,
types.VirtualMachineGuestOsIdentifierSjdsGuest,
@@ -114,12 +135,18 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
types.VirtualMachineGuestOsIdentifierDebian9_64Guest,
types.VirtualMachineGuestOsIdentifierDebian10Guest,
types.VirtualMachineGuestOsIdentifierDebian10_64Guest,
+ types.VirtualMachineGuestOsIdentifierDebian11Guest,
+ types.VirtualMachineGuestOsIdentifierDebian11_64Guest,
+ types.VirtualMachineGuestOsIdentifierDebian12Guest,
+ types.VirtualMachineGuestOsIdentifierDebian12_64Guest,
types.VirtualMachineGuestOsIdentifierAsianux3Guest,
types.VirtualMachineGuestOsIdentifierAsianux3_64Guest,
types.VirtualMachineGuestOsIdentifierAsianux4Guest,
types.VirtualMachineGuestOsIdentifierAsianux4_64Guest,
types.VirtualMachineGuestOsIdentifierAsianux5_64Guest,
types.VirtualMachineGuestOsIdentifierAsianux7_64Guest,
+ types.VirtualMachineGuestOsIdentifierAsianux8_64Guest,
+ types.VirtualMachineGuestOsIdentifierAsianux9_64Guest,
types.VirtualMachineGuestOsIdentifierOpensuseGuest,
types.VirtualMachineGuestOsIdentifierOpensuse64Guest,
types.VirtualMachineGuestOsIdentifierFedoraGuest,
@@ -130,10 +157,16 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
types.VirtualMachineGuestOsIdentifierOther26xLinuxGuest,
types.VirtualMachineGuestOsIdentifierOtherLinuxGuest,
types.VirtualMachineGuestOsIdentifierOther3xLinuxGuest,
+ types.VirtualMachineGuestOsIdentifierOther4xLinuxGuest,
+ types.VirtualMachineGuestOsIdentifierOther5xLinuxGuest,
+ types.VirtualMachineGuestOsIdentifierOther6xLinuxGuest,
types.VirtualMachineGuestOsIdentifierGenericLinuxGuest,
types.VirtualMachineGuestOsIdentifierOther24xLinux64Guest,
types.VirtualMachineGuestOsIdentifierOther26xLinux64Guest,
types.VirtualMachineGuestOsIdentifierOther3xLinux64Guest,
+ types.VirtualMachineGuestOsIdentifierOther4xLinux64Guest,
+ types.VirtualMachineGuestOsIdentifierOther5xLinux64Guest,
+ types.VirtualMachineGuestOsIdentifierOther6xLinux64Guest,
types.VirtualMachineGuestOsIdentifierOtherLinux64Guest,
types.VirtualMachineGuestOsIdentifierSolaris6Guest,
types.VirtualMachineGuestOsIdentifierSolaris7Guest,
@@ -162,10 +195,24 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
types.VirtualMachineGuestOsIdentifierDarwin14_64Guest,
types.VirtualMachineGuestOsIdentifierDarwin15_64Guest,
types.VirtualMachineGuestOsIdentifierDarwin16_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin17_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin18_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin19_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin20_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin21_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin22_64Guest,
+ types.VirtualMachineGuestOsIdentifierDarwin23_64Guest,
types.VirtualMachineGuestOsIdentifierVmkernelGuest,
types.VirtualMachineGuestOsIdentifierVmkernel5Guest,
types.VirtualMachineGuestOsIdentifierVmkernel6Guest,
types.VirtualMachineGuestOsIdentifierVmkernel65Guest,
+ types.VirtualMachineGuestOsIdentifierVmkernel7Guest,
+ types.VirtualMachineGuestOsIdentifierVmkernel8Guest,
+ types.VirtualMachineGuestOsIdentifierAmazonlinux2_64Guest,
+ types.VirtualMachineGuestOsIdentifierAmazonlinux3_64Guest,
+ types.VirtualMachineGuestOsIdentifierCrxPod1Guest,
+ types.VirtualMachineGuestOsIdentifierRockylinux_64Guest,
+ types.VirtualMachineGuestOsIdentifierAlmalinux_64Guest,
types.VirtualMachineGuestOsIdentifierOtherGuest,
types.VirtualMachineGuestOsIdentifierOtherGuest64,
}
diff --git a/vendor/github.com/vmware/govmomi/simulator/guest_operations_manager.go b/vendor/github.com/vmware/govmomi/simulator/guest_operations_manager.go
index 780f44a040..f058835808 100644
--- a/vendor/github.com/vmware/govmomi/simulator/guest_operations_manager.go
+++ b/vendor/github.com/vmware/govmomi/simulator/guest_operations_manager.go
@@ -69,7 +69,7 @@ func guestURL(ctx *Context, vm *VirtualMachine, path string) string {
Host: "*", // See guest.FileManager.TransferURL
Path: guestPrefix + strings.TrimPrefix(path, "/"),
RawQuery: url.Values{
- "id": []string{vm.run.id},
+ "id": []string{vm.svm.c.id},
"token": []string{ctx.Session.Key},
}.Encode(),
}).String()
@@ -79,7 +79,7 @@ func (m *GuestFileManager) InitiateFileTransferToGuest(ctx *Context, req *types.
body := new(methods.InitiateFileTransferToGuestBody)
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- err := vm.run.prepareGuestOperation(vm, req.Auth)
+ err := vm.svm.prepareGuestOperation(req.Auth)
if err != nil {
body.Fault_ = Fault("", err)
return body
@@ -96,7 +96,7 @@ func (m *GuestFileManager) InitiateFileTransferFromGuest(ctx *Context, req *type
body := new(methods.InitiateFileTransferFromGuestBody)
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- err := vm.run.prepareGuestOperation(vm, req.Auth)
+ err := vm.svm.prepareGuestOperation(req.Auth)
if err != nil {
body.Fault_ = Fault("", err)
return body
@@ -126,7 +126,7 @@ func (m *GuestProcessManager) StartProgramInGuest(ctx *Context, req *types.Start
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- fault := vm.run.prepareGuestOperation(vm, auth)
+ fault := vm.svm.prepareGuestOperation(auth)
if fault != nil {
body.Fault_ = Fault("", fault)
}
@@ -141,7 +141,7 @@ func (m *GuestProcessManager) StartProgramInGuest(ctx *Context, req *types.Start
args = append(args, "-e", e)
}
- args = append(args, vm.run.id, spec.ProgramPath, spec.Arguments)
+ args = append(args, vm.svm.c.id, spec.ProgramPath, spec.Arguments)
spec.ProgramPath = "docker"
spec.Arguments = strings.Join(args, " ")
@@ -213,7 +213,7 @@ func (m *GuestFileManager) mktemp(ctx *Context, req *types.CreateTemporaryFileIn
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- return vm.run.exec(ctx, vm, req.Auth, args)
+ return vm.svm.exec(ctx, req.Auth, args)
}
func (m *GuestFileManager) CreateTemporaryFileInGuest(ctx *Context, req *types.CreateTemporaryFileInGuest) soap.HasFault {
@@ -298,7 +298,7 @@ func (m *GuestFileManager) ListFilesInGuest(ctx *Context, req *types.ListFilesIn
return body
}
- res, fault := vm.run.exec(ctx, vm, req.Auth, listFiles(req))
+ res, fault := vm.svm.exec(ctx, req.Auth, listFiles(req))
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -317,7 +317,7 @@ func (m *GuestFileManager) DeleteFileInGuest(ctx *Context, req *types.DeleteFile
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -338,7 +338,7 @@ func (m *GuestFileManager) DeleteDirectoryInGuest(ctx *Context, req *types.Delet
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -359,7 +359,7 @@ func (m *GuestFileManager) MakeDirectoryInGuest(ctx *Context, req *types.MakeDir
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -381,7 +381,7 @@ func (m *GuestFileManager) MoveFileInGuest(ctx *Context, req *types.MoveFileInGu
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -399,7 +399,7 @@ func (m *GuestFileManager) MoveDirectoryInGuest(ctx *Context, req *types.MoveDir
vm := ctx.Map.Get(req.Vm).(*VirtualMachine)
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -424,7 +424,7 @@ func (m *GuestFileManager) ChangeFileAttributesInGuest(ctx *Context, req *types.
if attr.Permissions != 0 {
args := []string{"chmod", fmt.Sprintf("%#o", attr.Permissions), req.GuestFilePath}
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
@@ -443,7 +443,7 @@ func (m *GuestFileManager) ChangeFileAttributesInGuest(ctx *Context, req *types.
if c.id != nil {
args := []string{c.cmd, fmt.Sprintf("%d", *c.id), req.GuestFilePath}
- _, fault := vm.run.exec(ctx, vm, req.Auth, args)
+ _, fault := vm.svm.exec(ctx, req.Auth, args)
if fault != nil {
body.Fault_ = Fault("", fault)
return body
diff --git a/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go b/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go
index 185ebbd853..4725203163 100644
--- a/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go
+++ b/vendor/github.com/vmware/govmomi/simulator/host_datastore_browser.go
@@ -17,7 +17,6 @@ limitations under the License.
package simulator
import (
- "io/ioutil"
"os"
"path"
"strings"
@@ -149,7 +148,7 @@ func (s *searchDatastore) queryMatch(file os.FileInfo) bool {
}
func (s *searchDatastore) search(ds *types.ManagedObjectReference, folder string, dir string) error {
- files, err := ioutil.ReadDir(dir)
+ files, err := os.ReadDir(dir)
if err != nil {
tracef("search %s: %s", dir, err)
return err
@@ -162,11 +161,11 @@ func (s *searchDatastore) search(ds *types.ManagedObjectReference, folder string
for _, file := range files {
name := file.Name()
-
- if s.queryMatch(file) {
+ info, _ := file.Info()
+ if s.queryMatch(info) {
for _, m := range s.SearchSpec.MatchPattern {
if ok, _ := path.Match(m, name); ok {
- s.addFile(file, &res)
+ s.addFile(info, &res)
break
}
}
diff --git a/vendor/github.com/vmware/govmomi/simulator/host_system.go b/vendor/github.com/vmware/govmomi/simulator/host_system.go
index f28101a8c3..fd88cb4978 100644
--- a/vendor/github.com/vmware/govmomi/simulator/host_system.go
+++ b/vendor/github.com/vmware/govmomi/simulator/host_system.go
@@ -17,8 +17,10 @@ limitations under the License.
package simulator
import (
+ "fmt"
"net"
"os"
+ "sync"
"time"
"github.com/vmware/govmomi/simulator/esx"
@@ -30,10 +32,16 @@ import (
var (
hostPortUnique = os.Getenv("VCSIM_HOST_PORT_UNIQUE") == "true"
+
+ globalLock sync.Mutex
+ // globalHostCount is used to construct unique hostnames. Should be consumed under globalLock.
+ globalHostCount = 0
)
type HostSystem struct {
mo.HostSystem
+
+ sh *simHost
}
func asHostSystemMO(obj mo.Reference) (*mo.HostSystem, bool) {
@@ -72,13 +80,23 @@ func NewHostSystem(host mo.HostSystem) *HostSystem {
deepCopy(hs.Config, cfg)
hs.Config = cfg
+ // copy over the reference advanced options so each host can have it's own, allowing hosts to be configured for
+ // container backing individually
+ deepCopy(esx.AdvancedOptions, &cfg.Option)
+
+ // add a supported option to the AdvancedOption manager
+ simOption := types.OptionDef{ElementDescription: types.ElementDescription{Key: advOptContainerBackingImage}}
+ // TODO: how do we enter patterns here? Or should we stick to a list in the value?
+ // patterns become necessary if we want to enforce correctness on options for RUN.underlay.