You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/12/05 10:03:02 UTC

[1/4] git commit: updated refs/heads/master to f82873e

Repository: cloudstack
Updated Branches:
  refs/heads/master 45a746ad2 -> f82873ebf


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/master
Commit: ba32ac1a7c643644c0b238fee622c726a0e6df22
Parents: 9eb8b2e
Author: Abhinandan Prateek <ap...@apache.org>
Authored: Fri Dec 2 13:37:47 2016 +0530
Committer: Abhinandan Prateek <ap...@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 {


[2/4] git commit: updated refs/heads/master to f82873e

Posted by bh...@apache.org.
Merge pull request #1765 from shapeblue/CLOUDSTACK-9586

Cloudstack 9586: When using local storage with Xenserver prepareTemplate does not work with multiple primary storeThe 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.

* pr/1765:
  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.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/master
Commit: 20aea27dc0dd2a212acd830d47945ea5ea579f0c
Parents: 9e4246a ba32ac1
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Dec 5 15:30:46 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Dec 5 15:31:25 2016 +0530

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



[3/4] git commit: updated refs/heads/master to f82873e

Posted by bh...@apache.org.
Merge branch '4.8' into 4.9


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

Branch: refs/heads/master
Commit: 48b28f7d6e72010bc365c5b8829a7f20e47c015b
Parents: 8d14e8e 20aea27
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Dec 5 15:32:03 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Dec 5 15:32:03 2016 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48b28f7d/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------


[4/4] git commit: updated refs/heads/master to f82873e

Posted by bh...@apache.org.
Merge branch '4.9'


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

Branch: refs/heads/master
Commit: f82873ebf85f068884921db8cf5fc2a4651f44c5
Parents: 45a746a 48b28f7
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Dec 5 15:32:11 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Dec 5 15:32:11 2016 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f82873eb/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------