cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshbatt...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 28fcd36
Date Fri, 03 Jan 2014 12:02:28 GMT
Updated Branches:
  refs/heads/master e59420c51 -> 28fcd3629


CLOUDSTACK-5658 CLOUDSTACK-5563  deploying VM from template created from volumes fails


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

Branch: refs/heads/master
Commit: cd43921fda02a391ae461095ae95893c7a2c4817
Parents: e59420c
Author: Rajesh Battala <rajesh.battala@citrix.com>
Authored: Fri Jan 3 15:32:06 2014 +0530
Committer: Rajesh Battala <rajesh.battala@citrix.com>
Committed: Fri Jan 3 17:25:54 2014 +0530

----------------------------------------------------------------------
 .../HypervResource/CloudStackTypes.cs           |  4 ++-
 .../HypervResource/HypervResourceController.cs  | 36 ++++++++++++++++----
 2 files changed, 33 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd43921f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
index 020f761..314c26b 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
@@ -346,6 +346,7 @@ namespace HypervResource
         public PrimaryDataStoreTO primaryDataStore = null;
         public string path;
         public string checksum;
+        public string size;
 
         public static TemplateObjectTO ParseJson(dynamic json)
         {
@@ -360,7 +361,8 @@ namespace HypervResource
                     name = (string)templateObjectTOJson.name,
                     uuid = (string)templateObjectTOJson.uuid,
                     path = (string)templateObjectTOJson.path,
-                    checksum = (string)templateObjectTOJson.checksum
+                    checksum = (string)templateObjectTOJson.checksum,
+                    size = (string)templateObjectTOJson.size
                 };
                 result.s3DataStoreTO = S3TO.ParseJson(templateObjectTOJson.imageDataStore);
                 result.nfsDataStoreTO = NFSTO.ParseJson(templateObjectTOJson.imageDataStore);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd43921f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
index 54adc7a..1725169 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -1319,15 +1319,17 @@ namespace HypervResource
                 bool result = false;
                 string details = null;
                 object newData = null;
+                TemplateObjectTO destTemplateObjectTO = null;
+                VolumeObjectTO destVolumeObjectTO = null;
 
                 try
                 {
                     dynamic timeout = cmd.wait;  // TODO: Useful?
 
                     TemplateObjectTO srcTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.srcTO);
-                    TemplateObjectTO destTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.destTO);
+                    destTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.destTO);
                     VolumeObjectTO srcVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.srcTO);
-                    VolumeObjectTO destVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.destTO);
+                    destVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.destTO);
 
                     string destFile = null;
                     if (destTemplateObjectTO != null)
@@ -1469,7 +1471,16 @@ namespace HypervResource
                             {
                                 // TODO: thin provision instead of copying the full file.
                                 File.Copy(srcFile, destFile);
-                                newData = cmd.destTO;
+                                VolumeObjectTO volume = new VolumeObjectTO();
+                                volume.path = destFile;
+                                volume.dataStore = destVolumeObjectTO.dataStore;
+                                volume.name = destVolumeObjectTO.name;
+                                volume.size = ulong.Parse(destVolumeObjectTO.size.ToString());
+                                volume.format = destVolumeObjectTO.format;
+                                volume.nfsDataStore = destVolumeObjectTO.nfsDataStore;
+                                volume.primaryDataStore = destVolumeObjectTO.primaryDataStore;
+                                JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.VolumeObjectTO,
volume);
+                                newData = ansObj;
                                 result = true;
                             }
                         }
@@ -1501,7 +1512,12 @@ namespace HypervResource
                                 // doesn't do anything if the directory is already present.
                                 Directory.CreateDirectory(Path.GetDirectoryName(destFile));
                                 File.Copy(srcFile, destFile);
-                                newData = cmd.destTO;
+                                // create volumeto object deserialize and send it 
+                                VolumeObjectTO volume = new VolumeObjectTO();
+                                volume.path = destFile;
+                                volume.size = ulong.Parse(destVolumeObjectTO.size.ToString());
+                                JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.VolumeObjectTO,
volume);
+                                newData = ansObj;
                                 result = true;
                             }
                         }
@@ -1533,7 +1549,15 @@ namespace HypervResource
                                 // doesn't do anything if the directory is already present.
                                 Directory.CreateDirectory(Path.GetDirectoryName(destFile));
                                 File.Copy(srcFile, destFile);
-                                newData = cmd.destTO;
+                                TemplateObjectTO destTemplateObject = new TemplateObjectTO();
+                                destTemplateObject.size = srcVolumeObjectTO.size.ToString();
+                                destTemplateObject.format = srcVolumeObjectTO.format;
+                                destTemplateObject.path = destFile;
+                                destTemplateObject.nfsDataStoreTO = destTemplateObjectTO.nfsDataStoreTO;
+                                destTemplateObject.checksum = destTemplateObjectTO.checksum;
+                                newData = destTemplateObject;
+                                JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.TemplateObjectTO,
destTemplateObject);
+                                newData = ansObj;
                                 result = true;
                             }
                         }
@@ -1554,7 +1578,7 @@ namespace HypervResource
                 {
                     result = result,
                     details = details,
-                    newData = cmd.destTO,
+                    newData = newData,
                     contextMap = contextMap
                 };
                 return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CopyCmdAnswer);


Mime
View raw message