From c684e6736b815a1f50d9bd74f6258a33780e71ce Mon Sep 17 00:00:00 2001 From: Anjan Nath Date: Wed, 18 Dec 2024 16:10:27 +0530 Subject: [PATCH] don't try to get IP of VM when its not running 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 --- pkg/crc/machine/status.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/crc/machine/status.go b/pkg/crc/machine/status.go index 783ed6085f..dbb9dfec92 100644 --- a/pkg/crc/machine/status.go +++ b/pkg/crc/machine/status.go @@ -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")