博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Openstack中查看虚拟机console log的几种方法
阅读量:4587 次
发布时间:2019-06-09

本文共 2599 字,大约阅读时间需要 8 分钟。

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

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

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

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

转载于:https://www.cnblogs.com/bjtime/p/9571984.html

你可能感兴趣的文章
PHP计算中文字符串长度 、截取相应中文字符串
查看>>
程序的模块化的一些见解6-读牛人代码之感
查看>>
ZigZag Conversion
查看>>
关注关注工作行列
查看>>
GDB十分钟教程
查看>>
MyEclipse导入jquery-1.8.0.min.js等文件报错的解决方案
查看>>
<pythonchallenge.com>----Lv1
查看>>
Android App测试要点
查看>>
【新手入门篇】新浪微博应用开发之Java入门篇
查看>>
2-10
查看>>
CentOS 7 安装 Docker
查看>>
三、MapReduce学习
查看>>
MySQL的表分区详解 - 查看分区数据量,查看全库数据量----转http://blog.csdn.net/xj626852095/article/details/51245844...
查看>>
课程作业02将所有动手动脑的问题以及课后实验问题
查看>>
oracle_(第二课)监听器配置
查看>>
使用xdebug调试程序后程序很慢的原因
查看>>
windows下配置Tomcat7.0.22
查看>>
Perl中命令行参数以及打开管道文件
查看>>
习题 11 提问
查看>>
2018-07-05-Python全栈开发day25-python中的继承
查看>>