Difference between revisions of "XenStore"

From Christoph's Personal Wiki
Jump to: navigation, search
(XenStore commands to be run on guest VM)
(XenStore commands to be run on guest VM)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
'''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).
 
'''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).
 
</div>
 
</div>
 +
 +
==XenStore commands to be run on hypervisor/host==
  
 
* View all domain information for a given DOMID:
 
* View all domain information for a given DOMID:
 
  $ xenstore-ls /local/domain/123
 
  $ 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):
+
* View the domain data for a given DOMID (note that the "host" value is empty and the "guest" is not. This is what one should see):
 
<pre>
 
<pre>
 
$ xenstore-ls /local/domain/123/data
 
$ xenstore-ls /local/domain/123/data
Line 27: Line 29:
 
</pre>
 
</pre>
  
* This is what the above output should _not_ look like (note that does not have the "guest" entries):
+
* This is what the above output should '''not''' look like (note that the output does not have the "guest" entries):
 
<pre>
 
<pre>
 
$ xenstore-ls /local/domain/399/data
 
$ xenstore-ls /local/domain/399/data
Line 66: Line 68:
  
 
==XenStore commands to be run on guest VM==
 
==XenStore commands to be run on guest VM==
 +
''Note: You can run all of these commands (as root) within a given [[:Category:Rackspace|Rackspace]] Cloud Server.''
 
  $ xenstore-ls data
 
  $ xenstore-ls data
 
  $ xenstore-read data/os_name
 
  $ xenstore-read data/os_name
Line 80: Line 83:
  
 
*Advanced lookups:
 
*Advanced lookups:
  $ xenstore-ls /local/domain/`xenstore-read domid`
+
  $ xenstore-ls /local/domain/$(xenstore-read domid)
  $ xenstore-read vm-data/networking/$(xenstore-read device/vif/2/mac|sed 's/://g')|python -mjson.tool
+
  $ xenstore-read vm-data/networking/$(xenstore-read device/vif/2/mac|sed 's/://g') | python -mjson.tool
 +
$ xenstore-ls /local/domain/$(xenstore-read domid) | grep "backend ="
 
  $ xenstore-ls -f /local/domain/0/backend/vbd/1207/768  # <- Replace with your actual VBD values
 
  $ xenstore-ls -f /local/domain/0/backend/vbd/1207/768  # <- Replace with your actual VBD values
 
  $ xenstore-ls -f /local/domain/0/backend/vif/1207/2  # <- Replace with your actual VIF values
 
  $ xenstore-ls -f /local/domain/0/backend/vif/1207/2  # <- Replace with your actual VIF values
  
 
[[Category:XenServer]]
 
[[Category:XenServer]]

Latest revision as of 06:37, 15 October 2021

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).

XenStore commands to be run on hypervisor/host

  • 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" value is empty and the "guest" is not. This is what one should 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 the output 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

Note: You can run all of these commands (as root) within a given Rackspace Cloud Server.

$ xenstore-ls data
$ xenstore-read data/os_name
$ xenstore-read data/meminfo_total
$ 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
$ xenstore-read name
$ xenstore-read domid
  • Advanced lookups:
$ xenstore-ls /local/domain/$(xenstore-read domid)
$ xenstore-read vm-data/networking/$(xenstore-read device/vif/2/mac|sed 's/://g') | python -mjson.tool
$ xenstore-ls /local/domain/$(xenstore-read domid) | grep "backend ="
$ xenstore-ls -f /local/domain/0/backend/vbd/1207/768  # <- Replace with your actual VBD values
$ xenstore-ls -f /local/domain/0/backend/vif/1207/2  # <- Replace with your actual VIF values