@@ -1077,11 +1077,10 @@ public JContainer PlugNicCommand([FromBody]dynamic cmd)
10771077 using ( log4net . NDC . Push ( Guid . NewGuid ( ) . ToString ( ) ) )
10781078 {
10791079 logger . Info ( CloudStackTypes . PlugNicCommand + Utils . CleanString ( cmd . ToString ( ) ) ) ;
1080-
10811080 object ansContent = new
10821081 {
10831082 result = true ,
1084- details = "instead of plug, change he network settings" ,
1083+ details = "Hot Nic plug not supported , change any empty virtual network adapter network settings" ,
10851084 contextMap = contextMap
10861085 } ;
10871086 return ReturnCloudStackTypedJArray ( ansContent , CloudStackTypes . PlugNicAnswer ) ;
@@ -1394,18 +1393,21 @@ public JContainer ModifyVmNicConfigCommand([FromBody]dynamic cmd)
13941393 logger . Info ( CloudStackTypes . ModifyVmNicConfigCommand + Utils . CleanString ( cmd . ToString ( ) ) ) ;
13951394 bool result = false ;
13961395 String vmName = cmd . vmName ;
1397- uint vlan = ( uint ) cmd . vlan ;
1396+ String vlan = cmd . vlan ;
13981397 string macAddress = cmd . macAddress ;
1399- uint pos = cmd . index ;
1398+ uint pos = cmd . index ;
1399+ bool enable = cmd . enable ;
1400+ string switchLableName = cmd . switchLableName ;
14001401 if ( macAddress != null )
14011402 {
1402- wmiCallsV2 . ModifyVmVLan ( vmName , vlan , macAddress ) ;
1403- }
1404- else if ( pos > 1 )
1405- {
1406- wmiCallsV2 . ModifyVmVLan ( vmName , vlan , pos ) ;
1403+ wmiCallsV2 . ModifyVmVLan ( vmName , vlan , macAddress ) ;
1404+ result = true ;
14071405 }
1406+ else if ( pos >= 1 )
1407+ {
1408+ wmiCallsV2 . ModifyVmVLan ( vmName , vlan , pos , enable , switchLableName ) ;
14081409 result = true ;
1410+ }
14091411
14101412 object ansContent = new
14111413 {
@@ -1432,31 +1434,37 @@ public JContainer GetVmConfigCommand([FromBody]dynamic cmd)
14321434 List < NicDetails > nicDetails = new List < NicDetails > ( ) ;
14331435 var nicSettingsViaVm = wmiCallsV2 . GetEthernetPortSettings ( vm ) ;
14341436 NicDetails nic = null ;
1435- String [ ] macAddress = new String [ nicSettingsViaVm . Length ] ;
1436- int index = 0 ;
1437- foreach ( SyntheticEthernetPortSettingData item in nicSettingsViaVm )
1438- {
1439- macAddress [ index ++ ] = item . Address ;
1440- }
1441-
1437+ int index = 0 ;
1438+ int [ ] nicStates = new int [ 8 ] ;
1439+ int [ ] nicVlan = new int [ 8 ] ;
1440+ int vlanid = 1 ;
1441+
1442+ var ethernetConnections = wmiCallsV2 . GetEthernetConnections ( vm ) ;
1443+ foreach ( EthernetPortAllocationSettingData item in ethernetConnections )
1444+ {
1445+ EthernetSwitchPortVlanSettingData vlanSettings = wmiCallsV2 . GetVlanSettings ( item ) ;
1446+ if ( vlanSettings == null )
1447+ {
1448+ vlanid = - 1 ;
1449+ }
1450+ else
1451+ {
1452+ vlanid = vlanSettings . AccessVlanId ;
1453+ }
1454+ nicStates [ index ] = ( Int32 ) ( item . EnabledState ) ;
1455+ nicVlan [ index ] = vlanid ;
1456+ index ++ ;
1457+ }
1458+
14421459 index = 0 ;
1443- var ethernetConnections = wmiCallsV2 . GetEthernetConnections ( vm ) ;
1444- int vlanid = 1 ;
1445- foreach ( EthernetPortAllocationSettingData item in ethernetConnections )
1460+ foreach ( SyntheticEthernetPortSettingData item in nicSettingsViaVm )
14461461 {
1447- EthernetSwitchPortVlanSettingData vlanSettings = wmiCallsV2 . GetVlanSettings ( item ) ;
1448- if ( vlanSettings == null )
1449- {
1450- vlanid = - 1 ;
1451- }
1452- else
1453- {
1454- vlanid = vlanSettings . AccessVlanId ;
1455- }
1456- nic = new NicDetails ( macAddress [ index ++ ] , vlanid ) ;
1462+ nic = new NicDetails ( item . Address , nicVlan [ index ] , nicStates [ index ] ) ;
1463+ index ++ ;
14571464 nicDetails . Add ( nic ) ;
14581465 }
14591466
1467+
14601468 result = true ;
14611469
14621470 object ansContent = new
0 commit comments