Compare commits

...

3 Commits

Author SHA1 Message Date
Erik Böck 5c61268929
Merge e72afc0895 into 420bf6dff8 2026-01-22 14:25:45 +00:00
erikbocks e72afc0895 remove unused import and fix tests 2026-01-22 11:25:33 -03:00
erikbocks b419a77fd8 standardize events and fix rebase errors 2026-01-22 09:26:01 -03:00
36 changed files with 39 additions and 40 deletions

View File

@ -142,6 +142,6 @@ public class ExecuteClusterDrsPlanCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return String.format("Executing DRS plan for cluster: %d", getResourceUuid(ApiConstants.ID)); return "Executing DRS plan for cluster with ID: " + getResourceUuid(ApiConstants.ID);
} }
} }

View File

@ -140,7 +140,7 @@ public class GetDiagnosticsDataCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Getting diagnostics data files from System VM with ID: " + getResourceUuid(ApiConstants.TARGET_ID); return "Getting diagnostics data files from System Instance with ID: " + getResourceUuid(ApiConstants.TARGET_ID);
} }
@Override @Override

View File

@ -153,7 +153,7 @@ public class RunDiagnosticsCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Executing diagnostics on System VM with ID: " + getResourceUuid(ApiConstants.TARGET_ID); return "Executing diagnostics on System Instance with ID: " + getResourceUuid(ApiConstants.TARGET_ID);
} }
@Override @Override

View File

@ -85,7 +85,7 @@ public class CreateIpv4SubnetForGuestNetworkCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Creating guest IPv4 subnet " + getSubnet() + " in zone subnet=" + getResourceUuid(ApiConstants.PARENT_ID); return "Creating guest IPv4 subnet " + getSubnet() + " in zone subnet: " + getResourceUuid(ApiConstants.PARENT_ID);
} }
@Override @Override

View File

@ -115,7 +115,7 @@ public class MigrateNetworkCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
String description = "Migrating network with ID: " + getResourceUuid(ApiConstants.NETWORK_ID); String description = "Migrating Network with ID: " + getResourceUuid(ApiConstants.NETWORK_ID);
if (getNetworkOfferingId() != null) { if (getNetworkOfferingId() != null) {
Network network = _networkService.getNetwork(getId()); Network network = _networkService.getNetwork(getId());
if (network == null) { if (network == null) {
@ -128,7 +128,7 @@ public class MigrateNetworkCmd extends BaseAsyncCmd {
throw new InvalidParameterValueException("Network offering id supplied is invalid"); throw new InvalidParameterValueException("Network offering id supplied is invalid");
} }
description += ". Original network offering id: " + oldOff.getUuid() + ", new network offering id: " + newOff.getUuid(); description += ". Original Network Offering id: " + oldOff.getUuid() + ", new Network Offering id: " + newOff.getUuid();
} }
} }

View File

@ -100,7 +100,7 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Updating physical network ServiceProvider with ID: " + getResourceUuid(ApiConstants.ID); return "Updating Physical Network ServiceProvider with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -98,7 +98,7 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Updating Physical network: " + getResourceUuid(ApiConstants.ID); return "Updating Physical Network with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -93,7 +93,7 @@ public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Update storage IP range " + getResourceUuid(ApiConstants.ID) + " [StartIp=" + getStartIp() + ", EndIp=" + getEndIp() + ", vlan=" + getVlan() + ", netmask=" + getNetmask() + ']'; return "Updating storage IP range " + getResourceUuid(ApiConstants.ID) + " [StartIp=" + getStartIp() + ", EndIp=" + getEndIp() + ", VLAN=" + getVlan() + ", netmask=" + getNetmask() + ']';
} }
@Override @Override

View File

@ -80,7 +80,7 @@ public class ChangeBgpPeersForNetworkCmd extends BaseAsyncCmd implements AdminCm
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Changing BGP Peers for network with ID: " + getResourceUuid(ApiConstants.NETWORK_ID); return "Changing BGP Peers for Network with ID: " + getResourceUuid(ApiConstants.NETWORK_ID);
} }
@Override @Override

View File

@ -79,7 +79,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Stopping router with ID: " + getResourceUuid(ApiConstants.ID); return "Stopping virtual router with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -76,7 +76,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Destroying system Instance with ID: " + getResourceUuid(ApiConstants.ID); return "Destroying System VM with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override
@ -98,7 +98,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy System VM");
} }
} }
} }

View File

@ -120,7 +120,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Attempting to migrate Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to host with ID: " + getResourceUuid(ApiConstants.HOST_ID); return "Attempting to migrate System VM with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to host with ID: " + getResourceUuid(ApiConstants.HOST_ID);
} }
@Override @Override

View File

@ -86,7 +86,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Rebooting system VM with ID: " + getResourceUuid(ApiConstants.ID); return "Rebooting System VM with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override
@ -112,7 +112,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot System Instance");
} }
} }
} }

View File

@ -137,6 +137,6 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Upgrading system vm: " + getResourceUuid(ApiConstants.ID) + " to service offering: " + getResourceUuid(ApiConstants.SERVICE_OFFERING_ID); return "Upgrading System VM with ID: " + getResourceUuid(ApiConstants.ID) + " to service offering: " + getResourceUuid(ApiConstants.SERVICE_OFFERING_ID);
} }
} }

View File

@ -87,7 +87,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Starting system VM with ID: " + getResourceUuid(ApiConstants.ID); return "Starting System VM with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -100,7 +100,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot System VM");
} }
} }
} }

View File

@ -160,7 +160,7 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "creating AutoScale Policy"; return "Creating AutoScale Policy";
} }
@Override @Override

View File

@ -185,7 +185,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Configuring AutoScale Instance Group. Instance Group Id: " + getEntityId(); return "Configuring AutoScale Instance Group with ID: " + getEntityId();
} }
@Override @Override

View File

@ -127,7 +127,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "creating a condition"; return "Creating AutoScale condition";
} }
@Override @Override

View File

@ -89,7 +89,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Deleting autoscale Instance group with ID: " + getResourceUuid(ApiConstants.ID); return "Deleting AutoScale Instance group with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -79,7 +79,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Deleting autoscale Instance profile with ID: " + getResourceUuid(ApiConstants.ID); return "Deleting AutoScale Instance profile with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -100,6 +100,6 @@ public class DeleteConditionCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Deleting auto scaling condition with ID: " + getResourceUuid(ApiConstants.ID); return "Deleting AutoScale condition with ID: " + getResourceUuid(ApiConstants.ID);
} }
} }

View File

@ -130,7 +130,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Updating Auto Scale Policy with ID: " + getResourceUuid(ApiConstants.ID); return "Updating AutoScale Policy with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -151,7 +151,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Updating AutoScale Instance Group. Instance Group Id: " + getId(); return "Updating AutoScale Instance Group with ID: " + getId();
} }
@Override @Override

View File

@ -190,7 +190,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Updating AutoScale Instance Profile. Instance Profile Id: " + getId(); return "Updating AutoScale Instance Profile with ID: " + getId();
} }
@Override @Override

View File

@ -110,6 +110,6 @@ public class UpdateConditionCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Updating VM auto scaling condition with ID: " + getResourceUuid(ApiConstants.ID); return "Updating Instance AutoScale condition with ID: " + getResourceUuid(ApiConstants.ID);
} }
} }

View File

@ -28,7 +28,6 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.BackupResponse; import org.apache.cloudstack.api.response.BackupResponse;
import org.apache.cloudstack.backup.Backup;
import org.apache.cloudstack.backup.BackupManager; import org.apache.cloudstack.backup.BackupManager;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;

View File

@ -76,10 +76,10 @@ public class ReplaceNetworkACLListCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
String description = "Associating network ACL with ID:" + getResourceUuid(ApiConstants.ACL_ID); String description = "Associating Network ACL with ID:" + getResourceUuid(ApiConstants.ACL_ID);
if (getNetworkId() != null) { if (getNetworkId() != null) {
description += " to network with ID:" + getResourceUuid(ApiConstants.NETWORK_ID); description += " to Network with ID:" + getResourceUuid(ApiConstants.NETWORK_ID);
} }
return description; return description;

View File

@ -115,7 +115,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Restarting network with ID: " + getResourceUuid(ApiConstants.ID); return "Restarting Network with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -96,7 +96,7 @@ public class ExtractSnapshotCmd extends BaseAsyncCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Starting snapshot extraction for snapshot with ID: " + getResourceUuid(ApiConstants.ID); return "Starting Snapshot extraction for Snapshot with ID: " + getResourceUuid(ApiConstants.ID);
} }
@Override @Override

View File

@ -136,7 +136,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd implements UserCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
String description = "Copying template: " + getResourceUuid(ApiConstants.ID); String description = "Copying Template: " + getResourceUuid(ApiConstants.ID);
if (getSourceZoneId() != null) { if (getSourceZoneId() != null) {
description += " from zone: " + getResourceUuid(ApiConstants.SOURCE_ZONE_ID); description += " from zone: " + getResourceUuid(ApiConstants.SOURCE_ZONE_ID);

View File

@ -121,7 +121,7 @@ public class AddNicToVMCmd extends BaseAsyncCmd implements UserCmd {
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "Adding NIC on network " + getResourceUuid(ApiConstants.NETWORK_ID) + " to User Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); return "Adding NIC on Network " + getResourceUuid(ApiConstants.NETWORK_ID) + " to User Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID);
} }
@Override @Override

View File

@ -57,7 +57,7 @@ public class CreateIpv4SubnetForGuestNetworkCmdTest {
Assert.assertEquals(cidrSize, cmd.getCidrSize()); Assert.assertEquals(cidrSize, cmd.getCidrSize());
Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(1L, cmd.getEntityOwnerId());
Assert.assertEquals(EventTypes.EVENT_IP4_GUEST_SUBNET_CREATE, cmd.getEventType()); Assert.assertEquals(EventTypes.EVENT_IP4_GUEST_SUBNET_CREATE, cmd.getEventType());
Assert.assertEquals(String.format("Creating guest IPv4 subnet %s in zone subnet=%s", subnet, parentUuid), cmd.getEventDescription()); Assert.assertEquals(String.format("Creating guest IPv4 subnet %s in zone subnet: %s", subnet, parentUuid), cmd.getEventDescription());
Ipv4GuestSubnetNetworkMap ipv4GuestSubnetNetworkMap = Mockito.mock(Ipv4GuestSubnetNetworkMap.class); Ipv4GuestSubnetNetworkMap ipv4GuestSubnetNetworkMap = Mockito.mock(Ipv4GuestSubnetNetworkMap.class);
Mockito.when(routedIpv4Manager.createIpv4SubnetForGuestNetwork(cmd)).thenReturn(ipv4GuestSubnetNetworkMap); Mockito.when(routedIpv4Manager.createIpv4SubnetForGuestNetwork(cmd)).thenReturn(ipv4GuestSubnetNetworkMap);

View File

@ -61,7 +61,7 @@ public class ChangeBgpPeersForNetworkCmdTest {
Assert.assertEquals(bgpPeerIds, cmd.getBgpPeerIds()); Assert.assertEquals(bgpPeerIds, cmd.getBgpPeerIds());
Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(1L, cmd.getEntityOwnerId());
Assert.assertEquals(EventTypes.EVENT_NETWORK_BGP_PEER_UPDATE, cmd.getEventType()); Assert.assertEquals(EventTypes.EVENT_NETWORK_BGP_PEER_UPDATE, cmd.getEventType());
Assert.assertEquals(String.format("Changing BGP Peers for network with ID: %s", networkUuid), cmd.getEventDescription()); Assert.assertEquals(String.format("Changing BGP Peers for Network with ID: %s", networkUuid), cmd.getEventDescription());
Network network = Mockito.mock(Network.class); Network network = Mockito.mock(Network.class);
Mockito.when(routedIpv4Manager.changeBgpPeersForNetwork(cmd)).thenReturn(network); Mockito.when(routedIpv4Manager.changeBgpPeersForNetwork(cmd)).thenReturn(network);

View File

@ -100,7 +100,7 @@ public class UpdateAutoScaleVmProfileCmdTest {
Assert.assertEquals("updateautoscalevmprofileresponse", updateAutoScaleVmProfileCmd.getCommandName()); Assert.assertEquals("updateautoscalevmprofileresponse", updateAutoScaleVmProfileCmd.getCommandName());
Assert.assertEquals(EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE, updateAutoScaleVmProfileCmd.getEventType()); Assert.assertEquals(EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE, updateAutoScaleVmProfileCmd.getEventType());
Assert.assertEquals("Updating AutoScale Instance Profile. Instance Profile Id: " + profileId, updateAutoScaleVmProfileCmd.getEventDescription()); Assert.assertEquals("Updating AutoScale Instance Profile with ID: " + profileId, updateAutoScaleVmProfileCmd.getEventDescription());
} }
@Test @Test

View File

@ -89,7 +89,7 @@ public class UpdateConditionCmdTest {
Assert.assertEquals(ApiCommandResourceType.Condition, updateConditionCmd.getApiResourceType()); Assert.assertEquals(ApiCommandResourceType.Condition, updateConditionCmd.getApiResourceType());
Assert.assertEquals("updateconditionresponse", updateConditionCmd.getCommandName()); Assert.assertEquals("updateconditionresponse", updateConditionCmd.getCommandName());
Assert.assertEquals(EventTypes.EVENT_CONDITION_UPDATE, updateConditionCmd.getEventType()); Assert.assertEquals(EventTypes.EVENT_CONDITION_UPDATE, updateConditionCmd.getEventType());
Assert.assertEquals("Updating VM auto scaling condition with ID: " + conditionUuid, updateConditionCmd.getEventDescription()); Assert.assertEquals("Updating Instance AutoScale condition with ID: " + conditionUuid, updateConditionCmd.getEventDescription());
when(entityMgr.findById(Condition.class, conditionId)).thenReturn(condition); when(entityMgr.findById(Condition.class, conditionId)).thenReturn(condition);
when(condition.getAccountId()).thenReturn(accountId); when(condition.getAccountId()).thenReturn(accountId);