나는 그것을 사용하고 있다유칼립투스Ubuntu 10.04에서 프라이빗 클라우드를 설정합니다. 때로는 SSH를 통해 VM 인스턴스에 액세스할 수 없지만 VM 인스턴스의 콘솔에 직접 연결할 수 있기를 원합니다. 그러나 이것은 기본적으로 virsh를 통해 작동하지 않는 것 같습니다.
$ sudo virsh -c qemu:///system console i-486B085E
No console available for domain
예를 들어 Eucalyptus가 libvirt에 전달된 XML 파일을 생성하는 방식을 변경하여 이를 달성할 수 있는 방법이 있습니까?
이것은 Eucalyptus에서 생성된 libvirt.xml 파일입니다.
$ cat /var/lib/eucalyptus/instances/admin/i-486B085E/libvirt.xml
<domain type='kvm'>
<name>i-486B085E</name>
<os>
<type>hvm</type>
<kernel>/var/lib/eucalyptus/instances//admin/i-486B085E/kernel</kernel>
<initrd>/var/lib/eucalyptus/instances//admin/i-486B085E/ramdisk</initrd>
<cmdline>root=/dev/sda1 console=ttyS0</cmdline>
</os>
<features>
<acpi/>
</features>
<memory>262144</memory>
<vcpu>1</vcpu>
<devices>
<disk type='file'>
<source file='/var/lib/eucalyptus/instances//admin/i-486B085E/disk'/>
<target dev='sda'/>
</disk>
<interface type='bridge'>
<source bridge='eucabr10'/>
<mac address='d0:0d:48:6B:08:5E'/>
<model type='e1000'/>
</interface>
<serial type="file">
<source path='/var/lib/eucalyptus/instances//admin/i-486B085E/console.log'/>
<target port='1'/>
</serial>
</devices>
</domain>
이것은 virsh dumpxml의 출력입니다:
$ sudo virsh dumpxml i-486B085E
<domain type='kvm' id='3'>
<name>i-486B085E</name>
<uuid>3b762376-4de1-f6ac-7327-9df520fa4862</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc-0.12'>hvm</type>
<kernel>/var/lib/eucalyptus/instances//admin/i-486B085E/kernel</kernel>
<initrd>/var/lib/eucalyptus/instances//admin/i-486B085E/ramdisk</initrd>
<cmdline>root=/dev/sda1 console=ttyS0</cmdline>
<boot dev='hd'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<source file='/var/lib/eucalyptus/instances//admin/i-486B085E/disk'/>
<target dev='sda' bus='scsi'/>
</disk>
<interface type='bridge'>
<mac address='d0:0d:48:6b:08:5e'/>
<source bridge='eucabr10'/>
<target dev='vnet0'/>
<model type='e1000'/>
</interface>
<serial type='file'>
<source path='/var/lib/eucalyptus/instances//admin/i-486B085E/console.log'/>
<target port='0'/>
</serial>
<console type='file'>
<source path='/var/lib/eucalyptus/instances//admin/i-486B085E/console.log'/>
<target port='0'/>
</console>
</devices>
<seclabel type='dynamic' model='apparmor'>
<label>libvirt-3b762376-4de1-f6ac-7327-9df520fa4862</label>
<imagelabel>libvirt-3b762376-4de1-f6ac-7327-9df520fa4862</imagelabel>
</seclabel>
</domain>
다음은 최종 호출된 전체 KVM 명령줄입니다.
/usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 256 -smp 1 -name i-486B085E -uuid 3b762376-4de1-f6ac-7327-9df520fa4862 -nographic -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/i-486B085E.monitor,server,nowait -monitor chardev:monitor -boot c -kernel /var/lib/eucalyptus/instances//admin/i-486B085E/kernel -initrd /var/lib/eucalyptus/instances//admin/i-486B085E/ramdisk -append root=/dev/sda1 console=ttyS0 -drive file=/var/lib/eucalyptus/instances//admin/i-486B085E/disk,if=scsi,index=0,boot=on -net nic,macaddr=d0:0d:48:6b:08:5e,vlan=0,model=e1000,name=e1000.0 -net tap,fd=55,vlan=0,name=tap.0 -chardev file,id=serial0,path=/var/lib/eucalyptus/instances//admin/i-486B085E/console.log -serial chardev:serial0 -parallel none -usb
참고: 다음에서 교차 게시됨서버 장애이슈 마이그레이션이 아직 지원되지 않기 때문입니다.
답변1
알아냈습니다... /usr/share/eucalyptus/gen_kvm_libvirt_xml 파일을 편집해야 합니다. 차이점은 다음과 같습니다.
--- /usr/share/eucalyptus/gen_kvm_libvirt_xml.bak 2010-09-28 14:54:20.259266161 -0400
+++ /usr/share/eucalyptus/gen_kvm_libvirt_xml 2010-09-28 15:01:25.269265897 -0400
@@ -109,9 +109,9 @@
<mac address='PRIVMACADDR'/>
<model type='e1000'/>
</interface>
- <serial type="file">
- <source path='BASEPATH/console.log'/>
- <target port='1'/>
+ <serial type='pty'>
+ <source path='/dev/pts/2'/>
+ <target port='0'/>
</serial>
</devices>
</domain>
(서버 오류에도 답변됨)