mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): add power states check in some cases (#15323)
This commit is contained in:
@@ -70,7 +70,8 @@ import (
|
||||
|
||||
func (self *SGuest) GetDetailsVnc(ctx context.Context, userCred mcclient.TokenCredential, input *cloudprovider.ServerVncInput) (*cloudprovider.ServerVncOutput, error) {
|
||||
ret := &cloudprovider.ServerVncOutput{}
|
||||
if utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM, api.VM_MIGRATING}) {
|
||||
if self.PowerStates == api.VM_POWER_STATES_ON ||
|
||||
utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM, api.VM_MIGRATING}) {
|
||||
host, err := self.GetHost()
|
||||
if err != nil {
|
||||
return nil, httperrors.NewInternalServerError(errors.Wrapf(err, "GetHost").Error())
|
||||
@@ -116,7 +117,8 @@ func (self *SGuest) PerformMonitor(
|
||||
query jsonutils.JSONObject,
|
||||
input *api.ServerMonitorInput,
|
||||
) (jsonutils.JSONObject, error) {
|
||||
if utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM, api.VM_MIGRATING}) {
|
||||
if self.PowerStates == api.VM_POWER_STATES_ON ||
|
||||
utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM, api.VM_MIGRATING}) {
|
||||
if input.COMMAND == "" {
|
||||
return nil, httperrors.NewMissingParameterError("command")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user