Ram, currently the compute API makes a call to the generate_mac() function in utils and stores the result in the dict that is passed to db.create_instance. This is changing. The compute manager will make a call to the network manager to assign the necessary network components for an instance. The network manager will be responsible for generating and storing the mac address.<br>
<br><div class="gmail_quote">On Tue, Mar 29, 2011 at 9:30 AM, Ramesh Durairaj <span dir="ltr"><<a href="mailto:dramesh@gmail.com">dramesh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Also, curious, who assigns mac_addresses? or how the table is built initially?<br>
<br>
Ram<br>
<div><div></div><div class="h5"><br>
On Tue, Mar 29, 2011 at 2:45 AM, Ishimoto, Ryu <<a href="mailto:ryu@midokura.jp">ryu@midokura.jp</a>> wrote:<br>
><br>
> ahhh yes, I misread the blueprint, it makes a lot of sense now.  Thanks.<br>
> Does this mean that when an instance launches, all the MAC<br>
> addresses/Networks that belong in the same project get assigned to that<br>
> instance?   I couldn't find this in the code so I just wanted to verify.<br>
> Ryu<br>
> On Tue, Mar 29, 2011 at 1:13 AM, Trey Morris <<a href="mailto:trey.morris@rackspace.com">trey.morris@rackspace.com</a>><br>
> wrote:<br>
>><br>
>> Ryu, the new mac_address table is going to associate a mac_address with an<br>
>> instance and a network. When the VIFs are created for the instance, they are<br>
>> given the mac_address from the table and attached to the network from the<br>
>> table. Does that help?<br>
>> -trey<br>
>><br>
>> On Mon, Mar 28, 2011 at 10:54 AM, Ishimoto, Ryu <<a href="mailto:ryu@midokura.jp">ryu@midokura.jp</a>> wrote:<br>
>>><br>
>>> Thanks, that cleared it up for me.<br>
>>> Staying on the topic of multi-nics, I have been trying to understand the<br>
>>> direction in which Nova is going in regards to networking, and reading up on<br>
>>> the multi-nics blueprint, it certainly seems like it's going in the right<br>
>>> direction, but I do have one question:<br>
>>> What was the reasoning behind associating networks, and not NICs, to an<br>
>>> instance?  I understand that each instance NIC would belong to a distinct<br>
>>> network, but it just seems more intuitive to imagine that an instance has<br>
>>> NICs, and these NICs are connected to networks(or even more intuitively,<br>
>>> connected to virtual ports that belong to various networks - Assigning a<br>
>>> port to a NIC is like allocating an IP address).<br>
>>> One problem I see from my suggestion above is that there is no<br>
>>> association between NICs and networks, which means there is no way to select<br>
>>> a network to grab an IP address from for each NIC at the time of VM launch.<br>
>>>  I might be missing something completely here, but why not just let the user<br>
>>> manage all this through the management  API before the VM launch?  Let the<br>
>>> user create NICs, Networks(and Ports with IP addresses), and map the NICs to<br>
>>> ports.  Then pass this list of 'connected' NICs as a parameter to launch a<br>
>>> VM.  This parameter is optional, and if omitted, it should be treated as<br>
>>> launching a single NIC instance, with a new NIC created and associated with<br>
>>> the instance on the fly.  This prevents it from breaking the way it works<br>
>>> now.<br>
>>> If the concept of NICs for instance makes sense to everyone, I would love<br>
>>> to help out and look further into what work needs to be done to extend the<br>
>>> current multi-nic model into this one.<br>
>>> I hope this made sense.  I apologize for the length.<br>
>>> Thanks,<br>
>>> Ryu<br>
>>><br>
>>> On Tue, Mar 29, 2011 at 12:47 AM, Trey Morris <<a href="mailto:trey.morris@rackspace.com">trey.morris@rackspace.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> I've written a migration to handle moving the data in the current<br>
>>>> instances table mac_address column into the new mac_address table before the<br>
>>>> column is removed.<br>
>>>> I agree with Jay, data should never be discarded when migrating forward.<br>
>>>> I don't think there has been a case yet where data is migrated in nova. This<br>
>>>> could be the first.<br>
>>>><br>
>>>> -trey<br>
>>>><br>
>>>> On Mon, Mar 28, 2011 at 8:17 AM, Jay Pipes <<a href="mailto:jaypipes@gmail.com">jaypipes@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> On Mon, Mar 28, 2011 at 2:31 AM, Ishimoto, Ryu <<a href="mailto:ryu@midokura.jp">ryu@midokura.jp</a>> wrote:<br>
>>>>> > Hi All,<br>
>>>>> > I was looking at the multi-nic<br>
>>>>> ><br>
>>>>> > blueprint(<a href="https://blueprints.launchpad.net/nova/+spec/nova-multi-nic" target="_blank">https://blueprints.launchpad.net/nova/+spec/nova-multi-nic</a>), and<br>
>>>>> > in particular:<br>
>>>>> > 1) removing mac_address column from the instances table and creating<br>
>>>>> > a<br>
>>>>> > mac_addresses table. This is for storing which instances own which<br>
>>>>> > mac<br>
>>>>> > addresses as well as which network each mac is for.<br>
>>>>> > What happens(or should happen) to the MAC addresses that are already<br>
>>>>> > associated with instances?  Will they be migrated to the new<br>
>>>>> > mac_addresses<br>
>>>>> > table?  Or will they be discarded completely?<br>
>>>>><br>
>>>>> Data should never be discarded in situations like this where a column<br>
>>>>> is moved to another table's schema (or to be records in another<br>
>>>>> table).<br>
>>>>><br>
>>>>> > I was curious to know how Nova usually handles data migration issues<br>
>>>>> > like<br>
>>>>> > this.<br>
>>>>><br>
>>>>> No idea whether/if Nova's data migrations have previously needed to<br>
>>>>> preserve data in this way. Glance does, however, and you can use the<br>
>>>>> following Python changescript to get an idea how to perform this exact<br>
>>>>> type of change:<br>
>>>>><br>
>>>>><br>
>>>>> <a href="http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_add_disk_format.py" target="_blank">http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_add_disk_format.py</a><br>

>>>>><br>
>>>>> Note that SQLite has issues if you try to add and drop columns in the<br>
>>>>> same changescript and you also have an unrelated column that is<br>
>>>>> indexed (see:<br>
>>>>> <a href="http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117" target="_blank">http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117</a>).<br>
>>>>> If this is the case, you will need to write SQL-based changescripts<br>
>>>>> specfically for SQLite. You can see examples of how this is<br>
>>>>> accomplished in Glance for the same DB version here:<br>
>>>>><br>
>>>>><br>
>>>>> <a href="http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_upgrade.sql" target="_blank">http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_upgrade.sql</a><br>

>>>>><br>
>>>>> <a href="http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_downgrade.sql" target="_blank">http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_downgrade.sql</a><br>

>>>>><br>
>>>>> Cheers,<br>
>>>>> jay<br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
>>>>> Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
>>>>> Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
>>>>> More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
>>>><br>
>>>> Confidentiality Notice: This e-mail message (including any attached or<br>
>>>> embedded documents) is intended for the exclusive and confidential use<br>
>>>> of the<br>
>>>> individual or entity to which this message is addressed, and unless<br>
>>>> otherwise<br>
>>>> expressly indicated, is confidential and privileged information of<br>
>>>> Rackspace.<br>
>>>> Any dissemination, distribution or copying of the enclosed material is<br>
>>>> prohibited.<br>
>>>> If you receive this transmission in error, please notify us immediately<br>
>>>> by e-mail<br>
>>>> at <a href="mailto:abuse@rackspace.com">abuse@rackspace.com</a>, and delete the original message.<br>
>>>> Your cooperation is appreciated.<br>
>>><br>
>><br>
>> Confidentiality Notice: This e-mail message (including any attached or<br>
>> embedded documents) is intended for the exclusive and confidential use of<br>
>> the<br>
>> individual or entity to which this message is addressed, and unless<br>
>> otherwise<br>
>> expressly indicated, is confidential and privileged information of<br>
>> Rackspace.<br>
>> Any dissemination, distribution or copying of the enclosed material is<br>
>> prohibited.<br>
>> If you receive this transmission in error, please notify us immediately by<br>
>> e-mail<br>
>> at <a href="mailto:abuse@rackspace.com">abuse@rackspace.com</a>, and delete the original message.<br>
>> Your cooperation is appreciated.<br>
><br>
><br>
> _______________________________________________<br>
> Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
> Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
> Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
> More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
><br>
><br>
</div></div></blockquote></div><br><PRE>
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.
</PRE>