Skip to content

Commit

Permalink
CLOUDSTACK-874 Ability to delete Events and Alerts
Browse files Browse the repository at this point in the history
Signed-off-by: Min Chen <[email protected]>
  • Loading branch information
sanjaytripathi authored and minchen07 committed Mar 8, 2013
1 parent ae3eeca commit 5e4c2c8
Show file tree
Hide file tree
Showing 17 changed files with 475 additions and 120 deletions.
1 change: 1 addition & 0 deletions api/src/com/cloud/alert/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ public interface Alert extends Identity, InternalIdentity {
Date getCreatedDate();
Date getLastSent();
Date getResolved();
boolean getArchived();
}
1 change: 1 addition & 0 deletions api/src/com/cloud/event/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ public enum State {
String getLevel();
long getStartId();
String getParameters();
boolean getArchived();
}
38 changes: 32 additions & 6 deletions api/src/com/cloud/server/ManagementService.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
Expand All @@ -40,12 +42,12 @@
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
Expand All @@ -55,12 +57,10 @@
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;

import com.cloud.alert.Alert;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
Expand All @@ -72,8 +72,6 @@
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.IpAddress;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOsCategory;
Expand Down Expand Up @@ -194,6 +192,34 @@ public interface ManagementService {
*/
Pair<List<? extends Alert>, Integer> searchForAlerts(ListAlertsCmd cmd);

/**
* Archive alerts
* @param cmd
* @return True on success. False otherwise.
*/
boolean archiveAlerts(ArchiveAlertsCmd cmd);

/**
* Delete alerts
* @param cmd
* @return True on success. False otherwise.
*/
boolean deleteAlerts(DeleteAlertsCmd cmd);

/**
* Archive events
* @param cmd
* @return True on success. False otherwise.
*/
boolean archiveEvents(ArchiveEventsCmd cmd);

/**
* Delete events
* @param cmd
* @return True on success. False otherwise.
*/
boolean deleteEvents(DeleteEventsCmd cmd);

/**
* list all the capacity rows in capacity operations table
*
Expand Down
1 change: 1 addition & 0 deletions api/src/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ public class ApiConstants {
public static final String UCS_BLADE_DN = "bladedn";
public static final String UCS_BLADE_ID = "bladeid";
public static final String VM_GUEST_IP = "vmguestip";
public static final String OLDER_THAN = "olderthan";

public enum HostDetails {
all, capacity, events, stats, min;
Expand Down
4 changes: 4 additions & 0 deletions client/tomcatconf/commands.properties.in
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,13 @@ listZones=15
#### events commands
listEvents=15
listEventTypes=15
archiveEvents=15
deleteEvents=15

#### alerts commands
listAlerts=3
archiveAlerts=1
deleteAlerts=1

#### system capacity commands
listCapacity=3
Expand Down
38 changes: 24 additions & 14 deletions core/src/com/cloud/alert/AlertVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.cloudstack.api.Identity;
import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;

@Entity
@Table(name="alert")
Expand Down Expand Up @@ -68,16 +66,19 @@ public class AlertVO implements Alert {
@Temporal(TemporalType.TIMESTAMP)
@Column(name="resolved", updatable=true, nullable=true)
private Date resolved;

@Column(name="uuid")
private String uuid;

@Column(name="archived")
private boolean archived;

public AlertVO() {
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}
public AlertVO(Long id) {
this.id = id;
this.uuid = UUID.randomUUID().toString();
this.uuid = UUID.randomUUID().toString();
}

@Override
Expand All @@ -103,12 +104,12 @@ public void setSubject(String subject) {
}

public Long getClusterId() {
return clusterId;
}
public void setClusterId(Long clusterId) {
this.clusterId = clusterId;
}
@Override
return clusterId;
}
public void setClusterId(Long clusterId) {
this.clusterId = clusterId;
}
@Override
public Long getPodId() {
return podId;
}
Expand Down Expand Up @@ -164,10 +165,19 @@ public void setResolved(Date resolved) {

@Override
public String getUuid() {
return this.uuid;
return this.uuid;
}

public void setUuid(String uuid) {
this.uuid = uuid;
this.uuid = uuid;
}

@Override
public boolean getArchived() {
return archived;
}

public void setArchived(Boolean archived) {
this.archived = archived;
}
}
Loading

0 comments on commit 5e4c2c8

Please sign in to comment.