Solaris Xen Drop 66 – Setup Solaris DomU

本文介绍如何通过创建Python配置文件来安装Solaris DomU,并详细解释了配置参数的意义。此外,还提供了运行已安装的Solaris DomU的方法及注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Installing a Solaris DomU

  1. Set up your machine as a Solaris Dom0 as described in How to Set Up Solaris Dom0.

  2. Create a Python configuration file for the DomU you want to install.

    One example:

    name = "solaris-install" 
    memory = "1024"
    disk = [ 'file:/ws/public/isos/65-0604-nd.iso,6:cdrom,r', 'file:/export/root/solaris_domu/disk.img,0,w' ]
    vif = [ 'mac=00:0e:0c:3e:18:cd' ]
    on_shutdown = 'destroy'
    on_reboot = 'destroy'
    on_crash = 'destroy'
  3. The parameters above are defined as:

    • name: Name of your DomU.
      Since you are just using this for the install, you can use something like solaris-install

    • memory: RAM size for the DomU, in megabytes.
      1024 (1 GB) works well.

    • disk: A set of tuples describing disk files or devices to be created in the DomU.
      These tuples are defined as follows:

      • 'type:pathname,target number[:qualifier],rw mode'

      With the fields:

      • type: The type of device to be exported to the DomU:

        Specifier

        Meaning

        file

        File, such as a file to be used as a disk image or an ISO file

        phy

        Physical device, such as a ZFS pool or a raw disk device

      • pathname: Pathname specified by the specifier type, above.

      • target number: Target number of the specified device in the DomU.
        The device will appear to the DomU as /dev/dsk/c0dns0

      • qualifier: An optional qualifier that clarifies the device type to xenstore and xdf.
        The only qualifier typically used is :cdrom to specify the device as an optical drive type to the DomU (so ":cdrom" is used to denote any ISO file.)

      • rw mode: Whether the device should be created read-only or read/write in the DomU.

        Specifier

        Meaning

        r

        Create device read-only

        w

        Create device read/write

      Some sample disk identifiers:

      • 'file:/ws/public/isos/65-0604-nd.iso,6:cdrom,r'
        This will make the ISO file /ws/public/isos/65-0604-nd.iso available to the DomU as the read-only device /dev/dsk/c0t6d0.

        This is the default installation optical disk for a standard Solaris install.

      • 'file:/export/root/solaris_domu/disk.img,0,w'
        This will make the sparse file /export/root/solaris_domu/disk.img available to the DomU as the read/write device /dev/dsk/c0t0d0.

        For example, to create an 8 GB sparse file for use as a root disk 8 GB in size within the DomU, you would use the following command:

        • dd if=/dev/zero of=/export/root/solaris_domu/disk.img bs=1024k seek=8k count=1

        After creation, you should see a sparse file of the proper size in your directory, e.g.:

        • # ls -l /export/root/solaris_domu/disk.img 
          -rw------- 1 root root 8590983168 Jun 7 16:37 /export/root/solaris_domu/disk.img
      • 'phy:/dev/zvol/dsk/pool/solaris-root,0,w'
        This would make the ZFS pool /dev/zvol/dsk/pool/solaris-root available to the DomU as the read/write device /dev/dsk/c0t0d0.

      Additional notes on the disk parameter:

      • There is no need to use lofiadm(1M) on the ISO file or to mount it; that will be done automatically by xen.

      • The specification for the ISO file must be the first tuple provided in the disk list.

      • The root disk of the DomU must be specified with a target of 0, meaning the root device of any Solaris DomU will always be /dev/dsk/c0t0d0.

      • If specifying a file rather than a device for use as the DomU root disk, the file must already exist. Sample syntax for this is given in the disk.img example above.

      • Each of the disks specified above is subject to regular partitioning, such that the disks made available to the DomU can be accessed via partitions from within the DomU.

        For example, the ZFS pool provided above can be partitioned within the DomU as if it is a regular disk; the DomU simply sees the device as a source of raw bytes, just as a normal ZFS pool would be.

      • Multiple disk tuples can be specified on the same line, separated by commas.

    • vif: Virtual network interface MAC address.
      This should be the MAC address of the dom0's network interface that you wish the DomU to use to send and receive internet traffic.

      If it is not specified, the dom0's default network interface will be used.

    • on_shutdown: Action to be taken on a DomU shutdown, as defined by the xm command.
      For an install kernel, we just want to destroy the domain on a shutdown.

    • on_reboot: Action to be taken on a DomU reboot, as defined by the xm command.
      For an install kernel, we just want to destroy the domain on a reboot, as a reboot would just restart from the install ISO.

    • on_crash: Action to be taken on a DomU crash, as defined by the xm command.
      For an install kernel, we just want to destroy the domain on a crash.

  4. Perform the installation of the DomU using the xm create command.

    For example, if you created the Python configuration file above and named it solaris_install.py, you would execute the command:

    • xm create -c solaris_install.py

    When run this command will create the DomU and then boot into a normal text console Solaris install, just as if you had booted from a Solaris installation disc and had specified a text console installation.

Running a Solaris DomU

Once the installation steps above have completed succesfully and the system involved has "rebooted," you must create a new Python configuration file to run the DomU you've installed.

After the installation has completed, but before running your new DomU, you should make sure the installation domain has been destroyed by checking the output of the xm list command and searching for the existence of your installation domain (e.g., check the output to make sure that the solaris-install domain no longer exists.)

If the domain does still exist, you should manually do:

  • xm destroy solaris-install

before proceeeding.

Here's a sample configuration file for running a DomU:

name = "nevada" 
vcpus = 1
memory = "1024"
root = "/dev/dsk/c0d0s0"
disk = ['file:/export/root/solaris_domu/disk.img,0,w']
vif = ['']
on_shutdown = 'destroy'
on_reboot = 'restart'
on_crash = 'destroy'

The parameters above have the same meanings as they did in the installation configuration file. (Note that the action specified on a reboot is now a restart of the DomU.)

As this file will be used to run your DomU, the "name" parameter should now be something unique and descriptive, not only so you can determine the domain's status from the output of xm list, but also so that you can note the status of your domain should you decide to create and run multiple DomUs.

The file above also introduces a new parameter:

  • vcpus: Number of virtual CPUs in the DomU.
    If this parameter is not specified, it defaults to 1.

Once the configuration file has been created, you can start and connect to the console of your DomU by running the xm create command.

For example, if you created the Python configuration file above and named it solaris.py, you would execute the command:

  • xm create -c solaris.py

More information

  • What's a Dom0?

  • What's a DomU?

  • More information on the Python configuration file can be found in the xmdomain.cfg(5) man page.

    A Linux version can be viewed here; note that as this version refers to Linux DomUs, some options (notably the description for "disk") may differ in syntax from that given above.

Note:

1. After installation, try to start the DomU by

bash-3.00# xm create -c xen_solaris.py
Using config file "./xen_solaris.py".
Started domain solaris-xenU
/usr/lib/xen/bin/xenconsole: Could not open tty `/dev/pts/6': No such file or directory

Try to start again:

bash-3.00# xm create -c xen_solaris.py
Using config file "./xen_solaris.py".
Started domain solaris-xenU
SunOS Release 5.11 Version xen-nv66-2007-06-24 64-bit
Copyright 1983-2007 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.

panic[cpu0]/thread=fffffffffbc3f1a0: cannot mount root path /xpvd/xdf@208:a

fffffffffbc72230 genunix:rootconf+11f ()
fffffffffbc72280 genunix:vfs_mountroot+65 ()
fffffffffbc722b0 genunix:main+ce ()
fffffffffbc722c0 unix:_locore_start+80 ()

skipping system dump - no dump device configured
rebooting...

Starting the same py file, gives two different results.

This kind of errors always happen, when the configuration file is not well written.  By checking my configuration file, I found the root statement is not correct:

root = "/dev/dsk/c0d0t0s0",

correct it to

root = "/dev/dsk/c0d0s0"

The DomU runs well.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值