Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DF754109EE for ; Thu, 5 Dec 2013 09:12:57 +0000 (UTC) Received: (qmail 72133 invoked by uid 500); 5 Dec 2013 09:12:52 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 68980 invoked by uid 500); 5 Dec 2013 09:12:46 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 68749 invoked by uid 99); 5 Dec 2013 09:12:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 09:12:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D2294320F36; Thu, 5 Dec 2013 09:12:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rajeshbattala@apache.org To: commits@cloudstack.apache.org Message-Id: <7b36842ce7c24bd9bc6e1f2e4e82c485@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.3 to 26020fc Date: Thu, 5 Dec 2013 09:12:28 +0000 (UTC) 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 Authored: Thu Dec 5 14:46:20 2013 +0530 Committer: Rajesh Battala 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 @@ 8 - 10.1.1.1 + 0.0.0.0 Routing @@ -45,13 +45,13 @@ 34359738368 - camldonall01.citrite.net + 0.0.0.0 1 - 10.70.176.1 + 0.0.0.0 2 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)