<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Sylvain,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks for the clarification, I’d missed that it was where the public network belonged to the same tenant (it’s not a use case we run with).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">So I can see that option [1] would make the validation work by (presumably) not including the shared network in the list of networks,  but looking further into
 the code allocate_for_instance() uses the same call to decide which networks it needs to create ports for, and from what I can see it would attach the instance to both networks.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L244<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">However that feels like the same problem that the patch was originally trying to fix, in that the network order isn’t controlled by the user, and many Guest
 OS’s will only configure the first NIC they are presented with.  The idea was that in this case the user needs to explicitly specify the networks in the order that they want them to be attached to.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Am I still missing something ?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Phil  
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext"> Sylvain Bauza [mailto:sylvain.bauza@bull.net]
<br>
<b>Sent:</b> 24 January 2014 14:02<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions)<br>
<b>Cc:</b> Day, Phil<br>
<b>Subject:</b> Re: [openstack-dev] [Nova] Why Nova should fail to boot if there are only one private network and one public network ?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Phil,<br>
<br>
Le 24/01/2014 14:13, Day, Phil a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">HI Sylvain,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The change only makes the user have to supply a network ID if there is more than one private network available (and the issue there is that otherwise the assignment
 order in the Guest is random, which normally leads to all sorts of routing problems).</span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
I'm sorry, but the query also includes shared (so, public) networks from the same tenant. See [1].
<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’m running a standard Devstack with Neuron (built from trunk a couple of days ago), can see both a private and public network, and can boot VMs without having
 to supply any network info:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
Indeed, that does work because Devstack is smart enough for creating the two networks with distinct tenant_ids. See [2] as a proof :-)<br>
If someone is building a private and a public network *on the same tenant*, it will fail to boot. Apologies if I was unclear.<br>
<br>
So, the question is : what shall I do for changing this ? There are 2 options for me:<br>
 1. Add an extra param to _get_available_networks : shared=True and only return shared networks if the param is set to True (so we keep compatibility with all the calls)<br>
 2. Parse the nets dict here [3] to expurge the shared networks when len(nets) > 1. That's simple but potentially a performance issue, as it's O(N).<br>
<br>
I would personnally vote for #1 and I'm ready to patch. By the way, the test case needs also to be updated [4].<br>
<br>
-Sylvain<br>
<br>
<br>
[1] <a href="https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L127">
https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L127</a><br>
[2] : <a href="http://paste.openstack.org/show/61819/">http://paste.openstack.org/show/61819/</a><br>
[3] : <a href="https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L528">
https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L528</a><br>
[4] : <a href="https://github.com/openstack/nova/blob/master/nova/tests/network/test_neutronv2.py#L1028">
https://github.com/openstack/nova/blob/master/nova/tests/network/test_neutronv2.py#L1028</a>
<o:p></o:p></p>
</div>
</div>
</body>
</html>