Difference between revisions of "XenStore"
From Christoph's Personal Wiki
(No difference)
|
Revision as of 12:44, 23 December 2014
This article will cover XenStore-related topics and CLI examples.
WARNING: The majority of these commands are meant to be run on the hypervisor/host. Unless otherwise noted, they should not be run on a guest VM (or Cloud Server).
- View all domain information for a given DOMID:
$ xenstore-ls /local/domain/123
- View the domain data for a given DOMID (note that the "host" is empty and the "guest" is not. That is what we want to see):
$ xenstore-ls /local/domain/123/data host = "" meminfo_total = "1022884" meminfo_free = "181088" os_name = "Debian GNU/Linux 7.1 (wheezy)" os_majorver = "7" os_minorver = "1" os_uname = "3.2.0-4-amd64" os_distro = "debian" updated = "Wed Oct 9 05:41:29 UTC 2013" guest = "" 127a8ec3-ffff-4d0b-cccc-6f6c03faedf3 = "{"message": "0.0.1.37", "returncode": "0"}" a1262b0a-ffff-4b39-cccc-7c9c5a341bd4 = "{"message": "120060756033138162104944855769740", "returncode": "D0"}" 5a6df0d1-ffff-4666-cccc-94bae5798776 = "{"message": "", "returncode": "0"}" dba8667d-ffff-469c-cccc-b46b25fadb8e = "{"message": "", "returncode": "0"}"
- This is what the above output should _not_ look like (note that does not have the "guest" entries):
$ xenstore-ls /local/domain/399/data host = "" cacbdbd9-ffff-4fd7-cccc-906f15e0f9fd = "{"name":"version","value":"agent"}" meminfo_total = "1022880" meminfo_free = "460328" os_name = "Debian GNU/Linux 7.1 (wheezy)" os_majorver = "7" os_minorver = "1" os_uname = "3.2.0-4-amd64" os_distro = "debian" updated = "Wed Oct 9 05:13:43 UTC 2013"
- Check nova-agent version (useful for making sure nova-agent is running on the VM):
$ label=instance-XXXXXXX; uuid=`uuidgen`; domid=$(xe vm-list name-label=$label params=dom-id --minimal); \ xenstore-write /local/domain/$domid/data/host/$uuid '{"name":"version","value":"agent"}'; sleep 10 ; \ xenstore-read /local/domain/$domid/data/guest/$uuid ; unset label; unset uuid; unset domid; $ #~OR~ $ echo -n 'Enter Name Label : ';read LABEL;DOMID=$(xe vm-list name-label=$LABEL params=dom-id --minimal);\ UUID=$(uuidgen);xenstore-write /local/domain/$DOMID/data/host/$UUID '{"name":"version","value":"agent"}';sleep 5;\ echo -ne "\nxapi reply : "; xenstore-read /local/domain/$DOMID/data/guest/$UUID ; \ xenstore-rm /local/domain/$DOM/data/host/$UUID ; unset LABEL; unset UUID; unset DOMID;
- Re-configure/reset network of VM from host:
$ label=instance-XXXXXXX; uuid=$(uuidgen); domid=$(xe vm-list name-label=$label params=dom-id --minimal); \ xenstore-write /local/domain/$domid/data/host/$uuid '{"name":"resetnetwork","value":""}'; sleep 10 ; \ xenstore-read /local/domain/$domid/data/guest/$uuid ; unset label; unset uuid; unset domid;
Miscellaneous commands
$ xenstore-exists /local/domain/$DOMID/data/guest/${UUID} $ xenstore-write /local/domain/$DOMID/data/host/${UUID} {"name": "resetnetwork", "value": ""}' $ xenstore-write /local/domain/$DOMID/data/host/${UUID} {"name": "password", "value": "MY_PASSWORD"}' $ xenstore-ls /local/domain/$DOMID/PVAddons $ xenstore-ls /local/domain/$DOMID/vm-data/networking $ xenstore-read /local/domain/$DOMID/vm-data/networking/$MAC # MAC address from previous command
XenStore commands to be run on guest VM
$ xenstore-ls vm-data $ xenstore-list vm-data $ xenstore-ls vm-data/networking $ xenstore-read vm-data/networking/${MAC_ADDRESS} # <- Replace with your actual MAC address $ xenstore-read vm-data/hostname $ xenstore-read vm-data/provider_data/roles $ xenstore-read vm-data/provider_data/region