cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject [05/27] git commit: updated refs/heads/master to d4d5cab
Date Fri, 28 Mar 2014 23:35:12 GMT
fix devcloud: after devcloud vm itself reboot, local storage's name label is changed to orignal

Conflicts:
	plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java


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

Branch: refs/heads/master
Commit: a72222dd4667e9c621a78740a0ec23e20fed228c
Parents: b985596
Author: Edison Su <sudison@gmail.com>
Authored: Tue Jan 14 14:35:18 2014 -0800
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Fri Mar 28 16:21:04 2014 -0700

----------------------------------------------------------------------
 .../hypervisor/xen/resource/XcpOssResource.java | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a72222dd/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 36400f2..e84a583 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
@@ -35,15 +35,20 @@ import com.cloud.agent.api.NetworkUsageCommand;
 import com.cloud.agent.api.StartAnswer;
 import com.cloud.agent.api.StartCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.StartupStorageCommand;
 import com.cloud.agent.api.StopAnswer;
 import com.cloud.agent.api.StopCommand;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.agent.api.StoragePoolInfo;
 import com.cloud.resource.ServerResource;
+import com.cloud.storage.Storage;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.SR;
 import com.xensource.xenapi.Types;
 import com.xensource.xenapi.Types.XenAPIException;
 import com.xensource.xenapi.VBD;
@@ -74,6 +79,38 @@ public class XcpOssResource extends CitrixResourceBase {
         cmd.setCaps(cmd.getCapabilities() + " , hvm");
     }
 
+    protected StartupStorageCommand initializeLocalSR(Connection conn) {
+        SR extsr = getLocalEXTSR(conn);
+        if (extsr != null) {
+            try {
+                String extuuid = extsr.getUuid(conn);
+                _host.localSRuuid = extuuid;
+                long cap = extsr.getPhysicalSize(conn);
+                if (cap > 0) {
+                    long avail = cap - extsr.getPhysicalUtilisation(conn);
+                    String name = "Cloud Stack Local EXT Storage Pool for " + _host.uuid;
+                    extsr.setNameDescription(conn, name);
+                    Host host = Host.getByUuid(conn, _host.uuid);
+                    String address = host.getAddress(conn);
+                    StoragePoolInfo pInfo = new StoragePoolInfo(extsr.getNameLabel(conn),
address, SRType.EXT.toString(), SRType.EXT.toString(), Storage.StoragePoolType.EXT, cap, avail);
+                    StartupStorageCommand cmd = new StartupStorageCommand();
+                    cmd.setPoolInfo(pInfo);
+                    cmd.setGuid(_host.uuid);
+                    cmd.setDataCenter(Long.toString(_dcId));
+                    cmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
+                    return cmd;
+                }
+            } catch (XenAPIException e) {
+                String msg = "build local EXT info err in host:" + _host.uuid + e.toString();
+                s_logger.warn(msg);
+            } catch (XmlRpcException e) {
+                String msg = "build local EXT info err in host:" + _host.uuid + e.getMessage();
+                s_logger.warn(msg);
+            }
+        }
+        return null;
+    }
+
     @Override
     protected String getGuestOsType(String stdType, boolean bootFromCD) {
     	if (stdType.equalsIgnoreCase("Debian GNU/Linux 6(64-bit)")) {


Mime
View raw message