cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/4.8 to 20aea27
Date Mon, 05 Dec 2016 10:05:12 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.8 9e4246a26 -> 20aea27dc


Cloudstack 9586: When using local storage with Xenserver prepareTemplate does not work with
multiple primary store
The race condition will happen whenever there are multiple primary storages and the CS tries
to mount the secondary store to xenserver host simultaneously.
Due to synchronised block one mount will be successful and other thread will get the already
mounted SR. Without the fix the two thread will try to mount it parallely and one will fail
on Xenserver.


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

Branch: refs/heads/4.8
Commit: ba32ac1a7c643644c0b238fee622c726a0e6df22
Parents: 9eb8b2e
Author: Abhinandan Prateek <aprateek@apache.org>
Authored: Fri Dec 2 13:37:47 2016 +0530
Committer: Abhinandan Prateek <aprateek@apache.org>
Committed: Fri Dec 2 13:37:47 2016 +0530

----------------------------------------------------------------------
 .../resource/Xenserver625StorageProcessor.java  | 45 ++++++++------------
 1 file changed, 17 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba32ac1a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
index e58bade..b07487b 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
@@ -101,35 +101,24 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
 
         try {
             final String srname = hypervisorResource.getHost().getUuid() + path.trim();
-
-            final Set<SR> srs = SR.getByNameLabel(conn, srname);
-
-            if (srs != null && !srs.isEmpty()) {
-                return srs.iterator().next();
+            synchronized (srname.intern()) {
+                final Set<SR> srs = SR.getByNameLabel(conn, srname);
+                if (srs != null && !srs.isEmpty()) {
+                    return srs.iterator().next();
+                }
+                final Map<String, String> smConfig = new HashMap<String, String>();
+                final Host host = Host.getByUuid(conn, hypervisorResource.getHost().getUuid());
+                final String uuid = UUID.randomUUID().toString();
+                sr = SR.introduce(conn, uuid, srname, srname, "file", "file", false, smConfig);
+                final PBD.Record record = new PBD.Record();
+                record.host = host;
+                record.SR = sr;
+                smConfig.put("location", path);
+                record.deviceConfig = smConfig;
+                pbd = PBD.create(conn, record);
+                pbd.plug(conn);
+                sr.scan(conn);
             }
-
-            final Map<String, String> smConfig = new HashMap<String, String>();
-
-            final Host host = Host.getByUuid(conn, hypervisorResource.getHost().getUuid());
-            final String uuid = UUID.randomUUID().toString();
-
-            sr = SR.introduce(conn, uuid, srname, srname, "file", "file", false, smConfig);
-
-            final PBD.Record record = new PBD.Record();
-
-            record.host = host;
-            record.SR = sr;
-
-            smConfig.put("location", path);
-
-            record.deviceConfig = smConfig;
-
-            pbd = PBD.create(conn, record);
-
-            pbd.plug(conn);
-
-            sr.scan(conn);
-
             return sr;
         } catch (final Exception ex) {
             try {


Mime
View raw message