You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2013/12/05 10:12:28 UTC
git commit: updated refs/heads/4.3 to 26020fc
Updated Branches:
refs/heads/4.3 60c180086 -> 26020fc07
added support to run hyperv agent on 0.0.0.0 and startuprouting command will discover the ip details and send in response
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/26020fc0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/26020fc0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/26020fc0
Branch: refs/heads/4.3
Commit: 26020fc078cc1d043ea04d860c7e73d3de01a7ec
Parents: 60c1800
Author: Rajesh Battala <ra...@citrix.com>
Authored: Thu Dec 5 14:46:20 2013 +0530
Committer: Rajesh Battala <ra...@citrix.com>
Committed: Thu Dec 5 14:46:44 2013 +0530
----------------------------------------------------------------------
.../ServerResource/HypervResource/App.config | 6 ++---
.../HypervResource/HypervResourceController.cs | 26 ++++++++++++++------
2 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26020fc0/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/App.config
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/App.config b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/App.config
index 1bf17d4..0e75ef9 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/App.config
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/App.config
@@ -24,7 +24,7 @@
<value>8</value>
</setting>
<setting name="private_ip_address" serializeAs="String">
- <value>10.1.1.1</value>
+ <value>0.0.0.0</value>
</setting>
<setting name="type" serializeAs="String">
<value>Routing</value>
@@ -45,13 +45,13 @@
<value>34359738368</value>
</setting>
<setting name="host" serializeAs="String">
- <value>camldonall01.citrite.net</value>
+ <value>0.0.0.0</value>
</setting>
<setting name="pod" serializeAs="String">
<value>1</value>
</setting>
<setting name="gateway_ip_address" serializeAs="String">
- <value>10.70.176.1</value>
+ <value>0.0.0.0</value>
</setting>
<setting name="cluster" serializeAs="String">
<value>2</value>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26020fc0/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 f500812..201d580 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -1609,13 +1609,19 @@ namespace HypervResource
dynamic strtRouteCmd = cmdArray[0][CloudStackTypes.StartupRoutingCommand];
// Insert networking details
- strtRouteCmd.privateIpAddress = config.PrivateIpAddress;
- strtRouteCmd.privateNetmask = config.PrivateNetmask;
- strtRouteCmd.privateMacAddress = config.PrivateMacAddress;
- strtRouteCmd.storageIpAddress = config.PrivateIpAddress;
- strtRouteCmd.storageNetmask = config.PrivateNetmask;
- strtRouteCmd.storageMacAddress = config.PrivateMacAddress;
- strtRouteCmd.gatewayIpAddress = config.GatewayIpAddress;
+ string privateIpAddress = strtRouteCmd.privateIpAddress;
+ string subnet;
+ System.Net.NetworkInformation.NetworkInterface privateNic = GetNicInfoFromIpAddress(privateIpAddress, out subnet);
+ strtRouteCmd.privateIpAddress = privateIpAddress;
+ strtRouteCmd.privateNetmask = subnet;
+ strtRouteCmd.privateMacAddress = privateNic.GetPhysicalAddress().ToString();
+ string storageip = strtRouteCmd.storageIpAddress;
+ System.Net.NetworkInformation.NetworkInterface storageNic = GetNicInfoFromIpAddress(storageip, out subnet);
+
+ strtRouteCmd.storageIpAddress = storageip;
+ strtRouteCmd.storageNetmask = subnet;
+ strtRouteCmd.storageMacAddress = storageNic.GetPhysicalAddress().ToString();
+ strtRouteCmd.gatewayIpAddress = storageNic.GetPhysicalAddress().ToString();
strtRouteCmd.caps = "hvm";
// Detect CPUs, speed, memory
@@ -1696,9 +1702,11 @@ namespace HypervResource
public static System.Net.NetworkInformation.NetworkInterface GetNicInfoFromIpAddress(string ipAddress, out string subnet)
{
System.Net.NetworkInformation.NetworkInterface[] nics = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
+ System.Net.NetworkInformation.NetworkInterface defaultnic = null;
foreach (var nic in nics)
{
subnet = null;
+ defaultnic = nic;
// TODO: use to remove NETMASK and MAC from the config file, and to validate the IPAddress.
var nicProps = nic.GetIPProperties();
bool found = false;
@@ -1716,7 +1724,9 @@ namespace HypervResource
}
return nic;
}
- throw new ArgumentException("No NIC for ipAddress " + ipAddress);
+ var defaultSubnet = defaultnic.GetIPProperties().UnicastAddresses[0];
+ subnet = defaultSubnet.IPv4Mask.ToString();
+ return defaultnic;
}
public static void GetCapacityForLocalPath(string localStoragePath, out long capacityBytes, out long availableBytes)