Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

VCloud. Unable to update network settings for a vm with C# vcloudSDK_v5_5 and vcloudRestSchema_v5_5

$
0
0



This is the error I have been getting when I try to change the network settings for a vm:


Network '' is in use and cannot be deleted. There may be vApps or vApp Templates connected to this network. Please check the list of vApps connected to this network. You can access this information using the 'Connected vApps' menu option."


Here is the code I am using.


workerVM = GetVM(orgName, vmName);

                Task task = workerVM.PowerOff();

                task.WaitForTask(0);

                 

                 

                //Task task = workerVM.PowerOff();

                //task.WaitForTask(0);

 

                Vapp workerVApp = getVAPPForVM(orgName, vmName);

                //Task task = workerVApp.PowerOff();

                  

                //NetworkConnectionType nwConnection = workerVM.GetNetworkConnections().Where(n => n.network == network.Name).FirstOrDefault();

                //workerVApp.get

                //nwConnection.network = network.NameChange;

                 

                //task = workerVM.UpdateSection(workerVM.GetNetworkConnectionSection());

                //task.WaitForTask(0);

                NetworkConfigSectionType networkConfigSectionType = new NetworkConfigSectionType();

                networkConfigSectionType = workerVApp.GetNetworkConfigSection();

                NetworkConfigurationType networkConfigurationType = new NetworkConfigurationType();

                networkConfigurationType = networkConfigSectionType.NetworkConfig.Where(n => n.networkName == network.Name).FirstOrDefault().Configuration;

                //networkConfigurationType.FenceMode = FenceModeValuesType.BRIDGED;

                 

                VAppNetworkConfigurationType vappNetworkConfig = new VAppNetworkConfigurationType();

                vappNetworkConfig.networkName = network.NameChange;//workerVApp.GetNetworkConfigSection().NetworkConfig.FirstOrDefault( n => n.networkName == network.Name).networkName;

                vappNetworkConfig.Configuration = networkConfigurationType;

 

                NetworkConfigSectionType networkConfigSectionType2 = new NetworkConfigSectionType();

                Msg_Type networkInfo = new Msg_Type();

                networkConfigSectionType2.Info = networkInfo;

                networkConfigSectionType2.NetworkConfig = new VAppNetworkConfigurationType[];

                //networkConfigSectionType2.NetworkConfig = vappNetworkConfig;

                task = workerVApp.UpdateSection(networkConfigSectionType2);

                task.WaitForTask(0);

 

                task = workerVApp.PowerOn();

                task.WaitForTask(0);

                //Msg_Type networkInfo = new Msg_Type();

                //networkInfo.Value

                //vappNetworkCongfigType = networkConfigSectionType.NetworkConfig.Where(n => n.networkName == network.Name).FirstOrDefault();

                //vappNetworkCongfigType.networkName = network.NameChange;

 

                //NetworkConfigurationType networkConfigType = vappNetworkCongfigType.Configuration;

 

                //IpScopesType scopeTypes = networkConfigType.IpScopes;

                //IpScopeType scopeType = scopeTypes.IpScope.FirstOrDefault();//.ToList().FirstOrDefault();// .IpScope;

                //RouterInfoType routerInfo = networkConfigType.RouterInfo;

                //IList


Viewing all articles
Browse latest Browse all 2039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>