通过可以直接获取虚拟机的控制台日志,调用novaclient可以直接
$ nova console-log $uuid
通常从console-log里可以看到一些虚拟机的异常问题,除此之外可以直接将虚拟机内部的一些信息重定向到console中,然后通过nova结果在console-log里可以获取,如
虚拟机内部interfaces文件
~# cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 allow-hotplug eth0 iface eth0 inet dhcp auto eth1 allow-hotplug eth1 iface eth1 inet dhcp auto eth2 allow-hotplug eth2 iface eth2 inet dhcp
假如想在虚拟机外部获取这些信息,可以进行如下操作
~# cat /etc/network/interfaces >> /dev/console
然后通过nova接口得到console-log信息,末尾几行即为上面重定向的信息
$ nova console-log 56e31ae6-667b-4142-8fec-0a549c57d9ae | less # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 allow-hotplug eth0 iface eth0 inet dhcp auto eth1 allow-hotplug eth1 iface eth1 inet dhcp auto eth2 allow-hotplug eth2 iface eth2 inet dhcp (END)