Skip to content

Commit dda5646

Browse files
author
vietanhduong
committed
fix incorrect state
Signed-off-by: vietanhduong <anh.duong@kyber.network>
1 parent ed4b2d0 commit dda5646

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/gcloud/vm/vm.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,15 @@ func StartInstance(vm *apis.Vm) error {
6969
if vm.GetState() != "TERMINATED" && vm.GetState() != "SUSPENDED" {
7070
return errors.Errorf("instance is incorrect state (%s)", vm.GetState())
7171
}
72+
73+
var cmd = "start"
74+
if vm.GetState() == "SUSPENDED" {
75+
cmd = "resume"
76+
}
7277
_, err := exec.Run(exec.Command("gcloud",
7378
"compute",
7479
"instances",
75-
"start", vm.GetName(),
80+
cmd, vm.GetName(),
7681
"--project", vm.GetProject(),
7782
"--zone", vm.GetZone()))
7883
return err

0 commit comments

Comments
 (0)