Este contenido no está disponible en el idioma seleccionado.
Chapter 5. Creating an instance
Before you can create an instance, other Red Hat OpenStack Platform (RHOSP) components must be available, such as the flavor, boot source, network, key pair, and security group. These components are used in the creation of an instance and are not available by default.
When you create an instance, you choose a boot source that has the bootable operating system that you require for your instance, a flavor that has the hardware profile you require for your instance, the network you want to connect your instance to, and any additional storage you need, such as data volumes and ephemeral storage.
With API microversion 2.94, if you pass an optional hostname when creating, updating, or rebuilding an instance, you can use Fully Qualified Domain Names (FQDN) when you specify the hostname. When using FQDN, ensure that [api]dhcp_domain
configuration option is set to the empty string for the correct FQDN to appear in the hostname field in the metadata API. By default, the hostname is normalized from the display name and all occurrences of "." are removed from the hostname and replaced with "_".
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>
$ openstack flavor list --os-cloud <cloud_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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>`
`export OS_CLOUD=<cloud_name>`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1. Prerequisites Copiar enlaceEnlace copiado en el portapapeles!
The required image or volume is available as the boot source:
- For more information about how to create an image, see Performing operations with the Image service (glance) in the Performing storage operations guide.
- For more information about how to create a volume, see Creating Block Storage volumes in the Performing storage operations guide.
- For more information about the options available for the boot source of an instance, see Instance boot source.
- A flavor is available that specifies the required number of CPUs, memory, and storage capacity. The flavor settings must meet the minimum requirements for disk and memory size specified by your chosen image, otherwise the instance will fail to launch.
- The required network is available. For more information about how to create a network, see Creating a network in the Managing networking resources guide.
5.2. Creating an instance from an image Copiar enlaceEnlace copiado en el portapapeles!
You can create an instance by using an image as the boot source.
With API microversion 2.94, if you pass an optional hostname when creating, updating, or rebuilding an instance, you can use Fully Qualified Domain Names (FQDN) when you specify the hostname. When using FQDN, ensure that [api]dhcp_domain
configuration option is set to the empty string for the correct FQDN to appear in the hostname field in the metadata API. By default, the hostname is normalized from the display name and all occurrences of "." are removed from the hostname and replaced with "_".
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
Retrieve the name or ID of the flavor that has the hardware profile that your instance requires:
openstack flavor list
$ openstack flavor list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteChoose a flavor with sufficient size for the image to successfully boot, otherwise the instance will fail to launch.
Retrieve the name or ID of the image that has the software profile that your instance requires:
openstack image list
$ openstack image list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the image that you require is not available, you can download or create a new image. For information about how to create or download cloud images, see Creating OS images in the Performing storage operations guide.
NoteIf you need to attach more than 26 volumes to your instance, then the image you use to create your instance must have the following properties:
-
hw_scsi_model=virtio-scsi
-
hw_disk_bus=scsi
-
Retrieve the name or ID of the network that you want to connect your instance to:
openstack network list
$ openstack network list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create your instance:
openstack server create --flavor <flavor> \ --image <image> --network <network> \ --wait myInstanceFromImage
$ openstack server create --flavor <flavor> \ --image <image> --network <network> \ --wait myInstanceFromImage
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<flavor>
with the name or ID of the flavor that you retrieved in step 1. -
Replace
<image>
with the name or ID of the image that you retrieved in step 2. -
Replace
<network>
with the name or ID of the network that you retrieved in step 3. You can use the--network
option more than once to connect your instance to several networks, as required.
-
Replace
5.3. Creating an instance from a bootable volume Copiar enlaceEnlace copiado en el portapapeles!
You can create an instance by using a bootable volume as the boot source. Boot your instance from a volume when you need to improve the availability of the instance data in the event of a failure.
When you use a block storage volume for your instance disk data, the block storage volume persists for any instance rebuilds, even when an instance is rebuilt with a new image that requests that a new volume is created.
With API microversion 2.94, if you pass an optional instance hostname when creating, updating, or rebuilding a server, you can use Fully Qualified Domain Names (FQDN) when you specify the hostname. When using FQDN, ensure that [api]dhcp_domain configuration option is set to the empty string for the correct FQDN to appear in the hostname field in the metadata API. By default, the hostname is normalized from the display name and all occurances of "." are removed from the hostname and replaced with "_".
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
Retrieve the name or ID of the image that has the software profile that your instance requires:
openstack image list
$ openstack image list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the image that you require is not available, you can download or create a new image. For information about how to create or download cloud images, see Creating RHEL KVM images in Performing storage operations.
NoteIf you need to attach more than 26 volumes to your instance, then the image you use to create your instance must have the following properties:
-
hw_scsi_model=virtio-scsi
-
hw_disk_bus=scsi
-
Create a bootable volume from the image:
openstack volume create --image <image> \ --size <size_gb> --bootable myBootableVolume
$ openstack volume create --image <image> \ --size <size_gb> --bootable myBootableVolume
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<image>
with the name or ID of the image to write to the volume, retrieved in step 1. -
Replace
<size_gb>
with the size of the volume in GB.
-
Replace
Retrieve the name or ID of the flavor that has the hardware profile that your instance requires:
openstack flavor list
$ openstack flavor list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the name or ID of the network that you want to connect your instance to:
openstack network list
$ openstack network list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an instance with the bootable volume:
openstack server create --flavor <flavor> \ --volume myBootableVolume --network <network> \ --wait myInstanceFromVolume
$ openstack server create --flavor <flavor> \ --volume myBootableVolume --network <network> \ --wait myInstanceFromVolume
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<flavor>
with the name or ID of the flavor that you retrieved in step 3. -
Replace
<network>
with the name or ID of the network that you retrieved in step 4. You can use the--network
option more than once to connect your instance to several networks, as required.
-
Replace
5.4. Creating an instance with a SR-IOV network interface Copiar enlaceEnlace copiado en el portapapeles!
To create an instance with a single root I/O virtualization (SR-IOV) network interface you need to create the required SR-IOV port.
With API microversion 2.94, if you pass an optional hostname when creating, updating, or rebuilding an instance, you can use Fully Qualified Domain Names (FQDN) when you specify the hostname. When using FQDN, ensure that [api]dhcp_domain
configuration option is set to the empty string for the correct FQDN to appear in the hostname field in the metadata API. By default, the hostname is normalized from the display name and all occurrences of "." are removed from the hostname and replaced with "_".
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
Retrieve the name or ID of the flavor that has the hardware profile that your instance requires:
openstack flavor list
$ openstack flavor list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteChoose a flavor with sufficient size for the image to successfully boot, otherwise the instance will fail to launch.
TipYou can specify the NUMA affinity policy that is applied to your instance for PCI passthrough devices and SR-IOV interfaces, by selecting a flavor that has the policy you require. For more information on the available policies, see Instance PCI NUMA affinity policy in Flavor metadata in the Configuring the Compute service for instance creation guide. If you choose a flavor with a NUMA affinity policy, then the image that you use must have either the same NUMA affinity policy or no NUMA affinity policy.
Retrieve the name or ID of the image that has the software profile that your instance requires:
openstack image list
$ openstack image list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the image that you require is not available, you can download or create a new image. For information about how to create or download cloud images, see Creating RHEL KVM images in Performing storage operations.
TipYou can specify the NUMA affinity policy that is applied to your instance for PCI passthrough devices and SR-IOV interfaces, by selecting an image that has the policy you require. For more information on the available policies, see Instance PCI NUMA affinity policy in Flavor metadata in the Configuring the Compute service for instance creation guide. If you choose an image with a NUMA affinity policy, then the flavor that you use must have either the same NUMA affinity policy or no NUMA affinity policy.
Retrieve the name or ID of the network that you want to connect your instance to:
openstack network list
$ openstack network list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the type of port that you require for your SR-IOV interface:
openstack port create --network <network> \ --vnic-type <vnic_type> mySriovPort
$ openstack port create --network <network> \ --vnic-type <vnic_type> mySriovPort
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<network>
with the name or ID of the network you retrieved in step 3. Replace
<vnic_type>
with the one of the following values:-
direct
: Creates a direct mode SR-IOV virtual function (VF) port. -
direct-physical
: Creates a direct mode SR-IOV physical function (PF) port. -
macvtap
: Creates an indirect mode SR-IOV VF port that uses MacVTap to expose the virtio interface to the instance.
-
-
Replace
Create your instance:
openstack server create --flavor <flavor> \ --image <image> --port <port> \ --wait mySriovInstance
$ openstack server create --flavor <flavor> \ --image <image> --port <port> \ --wait mySriovInstance
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<flavor>
with the name or ID of the flavor that you retrieved in step 1. -
Replace
<image>
with the name or ID of the image that you retrieved in step 2. -
Replace
<port>
with the name or ID of the port that you created in step 4.
-
Replace
5.5. Creating an instance with NUMA affinity on the port Copiar enlaceEnlace copiado en el portapapeles!
To create an instance with NUMA affinity on the port you create the port with the required NUMA affinity policy, then specify the port when creating the instance.
Port NUMA affinity policies have a higher precedence than flavors, images, and PCI NUMA affinity policies. Cloud operators can set a default NUMA affinity policy for each PCI passthrough device. You can use the instance flavor, image, or port to override the default NUMA affinity policy applied to an instance.
With API microversion 2.94, if you pass an optional hostname when creating, updating, or rebuilding an instance, you can use Fully Qualified Domain Names (FQDN) when you specify the hostname. When using FQDN, ensure that [api]dhcp_domain
configuration option is set to the empty string for the correct FQDN to appear in the hostname field in the metadata API. By default, the hostname is normalized from the display name and all occurrences of "." are removed from the hostname and replaced with "_".
Prerequisites
-
The
port-numa-affinity-policy
extension must be enabled in the cloud platform. - The service plugin must be configured in the Networking service (neutron).
-
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
Create a port with the NUMA affinity policy that you require:
openstack port create --network <network> \ [--numa-policy-required | --numa-policy-preferred | --numa-policy-legacy] \ myNUMAAffinityPort
$ openstack port create --network <network> \ [--numa-policy-required | --numa-policy-preferred | --numa-policy-legacy] \ myNUMAAffinityPort
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<network>
with the name or ID of the tenant network that you want to connect your instance to. Use one of the following options to specify the NUMA affinity policy to apply to the port:
-
--numa-policy-required
- NUMA affinity policy required to schedule this port. -
--numa-policy-preferred
- NUMA affinity policy preferred to schedule this port. -
--numa-policy-legacy
- NUMA affinity policy using legacy mode to schedule this port.
-
-
Replace
Create your instance:
openstack server create --flavor <flavor> \ --image <image> --port <port> \ --wait myNUMAAffinityInstance
$ openstack server create --flavor <flavor> \ --image <image> --port <port> \ --wait myNUMAAffinityInstance
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<flavor>
with the name or ID of the flavor that has the hardware profile that you require for your instance. -
Replace
<image>
with the name or ID of the image that has the software profile that you require for your instance. -
Replace
<port>
with the name or ID of the port that you created in step 1.
-
Replace