Repository: cloudstack
Updated Branches:
  refs/heads/4.3 c8929dfd1 -> 88d222aba


CLOUDSTACK-6438, CLOUDSTACK-6442: XAPI plugins must be copied to XS master first

Backported fix for 4.3 using e0e226869d83189dcdb69e3c18b24c47e2b8f1fe by:
Anthony Xu <anthony...@citrix.com>

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


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

Branch: refs/heads/4.3
Commit: 88d222abaa4bffa09370348f1b5e143179c56781
Parents: c8929df
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
Authored: Tue Nov 11 15:38:15 2014 +0530
Committer: Rohit Yadav <rohit.ya...@shapeblue.com>
Committed: Tue Nov 11 15:38:15 2014 +0530

----------------------------------------------------------------------
 .../hypervisor/xen/resource/CitrixResourceBase.java | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88d222ab/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 1f37167..3198917 100644
--- 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -5053,8 +5053,16 @@ public abstract class CitrixResourceBase implements 
ServerResource, HypervisorRe
 
     protected SetupAnswer execute(SetupCommand cmd) {
         Connection conn = getConnection();
-        setupServer(conn);
         try {
+            Map<Pool, Pool.Record> poolRecs = Pool.getAllRecords(conn);
+            if (poolRecs.size() != 1) {
+                throw new CloudRuntimeException("There are " + poolRecs.size() 
+ " pool for host :" + _host.uuid);
+            }
+            Host master = poolRecs.values().iterator().next().master;
+            setupServer(conn, master);
+            Host host = Host.getByUuid(conn, _host.uuid);
+            setupServer(conn, host);
+
             if (!setIptables(conn)) {
                 s_logger.warn("set xenserver Iptable failed");
                 return null;
@@ -5070,7 +5078,6 @@ public abstract class CitrixResourceBase implements 
ServerResource, HypervisorRe
             }
 
             cleanupTemplateSR(conn);
-            Host host = Host.getByUuid(conn, _host.uuid);
             try {
                 if (cmd.useMultipath()) {
                     // the config value is set to true
@@ -5177,14 +5184,11 @@ public abstract class CitrixResourceBase implements 
ServerResource, HypervisorRe
     }
 
     /* return : if setup is needed */
-    protected boolean setupServer(Connection conn) {
+    protected boolean setupServer(Connection conn, Host host) {
         String packageVersion = 
CitrixResourceBase.class.getPackage().getImplementationVersion();
         String version = this.getClass().getName() + "-" + ( packageVersion == 
null ? Long.toString(System.currentTimeMillis()) : packageVersion );
 
         try {
-            Host host = Host.getByUuid(conn, _host.uuid);
-            /* enable host in case it is disabled somehow */
-            host.enable(conn);
             /* push patches to XenServer */
             Host.Record hr = host.getRecord(conn);
 

Reply via email to