首页 技术 正文
技术 2022年11月16日
0 收藏 531 点赞 2,910 浏览 2506 个字

Openstack中有时候虚拟机启动不正常,这时可以通过查看虚拟机console log能得到一些有用的信息。

有这些方法可以查看或获取虚拟机console log:

1)openstack控制台图形界面(horizon):

进入虚拟机(Instance)列表界面,选中相应虚拟机,点击Log页面即可;或点击右侧的“View Full Log”查看完整的log。

Openstack中查看虚拟机console log的几种方法

2)在虚拟机所在的compute节点上找到log文件:

通过virsh dumpxml指令,找到如下关键段:

<console type=’file’>
      <source path=’/var/lib/nova/instances/842d5f63-6c0f-4582-8237-076ccc29e759/console.log’/>
      <target type=’serial’ port=’0’/>
      <alias name=’serial0’/>
</console>

再到相应的目录下即可:

root@compute-1:~# cd /var/lib/nova/instances/842d5f63-6c0f-4582-8237-076ccc29e759
root@compute-1:/var/lib/nova/instances/842d5f63-6c0f-4582-8237-076ccc29e759# ls
console.log  disk  disk.config  disk.info  libvirt.xml

3)使用指令nova console-log,这是最便捷的方法:

如下所示,能看到通过DHCP成功获取IP的信息:

root@controller:~# nova console-log test_vm68|more

[    0.000000] Initializing cgroup subsys cpuset

[    0.000000] Initializing cgroup subsys cpu

[    0.000000] Initializing cgroup subsys cpuacct

[    0.000000] Linux version 4.4.0-28-generic (buildd@lcy01-13) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) ) #47-Ubuntu S

MP Fri Jun 24 10:09:13 UTC 2016 (Ubuntu 4.4.0-28.47-generic 4.4.13)

[    0.000000] Command line: LABEL=cirros-rootfs ro console=tty1 console=ttyS0

[    0.000000] KERNEL supported cpus:

[    0.000000]   Intel GenuineIntel

[    0.000000]   AMD AuthenticAMD

[    0.000000]   Centaur CentaurHauls

[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256

[    0.000000] x86/fpu: xstate_offset[3]:  960, xstate_sizes[3]:   64

[    0.000000] x86/fpu: xstate_offset[4]: 1024, xstate_sizes[4]:   64

[    0.000000] x86/fpu: xstate_offset[5]: 1088, xstate_sizes[5]:   64

[    0.000000] x86/fpu: xstate_offset[6]: 1152, xstate_sizes[6]:  512

[    0.000000] x86/fpu: xstate_offset[7]: 1664, xstate_sizes[7]: 1024

Starting network…

udhcpc (v1.23.2) started

Sending discover…

Sending select for 1.3.11.10…

Lease of 1.3.11.10 obtained, lease time 86400

顺便提供通过vnc console用http访问虚拟机的方法:

usage: nova get-vnc-console <server> <console-type>

Get a vnc console to a server.

Positional arguments:  

<server>        Name or ID of server.  

<console-type>  Type of vnc console (“novnc” or “xvpvnc”).

1)获取vnc console口的URL:

root@controller:~# nova get-vnc-console test01 novnc
+——-+—————————————————————————————-+
| Type  | Url                                                                                    |
+——-+—————————————————————————————-+
| novnc | https://72.60.60.60:6080/vnc_auto.html?token=9253ac64-bfd1-4ed9-b7b1-35bfd371bd7a |
+——-+—————————————————————————————-+

2)在浏览器中输入上述URL即可。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,075
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,551
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,399
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,811
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,892