Skip to content

Commit 1ff171d

Browse files
jayantpatil1234yadvr
authored andcommitted
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.
1 parent d94a5be commit 1ff171d

File tree

72 files changed

+166
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+166
-118
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public long getEntityOwnerId() {
106106

107107
@Override
108108
public void execute() {
109-
CallContext.current().setEventDetails("Virtual router element Id: " + getEntityId());
109+
CallContext.current().setEventDetails("Virtual router element Id: " + getEntityUuid());
110110
VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId());
111111
if (result != null) {
112112
VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
@@ -137,6 +137,6 @@ public String getEventType() {
137137

138138
@Override
139139
public String getEventDescription() {
140-
return "Adding physical network ServiceProvider Virtual Router: " + getEntityId();
140+
return "Adding physical network ServiceProvider Virtual Router: " + getEntityUuid();
141141
}
142142
}

api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public String getEventType() {
8282

8383
@Override
8484
public String getEventDescription() {
85-
return "destroying router: " + getId();
85+
return "destroying router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId());
8686
}
8787

8888
@Override
@@ -98,7 +98,7 @@ public Long getInstanceId() {
9898
@Override
9999
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
100100
CallContext ctx = CallContext.current();
101-
ctx.setEventDetails("Router Id: " + getId());
101+
ctx.setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()));
102102

103103
VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId());
104104
if (result != null) {

api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public String getEventType() {
8383

8484
@Override
8585
public String getEventDescription() {
86-
return "rebooting router: " + getId();
86+
return "rebooting router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId());
8787
}
8888

8989
@Override
@@ -98,7 +98,7 @@ public Long getInstanceId() {
9898

9999
@Override
100100
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
101-
CallContext.current().setEventDetails("Router Id: " + getId());
101+
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()));
102102
VirtualRouter result = _routerService.rebootRouter(getId(), true);
103103
if (result != null) {
104104
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);

api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public String getEventType() {
8989

9090
@Override
9191
public String getEventDescription() {
92-
return "starting router: " + getId();
92+
return "starting router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
9393
}
9494

9595
@Override
@@ -104,7 +104,7 @@ public Long getInstanceId() {
104104

105105
@Override
106106
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
107-
CallContext.current().setEventDetails("Router Id: " + getId());
107+
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
108108
VirtualRouter result = null;
109109
VirtualRouter router = _routerService.findRouter(getId());
110110
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {

api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public String getEventType() {
8787

8888
@Override
8989
public String getEventDescription() {
90-
return "stopping router: " + getId();
90+
return "Stopping router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
9191
}
9292

9393
@Override
@@ -106,7 +106,7 @@ public boolean isForced() {
106106

107107
@Override
108108
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
109-
CallContext.current().setEventDetails("Router Id: " + getId());
109+
CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
110110
VirtualRouter result = null;
111111
VirtualRouter router = _routerService.findRouter(getId());
112112
if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public String getEventType() {
8484

8585
@Override
8686
public String getEventDescription() {
87-
return "destroying system vm: " + getId();
87+
return "destroying system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
8888
}
8989

9090
@Override
@@ -99,7 +99,7 @@ public Long getInstanceId() {
9999

100100
@Override
101101
public void execute() {
102-
CallContext.current().setEventDetails("Vm Id: " + getId());
102+
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
103103
VirtualMachine instance = _mgr.destroySystemVM(this);
104104
if (instance != null) {
105105
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public String getEventType() {
104104

105105
@Override
106106
public String getEventDescription() {
107-
return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId();
107+
return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId());
108108
}
109109

110110
@Override
@@ -115,7 +115,7 @@ public void execute() {
115115
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
116116
}
117117
try {
118-
CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId());
118+
CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()));
119119
//FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
120120
VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
121121
if (migratedVm != null) {

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public String getEventType() {
9191

9292
@Override
9393
public String getEventDescription() {
94-
return "rebooting system vm: " + getId();
94+
return "rebooting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
9595
}
9696

9797
@Override
@@ -106,7 +106,7 @@ public Long getInstanceId() {
106106

107107
@Override
108108
public void execute() {
109-
CallContext.current().setEventDetails("Vm Id: " + getId());
109+
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
110110
VirtualMachine result = _mgr.rebootSystemVM(this);
111111
if (result != null) {
112112
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public long getEntityOwnerId() {
101101

102102
@Override
103103
public void execute() {
104-
CallContext.current().setEventDetails("SystemVm Id: " + getId());
104+
CallContext.current().setEventDetails("SystemVm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
105105

106106
ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
107107
if (serviceOffering == null) {
@@ -140,6 +140,6 @@ public String getEventType() {
140140

141141
@Override
142142
public String getEventDescription() {
143-
return "Upgrading system vm: " + getId() + " to service offering: " + getServiceOfferingId();
143+
return "Upgrading system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId());
144144
}
145145
}

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public String getEventType() {
9595

9696
@Override
9797
public String getEventDescription() {
98-
return "starting system vm: " + getId();
98+
return "starting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId());
9999
}
100100

101101
@Override
@@ -110,7 +110,7 @@ public Long getInstanceId() {
110110

111111
@Override
112112
public void execute() {
113-
CallContext.current().setEventDetails("Vm Id: " + getId());
113+
CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
114114
VirtualMachine instance = _mgr.startSystemVM(getId());
115115
if (instance != null) {
116116
SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);

0 commit comments

Comments
 (0)