cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject git commit: updated refs/heads/master to 4d6c682
Date Tue, 24 Jun 2014 21:16:58 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master cb5e8c591 -> 4d6c682f1


supporting nfs protocol and resize feature for managed storage for xenserver

resize feature refactored

Signed-off-by: Mike Tutkowski <mike.tutkowski@solidfire.com>


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

Branch: refs/heads/master
Commit: 4d6c682f18d9bca50c145b55d8fa61ea1ab71755
Parents: cb5e8c5
Author: punith-cloudbyte <punith.s@cloudbyte.com>
Authored: Mon Jun 16 18:53:18 2014 +0530
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Tue Jun 24 15:16:45 2014 -0600

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/DiskTO.java      |  2 +
 .../orchestration/VolumeOrchestrator.java       |  3 ++
 .../xenserver/resource/CitrixResourceBase.java  | 46 +++++++++++++++-----
 .../com/cloud/storage/VolumeApiServiceImpl.java |  2 +
 4 files changed, 43 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d6c682f/api/src/com/cloud/agent/api/to/DiskTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/DiskTO.java b/api/src/com/cloud/agent/api/to/DiskTO.java
index 5901367..afab856 100644
--- a/api/src/com/cloud/agent/api/to/DiskTO.java
+++ b/api/src/com/cloud/agent/api/to/DiskTO.java
@@ -32,6 +32,8 @@ public class DiskTO {
     public static final String STORAGE_HOST = "storageHost";
     public static final String STORAGE_PORT = "storagePort";
     public static final String VOLUME_SIZE = "volumeSize";
+    public static final String MOUNT_POINT = "mountpoint";
+    public static final String PROTOCOL_TYPE = "protocoltype";
 
     private DataTO data;
     private Long diskSeq;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d6c682f/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 050143c..ab0a76c 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -1050,6 +1050,9 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
         details.put(DiskTO.STORAGE_PORT, String.valueOf(storagePool.getPort()));
         details.put(DiskTO.VOLUME_SIZE, String.valueOf(volumeInfo.getSize()));
         details.put(DiskTO.IQN, volumeInfo.get_iScsiName());
+        details.put(DiskTO.MOUNT_POINT, volumeInfo.get_iScsiName());
+        VolumeVO volume = _volumeDao.findById(volumeInfo.getId());
+        details.put(DiskTO.PROTOCOL_TYPE, (volume.getPoolType()!=null)?volume.getPoolType().toString():null);
 
         ChapInfo chapInfo = volService.getChapInfo(volumeInfo, dataStore);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d6c682f/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index af76760..397e665 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -1883,20 +1883,48 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         String storageHost = details.get(DiskTO.STORAGE_HOST);
         String chapInitiatorUsername = details.get(DiskTO.CHAP_INITIATOR_USERNAME);
         String chapInitiatorSecret = details.get(DiskTO.CHAP_INITIATOR_SECRET);
+        String mountpoint = details.get(DiskTO.MOUNT_POINT);
+        String protocoltype=details.get(DiskTO.PROTOCOL_TYPE);
+
+        if(StoragePoolType.NetworkFilesystem.toString().equalsIgnoreCase(protocoltype)){
+        String poolid = storageHost+":"+mountpoint;
+        String namelable = mountpoint;
+        String volumedesc = storageHost+":"+mountpoint;
+
+        return getNfsSR(conn, poolid, namelable, storageHost, mountpoint, volumedesc);
+
+        }else{
 
         return getIscsiSR(conn, iScsiName, storageHost, iScsiName, chapInitiatorUsername,
chapInitiatorSecret, true);
+        }
     }
 
     protected VDI prepareManagedStorage(Connection conn, Map<String, String> details,
String path, String vdiNameLabel) throws Exception {
         SR sr = prepareManagedSr(conn, details);
 
         VDI vdi = getVDIbyUuid(conn, path, false);
+        Long volumeSize = Long.parseLong(details.get(DiskTO.VOLUME_SIZE));
 
         if (vdi == null) {
-            Long volumeSize = Long.parseLong(details.get(DiskTO.VOLUME_SIZE));
 
             vdi = createVdi(sr, vdiNameLabel, volumeSize);
-        }
+        }else {
+
+            // if vdi is not null, it must have been already created, check whether a resize
of volume was done
+            // if true , resize the vdi to the volume size
+            s_logger.info("checking for the resize of the datadisk");
+            long vdiVirtualsize = vdi.getVirtualSize(conn);
+
+            if(vdiVirtualsize != volumeSize){
+                s_logger.info("resizing the datadisk(vdi) from vdiVirtualsize :"+ vdiVirtualsize
+ "to volumeSize :" + volumeSize);
+
+                try {
+                    vdi.resize(conn, volumeSize);
+                } catch (Exception e) {
+                    s_logger.warn("Unable to resize volume",e);
+                }
+            }
+         }
 
         return vdi;
     }
@@ -5058,7 +5086,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         StorageFilerTO pool = cmd.getPool();
         try {
             if (pool.getType() == StoragePoolType.NetworkFilesystem) {
-                getNfsSR(conn, pool);
+                getNfsSR(conn, Long.toString(pool.getId()),pool.getUuid(),pool.getHost(),pool.getPath(),pool.toString());
             } else if (pool.getType() == StoragePoolType.IscsiLUN) {
                 getIscsiSR(conn, pool.getUuid(), pool.getHost(), pool.getPath(), null, null,
false);
             } else if (pool.getType() == StoragePoolType.PreSetup) {
@@ -6068,11 +6096,9 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         }
     }
 
-    protected SR getNfsSR(Connection conn, StorageFilerTO pool) {
+    protected SR getNfsSR(Connection conn,String poolid,String uuid, String server,String
serverpath,String pooldesc) {
         Map<String, String> deviceConfig = new HashMap<String, String>();
         try {
-            String server = pool.getHost();
-            String serverpath = pool.getPath();
             serverpath = serverpath.replace("//", "/");
             Set<SR> srs = SR.getAll(conn);
             for (SR sr : srs) {
@@ -6103,7 +6129,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
 
                 if (server.equals(dc.get("server")) && serverpath.equals(dc.get("serverpath")))
{
                     throw new CloudRuntimeException("There is a SR using the same configuration
server:" + dc.get("server") + ", serverpath:" + dc.get("serverpath") +
-                            " for pool " + pool.getUuid() + "on host:" + _host.uuid);
+                            " for pool " + uuid + "on host:" + _host.uuid);
                 }
 
             }
@@ -6112,13 +6138,13 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
             Host host = Host.getByUuid(conn, _host.uuid);
             Map<String, String> smConfig = new HashMap<String, String>();
             smConfig.put("nosubdir", "true");
-            SR sr = SR.create(conn, host, deviceConfig, new Long(0), pool.getUuid(), Long.toString(pool.getId()),
SRType.NFS.toString(), "user", true, smConfig);
+            SR sr = SR.create(conn, host, deviceConfig, new Long(0), uuid, poolid, SRType.NFS.toString(),
"user", true, smConfig);
             sr.scan(conn);
             return sr;
         } catch (XenAPIException e) {
-            throw new CloudRuntimeException("Unable to create NFS SR " + pool.toString(),
e);
+            throw new CloudRuntimeException("Unable to create NFS SR " + pooldesc, e);
         } catch (XmlRpcException e) {
-            throw new CloudRuntimeException("Unable to create NFS SR " + pool.toString(),
e);
+            throw new CloudRuntimeException("Unable to create NFS SR " + pooldesc, e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d6c682f/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index fff6b11..76bc50c 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -2093,6 +2093,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             details.put(DiskTO.STORAGE_PORT, String.valueOf(volumeToAttachStoragePool.getPort()));
             details.put(DiskTO.VOLUME_SIZE, String.valueOf(volumeToAttach.getSize()));
             details.put(DiskTO.IQN, volumeToAttach.get_iScsiName());
+            details.put(DiskTO.MOUNT_POINT, volumeToAttach.get_iScsiName());
+            details.put(DiskTO.PROTOCOL_TYPE, (volumeToAttach.getPoolType()!=null) ? volumeToAttach.getPoolType().toString()
: null);
 
             if (chapInfo != null) {
                 details.put(DiskTO.CHAP_INITIATOR_USERNAME, chapInfo.getInitiatorUsername());


Mime
View raw message