diff --git a/pkg/infrastructure/vsphere/clusterapi/import.go b/pkg/infrastructure/vsphere/clusterapi/import.go index e83faf4068..ae9a32a206 100644 --- a/pkg/infrastructure/vsphere/clusterapi/import.go +++ b/pkg/infrastructure/vsphere/clusterapi/import.go @@ -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 }