Skip to content

Commit 2b578ae

Browse files
Added events for snapshots, vmsnapshots, internalLB operations
1 parent 06c80cd commit 2b578ae

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,9 @@ public Long getSyncObjId() {
210210
}
211211
return null;
212212
}
213+
214+
@Override
215+
public Long getApiResourceId() {
216+
return getEntityId();
217+
}
213218
}

plugins/network-elements/internal-loadbalancer/src/main/java/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import javax.inject.Inject;
2727
import javax.naming.ConfigurationException;
2828

29+
import com.cloud.event.ActionEvent;
30+
import com.cloud.event.EventTypes;
2931
import org.apache.cloudstack.context.CallContext;
3032
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
3133
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
@@ -540,6 +542,7 @@ public boolean destroyInternalLbVm(final long vmId, final Account caller, final
540542
}
541543

542544
@Override
545+
@ActionEvent(eventType = EventTypes.EVENT_INTERNAL_LB_VM_STOP, eventDescription = "stopping internal LB VM", async = true)
543546
public VirtualRouter stopInternalLbVm(final long vmId, final boolean forced, final Account caller, final long callerUserId) throws ConcurrentOperationException, ResourceUnavailableException {
544547
final DomainRouterVO internalLbVm = _internalLbVmDao.findById(vmId);
545548
if (internalLbVm == null || internalLbVm.getRole() != Role.INTERNAL_LB_VM) {
@@ -928,6 +931,7 @@ protected boolean sendCommandsToInternalLbVm(final VirtualRouter internalLbVm, f
928931
}
929932

930933
@Override
934+
@ActionEvent(eventType = EventTypes.EVENT_INTERNAL_LB_VM_START, eventDescription = "starting internal LB VM", async = true)
931935
public VirtualRouter startInternalLbVm(final long internalLbVmId, final Account caller, final long callerUserId) throws StorageUnavailableException, InsufficientCapacityException,
932936
ConcurrentOperationException, ResourceUnavailableException {
933937

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,8 @@ public Cluster updateCluster(UpdateClusterCmd cmd) {
12511251
}
12521252

12531253
@Override
1254+
@DB
1255+
@ActionEvent(eventType = EventTypes.EVENT_MAINTENANCE_CANCEL, eventDescription = "cancel maintenance for host", async = true)
12541256
public Host cancelMaintenance(final CancelMaintenanceCmd cmd) {
12551257
final Long hostId = cmd.getId();
12561258

@@ -1274,6 +1276,8 @@ public Host cancelMaintenance(final CancelMaintenanceCmd cmd) {
12741276
}
12751277

12761278
@Override
1279+
@DB
1280+
@ActionEvent(eventType = EventTypes.EVENT_HOST_RECONNECT, eventDescription = "reconnecting host", async = true)
12771281
public Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException {
12781282
Long hostId = cmd.getId();
12791283

@@ -1344,7 +1348,6 @@ private boolean doMaintain(final long hostId) {
13441348
throw new CloudRuntimeException(err + e.getMessage());
13451349
}
13461350

1347-
ActionEventUtils.onStartedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventTypes.EVENT_MAINTENANCE_PREPARE, "starting maintenance for host " + hostId, hostId, null, true, 0);
13481351
_agentMgr.pullAgentToMaintenance(hostId);
13491352

13501353
/* TODO: move below to listener */
@@ -1472,6 +1475,8 @@ public boolean maintain(final long hostId) throws AgentUnavailableException {
14721475
}
14731476

14741477
@Override
1478+
@DB
1479+
@ActionEvent(eventType = EventTypes.EVENT_MAINTENANCE_PREPARE, eventDescription = "maintenance for host", async = true)
14751480
public Host maintain(final PrepareForMaintenanceCmd cmd) {
14761481
final Long hostId = cmd.getId();
14771482
final HostVO host = _hostDao.findById(hostId);

server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ public Snapshot archiveSnapshot(Long snapshotId) {
492492
}
493493

494494
@Override
495+
@DB
496+
@ActionEvent(eventType = EventTypes.EVENT_SNAPSHOT_CREATE, eventDescription = "creating snapshot from VM snapshot", async = true)
495497
public Snapshot backupSnapshotFromVmSnapshot(Long snapshotId, Long vmId, Long volumeId, Long vmSnapshotId) {
496498
VMInstanceVO vm = _vmDao.findById(vmId);
497499
if (vm == null) {

0 commit comments

Comments
 (0)