cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frankzh...@apache.org
Subject git commit: updated refs/heads/4.2 to 7ff74ca
Date Thu, 18 Jul 2013 18:35:40 GMT
Updated Branches:
  refs/heads/4.2 33faf44b3 -> 7ff74caf8


CLOUDSTACK-3307
UCS:DB: Same UCS manager can be added multiple times

fixed resolved


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

Branch: refs/heads/4.2
Commit: 7ff74caf8e15dc91724f9caa33fb66ccbbfb7d35
Parents: 33faf44
Author: frank <frank.zhang@citrix.com>
Authored: Thu Jul 18 11:43:24 2013 -0700
Committer: frank <frank.zhang@citrix.com>
Committed: Thu Jul 18 11:45:10 2013 -0700

----------------------------------------------------------------------
 .../ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ff74caf/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
index 150e3dc..e2bd31d 100755
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
@@ -132,7 +132,14 @@ public class UcsManagerImpl implements UcsManager {
 
     @Override
     @DB
-    public UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
+    public UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
+    	SearchCriteriaService<UcsManagerVO, UcsManagerVO> q = SearchCriteria2.create(UcsManagerVO.class);
+    	q.addAnd(q.getEntity().getUrl(), Op.EQ, cmd.getUrl());
+    	UcsManagerVO mgrvo = q.find();
+    	if (mgrvo != null) {
+    	    throw new IllegalArgumentException(String.format("duplicate UCS manager. url[%s]
is used by another UCS manager already", cmd.getUrl()));
+    	}
+    	 
         UcsManagerVO vo = new UcsManagerVO();
         vo.setUuid(UUID.randomUUID().toString());
         vo.setPassword(cmd.getPassword());
@@ -141,6 +148,7 @@ public class UcsManagerImpl implements UcsManager {
         vo.setZoneId(cmd.getZoneId());
         vo.setName(cmd.getName());
 
+
         Transaction txn = Transaction.currentTxn();
         txn.start();
         ucsDao.persist(vo);


Mime
View raw message