use of com.cloud.api.response.SystemVmResponse in project CloudStack-archive by CloudStack-extras.
the class RebootSystemVmCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Vm Id: " + getId());
VirtualMachine result = _mgr.rebootSystemVM(this);
if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
}
}
use of com.cloud.api.response.SystemVmResponse in project CloudStack-archive by CloudStack-extras.
the class UpgradeSystemVMCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Vm Id: " + getId());
ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);
if (serviceOffering == null) {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
}
VirtualMachine result = _mgr.upgradeSystemVM(this);
if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
}
}
use of com.cloud.api.response.SystemVmResponse in project CloudStack-archive by CloudStack-extras.
the class ListSystemVMsCmd method execute.
@Override
public void execute() {
List<? extends VirtualMachine> systemVMs = _mgr.searchForSystemVm(this);
ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
for (VirtualMachine systemVM : systemVMs) {
SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
vmResponse.setObjectName("systemvm");
vmResponses.add(vmResponse);
}
response.setResponses(vmResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.SystemVmResponse in project CloudStack-archive by CloudStack-extras.
the class DestroySystemVmCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Vm Id: " + getId());
VirtualMachine instance = _mgr.destroySystemVM(this);
if (instance != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm");
}
}
use of com.cloud.api.response.SystemVmResponse in project cosmic by MissionCriticalCloud.
the class ScaleSystemVMCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("SystemVm Id: " + getId());
final ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
if (serviceOffering == null) {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
}
VirtualMachine result = null;
try {
result = _mgr.upgradeSystemVM(this);
} catch (final ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (final ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (final ManagementServerException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (final VirtualMachineMigrationException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
if (result != null) {
final SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade system vm");
}
}
Aggregations