Chapter 5. Creating an instance
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. Note When you create an instance, the Compute (nova) service uses the name you give the instance to generate a valid hostname for the instance in the metadata service and config drive. The Compute service replaces spaces (' ') and underscores (_) in the instance name with dashes (-) to generate a valid DNS label. The Compute service also replaces periods (.) with dashes (-) if the instance name ends with a period followed by one or more digits. 5.1. Prerequisites The required image or volume is available as the boot source: For more information about how to create an image, see Creating an image in the Creating and Managing Images guide. For more information about how to create a volume, see Creating Block Storage volumes in the Storage 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 Networking Guide . 5.2. Creating an instance from an image You can create an instance by using an image as the boot source. Procedure Retrieve the name or ID of the flavor that has the hardware profile that your instance requires: Note Choose 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: 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 Image service . Note If 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: Create your instance: 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. 5.3. Creating an instance from a bootable volume 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. Note 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. Procedure Retrieve the name or ID of the image that has the software profile that your instance requires: 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 Image service . Note If 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: 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. Retrieve the name or ID of the flavor that has the hardware profile that your instance requires: Retrieve the name or ID of the network that you want to connect your instance to: Create an instance with the bootable volume: 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. 5.4. Creating an instance with a SR-IOV network interface To create an instance with a single root I/O virtualization (SR-IOV) network interface you need to create the required SR-IOV port. Procedure Retrieve the name or ID of the flavor that has the hardware profile that your instance requires: Note Choose a flavor with sufficient size for the image to successfully boot, otherwise the instance will fail to launch. Tip You 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 . 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: 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 Image service . Tip You 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 . 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: Create the type of port that you require for your SR-IOV interface: 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. Create your instance: 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. 5.5. Additional resources Creating a customized instance
openstack flavor list openstack image list openstack network list openstack server create --flavor <flavor> --image <image> --network <network> --wait myInstanceFromImage openstack image list openstack volume create --image <image> --size <size_gb> --bootable myBootableVolume openstack flavor list openstack network list openstack server create --flavor <flavor> --volume myBootableVolume --network <network> --wait myInstanceFromVolume openstack flavor list openstack image list openstack network list openstack port create --network <network> --vnic-type <vnic_type> mySriovPort openstack server create --flavor <flavor> --image <image> --port <port> --wait mySriovInstance