XAPI fake presence of PV drivers: Difference between revisions
(Created page with "<!-- MoinMoin name: XAPI_fake_presence_of_pv_drivers --> <!-- Comment: --> <!-- WikiMedia name: XAPI fake presence of pv drivers --> <!-- Page revision: 00000002 --> <!…") |
Dave.scott (talk | contribs) m (Faking the PV drivers is a development trick) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<!-- MoinMoin name: XAPI_fake_presence_of_pv_drivers --> |
|||
<!-- Comment: --> |
|||
<!-- WikiMedia name: XAPI fake presence of pv drivers --> |
|||
<!-- Page revision: 00000002 --> |
|||
<!-- Original date: Thu Jan 28 11:04:51 2010 (1264676691000000) --> |
|||
__NOTOC__ |
|||
= Faking the presence of the PV drivers = |
= Faking the presence of the PV drivers = |
||
Line 15: | Line 8: | ||
The vast majority of testing is performed with PV drivers and it is recommended that PV drivers are always installed. |
The vast majority of testing is performed with PV drivers and it is recommended that PV drivers are always installed. |
||
However, at the xen-level, plain HVM guests without PV drivers can still be suspend/resumed and migrated, although with reduced performance (e.g. in the case of migrate: longer VM downtime). |
However, at the xen-level, plain HVM guests without PV drivers can usually still be suspend/resumed and migrated, although with reduced performance (e.g. in the case of migrate: longer VM downtime). It is convenient to "fake" the presence of PV drivers in order to test these features during development, without having to always install PV tools in VMs. |
||
The following script takes the VM's uuid and writes the magic xenstore keys to fake the presence of up-to-date PV drivers. It must be run on the same host as the VM. |
The following script takes the VM's uuid and writes the magic xenstore keys to fake the presence of up-to-date PV drivers. It must be run on the same host as the VM. |
||
<pre |
<pre> |
||
#!/bin/sh |
#!/bin/sh |
||
Line 73: | Line 66: | ||
;; |
;; |
||
esac |
esac |
||
</pre> |
|||
[[Category: |
[[Category:XAPI Devel]] |
||
[[Category:Developers]] |
|||
[[Category:Design Document]] |
[[Category:Design Document]] |
Latest revision as of 17:31, 20 January 2015
Faking the presence of the PV drivers
xapi currently insists that PV drivers are present before allowing the operations:
- suspend/resume
- migrate
- clean reboot/shutdown
- disk, nic hotplug/unplug
The vast majority of testing is performed with PV drivers and it is recommended that PV drivers are always installed.
However, at the xen-level, plain HVM guests without PV drivers can usually still be suspend/resumed and migrated, although with reduced performance (e.g. in the case of migrate: longer VM downtime). It is convenient to "fake" the presence of PV drivers in order to test these features during development, without having to always install PV tools in VMs.
The following script takes the VM's uuid and writes the magic xenstore keys to fake the presence of up-to-date PV drivers. It must be run on the same host as the VM.
#!/bin/sh set -e usage() { echo "$0 <VM uuid>" echo " -- fakes the presence of PV tools in <VM uuid>" echo " -- NB the VM must be either paused or running on localhost" } fake(){ local uuid=$1 domid=$(xe vm-list uuid=${uuid} params=dom-id --minimal) xenstore-write /local/domain/${domid}/attr/PVAddons/MajorVersion ${major} \ /local/domain/${domid}/attr/PVAddons/MinorVersion ${minor} \ /local/domain/${domid}/attr/PVAddons/MicroVersion ${micro} \ /local/domain/${domid}/data/updated 1 } uuid=$(xe vm-list uuid=$1 params=uuid --minimal) if [ $? -ne 0 ]; then echo "Argument should be a VM uuid" usage exit 1 fi # use the PRODUCT_VERSION from here: . /etc/xensource-inventory major=$(echo ${PRODUCT_VERSION} | cut -f 1 -d .) minor=$(echo ${PRODUCT_VERSION} | cut -f 2 -d .) micro=$(echo ${PRODUCT_VERSION} | cut -f 3 -d .) # Check the VM is running on this host resident_on=$(xe vm-list uuid=${uuid} params=resident-on --minimal) if [ "${resident_on}" != "${INSTALLATION_UUID}" ]; then echo "VM must be resident on this host" exit 2 fi power_state=$(xe vm-list uuid=${uuid} params=power-state --minimal) case "${power_state}" in running) fake $uuid ;; paused) fake $uuid ;; *) echo "VM must be either running or paused" exit 3 ;; esac