您的位置:首页 > 产品设计 > UI/UE

openstack 管理四十 - nova 与 qemu guest agent

2017-08-29 15:37 591 查看

目的

nova 下的 instance 可以通过 qemu guest agent 进行管理, 包括 开关机, 监控, 等操作


配置前提

instance kernel 默认需要大于 2.6.28 ( rhel5 提供另外一个开源项目 virto 进行支持 )
nova 需要配置 virt_type=kvm|qemu 与 cpu_mode=host-model  参数

参考
virt_type 配置
# Libvirt domain type (valid options are: kvm, lxc, qemu, uml,
# xen) (string value)
# Deprecated group;name - DEFAULT;libvirt_type

cpu_mode 配置
# Set to "host-model" to clone the host CPU feature flags; to
# "host-passthrough" to use the host CPU model exactly; to
# "custom" to use a named CPU model; to "none" to not set any
# CPU model. If virt_type="kvm|qemu", it will default to
# "host-model", otherwise it will default to "none" (string
# value)
# Deprecated group;name - DEFAULT;libvirt_cpu_mode


原文

Use guest agents to enable optional access between compute nodes and guests through a socket, using the QMP protocol.

To enable this feature, you must set hw_qemu_guest_agent=yes as a metadata parameter on the image you wish to use to create the guest-agent-capable instances from. You can explicitly disable the feature by setting hw_qemu_guest_agent=no in the image metadata.


guest agent 结构体系



glance 配置

glance 需要配置 hw_qemu_guest_agent=yes 才可以满足 agent 的支持

参考例子

glance image-create --name cirros \
--disk-format raw \
--container-format bare \
--file cirros-0.3.3-x86_64-disk.raw \
--is-public True \
--property hw_qemu_guest_agent=yes \
--progress


修改过的 glance 镜像, 会在 instance 启动时候, 自动把下面配置参数添加到 libvirt.xml 中

<channel type="unix">
<source mode="bind" path="/var/lib/libvirt/qemu/org.qemu.guest_agent.0.instance-00023ed9.sock"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>


nova boot

1.  nova instance boot 与之前没有任何区别
2. 只要 kernel 大于 2.6.28 , 系统系统后, 会自动生成 /dev/vportXpX 设备 (成功了一半)
3. 注: rhel5 不会自动生成该设备 (kernel 默认 2.6.18)  后面再说明


qemu-guest-agent 软件安装

rhel7

安装

yum install -y qemu-guest-agent


启动

systemctl restart qemu-guest-agent


rhel6

安装

yum install -y qemu-guest-agent


启动

/etc/init.d/qemu-ga start


rhel5

前提 (修改 /dev/vportXpX 属性, 为了之后设备生成与启动)

sed -i /vport/d /etc/udev/rules.d/50-udev.rules
sed -i /virtio/a\ 'KERNEL=="vport*", SYSFS{name}=="?*", MODE=="0660", GROUP="ovirtagent", SYMLINK+="virtio-ports/%s{name}"'  /etc/udev/rules.d/50-udev.rules


安装

yum install -y epel
yum install -y ovirt-guest-agent


建议做一次电脑重启

配置修改

sed -i /device/d /etc/ovirt-guest-agent.conf
sed -i /virtio/a\ 'device = /dev/virtio-ports/org.qemu.guest_agent.0' /etc/ovirt-guest-agent.conf


启动

/etc/init.d/ovirt-guest-agent restart
chkconfig ovirt-guest-agent on


windows 版本

参考redhat 文档 不在这里描述了

参考文档

rhel 7 官当中对 qemu-guest-agent 的描述

libvirt index

libvirt 官当对 qemu-guest-agent 描述

python 开发 example

python 开发文档

ovirt 官方文档
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  openstack qemu