mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5788, CLOUDSTACK-5789: Attaching upload volume and download
volume was failing for hyper-v. Copy command answer was failing while creating the answer object. Fixing the issue.
This commit is contained in:
parent
1069f56f8e
commit
3116f51a26
@ -187,7 +187,7 @@ namespace HypervResource
|
||||
throw new InvalidDataException(errMsg);
|
||||
}
|
||||
|
||||
if (!Path.HasExtension(fileName) && this.format != null)
|
||||
if (fileName != null && !Path.HasExtension(fileName) && this.format != null)
|
||||
{
|
||||
fileName = fileName + "." + this.format.ToLowerInvariant();
|
||||
}
|
||||
|
||||
@ -1321,14 +1321,16 @@ namespace HypervResource
|
||||
object newData = null;
|
||||
TemplateObjectTO destTemplateObjectTO = null;
|
||||
VolumeObjectTO destVolumeObjectTO = null;
|
||||
VolumeObjectTO srcVolumeObjectTO = null;
|
||||
TemplateObjectTO srcTemplateObjectTO = null;
|
||||
|
||||
try
|
||||
{
|
||||
dynamic timeout = cmd.wait; // TODO: Useful?
|
||||
|
||||
TemplateObjectTO srcTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.srcTO);
|
||||
srcTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.srcTO);
|
||||
destTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.destTO);
|
||||
VolumeObjectTO srcVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.srcTO);
|
||||
srcVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.srcTO);
|
||||
destVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.destTO);
|
||||
|
||||
string destFile = null;
|
||||
@ -1512,11 +1514,9 @@ namespace HypervResource
|
||||
// doesn't do anything if the directory is already present.
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destFile));
|
||||
File.Copy(srcFile, destFile);
|
||||
// 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);
|
||||
// Create volumeto object deserialize and send it
|
||||
destVolumeObjectTO.path = destFile;
|
||||
JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.VolumeObjectTO, destVolumeObjectTO);
|
||||
newData = ansObj;
|
||||
result = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user