Tuesday, September 11, 2012

Xen command

harddrives in XenServer 6.0:
  rhel 4: /dev/xvda, cdrom: /dev/xvdd
  rhel 5: /dev/hda, cdrom: /dev/hdd
  rhel 6: /dev/xvda, cdrom: /dev/xvdd

/etc/xensource/pool.conf
Emergency Network reset, will remove config for all host PIFs, Bonds, VLANs and tunnels, all VMs will be shutdown forcefully: xe-reset-networking
# xe pool-join master-address=linhb425 master-username=root master-password=xxxxx
. build status report when xapi is down
xen-bugtool --yestoall
# xe-toolstack-restart
. backup pool metadata for all VMs
# xe-backup-metadata -d -u [sr uuid]
. top Xen process
# xentop
. processor stat in Dom0
# mpstat 5
. virtual memory in Dom0
# vmstat 2
. storage traffic stats
# iostat -d 2 6
. lists VMs that are running
# list_domains

XAPI configuation in sqlite DB
 /var/xapi/state.db
 information for:
 - Host
 - VM
 - XAPI
# /opt/xensource/bin/xapi
# xenstore-ls
/opt/xensource/sm/XE_SR_ERRORCODES.xml
 /opt/xensource/sm/sm.py
 /opt/xensource/sm/<Type>SR.py
. xapi messages
# tail -f /var/log/xensource.log
.XenSource Inverntory info
# cat /etc/xensource-inventory
Platform Configuration
. HBA # /usr/local/bin/scli
. Software RAID # mdadm
. open-iscsi; discover iSCSI targets available to this server
  # iscsiadm -m discovery -t st -p <ip>
  # iscsiadm -m discovery -type sendtargets -port 192.168.250.14
. open iscsi sessions
  # iscsiadm -m session
. Network
 /etc/sysconfig/network-scripts/ifcfg-*
 /etc/sysconfig/iptables
  # tcpdump -i eth0 -vvv
  # netstat -pl
  # ifconfig
  # route
  # dhclient eth0
. kernel and modules
  # lsmod
  # insmod/modprobe
  # rmmod
. LVM Volume Group name: VG_XenStorage_<uuid>
  # fdisk -l
  # vgs
  # lvs
  # pvs
  # lvm
. incorporating a host disk in dom0
  # mount /dev/VG_XenStorage_<uuid>/<VM_uuid>.<disk> /path/to/mount/point
# pvcreate /dev/cciss/c0d1p1
. find vhd usage
# vhd-util scan -f -m “VHD-*” -l VG_XenStorage-<UUID_of_StorageRepository> -p
# lvscan

Object Commands:
 xe <class>-<TAB>
Object Parameter Command
 xe <class>-param-<TAB>
. Filter
 xe vm-list power-state=halted
. Parameter
 xe vm-list params=name-label
. Minimum
 xe vm-list --minimal

xe commands:
. list snapshot
# xe vdi-list is-a-snapshot=true
.dump crash kernel
# xe host-crashdump-list
.Xen Hypervisor Boot message
# xe host-dmesg
# xe event-wait class=vm name-label=<name> power-state=running
# xe host-cpu-list
# xe log-get-keys
# xe host-bugreport-upload
# xe host-backup
# xe log-set-output level=debug key=storage output=file:/tmp/storage-debug
# xe log-set-output level=debug key=storage output=nil
# xe sm-list
# xe sr-create type=lvm content-type=user device-config:device=/dev/cciss/c0d1p1 name-label="Local RAID5"