Documentation ¶
Overview ¶
The approach for providing VM policy-based integration has the following design constraints:
- Validation must never block updating the data model.
- Real-time validation is best effort.
- A scheduled search for VMs that needs to be validated ensures that all VMs eventually get validated.
Real-time validation is triggered by VM create/update model events. If the validation service is unavailable or fails, the condition is only logged with the intent that the next scheduled search will validate the latest version of VM. The scheduled search is a goroutine that periodically queries the DB for VMs with: revision != revisionValidated. Each matched VM is validated. To reduce overlap between the scheduled validation and event-driven validation, Each model event is "reported" (though a channel) to the search (loop). Reported are omitted from the search result. Both Cluster and Host model events result in all of the VMs in their respective containment trees will be updated with: revisionValidated = 0 which triggers (re)validation.
Index ¶
Constants ¶
const ( // Connect retry delay. RetryDelay = time.Second * 5 // Max object in each update. MaxObjectUpdates = 10000 )
Settings
const ( Folder = "Folder" VirtualMachine = "VirtualMachine" Datacenter = "Datacenter" Cluster = "ClusterComputeResource" ComputeResource = "ComputeResource" Host = "HostSystem" Network = "Network" DVPortGroup = "DistributedVirtualPortgroup" DVSwitch = "VmwareDistributedVirtualSwitch" Datastore = "Datastore" )
Types
const ( Enter = "enter" Leave = "leave" Modify = "modify" Assign = "assign" )
Actions
const ( // The (max) number of batched task results. MaxBatch = 1024 // Transaction label. ValidationLabel = "VM-validated" )
const ( BaseEndpoint = "/v1/data/io/konveyor/forklift/vmware/" VersionEndpoint = BaseEndpoint + "rules_version" ValidationEndpoint = BaseEndpoint + "validate" )
Endpoints.
const (
TraverseFolders = "traverseFolders"
)
Selections
Variables ¶
var Settings = &settings.Settings
Application settings.
var TsComputeResourceHost = &types.TraversalSpec{ Type: ComputeResource, Path: fHost, SelectSet: []types.BaseSelectionSpec{ &types.SelectionSpec{ Name: TraverseFolders, }, }, }
ComputeResource/Host traversal Spec.
var TsDatacenterDatastore = &types.TraversalSpec{ Type: Datacenter, Path: fDsFolder, SelectSet: []types.BaseSelectionSpec{ &types.SelectionSpec{ Name: TraverseFolders, }, }, }
Datacenter/Datastore traversal Spec.
var TsDatacenterHost = &types.TraversalSpec{ Type: Datacenter, Path: fHostFolder, SelectSet: []types.BaseSelectionSpec{ &types.SelectionSpec{ Name: TraverseFolders, }, }, }
Datacenter/Host traversal Spec.
var TsDatacenterNet = &types.TraversalSpec{ Type: Datacenter, Path: fNetFolder, SelectSet: []types.BaseSelectionSpec{ &types.SelectionSpec{ Name: TraverseFolders, }, }, }
Datacenter/Host traversal Spec.
var TsDatacenterVM = &types.TraversalSpec{ Type: Datacenter, Path: fVmFolder, SelectSet: []types.BaseSelectionSpec{ &types.SelectionSpec{ Name: TraverseFolders, }, }, }
Datacenter/VM traversal Spec.
var TsRootFolder = &types.TraversalSpec{ SelectionSpec: types.SelectionSpec{ Name: TraverseFolders, }, Type: Folder, Path: fChildEntity, SelectSet: []types.BaseSelectionSpec{ &types.SelectionSpec{ Name: TraverseFolders, }, TsComputeResourceHost, TsDatacenterVM, TsDatacenterHost, TsDatacenterNet, TsDatacenterDatastore, }, }
Root Folder traversal Spec
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface { // The adapter model. Model() model.Model // Apply the update to the model. Apply(types.ObjectUpdate) }
Model adapter. Each adapter provides provider-specific management of a model.
type Base ¶
type Base struct { }
Base adapter.
func (*Base) Apply ¶
func (b *Base) Apply(m *model.Base, u types.ObjectUpdate)
Apply the update to the model `Base`.
type ClusterAdapter ¶
type ClusterAdapter struct { Base // contains filtered or unexported fields }
Cluster model adapter.
func (*ClusterAdapter) Apply ¶
func (v *ClusterAdapter) Apply(u types.ObjectUpdate)
type ClusterEventHandler ¶
type ClusterEventHandler struct { libmodel.StockEventHandler // DB. DB libmodel.DB // contains filtered or unexported fields }
Watch for cluster changes and validate as needed.
func (*ClusterEventHandler) Updated ¶
func (r *ClusterEventHandler) Updated(event libmodel.Event)
Cluster updated. Analyze all related VMs.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
A VMWare collector.
type DVSwitchAdapter ¶
type DVSwitchAdapter struct { Base // contains filtered or unexported fields }
DVSwitch model adapter.
func (*DVSwitchAdapter) Apply ¶
func (v *DVSwitchAdapter) Apply(u types.ObjectUpdate)
Apply the update to the model.
type DatacenterAdapter ¶
type DatacenterAdapter struct { Base // contains filtered or unexported fields }
Datacenter model adapter.
func (*DatacenterAdapter) Apply ¶
func (v *DatacenterAdapter) Apply(u types.ObjectUpdate)
Apply the update to the model.
func (*DatacenterAdapter) Model ¶
func (v *DatacenterAdapter) Model() model.Model
The adapter model.
type DatastoreAdapter ¶
type DatastoreAdapter struct { Base // contains filtered or unexported fields }
Datastore model adapter.
func (*DatastoreAdapter) Apply ¶
func (v *DatastoreAdapter) Apply(u types.ObjectUpdate)
Apply the update to the model.
type FolderAdapter ¶
type FolderAdapter struct { Base // contains filtered or unexported fields }
Folder model adapter.
func (*FolderAdapter) Apply ¶
func (v *FolderAdapter) Apply(u types.ObjectUpdate)
Apply the update to the model.
type HostAdapter ¶
type HostAdapter struct { Base // contains filtered or unexported fields }
Host model adapter.
func (*HostAdapter) Apply ¶
func (v *HostAdapter) Apply(u types.ObjectUpdate)
type HostEventHandler ¶
type HostEventHandler struct { libmodel.StockEventHandler // DB. DB libmodel.DB // contains filtered or unexported fields }
Watch for host changes and validate as needed.
func (*HostEventHandler) Updated ¶
func (r *HostEventHandler) Updated(event libmodel.Event)
Host updated. Analyze all related VMs.
type NetworkAdapter ¶
type NetworkAdapter struct { Base // contains filtered or unexported fields }
Network model adapter.
func (*NetworkAdapter) Apply ¶
func (v *NetworkAdapter) Apply(u types.ObjectUpdate)
Apply the update to the model.
type VMEventHandler ¶
type VMEventHandler struct { libmodel.StockEventHandler // Provider. Provider *api.Provider // DB. DB libmodel.DB // contains filtered or unexported fields }
Watch for VM changes and validate as needed.
func (*VMEventHandler) Created ¶
func (r *VMEventHandler) Created(event libmodel.Event)
VM Created. The VM is scheduled (and reported as scheduled). This is best-effort. If the validate() fails, it wil be picked up in the next search().
func (*VMEventHandler) Updated ¶
func (r *VMEventHandler) Updated(event libmodel.Event)
VM Updated. The VM is scheduled (and reported as scheduled). This is best-effort. If the validate() fails, it wil be picked up in the next search().