设为首页 收藏本站
查看: 1293|回复: 0

[经验分享] Xen FAQ zz

[复制链接]

尚未签到

发表于 2015-4-13 11:18:44 | 显示全部楼层 |阅读模式
Table of Contents

1. General FAQs2. Further HOWTOs



1. General FAQs
  Common Xen problems.

1.1. How to limit dom0 cpu number?1.2. How to prevent xen from rebooting when panic?1.3. How to escape from an vm console?1.4. What is the domain builder in the guest configure file?1.5. How to access virtual console tty0 in vncviewer?1.6. How many VIFs can I use in HVM guest?1.7. How many VBDs can I use in HVM guest?
  1.1.
  How to limit dom0 cpu number?
  There are three methods to get that:


  •   Edit /etc/xen/xend-config.sxp:
    # In SMP system, dom0 will use dom0-cpus # of CPUS # If dom0-cpus = 0, dom0 will take all cpus available (dom0-cpus 1)
  •   Add "dom0_max_vcpus=1" to xen hypervisor kernel command line.
  •   Add "maxcpus=1" to Dom0 kernel command line.
  1.2.
  How to prevent xen from rebooting when panic?
  There are two places to consider:


  •   For xen hypervisor: appended "noreboot" to xen's command line.
  •   For linux dom0: append "panic=0" to linux's comand line, or:
    # echo "0" > /proc/sys/kernel/panic
  1.3.
  How to escape from an vm console?
  Use "Ctrl+5" or "Ctrl+]" to get out of the vm console.
  1.4.
  What is the domain builder in the guest configure file?
  Currently, only two domain builders come with xen: linux and hvm. Linux is ELF format kernels and support loadable modules; hvm is for unmodified OS. Adding new builder for a.out format kernel image (Plan 9 and Minix) is on the way.
  "builder" is associated with "ostype" field in the XenStore.
  1.5.
  How to access virtual console tty0 in vncviewer?
  For RealVNC vncviewer client, press F8 popup the configure memu. Select "Alt" and "Ctrl". Then press "F1" to get to tty1 console.
  1.6.
  How many VIFs can I use in HVM guest?
  HVM guest can support at most 8 emulated VIFs. This limit has been hard coded in qemu code tools/ioemu/vl.h:
#define MAX_NICS 8  If using pv drivers in hvm guest, there's no limit (the same with pv guest).
  There is a bug before xen-3.2 limiting for vif numbers of HVM guest. See: http://lists.xensource.com/archives/html/xen-devel/2007-05/msg01047.html
  For xen before 3.2, as a workaround, you can adding more than 8 vifs by specify the vif type:
vif = [ 'type=netfront', 'type=netfront', 'type=netfront', 'type=netfront', 'type=netfront', 'type=netfront', 'type=netfront', 'type=netfront', 'type=netfront', ]
  1.7.
  How many VBDs can I use in HVM guest?
  HVM guest can support at most 4 + 7 qemu-dm emulated VBDs. This limit has been hard coded in qemu code tools/ioemu/vl.h:
#define MAX_DISKS 4 #define MAX_SCSI_DISKS 7  If using pv drivers in hvm guest, there's no limit (the same with pv guest).




2. Further HOWTOs

2.1. How to setup Kdump for Xen?2.2. How to enable automatic core dumps of xen guests?2.3. How to setup gdb for xen guest debugging2.4. How to set the virtual guest clock?2.5. How to connect to serial console of HVM guest?2.6. How to access VM graphical console by VNC?2.7. How to allow root login on xen console for PV guest?2.8. How to enable VFB support in Xen?  Further Xen HOWTOs.




2.1. How to setup Kdump for Xen?
  Following these steps to setup Kdump for xen debugging in RHEL5.


  •   Append following parameters to xen boot command line:
    crashkernel=128M@32M
  •   Comment the following lines in /etc/init.d/kdump:
    #       MEM_RESERVED=`echo $KDUMP_COMMANDLINE | grep "crashkernel=[0-9]\+[MmKkGg]@[0-9]\+[MmGgKk]"` #       if [ -z "$MEM_RESERVED" ] #       then #               $LOGGER "No crashkernel parameter specified for running kernel" #               return 1 #       fi
  •   Change KDUMP_KERNELVER in /etc/sysconfig/kdump:
    KDUMP_KERNELVER="2.6.18-8.0.0.4.1.el5"
  •   Reboot.
  •   Run:
    # chkconfig --level 2345 kdump on # service kdump start
  •   Testing:
    # echo "c" >/proc/sysrq-trigger
  •   Reboot.

  Reference

  •   The Xen Port of Kexec/Kdump - A short introduction and status report.
  •   XenKdumpAnalysis - How to get xen whole-machine dump image and analyse it.




2.2. How to enable automatic core dumps of xen guests?
  Xendump is a facility for capturing vmcore dumps from Xen guests. It is built-in to the Xen Hypervisor. To configure Xendump follow the steps described below:


  •   Edit /etc/xen/xend-config.sxp and change the following line:
    #(enable-dump no)  to:
    (enable-dump yes)
  •   Restart the xen daemon:
    # service xend restart
  •   Testing.

    •   Change the vm config file to:
      on_crash = 'restart'
    •   Start the vm with:
      # xm create vm.cfg
    •   Do the following command within a para-virtualized (PV) Xen guest:
      # sysctl -w kernel.panic=1 # sysctl -w kernel.panic_on_oops=1 # echo "c" >/proc/sysrq-trigger


Note
  Right now, Xendump can be configured to capture vmcore dumps of para-virtualized (PV) Xen guests automatically upon a crash. However, vmcore dumps from fully-virtualized (FV) Xen guests can only be taken manually by running the xm dump-core command.

  Reference

  •   How do I configure Xendump on Red Hat Enterprise Linux 5?




2.3. How to setup gdb for xen guest debugging
  Following these steps to setup gdbserver for xen.


  •   Build the GDB server:
    $ cd tools/debugger/gdb/ $ ./gdbbuild
  •   Copy ./gdb-6.2.1-linux-i386-xen/gdb/gdbserver/gdbserver-xen to your test machine (dom0).
  •   On your test machine, run:
    gdbserver-xen 127.0.0.1:9999 --attach $domid
  •   In another terminal of your test machine, run:
    gdb /path/to/vmlinux-syms-2.6.xx-xenU  From within the gdb client session:
    (gdb) directory /path/to/linux-2.6.xx-xenU
  • (gdb) target remote 127.0.0.1:9999 (gdb) bt (gdb) disass

  Reference

  •   GDB Documentation.




2.4. How to set the virtual guest clock?
  By default, the clocks in a Linux VM are synchronized to the clock running on the control domain, and cannot be independently changed (Any attempts to set or modify the time in a guest will fail). This mode is a convenient default, since only the control domain needs to be running the NTP service to keep accurate time across all VMs.
  Paravirtualized guests may also perform their own system clock management:


  •   Add the following lines to /etc/sysctl.conf, and reboot the system:
    # Set independent wall clock time xen.independent_wallclock = 1
  •   You can temporarily override the setting for the current session in the proc filesystem. For example, as root run the following command on the guest:
    # echo 1 > /proc/sys/xen/independent_wallclock
  •   Pass "independent_wallclock=1" as a boot parameter to the VM.

Note
  This setting does not apply to hardware virtualized guests.




2.5. How to connect to serial console of HVM guest?
  It is easy to connect to the serial console of HVM guest. You should:


  •   Add "serial = 'pty'" to vm configure file vm.cfg.
  •   Add following lines to /boot/grub/grub.conf of the vm:
    serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console  And add kernel parameter: "console=tty0 console=ttyS0,115200n8". This tells linux to print logs on both tty0 and ttyS0. The result like this:
    kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ console=tty0 console=ttyS0,115200n8
  •   Add "ttyS0" to /etc/securetty of the vm.
  •   Add the following line to /etc/inittab of the vm:
    co:2345:respawn:/sbin/agetty ttyS0 115200 vt100-nav
  •   then execute the following command to start the domain and you'll get the serial console output:
    # xm create -c vm.cfg




2.6. How to access VM graphical console by VNC?
  To run vnciewer on Dom0, log in to Dom0 with:
$ ssh -X hostname  If you add:
vncconsole=1  to the a hvm guest config file, a vncviewer session will startup when you create that domain.
  If you want to set up VNC access to the host computer (Dom0) for any remote computer, edit the /etc/xen/xend-config.sxp file:
vnclisten=0.0.0.0  The same option can be applied to VM private configure file to override xend global settings.
  Setting vnclisten to 0.0.0.0 sets the VNCViewer to listen on any port, and redirects the vncframebuffer to any host. This may compromise security on the host machine.
  VNC access to Dom0 can be restricted to a particular host by setting vnclisten to the ip address of the host in the /etc/xen/xend-config.sxp file.




2.7. How to allow root login on xen console for PV guest?
  In order to allow root to login on xen console (for para-virtualized machine), you should:


  •   Add "xvc0" to /etc/securetty of the vm.
  •   Add the following line to /etc/inittab of the vm:
    co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav




2.8. How to enable VFB support in Xen?
  For PVM, the configure options look like:
vfb = ["type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=passwd"]  Start the vm, then get:
/usr/lib64/xen/bin/xen-vncfb --unused --listen 0.0.0.0 --domid 13 --title xen_el5_x86_64_para  You can kill this process and rerun /usr/lib64/xen/bin/xen-vncfb.
  For HVM, the configure options look like::
vnc=1 vncunused=1 vnclisten="0.0.0.0" vncpasswd="passwd" vncconsole=1  Start the vm, then get:
/usr/lib64/xen/bin/qemu-dm -d 9 -vcpus 1 -boot c -serial pty -acpi -domain-name xen_el5_x86_64_hvm -net nic,vlan=1,macaddr=00:16:3e:5a:af:2a,model=rtl8139 -net tap,vlan=1,bridge=xenbr0 -vnc 0.0.0.0:0 -vncunused -vncviewer  You cannot kill this process. Otherwise, the vm will be destroyed.
  原文:http://zhigang.org/files/docbook/xen-faq.html#setup_gdb

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-56618-1-1.html 上篇帖子: Linux应用环境实战22:虚拟机体验之Xen篇——令人脑洞大开的奇异架构 下篇帖子: Xen Cloud Platform 系列:NFS 存储库(四)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表