cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/4.2 to 3ae6e9e
Date Thu, 24 Oct 2013 17:15:22 GMT
Updated Branches:
  refs/heads/4.2 16301ddaa -> 3ae6e9e58


CLOUDSTACK-4649: added support to removeResourceDetail to remove details for UserVm/Templates


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

Branch: refs/heads/4.2
Commit: 3ae6e9e58ea1751cb9a9df55fb5177b911f521f6
Parents: 16301dd
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Oct 24 09:49:29 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu Oct 24 10:03:51 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/storage/dao/VMTemplateDetailsDao.java   |  4 +++-
 .../cloud/storage/dao/VMTemplateDetailsDaoImpl.java   | 14 +++++++++++++-
 .../schema/src/com/cloud/vm/dao/UserVmDetailsDao.java |  4 +++-
 .../src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java    | 14 +++++++++++++-
 .../cloud/metadata/ResourceMetaDataManagerImpl.java   |  8 ++++++--
 server/src/com/cloud/vm/dao/NicDetailDao.java         |  2 +-
 server/src/com/cloud/vm/dao/NicDetailDaoImpl.java     |  4 +---
 7 files changed, 40 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDao.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDao.java
index 284380e..3021b8f 100644
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDao.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDao.java
@@ -30,5 +30,7 @@ public interface VMTemplateDetailsDao extends GenericDao<VMTemplateDetailVO,
Lon
 
     void deleteDetails(long vmId);
     
-    void addTemplateDetail(Long templateId, String key, String value);
+    void addTemplateDetail(long templateId, String key, String value);
+    
+    void removeDetails(long templateId, String key);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
index 5ebed53..cb684c6 100644
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDetailsDaoImpl.java
@@ -98,7 +98,7 @@ public class VMTemplateDetailsDaoImpl extends GenericDaoBase<VMTemplateDetailVO,
     }
     
     @Override
-    public void addTemplateDetail(Long templateId, String key, String value) {
+    public void addTemplateDetail(long templateId, String key, String value) {
         VMTemplateDetailVO detail = findDetail(templateId, key);
         if (detail == null) {
             VMTemplateDetailVO newEntry = new VMTemplateDetailVO(templateId, key, value);
@@ -108,4 +108,16 @@ public class VMTemplateDetailsDaoImpl extends GenericDaoBase<VMTemplateDetailVO,
             update(detail.getId(), detail);
         }
     }
+    
+    @Override
+    public void removeDetails(long templateId, String key) {
+        if(key != null){
+            VMTemplateDetailVO detail = findDetail(templateId, key);
+            if(detail != null){
+                remove(detail.getId());
+            }
+        } else {
+            deleteDetails(templateId);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
index f17a530..591045e 100644
--- a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
@@ -30,5 +30,7 @@ public interface UserVmDetailsDao extends GenericDao<UserVmDetailVO,
Long> {
     
 	void deleteDetails(long vmId);
 	
-    void addVmDetail(Long vmId, String key, String value);
+    void addVmDetail(long vmId, String key, String value);
+    
+    void removeDetails(long vmId, String key);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
index be166b5..70cd66f 100644
--- a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
@@ -97,7 +97,7 @@ public class UserVmDetailsDaoImpl extends GenericDaoBase<UserVmDetailVO,
Long> i
 	}
 
     @Override
-    public void addVmDetail(Long vmId, String key, String value) {
+    public void addVmDetail(long vmId, String key, String value) {
         UserVmDetailVO detail = findDetail(vmId, key);
         if (detail == null) {
             UserVmDetailVO newEntry = new UserVmDetailVO(vmId, key, value);
@@ -107,4 +107,16 @@ public class UserVmDetailsDaoImpl extends GenericDaoBase<UserVmDetailVO,
Long> i
             update(detail.getId(), detail);
         }
     }
+
+    @Override
+    public void removeDetails(long vmId, String key) {
+        if(key != null){
+            UserVmDetailVO detail = findDetail(vmId, key);
+            if(detail != null){
+                remove(detail.getId());
+            }
+        }else {
+            deleteDetails(vmId);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
index 52b224c..dfdb051 100644
--- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
+++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
@@ -227,10 +227,14 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements
Resource
 
         Long id = _taggedResourceMgr.getResourceId(resourceId, resourceType);
         // TODO - Have a better design here.
-        if(resourceType == TaggedResourceType.Volume){
+        if (resourceType == TaggedResourceType.Volume){
            _volumeDetailDao.removeDetails(id, key);
-        } else {
+        } else if (resourceType == TaggedResourceType.Nic){
             _nicDetailDao.removeDetails(id, key);
+        } else if (resourceType == TaggedResourceType.UserVm) {
+            _userVmDetailsDao.removeDetails(id, key); 
+        } else if (resourceType == TaggedResourceType.Template) {
+            _templateDetailsDao.removeDetails(id, key);
         }
 
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/server/src/com/cloud/vm/dao/NicDetailDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/NicDetailDao.java b/server/src/com/cloud/vm/dao/NicDetailDao.java
index 38eb2f2..66bff16 100644
--- a/server/src/com/cloud/vm/dao/NicDetailDao.java
+++ b/server/src/com/cloud/vm/dao/NicDetailDao.java
@@ -31,5 +31,5 @@ public interface NicDetailDao extends GenericDao<NicDetailVO, Long>
{
 
     void deleteDetails(long nicId);
 
-    void removeDetails(Long id, String key);
+    void removeDetails(long nicId, String key);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ae6e9e5/server/src/com/cloud/vm/dao/NicDetailDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/NicDetailDaoImpl.java b/server/src/com/cloud/vm/dao/NicDetailDaoImpl.java
index e166891..87b4d20 100644
--- a/server/src/com/cloud/vm/dao/NicDetailDaoImpl.java
+++ b/server/src/com/cloud/vm/dao/NicDetailDaoImpl.java
@@ -94,8 +94,7 @@ public class NicDetailDaoImpl extends GenericDaoBase<NicDetailVO, Long>
implemen
     }
 
     @Override
-    public void removeDetails(Long nicId, String key) {
-
+    public void removeDetails(long nicId, String key) {
         if(key != null){
             NicDetailVO detail = findDetail(nicId, key);
             if(detail != null){
@@ -104,7 +103,6 @@ public class NicDetailDaoImpl extends GenericDaoBase<NicDetailVO, Long>
implemen
         }else {
             deleteDetails(nicId);
         }
-
     }
     
 }


Mime
View raw message