@@ -982,6 +982,24 @@ private bool ValidateStoragePoolCommand(dynamic cmd, out string localPath, out S
982982 return true ;
983983 }
984984
985+ // POST api/HypervResource/PlugNicCommand
986+ [ HttpPost ]
987+ [ ActionName ( CloudStackTypes . PlugNicCommand ) ]
988+ public JContainer PlugNicCommand ( [ FromBody ] dynamic cmd )
989+ {
990+ using ( log4net . NDC . Push ( Guid . NewGuid ( ) . ToString ( ) ) )
991+ {
992+ logger . Info ( CloudStackTypes . PlugNicCommand + cmd . ToString ( ) ) ;
993+ object ansContent = new
994+ {
995+ result = true ,
996+ details = "instead of plug, change he network settings" ,
997+ contextMap = contextMap
998+ } ;
999+ return ReturnCloudStackTypedJArray ( ansContent , CloudStackTypes . PlugNicAnswer ) ;
1000+ }
1001+ }
1002+
9851003
9861004 // POST api/HypervResource/CleanupNetworkRulesCmd
9871005 [ HttpPost ]
@@ -1264,6 +1282,88 @@ public JContainer PingCommand([FromBody]dynamic cmd)
12641282 }
12651283 }
12661284
1285+ // POST api/HypervResource/ModifyVmVnicVlanCommand
1286+ [ HttpPost ]
1287+ [ ActionName ( CloudStackTypes . ModifyVmNicConfigCommand ) ]
1288+ public JContainer ModifyVmNicConfigCommand ( [ FromBody ] dynamic cmd )
1289+ {
1290+
1291+ using ( log4net . NDC . Push ( Guid . NewGuid ( ) . ToString ( ) ) )
1292+ {
1293+ logger . Info ( CloudStackTypes . ModifyVmNicConfigCommand + cmd . ToString ( ) ) ;
1294+ bool result = false ;
1295+ String vmName = cmd . vmName ;
1296+ uint vlan = ( uint ) cmd . vlan ;
1297+ string macAddress = cmd . macAddress ;
1298+ wmiCallsV2 . ModifyVmVLan ( vmName , vlan , macAddress ) ;
1299+
1300+ result = true ;
1301+
1302+ object ansContent = new
1303+ {
1304+ vmName = vmName ,
1305+ result = result ,
1306+ contextMap = contextMap
1307+ } ;
1308+ return ReturnCloudStackTypedJArray ( ansContent , CloudStackTypes . ModifyVmNicConfigAnswer ) ;
1309+ }
1310+
1311+ }
1312+
1313+ // POST api/HypervResource/GetVmConfigCommand
1314+ [ HttpPost ]
1315+ [ ActionName ( CloudStackTypes . GetVmConfigCommand ) ]
1316+ public JContainer GetVmConfigCommand ( [ FromBody ] dynamic cmd )
1317+ {
1318+ using ( log4net . NDC . Push ( Guid . NewGuid ( ) . ToString ( ) ) )
1319+ {
1320+ logger . Info ( CloudStackTypes . GetVmConfigCommand + cmd . ToString ( ) ) ;
1321+ bool result = false ;
1322+ String vmName = cmd . vmName ;
1323+ ComputerSystem vm = wmiCallsV2 . GetComputerSystem ( vmName ) ;
1324+ List < NicDetails > nicDetails = new List < NicDetails > ( ) ;
1325+ var nicSettingsViaVm = wmiCallsV2 . GetEthernetPortSettings ( vm ) ;
1326+ NicDetails nic = null ;
1327+ String [ ] macAddress = new String [ nicSettingsViaVm . Length ] ;
1328+ int index = 0 ;
1329+ foreach ( SyntheticEthernetPortSettingData item in nicSettingsViaVm )
1330+ {
1331+ macAddress [ index ++ ] = item . Address ;
1332+ }
1333+
1334+ index = 0 ;
1335+ var ethernetConnections = wmiCallsV2 . GetEthernetConnections ( vm ) ;
1336+ int vlanid = 1 ;
1337+ foreach ( EthernetPortAllocationSettingData item in ethernetConnections )
1338+ {
1339+ EthernetSwitchPortVlanSettingData vlanSettings = wmiCallsV2 . GetVlanSettings ( item ) ;
1340+ if ( vlanSettings == null )
1341+ {
1342+ vlanid = - 1 ;
1343+ }
1344+ else
1345+ {
1346+ vlanid = vlanSettings . AccessVlanId ;
1347+ }
1348+ nic = new NicDetails ( macAddress [ index ++ ] , vlanid ) ;
1349+ nicDetails . Add ( nic ) ;
1350+ }
1351+
1352+ result = true ;
1353+
1354+ object ansContent = new
1355+ {
1356+ vmName = vmName ,
1357+ nics = nicDetails ,
1358+ result = result ,
1359+ contextMap = contextMap
1360+ } ;
1361+ return ReturnCloudStackTypedJArray ( ansContent , CloudStackTypes . GetVmConfigAnswer ) ;
1362+ }
1363+ }
1364+
1365+
1366+
12671367 // POST api/HypervResource/GetVmStatsCommand
12681368 [ HttpPost ]
12691369 [ ActionName ( CloudStackTypes . GetVmStatsCommand ) ]
0 commit comments