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

This commit is contained in:
Yousong Zhou
2021-04-12 17:33:42 +08:00
parent ba71fcaaa2
commit 460e54c919
+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",
}