Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 12. Tagging virtual devices


In Red Hat OpenStack Platform (RHOSP), if you attach multiple network interfaces or block devices to an instance, 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 available to the instance operating system through the metadata API and the configuration drive, if enabled.

You can also tag virtual devices to a running instance. For more information, see the following procedures:

Note

To execute openstack client commands on the cloud, you must specify the name of the cloud detailed in your clouds.yaml file. You can specify the name of the cloud by using one of the following methods:

  • Use the --os-cloud option with each command, for example:

    $ openstack flavor list --os-cloud <cloud_name>
    Copy to Clipboard Toggle word wrap

    Use this option if you access more than one cloud.

  • Create an environment variable for the cloud name in your bashrc file:

    `export OS_CLOUD=<cloud_name>`
    Copy to Clipboard Toggle word wrap

Prerequisites

  • The administrator has created a project for you and they have provided you with a clouds.yaml file for you to access the cloud.
  • You have installed the python-openstackclient package.

Procedure

  1. Create your instance with a virtual block device tag and a virtual network device tag:

    $ openstack server create --flavor m1.tiny --image cirros \
      --network <network_UUID>
      --nic net-id=<network_UUID>,tag=<myNicTag> \
      --block-device id=<volume_ID>,bus=virtio,tag=<myVolumeTag> myTaggedDevicesInstance
    Copy to Clipboard Toggle word wrap
    • Replace <myNicTag> with the name of the tag for the virtual NIC device. You can add as many tagged virtual devices as you require.
    • Replace <myVolumeTag> with the name of the tag for the virtual storage device. You can add as many tagged virtual devices as you require.
  2. Verify that the virtual device tags have been added to the instance metadata by using one of the following methods:

    • Retrieve the device tag metadata from the metadata API by using GET /openstack/latest/meta_data.json.
    • If the configuration drive is enabled and mounted under /configdrive on the instance operating system, view the /configdrive/openstack/latest/meta_data.json file.

      Example meta_data.json file:

      {
        "devices": [
          {
              "type": "nic",
              "bus": "pci",
              "address": "0030:00:02.0",
              "mac": "aa:00:00:00:01",
              "tags": ["myNicTag"]
          },
          {
              "type": "disk",
              "bus": "pci",
              "address": "0030:00:07.0",
              "serial": "disk-vol-227",
              "tags": ["myVolumeTag"]
          }
        ]
      }
      Copy to Clipboard Toggle word wrap
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat