Difference between revisions of "XenServer"

From Hack Sphere Labs Wiki
Jump to: navigation, search
(xe sr-create)
Line 47: Line 47:
  
 
  device-config:
 
  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
 +
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:  http://notes.rioastamal.net/2014/05/xenserver-62-fix-unrecognized-lvm-on-boot.html
 +
*http://discussions.citrix.com/topic/257054-local-iso-repository/
 +
 +
===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 <ref>http://mytechmemoirs.com/2012/03/11/update-or-patch-a-xenserver-host/<ref>
 +
 +
=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==
 +
*http://www.sotechdesign.com.au/xenserver-6-2-how-to-set-up-passthrough-of-a-pci-or-pci-express-device/
 +
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 <ref>
 +
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

Revision as of 20:25, 17 August 2015

Creating Local ISO Library

ssh box
df -h

Not alot of space huh?

pvs

Look at all that space

vgs

Create a new LV group to Store ISOs

lvcreate -L 20G -n IsoImages VG_XenStorage-dae27f11-a60d-35d2-075a-b1c2e5fa1d81

Format that thing

mkfs.ext3 /dev/VG_XenStorage-dae27f11-a60d-35d2-075a-b1c2e5fa1d81/IsoImages

Create a place for it

mkdir /mnt/IsoImages

Turn on the LVM

vgchange -a y

Create the ISO repo in Xen

xe sr-create name-label=IsoImages type=iso device-config:location=/mnt/IsoImages/ device-config:legacy_mode=true content-type=iso

Check that Xen can see it

 xe sr-list

Mount it

mount -t ext3 /dev/VG_XenStorage-dae27f11-a60d-35d2-075a-b1c2e5fa1d81/IsoImages /mnt/IsoImages

Add it to fstab

echo "/dev/VG_XenStorage-dae27f11-a60d-35d2-075a-b1c2e5fa1d81/IsoImages /mnt/IsoImages ext3 defaults 1 1" >> /etc/fstab

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

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
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 <ref>http://mytechmemoirs.com/2012/03/11/update-or-patch-a-xenserver-host/<ref>

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 <ref> 
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