Skip to content

Commit

Permalink
don't try to get IP of VM when its not running
Browse files Browse the repository at this point in the history
for crc status command to get some VM information like
disk-usage, pv count, etc. we need to SSH into the  VM
but this is only possible when the VM is running

in case the state of the VM is not Running it will now
return early without trying to fetch those  additional
information which results in the following error:

Error getting ip: host is not running
  • Loading branch information
anjannath committed Dec 18, 2024
1 parent 130a608 commit c684e67
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/crc/machine/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func (client *client) Status() (*types.ClusterStatusResult, error) {
return nil, errors.Wrap(err, "Cannot get machine state")
}

if vmStatus != state.Running {
return createClusterStatusResult(vmStatus, vm.bundle.GetBundleType(), vm.bundle.GetVersion(), "", 0, 0, 0, 0, 0, 0, nil)
}

ip, err := vm.IP()
if err != nil {
return nil, errors.Wrap(err, "Error getting ip")
Expand Down

0 comments on commit c684e67

Please sign in to comment.