Updated Branches:
  refs/heads/4.2 3eacdb154 -> f856c359e

CLOUDSTACK-3229: deleteSnapshotBackup failed on devcloud due to
different SR mount point on devcloud hypervisor.


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

Branch: refs/heads/4.2
Commit: f856c359eb274c6cbbb2656c791b461ac4a4c49d
Parents: 3eacdb1
Author: Min Chen <[email protected]>
Authored: Thu Aug 15 17:52:25 2013 -0700
Committer: Min Chen <[email protected]>
Committed: Thu Aug 15 17:52:44 2013 -0700

----------------------------------------------------------------------
 .../hypervisor/xen/resource/XcpOssResource.java | 105 ++++++++++---------
 .../xen/resource/XenServerStorageProcessor.java |   4 +
 2 files changed, 62 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f856c359/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
index 5261ca0..cb885c3 100644
--- 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
+++ 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
@@ -41,6 +41,8 @@ import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.resource.ServerResource;
+import com.cloud.storage.resource.StorageSubsystemCommandHandler;
+import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import com.cloud.vm.VirtualMachine;
@@ -71,35 +73,36 @@ public class XcpOssResource extends CitrixResourceBase {
     }
 
     @Override
-       protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) 
{
-       super.fillHostInfo(conn, cmd);
-       cmd.setCaps(cmd.getCapabilities() + " , hvm");
+    protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
+        super.fillHostInfo(conn, cmd);
+        cmd.setCaps(cmd.getCapabilities() + " , hvm");
     }
 
     @Override
     protected String getGuestOsType(String stdType, boolean bootFromCD) {
-       if (stdType.equalsIgnoreCase("Debian GNU/Linux 6(64-bit)")) {
-               return "Debian Squeeze 6.0 (64-bit)";
-       } else {
-               return CitrixHelper.getXcpGuestOsType(stdType);
-       }
+        if (stdType.equalsIgnoreCase("Debian GNU/Linux 6(64-bit)")) {
+            return "Debian Squeeze 6.0 (64-bit)";
+        } else {
+            return CitrixHelper.getXcpGuestOsType(stdType);
+        }
     }
 
+    @Override
     protected VBD createPatchVbd(Connection conn, String vmName, VM vm) throws 
XmlRpcException, XenAPIException {
-       if (_host.localSRuuid != null) {
-               //create an iso vdi on it
-               String result = callHostPlugin(conn, "vmops", "createISOVHD", 
"uuid", _host.localSRuuid);
-               if (result == null || result.equalsIgnoreCase("Failed")) {
-                        throw new CloudRuntimeException("can not create 
systemvm vdi");
-               }
-
-               Set<VDI> vdis = VDI.getByNameLabel(conn, "systemvm-vdi");
-               if (vdis.size() != 1) {
-                       throw new CloudRuntimeException("can not find 
systemvmiso");
-               }
-               VDI systemvmVDI = vdis.iterator().next();
-
-               VBD.Record cdromVBDR = new VBD.Record();
+        if (_host.localSRuuid != null) {
+            //create an iso vdi on it
+            String result = callHostPlugin(conn, "vmops", "createISOVHD", 
"uuid", _host.localSRuuid);
+            if (result == null || result.equalsIgnoreCase("Failed")) {
+                throw new CloudRuntimeException("can not create systemvm vdi");
+            }
+
+            Set<VDI> vdis = VDI.getByNameLabel(conn, "systemvm-vdi");
+            if (vdis.size() != 1) {
+                throw new CloudRuntimeException("can not find systemvmiso");
+            }
+            VDI systemvmVDI = vdis.iterator().next();
+
+            VBD.Record cdromVBDR = new VBD.Record();
             cdromVBDR.VM = vm;
             cdromVBDR.empty = false;
             cdromVBDR.bootable = false;
@@ -109,9 +112,9 @@ public class XcpOssResource extends CitrixResourceBase {
             cdromVBDR.VDI = systemvmVDI;
             VBD cdromVBD = VBD.create(conn, cdromVBDR);
             return cdromVBD;
-       } else {
-                throw new CloudRuntimeException("can not find local sr");
-       }
+        } else {
+            throw new CloudRuntimeException("can not find local sr");
+        }
     }
 
 
@@ -143,36 +146,44 @@ public class XcpOssResource extends CitrixResourceBase {
 
     @Override
     public StartAnswer execute(StartCommand cmd) {
-       StartAnswer answer = super.execute(cmd);
-
-       VirtualMachineTO vmSpec = cmd.getVirtualMachine();
-       if (vmSpec.getType() == VirtualMachine.Type.ConsoleProxy) {
-               Connection conn = getConnection();
-               String publicIp = null;
-               for (NicTO nic : vmSpec.getNics()) {
-                       if (nic.getType() == TrafficType.Guest) {
-                               publicIp = nic.getIp();
-                       }
-               }
-               callHostPlugin(conn, "vmops", "setDNATRule", "ip", publicIp, 
"port", "8443", "add", "true");
-       }
-
-       return answer;
+        StartAnswer answer = super.execute(cmd);
+
+        VirtualMachineTO vmSpec = cmd.getVirtualMachine();
+        if (vmSpec.getType() == VirtualMachine.Type.ConsoleProxy) {
+            Connection conn = getConnection();
+            String publicIp = null;
+            for (NicTO nic : vmSpec.getNics()) {
+                if (nic.getType() == TrafficType.Guest) {
+                    publicIp = nic.getIp();
+                }
+            }
+            callHostPlugin(conn, "vmops", "setDNATRule", "ip", publicIp, 
"port", "8443", "add", "true");
+        }
+
+        return answer;
     }
 
     @Override
     public StopAnswer execute(StopCommand cmd) {
-       StopAnswer answer = super.execute(cmd);
-       String vmName = cmd.getVmName();
-       if (vmName.startsWith("v-")) {
-               Connection conn = getConnection();
-               callHostPlugin(conn, "vmops", "setDNATRule", "add", "false");
-       }
-       return answer;
+        StopAnswer answer = super.execute(cmd);
+        String vmName = cmd.getVmName();
+        if (vmName.startsWith("v-")) {
+            Connection conn = getConnection();
+            callHostPlugin(conn, "vmops", "setDNATRule", "add", "false");
+        }
+        return answer;
     }
 
     @Override
     protected void setMemory(Connection conn, VM vm, long minMemsize, long 
maxMemsize) throws XmlRpcException, XenAPIException {
         vm.setMemoryLimits(conn, mem_32m, maxMemsize, minMemsize, maxMemsize);
     }
+
+    @Override
+    protected StorageSubsystemCommandHandler getStorageHandler() {
+        XenServerStorageProcessor processor = new 
XenServerStorageProcessor(this);
+        processor.setBaseMountPointOnHost("/run/cloud_mount"); // sr mount 
point on devcloud
+        return new StorageSubsystemCommandHandlerBase(processor);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f856c359/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
index 60f1ef9..39ecd9a 100644
--- 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
+++ 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
@@ -91,6 +91,10 @@ public class XenServerStorageProcessor implements 
StorageProcessor {
         this.hypervisorResource = resource;
     }
 
+    public void setBaseMountPointOnHost(String baseMountPointOnHost) {
+        BaseMountPointOnHost = baseMountPointOnHost;
+    }
+
     @Override
     public AttachAnswer attachIso(AttachCommand cmd) {
         DiskTO disk = cmd.getDisk();

Reply via email to