From: "M. Schneider" Subject: Docs: How to create and install CentOS PVMs with xe CLI on XCP 1.1 Date: Tue, 25 Oct 2011 21:53:17 +0200 Message-ID: <4EA713AD.7000808@it-infrastrukturen.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010000000301070406060603" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-users@lists.xensource.com Cc: "M. Schneider" , Xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010000000301070406060603 Content-Type: multipart/alternative; boundary="------------030604070306080807060404" --------------030604070306080807060404 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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@it-infrastrukturen.org *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 -g" echo " `basename $0` -h -u" echo " `basename $0` -h -d" 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} # --- --------------030604070306080807060404 Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit 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@it-infrastrukturen.org

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}
# ---
--------------030604070306080807060404-- --------------010000000301070406060603 Content-Type: text/plain; name="vmvnc" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vmvnc" #!/bin/bash function usage () { echo "Usage:" echo " `basename $0` -h -g " echo " `basename $0` -h -u " echo " `basename $0` -h -d " 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} --------------010000000301070406060603 Content-Type: text/plain; name="list-of-installed-VMs.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="list-of-installed-VMs.txt" [root@xcp11db02 ~]# xe vm-list uuid ( RO) : 4133031a-e064-38e7-416d-72e1eb0a9118 name-label ( RW): ubuntu11dbrt20 power-state ( RO): running uuid ( RO) : c6f33171-eaa6-eb54-aff2-172625b14c39 name-label ( RW): ubuntu11nfs20 power-state ( RO): running uuid ( RO) : a4db5c10-a197-6200-fdca-60a9a231f261 name-label ( RW): centos6dbrt20 power-state ( RO): running uuid ( RO) : 9e0726af-580b-45db-b2ae-07cbc810ccb2 name-label ( RW): Control domain on host: xcp11db02 power-state ( RO): running uuid ( RO) : df72d730-519d-70d9-da18-acd778a6afd9 name-label ( RW): ubuntu11dbp20 power-state ( RO): running --------------010000000301070406060603 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010000000301070406060603--