分享

OpenStack服务器节点迁移(修改IP)后引发的nova-compute不启动

坎蒂丝_Swan 发表于 2014-12-4 17:06:42 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 24751
本帖最后由 pig2 于 2014-12-4 19:49 编辑
问题导读


问题1:Openstack平台部署总是会遇到改IP等的问题,那到底改如何修改?
问题2:修改IP后出现的问题应如何解决?






之前一直在忙活将OpenStack的那几台服务器从部门机房搬迁到集团的大机房去,由于要修改节点的public_ip,出现了许多问题,也是经过了2个不免之夜,终于将问题都解决了,在这里将过程记录一下,和大家分享。



原IP为


  1. auto lo  
  2. iface lo inet loopback  
  3.   
  4. auto eth0  
  5. iface eth0 inet static  
  6. address 10.2.116.14  
  7. netmask 255.255.255.0  
  8. broadcast 10.2.116.255  
  9. gateway 10.2.116.1  
  10. dns-nameservers 8.8.8.8  
  11.   
  12. auto eth1  
  13. iface eth1 inet static  
  14. address 192.168.3.1  
  15. netmask 255.255.255.0  
  16. network 192.168.3.0  
  17. broadcast 192.168.3.255  
复制代码

修改后改为

  1. auto lo  
  2. iface lo inet loopback  
  3.   
  4. auto eth0  
  5. iface eth0 inet static  
  6. address 10.2.15.3  
  7. netmask 255.255.255.0  
  8. broadcast 10.2.15.255  
  9. gateway 10.2.15.1  
  10. dns-nameservers 8.8.8.8  
  11.   
  12. auto eth1  
  13. iface eth1 inet static  
  14. address 192.168.3.1  
  15. netmask 255.255.255.0  
  16. network 192.168.3.0  
  17. broadcast 192.168.3.255
复制代码

Eth0:Public_IP从原来的10.2.116.14变更为10.2.15.3,回想了一下安装过程,设计到此IP的主要有3个地方,KeyStone的Endpoint,Nova的配置文件nova.conf,以及设置Nova-network的floating_ip。将其一一修改为新IP之后重启,出现错误

  1. TRACE nova libvirtError: Domain not found: no domain with matching name 'instance-0000005f'
复制代码


查找instance-0000005f这个文件,发现其位置在/var/lib/nova/instances/instance-0000005f这个目录下有libvirt.xml这个文件,这个文件在nova-compute启动时会最为虚拟机的参数配置文件

查找发现VNC的配置IP还是原IP
  1. <graphics type='vnc' port='-1' autoport='yes' keymap='en-us' listen='10.2.116.14'/>
复制代码

修改为
  1. <graphics type='vnc' port='-1' autoport='yes' keymap='en-us' listen='10.2.15.3'/>
复制代码

之后重启nova-compute问题依旧,仔细研读出错的log信息,发现错误头为libvirtError想到会不会是libvirt的错误,然后到/etc/libvirt/qemu目录下查找,发现目录为空。证明libvirt启动时没有发现配置文件,正如上面的错误所示,“no domain with matching name instace-00xxxx"。研读nova源码发现,nova-compute启动时会根据/var/lib/novainstances/instance-0000005f/libvirt.xml去创建libvirt所使用的标准domain文件,估计是缓存或是bug等原因,导致只修改了VNC的IP后还是不能正确生成libvirt的domain文件,所以我们用libvirt的virsh命令手动生成。
  1. cd /etc/libvirt/qemu  
  2. virsh define instance-0000005f.xml
复制代码

之后手动添加其配置信息

  1. <!--
  2. WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
  3. OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  4.   virsh edit instance-0000005f
  5. or other application using the libvirt API.
  6. -->
  7. <domain type='kvm'>
  8.   <name>instance-0000005f</name>
  9.   <uuid>e8f73117-1a19-4d3e-a8d5-f846199d3b75</uuid>
  10.   <memory>524288</memory>
  11.   <currentMemory>524288</currentMemory>
  12.   <vcpu>1</vcpu>
  13.   <os>
  14.     <type arch='x86_64' machine='pc-1.0'>hvm</type>
  15.     <boot dev='hd'/>
  16.   </os>
  17.   <features>
  18.     <acpi/>
  19.   </features>
  20.   <clock offset='utc'/>
  21.   <on_poweroff>destroy</on_poweroff>
  22.   <on_reboot>restart</on_reboot>
  23.   <on_crash>destroy</on_crash>
  24.   <devices>
  25.     <emulator>/usr/bin/kvm</emulator>
  26.     <disk type='file' device='disk'>
  27.       <driver name='qemu' type='qcow2' cache='none'/>
  28.       <source file='/var/lib/nova/instances/instance-0000005f/disk'/>
  29.       <target dev='vda' bus='virtio'/>
  30.       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  31.     </disk>
  32.     <interface type='bridge'>
  33.       <mac address='fa:16:3e:1a:66:d3'/>
  34.       <source bridge='br100'/>
  35.       <model type='virtio'/>
  36.       <filterref filter='nova-instance-instance-0000005f-fa163e1a66d3'>
  37.         <parameter name='DHCPSERVER' value='192.168.4.33'/>
  38.         <parameter name='IP' value='192.168.4.40'/>
  39.       </filterref>
  40.       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
  41.     </interface>
  42.     <serial type='file'>
  43.       <source path='/var/lib/nova/instances/instance-0000005f/console.log'/>
  44.       <target port='0'/>
  45.     </serial>
  46.     <serial type='pty'>
  47.       <target port='1'/>
  48.     </serial>
  49.     <console type='file'>
  50.       <source path='/var/lib/nova/instances/instance-0000005f/console.log'/>
  51.       <target type='serial' port='0'/>
  52.     </console>
  53.     <input type='tablet' bus='usb'/>
  54.     <input type='mouse' bus='ps2'/>
  55.     <graphics type='vnc' port='-1' autoport='yes' listen='10.2.15.3' keymap='en-us'>
  56.       <listen type='address' address='10.2.15.3'/>
  57.     </graphics>
  58.     <video>
  59.       <model type='cirrus' vram='9216' heads='1'/>
  60.       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
  61.     </video>
  62.     <memballoon model='virtio'>
  63.       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
  64.     </memballoon>
  65.   </devices>
  66. </domain>
复制代码

保存后重启nova-compute出现新错误

  1. 2012-12-16 21:03:06 TRACE nova     if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self)
  2. 2012-12-16 21:03:06 TRACE nova libvirtError: Unable to read from monitor: Connection reset by peer
  3. 2012-12-16 21:03:06 TRACE nova
复制代码

可使用命令

  1. virsh managedsave-remove NameOfDomai
复制代码

之后再次重启nova-compute,出现新错误
  1. 2012-12-16 19:47:28 TRACE nova Command: sudo nova-rootwrap iscsiadm -m node -T iqn.2010-10.org.openstack:volume-0000000a -p 10.2.116.14:3260 --rescan
  2. 2012-12-16 19:47:28 TRACE nova Exit code: 255
  3. 2012-12-16 19:47:28 TRACE nova Stdout: ''
  4. 2012-12-16 19:47:28 TRACE nova Stderr: 'iscsiadm: No portal found.\n'
复制代码

经分析,是修改IP导致了nova-volume服务找不到对应的volume了,但是我们在nova-volume被没有相关的配置文件,几经思考之后决定查看openstack的系统数据库,发现在block_device_mapping和volumes两个表中有跟IP相关的列对应,将其修改为新的IP,之后再次重启nova-compute服务,终于一切正常。



2013-02-21 新增
上面nova-volume服务出现错误,主要是两个数据表中和服务IP有关联的项目所用的IP都是默认的外网IP端10.2.16.14,而我们服务器搬迁了之后正好更改的就是这个外网地址。我们可以修改nova.conf中增加--iscsi_ip_address=192.168.3.1,这样申请的volume就会用这个内网地址写到数据库中,如再遇服务器搬迁修改外网IP等问题,不会对系统内部产生影响。


期间也走了许多弯路,出现问题并不可怕,要冷静客观。主要还是要有逻辑分析能力,能找到解决问题的思路。

欢迎加入about云群90371779322273151432264021 ,云计算爱好者群,亦可关注about云腾讯认证空间||关注本站微信

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条