XenServer 将 HVM 转换为半虚拟化

XenServer 将 HVM 转换为半虚拟化

最近,我承担了一项艰巨的任务:将启用 HVM 的虚拟机(在 Citrix XenServer 5.6.0 上运行)的设置转换为 PV(半虚拟化)容器。

该项目的限制因素如下:

  1. 迁移后,操作系统的功能必须相同。
  2. 对操作系统的最小修改(内核/驱动器映射除外)

我还被允许以任何我认为合适的方式更改引导加载程序(即 grub)。

但是,我已经尝试过了,首先我想向你展示我所采取的步骤。

目前这是 CentOS5.5 特有的:

脚步:

  1. yum 安装内核-xen

    此安装:2.6.18-194.32.1.el5xen

  2. 编辑:/boot/grub/menu.lst 更改了我的规格以匹配:

    title CentOS (2.6.18-194.32.1.el5xen)    
    root (hd0,0)
    kernel /vmlinuz-2.6.18-194.32.1.el5xen ro root=/dev/VolGroup00/LogVol00 console=xvc0
    initrd /initrd-2.6.18-194.32.1.el5xen.img
    

    然后我更改了我的 xenserver 参数以匹配:

    xe vm-param-set uuid=[vm uuid] PV-bootloader-args="--kernel /vmlinuz-2.6.18-194.32.1.el5xen --ramdisk /initrd-2.6.18-194.32.1.el5xen.img"
    xe vm-param-set uuid=[vm uuid] HVM-boot-policy=""
    xe vm-param-set uuid=[vm uuid] PV-bootloader=pygrub 
    xe vbd-param-set uuid==[Virtual Block Device/VBD uuid] bootable=true
    

需要注意的是,我正在运行 VolGroup LVM;)

无论如何,完成所有这些步骤后(并不多!)我启动了虚拟机并且它可以正常启动初始内核,但是出现了这个错误:

启动屏幕:

device-mapper: dm-raid45: initialized v0.2594l
Waiting for driver initialization.
Scanning and configuring dmraid supported devices
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
Activating logical volumes
  Volume group "VolGroup00" not found
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory

现在我的提示是它无法检测 / 因为当你从 HVM 模式更改为 PV 时它会做一些事情(不那么明显)

当您在 HVM 上创建 SR(存储)时,您会将其作为 /dev/hda 安装到客户操作系统。

但是在 PV 模式下,它显示为 /dev/xvda...

这可能是答案吗?如果是的话,我到底该如何实现它呢?

更新:
因此,我的探索又取得了一些进展,因为它现在可以检测到 LVM......

为此,我需要重新编译 xen-kernel initrd 映像。

命令:mkinitrd -v --builtin=xen_vbd --preload=xenblk initrd-2.6.18-194.32.1.el5xen.img 2.6.18-194.32.1.el5xen

现在当我启动时我得到了这个:

启动屏幕:

Loading dm-raid45.ko module
device-mapper: dm-raid45: initialized v0.2594l
Scanning and configuring dmraid supported devices
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
Activating logical volumes
  3 logical volume(s) in volume group "VolGroup00" now active
Creating root device.
Mounting root filesystem.
mount: error mounting /dev/root on /sysroot as ext3: Device or resource busy
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

答案1

尝试: xe vm-param-set uuid=[vm uuid] PV-args="root=/dev/VolGroup00/LogVol00"

相关内容