Skip to content

Commit 607fdc3

Browse files
committed
try to get IP of VM only when its state is Running
for crc status command to get the status of the OpenShift cluster we need the IP address of the VM but while using network-mode 'system' and a Stopped VM this fails with: Error getting ip: host is not running this checks if the VM is in Running state before trying to get the VM IP we do not the see the same error for 'user' network-mode as in that case the VM ip is always 127.0.0.1
1 parent 130a608 commit 607fdc3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

capture.pcap

24 Bytes
Binary file not shown.

pkg/crc/machine/status.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ func (client *client) Status() (*types.ClusterStatusResult, error) {
3535
return nil, errors.Wrap(err, "Cannot get machine state")
3636
}
3737

38-
ip, err := vm.IP()
39-
if err != nil {
40-
return nil, errors.Wrap(err, "Error getting ip")
38+
ip := ""
39+
if vmStatus == state.Running {
40+
ip, err = vm.IP()
41+
if err != nil {
42+
return nil, errors.Wrap(err, "Error getting ip")
43+
}
4144
}
45+
4246
ramSize, ramUse := client.getRAMStatus(vm)
4347
diskSize, diskUse := client.getDiskDetails(vm)
4448
pvSize, pvUse := client.getPVCSize(vm)

0 commit comments

Comments
 (0)