Tuesday, December 24, 2013

Xenstore for fun and profit

The XenStore is the configuration database in which Xen stores information on the running domUs. Although Xen uses the XenStore internally for vital matters like setting up virtual devices, you can also write arbitrary data to it from domUs as well as from dom0. Think of it as some sort of interdomain socket.
I've stolen a useful script from The Book of Xen
#!/bin/sh

function dumpkey() {
  local param=${1}
  local key
  local result
  result=$(xenstore-list ${param})
  if [ "${result}" != "" ] ; then
    for key in ${result} ; do dumpkey ${param}/${key} ; done
  else
    echo -n ${param}'='
    xenstore-read ${param}
  fi
}

for key in /vm /local/domain /tool ; do dumpkey ${key} ; done
Lets do this
/vm/00000000-0000-0000-0000-000000000000/on_xend_stop=ignore
/vm/00000000-0000-0000-0000-000000000000/shadow_memory=0
/vm/00000000-0000-0000-0000-000000000000/uuid=00000000-0000-0000-0000-000000000000
/vm/00000000-0000-0000-0000-000000000000/on_reboot=restart
/vm/00000000-0000-0000-0000-000000000000/image/ostype=linux
/vm/00000000-0000-0000-0000-000000000000/image/kernel=
/vm/00000000-0000-0000-0000-000000000000/image/cmdline=
/vm/00000000-0000-0000-0000-000000000000/image/ramdisk=
/vm/00000000-0000-0000-0000-000000000000/on_poweroff=destroy
/vm/00000000-0000-0000-0000-000000000000/bootloader_args=
/vm/00000000-0000-0000-0000-000000000000/on_xend_start=ignore
/vm/00000000-0000-0000-0000-000000000000/on_crash=restart
/vm/00000000-0000-0000-0000-000000000000/xend/restart_count=0
/vm/00000000-0000-0000-0000-000000000000/vcpus=4
/vm/00000000-0000-0000-0000-000000000000/vcpu_avail=15
/vm/00000000-0000-0000-0000-000000000000/bootloader=
/vm/00000000-0000-0000-0000-000000000000/name=Domain-0
/vm/00000000-0000-0000-0000-000000000000/memory=2796
/local/domain/0/vm=/vm/00000000-0000-0000-0000-000000000000
/local/domain/0/device=
/local/domain/0/control/platform-feature-multiprocessor-suspend=1
/local/domain/0/error=
/local/domain/0/memory/target=2863104
/local/domain/0/guest=
/local/domain/0/hvmpv=
/local/domain/0/cpu/1/availability=online
/local/domain/0/cpu/3/availability=online
/local/domain/0/cpu/2/availability=online
/local/domain/0/cpu/0/availability=online
/local/domain/0/name=Domain-0
/local/domain/0/console/limit=1048576
/local/domain/0/console/type=xenconsoled
/local/domain/0/domid=0
/local/domain/0/device-model=
/tool/xenstored=

No comments:

Post a Comment