openstack 管理四十 - nova 与 qemu guest agent

目的

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 结构体系

查考 qemu 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 官方文档

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Terry_Tsang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值