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 2014/03/12 03:10:21 UTC
git commit: updated refs/heads/hyperv_vpc to cf478a2
Repository: cloudstack
Updated Branches:
refs/heads/hyperv_vpc bcb7d1283 -> cf478a2ce
CLOUDSTACK-6106 Agent side changes for VPC on Hyper-V
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cf478a2c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cf478a2c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cf478a2c
Branch: refs/heads/hyperv_vpc
Commit: cf478a2ce5f589b61aa1222ed8e9d70fd2c42fb3
Parents: bcb7d12
Author: Rajesh Battala <ra...@citrix.com>
Authored: Wed Mar 12 07:45:50 2014 +0530
Committer: Rajesh Battala <ra...@citrix.com>
Committed: Wed Mar 12 07:45:50 2014 +0530
----------------------------------------------------------------------
.../HypervResource/HypervResourceController.cs | 14 ++++++++---
.../HypervResource/IWmiCallsV2.cs | 1 +
.../ServerResource/HypervResource/WmiCallsV2.cs | 26 +++++++++++++++++++-
3 files changed, 37 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf478a2c/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 e233d03..c518cce 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -992,6 +992,7 @@ namespace HypervResource
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
{
logger.Info(CloudStackTypes.PlugNicCommand + cmd.ToString());
+
object ansContent = new
{
result = true,
@@ -1299,9 +1300,16 @@ namespace HypervResource
String vmName = cmd.vmName;
uint vlan = (uint)cmd.vlan;
string macAddress = cmd.macAddress;
- wmiCallsV2.ModifyVmVLan(vmName, vlan, macAddress);
-
- result = true;
+ uint pos = cmd.index;
+ if (macAddress != null)
+ {
+ wmiCallsV2.ModifyVmVLan(vmName, vlan, macAddress);
+ }
+ else if (pos > 1)
+ {
+ wmiCallsV2.ModifyVmVLan(vmName, vlan, pos);
+ }
+ result = true;
object ansContent = new
{
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf478a2c/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
index da6ad83..3369723 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
@@ -68,5 +68,6 @@ namespace HypervResource
void SetState(ComputerSystem vm, ushort requiredState);
Dictionary<String, VmState> GetVmSync(String privateIpAddress);
void ModifyVmVLan(string vmName, uint vlanid, string mac);
+ void ModifyVmVLan(string vmName, uint vlanid, uint pos);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf478a2c/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 d2b9ce1..bd5d89f 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -229,6 +229,7 @@ namespace HypervResource
string errMsg = vmName;
var diskDrives = vmInfo.disks;
var bootArgs = vmInfo.bootArgs;
+ string defaultvlan = "4094";
// assert
errMsg = vmName + ": missing disk information, array empty or missing, agent expects *at least* one disk for a VM";
@@ -391,6 +392,8 @@ namespace HypervResource
string vlan = null;
string isolationUri = nic.isolationUri;
string broadcastUri = nic.broadcastUri;
+ string nicIp = nic.ip;
+ string nicNetmask = nic.netmask;
if ( (broadcastUri != null ) || (isolationUri != null && isolationUri.StartsWith("vlan://")))
{
if (broadcastUri != null && broadcastUri.StartsWith("storage"))
@@ -415,6 +418,10 @@ namespace HypervResource
throw ex;
}
}
+ if(nicIp.Equals("0.0.0.0") && nicNetmask.Equals("255.255.255.255") ) {
+ // this is the extra nic added to VR.
+ vlan = defaultvlan;
+ }
if (nicCount == 2)
{
@@ -913,7 +920,6 @@ namespace HypervResource
ResourceAllocationSettingData defaultDiskDriveSettings = defaultDiskDriveSettingsObjs.OfType<ResourceAllocationSettingData>().First();
return new ResourceAllocationSettingData((ManagementBaseObject)defaultDiskDriveSettings.LateBoundObject.Clone());
}
-
// Modify the systemvm nic's VLAN id
public void ModifyVmVLan(string vmName, uint vlanid, String mac)
@@ -945,6 +951,24 @@ namespace HypervResource
vlanSettings.LateBoundObject.GetText(TextFormat.CimDtd20)});
}
+ // Modify the systemvm nic's VLAN id
+ public void ModifyVmVLan(string vmName, uint vlanid, uint pos)
+ {
+ ComputerSystem vm = GetComputerSystem(vmName);
+ SyntheticEthernetPortSettingData[] nicSettingsViaVm = GetEthernetPortSettings(vm);
+ // Obtain controller for Hyper-V virtualisation subsystem
+ VirtualSystemManagementService vmMgmtSvc = GetVirtualisationSystemManagementService();
+
+ EthernetPortAllocationSettingData[] ethernetConnections = GetEthernetConnections(vm);
+ EthernetSwitchPortVlanSettingData vlanSettings = GetVlanSettings(ethernetConnections[pos]);
+
+ //Assign configuration to new NIC
+ vlanSettings.LateBoundObject["AccessVlanId"] = vlanid;
+ vlanSettings.LateBoundObject["OperationMode"] = 1;
+ ModifyFeatureVmResources(vmMgmtSvc, vm, new String[] {
+ vlanSettings.LateBoundObject.GetText(TextFormat.CimDtd20)});
+ }
+
public void AttachIso(string displayName, string iso)
{
logger.DebugFormat("Got request to attach iso {0} to vm {1}", iso, displayName);