mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-9781: record resource uuid in events instead of integer id (#1940)
This changes several event logging to use uuid of resource than integer id when creating API events.
This commit is contained in:
parent
d94a5bea3c
commit
1ff171db90
@ -106,7 +106,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Virtual router element Id: " + getEntityId());
|
CallContext.current().setEventDetails("Virtual router element Id: " + getEntityUuid());
|
||||||
VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId());
|
VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
|
VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
|
||||||
@ -137,6 +137,6 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Adding physical network ServiceProvider Virtual Router: " + getEntityId();
|
return "Adding physical network ServiceProvider Virtual Router: " + getEntityUuid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "destroying router: " + getId();
|
return "destroying router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,7 +98,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
||||||
CallContext ctx = CallContext.current();
|
CallContext ctx = CallContext.current();
|
||||||
ctx.setEventDetails("Router Id: " + getId());
|
ctx.setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()));
|
||||||
|
|
||||||
VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId());
|
VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public class RebootRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "rebooting router: " + getId();
|
return "rebooting router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,7 +98,7 @@ public class RebootRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||||
CallContext.current().setEventDetails("Router Id: " + getId());
|
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()));
|
||||||
VirtualRouter result = _routerService.rebootRouter(getId(), true);
|
VirtualRouter result = _routerService.rebootRouter(getId(), true);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
|
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class StartRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "starting router: " + getId();
|
return "starting router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,7 +104,7 @@ public class StartRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||||
CallContext.current().setEventDetails("Router Id: " + getId());
|
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
VirtualRouter result = null;
|
VirtualRouter result = null;
|
||||||
VirtualRouter router = _routerService.findRouter(getId());
|
VirtualRouter router = _routerService.findRouter(getId());
|
||||||
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
|
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
|
||||||
|
|||||||
@ -87,7 +87,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "stopping router: " + getId();
|
return "Stopping router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -106,7 +106,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
|
||||||
CallContext.current().setEventDetails("Router Id: " + getId());
|
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
VirtualRouter result = null;
|
VirtualRouter result = null;
|
||||||
VirtualRouter router = _routerService.findRouter(getId());
|
VirtualRouter router = _routerService.findRouter(getId());
|
||||||
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
|
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "destroying system vm: " + getId();
|
return "destroying system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,7 +99,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
VirtualMachine instance = _mgr.destroySystemVM(this);
|
VirtualMachine instance = _mgr.destroySystemVM(this);
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
|
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
|
||||||
|
|||||||
@ -104,7 +104,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId();
|
return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,7 +115,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
|
|||||||
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
|
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId());
|
CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()));
|
||||||
//FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
|
//FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
|
||||||
VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
|
VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
|
||||||
if (migratedVm != null) {
|
if (migratedVm != null) {
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "rebooting system vm: " + getId();
|
return "rebooting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -106,7 +106,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
VirtualMachine result = _mgr.rebootSystemVM(this);
|
VirtualMachine result = _mgr.rebootSystemVM(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
|
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("SystemVm Id: " + getId());
|
CallContext.current().setEventDetails("SystemVm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
|
|
||||||
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
||||||
if (serviceOffering == null) {
|
if (serviceOffering == null) {
|
||||||
@ -140,6 +140,6 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Upgrading system vm: " + getId() + " to service offering: " + getServiceOfferingId();
|
return "Upgrading system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "starting system vm: " + getId();
|
return "starting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -110,7 +110,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
VirtualMachine instance = _mgr.startSystemVM(getId());
|
VirtualMachine instance = _mgr.startSystemVM(getId());
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
|
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
|
||||||
|
|||||||
@ -97,7 +97,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "stopping system vm: " + getId();
|
return "stopping system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -116,7 +116,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
|
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
VirtualMachine result = _mgr.stopSystemVM(this);
|
VirtualMachine result = _mgr.stopSystemVM(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
|
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
|
|
||||||
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
||||||
if (serviceOffering == null) {
|
if (serviceOffering == null) {
|
||||||
|
|||||||
@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.template;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cloud.storage.Snapshot;
|
||||||
|
import com.cloud.storage.Volume;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -38,7 +40,7 @@ public class CreateTemplateCmdByAdmin extends CreateTemplateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
|
CallContext.current().setEventDetails("Template Id: " + getEntityUuid()+((getSnapshotId() == null) ? " from volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) : " from snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
|
||||||
VirtualMachineTemplate template = null;
|
VirtualMachineTemplate template = null;
|
||||||
template = _templateService.createPrivateTemplate(this);
|
template = _templateService.createPrivateTemplate(this);
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.vm;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import com.cloud.network.Network;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -41,7 +42,7 @@ public class AddNicToVMCmdByAdmin extends AddNicToVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getVmId() + " Network Id: " + getNetworkId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()));
|
||||||
UserVm result = _userVmService.addNicToVirtualMachine(this);
|
UserVm result = _userVmService.addNicToVirtualMachine(this);
|
||||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||||
dc.add(VMDetails.valueOf("nics"));
|
dc.add(VMDetails.valueOf("nics"));
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class DeployVMCmdByAdmin extends DeployVMCmd {
|
|||||||
|
|
||||||
if (getStartVm()) {
|
if (getStartVm()) {
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getEntityId());
|
CallContext.current().setEventDetails("Vm Id: " + getEntityUuid());
|
||||||
result = _userVmService.startVirtualMachine(this);
|
result = _userVmService.startVirtualMachine(this);
|
||||||
} catch (ResourceUnavailableException ex) {
|
} catch (ResourceUnavailableException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class DestroyVMCmdByAdmin extends DestroyVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
|
public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getId());
|
CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result = _userVmService.destroyVm(this);
|
UserVm result = _userVmService.destroyVm(this);
|
||||||
|
|
||||||
UserVmResponse response = new UserVmResponse();
|
UserVmResponse response = new UserVmResponse();
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class ExpungeVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Expunging vm: " + getId();
|
return "Expunging vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,7 +104,7 @@ public class ExpungeVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
|
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
try {
|
try {
|
||||||
UserVm result = _userVmService.expungeVm(this.getId());
|
UserVm result = _userVmService.expungeVm(this.getId());
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,13 @@ public class MigrateVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId();
|
if (getHostId() != null) {
|
||||||
|
return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
|
||||||
|
} else if (getStoragePoolId() != null) {
|
||||||
|
return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId());
|
||||||
|
} else {
|
||||||
|
return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -146,7 +152,7 @@ public class MigrateVMCmd extends BaseAsyncCmd {
|
|||||||
if (destinationHost.getType() != Host.Type.Routing) {
|
if (destinationHost.getType() != Host.Type.Routing) {
|
||||||
throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the VM, please specify another one");
|
throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the VM, please specify another one");
|
||||||
}
|
}
|
||||||
CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId());
|
CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + ((getHostId() != null) ? " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()) : "" ));
|
||||||
}
|
}
|
||||||
|
|
||||||
StoragePool destStoragePool = null;
|
StoragePool destStoragePool = null;
|
||||||
@ -155,7 +161,7 @@ public class MigrateVMCmd extends BaseAsyncCmd {
|
|||||||
if (destStoragePool == null) {
|
if (destStoragePool == null) {
|
||||||
throw new InvalidParameterValueException("Unable to find the storage pool to migrate the VM");
|
throw new InvalidParameterValueException("Unable to find the storage pool to migrate the VM");
|
||||||
}
|
}
|
||||||
CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to storage pool Id: " + getStoragePoolId());
|
CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId();
|
return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class RebootVMCmdByAdmin extends RebootVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getId());
|
CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result;
|
UserVm result;
|
||||||
result = _userVmService.rebootVirtualMachine(this);
|
result = _userVmService.rebootVirtualMachine(this);
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.vm;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import com.cloud.vm.Nic;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -40,7 +41,7 @@ public class RemoveNicFromVMCmdByAdmin extends RemoveNicFromVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId());
|
CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
|
||||||
UserVm result = _userVmService.removeNicFromVirtualMachine(this);
|
UserVm result = _userVmService.removeNicFromVirtualMachine(this);
|
||||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||||
dc.add(VMDetails.valueOf("nics"));
|
dc.add(VMDetails.valueOf("nics"));
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class RestoreVMCmdByAdmin extends RestoreVMCmd {
|
|||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||||
ResourceAllocationException {
|
ResourceAllocationException {
|
||||||
UserVm result;
|
UserVm result;
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getVmId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()));
|
||||||
result = _userVmService.restoreVM(this);
|
result = _userVmService.restoreVM(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
|
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class StartVMCmdByAdmin extends StartVMCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ResourceAllocationException {
|
public void execute() throws ResourceUnavailableException, ResourceAllocationException {
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
|
|
||||||
UserVm result ;
|
UserVm result ;
|
||||||
result = _userVmService.startVirtualMachine(this);
|
result = _userVmService.startVirtualMachine(this);
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class StopVMCmdByAdmin extends StopVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ServerApiException, ConcurrentOperationException {
|
public void execute() throws ServerApiException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result;
|
UserVm result;
|
||||||
|
|
||||||
result = _userVmService.stopVirtualMachine(getId(), isForced());
|
result = _userVmService.stopVirtualMachine(getId(), isForced());
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.vm;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import com.cloud.vm.Nic;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -41,7 +42,7 @@ public class UpdateDefaultNicForVMCmdByAdmin extends UpdateDefaultNicForVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId());
|
CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
|
||||||
UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
|
UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
|
||||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||||
dc.add(VMDetails.valueOf("nics"));
|
dc.add(VMDetails.valueOf("nics"));
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class UpdateVMCmdByAdmin extends UpdateVMCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException,
|
public void execute() throws ResourceUnavailableException,
|
||||||
InsufficientCapacityException, ServerApiException {
|
InsufficientCapacityException, ServerApiException {
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getId());
|
CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result = _userVmService.updateVirtualMachine(this);
|
UserVm result = _userVmService.updateVirtualMachine(this);
|
||||||
if (result != null){
|
if (result != null){
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
|
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class UpgradeVMCmdByAdmin extends UpgradeVMCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceAllocationException{
|
public void execute() throws ResourceAllocationException{
|
||||||
CallContext.current().setEventDetails("Vm Id: "+getId());
|
CallContext.current().setEventDetails("Vm Id: "+this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
|
|
||||||
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
||||||
if (serviceOffering == null) {
|
if (serviceOffering == null) {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.admin.vmsnapshot;
|
|||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.cloud.vm.snapshot.VMSnapshot;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||||
@ -42,7 +43,7 @@ public class RevertToVMSnapshotCmdByAdmin extends RevertToVMSnapshotCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails(
|
CallContext.current().setEventDetails(
|
||||||
"vmsnapshot id: " + getVmSnapShotId());
|
"vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId()));
|
||||||
UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
|
UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full,
|
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full,
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class AttachVolumeCmdByAdmin extends AttachVolumeCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
|
CallContext.current().setEventDetails("Volume Id: "+this._uuidMgr.getUuid(Volume.class, getId())+" VmId: "+this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()));
|
||||||
Volume result = _volumeService.attachVolumeToVM(this);
|
Volume result = _volumeService.attachVolumeToVM(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
|
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class CreateVolumeCmdByAdmin extends CreateVolumeCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Volume Id: "+getEntityId()+((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()));
|
CallContext.current().setEventDetails("Volume Id: "+ getEntityUuid() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
|
||||||
Volume volume = _volumeService.createVolume(this);
|
Volume volume = _volumeService.createVolume(this);
|
||||||
if (volume != null) {
|
if (volume != null) {
|
||||||
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
|
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class DetachVolumeCmdByAdmin extends DetachVolumeCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
|
CallContext.current().setEventDetails(getEventDescription());
|
||||||
Volume result = _volumeService.detachVolumeFromVM(this);
|
Volume result = _volumeService.detachVolumeFromVM(this);
|
||||||
if (result != null){
|
if (result != null){
|
||||||
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
|
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class ResizeVolumeCmdByAdmin extends ResizeVolumeCmd {
|
|||||||
public void execute() throws ResourceAllocationException{
|
public void execute() throws ResourceAllocationException{
|
||||||
Volume volume = null;
|
Volume volume = null;
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G");
|
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + "G");
|
||||||
volume = _volumeService.resizeVolume(this);
|
volume = _volumeService.resizeVolume(this);
|
||||||
} catch (InvalidParameterValueException ex) {
|
} catch (InvalidParameterValueException ex) {
|
||||||
s_logger.info(ex.getMessage());
|
s_logger.info(ex.getMessage());
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class UpdateVolumeCmdByAdmin extends UpdateVolumeCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
CallContext.current().setEventDetails("Volume Id: "+getId());
|
CallContext.current().setEventDetails("Volume Id: "+this._uuidMgr.getUuid(Volume.class, getId()));
|
||||||
Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
|
Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
|
||||||
getCustomId(), getEntityOwnerId(), getChainInfo());
|
getCustomId(), getEntityOwnerId(), getChainInfo());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@ -112,14 +112,6 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||||||
return snapshotName;
|
return snapshotName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVolumeUuid() {
|
|
||||||
Volume volume = _entityMgr.findById(Volume.class, getVolumeId());
|
|
||||||
if (volume == null) {
|
|
||||||
throw new InvalidParameterValueException("Unable to find volume's UUID");
|
|
||||||
}
|
|
||||||
return volume.getUuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getPolicyId() {
|
public Long getPolicyId() {
|
||||||
if (policyId != null) {
|
if (policyId != null) {
|
||||||
return policyId;
|
return policyId;
|
||||||
@ -179,7 +171,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "creating snapshot for volume: " + getVolumeUuid();
|
return "creating snapshot for volume: " + this._uuidMgr.getUuid(Volume.class, getVolumeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -151,7 +151,7 @@ public class CreateSnapshotFromVMSnapshotCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "creating snapshot from vm snapshot : " + getVMSnapshotId();
|
return "creating snapshot from vm snapshot : " + this._uuidMgr.getUuid(VMSnapshot.class, getVMSnapshotId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -173,7 +173,7 @@ public class CreateSnapshotFromVMSnapshotCmd extends BaseAsyncCreateCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
s_logger.info("CreateSnapshotFromVMSnapshotCmd with vm snapshot id:" + getVMSnapshotId() + " and snapshot id:" + getEntityId() + " starts:" + System.currentTimeMillis());
|
s_logger.info("CreateSnapshotFromVMSnapshotCmd with vm snapshot id:" + getVMSnapshotId() + " and snapshot id:" + getEntityId() + " starts:" + System.currentTimeMillis());
|
||||||
CallContext.current().setEventDetails("Vm Snapshot Id: "+ getVMSnapshotId());
|
CallContext.current().setEventDetails("Vm Snapshot Id: "+ this._uuidMgr.getUuid(VMSnapshot.class, getVMSnapshotId()));
|
||||||
Snapshot snapshot = null;
|
Snapshot snapshot = null;
|
||||||
try {
|
try {
|
||||||
snapshot = _snapshotService.backupSnapshotFromVmSnapshot(getEntityId(), getVmId(), getVolumeId(), getVMSnapshotId());
|
snapshot = _snapshotService.backupSnapshotFromVmSnapshot(getEntityId(), getVmId(), getVolumeId(), getVMSnapshotId());
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "deleting snapshot: " + getId();
|
return "deleting snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,7 +99,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Snapshot Id: " + getId());
|
CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getId()));
|
||||||
boolean result = _snapshotService.deleteSnapshot(getId());
|
boolean result = _snapshotService.deleteSnapshot(getId());
|
||||||
if (result) {
|
if (result) {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class RevertSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "revert snapshot: " + getId();
|
return "revert snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -97,7 +97,7 @@ public class RevertSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Snapshot Id: " + getId());
|
CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getId()));
|
||||||
Snapshot snapshot = _snapshotService.revertSnapshot(getId());
|
Snapshot snapshot = _snapshotService.revertSnapshot(getId());
|
||||||
if (snapshot != null) {
|
if (snapshot != null) {
|
||||||
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
|
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.template;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cloud.dc.DataCenter;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -94,6 +95,10 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getDestinationZoneId() {
|
||||||
|
return destZoneId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -133,8 +138,19 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "copying template: " + getId() + " from zone: " + getSourceZoneId()
|
StringBuilder descBuilder = new StringBuilder();
|
||||||
+ " to zone: " + getDestinationZoneIds();
|
if (getDestinationZoneIds() != null) {
|
||||||
|
|
||||||
|
for (Long destId : getDestinationZoneIds()) {
|
||||||
|
descBuilder.append(", ");
|
||||||
|
descBuilder.append(this._uuidMgr.getUuid(DataCenter.class, destId));
|
||||||
|
}
|
||||||
|
if (descBuilder.length() > 0) {
|
||||||
|
descBuilder.deleteCharAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "copying template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) +((getSourceZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getSourceZoneId()) : "") + ((descBuilder.length() > 0) ? " to zones: " + descBuilder.toString() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -293,7 +293,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails(
|
CallContext.current().setEventDetails(
|
||||||
"Template Id: " + getEntityId() + ((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
|
"Template Id: " + getEntityUuid() + ((getSnapshotId() == null) ? " from volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) : " from snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
|
||||||
VirtualMachineTemplate template = null;
|
VirtualMachineTemplate template = null;
|
||||||
template = _templateService.createPrivateTemplate(this);
|
template = _templateService.createPrivateTemplate(this);
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Deleting template " + getId();
|
return "Deleting template " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,7 +115,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Template Id: " + getId());
|
CallContext.current().setEventDetails("Template Id: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()));
|
||||||
boolean result = _templateService.deleteTemplate(this);
|
boolean result = _templateService.deleteTemplate(this);
|
||||||
if (result) {
|
if (result) {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.api.command.user.template;
|
package org.apache.cloudstack.api.command.user.template;
|
||||||
|
|
||||||
|
import com.cloud.dc.DataCenter;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -113,7 +114,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "extracting template: " + getId() + " from zone: " + getZoneId();
|
return "extracting template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) + ((getZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()) : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -105,7 +105,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "associating ip to nic id=" + getNicId() + " belonging to network id=" + getNetworkId();
|
return "associating ip to nic id=" + this._uuidMgr.getUuid(Nic.class, getNicId()) + " belonging to network id=" + this._uuidMgr.getUuid(Network.class, getNetworkId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -124,11 +124,11 @@ public class AddIpToVmNicCmd extends BaseAsyncCreateCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
|
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
|
||||||
|
|
||||||
CallContext.current().setEventDetails("Nic Id: " + getNicId());
|
CallContext.current().setEventDetails("Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
|
||||||
NicSecondaryIp result = _entityMgr.findById(NicSecondaryIp.class, getEntityId());
|
NicSecondaryIp result = _entityMgr.findById(NicSecondaryIp.class, getEntityId());
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
CallContext.current().setEventDetails("secondary Ip Id: " + getEntityId());
|
CallContext.current().setEventDetails("secondary Ip Id: " + getEntityUuid());
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
success = _networkService.configureNicSecondaryIp(result, isZoneSGEnabled());
|
success = _networkService.configureNicSecondaryIp(result, isZoneSGEnabled());
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.EnumSet;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.cloud.network.Network;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
@ -121,7 +122,7 @@ public class AddNicToVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Adding network " + getNetworkId() + " to user vm: " + getVmId();
|
return "Adding network " + this._uuidMgr.getUuid(Network.class, getNetworkId()) + " to user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -157,7 +158,7 @@ public class AddNicToVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getVmId() + " Network Id: " + getNetworkId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()));
|
||||||
UserVm result = _userVmService.addNicToVirtualMachine(this);
|
UserVm result = _userVmService.addNicToVirtualMachine(this);
|
||||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||||
dc.add(VMDetails.valueOf("nics"));
|
dc.add(VMDetails.valueOf("nics"));
|
||||||
|
|||||||
@ -522,7 +522,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "starting Vm. Vm Id: " + getEntityId();
|
return "starting Vm. Vm Id: " + getEntityUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -536,7 +536,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
|
|||||||
|
|
||||||
if (getStartVm()) {
|
if (getStartVm()) {
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getEntityId());
|
CallContext.current().setEventDetails("Vm Id: " + getEntityUuid());
|
||||||
result = _userVmService.startVirtualMachine(this);
|
result = _userVmService.startVirtualMachine(this);
|
||||||
} catch (ResourceUnavailableException ex) {
|
} catch (ResourceUnavailableException ex) {
|
||||||
s_logger.warn("Exception: ", ex);
|
s_logger.warn("Exception: ", ex);
|
||||||
|
|||||||
@ -104,7 +104,7 @@ public class DestroyVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "destroying vm: " + getId();
|
return "destroying vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,7 +119,7 @@ public class DestroyVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
|
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result = _userVmService.destroyVm(this);
|
UserVm result = _userVmService.destroyVm(this);
|
||||||
|
|
||||||
UserVmResponse response = new UserVmResponse();
|
UserVmResponse response = new UserVmResponse();
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public class RebootVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "rebooting user vm: " + getId();
|
return "rebooting user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -101,7 +101,7 @@ public class RebootVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result;
|
UserVm result;
|
||||||
result = _userVmService.rebootVirtualMachine(this);
|
result = _userVmService.rebootVirtualMachine(this);
|
||||||
if (result !=null){
|
if (result !=null){
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import com.cloud.vm.Nic;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
@ -89,7 +90,7 @@ public class RemoveNicFromVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Removing NIC " + getNicId() + " from user vm: " + getVmId();
|
return "Removing NIC " + this._uuidMgr.getUuid(Nic.class, getNicId()) + " from user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -103,7 +104,7 @@ public class RemoveNicFromVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getVmId() + " Nic Id: " + getNicId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
|
||||||
UserVm result = _userVmService.removeNicFromVirtualMachine(this);
|
UserVm result = _userVmService.removeNicFromVirtualMachine(this);
|
||||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||||
dc.add(VMDetails.valueOf("nics"));
|
dc.add(VMDetails.valueOf("nics"));
|
||||||
|
|||||||
@ -72,7 +72,7 @@ public class RestoreVMCmd extends BaseAsyncCmd {
|
|||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||||
ResourceAllocationException {
|
ResourceAllocationException {
|
||||||
UserVm result;
|
UserVm result;
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getVmId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()));
|
||||||
result = _userVmService.restoreVM(this);
|
result = _userVmService.restoreVM(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
|
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.cloud.offering.ServiceOffering;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
@ -129,7 +130,7 @@ public class ScaleVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "upgrading vm: " + getId() + " to service offering: " + getServiceOfferingId();
|
return "upgrading vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,4 +160,4 @@ public class ScaleVMCmd extends BaseAsyncCmd {
|
|||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ public class StartVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "starting user vm: " + getId();
|
return "starting user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -133,7 +133,7 @@ public class StartVMCmd extends BaseAsyncCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, ResourceAllocationException {
|
public void execute() throws ResourceUnavailableException, ResourceAllocationException {
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
|
|
||||||
UserVm result;
|
UserVm result;
|
||||||
result = _userVmService.startVirtualMachine(this);
|
result = _userVmService.startVirtualMachine(this);
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public class StopVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "stopping user vm: " + getId();
|
return "stopping user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,7 +115,7 @@ public class StopVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ServerApiException, ConcurrentOperationException {
|
public void execute() throws ServerApiException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result;
|
UserVm result;
|
||||||
|
|
||||||
result = _userVmService.stopVirtualMachine(getId(), isForced());
|
result = _userVmService.stopVirtualMachine(getId(), isForced());
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import com.cloud.vm.Nic;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
@ -90,7 +91,7 @@ public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Updating NIC " + getNicId() + " on user vm: " + getVmId();
|
return "Updating NIC " + this._uuidMgr.getUuid(Nic.class, getNicId()) + " on user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,7 +105,7 @@ public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getVmId() + " Nic Id: " + getNicId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId()));
|
||||||
UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
|
UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
|
||||||
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
|
||||||
dc.add(VMDetails.valueOf("nics"));
|
dc.add(VMDetails.valueOf("nics"));
|
||||||
|
|||||||
@ -250,7 +250,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
UserVm result = _userVmService.updateVirtualMachine(this);
|
UserVm result = _userVmService.updateVirtualMachine(this);
|
||||||
if (result != null){
|
if (result != null){
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
|
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
|
||||||
|
|||||||
@ -126,7 +126,7 @@ public class UpdateVmNicIpCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "associating ip to nic id: " + getNetworkId() + " in zone " + getZoneId();
|
return "associating ip to nic id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()) + " in zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -119,7 +119,7 @@ public class UpgradeVMCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceAllocationException {
|
public void execute() throws ResourceAllocationException {
|
||||||
CallContext.current().setEventDetails("Vm Id: " + getId());
|
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
|
||||||
|
|
||||||
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
|
||||||
if (serviceOffering == null) {
|
if (serviceOffering == null) {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vmsnapshot;
|
|||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
import org.apache.cloudstack.api.ACL;
|
import org.apache.cloudstack.api.ACL;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -99,7 +100,7 @@ public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "creating snapshot for VM: " + getVmId();
|
return "creating snapshot for VM: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,7 +110,7 @@ public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("VM Id: " + getVmId());
|
CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()));
|
||||||
VMSnapshot result = _vmSnapshotService.createVMSnapshot(getVmId(), getEntityId(), getQuiescevm());
|
VMSnapshot result = _vmSnapshotService.createVMSnapshot(getVmId(), getEntityId(), getQuiescevm());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
VMSnapshotResponse response = _responseGenerator.createVMSnapshotResponse(result);
|
VMSnapshotResponse response = _responseGenerator.createVMSnapshotResponse(result);
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public class DeleteVMSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("vmsnapshot id: " + getId());
|
CallContext.current().setEventDetails("vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getId()));
|
||||||
boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
|
boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
|
||||||
if (result) {
|
if (result) {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
@ -81,7 +81,7 @@ public class DeleteVMSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Delete VM snapshot: " + getId();
|
return "Delete VM snapshot: " + this._uuidMgr.getUuid(VMSnapshot.class, getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class RevertToVMSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
|
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("vmsnapshot id: " + getVmSnapShotId());
|
CallContext.current().setEventDetails("vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId()));
|
||||||
UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
|
UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted,
|
UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted,
|
||||||
@ -88,7 +88,7 @@ public class RevertToVMSnapshotCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Revert from VM snapshot: " + getVmSnapShotId();
|
return "Revert from VM snapshot: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -111,12 +111,12 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "attaching volume: " + getId() + " to vm: " + getVirtualMachineId();
|
return "attaching volume: " + this._uuidMgr.getUuid(Volume.class, getId()) + " to vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getId() + " VmId: " + getVirtualMachineId());
|
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()) + " VmId: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()));
|
||||||
Volume result = _volumeService.attachVolumeToVM(this);
|
Volume result = _volumeService.attachVolumeToVM(this);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
|
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
|
||||||
|
|||||||
@ -203,7 +203,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "creating volume: " + getVolumeName() + ((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId());
|
return "creating volume: " + getVolumeName() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -220,7 +220,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getEntityId() + ((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()));
|
CallContext.current().setEventDetails("Volume Id: " + getEntityUuid() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())));
|
||||||
Volume volume = _volumeService.createVolume(this);
|
Volume volume = _volumeService.createVolume(this);
|
||||||
if (volume != null) {
|
if (volume != null) {
|
||||||
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
|
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
|
||||||
|
|||||||
@ -81,7 +81,7 @@ public class DeleteVolumeCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ConcurrentOperationException {
|
public void execute() throws ConcurrentOperationException {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getId());
|
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
|
||||||
boolean result = _volumeService.deleteVolume(id, CallContext.current().getCallingAccount());
|
boolean result = _volumeService.deleteVolume(id, CallContext.current().getCallingAccount());
|
||||||
if (result) {
|
if (result) {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
|
|||||||
@ -129,9 +129,9 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
|
|||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
sb.append(": " + id);
|
sb.append(": " + this._uuidMgr.getUuid(Volume.class, id));
|
||||||
} else if ((deviceId != null) && (virtualMachineId != null)) {
|
} else if ((deviceId != null) && (virtualMachineId != null)) {
|
||||||
sb.append(" with device id: " + deviceId + " from vm: " + virtualMachineId);
|
sb.append(" with device id: " + deviceId + " from vm: " + ((getVirtualMachineId() != null) ? this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) : "" ));
|
||||||
} else {
|
} else {
|
||||||
sb.append(" <error: either volume id or deviceId/vmId need to be specified>");
|
sb.append(" <error: either volume id or deviceId/vmId need to be specified>");
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getId() + " VmId: " + getVirtualMachineId());
|
CallContext.current().setEventDetails(getEventDescription());
|
||||||
Volume result = _volumeService.detachVolumeFromVM(this);
|
Volume result = _volumeService.detachVolumeFromVM(this);
|
||||||
if (result != null){
|
if (result != null){
|
||||||
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
|
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
|
||||||
|
|||||||
@ -133,7 +133,7 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getId());
|
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
|
||||||
String uploadUrl = _volumeService.extractVolume(this);
|
String uploadUrl = _volumeService.extractVolume(this);
|
||||||
if (uploadUrl != null) {
|
if (uploadUrl != null) {
|
||||||
ExtractResponse response = new ExtractResponse();
|
ExtractResponse response = new ExtractResponse();
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.api.command.user.volume;
|
package org.apache.cloudstack.api.command.user.volume;
|
||||||
|
|
||||||
|
import com.cloud.storage.StoragePool;
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.ApiErrorCode;
|
import org.apache.cloudstack.api.ApiErrorCode;
|
||||||
@ -98,7 +99,7 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Attempting to migrate volume Id: " + getVolumeId() + " to storage pool Id: " + getStoragePoolId();
|
return "Attempting to migrate volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNewDiskOfferingUuid() {
|
public String getNewDiskOfferingUuid() {
|
||||||
|
|||||||
@ -163,14 +163,14 @@ public class ResizeVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "Volume Id: " + getEntityId() + " to size " + getSize() + "G";
|
return "Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + "G";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() throws ResourceAllocationException {
|
public void execute() throws ResourceAllocationException {
|
||||||
Volume volume = null;
|
Volume volume = null;
|
||||||
try {
|
try {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G");
|
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + "G");
|
||||||
volume = _volumeService.resizeVolume(this);
|
volume = _volumeService.resizeVolume(this);
|
||||||
} catch (InvalidParameterValueException ex) {
|
} catch (InvalidParameterValueException ex) {
|
||||||
s_logger.info(ex.getMessage());
|
s_logger.info(ex.getMessage());
|
||||||
|
|||||||
@ -154,7 +154,7 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CallContext.current().setEventDetails("Volume Id: " + getId());
|
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
|
||||||
Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
|
Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
|
||||||
getCustomId(), getEntityOwnerId(), getChainInfo());
|
getCustomId(), getEntityOwnerId(), getChainInfo());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.api.command.user.volume;
|
package org.apache.cloudstack.api.command.user.volume;
|
||||||
|
|
||||||
|
import com.cloud.dc.DataCenter;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
@ -169,7 +170,7 @@ public class UploadVolumeCmd extends BaseAsyncCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return "uploading volume: " + getVolumeName() + " in the zone " + getZoneId();
|
return "uploading volume: " + getVolumeName() + " in the zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -485,7 +485,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId());
|
volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId());
|
||||||
volume.setFormat(ImageFormat.valueOf(format));
|
volume.setFormat(ImageFormat.valueOf(format));
|
||||||
volume = _volsDao.persist(volume);
|
volume = _volsDao.persist(volume);
|
||||||
CallContext.current().setEventDetails("Volume Id: " + volume.getId());
|
CallContext.current().setEventDetails("Volume Id: " + volume.getUuid());
|
||||||
|
|
||||||
// Increment resource count during allocation; if actual creation fails,
|
// Increment resource count during allocation; if actual creation fails,
|
||||||
// decrement it
|
// decrement it
|
||||||
@ -753,7 +753,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
Volume.class.getName(), volume.getUuid(), displayVolume);
|
Volume.class.getName(), volume.getUuid(), displayVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallContext.current().setEventDetails("Volume Id: " + volume.getId());
|
CallContext.current().setEventDetails("Volume Id: " + volume.getUuid());
|
||||||
|
|
||||||
// Increment resource count during allocation; if actual creation fails,
|
// Increment resource count during allocation; if actual creation fails,
|
||||||
// decrement it
|
// decrement it
|
||||||
|
|||||||
@ -1128,7 +1128,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||||||
if (isoId == null) {
|
if (isoId == null) {
|
||||||
throw new InvalidParameterValueException("The specified VM has no ISO attached to it.");
|
throw new InvalidParameterValueException("The specified VM has no ISO attached to it.");
|
||||||
}
|
}
|
||||||
CallContext.current().setEventDetails("Vm Id: " + vmId + " ISO Id: " + isoId);
|
CallContext.current().setEventDetails("Vm Id: " + userVM.getUuid() + " ISO Id: " + isoId);
|
||||||
|
|
||||||
State vmState = userVM.getState();
|
State vmState = userVM.getState();
|
||||||
if (vmState != State.Running && vmState != State.Stopped) {
|
if (vmState != State.Running && vmState != State.Stopped) {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.Identity;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
@ -111,4 +112,17 @@ public class UUIDManagerImpl implements UUIDManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> String getUuid(Class<T> entityType, Long customId) {
|
||||||
|
if (customId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Identity identity = (Identity) this._entityMgr.findById(entityType, customId);
|
||||||
|
if (identity == null) {
|
||||||
|
throw new InvalidParameterValueException("Unable to find UUID for id " + customId);
|
||||||
|
}
|
||||||
|
return identity.getUuid();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1581,7 +1581,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
|
|
||||||
Long vmId = cmd.getId();
|
Long vmId = cmd.getId();
|
||||||
Long newServiceOfferingId = cmd.getServiceOfferingId();
|
Long newServiceOfferingId = cmd.getServiceOfferingId();
|
||||||
CallContext.current().setEventDetails("Vm Id: " + vmId);
|
VirtualMachine vm = (VirtualMachine) this._entityMgr.findById(VirtualMachine.class, vmId);
|
||||||
|
if (vm == null) {
|
||||||
|
throw new InvalidParameterValueException("Unable to find VM's UUID");
|
||||||
|
}
|
||||||
|
CallContext.current().setEventDetails("Vm Id: " + vm.getUuid());
|
||||||
|
|
||||||
boolean result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getDetails());
|
boolean result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getDetails());
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -3768,7 +3772,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Successfully allocated DB entry for " + vm);
|
s_logger.debug("Successfully allocated DB entry for " + vm);
|
||||||
}
|
}
|
||||||
CallContext.current().setEventDetails("Vm Id: " + vm.getId());
|
CallContext.current().setEventDetails("Vm Id: " + vm.getUuid());
|
||||||
|
|
||||||
if (!offering.isDynamic()) {
|
if (!offering.isDynamic()) {
|
||||||
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE, accountId, zone.getId(), vm.getId(), vm.getHostName(), offering.getId(), template.getId(),
|
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE, accountId, zone.getId(), vm.getId(), vm.getHostName(), offering.getId(), template.getId(),
|
||||||
|
|||||||
@ -45,4 +45,6 @@ public interface UUIDManager {
|
|||||||
* .
|
* .
|
||||||
*/
|
*/
|
||||||
<T> void checkUuidSimple(String uuid, Class<T> entityType);
|
<T> void checkUuidSimple(String uuid, Class<T> entityType);
|
||||||
|
|
||||||
|
public <T> String getUuid(Class<T> entityType, Long customId);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user