qemu-ga

bty:git 提交需要xwindow的办法unset SSH_ASKPASS1.在virsh的xml定义中加入channel指定host的socket映射到guest的dev用virsh启动虚拟机的时候注意加channel[code="java"] [/code]...
摘要由CSDN通过智能技术生成
bty:git 提交需要xwindow的办法
unset SSH_ASKPASS


1.在virsh的xml定义中加入channel指定host的socket映射到guest的dev
用virsh启动虚拟机的时候
注意加channel

<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/test.agent'/>
<target type='virtio' name='com.haoning.spice.0'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>

2.在guest中启动qemu-ga:
yum install qemu-guest-agent qemu-kvm-tools
qemu-ga -v -p /dev/virtio-ports/com.haoning.spice.0

3.在host上使用python连socket或者socat
socat unix-connect:/var/lib/libvirt/qemu/test.agent readline



具体的control.xml

<domain type='kvm' id='12'>
<name>control</name>
<uuid>d07d7290-9b1d-f33e-f54a-70a821252410</uuid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='rhel6.5.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/rhel-server-6.5-x86_64-dvd.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/home/control.img'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<alias name='usb0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='ide' index='0'>
<alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值