region: guests: sshable: only check sshable state when in running state

This commit is contained in:
Yousong Zhou
2021-04-12 17:35:03 +08:00
parent 188cac1fdb
commit 042a572818
+4
View File
@@ -72,6 +72,10 @@ func (guest *SGuest) GetDetailsSshable(
userCred mcclient.TokenCredential,
query jsonutils.JSONObject,
) (jsonutils.JSONObject, error) {
if guest.Status != compute_api.VM_RUNNING {
return nil, httperrors.NewBadRequestError("server sshable state can only be checked when in running state")
}
tryData := &GuestSshableTryData{
User: "cloudroot",
}