mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
This commit is contained in:
parent
37f4a120fd
commit
832db1b398
31
api/src/com/cloud/event/ActionEvents.java
Normal file
31
api/src/com/cloud/event/ActionEvents.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package com.cloud.event;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.*;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target({ TYPE, METHOD })
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface ActionEvents {
|
||||||
|
ActionEvent[] value();
|
||||||
|
}
|
||||||
@ -42,7 +42,9 @@ public class CallContext {
|
|||||||
private String contextId;
|
private String contextId;
|
||||||
private Account account;
|
private Account account;
|
||||||
private long startEventId = 0;
|
private long startEventId = 0;
|
||||||
|
private String eventDescription;
|
||||||
private String eventDetails;
|
private String eventDetails;
|
||||||
|
private String eventType;
|
||||||
private User user;
|
private User user;
|
||||||
private final Map<Object, Object> context = new HashMap<Object, Object>();
|
private final Map<Object, Object> context = new HashMap<Object, Object>();
|
||||||
|
|
||||||
@ -211,6 +213,30 @@ public class CallContext {
|
|||||||
public String getEventDetails() {
|
public String getEventDetails() {
|
||||||
return eventDetails;
|
return eventDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(String eventType) {
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventDescription() {
|
||||||
|
return eventDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventDescription(String eventDescription) {
|
||||||
|
this.eventDescription = eventDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setActionEventInfo(String eventType, String description) {
|
||||||
|
CallContext context = CallContext.current();
|
||||||
|
if ( context != null ) {
|
||||||
|
context.setEventType(eventType);
|
||||||
|
context.setEventDescription(description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
@ -69,58 +69,58 @@ public interface ConfigurationManager {
|
|||||||
*/
|
*/
|
||||||
String updateConfiguration(long userId, String name, String category, String value, String scope, Long id);
|
String updateConfiguration(long userId, String name, String category, String value, String scope, Long id);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Creates a new service offering
|
// * Creates a new service offering
|
||||||
*
|
// *
|
||||||
* @param name
|
// * @param name
|
||||||
* @param cpu
|
// * @param cpu
|
||||||
* @param ramSize
|
// * @param ramSize
|
||||||
* @param speed
|
// * @param speed
|
||||||
* @param displayText
|
// * @param displayText
|
||||||
* @param localStorageRequired
|
// * @param localStorageRequired
|
||||||
* @param offerHA
|
// * @param offerHA
|
||||||
* @param domainId
|
// * @param domainId
|
||||||
* @param volatileVm
|
// * @param volatileVm
|
||||||
* @param hostTag
|
// * @param hostTag
|
||||||
* @param networkRate
|
// * @param networkRate
|
||||||
* TODO
|
// * TODO
|
||||||
* @param id
|
// * @param id
|
||||||
* @param useVirtualNetwork
|
// * @param useVirtualNetwork
|
||||||
* @param deploymentPlanner
|
// * @param deploymentPlanner
|
||||||
* @param details
|
// * @param details
|
||||||
* @param bytesReadRate
|
// * @param bytesReadRate
|
||||||
* @param bytesWriteRate
|
// * @param bytesWriteRate
|
||||||
* @param iopsReadRate
|
// * @param iopsReadRate
|
||||||
* @param iopsWriteRate
|
// * @param iopsWriteRate
|
||||||
* @return ID
|
// * @return ID
|
||||||
*/
|
// */
|
||||||
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
|
// ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
|
||||||
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map<String, String> details,
|
// boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map<String, String> details,
|
||||||
Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate);
|
// Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Creates a new disk offering
|
// * Creates a new disk offering
|
||||||
*
|
// *
|
||||||
* @param domainId
|
// * @param domainId
|
||||||
* @param name
|
// * @param name
|
||||||
* @param description
|
// * @param description
|
||||||
* @param numGibibytes
|
// * @param numGibibytes
|
||||||
* @param tags
|
// * @param tags
|
||||||
* @param isCustomized
|
// * @param isCustomized
|
||||||
* @param localStorageRequired
|
// * @param localStorageRequired
|
||||||
* @param isDisplayOfferingEnabled
|
// * @param isDisplayOfferingEnabled
|
||||||
* @param isCustomizedIops (is admin allowing users to set custom iops?)
|
// * @param isCustomizedIops (is admin allowing users to set custom iops?)
|
||||||
* @param minIops
|
// * @param minIops
|
||||||
* @param maxIops
|
// * @param maxIops
|
||||||
* @param bytesReadRate
|
// * @param bytesReadRate
|
||||||
* @param bytesWriteRate
|
// * @param bytesWriteRate
|
||||||
* @param iopsReadRate
|
// * @param iopsReadRate
|
||||||
* @param iopsWriteRate
|
// * @param iopsWriteRate
|
||||||
* @return newly created disk offering
|
// * @return newly created disk offering
|
||||||
*/
|
// */
|
||||||
DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
|
// DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
|
||||||
boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
|
// boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
|
||||||
Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate);
|
// Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new pod
|
* Creates a new pod
|
||||||
|
|||||||
@ -55,22 +55,22 @@ public interface FirewallManager extends FirewallService {
|
|||||||
|
|
||||||
boolean revokeFirewallRulesForIp(long ipId, long userId, Account caller) throws ResourceUnavailableException;
|
boolean revokeFirewallRulesForIp(long ipId, long userId, Account caller) throws ResourceUnavailableException;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Revokes a firewall rule
|
// * Revokes a firewall rule
|
||||||
*
|
// *
|
||||||
* @param ruleId
|
// * @param ruleId
|
||||||
* the id of the rule to revoke.
|
// * the id of the rule to revoke.
|
||||||
* @param caller
|
// * @param caller
|
||||||
* TODO
|
// * TODO
|
||||||
* @param userId
|
// * @param userId
|
||||||
* TODO
|
// * TODO
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
boolean revokeFirewallRule(long ruleId, boolean apply, Account caller, long userId);
|
// boolean revokeFirewallRule(long ruleId, boolean apply, Account caller, long userId);
|
||||||
|
|
||||||
FirewallRule createFirewallRule(Long ipAddrId, Account caller, String xId, Integer portStart, Integer portEnd, String protocol, List<String> sourceCidrList, Integer icmpCode, Integer icmpType, Long relatedRuleId,
|
// FirewallRule createFirewallRule(Long ipAddrId, Account caller, String xId, Integer portStart, Integer portEnd, String protocol, List<String> sourceCidrList, Integer icmpCode, Integer icmpType, Long relatedRuleId,
|
||||||
FirewallRule.FirewallRuleType type, Long networkId, FirewallRule.TrafficType traffictype)
|
// FirewallRule.FirewallRuleType type, Long networkId, FirewallRule.TrafficType traffictype)
|
||||||
throws NetworkRuleConflictException;
|
// throws NetworkRuleConflictException;
|
||||||
|
|
||||||
FirewallRule createRuleForAllCidrs(long ipAddrId, Account caller, Integer startPort, Integer endPort, String protocol, Integer icmpCode, Integer icmpType, Long relatedRuleId, long networkId) throws NetworkRuleConflictException;
|
FirewallRule createRuleForAllCidrs(long ipAddrId, Account caller, Integer startPort, Integer endPort, String protocol, Integer icmpCode, Integer icmpType, Long relatedRuleId, long networkId) throws NetworkRuleConflictException;
|
||||||
|
|
||||||
|
|||||||
@ -1979,6 +1979,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_CREATE, eventDescription = "creating service offering")
|
||||||
public ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd) {
|
public ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd) {
|
||||||
Long userId = CallContext.current().getCallingUserId();
|
Long userId = CallContext.current().getCallingUserId();
|
||||||
|
|
||||||
@ -2079,9 +2080,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate());
|
cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type,
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_CREATE, eventDescription = "creating service offering")
|
|
||||||
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type,
|
|
||||||
String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
|
String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
|
||||||
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag,
|
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag,
|
||||||
Integer networkRate, String deploymentPlanner, Map<String, String> details, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
|
Integer networkRate, String deploymentPlanner, Map<String, String> details, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
|
||||||
@ -2182,9 +2181,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_CREATE, eventDescription = "creating disk offering")
|
|
||||||
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
|
|
||||||
boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
|
boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
|
||||||
Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
|
Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
|
||||||
long diskSize = 0;// special case for custom disk offerings
|
long diskSize = 0;// special case for custom disk offerings
|
||||||
@ -2263,6 +2260,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_CREATE, eventDescription = "creating disk offering")
|
||||||
public DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd) {
|
public DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd) {
|
||||||
String name = cmd.getOfferingName();
|
String name = cmd.getOfferingName();
|
||||||
String description = cmd.getDisplayText();
|
String description = cmd.getDisplayText();
|
||||||
|
|||||||
@ -17,15 +17,14 @@
|
|||||||
package com.cloud.event;
|
package com.cloud.event;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
import org.apache.log4j.Logger;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
import com.cloud.utils.component.ComponentMethodInterceptor;
|
import com.cloud.utils.component.ComponentMethodInterceptor;
|
||||||
|
|
||||||
public class ActionEventInterceptor implements ComponentMethodInterceptor {
|
public class ActionEventInterceptor implements ComponentMethodInterceptor {
|
||||||
private static final Logger s_logger = Logger.getLogger(ActionEventInterceptor.class);
|
|
||||||
|
|
||||||
public ActionEventInterceptor() {
|
public ActionEventInterceptor() {
|
||||||
}
|
}
|
||||||
@ -33,19 +32,15 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor {
|
|||||||
@Override
|
@Override
|
||||||
public Object interceptStart(Method method, Object target) {
|
public Object interceptStart(Method method, Object target) {
|
||||||
EventVO event = null;
|
EventVO event = null;
|
||||||
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
|
for ( ActionEvent actionEvent : getActionEvents(method) ) {
|
||||||
if (actionEvent != null) {
|
|
||||||
boolean async = actionEvent.async();
|
boolean async = actionEvent.async();
|
||||||
if(async){
|
if(async){
|
||||||
CallContext ctx = CallContext.current();
|
CallContext ctx = CallContext.current();
|
||||||
long userId = ctx.getCallingUserId();
|
|
||||||
long accountId = ctx.getCallingAccountId();
|
String eventDescription = getEventDescription(actionEvent, ctx);
|
||||||
long startEventId = ctx.getStartEventId();
|
String eventType = getEventType(actionEvent, ctx);
|
||||||
String eventDescription = actionEvent.eventDescription();
|
|
||||||
if(ctx.getEventDetails() != null){
|
ActionEventUtils.onStartedActionEventFromContext(eventType, eventDescription);
|
||||||
eventDescription += ". "+ctx.getEventDetails();
|
|
||||||
}
|
|
||||||
ActionEventUtils.onStartedActionEvent(userId, accountId, actionEvent.eventType(), eventDescription, startEventId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return event;
|
return event;
|
||||||
@ -53,43 +48,45 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void interceptComplete(Method method, Object target, Object event) {
|
public void interceptComplete(Method method, Object target, Object event) {
|
||||||
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
|
for ( ActionEvent actionEvent : getActionEvents(method) ) {
|
||||||
if (actionEvent != null) {
|
|
||||||
CallContext ctx = CallContext.current();
|
CallContext ctx = CallContext.current();
|
||||||
long userId = ctx.getCallingUserId();
|
long userId = ctx.getCallingUserId();
|
||||||
long accountId = ctx.getCallingAccountId();
|
long accountId = ctx.getCallingAccountId();
|
||||||
long startEventId = ctx.getStartEventId();
|
long startEventId = ctx.getStartEventId();
|
||||||
String eventDescription = actionEvent.eventDescription();
|
String eventDescription = getEventDescription(actionEvent, ctx);
|
||||||
if(ctx.getEventDetails() != null){
|
String eventType = getEventType(actionEvent, ctx);
|
||||||
eventDescription += ". "+ctx.getEventDetails();
|
|
||||||
}
|
if ( eventType.equals("") )
|
||||||
|
return;
|
||||||
|
|
||||||
if(actionEvent.create()){
|
if(actionEvent.create()){
|
||||||
//This start event has to be used for subsequent events of this action
|
//This start event has to be used for subsequent events of this action
|
||||||
startEventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_INFO, actionEvent.eventType(), "Successfully created entity for "+eventDescription);
|
startEventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_INFO, eventType, "Successfully created entity for "+eventDescription);
|
||||||
ctx.setStartEventId(startEventId);
|
ctx.setStartEventId(startEventId);
|
||||||
} else {
|
} else {
|
||||||
ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_INFO, actionEvent.eventType(), "Successfully completed "+eventDescription, startEventId);
|
ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_INFO, eventType, "Successfully completed "+eventDescription, startEventId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void interceptException(Method method, Object target, Object event) {
|
public void interceptException(Method method, Object target, Object event) {
|
||||||
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
|
for ( ActionEvent actionEvent : getActionEvents(method) ) {
|
||||||
if (actionEvent != null) {
|
|
||||||
CallContext ctx = CallContext.current();
|
CallContext ctx = CallContext.current();
|
||||||
long userId = ctx.getCallingUserId();
|
long userId = ctx.getCallingUserId();
|
||||||
long accountId = ctx.getCallingAccountId();
|
long accountId = ctx.getCallingAccountId();
|
||||||
long startEventId = ctx.getStartEventId();
|
long startEventId = ctx.getStartEventId();
|
||||||
String eventDescription = actionEvent.eventDescription();
|
String eventDescription = getEventDescription(actionEvent, ctx);
|
||||||
if(ctx.getEventDetails() != null){
|
String eventType = getEventType(actionEvent, ctx);
|
||||||
eventDescription += ". "+ctx.getEventDetails();
|
|
||||||
}
|
if ( eventType.equals("") )
|
||||||
|
return;
|
||||||
|
|
||||||
if(actionEvent.create()){
|
if(actionEvent.create()){
|
||||||
long eventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, actionEvent.eventType(), "Error while creating entity for "+eventDescription);
|
long eventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, eventType, "Error while creating entity for "+eventDescription);
|
||||||
ctx.setStartEventId(eventId);
|
ctx.setStartEventId(eventId);
|
||||||
} else {
|
} else {
|
||||||
ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, actionEvent.eventType(), "Error while "+eventDescription, startEventId);
|
ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, eventType, "Error while "+eventDescription, startEventId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +98,49 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActionEvents events = method.getAnnotation(ActionEvents.class);
|
||||||
|
if ( events != null ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected List<ActionEvent> getActionEvents(Method m) {
|
||||||
|
List<ActionEvent> result = new ArrayList<ActionEvent>();
|
||||||
|
|
||||||
|
ActionEvents events = m.getAnnotation(ActionEvents.class);
|
||||||
|
|
||||||
|
if ( events != null ) {
|
||||||
|
for ( ActionEvent e : events.value() ) {
|
||||||
|
result.add(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ActionEvent e = m.getAnnotation(ActionEvent.class);
|
||||||
|
|
||||||
|
if ( e != null ) {
|
||||||
|
result.add(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
protected String getEventType(ActionEvent actionEvent, CallContext ctx) {
|
||||||
|
String type = ctx.getEventType();
|
||||||
|
|
||||||
|
return type == null ? actionEvent.eventType() : type;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getEventDescription(ActionEvent actionEvent, CallContext ctx) {
|
||||||
|
String eventDescription = ctx.getEventDescription();
|
||||||
|
if ( eventDescription == null ) {
|
||||||
|
eventDescription = actionEvent.eventDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ctx.getEventDetails() != null){
|
||||||
|
eventDescription += ". "+ctx.getEventDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
return eventDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,6 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
|
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
import org.apache.cloudstack.framework.events.EventBus;
|
import org.apache.cloudstack.framework.events.EventBus;
|
||||||
import org.apache.cloudstack.framework.events.EventBusException;
|
import org.apache.cloudstack.framework.events.EventBusException;
|
||||||
@ -94,7 +93,22 @@ public class ActionEventUtils {
|
|||||||
|
|
||||||
return event.getId();
|
return event.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void startNestedActionEvent(String eventType, String eventDescription) {
|
||||||
|
CallContext.setActionEventInfo(eventType, eventDescription);
|
||||||
|
onStartedActionEventFromContext(eventType, eventDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onStartedActionEventFromContext(String eventType, String eventDescription) {
|
||||||
|
CallContext ctx = CallContext.current();
|
||||||
|
long userId = ctx.getCallingUserId();
|
||||||
|
long accountId = ctx.getCallingAccountId();
|
||||||
|
long startEventId = ctx.getStartEventId();
|
||||||
|
|
||||||
|
if ( ! eventType.equals("") )
|
||||||
|
ActionEventUtils.onStartedActionEvent(userId, accountId, eventType, eventDescription, startEventId);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save event after starting execution of an async job
|
* Save event after starting execution of an async job
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -155,6 +155,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_OPEN, eventDescription = "creating firewall rule", create = true)
|
||||||
public FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException {
|
public FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException {
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
|
|
||||||
@ -169,6 +170,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_OPEN, eventDescription = "creating firewall rule", create = true)
|
||||||
public FirewallRule createIngressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException {
|
public FirewallRule createIngressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException {
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
Long sourceIpAddressId = rule.getSourceIpAddressId();
|
Long sourceIpAddressId = rule.getSourceIpAddressId();
|
||||||
@ -179,9 +181,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
@DB
|
||||||
@Override
|
protected FirewallRule createFirewallRule(Long ipAddrId, Account caller, String xId, Integer portStart,
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_OPEN, eventDescription = "creating firewall rule", create = true)
|
|
||||||
public FirewallRule createFirewallRule(Long ipAddrId, Account caller, String xId, Integer portStart,
|
|
||||||
Integer portEnd, String protocol, List<String> sourceCidrList, Integer icmpCode, Integer icmpType,
|
Integer portEnd, String protocol, List<String> sourceCidrList, Integer icmpCode, Integer icmpType,
|
||||||
Long relatedRuleId, FirewallRule.FirewallRuleType type, Long networkId, FirewallRule.TrafficType trafficType) throws NetworkRuleConflictException {
|
Long relatedRuleId, FirewallRule.FirewallRuleType type, Long networkId, FirewallRule.TrafficType trafficType) throws NetworkRuleConflictException {
|
||||||
|
|
||||||
@ -688,9 +688,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected boolean revokeFirewallRule(long ruleId, boolean apply, Account caller, long userId) {
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_CLOSE, eventDescription = "revoking firewall rule", async = true)
|
|
||||||
public boolean revokeFirewallRule(long ruleId, boolean apply, Account caller, long userId) {
|
|
||||||
|
|
||||||
FirewallRuleVO rule = _firewallDao.findById(ruleId);
|
FirewallRuleVO rule = _firewallDao.findById(ruleId);
|
||||||
if (rule == null || rule.getPurpose() != Purpose.Firewall) {
|
if (rule == null || rule.getPurpose() != Purpose.Firewall) {
|
||||||
@ -727,6 +725,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_CLOSE, eventDescription = "revoking firewall rule", async = true)
|
||||||
public boolean revokeFirewallRule(long ruleId, boolean apply) {
|
public boolean revokeFirewallRule(long ruleId, boolean apply) {
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
long userId = CallContext.current().getCallingUserId();
|
long userId = CallContext.current().getCallingUserId();
|
||||||
@ -770,6 +769,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_CLOSE, eventDescription = "revoking firewall rule", async = true)
|
||||||
public boolean revokeFirewallRulesForIp(long ipId, long userId, Account caller) throws ResourceUnavailableException {
|
public boolean revokeFirewallRulesForIp(long ipId, long userId, Account caller) throws ResourceUnavailableException {
|
||||||
List<FirewallRule> rules = new ArrayList<FirewallRule>();
|
List<FirewallRule> rules = new ArrayList<FirewallRule>();
|
||||||
|
|
||||||
@ -799,6 +799,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_OPEN, eventDescription = "creating firewall rule", create = true)
|
||||||
public FirewallRule createRuleForAllCidrs(long ipAddrId, Account caller,
|
public FirewallRule createRuleForAllCidrs(long ipAddrId, Account caller,
|
||||||
Integer startPort, Integer endPort, String protocol, Integer icmpCode, Integer icmpType, Long relatedRuleId, long networkId)
|
Integer startPort, Integer endPort, String protocol, Integer icmpCode, Integer icmpType, Long relatedRuleId, long networkId)
|
||||||
throws NetworkRuleConflictException {
|
throws NetworkRuleConflictException {
|
||||||
@ -817,6 +818,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_CLOSE, eventDescription = "revoking firewall rule", async = true)
|
||||||
public boolean revokeAllFirewallRulesForNetwork(long networkId, long userId, Account caller) throws ResourceUnavailableException {
|
public boolean revokeAllFirewallRulesForNetwork(long networkId, long userId, Account caller) throws ResourceUnavailableException {
|
||||||
List<FirewallRule> rules = new ArrayList<FirewallRule>();
|
List<FirewallRule> rules = new ArrayList<FirewallRule>();
|
||||||
|
|
||||||
@ -860,6 +862,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_CLOSE, eventDescription = "revoking firewall rule", async = true)
|
||||||
public boolean revokeFirewallRulesForVm(long vmId) {
|
public boolean revokeFirewallRulesForVm(long vmId) {
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
UserVmVO vm = _vmDao.findByIdIncludingRemoved(vmId);
|
UserVmVO vm = _vmDao.findByIdIncludingRemoved(vmId);
|
||||||
@ -916,6 +919,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_OPEN, eventDescription = "creating firewall rule", create = true)
|
||||||
public boolean addSystemFirewallRules(IPAddressVO ip, Account acct) {
|
public boolean addSystemFirewallRules(IPAddressVO ip, Account acct) {
|
||||||
List<FirewallRuleVO> systemRules = _firewallDao.listSystemRules();
|
List<FirewallRuleVO> systemRules = _firewallDao.listSystemRules();
|
||||||
for (FirewallRuleVO rule : systemRules) {
|
for (FirewallRuleVO rule : systemRules) {
|
||||||
|
|||||||
@ -2107,12 +2107,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
return _consoleProxyMgr.assignProxy(dataCenterId, userVmId);
|
return _consoleProxyMgr.assignProxy(dataCenterId, userVmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_PROXY_START, eventDescription = "starting console proxy Vm", async = true)
|
|
||||||
private ConsoleProxyVO startConsoleProxy(long instanceId) {
|
private ConsoleProxyVO startConsoleProxy(long instanceId) {
|
||||||
return _consoleProxyMgr.startProxy(instanceId);
|
return _consoleProxyMgr.startProxy(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_PROXY_STOP, eventDescription = "stopping console proxy Vm", async = true)
|
|
||||||
private ConsoleProxyVO stopConsoleProxy(VMInstanceVO systemVm, boolean isForced) throws ResourceUnavailableException, OperationTimedoutException,
|
private ConsoleProxyVO stopConsoleProxy(VMInstanceVO systemVm, boolean isForced) throws ResourceUnavailableException, OperationTimedoutException,
|
||||||
ConcurrentOperationException {
|
ConcurrentOperationException {
|
||||||
|
|
||||||
@ -2120,14 +2118,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
return _consoleProxyDao.findById(systemVm.getId());
|
return _consoleProxyDao.findById(systemVm.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_PROXY_REBOOT, eventDescription = "rebooting console proxy Vm", async = true)
|
|
||||||
private ConsoleProxyVO rebootConsoleProxy(long instanceId) {
|
private ConsoleProxyVO rebootConsoleProxy(long instanceId) {
|
||||||
_consoleProxyMgr.rebootProxy(instanceId);
|
_consoleProxyMgr.rebootProxy(instanceId);
|
||||||
return _consoleProxyDao.findById(instanceId);
|
return _consoleProxyDao.findById(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_PROXY_DESTROY, eventDescription = "destroying console proxy Vm", async = true)
|
protected ConsoleProxyVO destroyConsoleProxy(long instanceId) {
|
||||||
public ConsoleProxyVO destroyConsoleProxy(long instanceId) {
|
|
||||||
ConsoleProxyVO proxy = _consoleProxyDao.findById(instanceId);
|
ConsoleProxyVO proxy = _consoleProxyDao.findById(instanceId);
|
||||||
|
|
||||||
if (_consoleProxyMgr.destroyProxy(instanceId)) {
|
if (_consoleProxyMgr.destroyProxy(instanceId)) {
|
||||||
@ -2168,7 +2164,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_DOMAIN_UPDATE, eventDescription = "updating Domain")
|
|
||||||
@DB
|
@DB
|
||||||
public DomainVO updateDomain(UpdateDomainCmd cmd) {
|
public DomainVO updateDomain(UpdateDomainCmd cmd) {
|
||||||
Long domainId = cmd.getId();
|
Long domainId = cmd.getId();
|
||||||
@ -2988,12 +2983,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
return _poolDao.searchAndCount(sc, searchFilter);
|
return _poolDao.searchAndCount(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_SSVM_START, eventDescription = "starting secondary storage Vm", async = true)
|
private SecondaryStorageVmVO startSecondaryStorageVm(long instanceId) {
|
||||||
public SecondaryStorageVmVO startSecondaryStorageVm(long instanceId) {
|
|
||||||
return _secStorageVmMgr.startSecStorageVm(instanceId);
|
return _secStorageVmMgr.startSecStorageVm(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_SSVM_STOP, eventDescription = "stopping secondary storage Vm", async = true)
|
|
||||||
private SecondaryStorageVmVO stopSecondaryStorageVm(VMInstanceVO systemVm, boolean isForced) throws ResourceUnavailableException,
|
private SecondaryStorageVmVO stopSecondaryStorageVm(VMInstanceVO systemVm, boolean isForced) throws ResourceUnavailableException,
|
||||||
OperationTimedoutException, ConcurrentOperationException {
|
OperationTimedoutException, ConcurrentOperationException {
|
||||||
|
|
||||||
@ -3001,14 +2994,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
return _secStorageVmDao.findById(systemVm.getId());
|
return _secStorageVmDao.findById(systemVm.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_SSVM_REBOOT, eventDescription = "rebooting secondary storage Vm", async = true)
|
|
||||||
public SecondaryStorageVmVO rebootSecondaryStorageVm(long instanceId) {
|
public SecondaryStorageVmVO rebootSecondaryStorageVm(long instanceId) {
|
||||||
_secStorageVmMgr.rebootSecStorageVm(instanceId);
|
_secStorageVmMgr.rebootSecStorageVm(instanceId);
|
||||||
return _secStorageVmDao.findById(instanceId);
|
return _secStorageVmDao.findById(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_SSVM_DESTROY, eventDescription = "destroying secondary storage Vm", async = true)
|
protected SecondaryStorageVmVO destroySecondaryStorageVm(long instanceId) {
|
||||||
public SecondaryStorageVmVO destroySecondaryStorageVm(long instanceId) {
|
|
||||||
SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(instanceId);
|
SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(instanceId);
|
||||||
if (_secStorageVmMgr.destroySecStorageVm(instanceId)) {
|
if (_secStorageVmMgr.destroySecStorageVm(instanceId)) {
|
||||||
return secStorageVm;
|
return secStorageVm;
|
||||||
@ -3102,6 +3093,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = "", eventDescription = "", async = true)
|
||||||
public VirtualMachine startSystemVM(long vmId) {
|
public VirtualMachine startSystemVM(long vmId) {
|
||||||
|
|
||||||
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(vmId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
|
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(vmId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
|
||||||
@ -3112,8 +3104,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (systemVm.getType() == VirtualMachine.Type.ConsoleProxy) {
|
if (systemVm.getType() == VirtualMachine.Type.ConsoleProxy) {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_PROXY_START, "starting console proxy Vm");
|
||||||
return startConsoleProxy(vmId);
|
return startConsoleProxy(vmId);
|
||||||
} else if (systemVm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
|
} else if (systemVm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_SSVM_START, "starting secondary storage Vm");
|
||||||
return startSecondaryStorageVm(vmId);
|
return startSecondaryStorageVm(vmId);
|
||||||
} else {
|
} else {
|
||||||
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find a system vm with specified vmId");
|
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find a system vm with specified vmId");
|
||||||
@ -3123,6 +3117,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = "", eventDescription = "", async = true)
|
||||||
public VMInstanceVO stopSystemVM(StopSystemVmCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException {
|
public VMInstanceVO stopSystemVM(StopSystemVmCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException {
|
||||||
Long id = cmd.getId();
|
Long id = cmd.getId();
|
||||||
|
|
||||||
@ -3136,8 +3131,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (systemVm.getType() == VirtualMachine.Type.ConsoleProxy) {
|
if (systemVm.getType() == VirtualMachine.Type.ConsoleProxy) {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_PROXY_STOP, "stopping console proxy Vm");
|
||||||
return stopConsoleProxy(systemVm, cmd.isForced());
|
return stopConsoleProxy(systemVm, cmd.isForced());
|
||||||
} else if (systemVm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
|
} else if (systemVm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_SSVM_STOP, "stopping secondary storage Vm");
|
||||||
return stopSecondaryStorageVm(systemVm, cmd.isForced());
|
return stopSecondaryStorageVm(systemVm, cmd.isForced());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -3147,6 +3144,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_PROXY_REBOOT, eventDescription = "", async = true)
|
||||||
public VMInstanceVO rebootSystemVM(RebootSystemVmCmd cmd) {
|
public VMInstanceVO rebootSystemVM(RebootSystemVmCmd cmd) {
|
||||||
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(cmd.getId(), VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
|
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(cmd.getId(), VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
|
||||||
|
|
||||||
@ -3157,13 +3155,16 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (systemVm.getType().equals(VirtualMachine.Type.ConsoleProxy)) {
|
if (systemVm.getType().equals(VirtualMachine.Type.ConsoleProxy)) {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_PROXY_REBOOT, "rebooting console proxy Vm");
|
||||||
return rebootConsoleProxy(cmd.getId());
|
return rebootConsoleProxy(cmd.getId());
|
||||||
} else {
|
} else {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_SSVM_REBOOT, "rebooting secondary storage Vm");
|
||||||
return rebootSecondaryStorageVm(cmd.getId());
|
return rebootSecondaryStorageVm(cmd.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = "", eventDescription = "", async = true)
|
||||||
public VMInstanceVO destroySystemVM(DestroySystemVmCmd cmd) {
|
public VMInstanceVO destroySystemVM(DestroySystemVmCmd cmd) {
|
||||||
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(cmd.getId(), VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
|
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(cmd.getId(), VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
|
||||||
|
|
||||||
@ -3174,8 +3175,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (systemVm.getType().equals(VirtualMachine.Type.ConsoleProxy)) {
|
if (systemVm.getType().equals(VirtualMachine.Type.ConsoleProxy)) {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_PROXY_DESTROY, "destroying console proxy Vm");
|
||||||
return destroyConsoleProxy(cmd.getId());
|
return destroyConsoleProxy(cmd.getId());
|
||||||
} else {
|
} else {
|
||||||
|
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_SSVM_DESTROY, "destroying secondary storage Vm");
|
||||||
return destroySecondaryStorageVm(cmd.getId());
|
return destroySecondaryStorageVm(cmd.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ import javax.naming.ConfigurationException;
|
|||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import org.apache.cloudstack.acl.ControlledEntity;
|
import org.apache.cloudstack.acl.ControlledEntity;
|
||||||
import org.apache.cloudstack.acl.RoleType;
|
import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.acl.SecurityChecker;
|
import org.apache.cloudstack.acl.SecurityChecker;
|
||||||
@ -75,6 +74,7 @@ import com.cloud.domain.DomainVO;
|
|||||||
import com.cloud.domain.dao.DomainDao;
|
import com.cloud.domain.dao.DomainDao;
|
||||||
import com.cloud.event.ActionEvent;
|
import com.cloud.event.ActionEvent;
|
||||||
import com.cloud.event.ActionEventUtils;
|
import com.cloud.event.ActionEventUtils;
|
||||||
|
import com.cloud.event.ActionEvents;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.exception.AgentUnavailableException;
|
import com.cloud.exception.AgentUnavailableException;
|
||||||
import com.cloud.exception.CloudAuthenticationException;
|
import com.cloud.exception.CloudAuthenticationException;
|
||||||
@ -855,7 +855,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_CREATE, eventDescription = "creating Account")
|
@ActionEvents({
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_CREATE, eventDescription = "creating Account"),
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User"),
|
||||||
|
})
|
||||||
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
|
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
|
||||||
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID) {
|
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID) {
|
||||||
|
|
||||||
@ -927,6 +930,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
|
||||||
public UserVO createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID) {
|
public UserVO createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID) {
|
||||||
|
|
||||||
// default domain to ROOT if not specified
|
// default domain to ROOT if not specified
|
||||||
@ -1777,7 +1781,6 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
|
|
||||||
protected UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone, String userUUID) {
|
protected UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone, String userUUID) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone);
|
s_logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone);
|
||||||
|
|||||||
@ -2152,6 +2152,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
|
||||||
public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner,
|
public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner,
|
||||||
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group,
|
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group,
|
||||||
HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
|
||||||
@ -2212,6 +2213,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
|
||||||
public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
|
public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
|
||||||
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId,
|
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId,
|
||||||
Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
||||||
@ -2328,6 +2330,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
|
||||||
public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
|
||||||
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||||
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
|
||||||
@ -2449,7 +2452,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true)
|
@DB
|
||||||
protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, String hostName, String displayName, Account owner, Long diskOfferingId,
|
protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, String hostName, String displayName, Account owner, Long diskOfferingId,
|
||||||
Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod,
|
Long diskSize, List<NetworkVO> networkList, List<Long> securityGroupIdList, String group, HTTPMethod httpmethod,
|
||||||
String userData, String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps,
|
String userData, String sshKeyPair, HypervisorType hypervisor, Account caller, Map<Long, IpAddresses> requestedIps,
|
||||||
|
|||||||
@ -127,13 +127,6 @@ public class MockFirewallManagerImpl extends ManagerBase implements FirewallMana
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean revokeFirewallRule(long ruleId, boolean apply,
|
|
||||||
Account caller, long userId) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FirewallRule createRuleForAllCidrs(long ipAddrId, Account caller,
|
public FirewallRule createRuleForAllCidrs(long ipAddrId, Account caller,
|
||||||
Integer startPort, Integer endPort, String protocol,
|
Integer startPort, Integer endPort, String protocol,
|
||||||
@ -173,16 +166,6 @@ public class MockFirewallManagerImpl extends ManagerBase implements FirewallMana
|
|||||||
return false; //To change body of implemented methods use File | Settings | File Templates.
|
return false; //To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FirewallRule createFirewallRule(Long ipAddrId, Account caller,
|
|
||||||
String xId, Integer portStart, Integer portEnd, String protocol,
|
|
||||||
List<String> sourceCidrList, Integer icmpCode, Integer icmpType,
|
|
||||||
Long relatedRuleId, FirewallRuleType type, Long networkId,
|
|
||||||
TrafficType traffictype) throws NetworkRuleConflictException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validateFirewallRule(Account caller, IPAddressVO ipAddress,
|
public void validateFirewallRule(Account caller, IPAddressVO ipAddress,
|
||||||
Integer portStart, Integer portEnd, String proto, Purpose purpose,
|
Integer portStart, Integer portEnd, String proto, Purpose purpose,
|
||||||
|
|||||||
@ -390,17 +390,6 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see com.cloud.configuration.ConfigurationManager#createServiceOffering(long, boolean, com.cloud.vm.VirtualMachine.Type, java.lang.String, int, int, int, java.lang.String, boolean, boolean, boolean, java.lang.String, java.lang.Long, java.lang.String, java.lang.Integer)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA,
|
|
||||||
boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map<String, String> details,
|
|
||||||
Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.cloud.configuration.ConfigurationManager#createPod(long, java.lang.String, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
|
* @see com.cloud.configuration.ConfigurationManager#createPod(long, java.lang.String, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
|
||||||
*/
|
*/
|
||||||
@ -512,17 +501,6 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see com.cloud.configuration.ConfigurationManager#createDiskOffering(java.lang.Long, java.lang.String, java.lang.String, java.lang.Long, java.lang.String, boolean, boolean, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
|
|
||||||
boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
|
|
||||||
Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.cloud.configuration.ConfigurationManager#createZone(long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Long, com.cloud.dc.DataCenter.NetworkType, java.lang.String, java.lang.String, boolean, boolean)
|
* @see com.cloud.configuration.ConfigurationManager#createZone(long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Long, com.cloud.dc.DataCenter.NetworkType, java.lang.String, java.lang.String, boolean, boolean)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user