VMware vCloud

 View Only
  • 1.  Unable to configure vApp/VM network

    Posted May 15, 2012 07:17 AM

    Hi there,

    I am initiating a vApp from template using VMware_VCloud_SDK_Vdc::instantiateVAppTemplateDefault

    I am then trying to configure the network settings.

                $netRefs = $orgSDK->getOrgNetworkRefs();
                $pnetwkRef = VMware_VCloud_SDK_Helper::createReferenceTypeObj($netRefs[0]->get_href(), 'ParentNetwork');

                $info = new VMware_VCloud_API_OVF_Msg_Type();
                $info->set_valueOf("Configuration parameters for logical networks");

                $conf = new VMware_VCloud_API_NetworkConfigurationType();
                $conf->setParentNetwork($pnetwkRef);
                $conf->setFenceMode('bridged');

                $ipScope = new VMware_VCloud_API_IpScopeType();
                $ipScope->setIsInherited(true);
                $ipScope->setNetmask('255.255.252.0');
                $ipScope->setGateway('48.76.212.1');
                $ipScope->setDns1('196.33.227.30');
                $ipScope->setDns2('196.33.227.197');

                $conf->setIpScope($ipScope);

                $netconf = new VMware_VCloud_API_VAppNetworkConfigurationType();
                $netconf->set_networkName('VM Network');
                $netconf->setConfiguration($conf);
                $netconf->setIsDeployed(true);

                $section = new VMware_VCloud_API_NetworkConfigSectionType();
                $section->setInfo($info);
                $section->setNetworkConfig(array($netconf));

                $iparams = new VMware_VCloud_API_InstantiationParamsType();
                $iparams->setSection(array($section));

                $params = new VMware_VCloud_API_RecomposeVAppParamsType();
                $params->setInstantiationParams($iparams);

                $this->log('Starting recomposition');
                $task = $vAppSDK->recompose($params);

    Then I attempt to set the IP address of the VM

            $vmSDK = $this->getVMDSK($vm); /* @var $vmSDK VMware_VCloud_SDK_Vm */

            $net = $vmSDK->getNetworkConnectionSettings();
            $cons = $net->getNetworkConnection();
            $con = $cons[0]; /* @var $con VMware_VCloud_API_NetworkConnectionType */

            $con->setIpAddress($ip);
            $con->setIpAddressAllocationMode('MANUAL');

            $cons[0] = $con;

            $net->setNetworkConnection($cons);

    The problem that I am having is that the only thing that is being set is my DNS servers against the vApp.

    When checking the logs, vCloud Director is saying that the IP address I am trying to assign to the VM is not part of the subnet range.

    No errors or other log entries in the logs explaining why the subnet mask and gateway for the vApp is not being set.

    Any assistance would be greatly appreciated.



  • 2.  RE: Unable to configure vApp/VM network

    Posted May 15, 2012 04:26 PM

    I assume the IP you are trying to assign is within the 48.76.212.0/255.255.252.0 range?

    As a test, have you tried to assign the IP as "POOL" instead of "MANUAL?"



  • 3.  RE: Unable to configure vApp/VM network

    Posted May 16, 2012 09:15 AM

    Hi Jake,

    Thanks for the piece of info, but it has now highlighted the fact that the vApp is not pulling through the settings of the parent network.

    So I am getting the error

    There are no IP addresses in the static IP pool associated with this network. Please check the network specification.

    And on checking the network specification of the vApp it has pulled the default gateway as 192.168.254.1 and the subnet mask as 255.255.255.0

    The default gateway should have been 48.76.212.1 and subnet maske 255.255.252.0 which has been specified in the Org Network which is used as the parent for the vApp.

    I have been battling with this problem now for over 3 weeks.

    Please help? Pretty please?

    Regards,

    Dale



  • 4.  RE: Unable to configure vApp/VM network

    Posted May 16, 2012 03:46 PM

    Have you verified that there is a static IP pool in the Org network?

    I really don't think you need to do any IP settings in the vApp if you are just doing a bridged network. It should inherit all those from the parent.



  • 5.  RE: Unable to configure vApp/VM network

    Posted May 16, 2012 04:54 PM

    Yes, that is what is confusing me.

    The org network is exactly what it should be, but when I initiate a vApp with the org network as the parent, nothing is being pulled through.

    It is as if the vApp network is ignoring all settings related to the org network.

    Regards,

    Dale



  • 6.  RE: Unable to configure vApp/VM network

    Posted May 16, 2012 05:02 PM

    Try this:

    $netRefs = $orgSDK->getOrgNetworkRefs();
                $pnetwkRef = VMware_VCloud_SDK_Helper::createReferenceTypeObj($netRefs[0]->get_href(), 'ParentNetwork');

                $info = new VMware_VCloud_API_OVF_Msg_Type();
                $info->set_valueOf("Configuration parameters for logical networks");

                $conf = new VMware_VCloud_API_NetworkConfigurationType();
                $conf->setParentNetwork($pnetwkRef);
                $conf->setFenceMode('bridged');

                $netconf = new VMware_VCloud_API_VAppNetworkConfigurationType();
                $netconf->set_networkName('ParentNetwork');
                $netconf->setConfiguration($conf);
                $netconf->setIsDeployed(true);

                $section = new VMware_VCloud_API_NetworkConfigSectionType();
                $section->setInfo($info);
                $section->setNetworkConfig(array($netconf));

                $iparams = new VMware_VCloud_API_InstantiationParamsType();
                $iparams->setSection(array($section));

                $params = new VMware_VCloud_API_RecomposeVAppParamsType();
                $params->setInstantiationParams($iparams);

                $this->log('Starting recomposition');
                $task = $vAppSDK->recompose($params);



  • 7.  RE: Unable to configure vApp/VM network

    Posted May 17, 2012 08:14 AM

    When setting the network name, I get the following error:

    Entity VM Network(com.vmware.vcloud.entity.network:fd0d960a-6a18-4921-a393-97e518be3ff3) cannot be deleted, because it is in use.

    And I get the same error when trying:

    $conf->setRetainNetInfoAcrossDeployments(true);

    Not sure where to from here?



  • 8.  RE: Unable to configure vApp/VM network

    Posted May 18, 2012 07:24 AM

    Ok, so after a lot of back and forth, I have finally resolved the issue.

    Step 1: Do not use VMware_VCloud_SDK_Vdc::instantiateVAppTemplateDefault

    Step 2: Create you own VMware_VCloud_API_InstantiateVAppTemplateParamsType object

    Step 3: Build up your VMware_VCloud_API_NetworkConfigSectionType object

    Step 4: Create a VMware_VCloud_API_InstantiationParamsType and add your VMware_VCloud_API_NetworkConfigSectionType object as a section

    Step 5: Add your VMware_VCloud_API_InstantiationParamsType object to your VMware_VCloud_API_InstantiateVAppTemplateParamsType object by calling setInstantiationParams

    Step 6: Call VMware_VCloud_SDK_Vdc::instantiateVAppTemplate

    That will pull in all the necessary network settings to the vApp and allow you then to allocated the IP to your VM.