[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Docs: How to create and install CentOS PVMs with xe CLI on XCP 1.1



Hello,

First thank you very much for XCP 1.1, the vmvnc script and helpful hints from both xen-lists!

I hope the description below "How to create and install CentOS PVMs with xe CLI on XCP 1.1" will be helpful for first steps without XenCenter (as it doesn't run on Linux yet). Installation of PVM for ubuntu 11.10 server is very similar.

I strongly suggest to read documentation of XenServer 5.6 sp2 (reference.pdf and guest.pdf) for better understanding.

Enjoy and feel free to add it to xen-wiki or to documentation if you find it useful .

regards, Mark

-- 
ms@xxxxxxxxxxxxxxxxxxxxxx

Installing of CentOS6 PVM (xe CLI / XCP 1.1)
# On the XCP 1.1 host

# Prepare local iso repository
/var/opt/xen/iso_import/centos6
wget -Nc http://mirror.switch.ch/ftp/mirror/centos/6.0/isos/x86_64/CentOS-6.0-x86_64-minimal.iso
xe sr-create name-label=centos6 type=iso device-config:location=/var/opt/xen/iso_import/centos6 device-config:legacy_mode=true content-type=iso
xe cd-list

# Create and tune PVM
xe vm-install new-name-label=centos6dbrt20 sr-name-label=Local\ LVM\ SR\ DB-VM-pool  template=Other\ install\ media
xe vdi-create name-label="VDI centos6 dbrt20 server" sr-uuid=638d8bb3-4b08-f7c0-1e9d-2dc496b86c49 type=user sm-config:type=raw virtual-size=32GiB
xe vm-list

xe vm-param-set VCPUs-max=4 uuid=a4db5c10-a197-6200-fdca-60a9a231f261
xe vm-param-set VCPUs-at-startup=2 uuid=a4db5c10-a197-6200-fdca-60a9a231f261
xe vm-param-set memory-static-max=4GiB uuid=a4db5c10-a197-6200-fdca-60a9a231f261
xe vm-param-set memory-dynamic-max=4GiB uuid=a4db5c10-a197-6200-fdca-60a9a231f261
xe vm-param-set memory-dynamic-min=1GiB uuid=a4db5c10-a197-6200-fdca-60a9a231f261
xe vm-param-set memory-static-min=1GiB uuid=a4db5c10-a197-6200-fdca-60a9a231f261

xe vdi-create name-label="VDI centos6 dbrt20 server" sr-uuid=638d8bb3-4b08-f7c0-1e9d-2dc496b86c49 type=user sm-config:type=raw virtual-size=32GiB
xe vdi-list
xe vm-disk-add vm=centos6dbrt20 sr-uuid=638d8bb3-4b08-f7c0-1e9d-2dc496b86c49  device=0 disk-size=34359738368
xe vbd-list
xe vbd-param-set bootable=false uuid=878a2e9c-4efa-3daa-e5ad-5f98244d93c6

xe vm-list
xe network-list
xe vif-create vm-uuid=a4db5c10-a197-6200-fdca-60a9a231f261  network-uuid=9f6f2c37-090c-148a-1a99-134846808d10 mac=random device=0
xe vm-cd-add vm=centos6dbrt20 device=3 cd-name=CentOS-6.0-x86_64-minimal.iso
xe vm-cd-list vm=centos6dbrt20
xe vbd-param-set bootable=true uuid=c6ac1b61-fdf0-37c9-f6b5-aedcb74d8ba5
xe vm-param-set uuid=a4db5c10-a197-6200-fdca-60a9a231f261 other-config:install-repository=cdrom

# Start the installation of CentOS
xe vm-start vm=centos6dbrt20


# On the linux client with vncviewer
ironm@debian:~$ ./vmvnc -h 192.168.1.190 -g centos6dbrt20

# --- vmvnc script script
#!/bin/bash

function usage () {
    echo "Usage:"
    echo "   `basename $0` -h<xenserver host>  -g<guest vm name-label>"
    echo "   `basename $0` -h<xenserver host>  -u<guest vm uuid>"
    echo "   `basename $0` -h<xenserver host>  -d<domID>"
    exit 1
}

while getopts "h:g:u:d:" option
do
    case $option in
        h ) xs=${OPTARG} ;;
        g ) vm=${OPTARG} ;;
        u ) uu=${OPTARG} ;;
        d ) id=${OPTARG} ;;
        * ) usage
    esac
done

if [ -z ${xs} ]; then
    usage
fi

if [ -z ${uu} ]&&  [ -z ${vm} ]&&  [ -z ${id} ]; then
    usage
fi

if [ ! -z ${uu} ]; then
    domid=`ssh root@${xs} xe vm-list uuid=${uu} params=dom-id --minimal`
elif [ ! -z ${vm} ]; then
    domid=`ssh root@${xs} xe vm-list name-label=${vm} params=dom-id --minimal`
elif [ ! -z ${id} ]; then
    domid=${id}
fi

if [ -z ${domid} ]; then
    echo "Could not find guest ${vm}${uu} on host ${xs}."
    exit 1
elif [ ${domid} -lt 0 ]; then
    echo "Guest ${vm}${uu} has no dom-id. Is your vm running?"
    exit 1
fi

port=`ssh root@${xs} xenstore-read /local/domain/${domid}/console/vnc-port`

if [ -z ${port} ]; then
    echo "Couldn't read VNC port from xenstore. Is your vm running?"
    exit 1
fi

echo "Connecting to vnc port ${port} on host ${xs}..."

vncviewer -via root@${xs} localhost::${port}
# ---

Attachment: vmvnc
Description: Text document

Attachment: list-of-installed-VMs.txt
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.