Difference between revisions of "XenServer"

From Hack Sphere Labs Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=Importing xva Images=
 +
xe vm-import -h <host ip> -pw <yourpass> filename=./Ubuntu-9.1032bitPV.xva sr-uuid=<your SR UUID>
 +
*http://www.commandlinefu.com/commands/view/6682/import-a-virtual-machine-with-xenserver
 +
 +
=SATA Direct Local Disk Access=
 +
*http://techblog.conglomer.net/sata-direct-local-disk-access-on-xenserver/
 +
If/when Xen updates it will overwrite this file, you will have to add the lines again.
 +
nano -w /etc/udev/rules.d/50-udev.rules
 +
Add to the end
 +
ACTION=="add", KERNEL=="sdb", SYMLINK+="xapi/block/%k", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
 +
ACTION=="remove", KERNEL=="sdb", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
 +
Reboot Xen Server...
 +
 
=ethtool network stuff=
 
=ethtool network stuff=
 
*http://old-list-archives.xenproject.org/xen-users/2007-01/msg00460.html
 
*http://old-list-archives.xenproject.org/xen-users/2007-01/msg00460.html

Latest revision as of 05:33, 22 November 2015

Importing xva Images

xe vm-import -h <host ip> -pw <yourpass> filename=./Ubuntu-9.1032bitPV.xva sr-uuid=<your SR UUID>

SATA Direct Local Disk Access

If/when Xen updates it will overwrite this file, you will have to add the lines again.

nano -w /etc/udev/rules.d/50-udev.rules

Add to the end

ACTION=="add", KERNEL=="sdb", SYMLINK+="xapi/block/%k", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
ACTION=="remove", KERNEL=="sdb", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"

Reboot Xen Server...

ethtool network stuff

Snapshots and Cloaning

https://www.youtube.com/watch?v=Do68cDMVFiw

xe vm-snapshot vm=name new-name=label=name2 new-name-description=Testing
xe vm-list
xe snapshot-list snapshot-of=

http://www.commandlinefu.com/commands/view/6680/copy-a-virtual-machine-on-citrix-xenserver-optionally-to-a-different-storage-repository

Can only copy when VM is shutdown. Other solution, if I remember is to snapshot, and then copy or something.

xe vm-copy vm="ABCServer" sr-uuid=24565487-accf-55ed-54da54993ade784a new-name-label="Copy of ABCServer" new-name-description="New Description"

Export live running VM: http://www.xenlens.com/export-a-live-running-vm-guest-from-xenserver-host/


Commands

xe sr-create

type=
  • type - type of the SR, used to specify the SR backend driver to use
    • SR - storage repository

http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/reference.html#ck_reference_storage_repository_types

xe sr-probe

device-config:

Creating Local ISO Repo - LVM

pvscan
lvcreate -L 50G -n ISORepo VG_XenStorage-d2e116af-c45b-e6ba-5965-abc7e85c88c7
lvscan
mkfs.ext3 /dev/VG_XenStorage-d2e116af-c45b-e6ba-5965-abc7e85c88c7/ISORepo
mkdir /mnt/ISORepo

fstab

/dev/VG_XenStorage-d2e116af-c45b-e6ba-5965-abc7e85c88c7/ISORepo /mnt/ISORepo ext3 defaults 0 1

Mount it then:

xe sr-create name-label=ISORepo type=iso device-config:legacy_mode=true device-config:location=/mnt/ISORepo content-type=iso
uuidoutput:  93a71420-d899-58e7-bce4-26d9cd4f6e46

This is supposed to refresh the repo, but with legacy mode it is supposed to do that itself:

xe sr-scan uuid=93a71420-d899-58e7-bce4-26d9cd4f6e46

Additional LVMs do not activate on boot!!! Do this:

nano /etc/rc.sysinit

Uncomment:

#if [ -x /sbin/lvm.static ]; then
# action $"Setting up Logical Volume Management:" /sbin/lvm.static vgchange -a y --ignorelockingfailure
#fi


Source

Activate LVM on Boot on XenServer

To activate on boot we need to make small modification to file /etc/rc.sysinit around line 487 to 489. Take a look into these lines:

#if [ -x /sbin/lvm.static ]; then
# action $"Setting up Logical Volume Management:" /sbin/lvm.static vgchange -a y --ignorelockingfailure
#fi

That's the problem, the lines which activate the LVM volume is commented. That's why we ended up with the problem. Now just uncomment those lines and save the file. But make sure you made a copy of it. Reboot the server and all LVM volumes should be detected on boot. Here's an example of my XenServer custom partition scheme:

LABEL=root-mterkkri    /         ext3     defaults   1  1
#/var/swap/swap.001          swap      swap   defaults   0  0
none        /dev/pts  devpts defaults   0  0
none        /dev/shm  tmpfs  defaults   0  0
none        /proc     proc   defaults   0  0
none        /sys      sysfs  defaults   0  0
/opt/xensource/packages/iso/XenCenter.iso   /var/xen/xc-install   iso9660   loop,ro   0  0
/dev/mapper/VG--XEN01-Dom0--TMP /tmp ext2 defaults,noexec,nosuid,nodev 1 2
/dev/mapper/VG--XEN01-Dom0--SWAP swap swap defaults 0 0
/tmp /var/tmp   none rw,noexec,nosuid,nodev,bind 1 2

Applying Official Patches

wget http://downloadns.citrix.com.edgesuite.net/10340/XS65ESP1.zip
unzip XS65ESP1.zip
xe patch-upload -s 127.0.0.1 -u root -pw eliteelite file-name=XS65ESP1.xsupdate

Or

xe patch-upload file-name=XS65ESP1.xsupdate

Outputs UUID

7f2e4a3a-4098-4a71-84ff-b0ba919723c7
xe -s 127.0.0.1 -u root -pw eliteelite patch-pool-apply uuid=7f2e4a3a-4098-4a71-84ff-b0ba919723c7

Or

xe host-list
xe patch-apply uuid=7f2e4a3a-4098-4a71-84ff-b0ba919723c7 host-uuid=94a5ec24-cfa9-4592-bf73-7ed04a215bc6

List Patches

xe patch-list [1]

What?

xe-toolstack-restart

PCI Passthrough

Knowing if pciback support is active: http://wiki.xenproject.org/wiki/Xen_Kernel_Feature_Matrix#pvops

Only Temp?

lspci
03:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
03:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
04:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
04:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)

xl pci-assignable-add 03:00.0
xl pci-assignable-add 03:00.1
xl pci-assignable-add 04:00.0
xl pci-assignable-add 04:00.1

xl pci-assignable-list

Kernel Line

nano -w /boot/extlinux.conf

Add (Old Way):

pciback.hide=(01:00.0)(00:02.0)

Add (New Way):

xen-pciback.hide=(01:00.0)(00:02.0)
  • I just tried the old way on 6.5SP1 xenserver and it is working

Add it to a domU:

  • For more then one:
xe vm-param-set other-config:pci=0/0000:03:00.0,0/0000:03:00.1,0/0000:04:00.0,0/0000:04:00.1 uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
  • For one:
xe vm-param-set other-config:pci=0/0000:03:00.1 uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-list uuid=46bca2ec-2756-73cd-de4c-e60068a95a84

Error("38: Function not implemented")

You most likley do not IOMMU or have it disabled in the BIOS.

Changing domU Memory

xl mem-set #Not going to use
xe vm-list
xe vm-list params=all uuid=46bca2ec-2756-73cd-de4c-e60068a95a84

Output:

            memory-static-max ( RW): 268435456
           memory-dynamic-max ( RW): 268435456
           memory-dynamic-min ( RW): 268435456
            memory-static-min ( RW): 134217728

Set it: (try KiB, MiB, GiB or TiB)

xe vm-param-set memory-static-max=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-set memory-dynamic-max=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-set memory-dynamic-min=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-set memory-static-min=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84

What does vm-memory-limits-set do?

Network

xe network-list
xe network-destroy

xe pif-list
xe pif-forget


ToDo

  • Get notifications about new updates


Adding an additional hard drive to XenServer

fdisk -l
xe sr-create name-label=2TBNoRaid shared=false device-config:device=/dev/sdb type=lvm

Adding a existing network to a VM

xe vm-list
xe network-list
xe vif-create network-uuid=<networkuuid> vm-uuid=<vmuuid> device=2
  1. http://mytechmemoirs.com/2012/03/11/update-or-patch-a-xenserver-host/