cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [02/50] [abbrv] git commit: updated refs/heads/master to 97f8c52
Date Thu, 20 Jun 2013 07:19:35 GMT
Add convenient delete methods in DataObject to delete dangling data
object.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eb93efda
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eb93efda
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eb93efda

Branch: refs/heads/master
Commit: eb93efdaa4f076a349b72542a295dc6808a2ffbe
Parents: 614e08e
Author: Min Chen <min.chen@citrix.com>
Authored: Thu May 30 14:51:03 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Thu May 30 14:51:03 2013 -0700

----------------------------------------------------------------------
 .../engine/subsystem/api/storage/DataObject.java       |  2 ++
 .../cloudstack/storage/image/store/TemplateObject.java | 13 +++++++++++--
 .../cloudstack/storage/snapshot/SnapshotObject.java    |  7 +++++++
 .../storage/datastore/PrimaryDataStoreImpl.java        |  5 +++--
 .../apache/cloudstack/storage/volume/VolumeObject.java |  8 ++++++++
 5 files changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb93efda/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
index ef87989..0cd2111 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
@@ -38,6 +38,8 @@ public interface DataObject {
     // public DiskFormat getFormat();
     public String getUuid();
 
+    boolean delete();
+
     public void processEvent(ObjectInDataStoreStateMachine.Event event);
 
     public void processEvent(ObjectInDataStoreStateMachine.Event event, Answer answer);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb93efda/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
index e4be627..9957791 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
@@ -125,12 +125,12 @@ public class TemplateObject implements TemplateInfo {
         }
 
         /*
-         * 
+         *
          * // If the template that was passed into this allocator is not
          * installed in the storage pool, // add 3 * (template size on secondary
          * storage) to the running total VMTemplateHostVO templateHostVO =
          * _storageMgr.findVmTemplateHost(templateForVmCreation.getId(), null);
-         * 
+         *
          * if (templateHostVO == null) { VMTemplateSwiftVO templateSwiftVO =
          * _swiftMgr.findByTmpltId(templateForVmCreation.getId()); if
          * (templateSwiftVO != null) { long templateSize =
@@ -395,4 +395,13 @@ public class TemplateObject implements TemplateInfo {
         return this.imageVO.getDomainId();
     }
 
+    @Override
+    public boolean delete() {
+        if (dataStore != null) {
+            return dataStore.delete(this);
+        }
+        return true;
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb93efda/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
index 6aee3ea..bd14573 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
@@ -284,4 +284,11 @@ public class SnapshotObject implements SnapshotInfo {
 
     }
 
+    @Override
+    public boolean delete() {
+        if (store != null) {
+            return store.delete(this);
+        }
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb93efda/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
index 6d380af..1fc8251 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
@@ -252,8 +252,9 @@ public class PrimaryDataStoreImpl implements PrimaryDataStore {
 
     @Override
     public boolean delete(DataObject obj) {
-        // TODO Auto-generated method stub
-        return false;
+        //TODO: clean up through driver
+        objectInStoreMgr.delete(obj);
+        return true;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb93efda/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index 1e2f000..963015c 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -505,4 +505,12 @@ public class VolumeObject implements VolumeInfo {
     public ImageFormat getFormat() {
         return this.volumeVO.getFormat();
     }
+
+    @Override
+    public boolean delete() {
+        if (dataStore != null) {
+            return dataStore.delete(this);
+        }
+        return true;
+    }
 }


Mime
View raw message