本文共 2944 字,大约阅读时间需要 9 分钟。
所有managed domain在创建的时候(xm new)会将其配置信息写入:
/var/lib/xend/domains/UUID/config.sxp
这样,在dom0重启的时候,xend会将/var/lib/xend/domains下的所有虚机自动创建出来。 该文件的示例如下:(domain
(domid 49) (vcpus_params ((cap 0) (weight 256))) (PV_args 3) (PV_bootloader /usr/bin/pygrub) (cpus (() () () () () () () ())) (VCPUs_live 1) (actions_after_crash restart) (uuid 6ad57b30-3eca-4043-9327-6a674ab3b079) (PV_ramdisk ) (name_label vm1) (VCPUs_at_startup 1) (HVM_boot_params ()) (platform ((device_model /usr/lib64/xen/bin/qemu-dm) (videoram 4) (localtime 1)) ) (PV_kernel ) (memory_static_min 0) (HVM_boot_policy ) (VCPUs_max 8) (memory_static_max 2147483648) (actions_after_shutdown destroy) (memory_dynamic_max 1073741824) (is_a_template False) (memory_dynamic_min 1073741824) (target 0) (PV_bootloader_args -q) (other_config ()) (auto_power_on False) (actions_after_reboot restart) (s3_integrity 1) (on_crash restart) (uuid 6ad57b30-3eca-4043-9327-6a674ab3b079) (bootloader_args -q) (vcpus 8) (name vm1) (on_poweroff destroy) (on_reboot restart) (cpus (() () () () () () () ())) (bootloader /usr/bin/pygrub) (maxmem 2048) (memory 1024) (shadow_memory 0) (vcpu_avail '1') (features ) (on_xend_start ignore) (on_xend_stop ignore) (start_time 1319736949.93) (image (linux (kernel ) (args 3) (videoram 4) (localtime 1) (device_model /usr/lib64/xen/bin/qemu-dm) (notes (FEATURES 'writable_page_tables|writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel' ) (VIRT_BASE 18446744071562067968) (GUEST_VERSION 2.6) (PADDR_OFFSET 0) (GUEST_OS linux) (HYPERCALL_PAGE 18446744071564185600) (LOADER generic) (SUSPEND_CANCEL 1) (ENTRY 18446744071564165120) (XEN_VERSION xen-3.0) ) ) ) (status 1) (state ------) (store_mfn 2263340) (console_mfn 2263339) (device (vif (bridge eth0) (mac 00:16:3e:01:6c:cb) (script /etc/xen/scripts/vif-bridge) (uuid 8c4ea842-8e20-ab38-531d-9e7c7cbac2b9) (backend 0) ) ) (device (vbd (protocol x86_64-abi) (uuid ebac4ba7-2fb4-77e9-d7cd-3b9ce19b1dd5) (bootable 1) (dev sda2:disk) (uname phy:virtualvg2/linux_56_AD00001_2011_10_28_01_34_58) (mode w) (backend 0) (bootable 1) (VDI ) ) ) (device (vbd (protocol x86_64-abi) (uuid 1387e92c-54ec-45f3-615d-085346f8aed2) (bootable 0) (dev sda1:disk) (uname phy:virtualvg2/linux_56_AD00001_2011_10_28_01_34_58_swap) (mode w) (backend 0) (bootable 0) (VDI ) ) ) (device (vkbd (backend 0))) (device (vfb (uuid ea025155-9cb1-25b0-e4e0-473fd0f16644) (vnclisten 0.0.0.0) (vnc 1) (vncdisplay 56) (xauthority /root/.Xauthority) ) ) )其中,与xend相关的配置为:默认都是ignore,这样当xend重启的时候,不影响虚机的运行状态
(on_xend_start ignore) (on_xend_stop ignore) 当然,可以配置虚机与xend同步起停: (on_xend_start start) (on_xend_stop shutdown) 所有unmanaged domain在创建的时候(xm create)不会将其配置文件写入上述目录的配置文件中,所有当dom0重启的时候,xend不会自动创建这些虚机。无论managed domain还是unmanaged domain,在启动的时候都会将其配置写入到xenstore中,在停止的时候从xenstore中删除虚机信息。即xenstore中存放的是所有运行状态(确切的说是除了halt之外)虚机的配置以及前后端设备信息。
本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2011/11/27/2265139.html,如需转载请自行联系原作者