cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [49/50] [abbrv] git commit: updated refs/heads/4.4 to 48f8a95
Date Fri, 14 Mar 2014 13:58:46 GMT
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/4523f5d8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4523f5d8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4523f5d8

Branch: refs/heads/4.4
Commit: 4523f5d8de64761a507b5a8f1f9b4d451a8be17a
Parents: 1b4325d
Author: Rajesh Battala <rajesh.battala@citrix.com>
Authored: Wed Mar 12 07:45:50 2014 +0530
Committer: Rajesh Battala <rajesh.battala@citrix.com>
Committed: Fri Mar 14 17:36:43 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/4523f5d8/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 2d44753..40609e4 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/4523f5d8/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 6018896..8c682ad 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/IWmiCallsV2.cs
@@ -70,5 +70,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/4523f5d8/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 73156c5..d5cf7c9 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);


Mime
View raw message