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

[经验分享] How to auto start XEN VMs after reboot of DOM 0

[复制链接]

尚未签到

发表于 2015-4-13 12:25:17 | 显示全部楼层 |阅读模式
This document (3466408) is provided subject to the disclaimer at the end of this document.
Environment
  Novell SUSE Linux Enterprise Server 10 Service Pack 1
Novell SUSE Linux Enterprise Server 10 Service Pack 2
Novell SUSE Linux Enterprise Server 10 Service Pack 1 XEN
Novell SUSE Linux Enterprise Server 10 Service Pack 2 XEN
Situation
  After rebooting the SLES 10 XEN main OS, how can DomU virtual machines be started automatically?

Resolution
  general information:

  • Any DomU that has been "saved" using the xm save command will automatically be started at boot time when the xendomains service is on and requires no extra configuration.
  • The method described in this TID are not recommended DomU's that is started as part of a high availability cluster or are managed by other programs such as ZenWorks Orchistrator
  • Any DomU that was running before a graceful reboot, will start automatically and requires no extra configuration.
  • Method 1 is for unmanaged domains or domains that use legacy /etc/xen/vm files
  • Method 2 is the preferred method and is the most robust
  • Method 3 uses the legacy /etc/xen/vm files and is not recommended unless ALL configuration changes are made using the legacy fil
  kernel setupIf you are booting into the Xen kernel by default, you may skip this section.

  • Make sure that the appropriate kernel is running.

    • uname -r(The correct kernel should look something similar to 2.6.16-0.7- xen)
    • If the version shown does not include"xen" go to step 2; otherwise go to step 3

  • Edit the /boot/grub/menu.lst to boot off of the correct kernel (the XEN kernel)

    • Change the "default #" line (where # represents a number starting with zero or higher) to point to the correct stanza representing the xen kernel
    • EXAMPLE:
      # Modified by YaST2. Last modification on Thu May 3 15:51:09 UTC 2007
      default 1
      timeout 8
      gfxmenu (hd0,0)/message

      title SUSE Linux Enterprise Server 10 SP1
      root (hd0,0)
      kernel /vmlinuz-2.6.16.46-0.7-smp root=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD160JJS08HJ1OL323401-part2 vga=0x31a resume=/dev/sda3 splash=silent showopts
      initrd /initrd-2.6.16.46-0.7-smp ###Don't change this comment - YaST2 identifier: Original name: xen###

      title XEN
      root (hd0,0)
      kernel /xen.gz
      module /vmlinuz-2.6.16.46-0.7-xen root=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD160JJS08HJ1OL323401-part2 vga=0x31a resume=/dev/sda3 splash=silent showopts
      module /initrd-2.6.16.46-0.7-xen

  
method 1: auto start DomU using legacy configuration files

The xendomains init script will over write any configuration changes made by the"xm”, YaST or "virt-manager”. This method is not the preferred method, as it creates an unmanaged domain (that is, the domain is not managed with xend). The init script uses the xm create command to create the domain as a brand-new configuration. Method 2 and Method create a managed domain, which is preferred.
initial configuration


  • chkconfig --list | grep -i xen (xend and xendomains should be on)
  • If the services are not turned to "on" for runlevels 3 and 5 then type:

    • chkconfig xend on; chkconfig xendomains on

  • Make sure the service is currenly running by typing:

    • rcxend status; rcxendomains status

  • If the services are not running, they can be turned on by the following:
  link legacy configuration file

  • Change to the /etc/xen/vm directory

    • cd /etc/xen/vm

  • This directory will contain multiple files. For instance, if two virtual machines were installed with the names of vm1 and vm2, then the following files would be in the directory:

    • v m1, vm1.xml, vm2, vm2.xml

  • For the virtual machines that are to be auto-started after system reboot of Dom 0 (the main OS, or the host OS), create a soft link to the non-xml files to the /etc/xen/auto directory. Under SLES 10 SP2 the /etc/xen/auto directory does not exist. In order to use this method, you will need to create the directory (mkdir -p /etc/xen/auto)

    • cd /etc/xen/auto/
    • l n -s /etc/xen/vm/vm1 vm1

  • In the case above (because only vm1 was copied, and not vm2), only vm1 will auto start after a system reboot of Dom 0.
  method 2: use xend to auto-start DomU's using the information taken from xend (managed domains)
This method uses the "xm” commands and is the only safe method to auto-start a DomU when the "xm”, YaST or"virt-manager” has been used to alter the guest configuration after the initial installation of the virtual machine. Since the the management database will be used to start the DomU, the "xendomains" init script can be safely turned off.

  Replace SLES10 in the steps with the name of the virtual machine that you are configuring to start automatically.


  • Export the virtual machines configruation
    xm list -l SLES10 > sles10
  • Backup the file sles10, you may need it in the event that something is corrupted.
  • Open the file sles10 for editing
  •   Locate the line reading

    (on_xend_start ignore)
  •   Change it to

    (on_xend_start start)
  •   Locate the line reading

    (on_xend_stop ignore)
  •   Change it to

    (on_xend_stop shutdown)
  • Save the file

  • Reimport the new configuration
    xm new -F sles10
  
method 3: use legacy configuation file and import it into the xen management database

This method involves changing the installation file used to create the DomU. This method is NOT recommended when "xm”, "YaST” or "virt-manager” has not been used to modify the DomU. This method is only recommended when DomU configuration changes have only been made through the installation file.Since the the management database will be used to start the DomU, the "xendomains" init script can be safely turned off.


  • Shut down the DomU
  • Locate the installation file, usually found in /etc/xen/vm
  • Open the installation file for editing

  • Add the following lines:
    on_xend_start="start"
    on_xend_stop="shutdown"

  • Save and close the file

  • Import the new configuration
    xm new -f
Additional Information
  
Key words for searchability:
xen
auto
start
autostart
reboot

Document
Document ID:3466408
Creation Date:12-31-2007
Modified Date:12-24-2008
Novell Product:SUSE Linux Enterprise Server
Disclaimer
  
The Origin of this information may be internal or external to Novell. Novell makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Novell makes no explicit or implied claims to the validity of this information.
Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark information.
http://www.novell.com/support/viewContent.do?externalId=3466408&sliceId=1

运维网声明 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-56658-1-1.html 上篇帖子: xen,xen关闭 下篇帖子: xen虚机的启动过程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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