You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/12/11 15:10:48 UTC
git commit: updated refs/heads/4.3 to 3cd004c
Updated Branches:
refs/heads/4.3 5dea7728a -> 3cd004c92
CLOUDSTACK-5455: Fix detach iso on hyperv. Made sure normalized path is
used while attaching and detaching iso. Also made normalization of path
across the agent code.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3cd004c9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3cd004c9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3cd004c9
Branch: refs/heads/4.3
Commit: 3cd004c924f4c6095672a5ed7eb8a16cc2997072
Parents: 5dea772
Author: Devdeep Singh <de...@gmail.com>
Authored: Thu Dec 12 02:27:58 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed Dec 11 19:29:19 2013 +0530
----------------------------------------------------------------------
.../ServerResource/HypervResource/CloudStackTypes.cs | 2 +-
.../HypervResource/HypervResourceController.cs | 11 +++++------
.../DotNet/ServerResource/HypervResource/Utils.cs | 14 ++++++++++++--
.../ServerResource/HypervResource/WmiCallsV2.cs | 2 +-
4 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cd004c9/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 ce1b1e8..f4d25ec 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
@@ -160,7 +160,7 @@ namespace HypervResource
else
{
fileName = @"\\" + this.primaryDataStore.uri.Host + this.primaryDataStore.uri.LocalPath + @"\" + this.name;
- fileName = fileName.Replace(@"/", @"\");
+ fileName = Utils.NormalizePath(fileName);
}
if (this.format != null)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cd004c9/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 f5a76cf..04b6c3a 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -223,7 +223,7 @@ namespace HypervResource
Utils.ConnectToRemote(share.UncPath, share.Domain, share.User, share.Password);
// The share is mapped, now attach the iso
- string isoPath = Path.Combine(share.UncPath.Replace('/', Path.DirectorySeparatorChar), dataStore.path);
+ string isoPath = Utils.NormalizePath(Path.Combine(share.UncPath, dataStore.path));
wmiCallsV2.AttachIso(vmName, isoPath);
result = true;
}
@@ -267,8 +267,7 @@ namespace HypervResource
{
NFSTO share = dataStore.nfsDataStoreTO;
// The share is mapped, now attach the iso
- string isoPath = Path.Combine(share.UncPath.Replace('/', Path.DirectorySeparatorChar),
- dataStore.path.Replace('/', Path.DirectorySeparatorChar));
+ string isoPath = Utils.NormalizePath(Path.Combine(share.UncPath, dataStore.path));
wmiCallsV2.DetachDisk(vmName, isoPath);
result = true;
}
@@ -957,7 +956,7 @@ namespace HypervResource
share.uri = new Uri(uriStr);
string defaultDataPath = wmiCallsV2.GetDefaultDataRoot();
- string secondaryPath = Path.Combine(share.UncPath, "systemvm").Replace(@"/", @"\");
+ string secondaryPath = Utils.NormalizePath(Path.Combine(share.UncPath, "systemvm"));
string[] choices = choices = Directory.GetFiles(secondaryPath, "systemvm*.iso");
if (choices.Length != 1)
{
@@ -966,7 +965,7 @@ namespace HypervResource
}
else
{
- systemVmIsoPath = Path.Combine(defaultDataPath, Path.GetFileName(choices[0]));
+ systemVmIsoPath = Utils.NormalizePath(Path.Combine(defaultDataPath, Path.GetFileName(choices[0])));
if (!File.Exists(systemVmIsoPath))
{
Utils.DownloadCifsFileToLocalFile(choices[0], share, systemVmIsoPath);
@@ -1057,7 +1056,7 @@ namespace HypervResource
else
{
volumePath = @"\\" + primary.uri.Host + primary.uri.LocalPath + @"\" + volumeName;
- volumePath = volumePath.Replace('/', '\\');
+ volumePath = Utils.NormalizePath(volumePath);
Utils.ConnectToRemote(primary.UncPath, primary.Domain, primary.User, primary.Password);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cd004c9/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
index 0f7505d..c4b39ba 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
@@ -56,6 +56,16 @@ namespace HypervResource
return objContent;
}
+ public static string NormalizePath(string path)
+ {
+ if (!String.IsNullOrEmpty(path))
+ {
+ path = path.Replace('/', Path.DirectorySeparatorChar);
+ }
+
+ return path;
+ }
+
/// <summary>
/// Copy file on network share to local volume.
/// </summary>
@@ -80,7 +90,7 @@ namespace HypervResource
if (filePathRelativeToShare.EndsWith(".iso") || filePathRelativeToShare.EndsWith(".vhd") || filePathRelativeToShare.EndsWith(".vhdx"))
{
dest = Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare);
- dest = dest.Replace('/', Path.DirectorySeparatorChar);
+ dest = Utils.NormalizePath(dest);
}
// if the filePathRelativeToShare string don't have filename and only a dir point then find the vhd files in that folder and use
// In the clean setup, first copy command wont be having the filename it contains onlyu dir path.
@@ -117,7 +127,7 @@ namespace HypervResource
{
NETRESOURCE nr = new NETRESOURCE();
nr.dwType = RESOURCETYPE_DISK;
- nr.lpRemoteName = remoteUNC.Replace('/', Path.DirectorySeparatorChar);
+ nr.lpRemoteName = Utils.NormalizePath(remoteUNC);
if (domain != null)
{
username = domain + @"\" + username;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cd004c9/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index b2feab3..c89f837 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -335,7 +335,7 @@ namespace HypervResource
NFSTO share = templateInfo.nfsDataStoreTO;
Utils.ConnectToRemote(share.UncPath, share.Domain, share.User, share.Password);
// The share is mapped, now attach the iso
- isoPath = Path.Combine(share.UncPath.Replace('/', Path.DirectorySeparatorChar), templateInfo.path);
+ isoPath = Utils.NormalizePath(Path.Combine(share.UncPath, templateInfo.path));
}
string driveType = diskDrive.type;