Xen managed by libvirt in openstack 遇到问题

Openstack官方描述:

151538149.png

问题

161055705.png

libvirtError: POST operation failed: xend_post: error from xen daemon: (xend.err 'Device /dev/xvdp (51952, tap) is already connected.')

https://github.com/openstack/nova/commit/35c4962c0b97bae5b8751d316d5822fe22c1ab6a

修改后创建虚拟机时仍是err

[root@Dom0 ~(keystone_admin)]$ nova list
+--------------------------------------+---------------+---------+----------+
| ID                                   | Name          | Status  | Networks |
+--------------------------------------+---------------+---------+----------+
| 136c56da-c827-497b-b8b9-bc7b3f0592bf | cirros1       | ERROR   |          |

将image文件改成raw格式,并手工修改libvirt.xml后:

<domain type="xen">

<uuid>47c3dee4-4a0f-4e43-b3b2-360994c39eb6</uuid>

<name>instance-00000003</name>

<memory>131072</memory>

<vcpu>2</vcpu>

<os>

<type>xen</type>

<root>/dev/xvda</root>

<boot dev="hd"/>

</os>

<features>

<acpi/>

</features>

<clock offset="utc"/>

<devices>

<disk type="file" device="disk">

- <driver name="file" type="qcow2" cache="none"/>

+ <driver name="file" type="raw" cache="none"/>

<source file="/var/lib/nova/instances/instance-00000003/disk"/>

- <target bus="xen" dev="sda"/>

+ <target bus="xen" dev="xvda"/>

</disk>

<disk type="file" device="disk">

- <driver name="file" type="qcow2" cache="none"/>

+ <driver name="file" type="raw" cache="none"/>

<source file="/var/lib/nova/instances/instance-00000003/disk.swap"/>

- <target bus="xen" dev="sdb"/>

+ <target bus="xen" dev="xvdb"/>

</disk>

<console type="pty"/>

<graphics type="vnc" autoport="yes" keymap="en-us" listen="172.16.100.1"/>

</devices>

</domain>


[root@Dom0 ~(keystone_admin)]$ nova start cirros1

[root@Dom0 ~(keystone_admin)]$ nova list
+--------------------------------------+---------------+---------+----------+
| ID                                   | Name          | Status  | Networks |
+--------------------------------------+---------------+---------+----------+
| 136c56da-c827-497b-b8b9-bc7b3f0592bf | cirros1       | ACTIVE   |          |

[root@Dom0 instances]# virsh console instance-00000003

  ____               ____  ____
 / __/ __ ____ ____ / __ \/ __/
/ /__ / // __// __// /_/ /\ \
\___//_//_/  /_/   \____/___/
 http://launchpad.net/cirros
login as 'cirros' user. default password: 'cubswin:)'. use 'sudo' for root.
cirros login:

可是,总不能每次都手工修改吧,查阅官方文档后找到了问题的解决办法:

错误原因:

想要nova正确地生成xml配置文件,仅在nova配置文件(/etc/nova/nova.conf)中关于xen的配置使用下面几个参数是不够的,生成的配置文件在image文件格式(默认qcow2而openstack中Xen不支持)和磁盘名称(sdX)上都不对

# COMPUTE
libvirt_type=xen
connection_type=libvirt
compute_driver=libvirt.LibvirtDriver

至少应该这样指定:

# COMPUTE
libvirt_type=xen
connection_type=libvirt
compute_driver=libvirt.LibvirtDriver
libvirt_disk_prefix=xvd
libvirt_images_type=raw

重启服务:

[root@Dom0 ~(keystone_admin)]$ for svc in api compute network cert console scheduler; do service openstack-nova-$svc restart; done

创建虚拟机实例:

[root@Dom0 ~(keystone_admin)]$ nova boot --flavor 6 --image `nova image-list | grep cirros-0.3.0-x86 | awk '{print $2}'` --key_name testkey --security_group default cirros1

虚拟机正常启动:

[root@Dom0 ~(keystone_admin)]$ nova list
+--------------------------------------+---------+--------+----------------------+
| ID                                   | Name    | Status | Networks             |
+--------------------------------------+---------+--------+----------------------+
| bfdab37b-5419-47c0-90cc-9112000ba4d1 | cirros1 | ACTIVE | private=172.16.200.4 |
+--------------------------------------+---------+--------+----------------------+

ip及key都正常

[root@Dom0 ~(keystone_admin)]$ ssh [email protected]
$ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev                     51.9M         0     51.9M   0% /dev
/dev/xvda1               23.2M     12.9M      9.1M  59% /
tmpfs                    56.1M         0     56.1M   0% /dev/shm
tmpfs                   200.0K     20.0K    180.0K  10% /run
$ whoami
cirros
$

配置文件:

[root@Dom0 instances]# cat instance-00000002/libvirt.xml
<domain type="xen">
  <uuid>bfdab37b-5419-47c0-90cc-9112000ba4d1</uuid>
  <name>instance-00000002</name>
  <memory>131072</memory>
  <vcpu>2</vcpu>
  <os>
    <type>xen</type>
    <root>/dev/xvda</root>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset="utc"/>
  <devices>
    <disk type="file" device="disk">
      <driver name="file" type="raw" cache="none"/>
      <source file="/var/lib/nova/instances/instance-00000002/disk"/>
      <target bus="xen" dev="xvda"/>
    </disk>
    <interface type="bridge">
      <mac address="fa:16:3e:4a:01:b3"/>
      <source bridge="br100"/>
      <filterref filter="nova-instance-instance-00000002-fa163e4a01b3">
        <parameter name="IP" value="172.16.200.4"/>
        <parameter name="DHCPSERVER" value="172.16.200.3"/>
        <parameter name="PROJNET" value="172.16.200.0"/>
        <parameter name="PROJMASK" value="255.255.255.0"/>
      </filterref>
    </interface>
    <console type="pty"/>
    <graphics type="vnc" autoport="yes" keymap="en-us" listen="172.16.100.1"/>
  </devices>
</domain>



你可能感兴趣的:(xen,tap,managed,51952,xvdp)