cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [03/28] git commit: updated refs/heads/4.4 to 392dc81
Date Fri, 28 Mar 2014 00:39:12 GMT
fix devcloud: after devcloud vm itself reboot, local storage's name label is changed to orignal


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

Branch: refs/heads/4.4
Commit: fc3e413584bf3e6e4b2ed14ddaaec128959a6092
Parents: 5b16ccb
Author: Edison Su <sudison@gmail.com>
Authored: Tue Jan 14 14:35:18 2014 -0800
Committer: Edison Su <sudison@gmail.com>
Committed: Thu Mar 27 17:38:36 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc3e4135/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 f136489..14b4bf3 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
@@ -33,12 +33,17 @@ import com.cloud.agent.api.Command;
 import com.cloud.agent.api.NetworkUsageAnswer;
 import com.cloud.agent.api.NetworkUsageCommand;
 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.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;
@@ -69,6 +74,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