Jump to: navigation, search

Manila/IPv6

Recipe for Devstack with IPv6

In order to test the Manila IPv6 patches you need to be able to get IPv6 working with your devstack. Here is what I do.

VM setup

I use 2 networks for my devstack VMs. The "front end" network is connected to the outside world. The "back end" network is completely isolated. I use the front end network for management and the back end network for devstack's "public" network (even though that may not be the intended design).

Front end

<network>
  <name>devstacknet_fe</name>
  <forward mode='nat' />
  <bridge name='devstacknet0' stp='on' delay='0'/>
  <mac address='52:54:00:00:30:01'/>
  <domain name='localdomain'/>
  <ip address='192.168.30.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.30.2' end='192.168.30.20'/>
      <host mac="52:54:00:00:30:01" name="master" ip="192.168.30.1" />
      <host mac="52:54:00:00:30:02" name="cache" ip="192.168.30.2" />
      <host mac="52:54:00:00:30:03" name="stage1" ip="192.168.30.3" />
      <host mac="52:54:00:00:30:04" name="stage2" ip="192.168.30.4" />
      <host mac="52:54:00:00:30:05" name="openstack1" ip="192.168.30.5" />
      <host mac="52:54:00:00:30:06" name="openstack2" ip="192.168.30.6" />
    </dhcp>
  </ip>
  <ip family='ipv6' address='fd30::1' prefix='64'>
    <dhcp>
      <range start='fd30::100' end='fd30::1ff'/>
      <host id="00:03:00:01:52:54:00:00:30:01" name="master" ip="fd30::1" />
      <host id="00:03:00:01:52:54:00:00:30:02" name="cache" ip="fd30::2" />
      <host id="00:03:00:01:52:54:00:00:30:03" name="stage1" ip="fd30::3" />
      <host id="00:03:00:01:52:54:00:00:30:04" name="stage2" ip="fd30::4" />
      <host id="00:03:00:01:52:54:00:00:30:05" name="openstack1" ip="fd30::5" />
      <host id="00:03:00:01:52:54:00:00:30:06" name="openstack2" ip="fd30::6" />
    </dhcp>
  </ip>
</network>

Back end

<network ipv6='yes'>
  <name>devstacknet_be</name>
  <bridge name='devstacknet1' stp='on' delay='0'/>
  <mac address='52:54:00:00:31:01'/>
</network>

My VM is an Ubuntu Xenial VM with 2 NICs.

<domain type='kvm'>
  <name>openstack1</name>
  <memory unit='GiB'>4</memory>
  <currentMemory unit='GiB'>4</currentMemory>
  <vcpu>2</vcpu>
  <cpu mode='host-passthrough'></cpu>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc' />
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/vmdata/openstack1.qcow2'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <interface type='network'>
      <mac address='52:54:00:00:30:05'/>
      <source network='devstacknet_fe'/>
      <model type='virtio'/>
    </interface>
    <interface type='network'>
      <source network='devstacknet_be'/>
      <mac address='52:54:00:00:31:02'/>
      <model type='virtio'/>
    </interface>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
    </video>
    <memballoon model='virtio' />
  </devices>
</domain>

Inside the VM I configure my network like this:

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp

auto eth1
iface eth1 inet manual
    up ip link set dev eth1 up
    down ip link set dev eth1 down

I also force the DUID to the DUID-LL format rather than DUID-LLT so I can have a predictable IPv6 address. This step doesn't matter if you're willing to look up which IPv6 address you got each time.

$ head -n 1 /var/lib/dhcp/dhclient6.eth0.leases 
default-duid "\000\003\000\001RT\000\0000\005";

Outside the VM (on the hypervisor) I setup a route to ensure that the nova VMs will be able to talk to the hypervisor:

sudo ip -6 route replace fd10::/15 via fd30::5 dev devstacknet0

Devstack setup

Clone repos:

sudo mkdir /opt/stack
sudo chown $USERNAME:$USERNAME /opt/stack
cd /opt/stack
git clone https://github.com/openstack-dev/devstack
git clone https://github.com/openstack/manila
git clone https://github.com/openstack/python-manilaclient

Create local.conf:

[[local|localrc]]
# HOSP_IP comes from DHCP, it's predictable
HOST_IP=192.168.30.5
ADMIN_PASSWORD=camacho
DATABASE_PASSWORD=camacho
RABBIT_PASSWORD=camacho
SERVICE_PASSWORD=camacho
SERVICE_TOKEN=camacho
GUEST_PASSWORD=camacho
MYSQL_HOST=127.0.0.1
MYSQL_USER=root
MYSQL_PASSWORD=nova
RABBIT_HOST=127.0.0.1
LOGDAYS=1
LOGFILE=$DEST/devstack.log
SCREEN_LOGDIR=$DEST/logs/screen
RECLONE=False
LOG_COLOR=False
LIBVIRT_TYPE=kvm
IP_VERSION=4+6
DOWNLOAD_DEFAULT_IMAGES=False
LIBS_FROM_GIT=python-manilaclient
enable_plugin manila git://git.openstack.org/openstack/manila

MANILA_MULTI_BACKEND=True
MANILA_BACKEND1_CONFIG_GROUP_NAME=vienna
MANILA_BACKEND2_CONFIG_GROUP_NAME=prague
MANILA_SHARE_BACKEND1_NAME=Vienna
MANILA_SHARE_BACKEND2_NAME=Prague

# This image is the "client" image built from openstack/manila-test-image and
# uploaded to a cache server.
IMAGE_URLS=http://192.168.30.2/manila-test.img

SHARE_DRIVER=manila.share.drivers.lvm.LVMShareDriver
MANILA_OPTGROUP_vienna_driver_handles_share_servers=False
MANILA_OPTGROUP_prague_driver_handles_share_servers=False
MANILA_OPTGROUP_vienna_lvm_share_volume_group=lvm-shares1
MANILA_OPTGROUP_prague_lvm_share_volume_group=lvm-shares2
# This export IP comes from DHCPv6, it's predictable
MANILA_LVM_SHARE_EXPORT_IP=fd30::5

ENABLED_SERVICES=key,mysql,rabbit,tempest,manila,m-api,m-sch,m-shr,m-dat,q-svc,q-dhcp,q-meta,q-agt,q-l3,neutron,n-api,n-cond,n-cpu,n-sch,g-api,g-reg

Q_USE_PROVIDERNET_FOR_PUBLIC=True
PUBLIC_INTERFACE=eth1
Q_USE_SECGROUP=False
IPV4_ADDRS_SAFE_TO_USE=10.0.0.0/22
IPV6_RA_MODE=dhcpv6-stateful
IPV6_ADDRESS_MODE=dhcpv6-stateful
IPV6_ADDRS_SAFE_TO_USE=fd10::/16
FIXED_RANGE_V6=fd10::/64
IPV6_PUBLIC_RANGE=fd11::/64
IPV6_PUBLIC_NETWORK_GATEWAY=fd11::2


Before stacking I create my backing files explicitly:

mkdir /opt/stack/data
truncate -s 100g /opt/stack/data/lvm-shares1-backing-file
truncate -s 100g /opt/stack/data/lvm-shares2-backing-file
sudo vgcreate lvm-shares1 \$(sudo losetup -f --show /opt/stack/data/lvm-shares1-backing-file)
sudo vgcreate lvm-shares2 \$(sudo losetup -f --show /opt/stack/data/lvm-shares2-backing-file)

Now I run stack.sh and go get coffee.

Testing

After stacking, I run these commands:

source /opt/stack/devstack/openrc demo demo > /dev/null
openstack network create demo-net
POOL6=$(openstack subnet pool list | grep fd10::/16 | awk '{print $2}')
openstack subnet create --ip-version 6 demo-v6-subnet --network demo-net --subnet-pool $POOL6 --ipv6-ra-mode dhcpv6-stateful --ipv6-address-mode dhcpv6-stateful
POOL4=$(openstack subnet pool list | grep 10.0.0.0/22 | awk '{print $2}')
openstack subnet create --ip-version 4 demo-v4-subnet --network demo-net --subnet-pool $POOL4
openstack router add subnet router1 demo-v6-subnet
openstack router add subnet router1 demo-v4-subnet
openstack keypair create --public-key ~/.ssh/id_rsa.pub demo-key
nova boot --flavor cirros256 --image manila-test --nic net-name=demo-net --key-name demo-key --config-drive true demo-vm

Once the nova VM boots up I use "nova list" to get its IPv6 address and I can SSH to it from either the devstack VM or the hypervisor, and the nova VM is able to ping both the destack VM and the hypervisor, and perform mounts over IPv6, etc.