Showing posts with label openstack. Show all posts
Showing posts with label openstack. Show all posts

Monday, January 17, 2022

OpenStack: Add Host entry in dnsmasq


 Ex: Setup for hostname "openstack" to ip "10.0.0.1".

  • Create file /etc/neutron/dnsmasq-neutron.conf with below content in it.

address=/openstack/10.0.0.1
  • Edit /etc/neutron/dhcp_agent.ini and add below.

dnsmasq_config_file=/etc/neutron/dnsmasq-neutron.conf
  • Then kill all existing dnsmasq processes and restart dhcp-agent. Or reboot the network node.

# service neutron-dhcp-agent restart


OpenStack: Setup MTU for VM instance's network

 

Within the VM instance, set the network interface MTU to 1400 bytes.

To set the MTU automatically to 1400 by neutron dhcp server, follow below steps. This is achieved by dhcp server sending out 1400 MTU to instances as a dhcp option.

  • Create file /etc/neutron/dnsmasq-neutron.conf with below content in it.

dhcp-option-force=26,1400
  • Edit /etc/neutron/dhcp_agent.ini and add below.

dnsmasq_config_file=/etc/neutron/dnsmasq-neutron.conf
  • Then kill all existing dnsmasq processes and restart dhcp-agent. Or reboot the network node.

# service neutron-dhcp-agent restart

Tuesday, January 11, 2022

Openstack: Launch an instance with heat

 

Ref: https://docs.openstack.org/heat/latest/install/launch-instance.html

Create a template

The Orchestration service uses templates to describe stacks. To learn about the template language, see the Template Guide.

  • Create the demo-template.yml file with the following content:

    heat_template_version: 2015-10-15
    description: Launch a basic instance with CirrOS image using the
                 ``m1.tiny`` flavor, ``mykey`` key,  and one network.
    
    parameters:
      NetID:
        type: string
        description: Network ID to use for the instance.
    
    resources:
      server:
        type: OS::Nova::Server
        properties:
          image: cirros
          flavor: m1.tiny
          key_name: mykey
          networks:
          - network: { get_param: NetID }
    
    outputs:
      instance_name:
        description: Name of the instance.
        value: { get_attr: [ server, name ] }
      instance_ip:
        description: IP address of the instance.
        value: { get_attr: [ server, first_address ] }
    

Create a stack

Create a stack using the demo-template.yml template.

  1. Source the demo credentials to perform the following steps as a non-administrative project:

    $ . demo-openrc
    
  2. Determine available networks.

    $ openstack network list
    +--------------------------------------+-------------+--------------------------------------+
    | ID                                   | Name        | Subnets                              |
    +--------------------------------------+-------------+--------------------------------------+
    | 4716ddfe-6e60-40e7-b2a8-42e57bf3c31c | selfservice | 2112d5eb-f9d6-45fd-906e-7cabd38b7c7c |
    | b5b6993c-ddf9-40e7-91d0-86806a42edb8 | provider    | 310911f6-acf0-4a47-824e-3032916582ff |
    +--------------------------------------+-------------+--------------------------------------+
    

    Note

    This output may differ from your environment.

  3. Set the NET_ID environment variable to reflect the ID of a network. For example, using the provider network:

    $ export NET_ID=$(openstack network list | awk '/ provider / { print $2 }')
    
  4. Create a stack of one CirrOS instance on the provider network:

    $ openstack stack create -t demo-template.yml --parameter "NetID=$NET_ID" stack
    +--------------------------------------+------------+--------------------+---------------------+--------------+
    | ID                                   | Stack Name | Stack Status       | Creation Time       | Updated Time |
    +--------------------------------------+------------+--------------------+---------------------+--------------+
    | dbf46d1b-0b97-4d45-a0b3-9662a1eb6cf3 | stack      | CREATE_IN_PROGRESS | 2015-10-13T15:27:20 | None         |
    +--------------------------------------+------------+--------------------+---------------------+--------------+
    
  5. After a short time, verify successful creation of the stack:

    $ openstack stack list
    +--------------------------------------+------------+-----------------+---------------------+--------------+
    | ID                                   | Stack Name | Stack Status    | Creation Time       | Updated Time |
    +--------------------------------------+------------+-----------------+---------------------+--------------+
    | dbf46d1b-0b97-4d45-a0b3-9662a1eb6cf3 | stack      | CREATE_COMPLETE | 2015-10-13T15:27:20 | None         |
    +--------------------------------------+------------+-----------------+---------------------+--------------+
    
  6. Show the name and IP address of the instance and compare with the output of the OpenStack client:

    $ openstack stack output show --all stack
    [
      {
        "output_value": "stack-server-3nzfyfofu6d4",
        "description": "Name of the instance.",
        "output_key": "instance_name"
      },
      {
        "output_value": "10.4.31.106",
        "description": "IP address of the instance.",
        "output_key": "instance_ip"
      }
    ]
    
    $ openstack server list
    +--------------------------------------+---------------------------+--------+---------------------------------+
    | ID                                   | Name                      | Status | Networks                        |
    +--------------------------------------+---------------------------+--------+---------------------------------+
    | 0fc2af0c-ae79-4d22-8f36-9e860c257da5 | stack-server-3nzfyfofu6d4 | ACTIVE | public=10.4.31.106              |
    +--------------------------------------+---------------------------+--------+---------------------------------+
    
  7. Delete the stack.

    $ openstack stack delete --yes stack


Openstack: Heat with error "create() got an unexpected keyword argument 'policies' "

 


  • In OSP16 the Nova API has changed the policies field to policy

  • You can work around this issue by specify the compute API --os-compute-api-version 2.63 in your command.


openstack server group create --os-compute-api-version 2.63 --policy affinity demo


Edit file: /etc/heat/heat.conf  add the lines below and restart heat service:

[DEFAULT]

...

max_nova_api_microversion = 2.63


Install and use xorg-server on macOS via Homebrew

  The instructions to install and use xorg-server on macOS via Homebrew: Install Homebrew (if you haven't already): /bin/bash -c ...