You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/01/03 11:17:40 UTC
[07/50] [abbrv] git commit: updated refs/heads/opendaylight to 858fb69
CLOUDSTACK-5605: Fixing GetStorage stats command for hyper-v. The agent
wasn't looking up the share path correctly for reading the stats of a smb
share.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/faa503d6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/faa503d6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/faa503d6
Branch: refs/heads/opendaylight
Commit: faa503d6fc5b6f7ef7ef9d63d15d07b392675d13
Parents: dc0420c
Author: Devdeep Singh <de...@gmail.com>
Authored: Wed Jan 1 14:29:43 2014 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed Jan 1 14:33:33 2014 +0530
----------------------------------------------------------------------
.../HypervResource/HypervResourceController.cs | 51 +++++++++++++++++---
1 file changed, 44 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/faa503d6/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 0189627..54adc7a 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -909,18 +909,23 @@ namespace HypervResource
var tInfo = new Dictionary<string, string>();
long capacityBytes = 0;
long availableBytes = 0;
+ string hostPath = null;
if (poolType == StoragePoolType.Filesystem)
{
GetCapacityForLocalPath(localPath, out capacityBytes, out availableBytes);
+ hostPath = localPath;
}
else if (poolType == StoragePoolType.NetworkFilesystem)
{
NFSTO share = new NFSTO();
String uriStr = "cifs://" + (string)cmd.pool.host + (string)cmd.pool.path;
share.uri = new Uri(uriStr);
+ hostPath = Utils.NormalizePath(share.UncPath);
+
// Check access to share.
Utils.ConnectToRemote(share.UncPath, share.Domain, share.User, share.Password);
Utils.GetShareDetails(share.UncPath, out capacityBytes, out availableBytes);
+ config.setPrimaryStorage((string)cmd.pool.uuid, hostPath);
}
else
{
@@ -932,8 +937,8 @@ namespace HypervResource
{
uuid = uuid,
host = cmd.pool.host,
- localPath = cmd.pool.host,
- hostPath = cmd.localPath,
+ hostPath = cmd.pool.path,
+ localPath = hostPath,
poolType = cmd.pool.type,
capacityBytes = capacityBytes,
availableBytes = availableBytes
@@ -943,6 +948,7 @@ namespace HypervResource
{
result = result,
details = details,
+ localPath = hostPath,
templateInfo = tInfo,
poolInfo = poolInfo,
contextMap = contextMap
@@ -1645,11 +1651,42 @@ namespace HypervResource
long used = 0;
try
{
- string localPath = (string)cmd.localPath;
- GetCapacityForLocalPath(localPath, out capacity, out available);
- used = capacity - available;
- result = true;
- logger.Debug(CloudStackTypes.GetStorageStatsCommand + " set used bytes to " + used);
+ StoragePoolType poolType;
+ string poolId = (string)cmd.id;
+ string hostPath = null;
+ if (!Enum.TryParse<StoragePoolType>((string)cmd.pooltype, out poolType))
+ {
+ details = "Request to get unsupported pool type: " + ((string)cmd.pooltype == null ? "NULL" : (string)cmd.pooltype) + "in cmd " +
+ JsonConvert.SerializeObject(cmd);
+ logger.Error(details);
+ }
+ else if (poolType == StoragePoolType.Filesystem)
+ {
+ hostPath = (string)cmd.localPath;;
+ GetCapacityForLocalPath(hostPath, out capacity, out available);
+ used = capacity - available;
+ result = true;
+ }
+ else if (poolType == StoragePoolType.NetworkFilesystem)
+ {
+ string sharePath = config.getPrimaryStorage((string)cmd.id);
+ if (sharePath != null)
+ {
+ hostPath = sharePath;
+ Utils.GetShareDetails(sharePath, out capacity, out available);
+ used = capacity - available;
+ result = true;
+ }
+ }
+ else
+ {
+ result = false;
+ }
+
+ if (result)
+ {
+ logger.Debug(CloudStackTypes.GetStorageStatsCommand + " set used bytes for " + hostPath + " to " + used);
+ }
}
catch (Exception ex)
{