Device tagging, new in Newton

Device tagging in OpenStack Nova is a mechanism to communicate to the guest OS the intended usage of virtual network interfaces and disks. For example, if an instance has two virtual network interfaces, one connected to a public network and the other to a private management network, the interfaces can be tagged with ‘pub’ and ‘pvt’ respectively. An application in the guest OS can fetch the tags and provision each interface accordingly.

With python-novaclient, in order to boot an instance with tagged devices, use the tag key in the –nic and –block-device arguments to the nova boot command. For example:

$ nova boot --flavor 1 --image cirros \
--nic net-id=149f5beb-2be5-4be6-9f0e-5290049945ab,tag=pub \
--nic net-id=bda05031-7651-41bd-825c-29ba89a4f08b,tag=pvt \
--block-device \
  source=volume,dest=volume,bootindex=1,tag=db \
--block-device \
  source=volume,dest=volume,bootindex=1,tag=cache \

You can also take a look at the full REST API reference.

As a reminder, an instance can access metadata in two ways. The first is to curl The second is to look on the configdrive under openstack/latest/meta_data.json (if the configdrive is enabled). In the above example, a devices section will appear in the metadata, looking something like this:

"devices": [
    "type": "nic",
    "bus": "pci",
    "address": "00:01.0",
    "mac": "d5:d9:b3:0d:c8:b0",
    "tags": ["pub"]
    "type": "nic",
    "bus": "pci",
    "address": "00:02.0",
    "mac": "df:8b:d6:58:9b:b1",
    "tags": ["pvt"]
    "type": "disk",
    "bus": "ide",
    "address": "0:1",
    "tags": ["db"]
    "type": "disk",
    "bus": "ide",
    "address": "1:0",
    "tags": ["cache"]

In the Ocata cycle we plan on implementing attaching tagged interfaces and volumes.

If you’re interested in diving deeper, you can take a look at the full spec as it was approved in Newton, and if you’re really crazy you can search for the review topic in Gerrit.

2 thoughts on “Device tagging, new in Newton

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s