Red Hat Training

A Red Hat training course is available for Red Hat OpenStack Platform

Chapter 22. Use Tagging for Virtual Device Identification

Note

Virtual device tagging was added in version 2.32 of the nova API for both block devices and network ports, however:

  • For block devices: this capability only works in 2.32.
  • For network interface tagging: this capability only works in versions 2.32 to 2.36. Network interface tagging does not work under 2.37.

An update is available for python-novaclient (not openstackclient) that is intended to work around this issue. As a result, the issue should not occur when using novaclient, except when using both block device tagging and the automatic network feature introduced in 2.37. Attempting to use both of these features together will result in an error. Those capabilities will remain mutually exclusive for Red Hat OpenStack Platform 10.

  • These issues do not affect Red Hat OpenStack Platform 11, which uses version 2.42 and allows the concurrent use of both block device tagging and network interface tagging.
  • To apply this update, see https://access.redhat.com/errata/RHSA-2017:1595

If an instance is started with multiple network interfaces or block devices, you can use device tagging to communicate the intended role of each device to the instance operating system. Tags are assigned to devices at instance boot time, and are made available to the instance operating system through the metadata API and the config drive (if enabled).

The tags are set using the following parameters:

  • --block-device tag=device metadata
  • --nic tag=device metadata

For example, this command creates an instance using the tag parameters for --block-device and --nic:

$ nova boot test-vm --flavor m1.tiny --image cirros \
--nic net-id=55411ca3-83dd-4036-9158-bf4a6b8fb5ce,tag=nfv1 \
--block-device id=b8c9bef7-aa1d-4bf4-a14d-17674b370e13,bus=virtio,tag=database-server NFVappServer

The resulting tags are added to the existing instance metadata and are made available through both the metadata API, and on the configuration drive. In the above example, the following devices section will appear in the metadata:

  • Sample meta_data.json:
    {
  "devices": [
    {
        "type": "nic",
        "bus": "pci",
        "address": "0030:00:02.0",
        "mac": "aa:00:00:00:01",
        "tags": ["nfv1"]
    },
    {
        "type": "disk",
        "bus": "pci",
        "address": "0030:00:07.0",
        "serial": "disk-vol-227",
        "tags": ["database-server"]
    }
  ]
}

The device tag metadata is available as GET /openstack/latest/meta_data.json from the metadata API. If the configuration drive is enabled, and mounted under /configdrive in the instance operating system, the metadata is also present in /configdrive/openstack/latest/meta_data.json.