Thursday, November 01, 2007

CentOS 5 in openSolaris xVM

As you already know that I installed openSolaris build 75 recently and promised to blog more about the xVM. Good news, I managed to install CentOS 5 after a lot of attempts based on CDROM, Hard Disk, NFS, ...

I copied ISO images of CentOS5, openSUSE 10.3, and Solaris 10 U4 to the SunFire X4600. I tried to install a guest xvm on top of the openSolaris using DVD and ISO, but no luck in any of these. Same for NFS installation, the "virt-install" command just complained that it cannot find the NFS server. However, I was able to mount it manually.

Today, I tried the HTTP method and CentOS 5 worked but the others just failed. The CentOS 5 ISO was mounted using the LOFI ("lofiadm -a") followed by "mount -F hsfs". The mount point will be the "DocumentRoot" for the Apache web server. Below shows some of the details:

Make sure you boot up openSolaris xVM (this is not the default)

root@opensolaris# uname -a
SunOS opensolaris 5.11 snv_75 i86pc i386 i86xpv

root@opensolaris# svcs -a | grep xvm
online         Oct_30   svc:/system/xvm/store:default
online         Oct_30   svc:/system/xvm/xend:default
online         Oct_30   svc:/system/xvm/console:default
online         Oct_30   svc:/system/xvm/domains:default

root@opensolaris# ps -ef | grep xen
    root   336     1   0   Oct 30 ?           0:01 /usr/lib/xenstored --pid-file=/var/run/xenstore.pid
    root   418     1   0   Oct 30 ?           0:01 /usr/lib/xenconsoled start
    root   366     1   0   Oct 30 ?           0:30 python /usr/lib/xend start

For installation, you need "virt-install" (install guest operating system on xVM system) and "virsh" (management user interface for guest domains). You can either supply all the necessary arguments to virt-install. If insufficient details in creating the domain, it will prompt you for the details. By default, 1 CPU will be allocated to the guest domain. In this exercise, I forced it to use 4 'cos I have 16 CPUs in the server. You can always shutdown the domain and change the number of vcpu. In this domain, I allocated 4 CPUs, 4 GB memory and 10GB of disk space. The whole domain of 10GB will be housed in 1 file and you will see that this file has been used as lofi (loop back file system).

root@opensolaris# virt-install -vcpus=4
What is the name of your virtual machine? centos5
 How much RAM should be allocated (in megabytes)? 4096
 What would you like to use as the disk (path)? /data/xvm/centos5.xvm
 How large would you like the disk (/data/xvm/centos5.xvm) to be (in gigabytes)? 10
 Would you like to enable graphics support? (yes or no) no
 What is the install location? http://10.0.12.251/centos5/
....
....
[answer all the questions to setup the CentOS5]

root@opensolaris# xm list
Name                                      ID   Mem VCPUs      State   Time(s)
Domain-0                                   0 27759    16     r-----   7321.9
centos5                                    7  4096     4     -b----      7.3

root@opensolaris# xm list -l centos5
(domain
    (domid 7)
    (on_crash restart)
    (memory 4096)
    (uuid 3816e1f7-5e95-1841-0adc-5fc4a5360aa5)
    (bootloader_args )
    (name centos5)
    (maxmem 4096)
    (on_reboot restart)
    (on_poweroff destroy)
    (localtime 0)
    (vcpus 4)
    (bootloader /usr/lib/xen/bin/pygrub)
    (shadow_memory 0)
    (cpu_weight 256)
    (cpu_cap 0)
    (features )
    (on_xend_start ignore)
    (on_xend_stop shutdown)
    (start_time 1193889884.81)
    (cpu_time 7.283464146)
    (online_vcpus 4)
    (image (linux (kernel )))
    (status 2)
    (memory_dynamic_min 4096)
    (memory_dynamic_max 4096)
    (state -b----)
    (store_mfn 7498403)
    (console_mfn 7498402)
    (device
        (vif
            (bridge )
            (mac 00:16:3e:14:84:e5)
            (uuid b7628569-99c7-6b55-d120-13c4e0b5630d)
        )
    )
    (device
        (vbd
            (uname file:/data/xvm/centos5.xvm)
            (driver paravirtualised)
            (mode w)
            (dev xvda)
            (uuid 6666b6c5-6667-a8cf-17fd-52a7374881c7)
        )
    )
)

root@opensolaris# ls -l /data/xvm/centos5.xvm
-rwxr-xr-x   1 root     root     10737418240 Nov  1 13:26 /data/xvm/centos5.xvm

root@opensolaris# lofiadm
Block Device             File
/dev/lofi/1              /data/xvm/centos5.xvm

Now the guest domain is ready, let us login via the "xm" command and explore whether the new guest domain has been configured properly. Ctrl-] is the keyboard sequence to break out from the xvm.

root@opensolaris# xm console centos5
Bootdata ok (command line is ro root=/dev/VolGroup00/LogVol00 console=xvc0)
Linux version 2.6.18-8.el5xen (mockbuild@builder6.centos.org) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Thu Mar 15 19:56:43 EDT 2007
BIOS-provided physical RAM map:
 Xen: 0000000000000000 - 0000000100800000 (usable)
No mptable found.
Built 1 zonelists.  Total pages: 1050624
Kernel command line: ro root=/dev/VolGroup00/LogVol00 console=xvc0
Initializing CPU#0
PID hash table entries: 4096 (order: 12, 32768 bytes)
Xen reported: 2613.400 MHz processor.
Console: colour dummy device 80x25
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
Software IO TLB disabled
Memory: 4096768k/4202496k available (2321k kernel code, 96972k reserved, 1312k data, 168k init)
Calibrating delay using timer specific routine.. 6538.09 BogoMIPS (lpj=13076195)
Security Framework v1.0.0 initialized
SELinux:  Initializing.
SELinux:  Starting in permissive mode
selinux_register_security:  Registering secondary module capability
Capability LSM initialized as secondary
Mount-cache hash table entries: 256
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 1024K (64 bytes/line)
CPU: Physical Processor ID: 7
CPU: Processor Core ID: 1
(SMP-)alternatives turned off
Brought up 1 CPUs
checking if image is initramfs... it is
Grant table initialized
NET: Registered protocol family 16
ACPI Exception (utmutex-0262): AE_BAD_PARAMETER, Thread 377A0 could not acquire Mutex [2] [20060707]
Initializing CPU#1
migration_cost=1074
migration_cost=1074Initializing CPU#2

migration_cost=1074
Brought up 4 CPUs
Initializing CPU#3
PCI: setting up Xen PCI frontend stub
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
xen_mem: Initialising balloon driver.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: System does not support PCI
PCI: System does not support PCI
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4
NetLabel:  unlabeled traffic allowed by default
NET: Registered protocol family 2
IP route cache hash table entries: 262144 (order: 9, 2097152 bytes)
TCP established hash table entries: 262144 (order: 10, 4194304 bytes)
TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
TCP: Hash tables configured (established 262144 bind 65536)
TCP reno registered
IA-32 Microcode Update Driver: v1.14-xen <tigran@veritas.com>
audit: initializing netlink socket (disabled)
audit(1193918686.777:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
SELinux:  Registering netfilter hooks
Initializing Cryptographic API
ksign: Installing public key data
Loading keyring
- Added public key 991108A46E99ED4B
- User ID: CentOS (Kernel Module GPG key)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
rtc: IRQ 8 is not free.
Non-volatile memory driver v1.2
Linux agpgart interface v0.101 (c) Dave Jones
RAMDISK driver initialized: 16 RAM disks of 16384K size 4096 blocksize
Xen virtual console successfully installed as xvc0
Bootdata ok (command line is ro root=/dev/VolGroup00/LogVol00 console=xvc0)
Linux version 2.6.18-8.el5xen (mockbuild@builder6.centos.org) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Thu Mar 15 19:56:43 EDT 2007
BIOS-provided physical RAM map:
 Xen: 0000000000000000 - 0000000100800000 (usable)
No mptable found.
Built 1 zonelists.  Total pages: 1050624
Kernel command line: ro root=/dev/VolGroup00/LogVol00 console=xvc0
Initializing CPU#0
PID hash table entries: 4096 (order: 12, 32768 bytes)
Xen reported: 2613.400 MHz processor.
Console: colour dummy device 80x25
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
Software IO TLB disabled
Memory: 4096768k/4202496k available (2321k kernel code, 96972k reserved, 1312k data, 168k init)
Calibrating delay using timer specific routine.. 6538.09 BogoMIPS (lpj=13076195)
Security Framework v1.0.0 initialized
SELinux:  Initializing.
SELinux:  Starting in permissive mode
selinux_register_security:  Registering secondary module capability
Capability LSM initialized as secondary
Mount-cache hash table entries: 256
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 1024K (64 bytes/line)
CPU: Physical Processor ID: 7
CPU: Processor Core ID: 1
(SMP-)alternatives turned off
Brought up 1 CPUs
checking if image is initramfs... it is
Grant table initialized
NET: Registered protocol family 16
ACPI Exception (utmutex-0262): AE_BAD_PARAMETER, Thread 377A0 could not acquire Mutex [2] [20060707]
Initializing CPU#1
migration_cost=1074
migration_cost=1074Initializing CPU#2

migration_cost=1074
Brought up 4 CPUs
Initializing CPU#3
PCI: setting up Xen PCI frontend stub
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
xen_mem: Initialising balloon driver.
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: System does not support PCI
PCI: System does not support PCI
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4
NetLabel:  unlabeled traffic allowed by default
NET: Registered protocol family 2
IP route cache hash table entries: 262144 (order: 9, 2097152 bytes)
TCP established hash table entries: 262144 (order: 10, 4194304 bytes)
TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
TCP: Hash tables configured (established 262144 bind 65536)
TCP reno registered
IA-32 Microcode Update Driver: v1.14-xen <tigran@veritas.com>
audit: initializing netlink socket (disabled)
audit(1193918686.777:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
SELinux:  Registering netfilter hooks
Initializing Cryptographic API
ksign: Installing public key data
Loading keyring
- Added public key 991108A46E99ED4B
- User ID: CentOS (Kernel Module GPG key)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
rtc: IRQ 8 is not free.
Non-volatile memory driver v1.2
Linux agpgart interface v0.101 (c) Dave Jones
RAMDISK driver initialized: 16 RAM disks of 16384K size 4096 blocksize
Xen virtual console successfully installed as xvc0
Event-channel device installed.
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
ide-floppy driver 0.99.newide
usbcore: registered new driver hiddev
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
PNP: No PS/2 controller found. Probing ports directly.
i8042.c: No controller found.
mice: PS/2 mouse device common for all mice
md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
md: bitmap version 4.39
TCP bic registered
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 17
XENBUS: Device with no driver: device/vbd/51712
XENBUS: Device with no driver: device/vif/0
Write protecting the kernel read-only data: 439k
Red Hat nash version 5.1.19.6 starting
Mounting proc filesystem
Mounting sysfs filesystem
Creating /dev
Creating initial device nodes
Setting up hotplug.
Creating block device nodes.
Loading uhci-hcd.ko module
USB Universal Host Controller Interface driver v3.0
Loading ohci-hcd.ko module
Loading ehci-hcd.ko module
Loading jbd.ko module
Loading ext3.ko module
Loading xenblk.ko module
Registering block device major 202
 xvda: xvda1 xvda2
Loading dm-mod.ko module
device-mapper: ioctl: 4.11.0-ioctl (2006-09-14) initialised: dm-devel@redhat.com
Loading dm-mirror.ko module
Loading dm-zero.ko module
Loading dm-snapshot.ko module
Making device-mapper control node
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
Activating logical volumes
  2 logical volume(s) in volume group "VolGroup00" now active
Creating root device.
Mounting root filesystem.
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
Setting up other filesystems.
Setting up new root fs
no fstab.sys, mounting internal defaults
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
SELinux:  Disabled at runtime.
SELinux:  Unregistering netfilter hooks
audit(1193918690.801:2): selinux=0 auid=4294967295
INIT: version 2.86 booting
                Welcome to  CentOS release 5 (Final)
                Press 'I' to enter interactive startup.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
Setting clock  (utc): Thu Nov  1 20:04:50 SGT 2007 [  OK  ]
Starting udev: [  OK  ]
Setting hostname centos5:  [  OK  ]
Setting up Logical Volume Management:   2 logical volume(s) in volume group "VolGroup00" now active
[  OK  ]
Checking filesystems
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/VolGroup00/LogVol00
/dev/VolGroup00/LogVol00: clean, 42848/2080768 files, 369765/2080768 blocks
[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 -a /dev/xvda1
/boot: clean, 36/26104 files, 15441/104388 blocks
[  OK  ]
Remounting root filesystem in read-write mode:  [  OK  ]
Mounting local filesystems:  [  OK  ]
Enabling local filesystem quotas:  [  OK  ]
Enabling /etc/fstab swaps:  [  OK  ]
INIT: Entering runlevel: 3
Entering non-interactive startup
Starting background readahead: [  OK  ]
Checking for hardware changes [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]
Starting auditd: [  OK  ]
Starting system logger: [  OK  ]
Starting kernel logger: [  OK  ]
Starting irqbalance: [  OK  ]
Starting portmap: [  OK  ]
Starting NFS statd: [  OK  ]
Starting RPC idmapd: [  OK  ]
Starting system message bus: [  OK  ]
[  OK  ] Bluetooth services:[  OK  ]
Mounting other filesystems:  [  OK  ]
Starting PC/SC smart card daemon (pcscd): [  OK  ]
Starting hidd: [  OK  ]
Starting autofs:  Loading autofs4: [  OK  ]
Starting automount: [  OK  ]
[  OK  ]
Starting cups: [  OK  ]
Starting sshd: [  OK  ]
Starting xinetd: [  OK  ]
Starting sendmail: [  OK  ]
Starting sm-client: [  OK  ]
Starting console mouse services: [  OK  ]
Starting crond: [  OK  ]
Starting anacron: [  OK  ]
Starting atd: [  OK  ]
Starting yum-updatesd: [  OK  ]
Starting Avahi daemon... [  OK  ]
Starting HAL daemon: [  OK  ]
Starting smartd: [  OK  ]

CentOS release 5 (Final)
Kernel 2.6.18-8.el5xen on an x86_64

centos5 login: chihung
Password:
Last login: Thu Nov  1 19:55:29 from 10.0.12.33
[chihung@centos5 ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      7.7G  1.2G  6.2G  16% /
/dev/xvda1             99M   12M   82M  13% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm

[chihung@centos5 ~]$ which tclsh
/usr/bin/tclsh
[chihung@centos5 ~]$ tclsh
% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine)   = x86_64
tcl_platform(os)        = Linux
tcl_platform(osVersion) = 2.6.18-8.el5xen
tcl_platform(platform)  = unix
tcl_platform(threaded)  = 1
tcl_platform(user)      = chihung
tcl_platform(wordSize)  = 8
% set tcl_patchLevel
8.4.13
% exit

[chihung@centos5 ~]$ exit

[chihung@centos5 ~]$ su -

[root@centos5 proc]# xentop
xentop - 12:13:56   Xen 3.0.4-1-xvm
2 domains: 1 running, 1 blocked, 0 paused, 0 crashed, 0 dying, 0 shutdown
Mem: 33029676k total, 33028064k used, 1612k free    CPUs: 16 @ 2613MHz
      NAME  STATE   CPU(sec) CPU(%)     MEM(k) MEM(%)  MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS   VBD_OO   VBD_
RD   VBD_WR SSID
   centos5 --b---          8    0.0    4194072   12.7    4194304      12.7     4    1        0        0    1        0
 0        0    0
  Domain-0 -----r       7350    0.0   28424612   86.1   no limit       n/a    16    0        0        0    0        0
 0        0    0

[root@centos5 proc]# cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 33
model name      : Dual Core AMD Opteron(tm) Processor 885
stepping        : 2
cpu MHz         : 2613.400
cache size      : 1024 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm cmp_legacy
bogomips        : 6538.09
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp

processor       : 1
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 33
model name      : Dual Core AMD Opteron(tm) Processor 885
stepping        : 2
cpu MHz         : 2613.400
cache size      : 1024 KB
physical id     : 1
siblings        : 1
core id         : 0
cpu cores       : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm cmp_legacy
bogomips        : 6538.09
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp

processor       : 2
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 33
model name      : Dual Core AMD Opteron(tm) Processor 885
stepping        : 2
cpu MHz         : 2613.400
cache size      : 1024 KB
physical id     : 2
siblings        : 1
core id         : 0
cpu cores       : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm cmp_legacy
bogomips        : 6538.09
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp

processor       : 3
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 33
model name      : Dual Core AMD Opteron(tm) Processor 885
stepping        : 2
cpu MHz         : 2613.400
cache size      : 1024 KB
physical id     : 3
siblings        : 1
core id         : 0
cpu cores       : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm cmp_legacy
bogomips        : 6538.09
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp

[root@centos5 proc]# cat /proc/meminfo
MemTotal:      4194304 kB
MemFree:       3911712 kB
Buffers:         11708 kB
Cached:         117648 kB
SwapCached:          0 kB
Active:          51032 kB
Inactive:       105476 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      4194304 kB
LowFree:       3911712 kB
SwapTotal:     2031608 kB
SwapFree:      2031608 kB
Dirty:               0 kB
Writeback:           0 kB
AnonPages:       27168 kB
Mapped:           8720 kB
Slab:            11084 kB
PageTables:       2612 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   4128760 kB
Committed_AS:    66944 kB
VmallocTotal: 34359738367 kB
VmallocUsed:      1080 kB
VmallocChunk: 34359737267 kB

[root@centos5 proc]# uname -a
Linux centos5 2.6.18-8.el5xen #1 SMP Thu Mar 15 19:56:43 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux

[root@centos5 proc]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:16:3E:14:84:E5
          inet addr:10.0.12.34  Bcast:10.0.12.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fe14:84e5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:138 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9518 (9.2 KiB)  TX bytes:9536 (9.3 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@centos5 proc]# top 
top - 20:10:23 up 5 min,  1 user,  load average: 0.00, 0.04, 0.02
Tasks:  78 total,   1 running,  77 sleeping,   0 stopped,   0 zombie
Cpu0  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4194304k total,   281992k used,  3912312k free,    11796k buffers
Swap:  2031608k total,        0k used,  2031608k free,   117720k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1654 root      15   0 12568 1212  916 R    0  0.0   0:00.03 top
    1 root      18   0 10308  712  592 S    0  0.0   0:00.06 init [3]
    2 root      RT   0     0    0    0 S    0  0.0   0:00.00 [migration/0]
    3 root      34  19     0    0    0 S    0  0.0   0:00.00 [ksoftirqd/0]
    4 root      RT   0     0    0    0 S    0  0.0   0:00.00 [watchdog/0]
    5 root      10  -5     0    0    0 S    0  0.0   0:00.00 [events/0]
    6 root      10  -5     0    0    0 S    0  0.0   0:00.00 [khelper]
    7 root      10  -5     0    0    0 S    0  0.0   0:00.00 [kthread]
    9 root      10  -5     0    0    0 S    0  0.0   0:00.00 [xenwatch]
   10 root      10  -5     0    0    0 S    0  0.0   0:00.00 [xenbus]
   14 root      RT  -5     0    0    0 S    0  0.0   0:00.00 [migration/1]
   15 root      34  19     0    0    0 S    0  0.0   0:00.00 [ksoftirqd/1]
   16 root      RT  -5     0    0    0 S    0  0.0   0:00.00 [watchdog/1]
   17 root      10  -5     0    0    0 S    0  0.0   0:00.00 [events/1]

[root@centos5 proc]# exit

[chihung@centos5 ~]$ exit

CentOS release 5 (Final)
Kernel 2.6.18-8.el5xen on an x86_64

centos5 login: root@opensolaris#

To manage those guest domains, you need to use "virsh"

root@opensolaris# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # help
Commands:

    capabilities    capabilities
    connect         (re)connect to hypervisor
    console         connect to the guest console
    create          create a domain from an XML file
    start           start a (previously defined) inactive domain
    destroy         destroy a domain
    define          define (but don't start) a domain from an XML file
    domid           convert a domain name or UUID to domain id
    domuuid         convert a domain name or id to domain UUID
    dominfo         domain information
    domname         convert a domain id or UUID to domain name
    domstate        domain state
    dumpxml         domain information in XML
    help            print help
    list            list domains
    nodeinfo        node information
    quit            quit this interactive terminal
    reboot          reboot a domain
    restore         restore a domain from a saved state in a file
    resume          resume a domain
    save            save a domain state to a file
    schedinfo       show/set scheduler parameters
    dump            dump the core of a domain to a file for analysis
    shutdown        gracefully shutdown a domain
    setmem          change memory allocation
    setmaxmem       change maximum memory limit
    setvcpus        change number of virtual CPUs
    suspend         suspend a domain
    undefine        undefine an inactive domain
    vcpuinfo        domain vcpu information
    vcpupin         control domain vcpu affinity
    version         show version
    vncdisplay      vnc display
    attach-device   attach device from an XML file
    detach-device   detach device from an XML file

virsh # vcpuinfo centos5
VCPU:           0
CPU:            7
State:          blocked
CPU time:       4.3s
CPU Affinity:   yyyyyyyyyyyyyyyy

VCPU:           1
CPU:            0
State:          blocked
CPU time:       1.9s
CPU Affinity:   yyyyyyyyyyyyyyyy

VCPU:           2
CPU:            3
State:          blocked
CPU time:       1.4s
CPU Affinity:   yyyyyyyyyyyyyyyy

VCPU:           3
CPU:            12
State:          blocked
CPU time:       1.2s
CPU Affinity:   yyyyyyyyyyyyyyyy

virsh # nodeinfo
CPU model:           i86pc
CPU(s):              16
CPU frequency:       2613 MHz
CPU socket(s):       8
Core(s) per socket:  2
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         33029120 kB

virsh # version
Compiled against library: libvir 0.2.3
Using library: libvir 0.2.3
Using API: Xen 3.0.1
Running hypervisor: Xen 3.0

virsh # dumpxml centos5
<domain type='xen' id='8'>
  <name>centos5</name>
  <uuid>3816e1f75e9518410adc5fc4a5360aa5</uuid>
  <bootloader>/usr/lib/xen/bin/pygrub</bootloader>
  <os>
    <type>linux</type>
  </os>
  <memory>4194304</memory>
  <vcpu>4</vcpu>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <interface type='ethernet'>
      <mac address='00:16:3e:14:84:e5'/>
    </interface>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/data/xvm/centos5.xvm'/>
      <target dev='xvda'/>
    </disk>
    <console tty='/dev/pts/3'/>
  </devices>
</domain>

virsh # dumpxml Domain-0
<domain type='xen' id='0'>
  <name>Domain-0</name>
  <uuid>00000000000000000000000000000000</uuid>
  <memory>28423168</memory>
  <vcpu>16</vcpu>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
  </devices>
</domain>

virsh # quit

BTW, the xm, virt-install and virsh frontend to xVM are mostly implemented in Python.

root@opensolaris# pwd
/usr/lib/python2.4/vendor-packages/xen

root@opensolaris# ls
__init__.py   __init__.pyc  lowlevel      sv            util          web           xend          xm

root@opensolaris# pwd
/usr/lib/python2.4/vendor-packages/xen/xm

root@opensolaris# ls
XenAPI.py          cfgbootpolicy.pyc  dumppolicy.py      labels.pyc         migrate.py         resources.pyc
XenAPI.pyc         console.py         dumppolicy.pyc     loadpolicy.py      migrate.pyc        rmlabel.py
__init__.py        console.pyc        getlabel.py        loadpolicy.pyc     new.py             rmlabel.pyc
__init__.pyc       create.py          getlabel.pyc       main.py            new.pyc            shutdown.py
addlabel.py        create.pyc         help.py            main.pyc           opts.py            shutdown.pyc
addlabel.pyc       dry-run.py         help.pyc           makepolicy.py      opts.pyc
cfgbootpolicy.py   dry-run.pyc        labels.py          makepolicy.pyc     resources.py

root@opensolaris# head -1 /usr/sbin/xm
#!/usr/bin/env python

Hope those output helps you to 'interact' with the xvm in openSolaris.

Labels: , , ,

0 Comments:

Post a Comment

<< Home