Skip to content

Commit

Permalink
Get previous disk usage only from existing machine configs (#6700)
Browse files Browse the repository at this point in the history
Co-authored-by: Abhay Krishna Arunachalam <arnchlm@amazon.com>
  • Loading branch information
eks-distro-pr-bot and abhay-krishna authored Sep 19, 2023
1 parent 0100084 commit b07acd0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/providers/vsphere/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,14 @@ type datastoreUsage struct {
}

func (p *vsphereProvider) getPrevMachineConfigDatastoreUsage(ctx context.Context, machineConfig *v1alpha1.VSphereMachineConfig, cluster *types.Cluster, count int) (diskGiB float64, err error) {
em, err := p.providerKubectlClient.GetEksaVSphereMachineConfig(ctx, machineConfig.Name, cluster.KubeconfigFile, machineConfig.GetNamespace())
if err != nil {
return 0, err
}
if em != nil {
return float64(em.Spec.DiskGiB * count), nil
if count > 0 {
em, err := p.providerKubectlClient.GetEksaVSphereMachineConfig(ctx, machineConfig.Name, cluster.KubeconfigFile, machineConfig.GetNamespace())
if err != nil {
return 0, err
}
if em != nil {
return float64(em.Spec.DiskGiB * count), nil
}
}
return 0, nil
}
Expand Down

0 comments on commit b07acd0

Please sign in to comment.