mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
Merge pull request #9468 from openshift-cherrypick-robot/cherry-pick-9456-to-release-4.18
[release-4.18] OCPBUGS-50690: vsphere - check if host is powered down or on standby before uploading template
This commit is contained in:
@@ -142,7 +142,6 @@ func importRhcosOva(ctx context.Context, session *session.Session, folder *objec
|
||||
resourcePool.Reference(),
|
||||
datastore.Reference(),
|
||||
cisp)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create import spec: %w", err)
|
||||
}
|
||||
@@ -156,7 +155,6 @@ func importRhcosOva(ctx context.Context, session *session.Session, folder *objec
|
||||
}
|
||||
|
||||
lease, err := resourcePool.ImportVApp(ctx, spec.ImportSpec, folder, hostSystem)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to import vapp: %w", err)
|
||||
}
|
||||
@@ -224,9 +222,10 @@ func findAvailableHostSystems(ctx context.Context, clusterHostSystems []*object.
|
||||
// if distributed port group the cast will fail
|
||||
networkFound := isNetworkAvailable(networkObjectRef, hostSystemManagedObject.Network)
|
||||
datastoreFound := isDatastoreAvailable(datastore, hostSystemManagedObject.Datastore)
|
||||
hasUsablePowerState := hostSystemManagedObject.Runtime.PowerState != types.HostSystemPowerStatePoweredOff && hostSystemManagedObject.Runtime.PowerState != types.HostSystemPowerStateStandBy && !hostSystemManagedObject.Runtime.InMaintenanceMode
|
||||
|
||||
// if the network or datastore is not found or the ESXi host is in maintenance mode continue the loop
|
||||
if !networkFound || !datastoreFound || hostSystemManagedObject.Runtime.InMaintenanceMode {
|
||||
// if the network or datastore is not found or the ESXi host is in maintenance mode, powered off or in StandBy (DPM) continue the loop
|
||||
if !networkFound || !datastoreFound || !hasUsablePowerState {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user