Setting up multi nodes live migration in Openstack Juno with devstack

Summary

  • Live migration overview

  • Setup Openstack with devstack: one controller node, two compute nodes
  • Configure migrations
  • Live migration test
  • Issue summary

Live migration Overview

Migration enables an administrator to move a virtual-machine instance from one compute host to another. This feature is useful when a compute host requires maintenance. Migration can also be useful to redistribute the load when many VM instances are running on a specific physical machine.

The migration types are:

  • Non-live migration (sometimes referred to simply as 'migration'). The instance is shut down for a period of time to be moved to another hypervisor. In this case, the instance recognizes that it was rebooted.

  • Live migration (or 'true live migration'). Almost no instance downtime. Useful when the instances must be kept running during the migration. The different types of live migration are:

    • Shared storage-based live migration. Both hypervisors have access to shared storage.

    • Block live migration. No shared storage is required. Incompatible with read-only devices such as CD-ROMs and Configuration Drive (config_drive).

    • Volume-backed live migration. Instances are backed by volumes rather than ephemeral disk, no shared storage is required, and migration is supported (currently only available for libvirt-based hypervisors

This page's live migration uses block live migration which does not need shared storage.

Setup Openstack with devstack: one controller node, two compute nodes

Prepare three servers with ubuntu installed. One server is worked as control node, the other two are compute nodes(Note: please named three servers with different hostnames.) and get updates and install git

sudo apt-get update

sudo apt-get install git

Configure controller node

  1. Git devstack Juno release:  git clone https://github.com/openstack-dev/devstack.git -b stable/juno
  2. Add localrc under devstack and add content to it as following

    HOST_IP=your configured IP address
    MULTI_HOST=
    FIXED_RANGE=10.0.0.0/
    FIXED_NETWORK_SIZE=
    ADMIN_PASSWORD=
    MYSQL_PASSWORD=
    RABBIT_PASSWORD=
    SERVICE_PASSWORD=
    SERVICE_TOKEN=
    SCREEN_LOGDIR=/home/stack/log/screen
    LOGFILE=/home/stack/log/stack.log
    LOGDAYS=
    PUBLIC_INTERFACE=eth0 #actual name of your network interface
    FLAT_INTERFACE=eth0
  3. Run devstack to install openstack: ./stack.sh

Configure compute node

  1. Git devstack Juno release:  git clone https://github.com/openstack-dev/devstack.git -b stable/juno
  2. Add localrc under devstack and add content as done in controller node. and also add following to it.

    SERVICE_HOST=your controller ip
    
    HOST_IP=host ip
    
    MULTI_HOST=
    
     FIXED_RANGE=10.0.0.0/
    
    FIXED_NETWORK_SIZE=
    
     ADMIN_PASSWORD=
    
    MYSQL_PASSWORD=
    
    RABBIT_PASSWORD=
    
    SERVICE_PASSWORD=
    
    SERVICE_TOKEN=
    
    SCREEN_LOGDIR=/home/stack/log/screen
    
    LOGFILE=/home/stack/log/stack.log
    
    LOGDAYS=
    
    #PUBLIC_INTERFACE=eth0
    
    FLAT_INTERFACE=eth0
    
    DATABASE_TYPE=mysql
    
    Q_HOST=$SERVICE_HOST
    
    MYSQL_HOST=$SERVICE_HOST
    
    RABBIT_HOST=$SERVICE_HOST
    
    GLANCE_HOSTPORT=$SERVICE_HOST:
    
    KEYSTONE_AUTH_HOST=$SERVICE_HOST
    
    KEYSTONE_SERVICE_HOST=$SERVICE_HOST
    
    ENABLED_SERVICES=n-cpu,n-net,n-api,c-sch,c-api,c-vol
  3. Add some variables which would use during install openstack
    Copy following info to a shell file:

    #!/bin/bash
    
    export OS_AUTH_URL=http://controller'ip:5000/v2.0
    export OS_TENANT_ID=69eaaebc44174418956d4dd104f2be76
    export OS_TENANT_NAME="admin" export OS_USERNAME="admin"
    export OS_PASSWORD=
    export OS_VOLUME_API_VERSION=

    Update the OS_AUTH_URL with your controller node ip. And use command:mysql -uroot -p123456 -e "select * from keystone.project;"  to get OS_TENANT_ID and update it, then run this shell

  4. Run devstack to install openstack: ./stack.sh

Configure migrations

  1. Host name configuration
    Add three server's host names to /etc/hosts to be sure that every node can ping successful to others

    server's IP   server's host name
  2. Configure /etc/sysconfig/iptables file to allow libvirt listen on TCP port 16509 and add a record accepting KVM communication on TCP port within the range from 49152 to 49261
    Note: ubuntu does not have sysconfig folder under etc, need create it manually.

    -A INPUT -p tcp -m multiport --ports  -m comment --comment "libvirt" -j ACCEPT
    
    -A INPUT -p tcp -m multiport --ports : -m comment --comment "migration" -j ACCEPT
  3. Configuration libvirt
    Enable libvirt listen flag at /etc/sysconfig/libvirtd file: add

    LIBVIRTD_ARGS="-listen"

    Configure /etc/libvirt/libvirtd.conf:

    listen_tls =
    listen_tcp =
    auth_tcp = "none"

    Configure /etc/init/libvirt-bin.conf, modify exec /usr/sbin/libvirtd  to exec /usr/sbin/libvirtd -l
    Configure /etc/libvirt/qemu.conf,  modify security_driver="none"

    Restart libvirt, after executing the command, ensure that libvirt is successfully restarted: sudostop libvirt-bin && sudo start libvirt-bin

    ps -ef |grep libvirt

  4. Nova configuration
    Modify:force_config_drive = None(value from always to None)

    Add:live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE  (under default)

  5. Restart service on each node
    screen -s stack -X quit
    ./rejoin-stack.sh

Live migration test

Before start live migration test, to be sure that the nova compute service are ready

      

  1. create instance and attach volume
    nova boot --flavor=flavor_id --image=image_id instance_name
    nova volume-attach vm_id volume_id auto

    +----------+--------------------------------------+
    | Property | Value |
    +----------+--------------------------------------+
    | device | /dev/vdb |
    | id | 3deb171f-8d61-4df9-8e6e-29d86575e78e |
    | serverId | bb12f3b0-c17e-49f7-b482-255258931eb4 |
    | volumeId | 3deb171f-8d61-4df9-8e6e-29d86575e78e |
    +----------+--------------------------------------+
  2. How to mount the volume which attached to the instance
    1> execute command to ssh to the instance, for example: ssh cirros@10.0.0.2
    2> execute command to list the partition tables for the installed devices: sudo fdisk -l
         see:Disk /dev/vdb......
    3> create a filesystem on the  device: sudo mkfs.ext4 /dev/vdb
    4> create a dictionary and mount the volume:
         sudo mkdir /data
         sudo mount /dev/vdb /data/
    5> then we can create folder or file on it
  3. nova show instance_id
  4. nova live-migration --block_migrate vm_id target_server_hostname
  5. check the host before and after migration

Issue summary

1. n-api could not start when install openstack with devstack
Solution: Restart controller node and rejoin the service, then run unstack and stack on compute node

2. Get error:libvirtError: operation failed: Failed to connect to remote libvirt URI qemu+tcp://computer247/system: Unable to resolve address 'computer247' service '16509': Name or service not known
Solution: check the iptables in configure migration step 2.

3. Live Migration failure: Invalid value '4-7,12-15' for 'cpuset.cpus': Invalid argument
Solution: Check the CPU info in your compute nodes, if there have different architecture of cpus, it would be fail to migrate

4. Compute node's nova-cpu service could not enable:


Solution: Check the libvirt settings in configure migration section, and restart libvirt-bin service, then run command in both compute node and controller node:
screen -s stack -X quit
./rejoin-stack.sh

5. Get error:


Solution: It's about nova configuration, check /etc/nova/nova.conf:
Modify:force_config_drive = None(value from always to None)      Add:live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE  (under default)
then rejoin stack in compute node

6. Getting error:screen-n-cpu.2015-06-02-184950.log:2015-06-04
00:16:45.797 ERROR nova.virt.libvirt.driver [-] [instance:
d1b56987-4691-4259-897f-ba4ce3e71260] Live Migration failure: Failed to
open file '/dev/disk/by-path/ip-9.115.246.45:3260-iscsi-iqn.1986-03.com.ibm:2145.v7k41.node1-lun-4': No such file or directory
Solution:  No solution currently by me, it is a bug and would be fixed

7. Gettting
error when rejoin stack:2015-06-09 14:02:33.154 TRACE
cinder.openstack.common.threadgroup ArgumentError: Could not parse
rfc1738 URL from string ''"


Solution:
modify the node sql_connection  in /etc/cinder/cinder.conf and
/etc/nova/nova.conf with( It has no value as default): take following as
example
/etc/cinder/cinder.conf:  sql_connection = mysql://root:123456@9.115.246.185/cinder?charset=utf8
/etc/nova/nova.conf:   sql_connection = mysql://root:123456@9.115.246.185/nova?charset=utf8

Setting up multi nodes live migration in Openstack Juno with devstack的更多相关文章

  1. Deploying Cloud Foundry on OpenStack Juno and XenServer (Part I)

    link http://rabbitstack.github.io/deploying-cloud-foundry-on-openstack-juno-and-xenserver-part-i/ Cl ...

  2. 使用openshit在ubuntu14.04下一键部署openstack(juno版本)

    一.基本介绍 本实验是在vmware workstation上虚拟机ubuntu14.04(64bit,desktop)上部署openstack(Juno版本).采用的工具是openshit.open ...

  3. openStack juno for ubuntu12-04

    <一,preinstall basic conf,pre Env> 1,pwgen(openssl rand -hex 10) some Open-Stack services add a ...

  4. OpenStack Juno 版本发布——支持Spark和NFV[转]

    作者:郑晨,OpenStack中国社区,转载请注明出处 美国时间2014年10月16日,OpenStack Juno版本正式发布,这是OpenStack开源云计算项目自2010年创立以来的第10个版本 ...

  5. 一键安装openstack juno 之controller node.

    原文名称: OpenStack Juno Scripted Installation on CentOS 7 Step I:  本机信息配置 CONTROLLER_IP=192.168.173.133 ...

  6. [openStack]使用Fuel安装OpenStack juno的fuel_master

    安装OpenStack是一件很复杂的事情,特别是在想目中,如果一个组件一个组件,一台一台的coding部署,估计太消耗时间,而且出错的概率很高,所以使用工具推送部署的效率就很高了,而且必须得可靠.mi ...

  7. vmware vms migration to openstack

    Converting a VMware Workstation virtual machine to KVM Leave a commentPosted by rbgeek on August 13, ...

  8. VMware migration to openstack kvm

  9. Centos7 install Openstack Juno (RDO) (转载)

    原文地址:http://www.hdume.com/centos-7-0%E5%AE%89%E8%A3%85openstack/ 1.安装系统,Centos7镜像采用CentOS-7.0-1406-x ...

随机推荐

  1. 【干货】Chrome插件(扩展)开发全攻略(转)

    写在前面 我花了将近一个多月的时间断断续续写下这篇博文,并精心写下完整demo,写博客的辛苦大家懂的,所以转载务必保留出处.本文所有涉及到的大部分代码均在这个demo里面:https://github ...

  2. [Cordova+Sencha Touch] 移动开发1 sencha 2.4.0 + 在 安卓2.3.6上使用报错 - has no method 'bind'

    Sencha Touch 2.3.2和2.4.0在安卓2.3上面用会报错,具体报错信息如下: 解决办法是: 打开文件:你的file:///android_asset/www/sencha-touch- ...

  3. windows下Eclipse启动tomcat提示port已被占用 already in use

    >netstat -ano | findstr 8009 TCP    127.0.0.1:8005         0.0.0.0:0              LISTENING       ...

  4. C#代码实现矢量画图

    原文:C#代码实现矢量画图 版权声明:本文为博主原创文章,转载请附上链接地址. https://blog.csdn.net/ld15102891672/article/details/80275969 ...

  5. 简单推导 PCA

    考虑二维数据降低到一维的例子,如下图所示: 最小化投影方差(maximize projected variance): 1N∑n=1N(uuT1xn−uuT1x¯)=uuT1Suu1,s.t.uuT1 ...

  6. 随机森林算法原理及OpenCV应用

    随机森林算法是机器学习.计算机视觉等领域内应用较为广泛的一个算法.它不仅可以用来做分类(包括二分类和多分类),也可用来做回归预测,也可以作为一种数据降维的手段. 在随机森林中,将生成很多的决策树,并不 ...

  7. 细数 Windows Phone 灭亡的七宗罪(过程很详细,评论很精彩,但主要还是因为太慢了,生态跟不上,太贪了,厂商不愿意推广)

    曾梦想仗剑走天涯,看一看世界的繁华 年少的心有些轻狂,如今你四海为家 曾让你心疼的姑娘,如今已悄然无踪影 犹记得上大学攒钱买了第一台智能手机Lumia 520时,下载的第一首歌曲<曾经的你> ...

  8. Socket编程实践(6) --TCPNotes服务器

    僵尸进程过程 1)通过忽略SIGCHLD信号,避免僵尸进程 在server端代码中加入 signal(SIGCHLD, SIG_IGN); 2)通过wait/waitpid方法.解决僵尸进程 sign ...

  9. Lua学习 2) —— Android与Lua互调

    2014-07-09 一.Android类调用lua并回调 Android调用Lua函数,同一时候把类作为參数传递过去.然后再Lua中回调类的函数 调用lua mLuaState = LuaState ...

  10. WPF字体图标——IconFont

    原文:WPF字体图标--IconFont 版权声明:本文为[CSDN博主:松一160]原创文章,未经允许不得转载. https://blog.csdn.net/songyi160/article/de ...