Red Hat Training

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

Chapter 3. Launch Bare Metal Instances

Provision a physical machine on an enrolled bare metal node. Instances can be launched from the command line or in the OpenStack dashboard.

3.1. Deploy an Instance Using the Command Line Interface

Use the nova command line interface to deploy a bare metal instance.

Deploying an Instance on the Command Line

  1. Set up the shell to access Identity as the administrative user:

    # source ~/keystonerc_admin
  2. Deploy the instance:

    # nova boot --nic net-id=NETWORK_UUID --flavor FLAVOR_NAME --image IMAGE_UUID INSTANCE_NAME

    Replace the following values:

    • Replace NETWORK_UUID with the unique identifier for the network that was created for use with Bare Metal Provisioning.
    • Replace FLAVOR_NAME with the name of the flavor that was created for the node.
    • Replace IMAGE_UUID with the unique identifier for the disk image that was uploaded to the Image service.
    • Replace INSTANCE_NAME with a name for the bare metal instance.
  3. Check the status of the instance:

    # nova list

3.2. Deploy an Instance Using the Dashboard

Use the dashboard graphical user interface to deploy a bare metal instance.

Deploying an Instance in the Dashboard

  1. Log in to the dashboard at https://DASHBOARD_IP/dashboard.
  2. Click Project > Compute > Instances
  3. Click Launch Instance.
  4. In the Details tab, fill out the following fields:

    • Specify the Instance Name.
    • Select the Flavor that was created for the bare metal node.
    • Select 1 from the Instance Count list.
    • Select Boot from image from the Instance Boot Source list.
    • Select the operating system disk image from the Image Name list.
  5. In the Networking tab, drag and drop the required networks from Available Networks to Selected Networks. Ensure that the shared network created for Bare Metal Provisioning is selected here.
  6. Click Launch.

3.3. Create a Whole Windows Image

This procedure creates a deployment image for Windows Server 2012. Perform the following steps on a Red Hat Enterprise Linux system:

  1. Download the virtio-win drivers. Refer to the Red Hat customer portal for the required steps.

    As a result, the virtio-win .iso file is downloaded to /usr/share/virtio-win/. For example: /usr/share/virtio-win/virtio-win-1.8.0.iso

  2. Create a Windows Server 2012 template VM using virt-manager:

    • Determine the virtual hardware requirements of your Windows template. This example uses 1 x CPU, 4GB RAM, 10GB HDD, 2 x NICs, and 2 x virtual CD-ROM drives.
    • Create the disk as a qcow2 file.
    • Set both Virtual HDD and NIC drivers to virtio.
    • Attach 2x virtual CD-ROM drives, mounted to the Windows Server 2012 R2 .iso file, and the virtio-win-1.8.0.iso file. The two virtual CD-ROMs are required to allow the installation of the virtio-win drivers during the Windows installation process.
  3. Install Windows manually from the ISO image:

    • Start the installation of Windows from the evaluation .iso image of Windows Server 2012 R2.
    • When given the opportunity to select a HDD driver, select the driver from the second virtual CD-ROM containing the virtio-win-1.8.0.iso file.
  4. Perform post-install Windows checks:

    Open Device Manager and confirm that all devices are properly recognized, and that no question mark warnings are present. In particular, check that the NIC, serial, and balloon driver are using the VirtIO driver. If any devices are not correctly recognized, apply the driver from the virtio-win driver disc.

  5. Run sysprep:

    Sysprep causes the Windows installation to become generic, removing installation information that was specific to the single installation performed previously. This allows you to use the virtual hard disk of the VM as a template for multiple installations to other systems.

    1. Launch Sysprep from C:\Windows\System32\sysprep\sysprep.exe
    2. Enter the following information into the Sysprep tool:

      • For System Cleanup Action, select Enter System Out-of-Box-Experience (OOBE).
      • Select the Generalize check box
      • Under Shutdown Options, select Shutdown.
    3. Click OK to complete the sysprep process. The virtual machine will shut down automatically upon completion.
  6. Register the Windows image in Image Service (glance): This step registers the qcow2 HDD of the Windows installation in glance. This example uses the disk file: /root/win2012r2.qcow2.

    $ glance image-create --file /root/win2012r2.qcow2 --disk-format qcow2 --container-format bare --name win2012r2 --is-public True --progress
    [=============================>] 100%

3.3.1. Deploy Windows to a physical server

  1. Register the physical node in ironic by specifying the hardware components. For example:

    # ironic node-create -d fake_pxe -p cpus=1 -p memory_mb=1024 -p local_gb=15 -p cpu_arch=amd64
  2. Retrieve the new node’s UUID:

    # ironic node-list
  3. Create a port for the node that matches the MAC address of the physical Windows node.

    # ironic port-create -n [NODE_UUID] -a [NIC_MAC]

    For example:

    # ironic port-create -n 3b3d3fd4-4621-427f-a78d-054a1ef17a0a -a 52:54:00:85:76:53
  4. Set the node to maintenance mode:

    # ironic node-set-maintenance [NODE_UUID] true
    # ironic node-set-provision-state [NODE_UUID] manage
  5. Perform introspection of the new node:

    # openstack baremetal introspection start [NODE_UUID] --discoverd-url http://[KEYSTONE_URL]:5050
    • Replace [KEYSTONE_URL] with the IP address of the keystone service.

      Note: If using the FAKE_PXE driver, power on the node manually once the ironic node-list state moves to deploy wait-callback.

  6. Once introspection has completed, turn off maintenance mode:

    # ironic node-set-maintenance [NODE UUID] false
    # ironic node-set-provision-state [NODE UUID] provide
  7. Create a keypair for authentication to the instance:

    # nova keypair-add --pub_key ~/.ssh/id_rsa.pub [KEY_NAME]
  8. Enable local boot for the node:

    # ironic node-update [NODE_UUID] add properties/capabilities="boot_option:local"
  9. Use nova to boot the node:

    # nova boot --nic net-id=[NETWORK_UUID] --flavor [FLAVOR_NAME] --image [IMAGE_UUID/IMAGE_NAME] --keyname [INSTANCE_NAME]

    Replace the following values:

    • Replace [NETWORK_UUID] with the unique identifier for the network that was created for use with Bare Metal Provisioning.
    • Replace [FLAVOR_NAME] with the name of the flavor that was created for the node.
    • Replace [IMAGE_UUID] with the unique identifier for the disk image that was uploaded to the Image service.
    • Replace [INSTANCE_NAME] with a name for the bare metal instance.
  10. Retrieve the instance password:

    # nova get-password [INSTANCE_NAME]  /path/to/your/keypairs/private/key
  11. Review the status of the instance:

    # nova list

You can test this further by accessing the instance using the console in dashboard.

3.3.2. Enable Remote Desktop access

  1. Add a security group rule allowing Remote Desktop traffic on TCP/UDP 3389.
  2. Use the nova command to retrieve the security keys:

    # nova get-password [INSTANCE_NAME] /path/to/your/keypairs/private/key
    • Replace [INSTANCE_NAME] with the name of the bare metal instance.