aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>2007-01-31 10:30:54 -0700
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>2007-01-31 10:30:54 -0700
commit8e36c6490cab47a5b4acbd480a9f30f36d21fd6f (patch)
tree39eee25efcc0e8738a5e06b84daccb012fb516fc
parent0bf55ad11aee51ec964904535b7a9ba0b694870f (diff)
parentf492dd97fb674fbf6fe86f3052a50098ed169201 (diff)
downloadxen-8e36c6490cab47a5b4acbd480a9f30f36d21fd6f.tar.gz
xen-8e36c6490cab47a5b4acbd480a9f30f36d21fd6f.tar.bz2
xen-8e36c6490cab47a5b4acbd480a9f30f36d21fd6f.zip
merge with xen-unstable.hg
-rw-r--r--Makefile11
-rw-r--r--buildconfigs/linux-defconfig_xen0_ia642
-rw-r--r--buildconfigs/linux-defconfig_xen0_x86_322
-rw-r--r--buildconfigs/linux-defconfig_xen0_x86_642
-rw-r--r--buildconfigs/linux-defconfig_xen_ia642
-rw-r--r--buildconfigs/linux-defconfig_xen_x86_322
-rw-r--r--docs/Docs.mk12
-rw-r--r--docs/Makefile19
-rw-r--r--docs/xen-api/Makefile31
-rw-r--r--docs/xen-api/xenapi-datamodel.tex3167
-rw-r--r--linux-2.6-xen-sparse/arch/i386/kernel/vmlinux.lds.S1
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/smpboot.c10
-rw-r--r--tools/Rules.mk5
-rw-r--r--tools/blktap/Makefile4
-rw-r--r--tools/firmware/rombios/tcgbios.c38
-rw-r--r--tools/libxc/xc_dom_boot.c50
-rw-r--r--tools/libxc/xc_dom_ia64.c11
-rw-r--r--tools/libxc/xc_hvm_restore.c26
-rw-r--r--tools/libxc/xc_hvm_save.c6
-rw-r--r--tools/libxc/xc_linux_save.c4
-rw-r--r--tools/libxen/include/xen_cpu_feature.h387
-rw-r--r--tools/libxen/include/xen_crashdump.h206
-rw-r--r--tools/libxen/include/xen_crashdump_decl.h (renamed from tools/libxen/include/xen_cpu_feature_internal.h)23
-rw-r--r--tools/libxen/include/xen_driver_type.h77
-rw-r--r--tools/libxen/include/xen_host.h115
-rw-r--r--tools/libxen/include/xen_host_cpu.h9
-rw-r--r--tools/libxen/include/xen_host_metrics.h193
-rw-r--r--tools/libxen/include/xen_host_metrics_decl.h (renamed from tools/libxen/include/xen_driver_type_internal.h)23
-rw-r--r--tools/libxen/include/xen_pbd.h216
-rw-r--r--tools/libxen/include/xen_pbd_decl.h30
-rw-r--r--tools/libxen/include/xen_pif.h68
-rw-r--r--tools/libxen/include/xen_pif_metrics.h192
-rw-r--r--tools/libxen/include/xen_pif_metrics_decl.h30
-rw-r--r--tools/libxen/include/xen_sr.h13
-rw-r--r--tools/libxen/include/xen_vbd.h37
-rw-r--r--tools/libxen/include/xen_vdi.h29
-rw-r--r--tools/libxen/include/xen_vdi_type.h12
-rw-r--r--tools/libxen/include/xen_vif.h49
-rw-r--r--tools/libxen/include/xen_vm.h195
-rw-r--r--tools/libxen/include/xen_vm_metrics.h201
-rw-r--r--tools/libxen/include/xen_vm_metrics_decl.h30
-rw-r--r--tools/libxen/include/xen_vtpm.h18
-rw-r--r--tools/libxen/src/xen_cpu_feature.c143
-rw-r--r--tools/libxen/src/xen_crashdump.c199
-rw-r--r--tools/libxen/src/xen_driver_type.c81
-rw-r--r--tools/libxen/src/xen_host.c263
-rw-r--r--tools/libxen/src/xen_host_cpu.c23
-rw-r--r--tools/libxen/src/xen_host_metrics.c172
-rw-r--r--tools/libxen/src/xen_pbd.c228
-rw-r--r--tools/libxen/src/xen_pif.c134
-rw-r--r--tools/libxen/src/xen_pif_metrics.c172
-rw-r--r--tools/libxen/src/xen_sr.c5
-rw-r--r--tools/libxen/src/xen_vbd.c70
-rw-r--r--tools/libxen/src/xen_vdi.c60
-rw-r--r--tools/libxen/src/xen_vdi_type.c4
-rw-r--r--tools/libxen/src/xen_vif.c104
-rw-r--r--tools/libxen/src/xen_vm.c350
-rw-r--r--tools/libxen/src/xen_vm_metrics.c194
-rw-r--r--tools/libxen/src/xen_vtpm.c38
-rw-r--r--tools/libxen/test/test_bindings.c21
-rw-r--r--tools/pygrub/src/fsimage/fsimage.c4
-rw-r--r--tools/python/scripts/test_hvm_create.py12
-rw-r--r--tools/python/scripts/test_vm_create.py13
-rw-r--r--tools/python/scripts/xapi.py12
-rw-r--r--tools/python/xen/xend/XendAPI.py546
-rw-r--r--tools/python/xen/xend/XendAPIConstants.py14
-rw-r--r--tools/python/xen/xend/XendAuthSessions.py9
-rw-r--r--tools/python/xen/xend/XendConfig.py175
-rw-r--r--tools/python/xen/xend/XendDomain.py23
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py136
-rw-r--r--tools/python/xen/xend/XendError.py8
-rw-r--r--tools/python/xen/xend/XendNode.py80
-rw-r--r--tools/python/xen/xend/XendPIF.py54
-rw-r--r--tools/python/xen/xend/XendPIFMetrics.py47
-rw-r--r--tools/python/xen/xend/XendTask.py10
-rw-r--r--tools/python/xen/xend/XendTaskManager.py6
-rw-r--r--tools/python/xen/xend/XendVDI.py6
-rw-r--r--tools/python/xen/xend/image.py89
-rw-r--r--tools/python/xen/xend/server/ConsoleController.py6
-rw-r--r--tools/python/xen/xend/server/XMLRPCServer.py2
-rw-r--r--tools/python/xen/xend/server/vfbif.py69
-rw-r--r--tools/python/xen/xm/create.py6
-rw-r--r--tools/python/xen/xm/messages/en/xen-xm.po28
-rw-r--r--tools/security/Makefile3
-rw-r--r--tools/xenfb/Makefile2
-rw-r--r--tools/xm-test/tests/vtpm/09_vtpm-xapi.py121
-rw-r--r--xen/Makefile9
-rw-r--r--xen/acm/acm_chinesewall_hooks.c44
-rw-r--r--xen/acm/acm_core.c42
-rw-r--r--xen/acm/acm_policy.c84
-rw-r--r--xen/acm/acm_simple_type_enforcement_hooks.c34
-rw-r--r--xen/arch/ia64/linux-xen/perfmon.c2
-rw-r--r--xen/arch/ia64/linux-xen/setup.c9
-rw-r--r--xen/arch/ia64/linux-xen/sn/kernel/io_init.c4
-rw-r--r--xen/arch/ia64/linux-xen/unaligned.c2
-rw-r--r--xen/arch/ia64/xen/dom_fw.c44
-rw-r--r--xen/arch/ia64/xen/domain.c5
-rw-r--r--xen/arch/ia64/xen/gdbstub.c16
-rw-r--r--xen/arch/ia64/xen/oprofile/perfmon.c3
-rw-r--r--xen/arch/ia64/xen/xensetup.c19
-rw-r--r--xen/arch/powerpc/domain_build.c4
-rw-r--r--xen/arch/powerpc/of-devtree.c3
-rw-r--r--xen/arch/powerpc/ofd_fixup.c2
-rw-r--r--xen/arch/powerpc/setup.c4
-rw-r--r--xen/arch/x86/cpu/centaur.c3
-rw-r--r--xen/arch/x86/cpu/common.c10
-rw-r--r--xen/arch/x86/cpu/cyrix.c7
-rw-r--r--xen/arch/x86/cpu/intel.c2
-rw-r--r--xen/arch/x86/dmi_scan.c2
-rw-r--r--xen/arch/x86/domain.c8
-rw-r--r--xen/arch/x86/domain_build.c4
-rw-r--r--xen/arch/x86/domctl.c23
-rw-r--r--xen/arch/x86/hvm/hvm.c64
-rw-r--r--xen/arch/x86/hvm/i8254.c19
-rw-r--r--xen/arch/x86/hvm/intercept.c366
-rw-r--r--xen/arch/x86/hvm/rtc.c185
-rw-r--r--xen/arch/x86/hvm/svm/svm.c27
-rw-r--r--xen/arch/x86/hvm/vioapic.c46
-rw-r--r--xen/arch/x86/hvm/vlapic.c104
-rw-r--r--xen/arch/x86/hvm/vmx/vmx.c38
-rw-r--r--xen/arch/x86/hvm/vpic.c39
-rw-r--r--xen/arch/x86/oprofile/nmi_int.c35
-rw-r--r--xen/arch/x86/setup.c69
-rw-r--r--xen/arch/x86/time.c2
-rw-r--r--xen/common/gdbstub.c2
-rw-r--r--xen/common/kernel.c7
-rw-r--r--xen/common/kexec.c2
-rw-r--r--xen/common/keyhandler.c6
-rw-r--r--xen/common/lib.c9
-rw-r--r--xen/common/libelf/libelf-dominfo.c16
-rw-r--r--xen/common/libelf/libelf-private.h5
-rw-r--r--xen/common/perfc.c4
-rw-r--r--xen/common/rangeset.c5
-rw-r--r--xen/common/string.c97
-rw-r--r--xen/common/symbols.c10
-rw-r--r--xen/common/vsprintf.c52
-rw-r--r--xen/drivers/char/console.c4
-rw-r--r--xen/include/acm/acm_endian.h52
-rw-r--r--xen/include/asm-x86/hvm/domain.h15
-rw-r--r--xen/include/asm-x86/hvm/hvm.h4
-rw-r--r--xen/include/asm-x86/hvm/support.h218
-rw-r--r--xen/include/asm-x86/hvm/vpt.h9
-rw-r--r--xen/include/public/foreign/Makefile4
-rw-r--r--xen/include/public/hvm/save.h92
-rw-r--r--xen/include/xen/byteorder/big_endian.h4
-rw-r--r--xen/include/xen/byteorder/little_endian.h4
-rw-r--r--xen/include/xen/lib.h6
-rw-r--r--xen/include/xen/string.h29
148 files changed, 7190 insertions, 4149 deletions
diff --git a/Makefile b/Makefile
index 62b581062d..cac9547a3d 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ endif
install: install-xen install-kernels install-tools install-docs
.PHONY: build
-build: kernels build-headers
+build: kernels
$(MAKE) -C xen build
$(MAKE) -C tools build
$(MAKE) -C docs build
@@ -59,11 +59,11 @@ prep-kernels:
for i in $(XKERNELS) ; do $(MAKE) $$i-prep || exit 1; done
.PHONY: install-xen
-install-xen: build-headers
+install-xen:
$(MAKE) -C xen install
.PHONY: install-tools
-install-tools: build-headers
+install-tools:
$(MAKE) -C tools install
.PHONY: install-kernels
@@ -82,11 +82,6 @@ dev-docs:
.PHONY: kbuild
kbuild: kernels
-# generate header files
-.PHONY: build-headers
-build-headers:
- $(MAKE) -C xen/include/public/foreign
-
# Delete the kernel build trees entirely
.PHONY: kdelete
kdelete:
diff --git a/buildconfigs/linux-defconfig_xen0_ia64 b/buildconfigs/linux-defconfig_xen0_ia64
index 782c1f4925..9869aab066 100644
--- a/buildconfigs/linux-defconfig_xen0_ia64
+++ b/buildconfigs/linux-defconfig_xen0_ia64
@@ -1639,7 +1639,7 @@ CONFIG_XEN_PCIDEV_BACKEND=y
# CONFIG_XEN_PCIDEV_BACKEND_PASS is not set
CONFIG_XEN_PCIDEV_BACKEND_SLOT=y
# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
+CONFIG_XEN_TPMDEV_BACKEND=m
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
# CONFIG_XEN_FRAMEBUFFER is not set
diff --git a/buildconfigs/linux-defconfig_xen0_x86_32 b/buildconfigs/linux-defconfig_xen0_x86_32
index 2e3945f1fa..ad24086d00 100644
--- a/buildconfigs/linux-defconfig_xen0_x86_32
+++ b/buildconfigs/linux-defconfig_xen0_x86_32
@@ -1404,7 +1404,7 @@ CONFIG_XEN_PCIDEV_BACKEND=y
CONFIG_XEN_PCIDEV_BACKEND_PASS=y
# CONFIG_XEN_PCIDEV_BACKEND_SLOT is not set
# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
+CONFIG_XEN_TPMDEV_BACKEND=m
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_SCRUB_PAGES=y
diff --git a/buildconfigs/linux-defconfig_xen0_x86_64 b/buildconfigs/linux-defconfig_xen0_x86_64
index d93d10d1cb..ea1ec55f79 100644
--- a/buildconfigs/linux-defconfig_xen0_x86_64
+++ b/buildconfigs/linux-defconfig_xen0_x86_64
@@ -1354,7 +1354,7 @@ CONFIG_XEN_PCIDEV_BACKEND=y
CONFIG_XEN_PCIDEV_BACKEND_PASS=y
# CONFIG_XEN_PCIDEV_BACKEND_SLOT is not set
# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
+CONFIG_XEN_TPMDEV_BACKEND=m
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_SCRUB_PAGES=y
diff --git a/buildconfigs/linux-defconfig_xen_ia64 b/buildconfigs/linux-defconfig_xen_ia64
index 0d9c15f989..25253bc891 100644
--- a/buildconfigs/linux-defconfig_xen_ia64
+++ b/buildconfigs/linux-defconfig_xen_ia64
@@ -1639,7 +1639,7 @@ CONFIG_XEN_PCIDEV_BACKEND=y
# CONFIG_XEN_PCIDEV_BACKEND_PASS is not set
CONFIG_XEN_PCIDEV_BACKEND_SLOT=y
# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
+CONFIG_XEN_TPMDEV_BACKEND=m
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_FRAMEBUFFER=y
diff --git a/buildconfigs/linux-defconfig_xen_x86_32 b/buildconfigs/linux-defconfig_xen_x86_32
index fedfa15cce..328b86d938 100644
--- a/buildconfigs/linux-defconfig_xen_x86_32
+++ b/buildconfigs/linux-defconfig_xen_x86_32
@@ -3261,7 +3261,7 @@ CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
# CONFIG_XEN_PCIDEV_BACKEND_PASS is not set
# CONFIG_XEN_PCIDEV_BACKEND_SLOT is not set
# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
+CONFIG_XEN_TPMDEV_BACKEND=m
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_FRAMEBUFFER=y
diff --git a/docs/Docs.mk b/docs/Docs.mk
new file mode 100644
index 0000000000..bc7c3befbd
--- /dev/null
+++ b/docs/Docs.mk
@@ -0,0 +1,12 @@
+PS2PDF := ps2pdf
+DVIPS := dvips
+LATEX := latex
+FIG2DEV := fig2dev
+LATEX2HTML := latex2html
+DOXYGEN := doxygen
+POD2MAN := pod2man
+DOT := dot
+
+pkgdocdir := /usr/share/doc/xen
+mandir := /usr/share/man
+
diff --git a/docs/Makefile b/docs/Makefile
index 0432855384..bc80193dd0 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -2,20 +2,10 @@
XEN_ROOT=..
include $(XEN_ROOT)/Config.mk
+include $(XEN_ROOT)/docs/Docs.mk
VERSION = xen-unstable
-PS2PDF := ps2pdf
-DVIPS := dvips
-LATEX := latex
-FIG2DEV := fig2dev
-LATEX2HTML := latex2html
-DOXYGEN := doxygen
-POD2MAN := pod2man
-
-pkgdocdir := /usr/share/doc/xen
-mandir := /usr/share/man
-
DOC_MAN5SRC := $(wildcard man/*.pod.5)
DOC_MAN1SRC := $(wildcard man/*.pod.1)
DOC_MAN1 := $(patsubst man/%.pod.1,man1/%.1,$(DOC_MAN1SRC))
@@ -32,6 +22,9 @@ all: build
.PHONY: build
build: ps pdf html man-pages
+ @if which $(DOT) 1>/dev/null 2>/dev/null ; then \
+ $(MAKE) -C xen-api build ; else \
+ echo "Graphviz (dot) not installed; skipping xen-api." ; fi
rm -f *.aux *.dvi *.bbl *.blg *.glo *.idx *.ilg *.log *.ind *.toc
.PHONY: dev-docs
@@ -74,6 +67,7 @@ man5/%.5: man/%.pod.5 Makefile
.PHONY: clean
clean:
+ $(MAKE) -C xen-api clean
rm -rf .word_count *.aux *.dvi *.bbl *.blg *.glo *.idx *~
rm -rf *.ilg *.log *.ind *.toc *.bak core
rm -rf $(GFX) ps pdf html
@@ -88,6 +82,9 @@ distclean: clean
install: all
rm -rf $(DESTDIR)$(pkgdocdir)
$(INSTALL_DIR) $(DESTDIR)$(pkgdocdir)
+
+ $(MAKE) -C xen-api install
+
cp -dR ps $(DESTDIR)$(pkgdocdir)
cp -dR pdf $(DESTDIR)$(pkgdocdir)
$(INSTALL_DIR) $(DESTDIR)$(mandir)
diff --git a/docs/xen-api/Makefile b/docs/xen-api/Makefile
index 7dfb1bfbec..dbc923137c 100644
--- a/docs/xen-api/Makefile
+++ b/docs/xen-api/Makefile
@@ -1,22 +1,41 @@
+#!/usr/bin/make -f
+
+XEN_ROOT=../..
+include $(XEN_ROOT)/Config.mk
+include $(XEN_ROOT)/docs/Docs.mk
+
+
TEX := $(wildcard *.tex)
EPS := $(wildcard *.eps)
EPSDOT := $(patsubst %.dot,%.eps,$(wildcard *.dot))
.PHONY: all
-all: xenapi.pdf xenapi.ps
+all: build
+
+.PHONY: build
+build: xenapi.pdf xenapi.ps
+
+install:
+ $(INSTALL_DIR) $(DESTDIR)$(pkgdocdir)/ps
+ $(INSTALL_DIR) $(DESTDIR)$(pkgdocdir)/pdf
+
+ cp xenapi.ps $(DESTDIR)$(pkgdocdir)/ps
+ cp xenapi.pdf $(DESTDIR)$(pkgdocdir)/pdf
+
xenapi.dvi: $(TEX) $(EPS) $(EPSDOT)
- latex xenapi.tex
- latex xenapi.tex
+ $(LATEX) xenapi.tex
+ $(LATEX) xenapi.tex
+ rm -f *.aux *.log
%.pdf: %.ps
- ps2pdf $< $@
+ $(PS2PDF) $< $@
%.ps: %.dvi
- dvips $< -o $@
+ $(DVIPS) $< -o $@
%.eps: %.dot
- dot -Tps $< >$@
+ $(DOT) -Tps $< >$@
.PHONY: clean
clean:
diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex
index 3d74a76302..edfb8890bd 100644
--- a/docs/xen-api/xenapi-datamodel.tex
+++ b/docs/xen-api/xenapi-datamodel.tex
@@ -25,14 +25,19 @@ Name & Description \\
{\tt session} & A session \\
{\tt task} & A long-running asynchronous task \\
{\tt VM} & A virtual machine (or 'guest') \\
+{\tt VM\_metrics} & The metrics associated with a VM \\
{\tt host} & A physical host \\
+{\tt host\_metrics} & The metrics associated with a host \\
{\tt host\_cpu} & A physical CPU \\
{\tt network} & A virtual network \\
{\tt VIF} & A virtual network interface \\
{\tt PIF} & A physical network interface (note separate VLANs are represented as several PIFs) \\
+{\tt PIF\_metrics} & The metrics associated with a physical network interface \\
{\tt SR} & A storage repository \\
{\tt VDI} & A virtual disk image \\
{\tt VBD} & A virtual block device \\
+{\tt PBD} & The physical block devices through which hosts access SRs \\
+{\tt crashdump} & A VM crashdump \\
{\tt VTPM} & A virtual TPM device \\
{\tt console} & A console \\
{\tt user} & A user of the system \\
@@ -46,11 +51,17 @@ Fields that are bound together are shown in the following table:
{\em object.field} & {\em object.field} & {\em relationship} \\
\hline
+host.PBDs & PBD.host & many-to-one\\
+SR.PBDs & PBD.SR & many-to-one\\
VDI.VBDs & VBD.VDI & many-to-one\\
-VDI.parent & VDI.children & one-to-many\\
+VDI.crash\_dumps & crashdump.VDI & many-to-one\\
VBD.VM & VM.VBDs & one-to-many\\
+crashdump.VM & VM.crash\_dumps & one-to-many\\
VIF.VM & VM.VIFs & one-to-many\\
VIF.network & network.VIFs & one-to-many\\
+host.metrics & host\_metrics.host & one-to-one\\
+PIF.metrics & PIF\_metrics.PIF & one-to-one\\
+VM.metrics & VM\_metrics.VM & one-to-one\\
PIF.host & host.PIFs & one-to-many\\
PIF.network & network.PIFs & one-to-many\\
SR.VDIs & VDI.SR & many-to-one\\
@@ -117,6 +128,8 @@ The following enumeration types are used:
\hspace{0.5cm}{\tt system} & a disk that may be replaced on upgrade \\
\hspace{0.5cm}{\tt user} & a disk that is always preserved on upgrade \\
\hspace{0.5cm}{\tt ephemeral} & a disk that may be reformatted on upgrade \\
+\hspace{0.5cm}{\tt suspend} & a disk that stores a suspend image \\
+\hspace{0.5cm}{\tt crashdump} & a disk that stores VM crashdump information \\
\hline
\end{longtable}
@@ -137,83 +150,22 @@ The following enumeration types are used:
\vspace{1cm}
\begin{longtable}{|ll|}
\hline
-{\tt enum task\_status\_type} & \\
+{\tt enum task\_allowed\_operations} & \\
\hline
-\hspace{0.5cm}{\tt pending} & task is in progress \\
-\hspace{0.5cm}{\tt success} & task was completed successfully \\
-\hspace{0.5cm}{\tt failure} & task has failed \\
+\hspace{0.5cm}{\tt Cancel} & Cancel \\
\hline
\end{longtable}
\vspace{1cm}
\begin{longtable}{|ll|}
\hline
-{\tt enum cpu\_feature} & \\
+{\tt enum task\_status\_type} & \\
\hline
-\hspace{0.5cm}{\tt FPU} & Onboard FPU \\
-\hspace{0.5cm}{\tt VME} & Virtual Mode Extensions \\
-\hspace{0.5cm}{\tt DE} & Debugging Extensions \\
-\hspace{0.5cm}{\tt PSE} & Page Size Extensions \\
-\hspace{0.5cm}{\tt TSC} & Time Stamp Counter \\
-\hspace{0.5cm}{\tt MSR} & Model-Specific Registers, RDMSR, WRMSR \\
-\hspace{0.5cm}{\tt PAE} & Physical Address Extensions \\
-\hspace{0.5cm}{\tt MCE} & Machine Check Architecture \\
-\hspace{0.5cm}{\tt CX8} & CMPXCHG8 instruction \\
-\hspace{0.5cm}{\tt APIC} & Onboard APIC \\
-\hspace{0.5cm}{\tt SEP} & SYSENTER/SYSEXIT \\
-\hspace{0.5cm}{\tt MTRR} & Memory Type Range Registers \\
-\hspace{0.5cm}{\tt PGE} & Page Global Enable \\
-\hspace{0.5cm}{\tt MCA} & Machine Check Architecture \\
-\hspace{0.5cm}{\tt CMOV} & CMOV instruction (FCMOVCC and FCOMI too if FPU present) \\
-\hspace{0.5cm}{\tt PAT} & Page Attribute Table \\
-\hspace{0.5cm}{\tt PSE36} & 36-bit PSEs \\
-\hspace{0.5cm}{\tt PN} & Processor serial number \\
-\hspace{0.5cm}{\tt CLFLSH} & Supports the CLFLUSH instruction \\
-\hspace{0.5cm}{\tt DTES} & Debug Trace Store \\
-\hspace{0.5cm}{\tt ACPI} & ACPI via MSR \\
-\hspace{0.5cm}{\tt MMX} & Multimedia Extensions \\
-\hspace{0.5cm}{\tt FXSR} & FXSAVE and FXRSTOR instructions (fast save and restore \\
-\hspace{0.5cm}{\tt XMM} & Streaming SIMD Extensions \\
-\hspace{0.5cm}{\tt XMM2} & Streaming SIMD Extensions-2 \\
-\hspace{0.5cm}{\tt SELFSNOOP} & CPU self snoop \\
-\hspace{0.5cm}{\tt HT} & Hyper-Threading \\
-\hspace{0.5cm}{\tt ACC} & Automatic clock control \\
-\hspace{0.5cm}{\tt IA64} & IA-64 processor \\
-\hspace{0.5cm}{\tt SYSCALL} & SYSCALL/SYSRET \\
-\hspace{0.5cm}{\tt MP} & MP Capable. \\
-\hspace{0.5cm}{\tt NX} & Execute Disable \\
-\hspace{0.5cm}{\tt MMXEXT} & AMD MMX extensions \\
-\hspace{0.5cm}{\tt LM} & Long Mode (x86-64) \\
-\hspace{0.5cm}{\tt THREEDNOWEXT} & AMD 3DNow! extensions \\
-\hspace{0.5cm}{\tt THREEDNOW} & 3DNow! \\
-\hspace{0.5cm}{\tt RECOVERY} & CPU in recovery mode \\
-\hspace{0.5cm}{\tt LONGRUN} & Longrun power control \\
-\hspace{0.5cm}{\tt LRTI} & LongRun table interface \\
-\hspace{0.5cm}{\tt CXMMX} & Cyrix MMX extensions \\
-\hspace{0.5cm}{\tt K6\_MTRR} & AMD K6 nonstandard MTRRs \\
-\hspace{0.5cm}{\tt CYRIX\_ARR} & Cyrix ARRs (= MTRRs) \\
-\hspace{0.5cm}{\tt CENTAUR\_MCR} & Centaur MCRs (= MTRRs) \\
-\hspace{0.5cm}{\tt K8} & Opteron, Athlon64 \\
-\hspace{0.5cm}{\tt K7} & Athlon \\
-\hspace{0.5cm}{\tt P3} & P3 \\
-\hspace{0.5cm}{\tt P4} & P4 \\
-\hspace{0.5cm}{\tt CONSTANT\_TSC} & TSC ticks at a constant rate \\
-\hspace{0.5cm}{\tt FXSAVE\_LEAK} & FXSAVE leaks FOP/FIP/FOP \\
-\hspace{0.5cm}{\tt XMM3} & Streaming SIMD Extensions-3 \\
-\hspace{0.5cm}{\tt MWAIT} & Monitor/Mwait support \\
-\hspace{0.5cm}{\tt DSCPL} & CPL Qualified Debug Store \\
-\hspace{0.5cm}{\tt EST} & Enhanced SpeedStep \\
-\hspace{0.5cm}{\tt TM2} & Thermal Monitor 2 \\
-\hspace{0.5cm}{\tt CID} & Context ID \\
-\hspace{0.5cm}{\tt CX16} & CMPXCHG16B \\
-\hspace{0.5cm}{\tt XTPR} & Send Task Priority Messages \\
-\hspace{0.5cm}{\tt XSTORE} & on-CPU RNG present (xstore insn) \\
-\hspace{0.5cm}{\tt XSTORE\_EN} & on-CPU RNG enabled \\
-\hspace{0.5cm}{\tt XCRYPT} & on-CPU crypto (xcrypt insn) \\
-\hspace{0.5cm}{\tt XCRYPT\_EN} & on-CPU crypto enabled \\
-\hspace{0.5cm}{\tt LAHF\_LM} & LAHF/SAHF in long mode \\
-\hspace{0.5cm}{\tt CMP\_LEGACY} & If yes HyperThreading not valid \\
-\hspace{0.5cm}{\tt VMX} & VMX instruction set \\
+\hspace{0.5cm}{\tt pending} & task is in progress \\
+\hspace{0.5cm}{\tt success} & task was completed successfully \\
+\hspace{0.5cm}{\tt failure} & task has failed \\
+\hspace{0.5cm}{\tt cancelling} & task is being cancelled \\
+\hspace{0.5cm}{\tt cancelled} & task has been cancelled \\
\hline
\end{longtable}
@@ -262,16 +214,6 @@ The following enumeration types are used:
\end{longtable}
\vspace{1cm}
-\begin{longtable}{|ll|}
-\hline
-{\tt enum driver\_type} & \\
-\hline
-\hspace{0.5cm}{\tt ioemu} & use hardware emulation \\
-\hspace{0.5cm}{\tt paravirtualised} & use paravirtualised driver \\
-\hline
-\end{longtable}
-
-\vspace{1cm}
\newpage
\section{Class: session}
@@ -279,13 +221,14 @@ The following enumeration types are used:
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf session} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A session}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+session.}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
-$\mathit{RO}_\mathit{ins}$ & {\tt this\_host} & host ref & Currently connected host \\
-$\mathit{RO}_\mathit{ins}$ & {\tt this\_user} & user ref & Currently connected user \\
+$\mathit{RO}_\mathit{run}$ & {\tt this\_host} & host ref & Currently connected host \\
+$\mathit{RO}_\mathit{run}$ & {\tt this\_user} & user ref & Currently connected user \\
$\mathit{RO}_\mathit{run}$ & {\tt last\_active} & int & Timestamp for last time session was active \\
\hline
\end{longtable}
@@ -293,7 +236,7 @@ $\mathit{RO}_\mathit{run}$ & {\tt last\_active} & int & Timestamp for last time
\subsubsection{RPC name:~login\_with\_password}
{\bf Overview:}
-Attempt to authenticate the user, returning a session\_id if successful
+Attempt to authenticate the user, returning a session\_id if successful.
\noindent {\bf Signature:}
\begin{verbatim} (session ref) login_with_password (string uname, string pwd)\end{verbatim}
@@ -327,7 +270,7 @@ ID of newly created session
\subsubsection{RPC name:~logout}
{\bf Overview:}
-Log out of a session
+Log out of a session.
\noindent {\bf Signature:}
\begin{verbatim} void logout (session_id s)\end{verbatim}
@@ -545,83 +488,91 @@ all fields from the object
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf task} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A long-running asynchronous task}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+long-running asynchronous task.}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
-$\mathit{RW}$ & {\tt name/label} & string & a human-readable name \\
-$\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-readable description \\
+$\mathit{RO}_\mathit{run}$ & {\tt name/label} & string & a human-readable name \\
+$\mathit{RO}_\mathit{run}$ & {\tt name/description} & string & a notes field containg human-readable description \\
$\mathit{RO}_\mathit{run}$ & {\tt status} & task\_status\_type & current status of the task \\
+$\mathit{RO}_\mathit{run}$ & {\tt session} & session ref & the session that created the task \\
$\mathit{RO}_\mathit{run}$ & {\tt progress} & int & if the task is still pending, this field contains the estimated percentage complete (0-100). If task has completed (successfully or unsuccessfully) this should be 100. \\
-$\mathit{RO}_\mathit{run}$ & {\tt eta} & datetime & if the task is still pending, this field contains the estimated completion time. If the task has finished (successfully or not) it contains the time the task finished. \\
$\mathit{RO}_\mathit{run}$ & {\tt type} & string & if the task has completed successfully, this field contains the type of the encoded result (i.e. name of the class whose reference is in the result field). Undefined otherwise. \\
$\mathit{RO}_\mathit{run}$ & {\tt result} & string & if the task has completed successfully, this field contains the result value (either Void or an object reference). Undefined otherwise. \\
$\mathit{RO}_\mathit{run}$ & {\tt error\_code} & int & if the task has failed, this field contains the error code. Undefined otherwise. \\
$\mathit{RO}_\mathit{run}$ & {\tt error\_info} & string Set & if the task has failed, this field contains the set of associated error strings. Undefined otherwise. \\
+$\mathit{RO}_\mathit{run}$ & {\tt allowed\_operations} & (task\_allowed\_operations) Set & Operations allowed on this task \\
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: task}
-\subsubsection{RPC name:~get\_all}
+\subsubsection{RPC name:~cancel}
{\bf Overview:}
-Return a list of all the tasks known to the system.
+Cancel this task. If task.allowed\_operations does not contain Cancel,
+then this will fail with OPERATION\_NOT\_ALLOWED. The task will show the
+status 'cancelling', and you should continue to check its status until it
+shows 'cancelled'. There is no guarantee as to the time within which this
+task will be cancelled.
\noindent {\bf Signature:}
-\begin{verbatim} ((task ref) Set) get_all (session_id s)\end{verbatim}
+\begin{verbatim} void cancel (session_id s, task ref task)\end{verbatim}
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt task ref } & task & The task \\ \hline
+
+\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-(task ref) Set
+void
}
-references to all objects
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_uuid}
-{\bf Overview:}
-Get the uuid field of the given task.
+\vspace{0.3cm}
- \noindent {\bf Signature:}
-\begin{verbatim} string get_uuid (session_id s, task ref self)\end{verbatim}
+\noindent{\bf Possible Error Codes:} {\tt OPERATION\_NOT\_ALLOWED}
+\vspace{0.6cm}
+\subsubsection{RPC name:~get\_all}
-\noindent{\bf Arguments:}
+{\bf Overview:}
+Return a list of all the tasks known to the system.
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt task ref } & self & reference to the object \\ \hline
+ \noindent {\bf Signature:}
+\begin{verbatim} ((task ref) Set) get_all (session_id s)\end{verbatim}
-\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-string
+(task ref) Set
}
-value of the field
+references to all objects
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_name\_label}
+\subsubsection{RPC name:~get\_uuid}
{\bf Overview:}
-Get the name/label field of the given task.
+Get the uuid field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} string get_name_label (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} string get_uuid (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -647,13 +598,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_name\_label}
+\subsubsection{RPC name:~get\_name\_label}
{\bf Overview:}
-Set the name/label field of the given task.
+Get the name/label field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} void set_name_label (session_id s, task ref self, string value)\end{verbatim}
+\begin{verbatim} string get_name_label (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -665,19 +616,17 @@ Set the name/label field of the given task.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt task ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+string
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
@@ -713,13 +662,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_name\_description}
+\subsubsection{RPC name:~get\_status}
{\bf Overview:}
-Set the name/description field of the given task.
+Get the status field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} void set_name_description (session_id s, task ref self, string value)\end{verbatim}
+\begin{verbatim} (task_status_type) get_status (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -731,29 +680,27 @@ Set the name/description field of the given task.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt task ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+task\_status\_type
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_status}
+\subsubsection{RPC name:~get\_session}
{\bf Overview:}
-Get the status field of the given task.
+Get the session field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} (task_status_type) get_status (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} (session ref) get_session (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -771,7 +718,7 @@ Get the status field of the given task.
\noindent {\bf Return Type:}
{\tt
-task\_status\_type
+session ref
}
@@ -811,13 +758,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_eta}
+\subsubsection{RPC name:~get\_type}
{\bf Overview:}
-Get the eta field of the given task.
+Get the type field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} datetime get_eta (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} string get_type (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -835,7 +782,7 @@ Get the eta field of the given task.
\noindent {\bf Return Type:}
{\tt
-datetime
+string
}
@@ -843,13 +790,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_type}
+\subsubsection{RPC name:~get\_result}
{\bf Overview:}
-Get the type field of the given task.
+Get the result field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} string get_type (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} string get_result (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -875,13 +822,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_result}
+\subsubsection{RPC name:~get\_error\_code}
{\bf Overview:}
-Get the result field of the given task.
+Get the error\_code field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} string get_result (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} int get_error_code (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -899,7 +846,7 @@ Get the result field of the given task.
\noindent {\bf Return Type:}
{\tt
-string
+int
}
@@ -907,13 +854,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_error\_code}
+\subsubsection{RPC name:~get\_error\_info}
{\bf Overview:}
-Get the error\_code field of the given task.
+Get the error\_info field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} int get_error_code (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} (string Set) get_error_info (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -931,7 +878,7 @@ Get the error\_code field of the given task.
\noindent {\bf Return Type:}
{\tt
-int
+string Set
}
@@ -939,13 +886,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_error\_info}
+\subsubsection{RPC name:~get\_allowed\_operations}
{\bf Overview:}
-Get the error\_info field of the given task.
+Get the allowed\_operations field of the given task.
\noindent {\bf Signature:}
-\begin{verbatim} (string Set) get_error_info (session_id s, task ref self)\end{verbatim}
+\begin{verbatim} ((task_allowed_operations) Set) get_allowed_operations (session_id s, task ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -963,7 +910,7 @@ Get the error\_info field of the given task.
\noindent {\bf Return Type:}
{\tt
-string Set
+(task\_allowed\_operations) Set
}
@@ -1075,7 +1022,8 @@ references to objects with match names
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VM} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual machine (or 'guest').
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+virtual machine (or 'guest').
VM booting is controlled by setting one of the two mutually exclusive
groups: "PV", and "HVM". If HVM.boot is the empty string, then paravirtual
@@ -1089,7 +1037,10 @@ control domain to some other bootloader. The other fields, PV/kernel,
PV/ramdisk, PV/args and PV/bootloader\_args will be passed to the
bootloader unmodified, and interpretation of those fields is then specific
to the bootloader itself, including the possibility that the bootloader
-will ignore some or all of those given values.
+will ignore some or all of those given values. Finally the paths of all
+bootable disks are added to the bootloader commandline (a disk is bootable
+if its VBD has the bootable flag set). There may be zero, one or many
+bootable disks; the bootloader decides which disk (if any) to boot from.
If the bootloader is pygrub, then the menu.lst is parsed if present in the
guest's filesystem, otherwise the specified kernel and ramdisk are used, or
@@ -1102,7 +1053,7 @@ ramdisk values will be treated as paths within the control domain. If both
PV/bootloader and PV/kernel are empty, then the behaviour is as if
PV/bootloader was specified as "pygrub".
-When using HVM booting, HVM/boot specifies the order of the boot devices}} \\
+When using HVM booting, HVM/boot specifies the order of the boot devices.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -1113,27 +1064,25 @@ $\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-
$\mathit{RW}$ & {\tt user\_version} & int & a user version number for this machine \\
$\mathit{RW}$ & {\tt is\_a\_template} & bool & true if this is a template. Template VMs can never be started, they are used only for cloning other VMs \\
$\mathit{RW}$ & {\tt auto\_power\_on} & bool & true if this VM should be started automatically after host boot \\
+$\mathit{RO}_\mathit{run}$ & {\tt suspend\_VDI} & VDI ref & The VDI that a suspend image is stored on. (Only has meaning if VM is currently suspended) \\
$\mathit{RO}_\mathit{run}$ & {\tt resident\_on} & host ref & the host the VM is currently resident on \\
-$\mathit{RO}_\mathit{ins}$ & {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\
+$\mathit{RW}$ & {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\
$\mathit{RW}$ & {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\
-$\mathit{RO}_\mathit{run}$ & {\tt memory/actual} & int & Guest's actual usage (bytes) \\
$\mathit{RW}$ & {\tt memory/dynamic\_min} & int & Dynamic minimum (bytes) \\
-$\mathit{RO}_\mathit{ins}$ & {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum (bytes) \\
+$\mathit{RW}$ & {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum (bytes) \\
$\mathit{RW}$ & {\tt VCPUs/policy} & string & the name of the VCPU scheduling policy to be applied \\
-$\mathit{RW}$ & {\tt VCPUs/params} & string & string-encoded parameters passed to selected VCPU policy \\
-$\mathit{RW}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\
+$\mathit{RW}$ & {\tt VCPUs/params} & (string $\rightarrow$ string) Map & configuration parameters for the selected VCPU policy \\
+$\mathit{RW}$ & {\tt VCPUs/max} & int & Max number of VCPUs \\
+$\mathit{RW}$ & {\tt VCPUs/at\_startup} & int & Boot number of VCPUs \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\
$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\
-$\mathit{RO}_\mathit{ins}$ & {\tt VCPUs/features/required} & (cpu\_feature) Set & CPU features the guest demands the host supports \\
-$\mathit{RO}_\mathit{ins}$ & {\tt VCPUs/features/can\_use} & (cpu\_feature) Set & CPU features the guest can use if available \\
-$\mathit{RW}$ & {\tt VCPUs/features/force\_on} & (cpu\_feature) Set & CPU features to expose to the guest above the bare minimum \\
-$\mathit{RW}$ & {\tt VCPUs/features/force\_off} & (cpu\_feature) Set & CPU features to hide to the guest \\
$\mathit{RW}$ & {\tt actions/after\_shutdown} & on\_normal\_exit & action to take after the guest has shutdown itself \\
$\mathit{RW}$ & {\tt actions/after\_reboot} & on\_normal\_exit & action to take after the guest has rebooted itself \\
-$\mathit{RW}$ & {\tt actions/after\_suspend} & on\_normal\_exit & action to take after the guest has suspended itself \\
$\mathit{RW}$ & {\tt actions/after\_crash} & on\_crash\_behaviour & action to take if the guest crashes \\
$\mathit{RO}_\mathit{run}$ & {\tt consoles} & (console ref) Set & virtual console devices \\
$\mathit{RO}_\mathit{run}$ & {\tt VIFs} & (VIF ref) Set & virtual network interfaces \\
$\mathit{RO}_\mathit{run}$ & {\tt VBDs} & (VBD ref) Set & virtual block devices \\
+$\mathit{RO}_\mathit{run}$ & {\tt crash\_dumps} & (crashdump ref) Set & crash dumps associated with this VM \\
$\mathit{RO}_\mathit{run}$ & {\tt VTPMs} & (VTPM ref) Set & virtual TPMs \\
$\mathit{RW}$ & {\tt PV/bootloader} & string & name of or path to bootloader \\
$\mathit{RW}$ & {\tt PV/kernel} & string & path to the kernel \\
@@ -1148,14 +1097,19 @@ $\mathit{RW}$ & {\tt platform/clock\_offset} & bool & timeshift applied to gues
$\mathit{RW}$ & {\tt platform/enable\_audio} & bool & emulate audio \\
$\mathit{RO}_\mathit{ins}$ & {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\
$\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\
-$\mathit{RW}$ & {\tt otherConfig} & (string $\rightarrow$ string) Map & additional configuration \\
+$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
+$\mathit{RO}_\mathit{run}$ & {\tt is\_control\_domain} & bool & true if this is a control domain (domain 0 or a driver domain) \\
+$\mathit{RO}_\mathit{ins}$ & {\tt metrics} & VM\_metrics ref & metrics associated with this VM. \\
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: VM}
\subsubsection{RPC name:~clone}
{\bf Overview:}
-Clones the specified VM, making a new VM. Clone automatically exploits the capabilities of the underlying storage repository in which the VM's disk images are stored (e.g. Copy on Write). This function can only be called when the VM is in the Halted State.
+Clones the specified VM, making a new VM. Clone automatically exploits the
+capabilities of the underlying storage repository in which the VM's disk
+images are stored (e.g. Copy on Write). This function can only be called
+when the VM is in the Halted State.
\noindent {\bf Signature:}
\begin{verbatim} (VM ref) clone (session_id s, VM ref vm, string new_name)\end{verbatim}
@@ -1191,7 +1145,8 @@ The ID of the newly created VM.
\subsubsection{RPC name:~start}
{\bf Overview:}
-Start the specified VM. This function can only be called with the VM is in the Halted State.
+Start the specified VM. This function can only be called with the VM is in
+the Halted State.
\noindent {\bf Signature:}
\begin{verbatim} void start (session_id s, VM ref vm, bool start_paused)\end{verbatim}
@@ -1227,7 +1182,8 @@ void
\subsubsection{RPC name:~pause}
{\bf Overview:}
-Pause the specified VM. This can only be called when the specified VM is in the Running state.
+Pause the specified VM. This can only be called when the specified VM is in
+the Running state.
\noindent {\bf Signature:}
\begin{verbatim} void pause (session_id s, VM ref vm)\end{verbatim}
@@ -1261,7 +1217,8 @@ void
\subsubsection{RPC name:~unpause}
{\bf Overview:}
-Resume the specified VM. This can only be called when the specified VM is in the Paused state.
+Resume the specified VM. This can only be called when the specified VM is
+in the Paused state.
\noindent {\bf Signature:}
\begin{verbatim} void unpause (session_id s, VM ref vm)\end{verbatim}
@@ -1295,9 +1252,11 @@ void
\subsubsection{RPC name:~clean\_shutdown}
{\bf Overview:}
-Attempt to cleanly shutdown the specified VM. (Note: this may not be supported---e.g. if a guest agent is not installed).
+Attempt to cleanly shutdown the specified VM. (Note: this may not be
+supported---e.g. if a guest agent is not installed).
-Once shutdown has been completed perform poweroff action specified in guest configuration.
+Once shutdown has been completed perform poweroff action specified in guest
+configuration.
This can only be called when the specified VM is in the Running state.
@@ -1333,9 +1292,11 @@ void
\subsubsection{RPC name:~clean\_reboot}
{\bf Overview:}
-Attempt to cleanly shutdown the specified VM (Note: this may not be supported---e.g. if a guest agent is not installed).
+Attempt to cleanly shutdown the specified VM (Note: this may not be
+supported---e.g. if a guest agent is not installed).
-Once shutdown has been completed perform reboot action specified in guest configuration.
+Once shutdown has been completed perform reboot action specified in guest
+configuration.
This can only be called when the specified VM is in the Running state.
@@ -1371,7 +1332,8 @@ void
\subsubsection{RPC name:~hard\_shutdown}
{\bf Overview:}
-Stop executing the specified VM without attempting a clean shutdown. Then perform poweroff action specified in VM configuration.
+Stop executing the specified VM without attempting a clean shutdown. Then
+perform poweroff action specified in VM configuration.
\noindent {\bf Signature:}
\begin{verbatim} void hard_shutdown (session_id s, VM ref vm)\end{verbatim}
@@ -1403,7 +1365,8 @@ void
\subsubsection{RPC name:~hard\_reboot}
{\bf Overview:}
-Stop executing the specified VM without attempting a clean shutdown. Then perform reboot action specified in VM configuration
+Stop executing the specified VM without attempting a clean shutdown. Then
+perform reboot action specified in VM configuration.
\noindent {\bf Signature:}
\begin{verbatim} void hard_reboot (session_id s, VM ref vm)\end{verbatim}
@@ -1435,7 +1398,8 @@ void
\subsubsection{RPC name:~suspend}
{\bf Overview:}
-Suspend the specified VM to disk. This can only be called when the specified VM is in the Running state.
+Suspend the specified VM to disk. This can only be called when the
+specified VM is in the Running state.
\noindent {\bf Signature:}
\begin{verbatim} void suspend (session_id s, VM ref vm)\end{verbatim}
@@ -1469,7 +1433,8 @@ void
\subsubsection{RPC name:~resume}
{\bf Overview:}
-Awaken the specified VM and resume it. This can only be called when the specified VM is in the Suspended state.
+Awaken the specified VM and resume it. This can only be called when the
+specified VM is in the Suspended state.
\noindent {\bf Signature:}
\begin{verbatim} void resume (session_id s, VM ref vm, bool start_paused)\end{verbatim}
@@ -1917,13 +1882,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_resident\_on}
+\subsubsection{RPC name:~get\_suspend\_VDI}
{\bf Overview:}
-Get the resident\_on field of the given VM.
+Get the suspend\_VDI field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} (host ref) get_resident_on (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} (VDI ref) get_suspend_VDI (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -1941,7 +1906,7 @@ Get the resident\_on field of the given VM.
\noindent {\bf Return Type:}
{\tt
-host ref
+VDI ref
}
@@ -1949,13 +1914,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_static\_max}
+\subsubsection{RPC name:~get\_resident\_on}
{\bf Overview:}
-Get the memory/static\_max field of the given VM.
+Get the resident\_on field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} int get_memory_static_max (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} (host ref) get_resident_on (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -1973,7 +1938,7 @@ Get the memory/static\_max field of the given VM.
\noindent {\bf Return Type:}
{\tt
-int
+host ref
}
@@ -1981,13 +1946,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_dynamic\_max}
+\subsubsection{RPC name:~get\_memory\_static\_max}
{\bf Overview:}
-Get the memory/dynamic\_max field of the given VM.
+Get the memory/static\_max field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} int get_memory_dynamic_max (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} int get_memory_static_max (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2013,13 +1978,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_memory\_dynamic\_max}
+\subsubsection{RPC name:~set\_memory\_static\_max}
{\bf Overview:}
-Set the memory/dynamic\_max field of the given VM.
+Set the memory/static\_max field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_memory_dynamic_max (session_id s, VM ref self, int value)\end{verbatim}
+\begin{verbatim} void set_memory_static_max (session_id s, VM ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2047,45 +2012,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_actual}
-
-{\bf Overview:}
-Get the memory/actual field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} int get_memory_actual (session_id s, VM ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-int
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_dynamic\_min}
+\subsubsection{RPC name:~get\_memory\_dynamic\_max}
{\bf Overview:}
-Get the memory/dynamic\_min field of the given VM.
+Get the memory/dynamic\_max field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} int get_memory_dynamic_min (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} int get_memory_dynamic_max (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2111,13 +2044,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_memory\_dynamic\_min}
+\subsubsection{RPC name:~set\_memory\_dynamic\_max}
{\bf Overview:}
-Set the memory/dynamic\_min field of the given VM.
+Set the memory/dynamic\_max field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_memory_dynamic_min (session_id s, VM ref self, int value)\end{verbatim}
+\begin{verbatim} void set_memory_dynamic_max (session_id s, VM ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2145,13 +2078,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_static\_min}
+\subsubsection{RPC name:~get\_memory\_dynamic\_min}
{\bf Overview:}
-Get the memory/static\_min field of the given VM.
+Get the memory/dynamic\_min field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} int get_memory_static_min (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} int get_memory_dynamic_min (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2177,45 +2110,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_policy}
-
-{\bf Overview:}
-Get the VCPUs/policy field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} string get_VCPUs_policy (session_id s, VM ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_policy}
+\subsubsection{RPC name:~set\_memory\_dynamic\_min}
{\bf Overview:}
-Set the VCPUs/policy field of the given VM.
+Set the memory/dynamic\_min field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VCPUs_policy (session_id s, VM ref self, string value)\end{verbatim}
+\begin{verbatim} void set_memory_dynamic_min (session_id s, VM ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2227,7 +2128,7 @@ Set the VCPUs/policy field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
+{\tt int } & value & New value to set \\ \hline
\end{tabular}
@@ -2243,13 +2144,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_params}
+\subsubsection{RPC name:~get\_memory\_static\_min}
{\bf Overview:}
-Get the VCPUs/params field of the given VM.
+Get the memory/static\_min field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} string get_VCPUs_params (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} int get_memory_static_min (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2267,7 +2168,7 @@ Get the VCPUs/params field of the given VM.
\noindent {\bf Return Type:}
{\tt
-string
+int
}
@@ -2275,13 +2176,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_params}
+\subsubsection{RPC name:~set\_memory\_static\_min}
{\bf Overview:}
-Set the VCPUs/params field of the given VM.
+Set the memory/static\_min field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, string value)\end{verbatim}
+\begin{verbatim} void set_memory_static_min (session_id s, VM ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2293,7 +2194,7 @@ Set the VCPUs/params field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
+{\tt int } & value & New value to set \\ \hline
\end{tabular}
@@ -2309,13 +2210,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_number}
+\subsubsection{RPC name:~get\_VCPUs\_policy}
{\bf Overview:}
-Get the VCPUs/number field of the given VM.
+Get the VCPUs/policy field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} int get_VCPUs_number (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} string get_VCPUs_policy (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2333,7 +2234,7 @@ Get the VCPUs/number field of the given VM.
\noindent {\bf Return Type:}
{\tt
-int
+string
}
@@ -2341,13 +2242,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_number}
+\subsubsection{RPC name:~set\_VCPUs\_policy}
{\bf Overview:}
-Set the VCPUs/number field of the given VM.
+Set the VCPUs/policy field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VCPUs_number (session_id s, VM ref self, int value)\end{verbatim}
+\begin{verbatim} void set_VCPUs_policy (session_id s, VM ref self, string value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2359,7 +2260,7 @@ Set the VCPUs/number field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt int } & value & New value to set \\ \hline
+{\tt string } & value & New value to set \\ \hline
\end{tabular}
@@ -2375,13 +2276,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_utilisation}
+\subsubsection{RPC name:~get\_VCPUs\_params}
{\bf Overview:}
-Get the VCPUs/utilisation field of the given VM.
+Get the VCPUs/params field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} ((string -> string) Map) get_VCPUs_params (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2399,7 +2300,7 @@ Get the VCPUs/utilisation field of the given VM.
\noindent {\bf Return Type:}
{\tt
-(int $\rightarrow$ float) Map
+(string $\rightarrow$ string) Map
}
@@ -2407,13 +2308,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_features\_required}
+\subsubsection{RPC name:~set\_VCPUs\_params}
{\bf Overview:}
-Get the VCPUs/features/required field of the given VM.
+Set the VCPUs/params field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_required (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2425,27 +2326,29 @@ Get the VCPUs/features/required field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-(cpu\_feature) Set
+void
}
-value of the field
+
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_features\_can\_use}
+\subsubsection{RPC name:~add\_to\_VCPUs\_params}
{\bf Overview:}
-Get the VCPUs/features/can\_use field of the given VM.
+Add the given key-value pair to the VCPUs/params field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_can_use (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} void add_to_VCPUs_params (session_id s, VM ref self, string key, string value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2457,37 +2360,9 @@ Get the VCPUs/features/can\_use field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-(cpu\_feature) Set
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_features\_force\_on}
-
-{\bf Overview:}
-Get the VCPUs/features/force\_on field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_force_on (session_id s, VM ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
+{\tt string } & key & Key to add \\ \hline
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline
+{\tt string } & value & Value to add \\ \hline
\end{tabular}
@@ -2495,21 +2370,22 @@ Get the VCPUs/features/force\_on field of the given VM.
\noindent {\bf Return Type:}
{\tt
-(cpu\_feature) Set
+void
}
-value of the field
+
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_features\_force\_on}
+\subsubsection{RPC name:~remove\_from\_VCPUs\_params}
{\bf Overview:}
-Set the VCPUs/features/force\_on field of the given VM.
+Remove the given key and its corresponding value from the VCPUs/params
+field of the given VM. If the key is not in that Map, then do nothing.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VCPUs_features_force_on (session_id s, VM ref self, (cpu_feature) Set value)\end{verbatim}
+\begin{verbatim} void remove_from_VCPUs_params (session_id s, VM ref self, string key)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2521,7 +2397,7 @@ Set the VCPUs/features/force\_on field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt (cpu\_feature) Set } & value & New value to set \\ \hline
+{\tt string } & key & Key to remove \\ \hline
\end{tabular}
@@ -2537,13 +2413,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~add\_VCPUs\_features\_force\_on}
+\subsubsection{RPC name:~get\_VCPUs\_max}
{\bf Overview:}
-Add the given value to the VCPUs/features/force\_on field of the given VM. If the value is already in that Set, then do nothing.
+Get the VCPUs/max field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void add_VCPUs_features_force_on (session_id s, VM ref self, cpu_feature value)\end{verbatim}
+\begin{verbatim} int get_VCPUs_max (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2555,29 +2431,27 @@ Add the given value to the VCPUs/features/force\_on field of the given VM. If t
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt cpu\_feature } & value & New value to add \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+int
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~remove\_VCPUs\_features\_force\_on}
+\subsubsection{RPC name:~set\_VCPUs\_max}
{\bf Overview:}
-Remove the given value from the VCPUs/features/force\_on field of the given VM. If the value is not in that Set, then do nothing.
+Set the VCPUs/max field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void remove_VCPUs_features_force_on (session_id s, VM ref self, cpu_feature value)\end{verbatim}
+\begin{verbatim} void set_VCPUs_max (session_id s, VM ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2589,7 +2463,7 @@ Remove the given value from the VCPUs/features/force\_on field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt cpu\_feature } & value & Value to remove \\ \hline
+{\tt int } & value & New value to set \\ \hline
\end{tabular}
@@ -2605,13 +2479,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_features\_force\_off}
+\subsubsection{RPC name:~get\_VCPUs\_at\_startup}
{\bf Overview:}
-Get the VCPUs/features/force\_off field of the given VM.
+Get the VCPUs/at\_startup field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_force_off (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} int get_VCPUs_at_startup (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2629,7 +2503,7 @@ Get the VCPUs/features/force\_off field of the given VM.
\noindent {\bf Return Type:}
{\tt
-(cpu\_feature) Set
+int
}
@@ -2637,13 +2511,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_features\_force\_off}
+\subsubsection{RPC name:~set\_VCPUs\_at\_startup}
{\bf Overview:}
-Set the VCPUs/features/force\_off field of the given VM.
+Set the VCPUs/at\_startup field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VCPUs_features_force_off (session_id s, VM ref self, (cpu_feature) Set value)\end{verbatim}
+\begin{verbatim} void set_VCPUs_at_startup (session_id s, VM ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2655,7 +2529,7 @@ Set the VCPUs/features/force\_off field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt (cpu\_feature) Set } & value & New value to set \\ \hline
+{\tt int } & value & New value to set \\ \hline
\end{tabular}
@@ -2671,13 +2545,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~add\_VCPUs\_features\_force\_off}
+\subsubsection{RPC name:~get\_VCPUs\_number}
{\bf Overview:}
-Add the given value to the VCPUs/features/force\_off field of the given VM. If the value is already in that Set, then do nothing.
+Get the VCPUs/number field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void add_VCPUs_features_force_off (session_id s, VM ref self, cpu_feature value)\end{verbatim}
+\begin{verbatim} int get_VCPUs_number (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2689,29 +2563,27 @@ Add the given value to the VCPUs/features/force\_off field of the given VM. If
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt cpu\_feature } & value & New value to add \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+int
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~remove\_VCPUs\_features\_force\_off}
+\subsubsection{RPC name:~get\_VCPUs\_utilisation}
{\bf Overview:}
-Remove the given value from the VCPUs/features/force\_off field of the given VM. If the value is not in that Set, then do nothing.
+Get the VCPUs/utilisation field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void remove_VCPUs_features_force_off (session_id s, VM ref self, cpu_feature value)\end{verbatim}
+\begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2723,19 +2595,17 @@ Remove the given value from the VCPUs/features/force\_off field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt cpu\_feature } & value & Value to remove \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+(int $\rightarrow$ float) Map
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
@@ -2871,13 +2741,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_actions\_after\_suspend}
+\subsubsection{RPC name:~get\_actions\_after\_crash}
{\bf Overview:}
-Get the actions/after\_suspend field of the given VM.
+Get the actions/after\_crash field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} (on_normal_exit) get_actions_after_suspend (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} (on_crash_behaviour) get_actions_after_crash (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2895,7 +2765,7 @@ Get the actions/after\_suspend field of the given VM.
\noindent {\bf Return Type:}
{\tt
-on\_normal\_exit
+on\_crash\_behaviour
}
@@ -2903,13 +2773,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_actions\_after\_suspend}
+\subsubsection{RPC name:~set\_actions\_after\_crash}
{\bf Overview:}
-Set the actions/after\_suspend field of the given VM.
+Set the actions/after\_crash field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_actions_after_suspend (session_id s, VM ref self, on_normal_exit value)\end{verbatim}
+\begin{verbatim} void set_actions_after_crash (session_id s, VM ref self, on_crash_behaviour value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2921,7 +2791,7 @@ Set the actions/after\_suspend field of the given VM.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VM ref } & self & reference to the object \\ \hline
-{\tt on\_normal\_exit } & value & New value to set \\ \hline
+{\tt on\_crash\_behaviour } & value & New value to set \\ \hline
\end{tabular}
@@ -2937,13 +2807,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_actions\_after\_crash}
+\subsubsection{RPC name:~get\_consoles}
{\bf Overview:}
-Get the actions/after\_crash field of the given VM.
+Get the consoles field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} (on_crash_behaviour) get_actions_after_crash (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} ((console ref) Set) get_consoles (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -2961,7 +2831,7 @@ Get the actions/after\_crash field of the given VM.
\noindent {\bf Return Type:}
{\tt
-on\_crash\_behaviour
+(console ref) Set
}
@@ -2969,47 +2839,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_actions\_after\_crash}
-
-{\bf Overview:}
-Set the actions/after\_crash field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_actions_after_crash (session_id s, VM ref self, on_crash_behaviour value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline
-
-{\tt on\_crash\_behaviour } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_consoles}
+\subsubsection{RPC name:~get\_VIFs}
{\bf Overview:}
-Get the consoles field of the given VM.
+Get the VIFs field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((console ref) Set) get_consoles (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} ((VIF ref) Set) get_VIFs (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -3027,7 +2863,7 @@ Get the consoles field of the given VM.
\noindent {\bf Return Type:}
{\tt
-(console ref) Set
+(VIF ref) Set
}
@@ -3035,13 +2871,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VIFs}
+\subsubsection{RPC name:~get\_VBDs}
{\bf Overview:}
-Get the VIFs field of the given VM.
+Get the VBDs field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((VIF ref) Set) get_VIFs (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} ((VBD ref) Set) get_VBDs (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -3059,7 +2895,7 @@ Get the VIFs field of the given VM.
\noindent {\bf Return Type:}
{\tt
-(VIF ref) Set
+(VBD ref) Set
}
@@ -3067,13 +2903,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VBDs}
+\subsubsection{RPC name:~get\_crash\_dumps}
{\bf Overview:}
-Get the VBDs field of the given VM.
+Get the crash\_dumps field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((VBD ref) Set) get_VBDs (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} ((crashdump ref) Set) get_crash_dumps (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -3091,7 +2927,7 @@ Get the VBDs field of the given VM.
\noindent {\bf Return Type:}
{\tt
-(VBD ref) Set
+(crashdump ref) Set
}
@@ -3921,13 +3757,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_otherConfig}
+\subsubsection{RPC name:~get\_other\_config}
{\bf Overview:}
-Get the otherConfig field of the given VM.
+Get the other\_config field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} ((string -> string) Map) get_otherConfig (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -3953,13 +3789,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_otherConfig}
+\subsubsection{RPC name:~set\_other\_config}
{\bf Overview:}
-Set the otherConfig field of the given VM.
+Set the other\_config field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_otherConfig (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
+\begin{verbatim} void set_other_config (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -3987,13 +3823,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~add\_to\_otherConfig}
+\subsubsection{RPC name:~add\_to\_other\_config}
{\bf Overview:}
-map add message derived from field otherConfig of object VM
+Add the given key-value pair to the other\_config field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void add_to_otherConfig (session_id s, VM ref self, string key, string value)\end{verbatim}
+\begin{verbatim} void add_to_other_config (session_id s, VM ref self, string key, string value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -4023,13 +3859,14 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~remove\_from\_otherConfig}
+\subsubsection{RPC name:~remove\_from\_other\_config}
{\bf Overview:}
-map remove message derived from field otherConfig of object VM
+Remove the given key and its corresponding value from the other\_config
+field of the given VM. If the key is not in that Map, then do nothing.
\noindent {\bf Signature:}
-\begin{verbatim} void remove_from_otherConfig (session_id s, VM ref self, string key)\end{verbatim}
+\begin{verbatim} void remove_from_other_config (session_id s, VM ref self, string key)\end{verbatim}
\noindent{\bf Arguments:}
@@ -4057,6 +3894,70 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_is\_control\_domain}
+
+{\bf Overview:}
+Get the is\_control\_domain field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} bool get_is_control_domain (session_id s, VM ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+bool
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_metrics}
+
+{\bf Overview:}
+Get the metrics field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM_metrics ref) get_metrics (session_id s, VM ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VM\_metrics ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~create}
{\bf Overview:}
@@ -4092,7 +3993,8 @@ reference to the newly created object
\subsubsection{RPC name:~destroy}
{\bf Overview:}
-Destroy the specified VM. The VM is completely removed from the system. This function can only be called when the VM is in the Halted State.
+Destroy the specified VM. The VM is completely removed from the system.
+This function can only be called when the VM is in the Halted State.
\noindent {\bf Signature:}
\begin{verbatim} void destroy (session_id s, VM ref self)\end{verbatim}
@@ -4220,12 +4122,258 @@ references to objects with match names
\vspace{1cm}
\newpage
+\section{Class: VM\_metrics}
+\subsection{Fields for class: VM\_metrics}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VM\_metrics} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The metrics associated with a VM.}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & VM to which these metrics apply \\
+$\mathit{RO}_\mathit{run}$ & {\tt memory/actual} & int & Guest's actual memory (bytes) \\
+$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\
+$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: VM\_metrics}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given VM\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (session_id s, VM_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VM}
+
+{\bf Overview:}
+Get the VM field of the given VM\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM ref) get_VM (session_id s, VM_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VM ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_memory\_actual}
+
+{\bf Overview:}
+Get the memory/actual field of the given VM\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} int get_memory_actual (session_id s, VM_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_number}
+
+{\bf Overview:}
+Get the VCPUs/number field of the given VM\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} int get_VCPUs_number (session_id s, VM_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_utilisation}
+
+{\bf Overview:}
+Get the VCPUs/utilisation field of the given VM\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (session_id s, VM_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(int $\rightarrow$ float) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_by\_uuid}
+
+{\bf Overview:}
+Get a reference to the VM\_metrics instance with the specified UUID.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM_metrics ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VM\_metrics ref
+}
+
+
+reference to the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_record}
+
+{\bf Overview:}
+Get a record containing the current state of the given VM\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM_metrics record) get_record (session_id s, VM_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VM\_metrics record
+}
+
+
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
\section{Class: host}
\subsection{Fields for class: host}
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf host} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A physical host}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+physical host.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -4233,16 +4381,23 @@ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object ref
$\mathit{RW}$ & {\tt name/label} & string & a human-readable name \\
$\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-readable description \\
$\mathit{RO}_\mathit{run}$ & {\tt software\_version} & (string $\rightarrow$ string) Map & version strings \\
+$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
$\mathit{RO}_\mathit{run}$ & {\tt resident\_VMs} & (VM ref) Set & list of VMs currently resident on host \\
+$\mathit{RW}$ & {\tt logging} & (string $\rightarrow$ string) Map & logging configuration \\
$\mathit{RO}_\mathit{run}$ & {\tt PIFs} & (PIF ref) Set & physical network interfaces \\
+$\mathit{RW}$ & {\tt suspend\_image\_sr} & SR ref & The SR in which VDIs for suspend images are created \\
+$\mathit{RW}$ & {\tt crash\_dump\_sr} & SR ref & The SR in which VDIs for crash dumps are created \\
+$\mathit{RO}_\mathit{run}$ & {\tt PBDs} & (PBD ref) Set & physical blockdevices \\
$\mathit{RO}_\mathit{run}$ & {\tt host\_CPUs} & (host\_cpu ref) Set & The physical CPUs on this host \\
+$\mathit{RO}_\mathit{ins}$ & {\tt metrics} & host\_metrics ref & metrics associated with this host. \\
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: host}
\subsubsection{RPC name:~disable}
{\bf Overview:}
-Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute.
+Puts the host into a state in which no new VMs can be started. Currently
+active VMs on the host continue to execute.
\noindent {\bf Signature:}
\begin{verbatim} void disable (session_id s, host ref host)\end{verbatim}
@@ -4306,7 +4461,8 @@ void
\subsubsection{RPC name:~shutdown}
{\bf Overview:}
-Shutdown the host. (This function can only be called if there are no currently running VMs on the host and it is disabled.)
+Shutdown the host. (This function can only be called if there are no
+currently running VMs on the host and it is disabled.).
\noindent {\bf Signature:}
\begin{verbatim} void shutdown (session_id s, host ref host)\end{verbatim}
@@ -4338,7 +4494,8 @@ void
\subsubsection{RPC name:~reboot}
{\bf Overview:}
-Reboot the host. (This function can only be called if there are no currently running VMs on the host and it is disabled.)
+Reboot the host. (This function can only be called if there are no
+currently running VMs on the host and it is disabled.).
\noindent {\bf Signature:}
\begin{verbatim} void reboot (session_id s, host ref host)\end{verbatim}
@@ -4584,6 +4741,143 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_other\_config}
+
+{\bf Overview:}
+Get the other\_config field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_other\_config}
+
+{\bf Overview:}
+Set the other\_config field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_other_config (session_id s, host ref self, (string -> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_other\_config}
+
+{\bf Overview:}
+Add the given key-value pair to the other\_config field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void add_to_other_config (session_id s, host ref self, string key, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to add \\ \hline
+
+{\tt string } & value & Value to add \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_other\_config}
+
+{\bf Overview:}
+Remove the given key and its corresponding value from the other\_config
+field of the given host. If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void remove_from_other_config (session_id s, host ref self, string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to remove \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_resident\_VMs}
{\bf Overview:}
@@ -4616,6 +4910,143 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_logging}
+
+{\bf Overview:}
+Get the logging field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_logging (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_logging}
+
+{\bf Overview:}
+Set the logging field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_logging (session_id s, host ref self, (string -> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_logging}
+
+{\bf Overview:}
+Add the given key-value pair to the logging field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void add_to_logging (session_id s, host ref self, string key, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to add \\ \hline
+
+{\tt string } & value & Value to add \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_logging}
+
+{\bf Overview:}
+Remove the given key and its corresponding value from the logging field of
+the given host. If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void remove_from_logging (session_id s, host ref self, string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to remove \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_PIFs}
{\bf Overview:}
@@ -4648,6 +5079,170 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_suspend\_image\_sr}
+
+{\bf Overview:}
+Get the suspend\_image\_sr field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (SR ref) get_suspend_image_sr (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+SR ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_suspend\_image\_sr}
+
+{\bf Overview:}
+Set the suspend\_image\_sr field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_suspend_image_sr (session_id s, host ref self, SR ref value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt SR ref } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_crash\_dump\_sr}
+
+{\bf Overview:}
+Get the crash\_dump\_sr field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (SR ref) get_crash_dump_sr (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+SR ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_crash\_dump\_sr}
+
+{\bf Overview:}
+Set the crash\_dump\_sr field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_crash_dump_sr (session_id s, host ref self, SR ref value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+{\tt SR ref } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_PBDs}
+
+{\bf Overview:}
+Get the PBDs field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((PBD ref) Set) get_PBDs (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(PBD ref) Set
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_host\_CPUs}
{\bf Overview:}
@@ -4680,6 +5275,38 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_metrics}
+
+{\bf Overview:}
+Get the metrics field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (host_metrics ref) get_metrics (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+host\_metrics ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~create}
{\bf Overview:}
@@ -4843,6 +5470,218 @@ references to objects with match names
\vspace{1cm}
\newpage
+\section{Class: host\_metrics}
+\subsection{Fields for class: host\_metrics}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf host\_metrics} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The metrics associated with a host.}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt host} & host ref & Host to which these metrics apply \\
+$\mathit{RO}_\mathit{run}$ & {\tt memory/total} & int & Host's total memory (bytes) \\
+$\mathit{RO}_\mathit{run}$ & {\tt memory/free} & int & Host's free memory (bytes) \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: host\_metrics}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given host\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (session_id s, host_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_host}
+
+{\bf Overview:}
+Get the host field of the given host\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (host ref) get_host (session_id s, host_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+host ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_memory\_total}
+
+{\bf Overview:}
+Get the memory/total field of the given host\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} int get_memory_total (session_id s, host_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_memory\_free}
+
+{\bf Overview:}
+Get the memory/free field of the given host\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} int get_memory_free (session_id s, host_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_by\_uuid}
+
+{\bf Overview:}
+Get a reference to the host\_metrics instance with the specified UUID.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (host_metrics ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+host\_metrics ref
+}
+
+
+reference to the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_record}
+
+{\bf Overview:}
+Get a record containing the current state of the given host\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (host_metrics record) get_record (session_id s, host_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+host\_metrics record
+}
+
+
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
\section{Class: host\_cpu}
\subsection{Fields for class: host\_cpu}
\begin{longtable}{|lllp{0.38\textwidth}|}
@@ -4858,7 +5697,6 @@ $\mathit{RO}_\mathit{ins}$ & {\tt number} & int & the number of the physical CP
$\mathit{RO}_\mathit{ins}$ & {\tt vendor} & string & the vendor of the physical CPU \\
$\mathit{RO}_\mathit{ins}$ & {\tt speed} & int & the speed of the physical CPU \\
$\mathit{RO}_\mathit{ins}$ & {\tt modelname} & string & the model name of the physical CPU \\
-$\mathit{RO}_\mathit{ins}$ & {\tt features} & (cpu\_feature) Set & the features supported by the CPU \\
$\mathit{RO}_\mathit{run}$ & {\tt utilisation} & float & the current CPU utilisation \\
\hline
\end{longtable}
@@ -5055,38 +5893,6 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_features}
-
-{\bf Overview:}
-Get the features field of the given host\_cpu.
-
- \noindent {\bf Signature:}
-\begin{verbatim} ((cpu_feature) Set) get_features (session_id s, host_cpu ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt host\_cpu ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-(cpu\_feature) Set
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
\subsubsection{RPC name:~get\_utilisation}
{\bf Overview:}
@@ -5255,7 +6061,8 @@ all fields from the object
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf network} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual network}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+virtual network.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -5818,16 +6625,15 @@ references to objects with match names
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VIF} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual network interface}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+virtual network interface.}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
-$\mathit{RW}$ & {\tt name} & string & human-readable name of the interface \\
-$\mathit{RW}$ & {\tt type} & driver\_type & interface type \\
$\mathit{RW}$ & {\tt device} & string & name of network device as exposed to guest e.g. eth0 \\
-$\mathit{RW}$ & {\tt network} & network ref & virtual network to which this vif is connected \\
-$\mathit{RW}$ & {\tt VM} & VM ref & virtual machine to which this vif is connected \\
+$\mathit{RO}_\mathit{ins}$ & {\tt network} & network ref & virtual network to which this vif is connected \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & virtual machine to which this vif is connected \\
$\mathit{RW}$ & {\tt MAC} & string & ethernet MAC address of virtual interface, as exposed to guest \\
$\mathit{RW}$ & {\tt MTU} & int & MTU in octets \\
$\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\
@@ -5867,138 +6673,6 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_name}
-
-{\bf Overview:}
-Get the name field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} string get_name (session_id s, VIF ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_name}
-
-{\bf Overview:}
-Set the name field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_name (session_id s, VIF ref self, string value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-{\tt string } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_type}
-
-{\bf Overview:}
-Get the type field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} (driver_type) get_type (session_id s, VIF ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-driver\_type
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_type}
-
-{\bf Overview:}
-Set the type field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_type (session_id s, VIF ref self, driver_type value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-{\tt driver\_type } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
\subsubsection{RPC name:~get\_device}
{\bf Overview:}
@@ -6097,40 +6771,6 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_network}
-
-{\bf Overview:}
-Set the network field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_network (session_id s, VIF ref self, network ref value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-{\tt network ref } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
\subsubsection{RPC name:~get\_VM}
{\bf Overview:}
@@ -6163,40 +6803,6 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VM}
-
-{\bf Overview:}
-Set the VM field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_VM (session_id s, VIF ref self, VM ref value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-{\tt VM ref } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
\subsubsection{RPC name:~get\_MAC}
{\bf Overview:}
@@ -6529,29 +7135,30 @@ all fields from the object
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf PIF} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A physical network interface (note separate VLANs are represented as several PIFs)}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+physical network interface (note separate VLANs are represented as several
+PIFs).}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
-$\mathit{RW}$ & {\tt name} & string & human-readable name of the interface \\
-$\mathit{RW}$ & {\tt network} & network ref & virtual network to which this pif is connected \\
-$\mathit{RW}$ & {\tt host} & host ref & physical machine to which this pif is connected \\
+$\mathit{RW}$ & {\tt device} & string & machine-readable name of the interface (e.g. eth0) \\
+$\mathit{RO}_\mathit{ins}$ & {\tt network} & network ref & virtual network to which this pif is connected \\
+$\mathit{RO}_\mathit{ins}$ & {\tt host} & host ref & physical machine to which this pif is connected \\
$\mathit{RW}$ & {\tt MAC} & string & ethernet MAC address of physical interface \\
$\mathit{RW}$ & {\tt MTU} & int & MTU in octets \\
-$\mathit{RW}$ & {\tt VLAN} & string & VLAN tag for all traffic passing through this interface \\
-$\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\
-$\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\
+$\mathit{RW}$ & {\tt VLAN} & int & VLAN tag for all traffic passing through this interface \\
+$\mathit{RO}_\mathit{ins}$ & {\tt metrics} & PIF\_metrics ref & metrics associated with this PIF. \\
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: PIF}
-\subsubsection{RPC name:~get\_uuid}
+\subsubsection{RPC name:~create\_VLAN}
{\bf Overview:}
-Get the uuid field of the given PIF.
+Create a VLAN interface from an existing physical interface.
\noindent {\bf Signature:}
-\begin{verbatim} string get_uuid (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} (PIF ref) create_VLAN (session_id s, string device, network ref network, host ref host, int VLAN)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6561,7 +7168,13 @@ Get the uuid field of the given PIF.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt PIF ref } & self & reference to the object \\ \hline
+{\tt string } & device & physical interface on which to crate the VLAN interface \\ \hline
+
+{\tt network ref } & network & network to which this interface should be connected \\ \hline
+
+{\tt host ref } & host & physical machine to which this PIF is connected \\ \hline
+
+{\tt int } & VLAN & VLAN tag for the new interface \\ \hline
\end{tabular}
@@ -6569,21 +7182,24 @@ Get the uuid field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-string
+PIF ref
}
-value of the field
+The reference of the created PIF object
\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_name}
+
+\noindent{\bf Possible Error Codes:} {\tt VLAN\_TAG\_INVALID}
+
+\vspace{0.6cm}
+\subsubsection{RPC name:~destroy}
{\bf Overview:}
-Get the name field of the given PIF.
+Destroy the interface (provided it is a synthetic interface like a VLAN;
+fail if it is a physical interface).
\noindent {\bf Signature:}
-\begin{verbatim} string get_name (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} void destroy (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6593,7 +7209,7 @@ Get the name field of the given PIF.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt PIF ref } & self & reference to the object \\ \hline
+{\tt PIF ref } & self & the PIF object to destroy \\ \hline
\end{tabular}
@@ -6601,21 +7217,23 @@ Get the name field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-string
+void
}
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
+
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_name}
+
+\noindent{\bf Possible Error Codes:} {\tt PIF\_IS\_PHYSICAL}
+
+\vspace{0.6cm}
+\subsubsection{RPC name:~get\_uuid}
{\bf Overview:}
-Set the name field of the given PIF.
+Get the uuid field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} void set_name (session_id s, PIF ref self, string value)\end{verbatim}
+\begin{verbatim} string get_uuid (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6627,29 +7245,27 @@ Set the name field of the given PIF.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt PIF ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+string
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_network}
+\subsubsection{RPC name:~get\_device}
{\bf Overview:}
-Get the network field of the given PIF.
+Get the device field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} (network ref) get_network (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} string get_device (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6667,7 +7283,7 @@ Get the network field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-network ref
+string
}
@@ -6675,13 +7291,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_network}
+\subsubsection{RPC name:~set\_device}
{\bf Overview:}
-Set the network field of the given PIF.
+Set the device field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} void set_network (session_id s, PIF ref self, network ref value)\end{verbatim}
+\begin{verbatim} void set_device (session_id s, PIF ref self, string value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6693,7 +7309,7 @@ Set the network field of the given PIF.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt PIF ref } & self & reference to the object \\ \hline
-{\tt network ref } & value & New value to set \\ \hline
+{\tt string } & value & New value to set \\ \hline
\end{tabular}
@@ -6709,13 +7325,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_host}
+\subsubsection{RPC name:~get\_network}
{\bf Overview:}
-Get the host field of the given PIF.
+Get the network field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} (host ref) get_host (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} (network ref) get_network (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6733,7 +7349,7 @@ Get the host field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-host ref
+network ref
}
@@ -6741,13 +7357,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_host}
+\subsubsection{RPC name:~get\_host}
{\bf Overview:}
-Set the host field of the given PIF.
+Get the host field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} void set_host (session_id s, PIF ref self, host ref value)\end{verbatim}
+\begin{verbatim} (host ref) get_host (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6759,19 +7375,17 @@ Set the host field of the given PIF.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt PIF ref } & self & reference to the object \\ \hline
-{\tt host ref } & value & New value to set \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+host ref
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
@@ -6913,7 +7527,7 @@ void
Get the VLAN field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} string get_VLAN (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} int get_VLAN (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6931,7 +7545,7 @@ Get the VLAN field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-string
+int
}
@@ -6945,7 +7559,7 @@ value of the field
Set the VLAN field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VLAN (session_id s, PIF ref self, string value)\end{verbatim}
+\begin{verbatim} void set_VLAN (session_id s, PIF ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6957,7 +7571,7 @@ Set the VLAN field of the given PIF.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt PIF ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
+{\tt int } & value & New value to set \\ \hline
\end{tabular}
@@ -6973,13 +7587,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_io\_read\_kbs}
+\subsubsection{RPC name:~get\_metrics}
{\bf Overview:}
-Get the io/read\_kbs field of the given PIF.
+Get the metrics field of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} float get_io_read_kbs (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} (PIF_metrics ref) get_metrics (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -6997,7 +7611,7 @@ Get the io/read\_kbs field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-float
+PIF\_metrics ref
}
@@ -7005,13 +7619,45 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_io\_write\_kbs}
+\subsubsection{RPC name:~get\_by\_uuid}
+
+{\bf Overview:}
+Get a reference to the PIF instance with the specified UUID.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (PIF ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+PIF ref
+}
+
+
+reference to the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_record}
{\bf Overview:}
-Get the io/write\_kbs field of the given PIF.
+Get a record containing the current state of the given PIF.
\noindent {\bf Signature:}
-\begin{verbatim} float get_io_write_kbs (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} (PIF record) get_record (session_id s, PIF ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -7029,7 +7675,59 @@ Get the io/write\_kbs field of the given PIF.
\noindent {\bf Return Type:}
{\tt
-float
+PIF record
+}
+
+
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
+\section{Class: PIF\_metrics}
+\subsection{Fields for class: PIF\_metrics}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf PIF\_metrics} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The metrics associated with a physical network interface.}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt PIF} & PIF ref & PIF to which these metrics apply \\
+$\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\
+$\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: PIF\_metrics}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given PIF\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (session_id s, PIF_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt PIF\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+string
}
@@ -7037,13 +7735,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~create}
+\subsubsection{RPC name:~get\_PIF}
{\bf Overview:}
-Create a new PIF instance, and return its handle.
+Get the PIF field of the given PIF\_metrics.
\noindent {\bf Signature:}
-\begin{verbatim} (PIF ref) create (session_id s, PIF record args)\end{verbatim}
+\begin{verbatim} (PIF ref) get_PIF (session_id s, PIF_metrics ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -7053,7 +7751,7 @@ Create a new PIF instance, and return its handle.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt PIF record } & args & All constructor arguments \\ \hline
+{\tt PIF\_metrics ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -7065,17 +7763,17 @@ PIF ref
}
-reference to the newly created object
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~destroy}
+\subsubsection{RPC name:~get\_io\_read\_kbs}
{\bf Overview:}
-Destroy the specified PIF instance.
+Get the io/read\_kbs field of the given PIF\_metrics.
\noindent {\bf Signature:}
-\begin{verbatim} void destroy (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} float get_io_read_kbs (session_id s, PIF_metrics ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -7085,7 +7783,7 @@ Destroy the specified PIF instance.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt PIF ref } & self & reference to the object \\ \hline
+{\tt PIF\_metrics ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -7093,21 +7791,53 @@ Destroy the specified PIF instance.
\noindent {\bf Return Type:}
{\tt
-void
+float
}
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_io\_write\_kbs}
+
+{\bf Overview:}
+Get the io/write\_kbs field of the given PIF\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} float get_io_write_kbs (session_id s, PIF_metrics ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt PIF\_metrics ref } & self & reference to the object \\ \hline
+
+\end{tabular}
\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+float
+}
+
+
+value of the field
+\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
\subsubsection{RPC name:~get\_by\_uuid}
{\bf Overview:}
-Get a reference to the PIF instance with the specified UUID.
+Get a reference to the PIF\_metrics instance with the specified UUID.
\noindent {\bf Signature:}
-\begin{verbatim} (PIF ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+\begin{verbatim} (PIF_metrics ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
\noindent{\bf Arguments:}
@@ -7125,7 +7855,7 @@ Get a reference to the PIF instance with the specified UUID.
\noindent {\bf Return Type:}
{\tt
-PIF ref
+PIF\_metrics ref
}
@@ -7136,10 +7866,10 @@ reference to the object
\subsubsection{RPC name:~get\_record}
{\bf Overview:}
-Get a record containing the current state of the given PIF.
+Get a record containing the current state of the given PIF\_metrics.
\noindent {\bf Signature:}
-\begin{verbatim} (PIF record) get_record (session_id s, PIF ref self)\end{verbatim}
+\begin{verbatim} (PIF_metrics record) get_record (session_id s, PIF_metrics ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -7149,7 +7879,7 @@ Get a record containing the current state of the given PIF.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt PIF ref } & self & reference to the object \\ \hline
+{\tt PIF\_metrics ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -7157,7 +7887,7 @@ Get a record containing the current state of the given PIF.
\noindent {\bf Return Type:}
{\tt
-PIF record
+PIF\_metrics record
}
@@ -7173,7 +7903,8 @@ all fields from the object
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf SR} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A storage repository}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+storage repository.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -7181,6 +7912,7 @@ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object ref
$\mathit{RW}$ & {\tt name/label} & string & a human-readable name \\
$\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-readable description \\
$\mathit{RO}_\mathit{run}$ & {\tt VDIs} & (VDI ref) Set & managed virtual disks \\
+$\mathit{RO}_\mathit{run}$ & {\tt PBDs} & (PBD ref) Set & physical blockdevices \\
$\mathit{RO}_\mathit{run}$ & {\tt virtual\_allocation} & int & sum of virtual\_sizes of all VDIs in this storage repository (in bytes) \\
$\mathit{RO}_\mathit{run}$ & {\tt physical\_utilisation} & int & physical space currently utilised on this storage repository (in bytes). Note that for sparse disk formats, physical\_utilisation may be less than virtual\_allocation \\
$\mathit{RO}_\mathit{ins}$ & {\tt physical\_size} & int & total physical size of the repository (in bytes) \\
@@ -7443,6 +8175,38 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_PBDs}
+
+{\bf Overview:}
+Get the PBDs field of the given SR.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((PBD ref) Set) get_PBDs (session_id s, SR ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt SR ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(PBD ref) Set
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_virtual\_allocation}
{\bf Overview:}
@@ -7771,7 +8535,8 @@ references to objects with match names
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VDI} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual disk image}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+virtual disk image.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -7780,12 +8545,11 @@ $\mathit{RW}$ & {\tt name/label} & string & a human-readable name \\
$\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-readable description \\
$\mathit{RW}$ & {\tt SR} & SR ref & storage repository in which the VDI resides \\
$\mathit{RO}_\mathit{run}$ & {\tt VBDs} & (VBD ref) Set & list of vbds that refer to this disk \\
+$\mathit{RO}_\mathit{run}$ & {\tt crash\_dumps} & (crashdump ref) Set & list of crash dumps that refer to this disk \\
$\mathit{RW}$ & {\tt virtual\_size} & int & size of disk as presented to the guest (in multiples of sector\_size field) \\
$\mathit{RO}_\mathit{run}$ & {\tt physical\_utilisation} & int & amount of physical space that the disk image is currently taking up on the storage repository (in bytes) \\
$\mathit{RO}_\mathit{ins}$ & {\tt sector\_size} & int & sector size of VDI (in bytes) \\
$\mathit{RO}_\mathit{ins}$ & {\tt type} & vdi\_type & type of the VDI \\
-$\mathit{RO}_\mathit{ins}$ & {\tt parent} & VDI ref & parent disk (e.g. in the case of copy on write) \\
-$\mathit{RO}_\mathit{run}$ & {\tt children} & (VDI ref) Set & child disks (e.g. in the case of copy on write) \\
$\mathit{RW}$ & {\tt sharable} & bool & true if this disk may be shared \\
$\mathit{RW}$ & {\tt read\_only} & bool & true if this disk may ONLY be mounted read-only \\
\hline
@@ -7794,7 +8558,8 @@ $\mathit{RW}$ & {\tt read\_only} & bool & true if this disk may ONLY be mounted
\subsubsection{RPC name:~snapshot}
{\bf Overview:}
-Take an exact copy of the VDI; the snapshot lives in the same Storage Repository as its parent.
+Take an exact copy of the VDI; the snapshot lives in the same Storage
+Repository as its parent.
\noindent {\bf Signature:}
\begin{verbatim} (VDI ref) snapshot (session_id s, VDI ref vdi)\end{verbatim}
@@ -8119,13 +8884,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_virtual\_size}
+\subsubsection{RPC name:~get\_crash\_dumps}
{\bf Overview:}
-Get the virtual\_size field of the given VDI.
+Get the crash\_dumps field of the given VDI.
\noindent {\bf Signature:}
-\begin{verbatim} int get_virtual_size (session_id s, VDI ref self)\end{verbatim}
+\begin{verbatim} ((crashdump ref) Set) get_crash_dumps (session_id s, VDI ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8143,7 +8908,7 @@ Get the virtual\_size field of the given VDI.
\noindent {\bf Return Type:}
{\tt
-int
+(crashdump ref) Set
}
@@ -8151,47 +8916,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_virtual\_size}
-
-{\bf Overview:}
-Set the virtual\_size field of the given VDI.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_virtual_size (session_id s, VDI ref self, int value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VDI ref } & self & reference to the object \\ \hline
-
-{\tt int } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_physical\_utilisation}
+\subsubsection{RPC name:~get\_virtual\_size}
{\bf Overview:}
-Get the physical\_utilisation field of the given VDI.
+Get the virtual\_size field of the given VDI.
\noindent {\bf Signature:}
-\begin{verbatim} int get_physical_utilisation (session_id s, VDI ref self)\end{verbatim}
+\begin{verbatim} int get_virtual_size (session_id s, VDI ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8217,13 +8948,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_sector\_size}
+\subsubsection{RPC name:~set\_virtual\_size}
{\bf Overview:}
-Get the sector\_size field of the given VDI.
+Set the virtual\_size field of the given VDI.
\noindent {\bf Signature:}
-\begin{verbatim} int get_sector_size (session_id s, VDI ref self)\end{verbatim}
+\begin{verbatim} void set_virtual_size (session_id s, VDI ref self, int value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8235,27 +8966,29 @@ Get the sector\_size field of the given VDI.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VDI ref } & self & reference to the object \\ \hline
+{\tt int } & value & New value to set \\ \hline
+
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-int
+void
}
-value of the field
+
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_type}
+\subsubsection{RPC name:~get\_physical\_utilisation}
{\bf Overview:}
-Get the type field of the given VDI.
+Get the physical\_utilisation field of the given VDI.
\noindent {\bf Signature:}
-\begin{verbatim} (vdi_type) get_type (session_id s, VDI ref self)\end{verbatim}
+\begin{verbatim} int get_physical_utilisation (session_id s, VDI ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8273,7 +9006,7 @@ Get the type field of the given VDI.
\noindent {\bf Return Type:}
{\tt
-vdi\_type
+int
}
@@ -8281,13 +9014,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_parent}
+\subsubsection{RPC name:~get\_sector\_size}
{\bf Overview:}
-Get the parent field of the given VDI.
+Get the sector\_size field of the given VDI.
\noindent {\bf Signature:}
-\begin{verbatim} (VDI ref) get_parent (session_id s, VDI ref self)\end{verbatim}
+\begin{verbatim} int get_sector_size (session_id s, VDI ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8305,7 +9038,7 @@ Get the parent field of the given VDI.
\noindent {\bf Return Type:}
{\tt
-VDI ref
+int
}
@@ -8313,13 +9046,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_children}
+\subsubsection{RPC name:~get\_type}
{\bf Overview:}
-Get the children field of the given VDI.
+Get the type field of the given VDI.
\noindent {\bf Signature:}
-\begin{verbatim} ((VDI ref) Set) get_children (session_id s, VDI ref self)\end{verbatim}
+\begin{verbatim} (vdi_type) get_type (session_id s, VDI ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8337,7 +9070,7 @@ Get the children field of the given VDI.
\noindent {\bf Return Type:}
{\tt
-(VDI ref) Set
+vdi\_type
}
@@ -8645,17 +9378,18 @@ references to objects with match names
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VBD} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual block device}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+virtual block device.}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
-$\mathit{RW}$ & {\tt VM} & VM ref & the virtual machine \\
-$\mathit{RW}$ & {\tt VDI} & VDI ref & the virtual disk \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & the virtual machine \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VDI} & VDI ref & the virtual disk \\
$\mathit{RW}$ & {\tt device} & string & device seen by the guest e.g. hda1 \\
-$\mathit{RW}$ & {\tt mode} & vbd\_mode & the mode the disk should be mounted with \\
+$\mathit{RW}$ & {\tt bootable} & bool & true if this VBD is bootable \\
+$\mathit{RW}$ & {\tt mode} & vbd\_mode & the mode the VBD should be mounted with \\
$\mathit{RW}$ & {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\
-$\mathit{RW}$ & {\tt driver} & driver\_type & the style of driver \\
$\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\
$\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\
\hline
@@ -8664,7 +9398,8 @@ $\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB
\subsubsection{RPC name:~media\_change}
{\bf Overview:}
-Change the media in the device for CDROM-like devices only. For other devices, detach the VBD and attach a new one
+Change the media in the device for CDROM-like devices only. For other
+devices, detach the VBD and attach a new one.
\noindent {\bf Signature:}
\begin{verbatim} void media_change (session_id s, VBD ref vbd, VDI ref vdi)\end{verbatim}
@@ -8759,13 +9494,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VM}
+\subsubsection{RPC name:~get\_VDI}
{\bf Overview:}
-Set the VM field of the given VBD.
+Get the VDI field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VM (session_id s, VBD ref self, VM ref value)\end{verbatim}
+\begin{verbatim} (VDI ref) get_VDI (session_id s, VBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8777,29 +9512,27 @@ Set the VM field of the given VBD.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VBD ref } & self & reference to the object \\ \hline
-{\tt VM ref } & value & New value to set \\ \hline
-
\end{tabular}
\vspace{0.3cm}
\noindent {\bf Return Type:}
{\tt
-void
+VDI ref
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VDI}
+\subsubsection{RPC name:~get\_device}
{\bf Overview:}
-Get the VDI field of the given VBD.
+Get the device field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} (VDI ref) get_VDI (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} string get_device (session_id s, VBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8817,7 +9550,7 @@ Get the VDI field of the given VBD.
\noindent {\bf Return Type:}
{\tt
-VDI ref
+string
}
@@ -8825,13 +9558,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VDI}
+\subsubsection{RPC name:~set\_device}
{\bf Overview:}
-Set the VDI field of the given VBD.
+Set the device field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} void set_VDI (session_id s, VBD ref self, VDI ref value)\end{verbatim}
+\begin{verbatim} void set_device (session_id s, VBD ref self, string value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8843,7 +9576,7 @@ Set the VDI field of the given VBD.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VBD ref } & self & reference to the object \\ \hline
-{\tt VDI ref } & value & New value to set \\ \hline
+{\tt string } & value & New value to set \\ \hline
\end{tabular}
@@ -8859,13 +9592,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_device}
+\subsubsection{RPC name:~get\_bootable}
{\bf Overview:}
-Get the device field of the given VBD.
+Get the bootable field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} string get_device (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} bool get_bootable (session_id s, VBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8883,7 +9616,7 @@ Get the device field of the given VBD.
\noindent {\bf Return Type:}
{\tt
-string
+bool
}
@@ -8891,13 +9624,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_device}
+\subsubsection{RPC name:~set\_bootable}
{\bf Overview:}
-Set the device field of the given VBD.
+Set the bootable field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} void set_device (session_id s, VBD ref self, string value)\end{verbatim}
+\begin{verbatim} void set_bootable (session_id s, VBD ref self, bool value)\end{verbatim}
\noindent{\bf Arguments:}
@@ -8909,7 +9642,7 @@ Set the device field of the given VBD.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VBD ref } & self & reference to the object \\ \hline
-{\tt string } & value & New value to set \\ \hline
+{\tt bool } & value & New value to set \\ \hline
\end{tabular}
@@ -9057,13 +9790,13 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_driver}
+\subsubsection{RPC name:~get\_io\_read\_kbs}
{\bf Overview:}
-Get the driver field of the given VBD.
+Get the io/read\_kbs field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} (driver_type) get_driver (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} float get_io_read_kbs (session_id s, VBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9081,7 +9814,7 @@ Get the driver field of the given VBD.
\noindent {\bf Return Type:}
{\tt
-driver\_type
+float
}
@@ -9089,13 +9822,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_driver}
+\subsubsection{RPC name:~get\_io\_write\_kbs}
{\bf Overview:}
-Set the driver field of the given VBD.
+Get the io/write\_kbs field of the given VBD.
\noindent {\bf Signature:}
-\begin{verbatim} void set_driver (session_id s, VBD ref self, driver_type value)\end{verbatim}
+\begin{verbatim} float get_io_write_kbs (session_id s, VBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9107,7 +9840,69 @@ Set the driver field of the given VBD.
{\bf type} & {\bf name} & {\bf description} \\ \hline
{\tt VBD ref } & self & reference to the object \\ \hline
-{\tt driver\_type } & value & New value to set \\ \hline
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+float
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~create}
+
+{\bf Overview:}
+Create a new VBD instance, and return its handle.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VBD ref) create (session_id s, VBD record args)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD record } & args & All constructor arguments \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VBD ref
+}
+
+
+reference to the newly created object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~destroy}
+
+{\bf Overview:}
+Destroy the specified VBD instance.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void destroy (session_id s, VBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9123,13 +9918,45 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_io\_read\_kbs}
+\subsubsection{RPC name:~get\_by\_uuid}
{\bf Overview:}
-Get the io/read\_kbs field of the given VBD.
+Get a reference to the VBD instance with the specified UUID.
\noindent {\bf Signature:}
-\begin{verbatim} float get_io_read_kbs (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} (VBD ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VBD ref
+}
+
+
+reference to the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_record}
+
+{\bf Overview:}
+Get a record containing the current state of the given VBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VBD record) get_record (session_id s, VBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9147,7 +9974,60 @@ Get the io/read\_kbs field of the given VBD.
\noindent {\bf Return Type:}
{\tt
-float
+VBD record
+}
+
+
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
+\section{Class: PBD}
+\subsection{Fields for class: PBD}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf PBD} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The physical block devices through which hosts access SRs.}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt host} & host ref & physical machine on which the pbd is available \\
+$\mathit{RO}_\mathit{ins}$ & {\tt SR} & SR ref & the storage repository that the pbd realises \\
+$\mathit{RO}_\mathit{ins}$ & {\tt device\_config} & (string $\rightarrow$ string) Map & a config string that is provided to the host's SR-backend-driver \\
+$\mathit{RO}_\mathit{run}$ & {\tt currently\_attached} & bool & is the SR currently attached on this host? \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: PBD}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (session_id s, PBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+string
}
@@ -9155,13 +10035,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_io\_write\_kbs}
+\subsubsection{RPC name:~get\_host}
{\bf Overview:}
-Get the io/write\_kbs field of the given VBD.
+Get the host field of the given PBD.
\noindent {\bf Signature:}
-\begin{verbatim} float get_io_write_kbs (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} (host ref) get_host (session_id s, PBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9171,7 +10051,7 @@ Get the io/write\_kbs field of the given VBD.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VBD ref } & self & reference to the object \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9179,7 +10059,103 @@ Get the io/write\_kbs field of the given VBD.
\noindent {\bf Return Type:}
{\tt
-float
+host ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_SR}
+
+{\bf Overview:}
+Get the SR field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (SR ref) get_SR (session_id s, PBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+SR ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_device\_config}
+
+{\bf Overview:}
+Get the device\_config field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_device_config (session_id s, PBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_currently\_attached}
+
+{\bf Overview:}
+Get the currently\_attached field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} bool get_currently_attached (session_id s, PBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+bool
}
@@ -9190,10 +10166,10 @@ value of the field
\subsubsection{RPC name:~create}
{\bf Overview:}
-Create a new VBD instance, and return its handle.
+Create a new PBD instance, and return its handle.
\noindent {\bf Signature:}
-\begin{verbatim} (VBD ref) create (session_id s, VBD record args)\end{verbatim}
+\begin{verbatim} (PBD ref) create (session_id s, PBD record args)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9203,7 +10179,7 @@ Create a new VBD instance, and return its handle.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VBD record } & args & All constructor arguments \\ \hline
+{\tt PBD record } & args & All constructor arguments \\ \hline
\end{tabular}
@@ -9211,7 +10187,7 @@ Create a new VBD instance, and return its handle.
\noindent {\bf Return Type:}
{\tt
-VBD ref
+PBD ref
}
@@ -9222,10 +10198,10 @@ reference to the newly created object
\subsubsection{RPC name:~destroy}
{\bf Overview:}
-Destroy the specified VBD instance.
+Destroy the specified PBD instance.
\noindent {\bf Signature:}
-\begin{verbatim} void destroy (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} void destroy (session_id s, PBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9235,7 +10211,7 @@ Destroy the specified VBD instance.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VBD ref } & self & reference to the object \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9254,10 +10230,10 @@ void
\subsubsection{RPC name:~get\_by\_uuid}
{\bf Overview:}
-Get a reference to the VBD instance with the specified UUID.
+Get a reference to the PBD instance with the specified UUID.
\noindent {\bf Signature:}
-\begin{verbatim} (VBD ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+\begin{verbatim} (PBD ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9275,7 +10251,7 @@ Get a reference to the VBD instance with the specified UUID.
\noindent {\bf Return Type:}
{\tt
-VBD ref
+PBD ref
}
@@ -9286,10 +10262,10 @@ reference to the object
\subsubsection{RPC name:~get\_record}
{\bf Overview:}
-Get a record containing the current state of the given VBD.
+Get a record containing the current state of the given PBD.
\noindent {\bf Signature:}
-\begin{verbatim} (VBD record) get_record (session_id s, VBD ref self)\end{verbatim}
+\begin{verbatim} (PBD record) get_record (session_id s, PBD ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9299,7 +10275,7 @@ Get a record containing the current state of the given VBD.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VBD ref } & self & reference to the object \\ \hline
+{\tt PBD ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9307,7 +10283,7 @@ Get a record containing the current state of the given VBD.
\noindent {\bf Return Type:}
{\tt
-VBD record
+PBD record
}
@@ -9318,30 +10294,50 @@ all fields from the object
\vspace{1cm}
\newpage
-\section{Class: VTPM}
-\subsection{Fields for class: VTPM}
+\section{Class: crashdump}
+\subsection{Fields for class: crashdump}
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
-\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VTPM} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual TPM device}} \\
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf crashdump} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+VM crashdump.}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & the virtual machine \\
-$\mathit{RO}_\mathit{ins}$ & {\tt backend} & VM ref & the domain where the backend is located \\
-$\mathit{RO}_\mathit{ins}$ & {\tt driver} & driver\_type & the style of driver \\
-$\mathit{RO}_\mathit{ins}$ & {\tt instance} & int & the instance number the virtual TPM represents \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VDI} & VDI ref & the virtual disk \\
\hline
\end{longtable}
-\subsection{Additional RPCs associated with class: VTPM}
+\subsection{Additional RPCs associated with class: crashdump}
+\subsubsection{RPC name:~get\_all}
+
+{\bf Overview:}
+Return a list of all the crashdumps known to the system.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((crashdump ref) Set) get_all (session_id s)\end{verbatim}
+
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(crashdump ref) Set
+}
+
+
+references to all objects
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_uuid}
{\bf Overview:}
-Get the uuid field of the given VTPM.
+Get the uuid field of the given crashdump.
\noindent {\bf Signature:}
-\begin{verbatim} string get_uuid (session_id s, VTPM ref self)\end{verbatim}
+\begin{verbatim} string get_uuid (session_id s, crashdump ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9351,7 +10347,7 @@ Get the uuid field of the given VTPM.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VTPM ref } & self & reference to the object \\ \hline
+{\tt crashdump ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9370,10 +10366,10 @@ value of the field
\subsubsection{RPC name:~get\_VM}
{\bf Overview:}
-Get the VM field of the given VTPM.
+Get the VM field of the given crashdump.
\noindent {\bf Signature:}
-\begin{verbatim} (VM ref) get_VM (session_id s, VTPM ref self)\end{verbatim}
+\begin{verbatim} (VM ref) get_VM (session_id s, crashdump ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9383,7 +10379,7 @@ Get the VM field of the given VTPM.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VTPM ref } & self & reference to the object \\ \hline
+{\tt crashdump ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9399,13 +10395,192 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_backend}
+\subsubsection{RPC name:~get\_VDI}
{\bf Overview:}
-Get the backend field of the given VTPM.
+Get the VDI field of the given crashdump.
\noindent {\bf Signature:}
-\begin{verbatim} (VM ref) get_backend (session_id s, VTPM ref self)\end{verbatim}
+\begin{verbatim} (VDI ref) get_VDI (session_id s, crashdump ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt crashdump ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VDI ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~create}
+
+{\bf Overview:}
+Create a new crashdump instance, and return its handle.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (crashdump ref) create (session_id s, crashdump record args)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt crashdump record } & args & All constructor arguments \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+crashdump ref
+}
+
+
+reference to the newly created object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~destroy}
+
+{\bf Overview:}
+Destroy the specified crashdump instance.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void destroy (session_id s, crashdump ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt crashdump ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_by\_uuid}
+
+{\bf Overview:}
+Get a reference to the crashdump instance with the specified UUID.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (crashdump ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+crashdump ref
+}
+
+
+reference to the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_record}
+
+{\bf Overview:}
+Get a record containing the current state of the given crashdump.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (crashdump record) get_record (session_id s, crashdump ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt crashdump ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+crashdump record
+}
+
+
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
+\section{Class: VTPM}
+\subsection{Fields for class: VTPM}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VTPM} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+virtual TPM device.}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & the virtual machine \\
+$\mathit{RO}_\mathit{ins}$ & {\tt backend} & VM ref & the domain where the backend is located \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: VTPM}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given VTPM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (session_id s, VTPM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9423,7 +10598,7 @@ Get the backend field of the given VTPM.
\noindent {\bf Return Type:}
{\tt
-VM ref
+string
}
@@ -9431,13 +10606,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_driver}
+\subsubsection{RPC name:~get\_VM}
{\bf Overview:}
-Get the driver field of the given VTPM.
+Get the VM field of the given VTPM.
\noindent {\bf Signature:}
-\begin{verbatim} (driver_type) get_driver (session_id s, VTPM ref self)\end{verbatim}
+\begin{verbatim} (VM ref) get_VM (session_id s, VTPM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9455,7 +10630,7 @@ Get the driver field of the given VTPM.
\noindent {\bf Return Type:}
{\tt
-driver\_type
+VM ref
}
@@ -9463,13 +10638,13 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_instance}
+\subsubsection{RPC name:~get\_backend}
{\bf Overview:}
-Get the instance field of the given VTPM.
+Get the backend field of the given VTPM.
\noindent {\bf Signature:}
-\begin{verbatim} int get_instance (session_id s, VTPM ref self)\end{verbatim}
+\begin{verbatim} (VM ref) get_backend (session_id s, VTPM ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9487,7 +10662,7 @@ Get the instance field of the given VTPM.
\noindent {\bf Return Type:}
{\tt
-int
+VM ref
}
@@ -9631,7 +10806,8 @@ all fields from the object
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf console} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A console}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+console.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -9642,13 +10818,13 @@ $\mathit{RO}_\mathit{run}$ & {\tt VM} & VM ref & VM to which this console is at
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: console}
-\subsubsection{RPC name:~get\_record}
+\subsubsection{RPC name:~get\_uuid}
{\bf Overview:}
-Get the current state of the given console.
+Get the uuid field of the given console.
\noindent {\bf Signature:}
-\begin{verbatim} (console record) get_record (session_id s, console ref self)\end{verbatim}
+\begin{verbatim} string get_uuid (session_id s, console ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9666,21 +10842,21 @@ Get the current state of the given console.
\noindent {\bf Return Type:}
{\tt
-console record
+string
}
-all fields from the object
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_by\_uuid}
+\subsubsection{RPC name:~get\_protocol}
{\bf Overview:}
-Get a reference to the object with the specified UUID.
+Get the protocol field of the given console.
\noindent {\bf Signature:}
-\begin{verbatim} (console ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
+\begin{verbatim} (console_protocol) get_protocol (session_id s, console ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9690,7 +10866,7 @@ Get a reference to the object with the specified UUID.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt string } & uuid & UUID of object to return \\ \hline
+{\tt console ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9698,21 +10874,21 @@ Get a reference to the object with the specified UUID.
\noindent {\bf Return Type:}
{\tt
-console ref
+console\_protocol
}
-reference to the object
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~create}
+\subsubsection{RPC name:~get\_uri}
{\bf Overview:}
-Create a new console instance, and return its handle.
+Get the uri field of the given console.
\noindent {\bf Signature:}
-\begin{verbatim} (console ref) create (session_id s, console record args)\end{verbatim}
+\begin{verbatim} string get_uri (session_id s, console ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9722,7 +10898,7 @@ Create a new console instance, and return its handle.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt console record } & args & All constructor arguments \\ \hline
+{\tt console ref } & self & reference to the object \\ \hline
\end{tabular}
@@ -9730,21 +10906,21 @@ Create a new console instance, and return its handle.
\noindent {\bf Return Type:}
{\tt
-console ref
+string
}
-reference to the newly created object
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~destroy}
+\subsubsection{RPC name:~get\_VM}
{\bf Overview:}
-Destroy the specified console instance.
+Get the VM field of the given console.
\noindent {\bf Signature:}
-\begin{verbatim} void destroy (session_id s, console ref self)\end{verbatim}
+\begin{verbatim} (VM ref) get_VM (session_id s, console ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9762,21 +10938,21 @@ Destroy the specified console instance.
\noindent {\bf Return Type:}
{\tt
-void
+VM ref
}
-
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_uuid}
+\subsubsection{RPC name:~create}
{\bf Overview:}
-Get the uuid field of the given console.
+Create a new console instance, and return its handle.
\noindent {\bf Signature:}
-\begin{verbatim} string get_uuid (session_id s, console ref self)\end{verbatim}
+\begin{verbatim} (console ref) create (session_id s, console record args)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9786,7 +10962,7 @@ Get the uuid field of the given console.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt console ref } & self & reference to the object \\ \hline
+{\tt console record } & args & All constructor arguments \\ \hline
\end{tabular}
@@ -9794,21 +10970,21 @@ Get the uuid field of the given console.
\noindent {\bf Return Type:}
{\tt
-string
+console ref
}
-value of the field
+reference to the newly created object
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_protocol}
+\subsubsection{RPC name:~destroy}
{\bf Overview:}
-Get the protocol field of the given console.
+Destroy the specified console instance.
\noindent {\bf Signature:}
-\begin{verbatim} (console_protocol) get_protocol (session_id s, console ref self)\end{verbatim}
+\begin{verbatim} void destroy (session_id s, console ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9826,21 +11002,21 @@ Get the protocol field of the given console.
\noindent {\bf Return Type:}
{\tt
-console\_protocol
+void
}
-value of the field
+
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_uri}
+\subsubsection{RPC name:~get\_by\_uuid}
{\bf Overview:}
-Get the uri field of the given console.
+Get a reference to the console instance with the specified UUID.
\noindent {\bf Signature:}
-\begin{verbatim} string get_uri (session_id s, console ref self)\end{verbatim}
+\begin{verbatim} (console ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9850,7 +11026,7 @@ Get the uri field of the given console.
\begin{tabular}{|c|c|p{7cm}|}
\hline
{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt console ref } & self & reference to the object \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
\end{tabular}
@@ -9858,21 +11034,21 @@ Get the uri field of the given console.
\noindent {\bf Return Type:}
{\tt
-string
+console ref
}
-value of the field
+reference to the object
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VM}
+\subsubsection{RPC name:~get\_record}
{\bf Overview:}
-Get the VM field of the given console.
+Get a record containing the current state of the given console.
\noindent {\bf Signature:}
-\begin{verbatim} (VM ref) get_VM (session_id s, console ref self)\end{verbatim}
+\begin{verbatim} (console record) get_record (session_id s, console ref self)\end{verbatim}
\noindent{\bf Arguments:}
@@ -9890,11 +11066,11 @@ Get the VM field of the given console.
\noindent {\bf Return Type:}
{\tt
-VM ref
+console record
}
-value of the field
+all fields from the object
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
@@ -9906,7 +11082,8 @@ value of the field
\begin{longtable}{|lllp{0.38\textwidth}|}
\hline
\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf user} \\
-\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A user of the system}} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
+user of the system.}} \\
\hline
Quals & Field & Type & Description \\
\hline
@@ -10205,7 +11382,7 @@ A list of all the IDs of all the debug records
\subsubsection{RPC name:~return\_failure}
{\bf Overview:}
-Return an API 'successful' failure
+Return an API 'successful' failure.
\noindent {\bf Signature:}
\begin{verbatim} void return_failure (session_id s)\end{verbatim}
@@ -10438,6 +11615,16 @@ The handle parameter echoes the bad value given.
\begin{verbatim}HOST_HANDLE_INVALID(handle)\end{verbatim}
\begin{center}\rule{10em}{0.1pt}\end{center}
+\subsubsection{HOST\_METRICS\_HANDLE\_INVALID}
+
+You gave an invalid host\_metrics handle. The host\_metrics may have
+recently been deleted. The handle parameter echoes the bad value given.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}HOST_METRICS_HANDLE_INVALID(handle)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
\subsubsection{INTERNAL\_ERROR}
The server failed to handle your request, due to an internal error. The
@@ -10490,6 +11677,46 @@ already attached to some other PIF, and so the creation failed.
\begin{verbatim}NETWORK_ALREADY_CONNECTED(network, connected PIF)\end{verbatim}
\begin{center}\rule{10em}{0.1pt}\end{center}
+\subsubsection{OPERATION\_NOT\_ALLOWED}
+
+You attempted an operation that was not allowed.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}OPERATION_NOT_ALLOWED()\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
+\subsubsection{PIF\_HANDLE\_INVALID}
+
+You gave an invalid PIF handle. The PIF may have recently been deleted.
+The handle parameter echoes the bad value given.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}PIF_HANDLE_INVALID(handle)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
+\subsubsection{PIF\_IS\_PHYSICAL}
+
+You tried to destroy a PIF, but it represents an aspect of the physical
+host configuration, and so cannot be destroyed. The parameter echoes the
+PIF handle you gave.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}PIF_IS_PHYSICAL(PIF)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
+\subsubsection{PIF\_METRICS\_HANDLE\_INVALID}
+
+You gave an invalid PIF\_metrics handle. The PIF\_metrics may have
+recently been deleted. The handle parameter echoes the bad value given.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}PIF_METRICS_HANDLE_INVALID(handle)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
\subsubsection{SESSION\_AUTHENTICATION\_FAILED}
The credentials given by the user are incorrect, so access has been denied,
@@ -10521,6 +11748,16 @@ handle parameter echoes the bad value given.
\begin{verbatim}SR_HANDLE_INVALID(handle)\end{verbatim}
\begin{center}\rule{10em}{0.1pt}\end{center}
+\subsubsection{TASK\_HANDLE\_INVALID}
+
+You gave an invalid task handle. The task may have recently been deleted.
+The handle parameter echoes the bad value given.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}TASK_HANDLE_INVALID(handle)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
\subsubsection{VBD\_HANDLE\_INVALID}
You gave an invalid VBD handle. The VBD may have recently been deleted.
@@ -10551,11 +11788,21 @@ The handle parameter echoes the bad value given.
\begin{verbatim}VIF_HANDLE_INVALID(handle)\end{verbatim}
\begin{center}\rule{10em}{0.1pt}\end{center}
+\subsubsection{VLAN\_TAG\_INVALID}
+
+You tried to create a VLAN, but the tag you gave was invalid -- it mmust be
+between 0 and 4095. The parameter echoes the VLAN tag you gave.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}VLAN_TAG_INVALID(VLAN)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
\subsubsection{VM\_BAD\_POWER\_STATE}
You attempted an operation on a VM that was not in an appropriate power
state at the time; for example, you attempted to start a VM that was
-already running. The parameters returned are the VM's UUID, and the
+already running. The parameters returned are the VM's handle, and the
expected and actual VM state at the time of the call.
\vspace{0.3cm}
@@ -10573,6 +11820,16 @@ handle parameter echoes the bad value given.
\begin{verbatim}VM_HANDLE_INVALID(handle)\end{verbatim}
\begin{center}\rule{10em}{0.1pt}\end{center}
+\subsubsection{VM\_METRICS\_HANDLE\_INVALID}
+
+You gave an invalid VM\_metrics handle. The VM\_metrics may have recently
+been deleted. The handle parameter echoes the bad value given.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}VM_METRICS_HANDLE_INVALID(handle)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
\subsubsection{VTPM\_HANDLE\_INVALID}
You gave an invalid VTPM handle. The VTPM may have recently been deleted.
diff --git a/linux-2.6-xen-sparse/arch/i386/kernel/vmlinux.lds.S b/linux-2.6-xen-sparse/arch/i386/kernel/vmlinux.lds.S
index 1e7ac1c44d..2153fc7da3 100644
--- a/linux-2.6-xen-sparse/arch/i386/kernel/vmlinux.lds.S
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/vmlinux.lds.S
@@ -51,6 +51,7 @@ SECTIONS
__tracedata_end = .;
/* writeable */
+ . = ALIGN(4096);
.data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
*(.data)
CONSTRUCTORS
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
index f58b6dca2d..dea4b22923 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
@@ -48,6 +48,7 @@ cpumask_t cpu_online_map;
EXPORT_SYMBOL(cpu_online_map);
cpumask_t cpu_possible_map;
EXPORT_SYMBOL(cpu_possible_map);
+static cpumask_t cpu_initialized_map;
struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
EXPORT_SYMBOL(cpu_data);
@@ -278,6 +279,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
if (xen_smp_intr_init(0))
BUG();
+ cpu_initialized_map = cpumask_of_cpu(0);
+
/* Restrict the possible_map according to max_cpus. */
while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
for (cpu = NR_CPUS-1; !cpu_isset(cpu, cpu_possible_map); cpu--)
@@ -330,8 +333,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
#else
cpu_set(cpu, cpu_present_map);
#endif
-
- cpu_initialize_context(cpu);
}
init_xenbus_allowed_cpumask();
@@ -418,6 +419,11 @@ int __devinit __cpu_up(unsigned int cpu)
if (rc)
return rc;
+ if (!cpu_isset(cpu, cpu_initialized_map)) {
+ cpu_set(cpu, cpu_initialized_map);
+ cpu_initialize_context(cpu);
+ }
+
if (num_online_cpus() == 1)
alternatives_smp_switch(1);
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 581b670568..af530ac65d 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -53,6 +53,9 @@ mk-symlinks-xen:
mkdir -p xen/arch-x86
( cd xen/arch-x86 && ln -sf ../../$(XEN_ROOT)/xen/include/public/arch-x86/*.h . )
mkdir -p xen/foreign
- ( cd xen/foreign && ln -sf ../../$(XEN_ROOT)/xen/include/public/foreign/*.h . )
+ ( cd xen/foreign && ln -sf ../../$(XEN_ROOT)/xen/include/public/foreign/Makefile . )
+ ( cd xen/foreign && ln -sf ../../$(XEN_ROOT)/xen/include/public/foreign/reference.size . )
+ ( cd xen/foreign && ln -sf ../../$(XEN_ROOT)/xen/include/public/foreign/*.py . )
+ make -C xen/foreign
mk-symlinks: mk-symlinks-xen mk-symlinks-$(XEN_OS)
diff --git a/tools/blktap/Makefile b/tools/blktap/Makefile
index fb194f3203..671c4f4b87 100644
--- a/tools/blktap/Makefile
+++ b/tools/blktap/Makefile
@@ -9,7 +9,7 @@ SUBDIRS-y += drivers
all: build
.PHONY: build
-build: mk-symlinks
+build:
@set -e; for subdir in $(SUBDIRS-y); do \
$(MAKE) -C $$subdir all; \
done
@@ -22,7 +22,7 @@ install:
.PHONY: clean
clean:
- rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS
+ rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) TAGS
@set -e; for subdir in $(SUBDIRS-y); do \
$(MAKE) -C $$subdir clean; \
done
diff --git a/tools/firmware/rombios/tcgbios.c b/tools/firmware/rombios/tcgbios.c
index 0f3668f89a..c8f5af2853 100644
--- a/tools/firmware/rombios/tcgbios.c
+++ b/tools/firmware/rombios/tcgbios.c
@@ -39,7 +39,7 @@ Bit32u tcpa_extend_acpi_log(entry_ptr)
Bit32u entry_ptr;
{
ASM_START
- DoUpcall IDX_TCPA_EXTEND_ACPI_LOG
+ DoUpcall(IDX_TCPA_EXTEND_ACPI_LOG)
ASM_END
}
@@ -52,7 +52,7 @@ Bit32u tcpa_extend_acpi_log(entry_ptr)
tcpa_acpi_init()
{
ASM_START
- DoUpcall IDX_TCPA_ACPI_INIT
+ DoUpcall(IDX_TCPA_ACPI_INIT)
ASM_END
}
@@ -64,7 +64,7 @@ tcpa_acpi_init()
tcpa_calling_int19h()
{
ASM_START
- DoUpcall IDX_TCPA_CALLING_INT19H
+ DoUpcall(IDX_TCPA_CALLING_INT19H)
ASM_END
}
@@ -75,7 +75,7 @@ tcpa_calling_int19h()
tcpa_returned_int19h()
{
ASM_START
- DoUpcall IDX_TCPA_RETURNED_INT19H
+ DoUpcall(IDX_TCPA_RETURNED_INT19H)
ASM_END
}
@@ -86,7 +86,7 @@ tcpa_returned_int19h()
tcpa_add_event_separators()
{
ASM_START
- DoUpcall IDX_TCPA_ADD_EVENT_SEPARATORS
+ DoUpcall(IDX_TCPA_ADD_EVENT_SEPARATORS)
ASM_END
}
@@ -98,7 +98,7 @@ tcpa_add_event_separators()
tcpa_wake_event()
{
ASM_START
- DoUpcall IDX_TCPA_WAKE_EVENT
+ DoUpcall(IDX_TCPA_WAKE_EVENT)
ASM_END
}
@@ -111,7 +111,7 @@ tcpa_wake_event()
tcpa_start_option_rom_scan()
{
ASM_START
- DoUpcall IDX_TCPA_START_OPTION_ROM_SCAN
+ DoUpcall(IDX_TCPA_START_OPTION_ROM_SCAN)
ASM_END
}
@@ -124,7 +124,7 @@ tcpa_option_rom(seg)
Bit32u seg;
{
ASM_START
- DoUpcall IDX_TCPA_OPTION_ROM
+ DoUpcall(IDX_TCPA_OPTION_ROM)
ASM_END
}
@@ -138,7 +138,7 @@ void
Bit32u bootdrv;
{
ASM_START
- DoUpcall IDX_TCPA_ADD_BOOTDEVICE
+ DoUpcall(IDX_TCPA_ADD_BOOTDEVICE)
ASM_END
}
@@ -154,7 +154,7 @@ tcpa_ipl(seg)
Bit32u seg;
{
ASM_START
- DoUpcall IDX_TCPA_IPL
+ DoUpcall(IDX_TCPA_IPL)
ASM_END
}
@@ -164,7 +164,7 @@ tcpa_initialize_tpm(physpres)
Bit32u physpres;
{
ASM_START
- DoUpcall IDX_TCPA_INITIALIZE_TPM
+ DoUpcall(IDX_TCPA_INITIALIZE_TPM)
ASM_END
}
@@ -174,7 +174,7 @@ tcpa_measure_post(from, to)
Bit32u to;
{
ASM_START
- DoUpcall IDX_TCPA_MEASURE_POST
+ DoUpcall(IDX_TCPA_MEASURE_POST)
ASM_END
}
@@ -194,12 +194,12 @@ tcpa_do_measure_POSTs()
{
ASM_START
- POST_MEASURE post, nmi
- POST_MEASURE floppy_drive_post, hard_drive_post
- POST_MEASURE hard_drive_post, ebda_post
- POST_MEASURE ebda_post, eoi_jmp_post
- POST_MEASURE eoi_jmp_post, timer_tick_post
- POST_MEASURE timer_tick_post, int76_handler
+ POST_MEASURE(post, nmi)
+ POST_MEASURE(floppy_drive_post, hard_drive_post)
+ POST_MEASURE(hard_drive_post, ebda_post)
+ POST_MEASURE(ebda_post, eoi_jmp_post)
+ POST_MEASURE(eoi_jmp_post, timer_tick_post)
+ POST_MEASURE(timer_tick_post, int76_handler)
ret
ASM_END
@@ -213,7 +213,7 @@ TCGInterruptHandler(regs_ptr, es, ds, flags_ptr)
Bit32u flags_ptr;
{
ASM_START
- DoUpcall IDX_TCGINTERRUPTHANDLER
+ DoUpcall(IDX_TCGINTERRUPTHANDLER)
ASM_END
}
diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c
index 44d46e3f66..d8bfe485d8 100644
--- a/tools/libxc/xc_dom_boot.c
+++ b/tools/libxc/xc_dom_boot.c
@@ -157,6 +157,12 @@ static int arch_setup_early(struct xc_dom_image *dom)
return rc;
}
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
+ xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+ return 0;
+}
+
static int arch_setup_late(struct xc_dom_image *dom)
{
static const struct {
@@ -259,6 +265,12 @@ static int arch_setup_late(struct xc_dom_image *dom)
static int arch_setup_early(struct xc_dom_image *dom)
{
+ xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+ return 0;
+}
+
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
DECLARE_DOMCTL;
int rc;
@@ -268,16 +280,35 @@ static int arch_setup_early(struct xc_dom_image *dom)
domctl.cmd = XEN_DOMCTL_arch_setup;
domctl.domain = dom->guest_domid;
domctl.u.arch_setup.flags = 0;
+
+ /* dom->start_info_pfn should be initialized by alloc_magic_pages().
+ * However it is called later. So we initialize here.
+ */
+ dom->start_info_pfn = dom->total_pages - 3;
domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
+ sizeof(start_info_t);
- domctl.u.arch_setup.maxmem = dom->total_pages << PAGE_SHIFT;
+ /* 3 = start info page, xenstore page and console page */
+ domctl.u.arch_setup.maxmem = (dom->total_pages - 3) << PAGE_SHIFT;
rc = do_domctl(dom->guest_xc, &domctl);
return rc;
}
static int arch_setup_late(struct xc_dom_image *dom)
{
- xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+ unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
+ shared_info_t *shared_info;
+
+ /* setup shared_info page */
+ xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
+ __FUNCTION__, dom->shared_info_mfn);
+ shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+ page_size,
+ PROT_READ | PROT_WRITE,
+ dom->shared_info_mfn);
+ if (NULL == shared_info)
+ return -1;
+ dom->arch_hooks->shared_info(dom, shared_info);
+ munmap(shared_info, page_size);
return 0;
}
@@ -292,6 +323,12 @@ static int arch_setup_early(struct xc_dom_image *dom)
return 0;
}
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
+ xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+ return 0;
+}
+
static int arch_setup_late(struct xc_dom_image *dom)
{
start_info_t *si =
@@ -324,6 +361,12 @@ static int arch_setup_early(struct xc_dom_image *dom)
return 0;
}
+static int arch_setup_middle(struct xc_dom_image *dom)
+{
+ xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+ return 0;
+}
+
static int arch_setup_late(struct xc_dom_image *dom)
{
xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
@@ -395,6 +438,9 @@ int xc_dom_boot_mem_init(struct xc_dom_image *dom)
return rc;
}
+ if (0 != (rc = arch_setup_middle(dom)))
+ return rc;
+
return 0;
}
diff --git a/tools/libxc/xc_dom_ia64.c b/tools/libxc/xc_dom_ia64.c
index 7214c3c299..c6e4424515 100644
--- a/tools/libxc/xc_dom_ia64.c
+++ b/tools/libxc/xc_dom_ia64.c
@@ -26,7 +26,11 @@ static int alloc_magic_pages(struct xc_dom_image *dom)
/* allocate special pages */
dom->console_pfn = dom->total_pages -1;
dom->xenstore_pfn = dom->total_pages -2;
- dom->start_info_pfn = dom->total_pages -3;
+
+ /*
+ * this is initialized by arch_setup_middle().
+ * dom->start_info_pfn = dom->total_pages -3;
+ */
return 0;
}
@@ -39,6 +43,7 @@ static int start_info_ia64(struct xc_dom_image *dom)
xc_dom_printf("%s\n", __FUNCTION__);
+ memset(start_info, 0, sizeof(*start_info));
sprintf(start_info->magic, dom->guest_type);
start_info->flags = dom->flags;
start_info->nr_pages = dom->total_pages;
@@ -54,12 +59,12 @@ static int start_info_ia64(struct xc_dom_image *dom)
bp->initrd_start = start_info->mod_start;
bp->initrd_size = start_info->mod_len;
}
+ bp->command_line = (dom->start_info_pfn << PAGE_SHIFT_IA64)
+ + offsetof(start_info_t, cmd_line);
if (dom->cmdline)
{
strncpy((char *)start_info->cmd_line, dom->cmdline, MAX_GUEST_CMDLINE);
start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = '\0';
- bp->command_line = (dom->start_info_pfn << PAGE_SHIFT_IA64)
- + offsetof(start_info_t, cmd_line);
}
return 0;
}
diff --git a/tools/libxc/xc_hvm_restore.c b/tools/libxc/xc_hvm_restore.c
index 7092d5cea8..b2b9999fea 100644
--- a/tools/libxc/xc_hvm_restore.c
+++ b/tools/libxc/xc_hvm_restore.c
@@ -98,6 +98,8 @@ int xc_hvm_restore(int xc_handle, int io_fd,
/* Types of the pfns in the current region */
unsigned long region_pfn_type[MAX_BATCH_SIZE];
+ struct xen_add_to_physmap xatp;
+
/* hvm guest mem size (Mb) */
memsize = (unsigned long long)*store_mfn;
v_end = memsize << 20;
@@ -134,15 +136,6 @@ int xc_hvm_restore(int xc_handle, int io_fd,
goto out;
}
- /* Get the domain's shared-info frame. */
- domctl.cmd = XEN_DOMCTL_getdomaininfo;
- domctl.domain = (domid_t)dom;
- if (xc_domctl(xc_handle, &domctl) < 0) {
- ERROR("Could not get information on new domain");
- goto out;
- }
- shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
-
if(xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
errno = ENOMEM;
goto out;
@@ -346,6 +339,21 @@ int xc_hvm_restore(int xc_handle, int io_fd,
}
}
+ /* Shared-info pfn */
+ if (!read_exact(io_fd, &(shared_info_frame), sizeof(uint32_t)) ) {
+ ERROR("reading the shared-info pfn failed!\n");
+ goto out;
+ }
+ /* Map the shared-info frame where it was before */
+ xatp.domid = dom;
+ xatp.space = XENMAPSPACE_shared_info;
+ xatp.idx = 0;
+ xatp.gpfn = shared_info_frame;
+ if ( (rc = xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp)) != 0 ) {
+ ERROR("setting the shared-info pfn failed!\n");
+ goto out;
+ }
+
rc = 0;
goto out;
diff --git a/tools/libxc/xc_hvm_save.c b/tools/libxc/xc_hvm_save.c
index aa6ad5a930..3d08a509d9 100644
--- a/tools/libxc/xc_hvm_save.c
+++ b/tools/libxc/xc_hvm_save.c
@@ -702,6 +702,12 @@ int xc_hvm_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
goto out;
}
}
+
+ /* Shared-info pfn */
+ if (!write_exact(io_fd, &(shared_info_frame), sizeof(uint32_t)) ) {
+ ERROR("write shared-info pfn failed!\n");
+ goto out;
+ }
/* Success! */
rc = 0;
diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c
index e6c1799d7c..de1c605002 100644
--- a/tools/libxc/xc_linux_save.c
+++ b/tools/libxc/xc_linux_save.c
@@ -998,7 +998,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
}
for ( j = 0; j < batch; j++ )
- ((uint32_t *)pfn_type)[i] = pfn_type[i];
+ ((uint32_t *)pfn_type)[j] = pfn_type[j];
if ( xc_get_pfn_type_batch(xc_handle, dom, batch,
(uint32_t *)pfn_type) )
{
@@ -1006,7 +1006,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
goto out;
}
for ( j = batch-1; j >= 0; j-- )
- pfn_type[i] = ((uint32_t *)pfn_type)[i];
+ pfn_type[j] = ((uint32_t *)pfn_type)[j];
for ( j = 0; j < batch; j++ )
{
diff --git a/tools/libxen/include/xen_cpu_feature.h b/tools/libxen/include/xen_cpu_feature.h
deleted file mode 100644
index 57a34d2773..0000000000
--- a/tools/libxen/include/xen_cpu_feature.h
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_CPU_FEATURE_H
-#define XEN_CPU_FEATURE_H
-
-
-#include "xen_common.h"
-
-
-enum xen_cpu_feature
-{
- /**
- * Onboard FPU
- */
- XEN_CPU_FEATURE_FPU,
-
- /**
- * Virtual Mode Extensions
- */
- XEN_CPU_FEATURE_VME,
-
- /**
- * Debugging Extensions
- */
- XEN_CPU_FEATURE_DE,
-
- /**
- * Page Size Extensions
- */
- XEN_CPU_FEATURE_PSE,
-
- /**
- * Time Stamp Counter
- */
- XEN_CPU_FEATURE_TSC,
-
- /**
- * Model-Specific Registers, RDMSR, WRMSR
- */
- XEN_CPU_FEATURE_MSR,
-
- /**
- * Physical Address Extensions
- */
- XEN_CPU_FEATURE_PAE,
-
- /**
- * Machine Check Architecture
- */
- XEN_CPU_FEATURE_MCE,
-
- /**
- * CMPXCHG8 instruction
- */
- XEN_CPU_FEATURE_CX8,
-
- /**
- * Onboard APIC
- */
- XEN_CPU_FEATURE_APIC,
-
- /**
- * SYSENTER/SYSEXIT
- */
- XEN_CPU_FEATURE_SEP,
-
- /**
- * Memory Type Range Registers
- */
- XEN_CPU_FEATURE_MTRR,
-
- /**
- * Page Global Enable
- */
- XEN_CPU_FEATURE_PGE,
-
- /**
- * Machine Check Architecture
- */
- XEN_CPU_FEATURE_MCA,
-
- /**
- * CMOV instruction (FCMOVCC and FCOMI too if FPU present)
- */
- XEN_CPU_FEATURE_CMOV,
-
- /**
- * Page Attribute Table
- */
- XEN_CPU_FEATURE_PAT,
-
- /**
- * 36-bit PSEs
- */
- XEN_CPU_FEATURE_PSE36,
-
- /**
- * Processor serial number
- */
- XEN_CPU_FEATURE_PN,
-
- /**
- * Supports the CLFLUSH instruction
- */
- XEN_CPU_FEATURE_CLFLSH,
-
- /**
- * Debug Trace Store
- */
- XEN_CPU_FEATURE_DTES,
-
- /**
- * ACPI via MSR
- */
- XEN_CPU_FEATURE_ACPI,
-
- /**
- * Multimedia Extensions
- */
- XEN_CPU_FEATURE_MMX,
-
- /**
- * FXSAVE and FXRSTOR instructions (fast save and restore
- */
- XEN_CPU_FEATURE_FXSR,
-
- /**
- * Streaming SIMD Extensions
- */
- XEN_CPU_FEATURE_XMM,
-
- /**
- * Streaming SIMD Extensions-2
- */
- XEN_CPU_FEATURE_XMM2,
-
- /**
- * CPU self snoop
- */
- XEN_CPU_FEATURE_SELFSNOOP,
-
- /**
- * Hyper-Threading
- */
- XEN_CPU_FEATURE_HT,
-
- /**
- * Automatic clock control
- */
- XEN_CPU_FEATURE_ACC,
-
- /**
- * IA-64 processor
- */
- XEN_CPU_FEATURE_IA64,
-
- /**
- * SYSCALL/SYSRET
- */
- XEN_CPU_FEATURE_SYSCALL,
-
- /**
- * MP Capable.
- */
- XEN_CPU_FEATURE_MP,
-
- /**
- * Execute Disable
- */
- XEN_CPU_FEATURE_NX,
-
- /**
- * AMD MMX extensions
- */
- XEN_CPU_FEATURE_MMXEXT,
-
- /**
- * Long Mode (x86-64)
- */
- XEN_CPU_FEATURE_LM,
-
- /**
- * AMD 3DNow! extensions
- */
- XEN_CPU_FEATURE_THREEDNOWEXT,
-
- /**
- * 3DNow!
- */
- XEN_CPU_FEATURE_THREEDNOW,
-
- /**
- * CPU in recovery mode
- */
- XEN_CPU_FEATURE_RECOVERY,
-
- /**
- * Longrun power control
- */
- XEN_CPU_FEATURE_LONGRUN,
-
- /**
- * LongRun table interface
- */
- XEN_CPU_FEATURE_LRTI,
-
- /**
- * Cyrix MMX extensions
- */
- XEN_CPU_FEATURE_CXMMX,
-
- /**
- * AMD K6 nonstandard MTRRs
- */
- XEN_CPU_FEATURE_K6_MTRR,
-
- /**
- * Cyrix ARRs (= MTRRs)
- */
- XEN_CPU_FEATURE_CYRIX_ARR,
-
- /**
- * Centaur MCRs (= MTRRs)
- */
- XEN_CPU_FEATURE_CENTAUR_MCR,
-
- /**
- * Opteron, Athlon64
- */
- XEN_CPU_FEATURE_K8,
-
- /**
- * Athlon
- */
- XEN_CPU_FEATURE_K7,
-
- /**
- * P3
- */
- XEN_CPU_FEATURE_P3,
-
- /**
- * P4
- */
- XEN_CPU_FEATURE_P4,
-
- /**
- * TSC ticks at a constant rate
- */
- XEN_CPU_FEATURE_CONSTANT_TSC,
-
- /**
- * FXSAVE leaks FOP/FIP/FOP
- */
- XEN_CPU_FEATURE_FXSAVE_LEAK,
-
- /**
- * Streaming SIMD Extensions-3
- */
- XEN_CPU_FEATURE_XMM3,
-
- /**
- * Monitor/Mwait support
- */
- XEN_CPU_FEATURE_MWAIT,
-
- /**
- * CPL Qualified Debug Store
- */
- XEN_CPU_FEATURE_DSCPL,
-
- /**
- * Enhanced SpeedStep
- */
- XEN_CPU_FEATURE_EST,
-
- /**
- * Thermal Monitor 2
- */
- XEN_CPU_FEATURE_TM2,
-
- /**
- * Context ID
- */
- XEN_CPU_FEATURE_CID,
-
- /**
- * CMPXCHG16B
- */
- XEN_CPU_FEATURE_CX16,
-
- /**
- * Send Task Priority Messages
- */
- XEN_CPU_FEATURE_XTPR,
-
- /**
- * on-CPU RNG present (xstore insn)
- */
- XEN_CPU_FEATURE_XSTORE,
-
- /**
- * on-CPU RNG enabled
- */
- XEN_CPU_FEATURE_XSTORE_EN,
-
- /**
- * on-CPU crypto (xcrypt insn)
- */
- XEN_CPU_FEATURE_XCRYPT,
-
- /**
- * on-CPU crypto enabled
- */
- XEN_CPU_FEATURE_XCRYPT_EN,
-
- /**
- * LAHF/SAHF in long mode
- */
- XEN_CPU_FEATURE_LAHF_LM,
-
- /**
- * If yes HyperThreading not valid
- */
- XEN_CPU_FEATURE_CMP_LEGACY,
-
- /**
- * VMX instruction set
- */
- XEN_CPU_FEATURE_VMX
-};
-
-
-typedef struct xen_cpu_feature_set
-{
- size_t size;
- enum xen_cpu_feature contents[];
-} xen_cpu_feature_set;
-
-/**
- * Allocate a xen_cpu_feature_set of the given size.
- */
-extern xen_cpu_feature_set *
-xen_cpu_feature_set_alloc(size_t size);
-
-/**
- * Free the given xen_cpu_feature_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_cpu_feature_set_free(xen_cpu_feature_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_cpu_feature_to_string(enum xen_cpu_feature val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_cpu_feature
-xen_cpu_feature_from_string(xen_session *session, const char *str);
-
-
-#endif
diff --git a/tools/libxen/include/xen_crashdump.h b/tools/libxen/include/xen_crashdump.h
new file mode 100644
index 0000000000..fff0a1a144
--- /dev/null
+++ b/tools/libxen/include/xen_crashdump.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_CRASHDUMP_H
+#define XEN_CRASHDUMP_H
+
+#include "xen_common.h"
+#include "xen_crashdump_decl.h"
+#include "xen_vdi_decl.h"
+#include "xen_vm_decl.h"
+
+
+/*
+ * The crashdump class.
+ *
+ * A VM crashdump.
+ */
+
+
+/**
+ * Free the given xen_crashdump. The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_crashdump_free(xen_crashdump crashdump);
+
+
+typedef struct xen_crashdump_set
+{
+ size_t size;
+ xen_crashdump *contents[];
+} xen_crashdump_set;
+
+/**
+ * Allocate a xen_crashdump_set of the given size.
+ */
+extern xen_crashdump_set *
+xen_crashdump_set_alloc(size_t size);
+
+/**
+ * Free the given xen_crashdump_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_crashdump_set_free(xen_crashdump_set *set);
+
+
+typedef struct xen_crashdump_record
+{
+ xen_crashdump handle;
+ char *uuid;
+ struct xen_vm_record_opt *vm;
+ struct xen_vdi_record_opt *vdi;
+} xen_crashdump_record;
+
+/**
+ * Allocate a xen_crashdump_record.
+ */
+extern xen_crashdump_record *
+xen_crashdump_record_alloc(void);
+
+/**
+ * Free the given xen_crashdump_record, and all referenced values. The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_free(xen_crashdump_record *record);
+
+
+typedef struct xen_crashdump_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_crashdump handle;
+ xen_crashdump_record *record;
+ } u;
+} xen_crashdump_record_opt;
+
+/**
+ * Allocate a xen_crashdump_record_opt.
+ */
+extern xen_crashdump_record_opt *
+xen_crashdump_record_opt_alloc(void);
+
+/**
+ * Free the given xen_crashdump_record_opt, and all referenced values.
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt);
+
+
+typedef struct xen_crashdump_record_set
+{
+ size_t size;
+ xen_crashdump_record *contents[];
+} xen_crashdump_record_set;
+
+/**
+ * Allocate a xen_crashdump_record_set of the given size.
+ */
+extern xen_crashdump_record_set *
+xen_crashdump_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_crashdump_record_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_set_free(xen_crashdump_record_set *set);
+
+
+
+typedef struct xen_crashdump_record_opt_set
+{
+ size_t size;
+ xen_crashdump_record_opt *contents[];
+} xen_crashdump_record_opt_set;
+
+/**
+ * Allocate a xen_crashdump_record_opt_set of the given size.
+ */
+extern xen_crashdump_record_opt_set *
+xen_crashdump_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_crashdump_record_opt_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump);
+
+
+/**
+ * Get a reference to the crashdump instance with the specified UUID.
+ */
+extern bool
+xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid);
+
+
+/**
+ * Create a new crashdump instance, and return its handle.
+ */
+extern bool
+xen_crashdump_create(xen_session *session, xen_crashdump *result, xen_crashdump_record *record);
+
+
+/**
+ * Destroy the specified crashdump instance.
+ */
+extern bool
+xen_crashdump_destroy(xen_session *session, xen_crashdump crashdump);
+
+
+/**
+ * Get the uuid field of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump);
+
+
+/**
+ * Get the VM field of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump);
+
+
+/**
+ * Get the VDI field of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump);
+
+
+/**
+ * Return a list of all the crashdumps known to the system.
+ */
+extern bool
+xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result);
+
+
+#endif
diff --git a/tools/libxen/include/xen_cpu_feature_internal.h b/tools/libxen/include/xen_crashdump_decl.h
index c4616a7c5f..3087715c4f 100644
--- a/tools/libxen/include/xen_cpu_feature_internal.h
+++ b/tools/libxen/include/xen_crashdump_decl.h
@@ -16,22 +16,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef XEN_CRASHDUMP_DECL_H
+#define XEN_CRASHDUMP_DECL_H
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_cpu_feature. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_CPU_FEATURE_INTERNAL_H
-#define XEN_CPU_FEATURE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_cpu_feature_abstract_type_;
-extern const abstract_type xen_cpu_feature_set_abstract_type_;
+typedef void *xen_crashdump;
+struct xen_crashdump_set;
+struct xen_crashdump_record;
+struct xen_crashdump_record_set;
+struct xen_crashdump_record_opt;
+struct xen_crashdump_record_opt_set;
#endif
diff --git a/tools/libxen/include/xen_driver_type.h b/tools/libxen/include/xen_driver_type.h
deleted file mode 100644
index 585db28979..0000000000
--- a/tools/libxen/include/xen_driver_type.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_DRIVER_TYPE_H
-#define XEN_DRIVER_TYPE_H
-
-
-#include "xen_common.h"
-
-
-enum xen_driver_type
-{
- /**
- * use hardware emulation
- */
- XEN_DRIVER_TYPE_IOEMU,
-
- /**
- * use paravirtualised driver
- */
- XEN_DRIVER_TYPE_PARAVIRTUALISED
-};
-
-
-typedef struct xen_driver_type_set
-{
- size_t size;
- enum xen_driver_type contents[];
-} xen_driver_type_set;
-
-/**
- * Allocate a xen_driver_type_set of the given size.
- */
-extern xen_driver_type_set *
-xen_driver_type_set_alloc(size_t size);
-
-/**
- * Free the given xen_driver_type_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_driver_type_set_free(xen_driver_type_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_driver_type_to_string(enum xen_driver_type val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_driver_type
-xen_driver_type_from_string(xen_session *session, const char *str);
-
-
-#endif
diff --git a/tools/libxen/include/xen_host.h b/tools/libxen/include/xen_host.h
index 5b1a4dca8a..e64390b89f 100644
--- a/tools/libxen/include/xen_host.h
+++ b/tools/libxen/include/xen_host.h
@@ -22,14 +22,17 @@
#include "xen_common.h"
#include "xen_host_cpu_decl.h"
#include "xen_host_decl.h"
+#include "xen_host_metrics_decl.h"
+#include "xen_pbd_decl.h"
#include "xen_pif_decl.h"
+#include "xen_sr_decl.h"
#include "xen_string_string_map.h"
#include "xen_vm_decl.h"
/*
- * The host class.
- *
+ * The host class.
+ *
* A physical host.
*/
@@ -69,9 +72,15 @@ typedef struct xen_host_record
char *name_label;
char *name_description;
xen_string_string_map *software_version;
+ xen_string_string_map *other_config;
struct xen_vm_record_opt_set *resident_vms;
+ xen_string_string_map *logging;
struct xen_pif_record_opt_set *pifs;
+ struct xen_sr_record_opt *suspend_image_sr;
+ struct xen_sr_record_opt *crash_dump_sr;
+ struct xen_pbd_record_opt_set *pbds;
struct xen_host_cpu_record_opt_set *host_cpus;
+ struct xen_host_metrics_record_opt *metrics;
} xen_host_record;
/**
@@ -217,6 +226,13 @@ xen_host_get_software_version(xen_session *session, xen_string_string_map **resu
/**
+ * Get the other_config field of the given host.
+ */
+extern bool
+xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host);
+
+
+/**
* Get the resident_VMs field of the given host.
*/
extern bool
@@ -224,6 +240,13 @@ xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_
/**
+ * Get the logging field of the given host.
+ */
+extern bool
+xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host);
+
+
+/**
* Get the PIFs field of the given host.
*/
extern bool
@@ -231,6 +254,27 @@ xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host ho
/**
+ * Get the suspend_image_sr field of the given host.
+ */
+extern bool
+xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host);
+
+
+/**
+ * Get the crash_dump_sr field of the given host.
+ */
+extern bool
+xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host);
+
+
+/**
+ * Get the PBDs field of the given host.
+ */
+extern bool
+xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host);
+
+
+/**
* Get the host_CPUs field of the given host.
*/
extern bool
@@ -238,6 +282,13 @@ xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, x
/**
+ * Get the metrics field of the given host.
+ */
+extern bool
+xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host);
+
+
+/**
* Set the name/label field of the given host.
*/
extern bool
@@ -252,6 +303,66 @@ xen_host_set_name_description(xen_session *session, xen_host host, char *descrip
/**
+ * Set the other_config field of the given host.
+ */
+extern bool
+xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * host.
+ */
+extern bool
+xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given host. If the key is not in that Map, then
+ * do nothing.
+ */
+extern bool
+xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key);
+
+
+/**
+ * Set the logging field of the given host.
+ */
+extern bool
+xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging);
+
+
+/**
+ * Add the given key-value pair to the logging field of the given host.
+ */
+extern bool
+xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the logging
+ * field of the given host. If the key is not in that Map, then do nothing.
+ */
+extern bool
+xen_host_remove_from_logging(xen_session *session, xen_host host, char *key);
+
+
+/**
+ * Set the suspend_image_sr field of the given host.
+ */
+extern bool
+xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr);
+
+
+/**
+ * Set the crash_dump_sr field of the given host.
+ */
+extern bool
+xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr);
+
+
+/**
* Puts the host into a state in which no new VMs can be started.
* Currently active VMs on the host continue to execute.
*/
diff --git a/tools/libxen/include/xen_host_cpu.h b/tools/libxen/include/xen_host_cpu.h
index 15aee488d4..945a7279d1 100644
--- a/tools/libxen/include/xen_host_cpu.h
+++ b/tools/libxen/include/xen_host_cpu.h
@@ -20,7 +20,6 @@
#define XEN_HOST_CPU_H
#include "xen_common.h"
-#include "xen_cpu_feature.h"
#include "xen_host_cpu_decl.h"
#include "xen_host_decl.h"
@@ -69,7 +68,6 @@ typedef struct xen_host_cpu_record
char *vendor;
int64_t speed;
char *modelname;
- struct xen_cpu_feature_set *features;
double utilisation;
} xen_host_cpu_record;
@@ -223,13 +221,6 @@ xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu hos
/**
- * Get the features field of the given host_cpu.
- */
-extern bool
-xen_host_cpu_get_features(xen_session *session, struct xen_cpu_feature_set **result, xen_host_cpu host_cpu);
-
-
-/**
* Get the utilisation field of the given host_cpu.
*/
extern bool
diff --git a/tools/libxen/include/xen_host_metrics.h b/tools/libxen/include/xen_host_metrics.h
new file mode 100644
index 0000000000..6ee609a9e9
--- /dev/null
+++ b/tools/libxen/include/xen_host_metrics.h
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_HOST_METRICS_H
+#define XEN_HOST_METRICS_H
+
+#include "xen_common.h"
+#include "xen_host_decl.h"
+#include "xen_host_metrics_decl.h"
+
+
+/*
+ * The host_metrics class.
+ *
+ * The metrics associated with a host.
+ */
+
+
+/**
+ * Free the given xen_host_metrics. The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_metrics_free(xen_host_metrics host_metrics);
+
+
+typedef struct xen_host_metrics_set
+{
+ size_t size;
+ xen_host_metrics *contents[];
+} xen_host_metrics_set;
+
+/**
+ * Allocate a xen_host_metrics_set of the given size.
+ */
+extern xen_host_metrics_set *
+xen_host_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_metrics_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_metrics_set_free(xen_host_metrics_set *set);
+
+
+typedef struct xen_host_metrics_record
+{
+ xen_host_metrics handle;
+ char *uuid;
+ struct xen_host_record_opt *host;
+ int64_t memory_total;
+ int64_t memory_free;
+} xen_host_metrics_record;
+
+/**
+ * Allocate a xen_host_metrics_record.
+ */
+extern xen_host_metrics_record *
+xen_host_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_host_metrics_record, and all referenced values.
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_free(xen_host_metrics_record *record);
+
+
+typedef struct xen_host_metrics_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_host_metrics handle;
+ xen_host_metrics_record *record;
+ } u;
+} xen_host_metrics_record_opt;
+
+/**
+ * Allocate a xen_host_metrics_record_opt.
+ */
+extern xen_host_metrics_record_opt *
+xen_host_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_host_metrics_record_opt, and all referenced
+ * values. The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_opt_free(xen_host_metrics_record_opt *record_opt);
+
+
+typedef struct xen_host_metrics_record_set
+{
+ size_t size;
+ xen_host_metrics_record *contents[];
+} xen_host_metrics_record_set;
+
+/**
+ * Allocate a xen_host_metrics_record_set of the given size.
+ */
+extern xen_host_metrics_record_set *
+xen_host_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_metrics_record_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_set_free(xen_host_metrics_record_set *set);
+
+
+
+typedef struct xen_host_metrics_record_opt_set
+{
+ size_t size;
+ xen_host_metrics_record_opt *contents[];
+} xen_host_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_host_metrics_record_opt_set of the given size.
+ */
+extern xen_host_metrics_record_opt_set *
+xen_host_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_metrics_record_opt_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_opt_set_free(xen_host_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics);
+
+
+/**
+ * Get a reference to the host_metrics instance with the specified
+ * UUID.
+ */
+extern bool
+xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid);
+
+
+/**
+ * Get the uuid field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics);
+
+
+/**
+ * Get the host field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_host(xen_session *session, xen_host *result, xen_host_metrics host_metrics);
+
+
+/**
+ * Get the memory/total field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
+
+
+/**
+ * Get the memory/free field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
+
+
+#endif
diff --git a/tools/libxen/include/xen_driver_type_internal.h b/tools/libxen/include/xen_host_metrics_decl.h
index c44639f692..e9137160ed 100644
--- a/tools/libxen/include/xen_driver_type_internal.h
+++ b/tools/libxen/include/xen_host_metrics_decl.h
@@ -16,22 +16,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef XEN_HOST_METRICS_DECL_H
+#define XEN_HOST_METRICS_DECL_H
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_driver_type. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_DRIVER_TYPE_INTERNAL_H
-#define XEN_DRIVER_TYPE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_driver_type_abstract_type_;
-extern const abstract_type xen_driver_type_set_abstract_type_;
+typedef void *xen_host_metrics;
+struct xen_host_metrics_set;
+struct xen_host_metrics_record;
+struct xen_host_metrics_record_set;
+struct xen_host_metrics_record_opt;
+struct xen_host_metrics_record_opt_set;
#endif
diff --git a/tools/libxen/include/xen_pbd.h b/tools/libxen/include/xen_pbd.h
new file mode 100644
index 0000000000..6d0f6b449e
--- /dev/null
+++ b/tools/libxen/include/xen_pbd.h
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_PBD_H
+#define XEN_PBD_H
+
+#include "xen_common.h"
+#include "xen_host_decl.h"
+#include "xen_pbd_decl.h"
+#include "xen_sr_decl.h"
+#include "xen_string_string_map.h"
+
+
+/*
+ * The PBD class.
+ *
+ * The physical block devices through which hosts access SRs.
+ */
+
+
+/**
+ * Free the given xen_pbd. The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_pbd_free(xen_pbd pbd);
+
+
+typedef struct xen_pbd_set
+{
+ size_t size;
+ xen_pbd *contents[];
+} xen_pbd_set;
+
+/**
+ * Allocate a xen_pbd_set of the given size.
+ */
+extern xen_pbd_set *
+xen_pbd_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pbd_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_pbd_set_free(xen_pbd_set *set);
+
+
+typedef struct xen_pbd_record
+{
+ xen_pbd handle;
+ char *uuid;
+ struct xen_host_record_opt *host;
+ struct xen_sr_record_opt *sr;
+ xen_string_string_map *device_config;
+ bool currently_attached;
+} xen_pbd_record;
+
+/**
+ * Allocate a xen_pbd_record.
+ */
+extern xen_pbd_record *
+xen_pbd_record_alloc(void);
+
+/**
+ * Free the given xen_pbd_record, and all referenced values. The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_free(xen_pbd_record *record);
+
+
+typedef struct xen_pbd_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_pbd handle;
+ xen_pbd_record *record;
+ } u;
+} xen_pbd_record_opt;
+
+/**
+ * Allocate a xen_pbd_record_opt.
+ */
+extern xen_pbd_record_opt *
+xen_pbd_record_opt_alloc(void);
+
+/**
+ * Free the given xen_pbd_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_opt_free(xen_pbd_record_opt *record_opt);
+
+
+typedef struct xen_pbd_record_set
+{
+ size_t size;
+ xen_pbd_record *contents[];
+} xen_pbd_record_set;
+
+/**
+ * Allocate a xen_pbd_record_set of the given size.
+ */
+extern xen_pbd_record_set *
+xen_pbd_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pbd_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_set_free(xen_pbd_record_set *set);
+
+
+
+typedef struct xen_pbd_record_opt_set
+{
+ size_t size;
+ xen_pbd_record_opt *contents[];
+} xen_pbd_record_opt_set;
+
+/**
+ * Allocate a xen_pbd_record_opt_set of the given size.
+ */
+extern xen_pbd_record_opt_set *
+xen_pbd_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pbd_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_opt_set_free(xen_pbd_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given PBD.
+ */
+extern bool
+xen_pbd_get_record(xen_session *session, xen_pbd_record **result, xen_pbd pbd);
+
+
+/**
+ * Get a reference to the PBD instance with the specified UUID.
+ */
+extern bool
+xen_pbd_get_by_uuid(xen_session *session, xen_pbd *result, char *uuid);
+
+
+/**
+ * Create a new PBD instance, and return its handle.
+ */
+extern bool
+xen_pbd_create(xen_session *session, xen_pbd *result, xen_pbd_record *record);
+
+
+/**
+ * Destroy the specified PBD instance.
+ */
+extern bool
+xen_pbd_destroy(xen_session *session, xen_pbd pbd);
+
+
+/**
+ * Get the uuid field of the given PBD.
+ */
+extern bool
+xen_pbd_get_uuid(xen_session *session, char **result, xen_pbd pbd);
+
+
+/**
+ * Get the host field of the given PBD.
+ */
+extern bool
+xen_pbd_get_host(xen_session *session, xen_host *result, xen_pbd pbd);
+
+
+/**
+ * Get the SR field of the given PBD.
+ */
+extern bool
+xen_pbd_get_sr(xen_session *session, xen_sr *result, xen_pbd pbd);
+
+
+/**
+ * Get the device_config field of the given PBD.
+ */
+extern bool
+xen_pbd_get_device_config(xen_session *session, xen_string_string_map **result, xen_pbd pbd);
+
+
+/**
+ * Get the currently_attached field of the given PBD.
+ */
+extern bool
+xen_pbd_get_currently_attached(xen_session *session, bool *result, xen_pbd pbd);
+
+
+#endif
diff --git a/tools/libxen/include/xen_pbd_decl.h b/tools/libxen/include/xen_pbd_decl.h
new file mode 100644
index 0000000000..81f8f4b300
--- /dev/null
+++ b/tools/libxen/include/xen_pbd_decl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_PBD_DECL_H
+#define XEN_PBD_DECL_H
+
+typedef void *xen_pbd;
+
+struct xen_pbd_set;
+struct xen_pbd_record;
+struct xen_pbd_record_set;
+struct xen_pbd_record_opt;
+struct xen_pbd_record_opt_set;
+
+#endif
diff --git a/tools/libxen/include/xen_pif.h b/tools/libxen/include/xen_pif.h
index edc2b5a83b..a4d6db7420 100644
--- a/tools/libxen/include/xen_pif.h
+++ b/tools/libxen/include/xen_pif.h
@@ -23,11 +23,12 @@
#include "xen_host_decl.h"
#include "xen_network_decl.h"
#include "xen_pif_decl.h"
+#include "xen_pif_metrics_decl.h"
/*
- * The PIF class.
- *
+ * The PIF class.
+ *
* A physical network interface (note separate VLANs are represented as
* several PIFs).
*/
@@ -65,14 +66,13 @@ typedef struct xen_pif_record
{
xen_pif handle;
char *uuid;
- char *name;
+ char *device;
struct xen_network_record_opt *network;
struct xen_host_record_opt *host;
char *mac;
int64_t mtu;
- char *vlan;
- double io_read_kbs;
- double io_write_kbs;
+ int64_t vlan;
+ struct xen_pif_metrics_record_opt *metrics;
} xen_pif_record;
/**
@@ -169,20 +169,6 @@ xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid);
/**
- * Create a new PIF instance, and return its handle.
- */
-extern bool
-xen_pif_create(xen_session *session, xen_pif *result, xen_pif_record *record);
-
-
-/**
- * Destroy the specified PIF instance.
- */
-extern bool
-xen_pif_destroy(xen_session *session, xen_pif pif);
-
-
-/**
* Get the uuid field of the given PIF.
*/
extern bool
@@ -190,10 +176,10 @@ xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif);
/**
- * Get the name field of the given PIF.
+ * Get the device field of the given PIF.
*/
extern bool
-xen_pif_get_name(xen_session *session, char **result, xen_pif pif);
+xen_pif_get_device(xen_session *session, char **result, xen_pif pif);
/**
@@ -228,63 +214,57 @@ xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif);
* Get the VLAN field of the given PIF.
*/
extern bool
-xen_pif_get_vlan(xen_session *session, char **result, xen_pif pif);
+xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif);
/**
- * Get the io/read_kbs field of the given PIF.
+ * Get the metrics field of the given PIF.
*/
extern bool
-xen_pif_get_io_read_kbs(xen_session *session, double *result, xen_pif pif);
+xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif);
/**
- * Get the io/write_kbs field of the given PIF.
+ * Set the device field of the given PIF.
*/
extern bool
-xen_pif_get_io_write_kbs(xen_session *session, double *result, xen_pif pif);
+xen_pif_set_device(xen_session *session, xen_pif pif, char *device);
/**
- * Set the name field of the given PIF.
- */
-extern bool
-xen_pif_set_name(xen_session *session, xen_pif pif, char *name);
-
-
-/**
- * Set the network field of the given PIF.
+ * Set the MAC field of the given PIF.
*/
extern bool
-xen_pif_set_network(xen_session *session, xen_pif pif, xen_network network);
+xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac);
/**
- * Set the host field of the given PIF.
+ * Set the MTU field of the given PIF.
*/
extern bool
-xen_pif_set_host(xen_session *session, xen_pif pif, xen_host host);
+xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu);
/**
- * Set the MAC field of the given PIF.
+ * Set the VLAN field of the given PIF.
*/
extern bool
-xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac);
+xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan);
/**
- * Set the MTU field of the given PIF.
+ * Create a VLAN interface from an existing physical interface
*/
extern bool
-xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu);
+xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan);
/**
- * Set the VLAN field of the given PIF.
+ * Destroy the interface (provided it is a synthetic interface like a
+ * VLAN; fail if it is a physical interface)
*/
extern bool
-xen_pif_set_vlan(xen_session *session, xen_pif pif, char *vlan);
+xen_pif_destroy(xen_session *session, xen_pif self);
#endif
diff --git a/tools/libxen/include/xen_pif_metrics.h b/tools/libxen/include/xen_pif_metrics.h
new file mode 100644
index 0000000000..420516d8b6
--- /dev/null
+++ b/tools/libxen/include/xen_pif_metrics.h
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_PIF_METRICS_H
+#define XEN_PIF_METRICS_H
+
+#include "xen_common.h"
+#include "xen_pif_decl.h"
+#include "xen_pif_metrics_decl.h"
+
+
+/*
+ * The PIF_metrics class.
+ *
+ * The metrics associated with a physical network interface.
+ */
+
+
+/**
+ * Free the given xen_pif_metrics. The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_pif_metrics_free(xen_pif_metrics pif_metrics);
+
+
+typedef struct xen_pif_metrics_set
+{
+ size_t size;
+ xen_pif_metrics *contents[];
+} xen_pif_metrics_set;
+
+/**
+ * Allocate a xen_pif_metrics_set of the given size.
+ */
+extern xen_pif_metrics_set *
+xen_pif_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_metrics_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_pif_metrics_set_free(xen_pif_metrics_set *set);
+
+
+typedef struct xen_pif_metrics_record
+{
+ xen_pif_metrics handle;
+ char *uuid;
+ struct xen_pif_record_opt *pif;
+ double io_read_kbs;
+ double io_write_kbs;
+} xen_pif_metrics_record;
+
+/**
+ * Allocate a xen_pif_metrics_record.
+ */
+extern xen_pif_metrics_record *
+xen_pif_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_pif_metrics_record, and all referenced values.
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_free(xen_pif_metrics_record *record);
+
+
+typedef struct xen_pif_metrics_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_pif_metrics handle;
+ xen_pif_metrics_record *record;
+ } u;
+} xen_pif_metrics_record_opt;
+
+/**
+ * Allocate a xen_pif_metrics_record_opt.
+ */
+extern xen_pif_metrics_record_opt *
+xen_pif_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_pif_metrics_record_opt, and all referenced
+ * values. The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_opt_free(xen_pif_metrics_record_opt *record_opt);
+
+
+typedef struct xen_pif_metrics_record_set
+{
+ size_t size;
+ xen_pif_metrics_record *contents[];
+} xen_pif_metrics_record_set;
+
+/**
+ * Allocate a xen_pif_metrics_record_set of the given size.
+ */
+extern xen_pif_metrics_record_set *
+xen_pif_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_metrics_record_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_set_free(xen_pif_metrics_record_set *set);
+
+
+
+typedef struct xen_pif_metrics_record_opt_set
+{
+ size_t size;
+ xen_pif_metrics_record_opt *contents[];
+} xen_pif_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_pif_metrics_record_opt_set of the given size.
+ */
+extern xen_pif_metrics_record_opt_set *
+xen_pif_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_metrics_record_opt_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_opt_set_free(xen_pif_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_record(xen_session *session, xen_pif_metrics_record **result, xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get a reference to the PIF_metrics instance with the specified UUID.
+ */
+extern bool
+xen_pif_metrics_get_by_uuid(xen_session *session, xen_pif_metrics *result, char *uuid);
+
+
+/**
+ * Get the uuid field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_uuid(xen_session *session, char **result, xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get the PIF field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_pif(xen_session *session, xen_pif *result, xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get the io/read_kbs field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get the io/write_kbs field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics);
+
+
+#endif
diff --git a/tools/libxen/include/xen_pif_metrics_decl.h b/tools/libxen/include/xen_pif_metrics_decl.h
new file mode 100644
index 0000000000..71afe69d53
--- /dev/null
+++ b/tools/libxen/include/xen_pif_metrics_decl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_PIF_METRICS_DECL_H
+#define XEN_PIF_METRICS_DECL_H
+
+typedef void *xen_pif_metrics;
+
+struct xen_pif_metrics_set;
+struct xen_pif_metrics_record;
+struct xen_pif_metrics_record_set;
+struct xen_pif_metrics_record_opt;
+struct xen_pif_metrics_record_opt_set;
+
+#endif
diff --git a/tools/libxen/include/xen_sr.h b/tools/libxen/include/xen_sr.h
index eb8a420149..e5e4299844 100644
--- a/tools/libxen/include/xen_sr.h
+++ b/tools/libxen/include/xen_sr.h
@@ -20,13 +20,14 @@
#define XEN_SR_H
#include "xen_common.h"
+#include "xen_pbd_decl.h"
#include "xen_sr_decl.h"
#include "xen_vdi_decl.h"
/*
- * The SR class.
- *
+ * The SR class.
+ *
* A storage repository.
*/
@@ -66,6 +67,7 @@ typedef struct xen_sr_record
char *name_label;
char *name_description;
struct xen_vdi_record_opt_set *vdis;
+ struct xen_pbd_record_opt_set *pbds;
int64_t virtual_allocation;
int64_t physical_utilisation;
int64_t physical_size;
@@ -216,6 +218,13 @@ xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr);
/**
+ * Get the PBDs field of the given SR.
+ */
+extern bool
+xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr);
+
+
+/**
* Get the virtual_allocation field of the given SR.
*/
extern bool
diff --git a/tools/libxen/include/xen_vbd.h b/tools/libxen/include/xen_vbd.h
index 2b9d8b05eb..880449f3c1 100644
--- a/tools/libxen/include/xen_vbd.h
+++ b/tools/libxen/include/xen_vbd.h
@@ -20,7 +20,6 @@
#define XEN_VBD_H
#include "xen_common.h"
-#include "xen_driver_type.h"
#include "xen_vbd_decl.h"
#include "xen_vbd_mode.h"
#include "xen_vdi_decl.h"
@@ -28,8 +27,8 @@
/*
- * The VBD class.
- *
+ * The VBD class.
+ *
* A virtual block device.
*/
@@ -70,8 +69,8 @@ typedef struct xen_vbd_record
struct xen_vdi_record_opt *vdi;
char *device;
char *image;
+ bool bootable;
enum xen_vbd_mode mode;
- enum xen_driver_type driver;
double io_read_kbs;
double io_write_kbs;
} xen_vbd_record;
@@ -212,17 +211,17 @@ xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd);
/**
- * Get the mode field of the given VBD.
+ * Get the bootable field of the given VBD.
*/
extern bool
-xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
+xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd);
/**
- * Get the driver field of the given VBD.
+ * Get the mode field of the given VBD.
*/
extern bool
-xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd vbd);
+xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
/**
@@ -240,20 +239,6 @@ xen_vbd_get_io_write_kbs(xen_session *session, double *result, xen_vbd vbd);
/**
- * Set the VM field of the given VBD.
- */
-extern bool
-xen_vbd_set_vm(xen_session *session, xen_vbd vbd, xen_vm vm);
-
-
-/**
- * Set the VDI field of the given VBD.
- */
-extern bool
-xen_vbd_set_vdi(xen_session *session, xen_vbd vbd, xen_vdi vdi);
-
-
-/**
* Set the device field of the given VBD.
*/
extern bool
@@ -261,17 +246,17 @@ xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device);
/**
- * Set the mode field of the given VBD.
+ * Set the bootable field of the given VBD.
*/
extern bool
-xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode);
+xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable);
/**
- * Set the driver field of the given VBD.
+ * Set the mode field of the given VBD.
*/
extern bool
-xen_vbd_set_driver(xen_session *session, xen_vbd vbd, enum xen_driver_type driver);
+xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode);
/**
diff --git a/tools/libxen/include/xen_vdi.h b/tools/libxen/include/xen_vdi.h
index cfdbc6a61c..d72eceb001 100644
--- a/tools/libxen/include/xen_vdi.h
+++ b/tools/libxen/include/xen_vdi.h
@@ -20,6 +20,7 @@
#define XEN_VDI_H
#include "xen_common.h"
+#include "xen_crashdump_decl.h"
#include "xen_sr_decl.h"
#include "xen_vbd_decl.h"
#include "xen_vdi_decl.h"
@@ -27,8 +28,8 @@
/*
- * The VDI class.
- *
+ * The VDI class.
+ *
* A virtual disk image.
*/
@@ -69,12 +70,11 @@ typedef struct xen_vdi_record
char *name_description;
struct xen_sr_record_opt *sr;
struct xen_vbd_record_opt_set *vbds;
+ struct xen_crashdump_record_opt_set *crash_dumps;
int64_t virtual_size;
int64_t physical_utilisation;
int64_t sector_size;
enum xen_vdi_type type;
- struct xen_vdi_record_opt *parent;
- struct xen_vdi_record_opt_set *children;
bool sharable;
bool read_only;
} xen_vdi_record;
@@ -229,6 +229,13 @@ xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi vdi)
/**
+ * Get the crash_dumps field of the given VDI.
+ */
+extern bool
+xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi);
+
+
+/**
* Get the virtual_size field of the given VDI.
*/
extern bool
@@ -257,20 +264,6 @@ xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi);
/**
- * Get the parent field of the given VDI.
- */
-extern bool
-xen_vdi_get_parent(xen_session *session, xen_vdi *result, xen_vdi vdi);
-
-
-/**
- * Get the children field of the given VDI.
- */
-extern bool
-xen_vdi_get_children(xen_session *session, struct xen_vdi_set **result, xen_vdi vdi);
-
-
-/**
* Get the sharable field of the given VDI.
*/
extern bool
diff --git a/tools/libxen/include/xen_vdi_type.h b/tools/libxen/include/xen_vdi_type.h
index 33ba7c61bf..01168491ee 100644
--- a/tools/libxen/include/xen_vdi_type.h
+++ b/tools/libxen/include/xen_vdi_type.h
@@ -38,7 +38,17 @@ enum xen_vdi_type
/**
* a disk that may be reformatted on upgrade
*/
- XEN_VDI_TYPE_EPHEMERAL
+ XEN_VDI_TYPE_EPHEMERAL,
+
+ /**
+ * a disk that stores a suspend image
+ */
+ XEN_VDI_TYPE_SUSPEND,
+
+ /**
+ * a disk that stores VM crashdump information
+ */
+ XEN_VDI_TYPE_CRASHDUMP
};
diff --git a/tools/libxen/include/xen_vif.h b/tools/libxen/include/xen_vif.h
index 4efc3f0851..7141bf3197 100644
--- a/tools/libxen/include/xen_vif.h
+++ b/tools/libxen/include/xen_vif.h
@@ -20,15 +20,14 @@
#define XEN_VIF_H
#include "xen_common.h"
-#include "xen_driver_type.h"
#include "xen_network_decl.h"
#include "xen_vif_decl.h"
#include "xen_vm_decl.h"
/*
- * The VIF class.
- *
+ * The VIF class.
+ *
* A virtual network interface.
*/
@@ -65,8 +64,6 @@ typedef struct xen_vif_record
{
xen_vif handle;
char *uuid;
- char *name;
- enum xen_driver_type type;
char *device;
struct xen_network_record_opt *network;
struct xen_vm_record_opt *vm;
@@ -191,20 +188,6 @@ xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
/**
- * Get the name field of the given VIF.
- */
-extern bool
-xen_vif_get_name(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the type field of the given VIF.
- */
-extern bool
-xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif vif);
-
-
-/**
* Get the device field of the given VIF.
*/
extern bool
@@ -254,20 +237,6 @@ xen_vif_get_io_write_kbs(xen_session *session, double *result, xen_vif vif);
/**
- * Set the name field of the given VIF.
- */
-extern bool
-xen_vif_set_name(xen_session *session, xen_vif vif, char *name);
-
-
-/**
- * Set the type field of the given VIF.
- */
-extern bool
-xen_vif_set_type(xen_session *session, xen_vif vif, enum xen_driver_type type);
-
-
-/**
* Set the device field of the given VIF.
*/
extern bool
@@ -275,20 +244,6 @@ xen_vif_set_device(xen_session *session, xen_vif vif, char *device);
/**
- * Set the network field of the given VIF.
- */
-extern bool
-xen_vif_set_network(xen_session *session, xen_vif vif, xen_network network);
-
-
-/**
- * Set the VM field of the given VIF.
- */
-extern bool
-xen_vif_set_vm(xen_session *session, xen_vif vif, xen_vm vm);
-
-
-/**
* Set the MAC field of the given VIF.
*/
extern bool
diff --git a/tools/libxen/include/xen_vm.h b/tools/libxen/include/xen_vm.h
index 5287be5873..7a56ba482e 100644
--- a/tools/libxen/include/xen_vm.h
+++ b/tools/libxen/include/xen_vm.h
@@ -21,15 +21,17 @@
#include "xen_common.h"
#include "xen_console_decl.h"
-#include "xen_cpu_feature.h"
+#include "xen_crashdump_decl.h"
#include "xen_host_decl.h"
#include "xen_int_float_map.h"
#include "xen_on_crash_behaviour.h"
#include "xen_on_normal_exit.h"
#include "xen_string_string_map.h"
#include "xen_vbd_decl.h"
+#include "xen_vdi_decl.h"
#include "xen_vif_decl.h"
#include "xen_vm_decl.h"
+#include "xen_vm_metrics_decl.h"
#include "xen_vm_power_state.h"
#include "xen_vtpm_decl.h"
@@ -51,7 +53,10 @@
* PV/ramdisk, PV/args and PV/bootloader_args will be passed to the bootloader
* unmodified, and interpretation of those fields is then specific to the
* bootloader itself, including the possibility that the bootloader will
- * ignore some or all of those given values.
+ * ignore some or all of those given values. Finally the paths of all bootable
+ * disks are added to the bootloader commandline (a disk is bootable if its
+ * VBD has the bootable flag set). There may be zero, one or many bootable
+ * disks; the bootloader decides which disk (if any) to boot from.
*
* If the bootloader is pygrub, then the menu.lst is parsed if present in the
* guest's filesystem, otherwise the specified kernel and ramdisk are used, or
@@ -106,27 +111,25 @@ typedef struct xen_vm_record
int64_t user_version;
bool is_a_template;
bool auto_power_on;
+ struct xen_vdi_record_opt *suspend_vdi;
struct xen_host_record_opt *resident_on;
int64_t memory_static_max;
int64_t memory_dynamic_max;
- int64_t memory_actual;
int64_t memory_dynamic_min;
int64_t memory_static_min;
char *vcpus_policy;
- char *vcpus_params;
+ xen_string_string_map *vcpus_params;
+ int64_t vcpus_max;
+ int64_t vcpus_at_startup;
int64_t vcpus_number;
xen_int_float_map *vcpus_utilisation;
- struct xen_cpu_feature_set *vcpus_features_required;
- struct xen_cpu_feature_set *vcpus_features_can_use;
- struct xen_cpu_feature_set *vcpus_features_force_on;
- struct xen_cpu_feature_set *vcpus_features_force_off;
enum xen_on_normal_exit actions_after_shutdown;
enum xen_on_normal_exit actions_after_reboot;
- enum xen_on_normal_exit actions_after_suspend;
enum xen_on_crash_behaviour actions_after_crash;
struct xen_console_record_opt_set *consoles;
struct xen_vif_record_opt_set *vifs;
struct xen_vbd_record_opt_set *vbds;
+ struct xen_crashdump_record_opt_set *crash_dumps;
struct xen_vtpm_record_opt_set *vtpms;
char *pv_bootloader;
char *pv_kernel;
@@ -141,7 +144,9 @@ typedef struct xen_vm_record
bool platform_enable_audio;
char *pci_bus;
xen_string_string_map *tools_version;
- xen_string_string_map *otherconfig;
+ xen_string_string_map *other_config;
+ bool is_control_domain;
+ struct xen_vm_metrics_record_opt *metrics;
} xen_vm_record;
/**
@@ -310,6 +315,13 @@ xen_vm_get_auto_power_on(xen_session *session, bool *result, xen_vm vm);
/**
+ * Get the suspend_VDI field of the given VM.
+ */
+extern bool
+xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm);
+
+
+/**
* Get the resident_on field of the given VM.
*/
extern bool
@@ -331,13 +343,6 @@ xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm);
/**
- * Get the memory/actual field of the given VM.
- */
-extern bool
-xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm);
-
-
-/**
* Get the memory/dynamic_min field of the given VM.
*/
extern bool
@@ -362,49 +367,35 @@ xen_vm_get_vcpus_policy(xen_session *session, char **result, xen_vm vm);
* Get the VCPUs/params field of the given VM.
*/
extern bool
-xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm);
-
-
-/**
- * Get the VCPUs/number field of the given VM.
- */
-extern bool
-xen_vm_get_vcpus_number(xen_session *session, int64_t *result, xen_vm vm);
-
-
-/**
- * Get the VCPUs/utilisation field of the given VM.
- */
-extern bool
-xen_vm_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm vm);
+xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm);
/**
- * Get the VCPUs/features/required field of the given VM.
+ * Get the VCPUs/max field of the given VM.
*/
extern bool
-xen_vm_get_vcpus_features_required(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm);
+xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm);
/**
- * Get the VCPUs/features/can_use field of the given VM.
+ * Get the VCPUs/at_startup field of the given VM.
*/
extern bool
-xen_vm_get_vcpus_features_can_use(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm);
+xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm);
/**
- * Get the VCPUs/features/force_on field of the given VM.
+ * Get the VCPUs/number field of the given VM.
*/
extern bool
-xen_vm_get_vcpus_features_force_on(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm);
+xen_vm_get_vcpus_number(xen_session *session, int64_t *result, xen_vm vm);
/**
- * Get the VCPUs/features/force_off field of the given VM.
+ * Get the VCPUs/utilisation field of the given VM.
*/
extern bool
-xen_vm_get_vcpus_features_force_off(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm);
+xen_vm_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm vm);
/**
@@ -422,13 +413,6 @@ xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *r
/**
- * Get the actions/after_suspend field of the given VM.
- */
-extern bool
-xen_vm_get_actions_after_suspend(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm);
-
-
-/**
* Get the actions/after_crash field of the given VM.
*/
extern bool
@@ -457,6 +441,13 @@ xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm);
/**
+ * Get the crash_dumps field of the given VM.
+ */
+extern bool
+xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm);
+
+
+/**
* Get the VTPMs field of the given VM.
*/
extern bool
@@ -555,10 +546,24 @@ xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result, x
/**
- * Get the otherConfig field of the given VM.
+ * Get the other_config field of the given VM.
+ */
+extern bool
+xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm);
+
+
+/**
+ * Get the is_control_domain field of the given VM.
+ */
+extern bool
+xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the metrics field of the given VM.
*/
extern bool
-xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen_vm vm);
+xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm);
/**
@@ -597,84 +602,76 @@ xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on);
/**
- * Set the memory/dynamic_max field of the given VM.
+ * Set the memory/static_max field of the given VM.
*/
extern bool
-xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max);
+xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max);
/**
- * Set the memory/dynamic_min field of the given VM.
- */
-extern bool
-xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min);
-
-
-/**
- * Set the VCPUs/policy field of the given VM.
+ * Set the memory/dynamic_max field of the given VM.
*/
extern bool
-xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy);
+xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max);
/**
- * Set the VCPUs/params field of the given VM.
+ * Set the memory/dynamic_min field of the given VM.
*/
extern bool
-xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params);
+xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min);
/**
- * Set the VCPUs/number field of the given VM.
+ * Set the memory/static_min field of the given VM.
*/
extern bool
-xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number);
+xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min);
/**
- * Set the VCPUs/features/force_on field of the given VM.
+ * Set the VCPUs/policy field of the given VM.
*/
extern bool
-xen_vm_set_vcpus_features_force_on(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_on);
+xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy);
/**
- * Add the given value to the VCPUs/features/force_on field of the
- * given VM. If the value is already in that Set, then do nothing.
+ * Set the VCPUs/params field of the given VM.
*/
extern bool
-xen_vm_add_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value);
+xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params);
/**
- * Remove the given value from the VCPUs/features/force_on field of the
- * given VM. If the value is not in that Set, then do nothing.
+ * Add the given key-value pair to the VCPUs/params field of the given
+ * VM.
*/
extern bool
-xen_vm_remove_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value);
+xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value);
/**
- * Set the VCPUs/features/force_off field of the given VM.
+ * Remove the given key and its corresponding value from the
+ * VCPUs/params field of the given VM. If the key is not in that Map, then do
+ * nothing.
*/
extern bool
-xen_vm_set_vcpus_features_force_off(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_off);
+xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key);
/**
- * Add the given value to the VCPUs/features/force_off field of the
- * given VM. If the value is already in that Set, then do nothing.
+ * Set the VCPUs/max field of the given VM.
*/
extern bool
-xen_vm_add_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value);
+xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max);
/**
- * Remove the given value from the VCPUs/features/force_off field of
- * the given VM. If the value is not in that Set, then do nothing.
+ * Set the VCPUs/at_startup field of the given VM.
*/
extern bool
-xen_vm_remove_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value);
+xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup);
/**
@@ -692,13 +689,6 @@ xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_nor
/**
- * Set the actions/after_suspend field of the given VM.
- */
-extern bool
-xen_vm_set_actions_after_suspend(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_suspend);
-
-
-/**
* Set the actions/after_crash field of the given VM.
*/
extern bool
@@ -783,10 +773,27 @@ xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool enable_au
/**
- * Set the otherConfig field of the given VM.
+ * Set the other_config field of the given VM.
*/
extern bool
-xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig);
+xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * VM.
+ */
+extern bool
+xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given VM. If the key is not in that Map, then do
+ * nothing.
+ */
+extern bool
+xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key);
/**
@@ -829,6 +836,8 @@ xen_vm_unpause(xen_session *session, xen_vm vm);
*
* Once shutdown has been completed perform poweroff action specified in guest
* configuration.
+ *
+ * This can only be called when the specified VM is in the Running state.
*/
extern bool
xen_vm_clean_shutdown(xen_session *session, xen_vm vm);
@@ -840,6 +849,8 @@ xen_vm_clean_shutdown(xen_session *session, xen_vm vm);
*
* Once shutdown has been completed perform reboot action specified in guest
* configuration.
+ *
+ * This can only be called when the specified VM is in the Running state.
*/
extern bool
xen_vm_clean_reboot(xen_session *session, xen_vm vm);
@@ -862,14 +873,16 @@ xen_vm_hard_reboot(xen_session *session, xen_vm vm);
/**
- * Suspend the specified VM to disk.
+ * Suspend the specified VM to disk. This can only be called when the
+ * specified VM is in the Running state.
*/
extern bool
xen_vm_suspend(xen_session *session, xen_vm vm);
/**
- * Awaken the specified VM and resume it.
+ * Awaken the specified VM and resume it. This can only be called when
+ * the specified VM is in the Suspended state.
*/
extern bool
xen_vm_resume(xen_session *session, xen_vm vm, bool start_paused);
diff --git a/tools/libxen/include/xen_vm_metrics.h b/tools/libxen/include/xen_vm_metrics.h
new file mode 100644
index 0000000000..740e327d10
--- /dev/null
+++ b/tools/libxen/include/xen_vm_metrics.h
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_METRICS_H
+#define XEN_VM_METRICS_H
+
+#include "xen_common.h"
+#include "xen_int_float_map.h"
+#include "xen_vm_decl.h"
+#include "xen_vm_metrics_decl.h"
+
+
+/*
+ * The VM_metrics class.
+ *
+ * The metrics associated with a VM.
+ */
+
+
+/**
+ * Free the given xen_vm_metrics. The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_metrics_free(xen_vm_metrics vm_metrics);
+
+
+typedef struct xen_vm_metrics_set
+{
+ size_t size;
+ xen_vm_metrics *contents[];
+} xen_vm_metrics_set;
+
+/**
+ * Allocate a xen_vm_metrics_set of the given size.
+ */
+extern xen_vm_metrics_set *
+xen_vm_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_metrics_set_free(xen_vm_metrics_set *set);
+
+
+typedef struct xen_vm_metrics_record
+{
+ xen_vm_metrics handle;
+ char *uuid;
+ struct xen_vm_record_opt *vm;
+ int64_t memory_actual;
+ int64_t vcpus_number;
+ xen_int_float_map *vcpus_utilisation;
+} xen_vm_metrics_record;
+
+/**
+ * Allocate a xen_vm_metrics_record.
+ */
+extern xen_vm_metrics_record *
+xen_vm_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vm_metrics_record, and all referenced values.
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_free(xen_vm_metrics_record *record);
+
+
+typedef struct xen_vm_metrics_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_vm_metrics handle;
+ xen_vm_metrics_record *record;
+ } u;
+} xen_vm_metrics_record_opt;
+
+/**
+ * Allocate a xen_vm_metrics_record_opt.
+ */
+extern xen_vm_metrics_record_opt *
+xen_vm_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_metrics_record_opt, and all referenced values.
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt);
+
+
+typedef struct xen_vm_metrics_record_set
+{
+ size_t size;
+ xen_vm_metrics_record *contents[];
+} xen_vm_metrics_record_set;
+
+/**
+ * Allocate a xen_vm_metrics_record_set of the given size.
+ */
+extern xen_vm_metrics_record_set *
+xen_vm_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_record_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set);
+
+
+
+typedef struct xen_vm_metrics_record_opt_set
+{
+ size_t size;
+ xen_vm_metrics_record_opt *contents[];
+} xen_vm_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vm_metrics_record_opt_set of the given size.
+ */
+extern xen_vm_metrics_record_opt_set *
+xen_vm_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_record_opt_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get a reference to the VM_metrics instance with the specified UUID.
+ */
+extern bool
+xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid);
+
+
+/**
+ * Get the uuid field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VM field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the memory/actual field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/number field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/utilisation field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics);
+
+
+#endif
diff --git a/tools/libxen/include/xen_vm_metrics_decl.h b/tools/libxen/include/xen_vm_metrics_decl.h
new file mode 100644
index 0000000000..ea1bcb51f7
--- /dev/null
+++ b/tools/libxen/include/xen_vm_metrics_decl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_METRICS_DECL_H
+#define XEN_VM_METRICS_DECL_H
+
+typedef void *xen_vm_metrics;
+
+struct xen_vm_metrics_set;
+struct xen_vm_metrics_record;
+struct xen_vm_metrics_record_set;
+struct xen_vm_metrics_record_opt;
+struct xen_vm_metrics_record_opt_set;
+
+#endif
diff --git a/tools/libxen/include/xen_vtpm.h b/tools/libxen/include/xen_vtpm.h
index a04c8d4de3..add504221f 100644
--- a/tools/libxen/include/xen_vtpm.h
+++ b/tools/libxen/include/xen_vtpm.h
@@ -21,7 +21,6 @@
#define XEN_VTPM_H
#include "xen_common.h"
-#include "xen_driver_type.h"
#include "xen_vm_decl.h"
#include "xen_vtpm_decl.h"
@@ -67,8 +66,6 @@ typedef struct xen_vtpm_record
char *uuid;
struct xen_vm_record_opt *vm;
struct xen_vm_record_opt *backend;
- enum xen_driver_type driver;
- int64_t instance;
} xen_vtpm_record;
/**
@@ -198,19 +195,4 @@ xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm);
extern bool
xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
-
-/**
- * Get the driver field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm);
-
-
-/**
- * Get the instance field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_instance(xen_session *session, int64_t *result, xen_vtpm vtpm);
-
-
#endif
diff --git a/tools/libxen/src/xen_cpu_feature.c b/tools/libxen/src/xen_cpu_feature.c
deleted file mode 100644
index 6f19f32704..0000000000
--- a/tools/libxen/src/xen_cpu_feature.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include "xen_cpu_feature.h"
-#include "xen_cpu_feature_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "FPU",
- "VME",
- "DE",
- "PSE",
- "TSC",
- "MSR",
- "PAE",
- "MCE",
- "CX8",
- "APIC",
- "SEP",
- "MTRR",
- "PGE",
- "MCA",
- "CMOV",
- "PAT",
- "PSE36",
- "PN",
- "CLFLSH",
- "DTES",
- "ACPI",
- "MMX",
- "FXSR",
- "XMM",
- "XMM2",
- "SELFSNOOP",
- "HT",
- "ACC",
- "IA64",
- "SYSCALL",
- "MP",
- "NX",
- "MMXEXT",
- "LM",
- "THREEDNOWEXT",
- "THREEDNOW",
- "RECOVERY",
- "LONGRUN",
- "LRTI",
- "CXMMX",
- "K6_MTRR",
- "CYRIX_ARR",
- "CENTAUR_MCR",
- "K8",
- "K7",
- "P3",
- "P4",
- "CONSTANT_TSC",
- "FXSAVE_LEAK",
- "XMM3",
- "MWAIT",
- "DSCPL",
- "EST",
- "TM2",
- "CID",
- "CX16",
- "XTPR",
- "XSTORE",
- "XSTORE_EN",
- "XCRYPT",
- "XCRYPT_EN",
- "LAHF_LM",
- "CMP_LEGACY",
- "VMX"
-};
-
-
-extern xen_cpu_feature_set *
-xen_cpu_feature_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_cpu_feature_set) +
- size * sizeof(enum xen_cpu_feature));
-}
-
-
-extern void
-xen_cpu_feature_set_free(xen_cpu_feature_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_cpu_feature_to_string(enum xen_cpu_feature val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_cpu_feature
-xen_cpu_feature_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_cpu_feature_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_cpu_feature_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_cpu_feature_from_string
- };
-
-
-const abstract_type xen_cpu_feature_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_cpu_feature_abstract_type_
- };
-
-
diff --git a/tools/libxen/src/xen_crashdump.c b/tools/libxen/src/xen_crashdump.c
new file mode 100644
index 0000000000..53504ba249
--- /dev/null
+++ b/tools/libxen/src/xen_crashdump.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_crashdump.h"
+#include "xen_internal.h"
+#include "xen_vdi.h"
+#include "xen_vm.h"
+
+
+XEN_FREE(xen_crashdump)
+XEN_SET_ALLOC_FREE(xen_crashdump)
+XEN_ALLOC(xen_crashdump_record)
+XEN_SET_ALLOC_FREE(xen_crashdump_record)
+XEN_ALLOC(xen_crashdump_record_opt)
+XEN_RECORD_OPT_FREE(xen_crashdump)
+XEN_SET_ALLOC_FREE(xen_crashdump_record_opt)
+
+
+static const struct_member xen_crashdump_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_crashdump_record, uuid) },
+ { .key = "VM",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_crashdump_record, vm) },
+ { .key = "VDI",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_crashdump_record, vdi) }
+ };
+
+const abstract_type xen_crashdump_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_crashdump_record),
+ .member_count =
+ sizeof(xen_crashdump_record_struct_members) / sizeof(struct_member),
+ .members = xen_crashdump_record_struct_members
+ };
+
+
+void
+xen_crashdump_record_free(xen_crashdump_record *record)
+{
+ if (record == NULL)
+ {
+ return;
+ }
+ free(record->handle);
+ free(record->uuid);
+ xen_vm_record_opt_free(record->vm);
+ xen_vdi_record_opt_free(record->vdi);
+ free(record);
+}
+
+
+bool
+xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = crashdump }
+ };
+
+ abstract_type result_type = xen_crashdump_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("crashdump.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("crashdump.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_create(xen_session *session, xen_crashdump *result, xen_crashdump_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_crashdump_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("crashdump.create");
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_destroy(xen_session *session, xen_crashdump crashdump)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = crashdump }
+ };
+
+ xen_call_(session, "crashdump.destroy", param_values, 1, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = crashdump }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("crashdump.get_VM");
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = crashdump }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("crashdump.get_VDI");
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result)
+{
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ xen_call_(session, "crashdump.get_all", NULL, 0, &result_type, result);
+ return session->ok;
+}
+
+
+bool
+xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump)
+{
+ *result = session->ok ? xen_strdup_((char *)crashdump) : NULL;
+ return session->ok;
+}
diff --git a/tools/libxen/src/xen_driver_type.c b/tools/libxen/src/xen_driver_type.c
deleted file mode 100644
index fe95d84f0c..0000000000
--- a/tools/libxen/src/xen_driver_type.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include "xen_driver_type.h"
-#include "xen_driver_type_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "ioemu",
- "paravirtualised"
-};
-
-
-extern xen_driver_type_set *
-xen_driver_type_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_driver_type_set) +
- size * sizeof(enum xen_driver_type));
-}
-
-
-extern void
-xen_driver_type_set_free(xen_driver_type_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_driver_type_to_string(enum xen_driver_type val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_driver_type
-xen_driver_type_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_driver_type_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_driver_type_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_driver_type_from_string
- };
-
-
-const abstract_type xen_driver_type_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_driver_type_abstract_type_
- };
-
-
diff --git a/tools/libxen/src/xen_host.c b/tools/libxen/src/xen_host.c
index 931a0c44ce..7968b96994 100644
--- a/tools/libxen/src/xen_host.c
+++ b/tools/libxen/src/xen_host.c
@@ -23,8 +23,11 @@
#include "xen_common.h"
#include "xen_host.h"
#include "xen_host_cpu.h"
+#include "xen_host_metrics.h"
#include "xen_internal.h"
+#include "xen_pbd.h"
#include "xen_pif.h"
+#include "xen_sr.h"
#include "xen_string_string_map.h"
#include "xen_vm.h"
@@ -52,15 +55,33 @@ static const struct_member xen_host_record_struct_members[] =
{ .key = "software_version",
.type = &abstract_type_string_string_map,
.offset = offsetof(xen_host_record, software_version) },
+ { .key = "other_config",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_host_record, other_config) },
{ .key = "resident_VMs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_host_record, resident_vms) },
+ { .key = "logging",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_host_record, logging) },
{ .key = "PIFs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_host_record, pifs) },
+ { .key = "suspend_image_sr",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_host_record, suspend_image_sr) },
+ { .key = "crash_dump_sr",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_host_record, crash_dump_sr) },
+ { .key = "PBDs",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_host_record, pbds) },
{ .key = "host_CPUs",
.type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_record, host_cpus) }
+ .offset = offsetof(xen_host_record, host_cpus) },
+ { .key = "metrics",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_host_record, metrics) }
};
const abstract_type xen_host_record_abstract_type_ =
@@ -85,9 +106,15 @@ xen_host_record_free(xen_host_record *record)
free(record->name_label);
free(record->name_description);
xen_string_string_map_free(record->software_version);
+ xen_string_string_map_free(record->other_config);
xen_vm_record_opt_set_free(record->resident_vms);
+ xen_string_string_map_free(record->logging);
xen_pif_record_opt_set_free(record->pifs);
+ xen_sr_record_opt_free(record->suspend_image_sr);
+ xen_sr_record_opt_free(record->crash_dump_sr);
+ xen_pbd_record_opt_set_free(record->pbds);
xen_host_cpu_record_opt_set_free(record->host_cpus);
+ xen_host_metrics_record_opt_free(record->metrics);
free(record);
}
@@ -232,6 +259,23 @@ xen_host_get_software_version(xen_session *session, xen_string_string_map **resu
bool
+xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("host.get_other_config");
+ return session->ok;
+}
+
+
+bool
xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host)
{
abstract_value param_values[] =
@@ -249,6 +293,23 @@ xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_
bool
+xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("host.get_logging");
+ return session->ok;
+}
+
+
+bool
xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host)
{
abstract_value param_values[] =
@@ -266,6 +327,57 @@ xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host ho
bool
+xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_suspend_image_sr");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_crash_dump_sr");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("host.get_PBDs");
+ return session->ok;
+}
+
+
+bool
xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host)
{
abstract_value param_values[] =
@@ -283,6 +395,23 @@ xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, x
bool
+xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_metrics");
+ return session->ok;
+}
+
+
+bool
xen_host_set_name_label(xen_session *session, xen_host host, char *label)
{
abstract_value param_values[] =
@@ -315,6 +444,138 @@ xen_host_set_name_description(xen_session *session, xen_host host, char *descrip
bool
+xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)other_config }
+ };
+
+ xen_call_(session, "host.set_other_config", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "host.add_to_other_config", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
+ };
+
+ xen_call_(session, "host.remove_from_other_config", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)logging }
+ };
+
+ xen_call_(session, "host.set_logging", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "host.add_to_logging", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_remove_from_logging(xen_session *session, xen_host host, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
+ };
+
+ xen_call_(session, "host.remove_from_logging", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string,
+ .u.string_val = suspend_image_sr }
+ };
+
+ xen_call_(session, "host.set_suspend_image_sr", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host },
+ { .type = &abstract_type_string,
+ .u.string_val = crash_dump_sr }
+ };
+
+ xen_call_(session, "host.set_crash_dump_sr", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
xen_host_disable(xen_session *session, xen_host host)
{
abstract_value param_values[] =
diff --git a/tools/libxen/src/xen_host_cpu.c b/tools/libxen/src/xen_host_cpu.c
index ff73dcd9b9..1300ce0e43 100644
--- a/tools/libxen/src/xen_host_cpu.c
+++ b/tools/libxen/src/xen_host_cpu.c
@@ -21,8 +21,6 @@
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_cpu_feature.h"
-#include "xen_cpu_feature_internal.h"
#include "xen_host.h"
#include "xen_host_cpu.h"
#include "xen_internal.h"
@@ -57,9 +55,6 @@ static const struct_member xen_host_cpu_record_struct_members[] =
{ .key = "modelname",
.type = &abstract_type_string,
.offset = offsetof(xen_host_cpu_record, modelname) },
- { .key = "features",
- .type = &xen_cpu_feature_set_abstract_type_,
- .offset = offsetof(xen_host_cpu_record, features) },
{ .key = "utilisation",
.type = &abstract_type_float,
.offset = offsetof(xen_host_cpu_record, utilisation) }
@@ -87,7 +82,6 @@ xen_host_cpu_record_free(xen_host_cpu_record *record)
xen_host_record_opt_free(record->host);
free(record->vendor);
free(record->modelname);
- xen_cpu_feature_set_free(record->features);
free(record);
}
@@ -247,23 +241,6 @@ xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu hos
bool
-xen_host_cpu_get_features(xen_session *session, struct xen_cpu_feature_set **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = xen_cpu_feature_set_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_features");
- return session->ok;
-}
-
-
-bool
xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu)
{
abstract_value param_values[] =
diff --git a/tools/libxen/src/xen_host_metrics.c b/tools/libxen/src/xen_host_metrics.c
new file mode 100644
index 0000000000..910ca229ec
--- /dev/null
+++ b/tools/libxen/src/xen_host_metrics.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_host.h"
+#include "xen_host_metrics.h"
+#include "xen_internal.h"
+
+
+XEN_FREE(xen_host_metrics)
+XEN_SET_ALLOC_FREE(xen_host_metrics)
+XEN_ALLOC(xen_host_metrics_record)
+XEN_SET_ALLOC_FREE(xen_host_metrics_record)
+XEN_ALLOC(xen_host_metrics_record_opt)
+XEN_RECORD_OPT_FREE(xen_host_metrics)
+XEN_SET_ALLOC_FREE(xen_host_metrics_record_opt)
+
+
+static const struct_member xen_host_metrics_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_host_metrics_record, uuid) },
+ { .key = "host",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_host_metrics_record, host) },
+ { .key = "memory_total",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_host_metrics_record, memory_total) },
+ { .key = "memory_free",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_host_metrics_record, memory_free) }
+ };
+
+const abstract_type xen_host_metrics_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_host_metrics_record),
+ .member_count =
+ sizeof(xen_host_metrics_record_struct_members) / sizeof(struct_member),
+ .members = xen_host_metrics_record_struct_members
+ };
+
+
+void
+xen_host_metrics_record_free(xen_host_metrics_record *record)
+{
+ if (record == NULL)
+ {
+ return;
+ }
+ free(record->handle);
+ free(record->uuid);
+ xen_host_record_opt_free(record->host);
+ free(record);
+}
+
+
+bool
+xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_metrics }
+ };
+
+ abstract_type result_type = xen_host_metrics_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("host_metrics.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host_metrics.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_host_metrics_get_host(xen_session *session, xen_host *result, xen_host_metrics host_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_metrics }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host_metrics.get_host");
+ return session->ok;
+}
+
+
+bool
+xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_metrics }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("host_metrics.get_memory_total");
+ return session->ok;
+}
+
+
+bool
+xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_metrics }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("host_metrics.get_memory_free");
+ return session->ok;
+}
+
+
+bool
+xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics)
+{
+ *result = session->ok ? xen_strdup_((char *)host_metrics) : NULL;
+ return session->ok;
+}
diff --git a/tools/libxen/src/xen_pbd.c b/tools/libxen/src/xen_pbd.c
new file mode 100644
index 0000000000..cb7ac9df72
--- /dev/null
+++ b/tools/libxen/src/xen_pbd.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_host.h"
+#include "xen_internal.h"
+#include "xen_pbd.h"
+#include "xen_sr.h"
+#include "xen_string_string_map.h"
+
+
+XEN_FREE(xen_pbd)
+XEN_SET_ALLOC_FREE(xen_pbd)
+XEN_ALLOC(xen_pbd_record)
+XEN_SET_ALLOC_FREE(xen_pbd_record)
+XEN_ALLOC(xen_pbd_record_opt)
+XEN_RECORD_OPT_FREE(xen_pbd)
+XEN_SET_ALLOC_FREE(xen_pbd_record_opt)
+
+
+static const struct_member xen_pbd_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_pbd_record, uuid) },
+ { .key = "host",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_pbd_record, host) },
+ { .key = "SR",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_pbd_record, sr) },
+ { .key = "device_config",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_pbd_record, device_config) },
+ { .key = "currently_attached",
+ .type = &abstract_type_bool,
+ .offset = offsetof(xen_pbd_record, currently_attached) }
+ };
+
+const abstract_type xen_pbd_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_pbd_record),
+ .member_count =
+ sizeof(xen_pbd_record_struct_members) / sizeof(struct_member),
+ .members = xen_pbd_record_struct_members
+ };
+
+
+void
+xen_pbd_record_free(xen_pbd_record *record)
+{
+ if (record == NULL)
+ {
+ return;
+ }
+ free(record->handle);
+ free(record->uuid);
+ xen_host_record_opt_free(record->host);
+ xen_sr_record_opt_free(record->sr);
+ xen_string_string_map_free(record->device_config);
+ free(record);
+}
+
+
+bool
+xen_pbd_get_record(xen_session *session, xen_pbd_record **result, xen_pbd pbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pbd }
+ };
+
+ abstract_type result_type = xen_pbd_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("PBD.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_pbd_get_by_uuid(xen_session *session, xen_pbd *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PBD.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_pbd_create(xen_session *session, xen_pbd *result, xen_pbd_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_pbd_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PBD.create");
+ return session->ok;
+}
+
+
+bool
+xen_pbd_destroy(xen_session *session, xen_pbd pbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pbd }
+ };
+
+ xen_call_(session, "PBD.destroy", param_values, 1, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_pbd_get_host(xen_session *session, xen_host *result, xen_pbd pbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pbd }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PBD.get_host");
+ return session->ok;
+}
+
+
+bool
+xen_pbd_get_sr(xen_session *session, xen_sr *result, xen_pbd pbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pbd }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PBD.get_SR");
+ return session->ok;
+}
+
+
+bool
+xen_pbd_get_device_config(xen_session *session, xen_string_string_map **result, xen_pbd pbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pbd }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("PBD.get_device_config");
+ return session->ok;
+}
+
+
+bool
+xen_pbd_get_currently_attached(xen_session *session, bool *result, xen_pbd pbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pbd }
+ };
+
+ abstract_type result_type = abstract_type_bool;
+
+ XEN_CALL_("PBD.get_currently_attached");
+ return session->ok;
+}
+
+
+bool
+xen_pbd_get_uuid(xen_session *session, char **result, xen_pbd pbd)
+{
+ *result = session->ok ? xen_strdup_((char *)pbd) : NULL;
+ return session->ok;
+}
diff --git a/tools/libxen/src/xen_pif.c b/tools/libxen/src/xen_pif.c
index b3edd91e6d..0e9af6a382 100644
--- a/tools/libxen/src/xen_pif.c
+++ b/tools/libxen/src/xen_pif.c
@@ -25,6 +25,7 @@
#include "xen_internal.h"
#include "xen_network.h"
#include "xen_pif.h"
+#include "xen_pif_metrics.h"
XEN_FREE(xen_pif)
@@ -41,9 +42,9 @@ static const struct_member xen_pif_record_struct_members[] =
{ .key = "uuid",
.type = &abstract_type_string,
.offset = offsetof(xen_pif_record, uuid) },
- { .key = "name",
+ { .key = "device",
.type = &abstract_type_string,
- .offset = offsetof(xen_pif_record, name) },
+ .offset = offsetof(xen_pif_record, device) },
{ .key = "network",
.type = &abstract_type_ref,
.offset = offsetof(xen_pif_record, network) },
@@ -57,14 +58,11 @@ static const struct_member xen_pif_record_struct_members[] =
.type = &abstract_type_int,
.offset = offsetof(xen_pif_record, mtu) },
{ .key = "VLAN",
- .type = &abstract_type_string,
+ .type = &abstract_type_int,
.offset = offsetof(xen_pif_record, vlan) },
- { .key = "io_read_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_pif_record, io_read_kbs) },
- { .key = "io_write_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_pif_record, io_write_kbs) }
+ { .key = "metrics",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_pif_record, metrics) }
};
const abstract_type xen_pif_record_abstract_type_ =
@@ -86,11 +84,11 @@ xen_pif_record_free(xen_pif_record *record)
}
free(record->handle);
free(record->uuid);
- free(record->name);
+ free(record->device);
xen_network_record_opt_free(record->network);
xen_host_record_opt_free(record->host);
free(record->mac);
- free(record->vlan);
+ xen_pif_metrics_record_opt_free(record->metrics);
free(record);
}
@@ -136,38 +134,7 @@ xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid)
bool
-xen_pif_create(xen_session *session, xen_pif *result, xen_pif_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_pif_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.create");
- return session->ok;
-}
-
-
-bool
-xen_pif_destroy(xen_session *session, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- xen_call_(session, "PIF.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pif_get_name(xen_session *session, char **result, xen_pif pif)
+xen_pif_get_device(xen_session *session, char **result, xen_pif pif)
{
abstract_value param_values[] =
{
@@ -178,7 +145,7 @@ xen_pif_get_name(xen_session *session, char **result, xen_pif pif)
abstract_type result_type = abstract_type_string;
*result = NULL;
- XEN_CALL_("PIF.get_name");
+ XEN_CALL_("PIF.get_device");
return session->ok;
}
@@ -251,7 +218,7 @@ xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif)
bool
-xen_pif_get_vlan(xen_session *session, char **result, xen_pif pif)
+xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif)
{
abstract_value param_values[] =
{
@@ -259,32 +226,15 @@ xen_pif_get_vlan(xen_session *session, char **result, xen_pif pif)
.u.string_val = pif }
};
- abstract_type result_type = abstract_type_string;
+ abstract_type result_type = abstract_type_int;
- *result = NULL;
XEN_CALL_("PIF.get_VLAN");
return session->ok;
}
bool
-xen_pif_get_io_read_kbs(xen_session *session, double *result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("PIF.get_io_read_kbs");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_io_write_kbs(xen_session *session, double *result, xen_pif pif)
+xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif)
{
abstract_value param_values[] =
{
@@ -292,105 +242,111 @@ xen_pif_get_io_write_kbs(xen_session *session, double *result, xen_pif pif)
.u.string_val = pif }
};
- abstract_type result_type = abstract_type_float;
+ abstract_type result_type = abstract_type_string;
- XEN_CALL_("PIF.get_io_write_kbs");
+ *result = NULL;
+ XEN_CALL_("PIF.get_metrics");
return session->ok;
}
bool
-xen_pif_set_name(xen_session *session, xen_pif pif, char *name)
+xen_pif_set_device(xen_session *session, xen_pif pif, char *device)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = pif },
{ .type = &abstract_type_string,
- .u.string_val = name }
+ .u.string_val = device }
};
- xen_call_(session, "PIF.set_name", param_values, 2, NULL, NULL);
+ xen_call_(session, "PIF.set_device", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_pif_set_network(xen_session *session, xen_pif pif, xen_network network)
+xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = pif },
{ .type = &abstract_type_string,
- .u.string_val = network }
+ .u.string_val = mac }
};
- xen_call_(session, "PIF.set_network", param_values, 2, NULL, NULL);
+ xen_call_(session, "PIF.set_MAC", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_pif_set_host(xen_session *session, xen_pif pif, xen_host host)
+xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = pif },
- { .type = &abstract_type_string,
- .u.string_val = host }
+ { .type = &abstract_type_int,
+ .u.int_val = mtu }
};
- xen_call_(session, "PIF.set_host", param_values, 2, NULL, NULL);
+ xen_call_(session, "PIF.set_MTU", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac)
+xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = pif },
- { .type = &abstract_type_string,
- .u.string_val = mac }
+ { .type = &abstract_type_int,
+ .u.int_val = vlan }
};
- xen_call_(session, "PIF.set_MAC", param_values, 2, NULL, NULL);
+ xen_call_(session, "PIF.set_VLAN", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu)
+xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
- .u.string_val = pif },
+ .u.string_val = device },
+ { .type = &abstract_type_string,
+ .u.string_val = network },
+ { .type = &abstract_type_string,
+ .u.string_val = host },
{ .type = &abstract_type_int,
- .u.int_val = mtu }
+ .u.int_val = vlan }
};
- xen_call_(session, "PIF.set_MTU", param_values, 2, NULL, NULL);
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PIF.create_VLAN");
return session->ok;
}
bool
-xen_pif_set_vlan(xen_session *session, xen_pif pif, char *vlan)
+xen_pif_destroy(xen_session *session, xen_pif self)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
- .u.string_val = pif },
- { .type = &abstract_type_string,
- .u.string_val = vlan }
+ .u.string_val = self }
};
- xen_call_(session, "PIF.set_VLAN", param_values, 2, NULL, NULL);
+ xen_call_(session, "PIF.destroy", param_values, 1, NULL, NULL);
return session->ok;
}
diff --git a/tools/libxen/src/xen_pif_metrics.c b/tools/libxen/src/xen_pif_metrics.c
new file mode 100644
index 0000000000..3f09ae7dc1
--- /dev/null
+++ b/tools/libxen/src/xen_pif_metrics.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_pif.h"
+#include "xen_pif_metrics.h"
+
+
+XEN_FREE(xen_pif_metrics)
+XEN_SET_ALLOC_FREE(xen_pif_metrics)
+XEN_ALLOC(xen_pif_metrics_record)
+XEN_SET_ALLOC_FREE(xen_pif_metrics_record)
+XEN_ALLOC(xen_pif_metrics_record_opt)
+XEN_RECORD_OPT_FREE(xen_pif_metrics)
+XEN_SET_ALLOC_FREE(xen_pif_metrics_record_opt)
+
+
+static const struct_member xen_pif_metrics_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_pif_metrics_record, uuid) },
+ { .key = "PIF",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_pif_metrics_record, pif) },
+ { .key = "io_read_kbs",
+ .type = &abstract_type_float,
+ .offset = offsetof(xen_pif_metrics_record, io_read_kbs) },
+ { .key = "io_write_kbs",
+ .type = &abstract_type_float,
+ .offset = offsetof(xen_pif_metrics_record, io_write_kbs) }
+ };
+
+const abstract_type xen_pif_metrics_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_pif_metrics_record),
+ .member_count =
+ sizeof(xen_pif_metrics_record_struct_members) / sizeof(struct_member),
+ .members = xen_pif_metrics_record_struct_members
+ };
+
+
+void
+xen_pif_metrics_record_free(xen_pif_metrics_record *record)
+{
+ if (record == NULL)
+ {
+ return;
+ }
+ free(record->handle);
+ free(record->uuid);
+ xen_pif_record_opt_free(record->pif);
+ free(record);
+}
+
+
+bool
+xen_pif_metrics_get_record(xen_session *session, xen_pif_metrics_record **result, xen_pif_metrics pif_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pif_metrics }
+ };
+
+ abstract_type result_type = xen_pif_metrics_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("PIF_metrics.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_pif_metrics_get_by_uuid(xen_session *session, xen_pif_metrics *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PIF_metrics.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_pif_metrics_get_pif(xen_session *session, xen_pif *result, xen_pif_metrics pif_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pif_metrics }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("PIF_metrics.get_PIF");
+ return session->ok;
+}
+
+
+bool
+xen_pif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pif_metrics }
+ };
+
+ abstract_type result_type = abstract_type_float;
+
+ XEN_CALL_("PIF_metrics.get_io_read_kbs");
+ return session->ok;
+}
+
+
+bool
+xen_pif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = pif_metrics }
+ };
+
+ abstract_type result_type = abstract_type_float;
+
+ XEN_CALL_("PIF_metrics.get_io_write_kbs");
+ return session->ok;
+}
+
+
+bool
+xen_pif_metrics_get_uuid(xen_session *session, char **result, xen_pif_metrics pif_metrics)
+{
+ *result = session->ok ? xen_strdup_((char *)pif_metrics) : NULL;
+ return session->ok;
+}
diff --git a/tools/libxen/src/xen_sr.c b/tools/libxen/src/xen_sr.c
index 3c4ffb16de..c3650f26a0 100644
--- a/tools/libxen/src/xen_sr.c
+++ b/tools/libxen/src/xen_sr.c
@@ -22,6 +22,7 @@
#include "xen_common.h"
#include "xen_internal.h"
+#include "xen_pbd.h"
#include "xen_sr.h"
#include "xen_vdi.h"
@@ -49,6 +50,9 @@ static const struct_member xen_sr_record_struct_members[] =
{ .key = "VDIs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_sr_record, vdis) },
+ { .key = "PBDs",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_sr_record, pbds) },
{ .key = "virtual_allocation",
.type = &abstract_type_int,
.offset = offsetof(xen_sr_record, virtual_allocation) },
@@ -88,6 +92,7 @@ xen_sr_record_free(xen_sr_record *record)
free(record->name_label);
free(record->name_description);
xen_vdi_record_opt_set_free(record->vdis);
+ xen_pbd_record_opt_set_free(record->pbds);
free(record->type);
free(record->location);
free(record);
diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c
index c49ecf236a..786c7ea896 100644
--- a/tools/libxen/src/xen_vbd.c
+++ b/tools/libxen/src/xen_vbd.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_driver_type_internal.h"
#include "xen_internal.h"
#include "xen_vbd.h"
#include "xen_vbd_mode_internal.h"
@@ -55,12 +54,12 @@ static const struct_member xen_vbd_record_struct_members[] =
{ .key = "image",
.type = &abstract_type_string,
.offset = offsetof(xen_vbd_record, image) },
+ { .key = "bootable",
+ .type = &abstract_type_bool,
+ .offset = offsetof(xen_vbd_record, bootable) },
{ .key = "mode",
.type = &xen_vbd_mode_abstract_type_,
.offset = offsetof(xen_vbd_record, mode) },
- { .key = "driver",
- .type = &xen_driver_type_abstract_type_,
- .offset = offsetof(xen_vbd_record, driver) },
{ .key = "io_read_kbs",
.type = &abstract_type_float,
.offset = offsetof(xen_vbd_record, io_read_kbs) },
@@ -218,7 +217,7 @@ xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd)
bool
-xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd)
+xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd)
{
abstract_value param_values[] =
{
@@ -226,16 +225,15 @@ xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd)
.u.string_val = vbd }
};
- abstract_type result_type = xen_vbd_mode_abstract_type_;
- char *result_str = NULL;
- XEN_CALL_("VBD.get_mode");
- *result = xen_vbd_mode_from_string(session, result_str);
+ abstract_type result_type = abstract_type_bool;
+
+ XEN_CALL_("VBD.get_bootable");
return session->ok;
}
bool
-xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd vbd)
+xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd)
{
abstract_value param_values[] =
{
@@ -243,10 +241,10 @@ xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd v
.u.string_val = vbd }
};
- abstract_type result_type = xen_driver_type_abstract_type_;
+ abstract_type result_type = xen_vbd_mode_abstract_type_;
char *result_str = NULL;
- XEN_CALL_("VBD.get_driver");
- *result = xen_driver_type_from_string(session, result_str);
+ XEN_CALL_("VBD.get_mode");
+ *result = xen_vbd_mode_from_string(session, result_str);
return session->ok;
}
@@ -284,49 +282,33 @@ xen_vbd_get_io_write_kbs(xen_session *session, double *result, xen_vbd vbd)
bool
-xen_vbd_set_vm(xen_session *session, xen_vbd vbd, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VBD.set_VM", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_vdi(xen_session *session, xen_vbd vbd, xen_vdi vdi)
+xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vbd },
{ .type = &abstract_type_string,
- .u.string_val = vdi }
+ .u.string_val = device }
};
- xen_call_(session, "VBD.set_VDI", param_values, 2, NULL, NULL);
+ xen_call_(session, "VBD.set_device", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device)
+xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = device }
+ { .type = &abstract_type_bool,
+ .u.bool_val = bootable }
};
- xen_call_(session, "VBD.set_device", param_values, 2, NULL, NULL);
+ xen_call_(session, "VBD.set_bootable", param_values, 2, NULL, NULL);
return session->ok;
}
@@ -348,22 +330,6 @@ xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode)
bool
-xen_vbd_set_driver(xen_session *session, xen_vbd vbd, enum xen_driver_type driver)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &xen_driver_type_abstract_type_,
- .u.string_val = xen_driver_type_to_string(driver) }
- };
-
- xen_call_(session, "VBD.set_driver", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi)
{
abstract_value param_values[] =
diff --git a/tools/libxen/src/xen_vdi.c b/tools/libxen/src/xen_vdi.c
index a8d157d232..b2eddbcafb 100644
--- a/tools/libxen/src/xen_vdi.c
+++ b/tools/libxen/src/xen_vdi.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "xen_common.h"
+#include "xen_crashdump.h"
#include "xen_internal.h"
#include "xen_sr.h"
#include "xen_vbd.h"
@@ -54,6 +55,9 @@ static const struct_member xen_vdi_record_struct_members[] =
{ .key = "VBDs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_vdi_record, vbds) },
+ { .key = "crash_dumps",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_vdi_record, crash_dumps) },
{ .key = "virtual_size",
.type = &abstract_type_int,
.offset = offsetof(xen_vdi_record, virtual_size) },
@@ -66,12 +70,6 @@ static const struct_member xen_vdi_record_struct_members[] =
{ .key = "type",
.type = &xen_vdi_type_abstract_type_,
.offset = offsetof(xen_vdi_record, type) },
- { .key = "parent",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vdi_record, parent) },
- { .key = "children",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vdi_record, children) },
{ .key = "sharable",
.type = &abstract_type_bool,
.offset = offsetof(xen_vdi_record, sharable) },
@@ -103,8 +101,7 @@ xen_vdi_record_free(xen_vdi_record *record)
free(record->name_description);
xen_sr_record_opt_free(record->sr);
xen_vbd_record_opt_set_free(record->vbds);
- xen_vdi_record_opt_free(record->parent);
- xen_vdi_record_opt_set_free(record->children);
+ xen_crashdump_record_opt_set_free(record->crash_dumps);
free(record);
}
@@ -266,7 +263,7 @@ xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi vdi)
bool
-xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi)
+xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi)
{
abstract_value param_values[] =
{
@@ -274,15 +271,16 @@ xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi)
.u.string_val = vdi }
};
- abstract_type result_type = abstract_type_int;
+ abstract_type result_type = abstract_type_string_set;
- XEN_CALL_("VDI.get_virtual_size");
+ *result = NULL;
+ XEN_CALL_("VDI.get_crash_dumps");
return session->ok;
}
bool
-xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi)
+xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi)
{
abstract_value param_values[] =
{
@@ -292,13 +290,13 @@ xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi
abstract_type result_type = abstract_type_int;
- XEN_CALL_("VDI.get_physical_utilisation");
+ XEN_CALL_("VDI.get_virtual_size");
return session->ok;
}
bool
-xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi)
+xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi)
{
abstract_value param_values[] =
{
@@ -308,30 +306,13 @@ xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi)
abstract_type result_type = abstract_type_int;
- XEN_CALL_("VDI.get_sector_size");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = xen_vdi_type_abstract_type_;
- char *result_str = NULL;
- XEN_CALL_("VDI.get_type");
- *result = xen_vdi_type_from_string(session, result_str);
+ XEN_CALL_("VDI.get_physical_utilisation");
return session->ok;
}
bool
-xen_vdi_get_parent(xen_session *session, xen_vdi *result, xen_vdi vdi)
+xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi)
{
abstract_value param_values[] =
{
@@ -339,16 +320,15 @@ xen_vdi_get_parent(xen_session *session, xen_vdi *result, xen_vdi vdi)
.u.string_val = vdi }
};
- abstract_type result_type = abstract_type_string;
+ abstract_type result_type = abstract_type_int;
- *result = NULL;
- XEN_CALL_("VDI.get_parent");
+ XEN_CALL_("VDI.get_sector_size");
return session->ok;
}
bool
-xen_vdi_get_children(xen_session *session, struct xen_vdi_set **result, xen_vdi vdi)
+xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi)
{
abstract_value param_values[] =
{
@@ -356,10 +336,8 @@ xen_vdi_get_children(xen_session *session, struct xen_vdi_set **result, xen_vdi
.u.string_val = vdi }
};
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VDI.get_children");
+ abstract_type result_type = xen_vdi_type_abstract_type_;
+ XEN_CALL_("VDI.get_type");
return session->ok;
}
diff --git a/tools/libxen/src/xen_vdi_type.c b/tools/libxen/src/xen_vdi_type.c
index 90cfe8c820..79e855fa59 100644
--- a/tools/libxen/src/xen_vdi_type.c
+++ b/tools/libxen/src/xen_vdi_type.c
@@ -30,7 +30,9 @@ static const char *lookup_table[] =
{
"system",
"user",
- "ephemeral"
+ "ephemeral",
+ "suspend",
+ "crashdump"
};
diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c
index 82b4a15b31..47ef4730f6 100644
--- a/tools/libxen/src/xen_vif.c
+++ b/tools/libxen/src/xen_vif.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_driver_type_internal.h"
#include "xen_internal.h"
#include "xen_network.h"
#include "xen_vif.h"
@@ -42,12 +41,6 @@ static const struct_member xen_vif_record_struct_members[] =
{ .key = "uuid",
.type = &abstract_type_string,
.offset = offsetof(xen_vif_record, uuid) },
- { .key = "name",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, name) },
- { .key = "type",
- .type = &xen_driver_type_abstract_type_,
- .offset = offsetof(xen_vif_record, type) },
{ .key = "device",
.type = &abstract_type_string,
.offset = offsetof(xen_vif_record, device) },
@@ -90,7 +83,6 @@ xen_vif_record_free(xen_vif_record *record)
}
free(record->handle);
free(record->uuid);
- free(record->name);
free(record->device);
xen_network_record_opt_free(record->network);
xen_vm_record_opt_free(record->vm);
@@ -171,38 +163,6 @@ xen_vif_destroy(xen_session *session, xen_vif vif)
bool
-xen_vif_get_name(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_name");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = xen_driver_type_abstract_type_;
- XEN_CALL_("VIF.get_type");
- return session->ok;
-}
-
-
-bool
xen_vif_get_device(xen_session *session, char **result, xen_vif vif)
{
abstract_value param_values[] =
@@ -319,38 +279,6 @@ xen_vif_get_io_write_kbs(xen_session *session, double *result, xen_vif vif)
bool
-xen_vif_set_name(xen_session *session, xen_vif vif, char *name)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = name }
- };
-
- xen_call_(session, "VIF.set_name", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_type(xen_session *session, xen_vif vif, enum xen_driver_type type)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &xen_driver_type_abstract_type_,
- .u.string_val = xen_driver_type_to_string(type) }
- };
-
- xen_call_(session, "VIF.set_type", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
xen_vif_set_device(xen_session *session, xen_vif vif, char *device)
{
abstract_value param_values[] =
@@ -367,38 +295,6 @@ xen_vif_set_device(xen_session *session, xen_vif vif, char *device)
bool
-xen_vif_set_network(xen_session *session, xen_vif vif, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- xen_call_(session, "VIF.set_network", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_vm(xen_session *session, xen_vif vif, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VIF.set_VM", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac)
{
abstract_value param_values[] =
diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c
index 35cf104abf..6cbc3670b0 100644
--- a/tools/libxen/src/xen_vm.c
+++ b/tools/libxen/src/xen_vm.c
@@ -22,8 +22,7 @@
#include "xen_common.h"
#include "xen_console.h"
-#include "xen_cpu_feature.h"
-#include "xen_cpu_feature_internal.h"
+#include "xen_crashdump.h"
#include "xen_host.h"
#include "xen_int_float_map.h"
#include "xen_internal.h"
@@ -31,8 +30,10 @@
#include "xen_on_normal_exit_internal.h"
#include "xen_string_string_map.h"
#include "xen_vbd.h"
+#include "xen_vdi.h"
#include "xen_vif.h"
#include "xen_vm.h"
+#include "xen_vm_metrics.h"
#include "xen_vm_power_state_internal.h"
#include "xen_vtpm.h"
@@ -69,6 +70,9 @@ static const struct_member xen_vm_record_struct_members[] =
{ .key = "auto_power_on",
.type = &abstract_type_bool,
.offset = offsetof(xen_vm_record, auto_power_on) },
+ { .key = "suspend_VDI",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vm_record, suspend_vdi) },
{ .key = "resident_on",
.type = &abstract_type_ref,
.offset = offsetof(xen_vm_record, resident_on) },
@@ -78,9 +82,6 @@ static const struct_member xen_vm_record_struct_members[] =
{ .key = "memory_dynamic_max",
.type = &abstract_type_int,
.offset = offsetof(xen_vm_record, memory_dynamic_max) },
- { .key = "memory_actual",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, memory_actual) },
{ .key = "memory_dynamic_min",
.type = &abstract_type_int,
.offset = offsetof(xen_vm_record, memory_dynamic_min) },
@@ -91,35 +92,26 @@ static const struct_member xen_vm_record_struct_members[] =
.type = &abstract_type_string,
.offset = offsetof(xen_vm_record, vcpus_policy) },
{ .key = "VCPUs_params",
- .type = &abstract_type_string,
+ .type = &abstract_type_string_string_map,
.offset = offsetof(xen_vm_record, vcpus_params) },
+ { .key = "VCPUs_max",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vm_record, vcpus_max) },
+ { .key = "VCPUs_at_startup",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vm_record, vcpus_at_startup) },
{ .key = "VCPUs_number",
.type = &abstract_type_int,
.offset = offsetof(xen_vm_record, vcpus_number) },
{ .key = "VCPUs_utilisation",
.type = &abstract_type_int_float_map,
.offset = offsetof(xen_vm_record, vcpus_utilisation) },
- { .key = "VCPUs_features_required",
- .type = &xen_cpu_feature_set_abstract_type_,
- .offset = offsetof(xen_vm_record, vcpus_features_required) },
- { .key = "VCPUs_features_can_use",
- .type = &xen_cpu_feature_set_abstract_type_,
- .offset = offsetof(xen_vm_record, vcpus_features_can_use) },
- { .key = "VCPUs_features_force_on",
- .type = &xen_cpu_feature_set_abstract_type_,
- .offset = offsetof(xen_vm_record, vcpus_features_force_on) },
- { .key = "VCPUs_features_force_off",
- .type = &xen_cpu_feature_set_abstract_type_,
- .offset = offsetof(xen_vm_record, vcpus_features_force_off) },
{ .key = "actions_after_shutdown",
.type = &xen_on_normal_exit_abstract_type_,
.offset = offsetof(xen_vm_record, actions_after_shutdown) },
{ .key = "actions_after_reboot",
.type = &xen_on_normal_exit_abstract_type_,
.offset = offsetof(xen_vm_record, actions_after_reboot) },
- { .key = "actions_after_suspend",
- .type = &xen_on_normal_exit_abstract_type_,
- .offset = offsetof(xen_vm_record, actions_after_suspend) },
{ .key = "actions_after_crash",
.type = &xen_on_crash_behaviour_abstract_type_,
.offset = offsetof(xen_vm_record, actions_after_crash) },
@@ -132,6 +124,9 @@ static const struct_member xen_vm_record_struct_members[] =
{ .key = "VBDs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_vm_record, vbds) },
+ { .key = "crash_dumps",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_vm_record, crash_dumps) },
{ .key = "VTPMs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_vm_record, vtpms) },
@@ -174,9 +169,15 @@ static const struct_member xen_vm_record_struct_members[] =
{ .key = "tools_version",
.type = &abstract_type_string_string_map,
.offset = offsetof(xen_vm_record, tools_version) },
- { .key = "otherConfig",
+ { .key = "other_config",
.type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, otherconfig) }
+ .offset = offsetof(xen_vm_record, other_config) },
+ { .key = "is_control_domain",
+ .type = &abstract_type_bool,
+ .offset = offsetof(xen_vm_record, is_control_domain) },
+ { .key = "metrics",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vm_record, metrics) }
};
const abstract_type xen_vm_record_abstract_type_ =
@@ -200,17 +201,15 @@ xen_vm_record_free(xen_vm_record *record)
free(record->uuid);
free(record->name_label);
free(record->name_description);
+ xen_vdi_record_opt_free(record->suspend_vdi);
xen_host_record_opt_free(record->resident_on);
free(record->vcpus_policy);
- free(record->vcpus_params);
+ xen_string_string_map_free(record->vcpus_params);
xen_int_float_map_free(record->vcpus_utilisation);
- xen_cpu_feature_set_free(record->vcpus_features_required);
- xen_cpu_feature_set_free(record->vcpus_features_can_use);
- xen_cpu_feature_set_free(record->vcpus_features_force_on);
- xen_cpu_feature_set_free(record->vcpus_features_force_off);
xen_console_record_opt_set_free(record->consoles);
xen_vif_record_opt_set_free(record->vifs);
xen_vbd_record_opt_set_free(record->vbds);
+ xen_crashdump_record_opt_set_free(record->crash_dumps);
xen_vtpm_record_opt_set_free(record->vtpms);
free(record->pv_bootloader);
free(record->pv_kernel);
@@ -221,7 +220,8 @@ xen_vm_record_free(xen_vm_record *record)
free(record->platform_serial);
free(record->pci_bus);
xen_string_string_map_free(record->tools_version);
- xen_string_string_map_free(record->otherconfig);
+ xen_string_string_map_free(record->other_config);
+ xen_vm_metrics_record_opt_free(record->metrics);
free(record);
}
@@ -412,7 +412,7 @@ xen_vm_get_auto_power_on(xen_session *session, bool *result, xen_vm vm)
bool
-xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm)
+xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -423,13 +423,13 @@ xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm)
abstract_type result_type = abstract_type_string;
*result = NULL;
- XEN_CALL_("VM.get_resident_on");
+ XEN_CALL_("VM.get_suspend_VDI");
return session->ok;
}
bool
-xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm)
+xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -437,15 +437,16 @@ xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm)
.u.string_val = vm }
};
- abstract_type result_type = abstract_type_int;
+ abstract_type result_type = abstract_type_string;
- XEN_CALL_("VM.get_memory_static_max");
+ *result = NULL;
+ XEN_CALL_("VM.get_resident_on");
return session->ok;
}
bool
-xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm)
+xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -455,13 +456,13 @@ xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm)
abstract_type result_type = abstract_type_int;
- XEN_CALL_("VM.get_memory_dynamic_max");
+ XEN_CALL_("VM.get_memory_static_max");
return session->ok;
}
bool
-xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm)
+xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -471,7 +472,7 @@ xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm)
abstract_type result_type = abstract_type_int;
- XEN_CALL_("VM.get_memory_actual");
+ XEN_CALL_("VM.get_memory_dynamic_max");
return session->ok;
}
@@ -526,7 +527,7 @@ xen_vm_get_vcpus_policy(xen_session *session, char **result, xen_vm vm)
bool
-xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm)
+xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -534,7 +535,7 @@ xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm)
.u.string_val = vm }
};
- abstract_type result_type = abstract_type_string;
+ abstract_type result_type = abstract_type_string_string_map;
*result = NULL;
XEN_CALL_("VM.get_VCPUs_params");
@@ -543,7 +544,7 @@ xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm)
bool
-xen_vm_get_vcpus_number(xen_session *session, int64_t *result, xen_vm vm)
+xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -553,13 +554,13 @@ xen_vm_get_vcpus_number(xen_session *session, int64_t *result, xen_vm vm)
abstract_type result_type = abstract_type_int;
- XEN_CALL_("VM.get_VCPUs_number");
+ XEN_CALL_("VM.get_VCPUs_max");
return session->ok;
}
bool
-xen_vm_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm vm)
+xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -567,50 +568,15 @@ xen_vm_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, x
.u.string_val = vm }
};
- abstract_type result_type = abstract_type_int_float_map;
-
- *result = NULL;
- XEN_CALL_("VM.get_VCPUs_utilisation");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_features_required(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_cpu_feature_set_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VM.get_VCPUs_features_required");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_features_can_use(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_cpu_feature_set_abstract_type_;
+ abstract_type result_type = abstract_type_int;
- *result = NULL;
- XEN_CALL_("VM.get_VCPUs_features_can_use");
+ XEN_CALL_("VM.get_VCPUs_at_startup");
return session->ok;
}
bool
-xen_vm_get_vcpus_features_force_on(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm)
+xen_vm_get_vcpus_number(xen_session *session, int64_t *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -618,16 +584,15 @@ xen_vm_get_vcpus_features_force_on(xen_session *session, struct xen_cpu_feature_
.u.string_val = vm }
};
- abstract_type result_type = xen_cpu_feature_set_abstract_type_;
+ abstract_type result_type = abstract_type_int;
- *result = NULL;
- XEN_CALL_("VM.get_VCPUs_features_force_on");
+ XEN_CALL_("VM.get_VCPUs_number");
return session->ok;
}
bool
-xen_vm_get_vcpus_features_force_off(xen_session *session, struct xen_cpu_feature_set **result, xen_vm vm)
+xen_vm_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -635,10 +600,10 @@ xen_vm_get_vcpus_features_force_off(xen_session *session, struct xen_cpu_feature
.u.string_val = vm }
};
- abstract_type result_type = xen_cpu_feature_set_abstract_type_;
+ abstract_type result_type = abstract_type_int_float_map;
*result = NULL;
- XEN_CALL_("VM.get_VCPUs_features_force_off");
+ XEN_CALL_("VM.get_VCPUs_utilisation");
return session->ok;
}
@@ -674,7 +639,7 @@ xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *r
bool
-xen_vm_get_actions_after_suspend(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm)
+xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -682,14 +647,14 @@ xen_vm_get_actions_after_suspend(xen_session *session, enum xen_on_normal_exit *
.u.string_val = vm }
};
- abstract_type result_type = xen_on_normal_exit_abstract_type_;
- XEN_CALL_("VM.get_actions_after_suspend");
+ abstract_type result_type = xen_on_crash_behaviour_abstract_type_;
+ XEN_CALL_("VM.get_actions_after_crash");
return session->ok;
}
bool
-xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm)
+xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -697,14 +662,16 @@ xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour
.u.string_val = vm }
};
- abstract_type result_type = xen_on_crash_behaviour_abstract_type_;
- XEN_CALL_("VM.get_actions_after_crash");
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("VM.get_consoles");
return session->ok;
}
bool
-xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_vm vm)
+xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -715,13 +682,13 @@ xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_v
abstract_type result_type = abstract_type_string_set;
*result = NULL;
- XEN_CALL_("VM.get_consoles");
+ XEN_CALL_("VM.get_VIFs");
return session->ok;
}
bool
-xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm)
+xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -732,13 +699,13 @@ xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm)
abstract_type result_type = abstract_type_string_set;
*result = NULL;
- XEN_CALL_("VM.get_VIFs");
+ XEN_CALL_("VM.get_VBDs");
return session->ok;
}
bool
-xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm)
+xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -749,7 +716,7 @@ xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm)
abstract_type result_type = abstract_type_string_set;
*result = NULL;
- XEN_CALL_("VM.get_VBDs");
+ XEN_CALL_("VM.get_crash_dumps");
return session->ok;
}
@@ -989,7 +956,7 @@ xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result, x
bool
-xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen_vm vm)
+xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm)
{
abstract_value param_values[] =
{
@@ -1000,7 +967,40 @@ xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen
abstract_type result_type = abstract_type_string_string_map;
*result = NULL;
- XEN_CALL_("VM.get_otherConfig");
+ XEN_CALL_("VM.get_other_config");
+ return session->ok;
+}
+
+
+bool
+xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm }
+ };
+
+ abstract_type result_type = abstract_type_bool;
+
+ XEN_CALL_("VM.get_is_control_domain");
+ return session->ok;
+}
+
+
+bool
+xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VM.get_metrics");
return session->ok;
}
@@ -1086,177 +1086,163 @@ xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on)
bool
-xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max)
+xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &abstract_type_int,
- .u.int_val = dynamic_max }
+ .u.int_val = static_max }
};
- xen_call_(session, "VM.set_memory_dynamic_max", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_memory_static_max", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min)
+xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &abstract_type_int,
- .u.int_val = dynamic_min }
- };
-
- xen_call_(session, "VM.set_memory_dynamic_min", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = policy }
+ .u.int_val = dynamic_max }
};
- xen_call_(session, "VM.set_VCPUs_policy", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_memory_dynamic_max", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params)
+xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = params }
+ { .type = &abstract_type_int,
+ .u.int_val = dynamic_min }
};
- xen_call_(session, "VM.set_VCPUs_params", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_memory_dynamic_min", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number)
+xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &abstract_type_int,
- .u.int_val = number }
+ .u.int_val = static_min }
};
- xen_call_(session, "VM.set_VCPUs_number", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_memory_static_min", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_set_vcpus_features_force_on(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_on)
+xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &xen_cpu_feature_set_abstract_type_,
- .u.set_val = (arbitrary_set *)force_on }
+ { .type = &abstract_type_string,
+ .u.string_val = policy }
};
- xen_call_(session, "VM.set_VCPUs_features_force_on", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_VCPUs_policy", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_add_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value)
+xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &xen_cpu_feature_abstract_type_,
- .u.string_val = xen_cpu_feature_to_string(value) }
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)params }
};
- xen_call_(session, "VM.add_VCPUs_features_force_on", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_VCPUs_params", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_remove_vcpus_features_force_on(xen_session *session, xen_vm vm, enum xen_cpu_feature value)
+xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &xen_cpu_feature_abstract_type_,
- .u.string_val = xen_cpu_feature_to_string(value) }
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
};
- xen_call_(session, "VM.remove_VCPUs_features_force_on", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.add_to_VCPUs_params", param_values, 3, NULL, NULL);
return session->ok;
}
bool
-xen_vm_set_vcpus_features_force_off(xen_session *session, xen_vm vm, struct xen_cpu_feature_set *force_off)
+xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &xen_cpu_feature_set_abstract_type_,
- .u.set_val = (arbitrary_set *)force_off }
+ { .type = &abstract_type_string,
+ .u.string_val = key }
};
- xen_call_(session, "VM.set_VCPUs_features_force_off", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.remove_from_VCPUs_params", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_add_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value)
+xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &xen_cpu_feature_abstract_type_,
- .u.string_val = xen_cpu_feature_to_string(value) }
+ { .type = &abstract_type_int,
+ .u.int_val = max }
};
- xen_call_(session, "VM.add_VCPUs_features_force_off", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_VCPUs_max", param_values, 2, NULL, NULL);
return session->ok;
}
bool
-xen_vm_remove_vcpus_features_force_off(xen_session *session, xen_vm vm, enum xen_cpu_feature value)
+xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
- { .type = &xen_cpu_feature_abstract_type_,
- .u.string_val = xen_cpu_feature_to_string(value) }
+ { .type = &abstract_type_int,
+ .u.int_val = at_startup }
};
- xen_call_(session, "VM.remove_VCPUs_features_force_off", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.set_VCPUs_at_startup", param_values, 2, NULL, NULL);
return session->ok;
}
@@ -1294,22 +1280,6 @@ xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_nor
bool
-xen_vm_set_actions_after_suspend(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_suspend)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &xen_on_normal_exit_abstract_type_,
- .u.string_val = xen_on_normal_exit_to_string(after_suspend) }
- };
-
- xen_call_(session, "VM.set_actions_after_suspend", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_crash_behaviour after_crash)
{
abstract_value param_values[] =
@@ -1502,17 +1472,51 @@ xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool enable_au
bool
-xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig)
+xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)otherconfig }
+ .u.set_val = (arbitrary_set *)other_config }
+ };
+
+ xen_call_(session, "VM.set_other_config", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "VM.add_to_other_config", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
};
- xen_call_(session, "VM.set_otherConfig", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.remove_from_other_config", param_values, 2, NULL, NULL);
return session->ok;
}
diff --git a/tools/libxen/src/xen_vm_metrics.c b/tools/libxen/src/xen_vm_metrics.c
new file mode 100644
index 0000000000..03a08d8971
--- /dev/null
+++ b/tools/libxen/src/xen_vm_metrics.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_int_float_map.h"
+#include "xen_internal.h"
+#include "xen_vm.h"
+#include "xen_vm_metrics.h"
+
+
+XEN_FREE(xen_vm_metrics)
+XEN_SET_ALLOC_FREE(xen_vm_metrics)
+XEN_ALLOC(xen_vm_metrics_record)
+XEN_SET_ALLOC_FREE(xen_vm_metrics_record)
+XEN_ALLOC(xen_vm_metrics_record_opt)
+XEN_RECORD_OPT_FREE(xen_vm_metrics)
+XEN_SET_ALLOC_FREE(xen_vm_metrics_record_opt)
+
+
+static const struct_member xen_vm_metrics_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vm_metrics_record, uuid) },
+ { .key = "VM",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vm_metrics_record, vm) },
+ { .key = "memory_actual",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vm_metrics_record, memory_actual) },
+ { .key = "VCPUs_number",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vm_metrics_record, vcpus_number) },
+ { .key = "VCPUs_utilisation",
+ .type = &abstract_type_int_float_map,
+ .offset = offsetof(xen_vm_metrics_record, vcpus_utilisation) }
+ };
+
+const abstract_type xen_vm_metrics_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_vm_metrics_record),
+ .member_count =
+ sizeof(xen_vm_metrics_record_struct_members) / sizeof(struct_member),
+ .members = xen_vm_metrics_record_struct_members
+ };
+
+
+void
+xen_vm_metrics_record_free(xen_vm_metrics_record *record)
+{
+ if (record == NULL)
+ {
+ return;
+ }
+ free(record->handle);
+ free(record->uuid);
+ xen_vm_record_opt_free(record->vm);
+ xen_int_float_map_free(record->vcpus_utilisation);
+ free(record);
+}
+
+
+bool
+xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm_metrics }
+ };
+
+ abstract_type result_type = xen_vm_metrics_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("VM_metrics.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VM_metrics.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics vm_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm_metrics }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VM_metrics.get_VM");
+ return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm_metrics }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("VM_metrics.get_memory_actual");
+ return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm_metrics }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("VM_metrics.get_VCPUs_number");
+ return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm_metrics }
+ };
+
+ abstract_type result_type = abstract_type_int_float_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_metrics.get_VCPUs_utilisation");
+ return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics)
+{
+ *result = session->ok ? xen_strdup_((char *)vm_metrics) : NULL;
+ return session->ok;
+}
diff --git a/tools/libxen/src/xen_vtpm.c b/tools/libxen/src/xen_vtpm.c
index 7c482be459..2b695f6ee2 100644
--- a/tools/libxen/src/xen_vtpm.c
+++ b/tools/libxen/src/xen_vtpm.c
@@ -22,7 +22,6 @@
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_driver_type_internal.h"
#include "xen_internal.h"
#include "xen_vm.h"
#include "xen_vtpm.h"
@@ -48,12 +47,6 @@ static const struct_member xen_vtpm_record_struct_members[] =
{ .key = "backend",
.type = &abstract_type_ref,
.offset = offsetof(xen_vtpm_record, backend) },
- { .key = "driver",
- .type = &xen_driver_type_abstract_type_,
- .offset = offsetof(xen_vtpm_record, driver) },
- { .key = "instance",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vtpm_record, instance) }
};
const abstract_type xen_vtpm_record_abstract_type_ =
@@ -187,37 +180,6 @@ xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm)
bool
-xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vtpm }
- };
-
- abstract_type result_type = xen_driver_type_abstract_type_;
- XEN_CALL_("VTPM.get_driver");
- return session->ok;
-}
-
-
-bool
-xen_vtpm_get_instance(xen_session *session, int64_t *result, xen_vtpm vtpm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vtpm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VTPM.get_instance");
- return session->ok;
-}
-
-
-bool
xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm)
{
*result = session->ok ? xen_strdup_((char *)vtpm) : NULL;
diff --git a/tools/libxen/test/test_bindings.c b/tools/libxen/test/test_bindings.c
index 1e10ef4223..88fce8b35b 100644
--- a/tools/libxen/test/test_bindings.c
+++ b/tools/libxen/test/test_bindings.c
@@ -277,13 +277,7 @@ int main(int argc, char **argv)
*/
static xen_vm create_new_vm(xen_session *session)
{
- xen_cpu_feature_set *empty_cpu_feature_set =
- xen_cpu_feature_set_alloc(0);
-
- xen_cpu_feature_set *force_off_cpu_feature_set =
- xen_cpu_feature_set_alloc(1);
- force_off_cpu_feature_set->contents[0] = XEN_CPU_FEATURE_MMX;
-
+ xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1);
xen_vm_record vm_record =
{
.name_label = "NewVM",
@@ -295,15 +289,10 @@ static xen_vm create_new_vm(xen_session *session)
.memory_dynamic_min = 128,
.memory_static_min = 128,
.vcpus_policy = "credit",
- .vcpus_params = "",
+ .vcpus_params = vcpus_params,
.vcpus_number = 2,
- .vcpus_features_required = empty_cpu_feature_set,
- .vcpus_features_can_use = empty_cpu_feature_set,
- .vcpus_features_force_on = empty_cpu_feature_set,
- .vcpus_features_force_off = force_off_cpu_feature_set,
.actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
.actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
- .actions_after_suspend = XEN_ON_NORMAL_EXIT_DESTROY,
.actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
.hvm_boot = "",
.pv_bootloader = "pygrub",
@@ -317,9 +306,6 @@ static xen_vm create_new_vm(xen_session *session)
xen_vm vm;
xen_vm_create(session, &vm, &vm_record);
- xen_cpu_feature_set_free(empty_cpu_feature_set);
- xen_cpu_feature_set_free(force_off_cpu_feature_set);
-
if (!session->ok)
{
fprintf(stderr, "VM creation failed.\n");
@@ -382,8 +368,7 @@ static xen_vm create_new_vm(xen_session *session)
.vm = &vm_record_opt,
.vdi = &vdi0_record_opt,
.device = "xvda1",
- .mode = XEN_VBD_MODE_RW,
- .driver = XEN_DRIVER_TYPE_PARAVIRTUALISED
+ .mode = XEN_VBD_MODE_RW
};
xen_vbd vbd0;
diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c
index ad0182d691..52a8a4b1ac 100644
--- a/tools/pygrub/src/fsimage/fsimage.c
+++ b/tools/pygrub/src/fsimage/fsimage.c
@@ -125,7 +125,7 @@ fsimage_file_dealloc(fsimage_file_t *file)
if (file->file != NULL)
fsi_close_file(file->file);
Py_XDECREF(file->fs);
- PyMem_DEL(file);
+ PyObject_DEL(file);
}
static char fsimage_file_type__doc__[] = "Filesystem image file";
@@ -226,7 +226,7 @@ fsimage_fs_dealloc (fsimage_fs_t *fs)
{
if (fs->fs != NULL)
fsi_close_fsimage(fs->fs);
- PyMem_DEL(fs);
+ PyObject_DEL(fs);
}
PyDoc_STRVAR(fsimage_fs_type__doc__, "Filesystem image");
diff --git a/tools/python/scripts/test_hvm_create.py b/tools/python/scripts/test_hvm_create.py
index 5d2aca5944..8effd42db9 100644
--- a/tools/python/scripts/test_hvm_create.py
+++ b/tools/python/scripts/test_hvm_create.py
@@ -72,6 +72,12 @@ vif_cfg = {
'MTU': 1500,
}
+console_cfg = {
+ 'protocol': 'rfb',
+ 'other_config': {'vncunused': 1, 'vncpasswd': 'testing'},
+}
+
+
import sys
import time
sys.path.append('/usr/lib/python')
@@ -125,6 +131,12 @@ def test_vm_create():
vif_cfg['VM'] = vm_uuid
vif_uuid = execute(server, 'VIF.create', (session, vif_cfg))
+ # Create a console
+ console_cfg['VM'] = vm_uuid
+ console_uuid = execute(server, 'console.create',
+ (session, console_cfg))
+ print console_uuid
+
# Start the VM
execute(server, 'VM.start', (session, vm_uuid, False))
diff --git a/tools/python/scripts/test_vm_create.py b/tools/python/scripts/test_vm_create.py
index 19a5135153..0d702aae69 100644
--- a/tools/python/scripts/test_vm_create.py
+++ b/tools/python/scripts/test_vm_create.py
@@ -91,6 +91,11 @@ vif_cfg = {
'network': '',
'MAC': '',
'MTU': 1500,
+}
+
+console_cfg = {
+ 'protocol': 'rfb',
+ 'other_config': {'vncunused': 1, 'vncpasswd': 'testing'},
}
import sys
@@ -157,12 +162,18 @@ def test_vm_create():
vif_cfg['VM'] = vm_uuid
vif_uuid = execute(server, 'VIF.create', (session, vif_cfg))
+ # Create a console
+ console_cfg['VM'] = vm_uuid
+ console_uuid = execute(server, 'console.create',
+ (session, console_cfg))
+ print console_uuid
+
# Start the VM
execute(server, 'VM.start', (session, vm_uuid, False))
time.sleep(30)
- test_suspend = True
+ test_suspend = False
if test_suspend:
print 'Suspending VM..'
execute(server, 'VM.suspend', (session, vm_uuid))
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py
index f1829e0a10..b5fe8b3682 100644
--- a/tools/python/scripts/xapi.py
+++ b/tools/python/scripts/xapi.py
@@ -45,7 +45,7 @@ VDI_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(virtual_size)-8s '\
VBD_LIST_FORMAT = '%(device)-6s %(uuid)-36s %(VDI)-8s'
TASK_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(status)-8s %(progress)-4s'
VIF_LIST_FORMAT = '%(name)-8s %(device)-7s %(uuid)-36s %(MAC)-10s'
-CONSOLE_LIST_FORMAT = '%(uuid)-36s %(protocol)-8s %(uri)-32s'
+CONSOLE_LIST_FORMAT = '%(uuid)-36s %(protocol)-8s %(location)-32s'
COMMANDS = {
'host-info': ('', 'Get Xen Host Info'),
@@ -545,7 +545,7 @@ def xapi_console_list(args, async = False):
if not is_long:
print CONSOLE_LIST_FORMAT % {'protocol': 'Protocol',
- 'uri': 'URI',
+ 'location': 'Location',
'uuid': 'UUID'}
for console in consoles:
@@ -678,14 +678,6 @@ def xapi_vtpm_create(args, async = False):
print "Creating vTPM with cfg = %s" % cfg
vtpm_uuid = execute(server, 'VTPM.create', (session, cfg))
print "Done. (%s)" % vtpm_uuid
- vtpm_id = execute(server, 'VTPM.get_instance', (session, vtpm_uuid))
- print "Has instance number '%s'" % vtpm_id
- vtpm_be = execute(server, 'VTPM.get_backend', (session, vtpm_uuid))
- print "Has backend in '%s'" % vtpm_be
- driver = execute(server, 'VTPM.get_driver', (session, vtpm_uuid))
- print "Has driver type '%s'" % driver
- vtpm_rec = execute(server, 'VTPM.get_record', (session, vtpm_uuid))
- print "Has vtpm record '%s'" % vtpm_rec
def xapi_pif_list(args, async = False):
diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py
index b9e6dfe1c8..0b249f9449 100644
--- a/tools/python/xen/xend/XendAPI.py
+++ b/tools/python/xen/xend/XendAPI.py
@@ -12,7 +12,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#============================================================================
-# Copyright (C) 2006 XenSource Ltd.
+# Copyright (C) 2006-2007 XenSource Ltd.
#============================================================================
import inspect
@@ -158,6 +158,17 @@ def valid_host(func):
_check_ref(XendNode.instance().is_valid_host,
'HOST_HANDLE_INVALID', func, *args, **kwargs)
+def valid_host_metrics(func):
+ """Decorator to verify if host_metrics_ref is valid before calling
+ method.
+
+ @param func: function with params: (self, session, host_metrics_ref)
+ @rtype: callable object
+ """
+ return lambda *args, **kwargs: \
+ _check_ref(lambda r: r == XendNode.instance().host_metrics_uuid,
+ 'HOST_METRICS_HANDLE_INVALID', func, *args, **kwargs)
+
def valid_host_cpu(func):
"""Decorator to verify if host_cpu_ref is valid before calling method.
@@ -261,6 +272,17 @@ def valid_pif(func):
_check_ref(lambda r: r in XendNode.instance().pifs,
'PIF_HANDLE_INVALID', func, *args, **kwargs)
+def valid_pif_metrics(func):
+ """Decorator to verify if pif_metrics_ref is valid before calling
+ method.
+
+ @param func: function with params: (self, session, pif_metrics_ref)
+ @rtype: callable object
+ """
+ return lambda *args, **kwargs: \
+ _check_ref(lambda r: r in XendNode.instance().pif_metrics,
+ 'PIF_METRICS_HANDLE_INVALID', func, *args, **kwargs)
+
def valid_task(func):
"""Decorator to verify if task_ref is valid before calling
method.
@@ -349,20 +371,22 @@ class XendAPI(object):
"""
global_validators = [session_required, catch_typeerror]
classes = {
- 'session' : None,
- 'host' : valid_host,
- 'host_cpu': valid_host_cpu,
- 'network' : valid_network,
- 'VM' : valid_vm,
- 'VBD' : valid_vbd,
- 'VIF' : valid_vif,
- 'VDI' : valid_vdi,
- 'VTPM' : valid_vtpm,
- 'console' : valid_console,
- 'SR' : valid_sr,
- 'PIF' : valid_pif,
- 'task' : valid_task,
- 'debug' : valid_debug,
+ 'session' : None,
+ 'host' : valid_host,
+ 'host_cpu' : valid_host_cpu,
+ 'host_metrics' : valid_host_metrics,
+ 'network' : valid_network,
+ 'VM' : valid_vm,
+ 'VBD' : valid_vbd,
+ 'VIF' : valid_vif,
+ 'VDI' : valid_vdi,
+ 'VTPM' : valid_vtpm,
+ 'console' : valid_console,
+ 'SR' : valid_sr,
+ 'PIF' : valid_pif,
+ 'PIF_metrics' : valid_pif_metrics,
+ 'task' : valid_task,
+ 'debug' : valid_debug,
}
# Cheat methods
@@ -372,6 +396,9 @@ class XendAPI(object):
# all get_by_uuid() methods.
for api_cls in classes.keys():
+ if api_cls == 'session':
+ continue
+
get_by_uuid = '%s_get_by_uuid' % api_cls
get_uuid = '%s_get_uuid' % api_cls
def _get_by_uuid(_1, _2, ref):
@@ -451,7 +478,6 @@ class XendAPI(object):
session_attr_ro = ['this_host', 'this_user']
session_methods = [('logout', None)]
- # session_funcs = ['login_with_password']
def session_login_with_password(self, *args):
if len(args) != 2:
@@ -473,15 +499,18 @@ class XendAPI(object):
def session_logout(self, session):
auth_manager().logout(session)
return xen_api_success_void()
- def session_destroy(self, session):
- return xen_api_error(XEND_ERROR_UNSUPPORTED)
def session_get_record(self, session):
- record = {'this_host': XendNode.instance().uuid,
+ record = {'uuid' : session,
+ 'this_host': XendNode.instance().uuid,
'this_user': auth_manager().get_user(session)}
return xen_api_success(record)
- def session_get_all(self):
- return xen_api_error(XEND_ERROR_UNSUPPORTED)
-
+
+ def session_get_uuid(self, session):
+ return xen_api_success(session)
+
+ def session_get_by_uuid(self, session):
+ return xen_api_success(session)
+
# attributes (ro)
def session_get_this_host(self, session):
return xen_api_success(XendNode.instance().uuid)
@@ -499,18 +528,30 @@ class XendAPI(object):
# Xen API: Class Tasks
# ----------------------------------------------------------------
- task_attr_ro = ['status',
+ task_attr_ro = ['name_label',
+ 'name_description',
+ 'status',
'progress',
- 'eta',
'type',
'result',
'error_code',
- 'error_info']
+ 'error_info',
+ 'allowed_operations',
+ 'session'
+ ]
- task_attr_rw = ['name_label',
- 'name_description']
+ task_attr_rw = []
+
+ task_funcs = [('get_by_name_label', 'Set(task)'),
+ ('cancel', None)]
+
+ def task_get_name_label(self, session, task_ref):
+ task = XendTaskManager.get_task(task_ref)
+ return xen_api_success(task.name_label)
- task_funcs = [('get_by_name_label', 'Set(task)')]
+ def task_get_name_description(self, session, task_ref):
+ task = XendTaskManager.get_task(task_ref)
+ return xen_api_success(task.name_description)
def task_get_status(self, session, task_ref):
task = XendTaskManager.get_task(task_ref)
@@ -520,10 +561,6 @@ class XendAPI(object):
task = XendTaskManager.get_task(task_ref)
return xen_api_success(task.progress)
- def task_get_eta(self, session, task_ref):
- task = XendTaskManager.get_task(task_ref)
- return xen_api_success(task.eta)
-
def task_get_type(self, session, task_ref):
task = XendTaskManager.get_task(task_ref)
return xen_api_success(task.type)
@@ -540,53 +577,45 @@ class XendAPI(object):
task = XendTaskManager.get_task(task_ref)
return xen_api_success(task.error_info)
- def task_get_name_label(self, session, task_ref):
- task = XendTaskManager.get_task(task_ref)
- return xen_api_success(task.name_label)
+ def task_get_allowed_operations(self, session, task_ref):
+ return xen_api_success({})
- def task_get_name_description(self, session, task_ref):
+ def task_get_session(self, session, task_ref):
task = XendTaskManager.get_task(task_ref)
- return xen_api_success(task.name_description)
-
- def task_set_name_label(self, session, task_ref, label):
- task = XendTaskManager.get_task(task_ref)
- task.name_label = label
- return xen_api_success_void()
-
- def task_set_name_description(self, session, task_ref, desc):
- task = XendTaskManager.get_task(task_ref)
- task.name_description = desc
- return xen_api_success_void()
+ return xen_api_success(task.session)
def task_get_all(self, session):
tasks = XendTaskManager.get_all_tasks()
return xen_api_success(tasks)
- def task_destroy(self, session, task_uuid):
- XendTaskManager.destroy_task(task_uuid)
- return xen_api_success_void()
-
def task_get_record(self, session, task_ref):
task = XendTaskManager.get_task(task_ref)
return xen_api_success(task.get_record())
+ def task_cancel(self, session, task_ref):
+ return xen_api_error('OPERATION_NOT_ALLOWED')
+
def task_get_by_name_label(self, session, name):
return xen_api_success(XendTaskManager.get_task_by_name(name))
- # Xen API: Class Host
+ # Xen API: Class host
# ----------------------------------------------------------------
host_attr_ro = ['software_version',
'resident_VMs',
- 'host_CPUs']
+ 'host_CPUs',
+ 'metrics']
host_attr_rw = ['name_label',
- 'name_description']
+ 'name_description',
+ 'other_config']
host_methods = [('disable', None),
('enable', None),
('reboot', None),
- ('shutdown', None)]
+ ('shutdown', None),
+ ('add_to_other_config', None),
+ ('remove_from_other_config', None)]
host_funcs = [('get_by_name_label', 'Set(host)')]
@@ -601,12 +630,31 @@ class XendAPI(object):
def host_set_name_description(self, session, host_ref, new_desc):
XendNode.instance().set_description(new_desc)
return xen_api_success_void()
+ def host_get_other_config(self, session, host_ref):
+ return xen_api_success(XendNode.instance().other_config)
+ def host_set_other_config(self, session, host_ref, other_config):
+ node = XendNode.instance()
+ node.other_config = dict(other_config)
+ node.save()
+ return xen_api_success_void()
+ def host_add_to_other_config(self, session, host_ref, key, value):
+ node = XendNode.instance()
+ node.other_config[key] = value
+ node.save()
+ return xen_api_success_void()
+ def host_remove_from_other_config(self, session, host_ref, key):
+ node = XendNode.instance()
+ del node.other_config[key]
+ node.save()
+ return xen_api_success_void()
def host_get_software_version(self, session, host_ref):
return xen_api_success(XendNode.instance().xen_version())
def host_get_resident_VMs(self, session, host_ref):
return xen_api_success(XendDomain.instance().get_domain_refs())
def host_get_host_CPUs(self, session, host_ref):
return xen_api_success(XendNode.instance().get_host_cpu_refs())
+ def host_get_metrics(self, _, ref):
+ return xen_api_success(XendNode.instance().host_metrics_uuid)
# object methods
def host_destroy(self, session, host_ref):
@@ -625,6 +673,7 @@ class XendAPI(object):
if not XendDomain.instance().allow_new_domains():
return xen_api_error(XEND_ERROR_HOST_RUNNING)
return xen_api_error(XEND_ERROR_UNSUPPORTED)
+
def host_get_record(self, session, host_ref):
node = XendNode.instance()
dom = XendDomain.instance()
@@ -633,7 +682,8 @@ class XendAPI(object):
'name_description': '',
'software_version': node.xen_version(),
'resident_VMs': dom.get_domain_refs(),
- 'host_CPUs': node.get_host_cpu_refs()}
+ 'host_CPUs': node.get_host_cpu_refs(),
+ 'metrics': node.host_metrics_uuid}
return xen_api_success(record)
# class methods
@@ -647,20 +697,16 @@ class XendAPI(object):
return xen_api_success([])
- # Xen API: Class Host_CPU
+ # Xen API: Class host_CPU
# ----------------------------------------------------------------
host_cpu_attr_ro = ['host',
'number',
- 'features',
'utilisation']
# attributes
def host_cpu_get_host(self, session, host_cpu_ref):
return xen_api_success(XendNode.instance().uuid)
- def host_cpu_get_features(self, session, host_cpu_ref):
- features = XendNode.instance().get_host_cpu_features(host_cpu_ref)
- return xen_api_success(features)
def host_cpu_get_utilisation(self, session, host_cpu_ref):
util = XendNode.instance().get_host_cpu_load(host_cpu_ref)
return xen_api_success(util)
@@ -676,7 +722,6 @@ class XendAPI(object):
record = {'uuid': host_cpu_ref,
'host': node.uuid,
'number': node.get_host_cpu_number(host_cpu_ref),
- 'features': node.get_host_cpu_features(host_cpu_ref),
'utilisation': node.get_host_cpu_load(host_cpu_ref)}
return xen_api_success(record)
@@ -685,6 +730,44 @@ class XendAPI(object):
return xen_api_success(XendNode.instance().get_host_cpu_refs())
+ # Xen API: Class host_metrics
+ # ----------------------------------------------------------------
+
+ host_metrics_attr_ro = ['memory_total',
+ 'memory_free',
+ 'host']
+ host_metrics_attr_rw = []
+ host_methods = []
+
+ def _host_metrics_get(self, ref, f):
+ return xen_api_success(getattr(node, f)())
+
+ def host_metrics_get_record(self, _, ref):
+ return xen_api_success({
+ 'uuid' : ref,
+ 'host' : XendNode.instance().uuid,
+ 'memory_total' : self._host_metrics_get_memory_total(),
+ 'memory_free' : self._host_metrics_get_memory_free(),
+ })
+
+ def host_metrics_get_host(self, _, ref):
+ return xen_api_success(XendNode.instance().uuid)
+
+ def host_metrics_get_memory_total(self, _, ref):
+ return xen_api_success(self._host_metrics_get_memory_total())
+
+ def host_metrics_get_memory_free(self, _, ref):
+ return xen_api_success(self._host_metrics_get_memory_free())
+
+ def _host_metrics_get_memory_total(self):
+ node = XendNode.instance()
+ return node.xc.physinfo()['total_memory'] * 1024
+
+ def _host_metrics_get_memory_free(self):
+ node = XendNode.instance()
+ return node.xc.physinfo()['free_memory'] * 1024
+
+
# Xen API: Class network
# ----------------------------------------------------------------
@@ -750,9 +833,8 @@ class XendAPI(object):
# Xen API: Class PIF
# ----------------------------------------------------------------
- PIF_attr_ro = ['io_read_kbs',
- 'io_write_kbs']
- PIF_attr_rw = ['name',
+ PIF_attr_ro = ['metrics']
+ PIF_attr_rw = ['device',
'network',
'host',
'MAC',
@@ -766,24 +848,11 @@ class XendAPI(object):
def _get_PIF(self, ref):
return XendNode.instance().pifs[ref]
- def PIF_create(self, _, name, network_uuid, host_uuid, mac, mtu, vlan):
- try:
- node = XendNode.instance()
- if host_uuid != node.uuid:
- return xen_api_error(['HOST_HANDLE_INVALID', host_uuid])
-
- elif _is_valid_ref(network_uuid, node.is_valid_network):
- network = node.get_network(network_uuid)
- return xen_api_success(node.PIF_create(name, mtu, vlan, mac,
- network))
- else:
- return xen_api_error(['NETWORK_HANDLE_INVALID', network_uuid])
- except NetworkAlreadyConnected, exn:
- return xen_api_error(['NETWORK_ALREADY_CONNECTED',
- network_uuid, exn.pif_uuid])
-
def PIF_destroy(self, _, ref):
- return xen_api_success(XendNode.instance().PIF_destroy(ref))
+ try:
+ return xen_api_success(XendNode.instance().PIF_destroy(ref))
+ except PIFIsPhysical, exn:
+ return xen_api_error(['PIF_IS_PHYSICAL', ref])
# object methods
def PIF_get_record(self, _, ref):
@@ -792,8 +861,11 @@ class XendAPI(object):
def PIF_get_all(self, _):
return xen_api_success(XendNode.instance().pifs.keys())
- def PIF_get_name(self, _, ref):
- return xen_api_success(self._get_PIF(ref).name)
+ def PIF_get_metrics(self, _, ref):
+ return xen_api_success(self._get_PIF(ref).metrics.uuid)
+
+ def PIF_get_device(self, _, ref):
+ return xen_api_success(self._get_PIF(ref).device)
def PIF_get_network(self, _, ref):
return xen_api_success(self._get_PIF(ref).network.uuid)
@@ -810,14 +882,8 @@ class XendAPI(object):
def PIF_get_VLAN(self, _, ref):
return xen_api_success(self._get_PIF(ref).vlan)
- def PIF_get_io_read_kbs(self, _, ref):
- return xen_api_success(self._get_PIF(ref).get_io_read_kbs())
-
- def PIF_get_io_write_kbs(self, _, ref):
- return xen_api_success(self._get_PIF(ref).get_io_write_kbs())
-
- def PIF_set_name(self, _, ref, name):
- return xen_api_success(self._get_PIF(ref).set_name(name))
+ def PIF_set_device(self, _, ref, device):
+ return xen_api_success(self._get_PIF(ref).set_device(device))
def PIF_set_MAC(self, _, ref, mac):
return xen_api_success(self._get_PIF(ref).set_mac(mac))
@@ -827,14 +893,48 @@ class XendAPI(object):
def PIF_create_VLAN(self, _, ref, network, vlan):
try:
- if _is_valid_ref(network, XendNode.instance().is_valid_network):
- return xen_api_success(XendNode.instance().PIF_create_VLAN(
- ref, network, vlan))
+ vlan = int(vlan)
+ except:
+ return xen_api_error(['VLAN_TAG_INVALID', vlan])
+
+ try:
+ node = XendNode.instance()
+
+ if _is_valid_ref(network, node.is_valid_network):
+ return xen_api_success(
+ node.PIF_create_VLAN(ref, network, vlan))
else:
return xen_api_error(['NETWORK_HANDLE_INVALID', network])
except NetworkAlreadyConnected, exn:
return xen_api_error(['NETWORK_ALREADY_CONNECTED',
network, exn.pif_uuid])
+ except VLANTagInvalid:
+ return xen_api_error(['VLAN_TAG_INVALID', vlan])
+
+
+ # Xen API: Class PIF_metrics
+ # ----------------------------------------------------------------
+
+ PIF_metrics_attr_ro = ['PIF',
+ 'io_read_kbs',
+ 'io_write_kbs']
+ PIF_metrics_attr_rw = []
+ PIF_methods = []
+
+ def _PIF_metrics_get(self, ref):
+ return XendNode.instance().pif_metrics[ref]
+
+ def PIF_metrics_get_record(self, _, ref):
+ return xen_api_success(self._PIF_metrics_get(ref).get_record())
+
+ def PIF_metrics_get_PIF(self, _, ref):
+ return xen_api_success(self._PIF_metrics_get(ref).pif.uuid)
+
+ def PIF_metrics_get_io_read_kbs(self, _, ref):
+ return xen_api_success(self._PIF_metrics_get(ref).get_io_read_kbs())
+
+ def PIF_metrics_get_io_write_kbs(self, _, ref):
+ return xen_api_success(self._PIF_metrics_get(ref).get_io_write_kbs())
# Xen API: Class VM
@@ -847,14 +947,13 @@ class XendAPI(object):
'memory_static_min',
'VCPUs_number',
'VCPUs_utilisation',
- 'VCPUs_features_required',
- 'VCPUs_can_use',
'consoles',
'VIFs',
'VBDs',
'VTPMs',
'PCI_bus',
'tools_version',
+ 'is_control_domain',
]
VM_attr_rw = ['name_label',
@@ -866,8 +965,6 @@ class XendAPI(object):
'memory_dynamic_min',
'VCPUs_policy',
'VCPUs_params',
- 'VCPUs_features_force_on',
- 'VCPUs_features_force_off',
'actions_after_shutdown',
'actions_after_reboot',
'actions_after_suspend',
@@ -884,7 +981,7 @@ class XendAPI(object):
'platform_clock_offset',
'platform_enable_audio',
'platform_keymap',
- 'otherConfig']
+ 'other_config']
VM_methods = [('clone', 'VM'),
('start', None),
@@ -896,8 +993,8 @@ class XendAPI(object):
('hard_reboot', None),
('suspend', None),
('resume', None),
- ('add_to_otherConfig', None),
- ('remove_from_otherConfig', None)]
+ ('add_to_other_config', None),
+ ('remove_from_other_config', None)]
VM_funcs = [('create', 'VM'),
('get_by_name_label', 'Set(VM)')]
@@ -914,10 +1011,6 @@ class XendAPI(object):
'memory_static_min',
'VCPUs_policy',
'VCPUs_params',
- 'VCPUs_features_required',
- 'VCPUs_features_can_use',
- 'VCPUs_features_force_on',
- 'VCPUs_features_force_off',
'actions_after_shutdown',
'actions_after_reboot',
'actions_after_suspend',
@@ -936,7 +1029,7 @@ class XendAPI(object):
'platform_keymap',
'grub_cmdline',
'PCI_bus',
- 'otherConfig']
+ 'other_config']
def VM_get(self, name, session, vm_ref):
return xen_api_success(
@@ -977,14 +1070,6 @@ class XendAPI(object):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_success(dom.get_vcpus_util())
- def VM_get_VCPUs_features_required(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_todo() # unsupported by xc
-
- def VM_get_VCPUs_can_use(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_todo() # unsupported by xc
-
def VM_get_VIFs(self, session, vm_ref):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_success(dom.get_vifs())
@@ -1042,14 +1127,6 @@ class XendAPI(object):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_todo() # need access to scheduler
- def VM_get_VCPUs_features_force_on(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_todo()
-
- def VM_get_VCPUs_features_force_off(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_todo()
-
def VM_get_actions_after_shutdown(self, session, vm_ref):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_success(dom.get_on_shutdown())
@@ -1108,8 +1185,13 @@ class XendAPI(object):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_success(dom.get_platform_keymap())
- def VM_get_otherConfig(self, session, vm_ref):
- return self.VM_get('otherConfig', session, vm_ref)
+ def VM_get_other_config(self, session, vm_ref):
+ return self.VM_get('otherconfig', session, vm_ref)
+
+ def VM_get_is_control_domain(self, session, vm_ref):
+ xd = XendDomain.instance()
+ return xen_api_success(
+ xd.get_vm_by_uuid(vm_ref) == xd.privilegedDomain())
def VM_set_name_label(self, session, vm_ref, label):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
@@ -1144,14 +1226,6 @@ class XendAPI(object):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_todo()
- def VM_set_VCPUs_features_force_on(self, session, vm_ref, features):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_todo()
-
- def VM_set_VCPUs_features_force_off(self, session, vm_ref, features):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_todo()
-
def VM_set_actions_after_shutdown(self, session, vm_ref, action):
if action not in XEN_API_ON_NORMAL_EXIST:
return xen_api_error(['VM_ON_NORMAL_EXIT_INVALID', vm_ref])
@@ -1208,16 +1282,16 @@ class XendAPI(object):
def VM_set_platform_enable_audio(self, session, vm_ref, value):
return self.VM_set('platform_enable_audio', session, vm_ref, value)
- def VM_set_otherConfig(self, session, vm_ref, value):
+ def VM_set_other_config(self, session, vm_ref, value):
return self.VM_set('otherconfig', session, vm_ref, value)
- def VM_add_to_otherConfig(self, session, vm_ref, key, value):
+ def VM_add_to_other_config(self, session, vm_ref, key, value):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
if dom and 'otherconfig' in dom.info:
dom.info['otherconfig'][key] = value
return xen_api_success_void()
- def VM_remove_from_otherConfig(self, session, vm_ref, key):
+ def VM_remove_from_other_config(self, session, vm_ref, key):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
if dom and 'otherconfig' in dom.info \
and key in dom.info['otherconfig']:
@@ -1267,10 +1341,6 @@ class XendAPI(object):
'VCPUs_params': xeninfo.get_vcpus_params(),
'VCPUs_number': xeninfo.getVCpuCount(),
'VCPUs_utilisation': xeninfo.get_vcpus_util(),
- 'VCPUs_features_required': [],
- 'VCPUs_features_can_use': [],
- 'VCPUs_features_force_on': [],
- 'VCPUs_features_force_off': [],
'actions_after_shutdown': xeninfo.get_on_shutdown(),
'actions_after_reboot': xeninfo.get_on_reboot(),
'actions_after_suspend': xeninfo.get_on_suspend(),
@@ -1293,7 +1363,8 @@ class XendAPI(object):
'platform_keymap': xeninfo.get_platform_keymap(),
'PCI_bus': xeninfo.get_pci_bus(),
'tools_version': xeninfo.get_tools_version(),
- 'otherConfig': xeninfo.info.get('otherconfig'),
+ 'other_config': xeninfo.info.get('otherconfig'),
+ 'is_control_domain': xeninfo == xendom.privilegedDomain(),
}
return xen_api_success(record)
@@ -1352,9 +1423,9 @@ class XendAPI(object):
VBD_attr_rw = ['VM',
'VDI',
'device',
+ 'bootable',
'mode',
- 'type',
- 'driver']
+ 'type']
VBD_attr_inst = VBD_attr_rw
@@ -1419,45 +1490,43 @@ class XendAPI(object):
return xen_api_success_void()
# attributes (rw)
+ def _VBD_get(self, vbd_ref, prop):
+ return xen_api_success(
+ XendDomain.instance().get_dev_property_by_uuid(
+ 'vbd', vbd_ref, prop))
+
def VBD_get_VM(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd',
- vbd_ref, 'VM'))
+ return self._VBD_get(vbd_ref, 'VM')
def VBD_get_VDI(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd',
- vbd_ref, 'VDI'))
-
+ return self._VBD_get(vbd_ref, 'VDI')
+
def VBD_get_device(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
- 'device'))
+ return self._VBD_get(vbd_ref, 'device')
+
+ def VBD_get_bootable(self, session, vbd_ref):
+ return self._VBD_get(vbd_ref, 'bootable')
+
def VBD_get_mode(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
- 'mode'))
- def VBD_get_driver(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
- 'driver'))
+ return self._VBD_get(vbd_ref, 'mode')
def VBD_get_type(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
- 'type'))
+ return self._VBD_get(vbd_ref, 'type')
def VBD_get_io_read_kbs(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
- 'io_read_kbs'))
-
+ return self._VBD_get(vbd_ref, 'io_read_kbs')
def VBD_get_io_write_kbs(self, session, vbd_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vbd', vbd_ref,
- 'io_read_kbs'))
-
+ return self._VBD_get(vbd_ref, 'io_write_kbs')
+
+ def VBD_set_bootable(self, session, vbd_ref, bootable):
+ bootable = bool(bootable)
+ xd = XendDomain.instance()
+ vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref)
+ vm.set_dev_property('vbd', vbd_ref, 'bootable', bootable)
+ xd.managed_config_save(vm)
+ return xen_api_success_void()
+
def VBD_get_all(self, session):
xendom = XendDomain.instance()
vbds = [d.get_vbds() for d in XendDomain.instance().list('all')]
@@ -1469,9 +1538,7 @@ class XendAPI(object):
VIF_attr_ro = ['io_read_kbs',
'io_write_kbs']
- VIF_attr_rw = ['name',
- 'type',
- 'device',
+ VIF_attr_rw = ['device',
'network',
'VM',
'MAC',
@@ -1532,10 +1599,6 @@ class XendAPI(object):
vm = xendom.get_vm_with_dev_uuid('vif', vif_ref)
return xen_api_success(vm.get_uuid())
- def VIF_get_name(self, session, vif_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
- 'name'))
def VIF_get_MTU(self, session, vif_ref):
xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
@@ -1545,17 +1608,10 @@ class XendAPI(object):
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
'MAC'))
- def VIF_get_type(self, session, vif_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
- 'type'))
-
-
def VIF_get_device(self, session, vif_ref):
xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
'device'))
-
def VIF_get_io_read_kbs(self, session, vif_ref):
xendom = XendDomain.instance()
@@ -1579,9 +1635,7 @@ class XendAPI(object):
VDI_attr_ro = ['VBDs',
'physical_utilisation',
'sector_size',
- 'type',
- 'parent',
- 'children']
+ 'type']
VDI_attr_rw = ['name_label',
'name_description',
'SR',
@@ -1610,12 +1664,6 @@ class XendAPI(object):
def VDI_get_type(self, session, vdi_ref):
return xen_api_success(self._get_VDI(vdi_ref).type)
- def VDI_get_parent(self, session, vdi_ref):
- return xen_api_success(self._get_VDI(vdi_ref).parent)
-
- def VDI_get_children(self, session, vdi_ref):
- return xen_api_success(self._get_VDI(vdi_ref).children)
-
def VDI_get_name_label(self, session, vdi_ref):
return xen_api_success(self._get_VDI(vdi_ref).name_label)
@@ -1677,8 +1725,6 @@ class XendAPI(object):
'physical_utilisation': image.physical_utilisation,
'sector_size': image.sector_size,
'type': image.type,
- 'parent': image.parent,
- 'children': image.children,
'sharable': image.sharable,
'read_only': image.read_only,
})
@@ -1708,9 +1754,7 @@ class XendAPI(object):
VTPM_attr_rw = [ ]
VTPM_attr_ro = ['VM',
- 'backend',
- 'instance',
- 'driver']
+ 'backend']
VTPM_attr_inst = VTPM_attr_rw
@@ -1727,41 +1771,14 @@ class XendAPI(object):
return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
valid_vtpm_keys = self.VTPM_attr_ro + self.VTPM_attr_rw + \
self.Base_attr_ro + self.Base_attr_rw
+ return_cfg = {}
for k in cfg.keys():
- if k not in valid_vtpm_keys:
- del cfg[k]
+ if k in valid_vtpm_keys:
+ return_cfg[k] = cfg[k]
- return xen_api_success(cfg)
+ return xen_api_success(return_cfg)
# Class Functions
- def VTPM_get_instance(self, session, vtpm_ref):
- xendom = XendDomain.instance()
- vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
- if not vm:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
- if not cfg:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- if cfg.has_key('instance'):
- instance = cfg['instance']
- else:
- instance = -1
- return xen_api_success(instance)
-
- def VTPM_get_driver(self, session, vtpm_ref):
- xendom = XendDomain.instance()
- vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
- if not vm:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
- if not cfg:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- if cfg.has_key('type'):
- driver = cfg['type']
- else:
- driver = "Unknown"
- return xen_api_success(driver)
-
def VTPM_get_backend(self, session, vtpm_ref):
xendom = XendDomain.instance()
vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
@@ -1770,11 +1787,9 @@ class XendAPI(object):
cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
if not cfg:
return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- if cfg.has_key('backend'):
- backend = cfg['backend']
- else:
- backend = "Domain-0"
- return xen_api_success(backend)
+ if not cfg.has_key('backend'):
+ return xen_api_error(['VTPM backend not set'])
+ return xen_api_success(cfg['backend'])
def VTPM_get_VM(self, session, vtpm_ref):
xendom = XendDomain.instance()
@@ -1783,12 +1798,18 @@ class XendAPI(object):
def VTPM_destroy(self, session, vtpm_ref):
xendom = XendDomain.instance()
- vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
- if not vm:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
-
- vm.destroy_vtpm(vtpm_ref)
- return xen_api_success_void()
+ dom = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
+ if dom:
+ if dom.state != XEN_API_VM_POWER_STATE_HALTED:
+ vm_ref = dom.get_dev_property('vtpm', vtpm_ref, 'VM')
+ return xen_api_error(['VM_BAD_POWER_STATE', vm_ref,
+ XendDomain.POWER_STATE_NAMES[XEN_API_VM_POWER_STATE_HALTED],
+ XendDomain.POWER_STATE_NAMES[dom.state]])
+ from xen.xend.server import tpmif
+ tpmif.destroy_vtpmstate(dom.getName())
+ return xen_api_success(True)
+ else:
+ return xen_api_error(['VM_HANDLE_INVALID', vtpm_struct['VM']])
# class methods
def VTPM_create(self, session, vtpm_struct):
@@ -1814,8 +1835,9 @@ class XendAPI(object):
# ----------------------------------------------------------------
- console_attr_ro = ['uri', 'protocol', 'VM']
- console_attr_rw = []
+ console_attr_ro = ['location', 'protocol', 'VM']
+ console_attr_rw = ['other_config']
+ console_funcs = [('create', 'console')]
def console_get_all(self, session):
xendom = XendDomain.instance()
@@ -1823,10 +1845,10 @@ class XendAPI(object):
cons = reduce(lambda x, y: x + y, cons)
return xen_api_success(cons)
- def console_get_uri(self, session, console_ref):
+ def console_get_location(self, session, console_ref):
return xen_api_success(xendom.get_dev_property_by_uuid('console',
console_ref,
- 'uri'))
+ 'location'))
def console_get_protocol(self, session, console_ref):
return xen_api_success(xendom.get_dev_property_by_uuid('console',
@@ -1858,6 +1880,22 @@ class XendAPI(object):
return xen_api_success(return_cfg)
+ def console_create(self, session, console_struct):
+ xendom = XendDomain.instance()
+ if not xendom.is_valid_vm(console_struct['VM']):
+ return xen_api_error(['VM_HANDLE_INVALID', console_struct['VM']])
+
+ dom = xendom.get_vm_by_uuid(console_struct['VM'])
+ try:
+ if 'protocol' not in console_struct:
+ return xen_api_error(['CONSOLE_PROTOCOL_INVALID',
+ 'No protocol specified'])
+
+ console_ref = dom.create_console(console_struct)
+ xendom.managed_config_save(dom)
+ return xen_api_success(console_ref)
+ except XendError, e:
+ return xen_api_error([XEND_ERROR_TODO, str(e)])
# Xen API: Class SR
# ----------------------------------------------------------------
@@ -2022,19 +2060,22 @@ class XendAPIAsyncProxy:
# Only deal with method names that start with "Async."
if not method.startswith(self.method_prefix):
- raise Exception('Method %s not supported' % method)
-
- # Require 'session' argument to be present.
- if len(args) < 1:
- raise Exception('Not enough arguments')
+ return xen_api_error(['MESSAGE_METHOD_UNKNOWN', method])
# Lookup synchronous version of the method
synchronous_method_name = method[len(self.method_prefix):]
if synchronous_method_name not in self.method_map:
- raise Exception('Method %s not supported' % method)
+ return xen_api_error(['MESSAGE_METHOD_UNKNOWN', method])
method = self.method_map[synchronous_method_name]
+ # Check that we've got enough arguments before issuing a task ID.
+ needed = argcounts[method.api]
+ if len(args) != needed:
+ return xen_api_error(['MESSAGE_PARAMETER_COUNT_MISMATCH',
+ self.method_prefix + method.api, needed,
+ len(args)])
+
# Validate the session before proceeding
session = args[0]
if not auth_manager().is_session_valid(session):
@@ -2045,7 +2086,8 @@ class XendAPIAsyncProxy:
task_uuid = XendTaskManager.create_task(method, args,
synchronous_method_name,
return_type,
- synchronous_method_name)
+ synchronous_method_name,
+ session)
return xen_api_success(task_uuid)
#
diff --git a/tools/python/xen/xend/XendAPIConstants.py b/tools/python/xen/xend/XendAPIConstants.py
index 47b6b08fee..9805cf02a7 100644
--- a/tools/python/xen/xend/XendAPIConstants.py
+++ b/tools/python/xen/xend/XendAPIConstants.py
@@ -35,20 +35,6 @@ XEN_API_VM_POWER_STATE_SUSPENDED = 3
XEN_API_VM_POWER_STATE_SHUTTINGDOWN = 4
XEN_API_VM_POWER_STATE_UNKNOWN = 5
-XEN_API_CPU_FEATURE = [
- 'FPU', 'VME', 'DE', 'PSE', 'TSC', 'MSR', 'PAE'
- 'MCE', 'CX8', 'APIC', 'SEP', 'MTRR', 'PGE', 'MCA',
- 'CMOV', 'PAT', 'PSE36', 'PN', 'CLFLSH', 'DTES',
- 'ACPI', 'MMX', 'FXCR', 'XMM', 'XMM2', 'SELFSNOOP',
- 'HT', 'ACC', 'IA64', 'SYSCALL', 'MP', 'NX', 'MMXEXT',
- 'LM', 'THREEDNOWEXT', 'THREEDNOW', 'RECOVERY', 'LONGRUN',
- 'LRTI', 'CXMMX', 'K6_MTRR', 'CYRIX_ARR', 'CENTAUR_MCR',
- 'K8', 'K7', 'P3', 'P4', 'CONSTANT_TSC', 'FXSAVE_LEAK',
- 'XMM3', 'MWAIT', 'DSCPL', 'EST', 'TM2', 'CID', 'CX16',
- 'XTPR', 'XSTORE', 'XSTORE_EN', 'XCRYPT', 'XCRYPT_EN',
- 'LAHF_LM', 'CMP_LEGACY'
-]
-
XEN_API_ON_NORMAL_EXIT = [
'destroy',
'restart',
diff --git a/tools/python/xen/xend/XendAuthSessions.py b/tools/python/xen/xend/XendAuthSessions.py
index 5c9a4e9a2f..769c66f3fa 100644
--- a/tools/python/xen/xend/XendAuthSessions.py
+++ b/tools/python/xen/xend/XendAuthSessions.py
@@ -21,11 +21,6 @@ from xen.xend import uuid
from xen.xend.XendError import *
from xen.xend.XendLogging import log
-try:
- import PAM
-except ImportError:
- log.warn("python-pam is required for XenAPI support.")
-
class XendAuthSessions:
"""Keeps track of Xen API Login Sessions using PAM.
@@ -80,7 +75,11 @@ class XendAuthSessions:
"""
pam_auth = None
try:
+ import PAM
pam_auth = PAM.pam()
+ except ImportError:
+ log.warn("python-pam is required for XenAPI support.")
+ return False
except NameError:
# if PAM doesn't exist, let's ignore it
return False
diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py
index 62b462f577..f17a5a2295 100644
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -126,6 +126,7 @@ XENAPI_HVM_CFG = {
'platform_serial' : 'serial',
'platform_localtime': 'localtime',
'platform_keymap' : 'keymap',
+ 'HVM_boot': 'boot',
}
# List of XendConfig configuration keys that have no direct equivalent
@@ -250,7 +251,8 @@ LEGACY_IMAGE_CFG = [
('sdl', int),
('vncdisplay', int),
('vncunused', int),
- ('vncpasswd', str),
+ ('vncpasswd', str),
+ ('vnclisten', str),
]
LEGACY_IMAGE_HVM_CFG = [
@@ -379,6 +381,7 @@ class XendConfig(dict):
'vif_refs': [],
'vbd_refs': [],
'vtpm_refs': [],
+ 'other_config': {},
}
defaults['name_label'] = 'Domain-' + defaults['uuid']
@@ -660,6 +663,25 @@ class XendConfig(dict):
self['vbd_refs'] = cfg.get('vbd_refs', [])
self['vtpm_refs'] = cfg.get('vtpm_refs', [])
+ # coalesce hvm vnc frame buffer with vfb config
+ if self['image']['type'] == 'hvm' and self['image'].get('vnc', 0):
+ # add vfb device if it isn't there already
+ has_rfb = False
+ for console_uuid in self['console_refs']:
+ if self['devices'][console_uuid][1].get('protocol') == 'rfb':
+ has_rfb = True
+ break
+
+ if not has_rfb:
+ dev_config = ['vfb']
+ # copy VNC related params from image config to vfb dev conf
+ for key in ['vncpasswd', 'vncunused', 'vncdisplay',
+ 'vnclisten']:
+ if key in self['image']:
+ dev_config.append([key, self['image'][key]])
+
+ self.device_add('vfb', cfg_sxp = dev_config)
+
def _sxp_to_xapi_unsupported(self, sxp_cfg):
"""Read in an SXP configuration object and populate
@@ -756,7 +778,7 @@ class XendConfig(dict):
# currently unsupported options
self['image']['hvm']['device_model'] = LEGACY_DM
- self['image']['vnc'] = 1
+ self['image']['vnc'] = 0
self['image']['hvm']['pae'] = 1
if self['platform_enable_audio']:
@@ -878,6 +900,14 @@ class XendConfig(dict):
controller = domain.getDeviceController(cls)
configs = controller.configurations()
for config in configs:
+ if sxp.name(config) in ('vbd', 'tap'):
+ # The bootable flag is never written to the
+ # store as part of the device config.
+ dev_uuid = sxp.child_value(config, 'uuid')
+ dev_type, dev_cfg = self['devices'][dev_uuid]
+ is_bootable = dev_cfg.get('bootable', False)
+ config.append(['bootable', int(is_bootable)])
+
sxpr.append(['device', config])
found = True
@@ -948,6 +978,7 @@ class XendConfig(dict):
pass
if dev_type == 'vbd':
+ dev_info['bootable'] = False
if dev_info.get('dev', '').startswith('ioemu:'):
dev_info['driver'] = 'ioemu'
else:
@@ -964,13 +995,43 @@ class XendConfig(dict):
if param not in target:
target[param] = []
if dev_uuid not in target[param]:
+ if dev_type == 'vbd' and not target[param]:
+ # Compat hack -- this is the first disk, so mark it
+ # bootable.
+ dev_info['bootable'] = True
target[param].append(dev_uuid)
- elif dev_type in ('tap',):
+ elif dev_type == 'tap':
if 'vbd_refs' not in target:
target['vbd_refs'] = []
if dev_uuid not in target['vbd_refs']:
+ if not target['vbd_refs']:
+ # Compat hack -- this is the first disk, so mark it
+ # bootable.
+ dev_info['bootable'] = True
target['vbd_refs'].append(dev_uuid)
- elif dev_type in ('console',):
+
+ elif dev_type == 'vfb':
+ # Populate other config with aux data that is associated
+ # with vfb
+
+ other_config = {}
+ for key in ['vncunused', 'vncdisplay', 'vnclisten',
+ 'vncpasswd', 'type', 'display', 'xauthority',
+ 'keymap']:
+ if key in dev_info:
+ other_config[key] = dev_info[key]
+ target['devices'][dev_uuid][1]['other_config'] = other_config
+
+
+ if 'console_refs' not in target:
+ target['console_refs'] = []
+
+ # Treat VFB devices as console devices so they are found
+ # through Xen API
+ if dev_uuid not in target['console_refs']:
+ target['console_refs'].append(dev_uuid)
+
+ elif dev_type == 'console':
if 'console_refs' not in target:
target['console_refs'] = []
if dev_uuid not in target['console_refs']:
@@ -1009,6 +1070,7 @@ class XendConfig(dict):
dev_info['uname'] = cfg_xenapi.get('image', '')
dev_info['dev'] = '%s:%s' % (cfg_xenapi.get('device'),
old_vbd_type)
+ dev_info['bootable'] = cfg_xenapi.get('bootable', False)
dev_info['driver'] = cfg_xenapi.get('driver')
dev_info['VDI'] = cfg_xenapi.get('VDI', '')
@@ -1031,50 +1093,117 @@ class XendConfig(dict):
target['devices'][dev_uuid] = (dev_type, dev_info)
target['vtpm_refs'].append(dev_uuid)
+ elif dev_type == 'console':
+ dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
+ dev_info['uuid'] = dev_uuid
+ dev_info['protocol'] = cfg_xenapi.get('protocol', 'rfb')
+ dev_info['other_config'] = cfg_xenapi.get('other_config', {})
+ if dev_info['protocol'] == 'rfb':
+ # collapse other config into devinfo for things
+ # such as vncpasswd, vncunused, etc.
+ dev_info.update(cfg_xenapi.get('other_config', {}))
+ dev_info['type'] = 'vnc'
+ target['devices'][dev_uuid] = ('vfb', dev_info)
+ target['console_refs'].append(dev_uuid)
+
+ # Finally, if we are a pvfb, we need to make a vkbd
+ # as well that is not really exposed to Xen API
+ vkbd_uuid = uuid.createString()
+ target['devices'][vkbd_uuid] = ('vkbd', {})
+
+ elif dev_info['protocol'] == 'vt100':
+ # if someone tries to create a VT100 console
+ # via the Xen API, we'll have to ignore it
+ # because we create one automatically in
+ # XendDomainInfo._update_consoles
+ raise XendConfigError('Creating vt100 consoles via '
+ 'Xen API is unsupported')
+
return dev_uuid
# no valid device to add
return ''
- def console_add(self, protocol, uri):
+ def console_add(self, protocol, location, other_config = {}):
dev_uuid = uuid.createString()
- dev_info = {
- 'uuid': dev_uuid,
- 'protocol': protocol,
- 'uri': uri
- }
- if 'devices' not in self:
- self['devices'] = {}
+ if protocol == 'vt100':
+ dev_info = {
+ 'uuid': dev_uuid,
+ 'protocol': protocol,
+ 'location': location,
+ 'other_config': other_config,
+ }
+
+ if 'devices' not in self:
+ self['devices'] = {}
- self['devices'][dev_uuid] = ('console', dev_info)
- self['console_refs'].append(dev_uuid)
- return dev_info
+ self['devices'][dev_uuid] = ('console', dev_info)
+ self['console_refs'].append(dev_uuid)
+ return dev_info
+
+ return {}
+
+ def console_update(self, console_uuid, key, value):
+ for dev_uuid, (dev_type, dev_info) in self['devices'].items():
+ if dev_uuid == console_uuid:
+ dev_info[key] = value
+ break
def console_get_all(self, protocol):
- consoles = [dinfo for dtype, dinfo in self['devices'].values()
- if dtype == 'console']
- return [c for c in consoles if c.get('protocol') == protocol]
+ if protocol == 'vt100':
+ consoles = [dinfo for dtype, dinfo in self['devices'].values()
+ if dtype == 'console']
+ return [c for c in consoles if c.get('protocol') == protocol]
+
+ elif protocol == 'rfb':
+ vfbs = [dinfo for dtype, dinfo in self['devices'].values()
+ if dtype == 'vfb']
+
+ # move all non-console key values to other_config before
+ # returning console config
+ valid_keys = ['uuid', 'location']
+ for vfb in vfbs:
+ other_config = {}
+ for key, val in vfb.items():
+ if key not in valid_keys:
+ other_config[key] = vfb[key]
+ del vfb[key]
+ vfb['other_config'] = other_config
+ vfb['protocol'] = 'rfb'
+
+ return vfbs
+
+ else:
+ return []
- def device_update(self, dev_uuid, cfg_sxp):
+ def device_update(self, dev_uuid, cfg_sxp = [], cfg_xenapi = {}):
"""Update an existing device with the new configuration.
@rtype: boolean
@return: Returns True if succesfully found and updated a device conf
"""
- if dev_uuid in self['devices']:
+ if dev_uuid in self['devices'] and cfg_sxp:
if sxp.child0(cfg_sxp) == 'device':
config = sxp.child0(cfg_sxp)
else:
config = cfg_sxp
-
+
+ dev_type, dev_info = self['devices'][dev_uuid]
for opt_val in config[1:]:
try:
opt, val = opt_val
- self['devices'][dev_uuid][opt] = val
+ dev_info[opt] = val
except (TypeError, ValueError):
pass # no value for this config option
-
+
+ self['devices'][dev_uuid] = (dev_type, dev_info)
return True
+
+ elif dev_uuid in self['devices'] and cfg_xenapi:
+ dev_type, dev_info = self['devices'][dev_uuid]
+ for key, val in cfg_xenapi.items():
+ dev_info[key] = val
+ self['devices'][dev_uuid] = (dev_type, dev_info)
return False
diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py
index d8a23197da..303a615ad8 100644
--- a/tools/python/xen/xend/XendDomain.py
+++ b/tools/python/xen/xend/XendDomain.py
@@ -32,7 +32,7 @@ import threading
import xen.lowlevel.xc
-from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo
+from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo, XendNode
from xen.xend.PrettyPrint import prettyprint
from xen.xend.XendConfig import XendConfig
from xen.xend.XendError import XendError, XendInvalidDomain, VmError
@@ -868,9 +868,10 @@ class XendDomain:
self._refresh()
dominfo = XendDomainInfo.create(config)
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
+ if XendNode.instance().xenschedinfo() == 'credit':
+ self.domain_sched_credit_set(dominfo.getDomid(),
+ dominfo.getWeight(),
+ dominfo.getCap())
return dominfo
finally:
self.domains_lock.release()
@@ -887,9 +888,10 @@ class XendDomain:
self._refresh()
dominfo = XendDomainInfo.create_from_dict(config_dict)
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
+ if XendNode.instance().xenschedinfo() == 'credit':
+ self.domain_sched_credit_set(dominfo.getDomid(),
+ dominfo.getWeight(),
+ dominfo.getCap())
return dominfo
finally:
self.domains_lock.release()
@@ -943,9 +945,10 @@ class XendDomain:
POWER_STATE_NAMES[dominfo.state])
dominfo.start(is_managed = True)
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
+ if XendNode.instance().xenschedinfo() == 'credit':
+ self.domain_sched_credit_set(dominfo.getDomid(),
+ dominfo.getWeight(),
+ dominfo.getCap())
finally:
self.domains_lock.release()
dominfo.waitForDevices()
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index a0c6c6ffa7..d657d4a1f1 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -695,16 +695,29 @@ class XendDomainInfo:
if not serial_consoles:
cfg = self.info.console_add('vt100', self.console_port)
self._createDevice('console', cfg)
+ else:
+ console_uuid = serial_consoles[0].get('uuid')
+ self.info.console_update(console_uuid, 'location',
+ self.console_port)
+
- # Update VNC port if it exists
+ # Update VNC port if it exists and write to xenstore
vnc_port = self.readDom('console/vnc-port')
if vnc_port is not None:
- vnc_consoles = self.info.console_get_all('rfb')
- if not vnc_consoles:
- cfg = self.info.console_add('rfb', 'localhost:%s' %
- str(vnc_port))
- self._createDevice('console', cfg)
+ for dev_uuid, (dev_type, dev_info) in self.info['devices'].items():
+ if dev_type == 'vfb':
+ old_location = dev_info.get('location')
+ listen_host = dev_info.get('vnclisten', 'localhost')
+ new_location = '%s:%s' % (listen_host, str(vnc_port))
+ if old_location == new_location:
+ break
+ dev_info['location'] = new_location
+ self.info.device_update(dev_uuid, cfg_xenapi = dev_info)
+ vfb_ctrl = self.getDeviceController('vfb')
+ vfb_ctrl.reconfigureDevice(0, dev_info)
+ break
+
#
# Function to update xenstore /vm/*
#
@@ -1653,48 +1666,47 @@ class XendDomainInfo:
blexec = osdep.pygrub_path
blcfg = None
- for (devtype, devinfo) in self.info.all_devices_sxpr():
- if not devtype or not devinfo or devtype not in ('vbd', 'tap'):
- continue
- disk = None
- for param in devinfo:
- if param[0] == 'uname':
- disk = param[1]
- break
+ disks = [x for x in self.info['vbd_refs']
+ if self.info['devices'][x][1]['bootable']]
- if disk is None:
- continue
- fn = blkdev_uname_to_file(disk)
- mounted = devtype == 'tap' and not os.stat(fn).st_rdev
- if mounted:
- # This is a file, not a device. pygrub can cope with a
- # file if it's raw, but if it's QCOW or other such formats
- # used through blktap, then we need to mount it first.
+ if not disks:
+ msg = "Had a bootloader specified, but no disks are bootable"
+ log.error(msg)
+ raise VmError(msg)
- log.info("Mounting %s on %s." %
- (fn, BOOTLOADER_LOOPBACK_DEVICE))
+ devinfo = self.info['devices'][disks[0]]
+ devtype = devinfo[0]
+ disk = devinfo[1]['uname']
- vbd = {
- 'mode': 'RO',
- 'device': BOOTLOADER_LOOPBACK_DEVICE,
- }
+ fn = blkdev_uname_to_file(disk)
+ mounted = devtype == 'tap' and not os.stat(fn).st_rdev
+ if mounted:
+ # This is a file, not a device. pygrub can cope with a
+ # file if it's raw, but if it's QCOW or other such formats
+ # used through blktap, then we need to mount it first.
- from xen.xend import XendDomain
- dom0 = XendDomain.instance().privilegedDomain()
- dom0._waitForDeviceUUID(dom0.create_vbd(vbd, fn))
- fn = BOOTLOADER_LOOPBACK_DEVICE
+ log.info("Mounting %s on %s." %
+ (fn, BOOTLOADER_LOOPBACK_DEVICE))
- try:
- blcfg = bootloader(blexec, fn, self, False,
- bootloader_args, kernel, ramdisk, args)
- finally:
- if mounted:
- log.info("Unmounting %s from %s." %
- (fn, BOOTLOADER_LOOPBACK_DEVICE))
+ vbd = {
+ 'mode': 'RO',
+ 'device': BOOTLOADER_LOOPBACK_DEVICE,
+ }
- dom0.destroyDevice('tap', '/dev/xvdp')
+ from xen.xend import XendDomain
+ dom0 = XendDomain.instance().privilegedDomain()
+ dom0._waitForDeviceUUID(dom0.create_vbd(vbd, fn))
+ fn = BOOTLOADER_LOOPBACK_DEVICE
- break
+ try:
+ blcfg = bootloader(blexec, fn, self, False,
+ bootloader_args, kernel, ramdisk, args)
+ finally:
+ if mounted:
+ log.info("Unmounting %s from %s." %
+ (fn, BOOTLOADER_LOOPBACK_DEVICE))
+
+ dom0.destroyDevice('tap', '/dev/xvdp')
if blcfg is None:
msg = "Had a bootloader specified, but can't find disk"
@@ -2018,21 +2030,18 @@ class XendDomainInfo:
@rtype: dictionary
"""
- dev_type_config = self.info['devices'].get(dev_uuid)
+ dev_type, dev_config = self.info['devices'].get(dev_uuid, (None, None))
# shortcut if the domain isn't started because
# the devcontrollers will have no better information
# than XendConfig.
if self.state in (XEN_API_VM_POWER_STATE_HALTED,):
- if dev_type_config:
- return copy.deepcopy(dev_type_config[1])
+ if dev_config:
+ return copy.deepcopy(dev_config)
return None
# instead of using dev_class, we use the dev_type
# that is from XendConfig.
- # This will accomdate 'tap' as well as 'vbd'
- dev_type = dev_type_config[0]
-
controller = self.getDeviceController(dev_type)
if not controller:
return None
@@ -2041,14 +2050,14 @@ class XendDomainInfo:
if not all_configs:
return None
- dev_config = copy.deepcopy(dev_type_config[1])
+ updated_dev_config = copy.deepcopy(dev_config)
for _devid, _devcfg in all_configs.items():
if _devcfg.get('uuid') == dev_uuid:
- dev_config.update(_devcfg)
- dev_config['id'] = _devid
- return dev_config
+ updated_dev_config.update(_devcfg)
+ updated_dev_config['id'] = _devid
+ return updated_dev_config
- return dev_config
+ return updated_dev_config
def get_dev_xenapi_config(self, dev_class, dev_uuid):
config = self.get_dev_config_by_uuid(dev_class, dev_uuid)
@@ -2126,7 +2135,10 @@ class XendDomainInfo:
config['mode'] = 'RW'
if dev_class == 'vtpm':
- config['driver'] = 'paravirtualised' # TODO
+ if not config.has_key('type'):
+ config['type'] = 'paravirtualised' # TODO
+ if not config.has_key('backend'):
+ config['backend'] = "00000000-0000-0000-0000-000000000000"
return config
@@ -2137,6 +2149,9 @@ class XendDomainInfo:
except KeyError:
raise XendError('Invalid property for device: %s' % field)
+ def set_dev_property(self, dev_class, dev_uuid, field, value):
+ self.info['devices'][dev_uuid][1][field] = value
+
def get_vcpus_util(self):
vcpu_util = {}
xennode = XendNode.instance()
@@ -2225,6 +2240,21 @@ class XendDomainInfo:
return dev_uuid
+ def create_console(self, xenapi_console):
+ """ Create a console device from a Xen API struct.
+
+ @return: uuid of device
+ @rtype: string
+ """
+ if self.state not in (DOM_STATE_HALTED,):
+ raise VmError("Can only add console to a halted domain.")
+
+ dev_uuid = self.info.device_add('console', cfg_xenapi = xenapi_console)
+ if not dev_uuid:
+ raise XendError('Failed to create device')
+
+ return dev_uuid
+
def destroy_device_by_uuid(self, dev_type, dev_uuid):
if dev_uuid not in self.info['devices']:
raise XendError('Device does not exist')
diff --git a/tools/python/xen/xend/XendError.py b/tools/python/xen/xend/XendError.py
index 439133d9a0..f1507c43dc 100644
--- a/tools/python/xen/xend/XendError.py
+++ b/tools/python/xen/xend/XendError.py
@@ -43,6 +43,14 @@ class NetworkAlreadyConnected(XendError):
XendError.__init__(self, 'Network already connected')
self.pif_uuid = pif_uuid
+class PIFIsPhysical(XendError):
+ def __init__(self):
+ XendError.__init__(self, 'PIF is physical')
+
+class VLANTagInvalid(XendError):
+ def __init__(self):
+ XendError.__init__(self, 'VLAN tag invalid')
+
class VmError(XendError):
"""Vm construction error."""
pass
diff --git a/tools/python/xen/xend/XendNode.py b/tools/python/xen/xend/XendNode.py
index 713dc081d4..294959752b 100644
--- a/tools/python/xen/xend/XendNode.py
+++ b/tools/python/xen/xend/XendNode.py
@@ -13,7 +13,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#============================================================================
# Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
-# Copyright (c) 2006 Xensource Inc.
+# Copyright (c) 2006, 2007 Xensource Inc.
#============================================================================
import os
@@ -23,12 +23,13 @@ import xen.lowlevel.xc
from xen.util import Brctl
from xen.xend import uuid
-from xen.xend.XendError import XendError, NetworkAlreadyConnected
+from xen.xend.XendError import *
from xen.xend.XendOptions import instance as xendoptions
from xen.xend.XendQCoWStorageRepo import XendQCoWStorageRepo
from xen.xend.XendLocalStorageRepo import XendLocalStorageRepo
from xen.xend.XendLogging import log
from xen.xend.XendPIF import *
+from xen.xend.XendPIFMetrics import XendPIFMetrics
from xen.xend.XendNetwork import *
from xen.xend.XendStateStore import XendStateStore
from xen.xend.XendMonitor import XendMonitor
@@ -39,10 +40,12 @@ class XendNode:
def __init__(self):
"""Initalises the state of all host specific objects such as
- * Host
- * Host_CPU
+ * host
+ * host_CPU
+ * host_metrics
* PIF
- * Network
+ * PIF_metrics
+ * network
* Storage Repository
"""
@@ -58,12 +61,20 @@ class XendNode:
host = saved_host[self.uuid]
self.name = host.get('name_label', socket.gethostname())
self.desc = host.get('name_description', '')
+ self.host_metrics_uuid = host.get('metrics_uuid',
+ uuid.createString())
+ try:
+ self.other_config = eval(host['other_config'])
+ except:
+ self.other_config = {}
self.cpus = {}
else:
self.uuid = uuid.createString()
self.name = socket.gethostname()
self.desc = ''
+ self.other_config = {}
self.cpus = {}
+ self.host_metrics_uuid = uuid.createString()
# load CPU UUIDs
saved_cpus = self.state_store.load_state('cpu')
@@ -88,6 +99,7 @@ class XendNode:
self.cpus[cpu_uuid] = cpu_info
self.pifs = {}
+ self.pif_metrics = {}
self.networks = {}
self.srs = {}
@@ -111,8 +123,22 @@ class XendNode:
if pif.get('network') in self.networks:
network = self.networks[pif['network']]
try:
- self.PIF_create(pif['name'], pif['MTU'], pif['VLAN'],
- pif['MAC'], network, False, pif_uuid)
+ if 'device' not in pif and 'name' in pif:
+ # Compatibility hack, can go pretty soon.
+ pif['device'] = pif['name']
+ if 'metrics' not in pif:
+ # Compatibility hack, can go pretty soon.
+ pif['metrics'] = uuid.createString()
+
+ try:
+ pif['VLAN'] = int(pif.get('VLAN', -1))
+ except (ValueError, TypeError):
+ pif['VLAN'] = -1
+
+ self._PIF_create(pif['device'], pif['MTU'],
+ pif['VLAN'],
+ pif['MAC'], network, False, pif_uuid,
+ pif['metrics'])
except NetworkAlreadyConnected, exn:
log.error('Cannot load saved PIF %s, as network %s ' +
'is already connected to PIF %s',
@@ -120,7 +146,7 @@ class XendNode:
else:
for name, mtu, mac in linux_get_phy_ifaces():
network = self.networks.values()[0]
- self.PIF_create(name, mtu, '', mac, network, False)
+ self._PIF_create(name, mtu, -1, mac, network, False)
# initialise storage
saved_srs = self.state_store.load_state('sr')
@@ -161,16 +187,24 @@ class XendNode:
self.save_networks()
- def PIF_create(self, name, mtu, vlan, mac, network, persist = True,
- pif_uuid = None):
+ def _PIF_create(self, name, mtu, vlan, mac, network, persist = True,
+ pif_uuid = None, metrics_uuid = None):
for pif in self.pifs.values():
if pif.network == network:
raise NetworkAlreadyConnected(pif.uuid)
if pif_uuid is None:
pif_uuid = uuid.createString()
- self.pifs[pif_uuid] = XendPIF(pif_uuid, name, mtu, vlan, mac, network,
- self)
+ if metrics_uuid is None:
+ metrics_uuid = uuid.createString()
+
+ metrics = XendPIFMetrics(metrics_uuid)
+ pif = XendPIF(pif_uuid, metrics, name, mtu, vlan, mac, network, self)
+ metrics.set_PIF(pif)
+
+ self.pif_metrics[metrics_uuid] = metrics
+ self.pifs[pif_uuid] = pif
+
if persist:
self.save_PIFs()
self.refreshBridges()
@@ -178,12 +212,20 @@ class XendNode:
def PIF_create_VLAN(self, pif_uuid, network_uuid, vlan):
+ if vlan < 0 or vlan >= 4096:
+ raise VLANTagInvalid()
+
pif = self.pifs[pif_uuid]
network = self.networks[network_uuid]
- return self.PIF_create(pif.name, pif.mtu, vlan, pif.mac, network)
+ return self._PIF_create(pif.device, pif.mtu, vlan, pif.mac, network)
def PIF_destroy(self, pif_uuid):
+ pif = self.pifs[pif_uuid]
+
+ if pif.vlan == -1:
+ raise PIFIsPhysical()
+
del self.pifs[pif_uuid]
self.save_PIFs()
@@ -191,7 +233,9 @@ class XendNode:
def save(self):
# save state
host_record = {self.uuid: {'name_label':self.name,
- 'name_description':self.desc}}
+ 'name_description':self.desc,
+ 'metrics_uuid': self.host_metrics_uuid,
+ 'other_config': repr(self.other_config)}}
self.state_store.save_state('host',host_record)
self.state_store.save_state('cpu', self.cpus)
self.save_PIFs()
@@ -199,7 +243,7 @@ class XendNode:
self.save_SRs()
def save_PIFs(self):
- pif_records = dict([(k, v.get_record(transient = False))
+ pif_records = dict([(k, v.get_record())
for k, v in self.pifs.items()])
self.state_store.save_state('pif', pif_records)
@@ -482,12 +526,6 @@ class XendNode:
return vbd_loads[domid].get(vbdid, (0.0, 0.0))
return (0.0, 0.0)
- def get_pif_util(self, pifname):
- pifs_util = self.monitor.get_pifs_util()
- if pifname in pifs_util:
- return pifs_util[pifname]
- return (0.0, 0.0)
-
# dictionary version of *info() functions to get rid of
# SXPisms.
def nodeinfo_dict(self):
diff --git a/tools/python/xen/xend/XendPIF.py b/tools/python/xen/xend/XendPIF.py
index 057d1335ec..efb65989e9 100644
--- a/tools/python/xen/xend/XendPIF.py
+++ b/tools/python/xen/xend/XendPIF.py
@@ -90,18 +90,20 @@ def linux_set_mtu(iface, mtu):
class XendPIF:
"""Representation of a Physical Network Interface."""
- def __init__(self, uuid, name, mtu, vlan, mac, network, host):
+ def __init__(self, uuid, metrics, device, mtu, vlan, mac, network,
+ host):
self.uuid = uuid
- self.name = name
+ self.metrics = metrics
+ self.device = device
self.mac = mac
self.mtu = mtu
self.vlan = vlan
self.network = network
self.host = host
- def set_name(self, new_name):
- self.name = new_name
-
+ def set_device(self, new_device):
+ self.device = new_device
+
def set_mac(self, new_mac):
success = linux_set_mac(new_mac)
if success:
@@ -114,26 +116,15 @@ class XendPIF:
self.mtu = new_mtu
return success
- def get_io_read_kbs(self):
- from xen.xend.XendNode import instance as xennode
- return xennode().get_pif_util(self.name)[0]
-
- def get_io_write_kbs(self):
- from xen.xend.XendNode import instance as xennode
- return xennode().get_pif_util(self.name)[1]
-
- def get_record(self, transient = True):
- result = {'name': self.name,
- 'MAC': self.mac,
- 'MTU': self.mtu,
- 'VLAN': self.vlan,
- 'host': self.host.uuid,
- 'network': self.network.uuid}
- if transient:
- result['io_read_kbs'] = self.get_io_read_kbs()
- result['io_write_kbs'] = self.get_io_write_kbs()
- return result
-
+ def get_record(self):
+ return {'uuid': self.uuid,
+ 'device': self.device,
+ 'MAC': self.mac,
+ 'MTU': self.mtu,
+ 'VLAN': self.vlan,
+ 'host': self.host.uuid,
+ 'network': self.network.uuid,
+ 'metrics': self.metrics.uuid}
def refresh(self, bridges):
ifname = self.interface_name()
@@ -143,13 +134,14 @@ class XendPIF:
# there's nothing we can do -- this should have been set up with
# the network script. Otherwise, we can use vconfig to derive
# a subinterface.
- if not self.vlan:
+ if self.vlan == -1:
return
- rc, _ = _cmd('vconfig add %s %s', self.name, self.vlan)
+ rc, _ = _cmd('vconfig add %s %d', self.device, self.vlan)
if rc != 0:
- log.error('Could not refresh %s', ifname)
+ log.error('Could not refresh VLAN for interface %s', ifname)
return
+
log.info('Created network interface %s', ifname)
for brname, nics in bridges.items():
@@ -175,10 +167,10 @@ class XendPIF:
def interface_name(self):
- if self.vlan:
- return '%s.%s' % (self.name, self.vlan)
+ if self.vlan != -1:
+ return '%s.%d' % (self.device, self.vlan)
else:
- return self.name
+ return self.device
def _cmd(cmd, *args):
diff --git a/tools/python/xen/xend/XendPIFMetrics.py b/tools/python/xen/xend/XendPIFMetrics.py
new file mode 100644
index 0000000000..8c65251664
--- /dev/null
+++ b/tools/python/xen/xend/XendPIFMetrics.py
@@ -0,0 +1,47 @@
+#============================================================================
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#============================================================================
+# Copyright (c) 2006-2007 Xensource Inc.
+#============================================================================
+
+
+class XendPIFMetrics:
+ """PIF Metrics."""
+
+ def __init__(self, uuid):
+ self.uuid = uuid
+
+ def set_PIF(self, pif):
+ self.pif = pif
+
+ def get_io_read_kbs(self):
+ return self._get_stat(0)
+
+ def get_io_write_kbs(self):
+ return self._get_stat(1)
+
+ def _get_stat(self, n):
+ from xen.xend.XendNode import instance as xennode
+ pifname = self.pif.device
+ pifs_util = xennode().monitor.get_pifs_util()
+ if pifname in pifs_util:
+ return pifs_util[pifname][n]
+ return 0.0
+
+ def get_record(self):
+ return {'uuid' : self.uuid,
+ 'PIF' : self.pif.uuid,
+ 'io_read_kbs' : self.get_io_read_kbs(),
+ 'io_write_kbs' : self.get_io_write_kbs()
+ }
diff --git a/tools/python/xen/xend/XendTask.py b/tools/python/xen/xend/XendTask.py
index d4de65b566..0485c39207 100644
--- a/tools/python/xen/xend/XendTask.py
+++ b/tools/python/xen/xend/XendTask.py
@@ -45,8 +45,8 @@ class XendTask(threading.Thread):
task_progress = {}
task_progress_lock = threading.Lock()
- def __init__(self, uuid, func, args, func_name, return_type = None,
- label = None, desc = None):
+ def __init__(self, uuid, func, args, func_name, return_type, label, desc,
+ session):
"""
@param uuid: UUID of the task
@type uuid: string
@@ -67,7 +67,6 @@ class XendTask(threading.Thread):
self.status = XEN_API_TASK_STATUS_TYPE[0]
self.progress = 0
- self.eta = None # TODO: we have no time estimates
self.type = return_type
self.uuid = uuid
@@ -83,6 +82,8 @@ class XendTask(threading.Thread):
self.func = func
self.args = args
+ self.session = session
+
def set_status(self, new_status):
self.status_lock.acquire()
try:
@@ -141,11 +142,12 @@ class XendTask(threading.Thread):
'name_description': self.name_description,
'status': self.status,
'progress': self.get_progress(),
- 'eta': self.eta,
'type': self.type,
'result': self.result,
'error_code': self.error_code,
'error_info': self.error_info,
+ 'allowed_operations': {},
+ 'session': self.session,
}
def get_progress(self):
diff --git a/tools/python/xen/xend/XendTaskManager.py b/tools/python/xen/xend/XendTaskManager.py
index ee5403c24a..6282078a44 100644
--- a/tools/python/xen/xend/XendTaskManager.py
+++ b/tools/python/xen/xend/XendTaskManager.py
@@ -32,7 +32,7 @@ import threading
tasks = {}
tasks_lock = threading.Lock()
-def create_task(func, args, func_name, return_type = None, label = ''):
+def create_task(func, args, func_name, return_type, label, session):
"""Creates a new Task and registers it with the XendTaskManager.
@param func: callable object XMLRPC method
@@ -48,8 +48,8 @@ def create_task(func, args, func_name, return_type = None, label = ''):
task_uuid = uuid.createString()
try:
tasks_lock.acquire()
- task = XendTask(task_uuid, func, args, func_name,
- return_type = return_type, label = label)
+ task = XendTask(task_uuid, func, args, func_name, return_type, label,
+ '', session)
tasks[task_uuid] = task
finally:
tasks_lock.release()
diff --git a/tools/python/xen/xend/XendVDI.py b/tools/python/xen/xend/XendVDI.py
index f1ea99e26b..0868814c8f 100644
--- a/tools/python/xen/xend/XendVDI.py
+++ b/tools/python/xen/xend/XendVDI.py
@@ -57,8 +57,6 @@ class XendVDI(AutoSaveObject):
'sector_size',
'virtual_size',
'physical_utilisation',
- 'parent',
- 'children',
'sharable',
'read_only']
@@ -72,8 +70,6 @@ class XendVDI(AutoSaveObject):
self.sector_size = 1024
self.virtual_size = 0
self.physical_utilisation = 0
- self.parent = None
- self.children = []
self.sharable = False
self.read_only = False
self.type = "system"
@@ -148,8 +144,6 @@ class XendVDI(AutoSaveObject):
'virtual_size': self.virtual_size,
'physical_utilisation': self.physical_utilisation,
'sector_size': self.sector_size,
- 'parent': None,
- 'children': [],
'sharable': False,
'readonly': False,
'SR': self.sr_uuid,
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
index b1437d3678..eeb8bd0ebd 100644
--- a/tools/python/xen/xend/image.py
+++ b/tools/python/xen/xend/image.py
@@ -26,6 +26,7 @@ import xen.lowlevel.xc
from xen.xend.XendConstants import REVERSE_DOMAIN_SHUTDOWN_REASONS
from xen.xend.XendError import VmError, XendError
from xen.xend.XendLogging import log
+from xen.xend.XendOptions import instance as xenopts
from xen.xend.server.netif import randomMAC
from xen.xend.xenstore.xswatch import xswatch
from xen.xend import arch
@@ -340,8 +341,6 @@ class HVMImageHandler(ImageHandler):
self.pid = None
- self.dmargs += self.configVNC(imageConfig)
-
self.pae = imageConfig['hvm'].get('pae', 0)
self.apic = imageConfig['hvm'].get('apic', 0)
self.acpi = imageConfig['hvm']['devices'].get('acpi', 0)
@@ -379,8 +378,8 @@ class HVMImageHandler(ImageHandler):
dmargs = [ 'boot', 'fda', 'fdb', 'soundhw',
'localtime', 'serial', 'stdvga', 'isa',
'acpi', 'usb', 'usbdevice', 'keymap' ]
+
hvmDeviceConfig = vmConfig['image']['hvm']['devices']
-
ret = ['-vcpus', str(self.vm.getVCpuCount())]
for a in dmargs:
@@ -439,49 +438,59 @@ class HVMImageHandler(ImageHandler):
ret.append("-net")
ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge))
- return ret
-
- def configVNC(self, imageConfig):
- # Handle graphics library related options
- vnc = imageConfig.get('vnc')
- sdl = imageConfig.get('sdl')
- ret = []
- nographic = imageConfig.get('nographic')
- # get password from VM config (if password omitted, None)
- vncpasswd_vmconfig = imageConfig.get('vncpasswd')
+ #
+ # Find RFB console device, and if it exists, make QEMU enable
+ # the VNC console.
+ #
+ if vmConfig['image'].get('nographic'):
+ # skip vnc init if nographic is set
+ ret.append('-nographic')
+ return ret
- if nographic:
+ vnc_config = {}
+ has_vfb = False
+ has_vnc = int(vmConfig['image'].get('vnc')) != 0
+ for dev_uuid in vmConfig['console_refs']:
+ dev_type, dev_info = vmConfig['devices'][devuuid]
+ if dev_type == 'rfb':
+ vnc_config = dev_info.get('other_config', {})
+ has_vfb = True
+ break
+
+ if not vnc_config:
+ for key in ('vncunused', 'vnclisten', 'vncdisplay', 'vncpasswd'):
+ if key in vmConfig['image']:
+ vnc_config[key] = vmConfig['image'][key]
+
+ if not has_vfb and not has_vnc:
ret.append('-nographic')
return ret
- if vnc:
- vncdisplay = imageConfig.get('vncdisplay',
- int(self.vm.getDomid()))
- vncunused = imageConfig.get('vncunused')
+
+ if not vnc_config.get('vncunused', 0) and \
+ vnc_config.get('vncdisplay', 0):
+ ret.append('-vnc')
+ ret.append(str(vncdisplay))
+ else:
+ ret.append('-vncunused')
- if vncunused:
- ret += ['-vncunused']
- else:
- ret += ['-vnc', '%d' % vncdisplay]
-
- vnclisten = imageConfig.get('vnclisten')
-
- if not(vnclisten):
- vnclisten = (xen.xend.XendOptions.instance().
- get_vnclisten_address())
- if vnclisten:
- ret += ['-vnclisten', vnclisten]
-
- vncpasswd = vncpasswd_vmconfig
- if vncpasswd is None:
- vncpasswd = (xen.xend.XendOptions.instance().
- get_vncpasswd_default())
- if vncpasswd is None:
- raise VmError('vncpasswd is not set up in ' +
- 'VMconfig and xend-config.')
- if vncpasswd != '':
- self.vm.storeVm("vncpasswd", vncpasswd)
+ vnclisten = vnc_config.get('vnclisten',
+ xenopts().get_vnclisten_address())
+ ret.append('-vnclisten')
+ ret.append(str(vnclisten))
+
+ # Store vncpassword in xenstore
+ vncpasswd = vnc_config.get('vncpasswd')
+ if not vncpasswd:
+ vncpasswd = xenopts().get_vncpasswd_default()
+
+ if vncpasswd is None:
+ raise VmError('vncpasswd is not setup in vmconfig or '
+ 'xend-config.sxp')
+
+ if vncpasswd != '':
+ self.vm.storeVm('vncpasswd', vncpasswd)
return ret
diff --git a/tools/python/xen/xend/server/ConsoleController.py b/tools/python/xen/xend/server/ConsoleController.py
index 0cccf4e55d..5afa34d7e8 100644
--- a/tools/python/xen/xend/server/ConsoleController.py
+++ b/tools/python/xen/xend/server/ConsoleController.py
@@ -8,7 +8,7 @@ class ConsoleController(DevController):
console devices with persistent UUIDs.
"""
- valid_cfg = ['uri', 'uuid', 'protocol']
+ valid_cfg = ['location', 'uuid', 'protocol']
def __init__(self, vm):
DevController.__init__(self, vm)
@@ -29,3 +29,7 @@ class ConsoleController(DevController):
def migrate(self, deviceConfig, network, dst, step, domName):
return 0
+
+ def destroyDevice(self, devid, force):
+ DevController.destroyDevice(self, devid, True)
+
diff --git a/tools/python/xen/xend/server/XMLRPCServer.py b/tools/python/xen/xend/server/XMLRPCServer.py
index 722ccb4b2b..09a66549e9 100644
--- a/tools/python/xen/xend/server/XMLRPCServer.py
+++ b/tools/python/xen/xend/server/XMLRPCServer.py
@@ -34,7 +34,7 @@ from xen.xend.XendError import XendInvalidDomain
def fixup_sxpr(sexpr):
ret = []
for k in sexpr:
- if type(k) in (types.ListType, types.TupleType):
+ if type(k) in (list, tuple):
if len(k) != 2 or k[0] != 'vcpu_avail':
ret.append(fixup_sxpr(k))
else:
diff --git a/tools/python/xen/xend/server/vfbif.py b/tools/python/xen/xend/server/vfbif.py
index 7bfe850593..0bd1b92bf3 100644
--- a/tools/python/xen/xend/server/vfbif.py
+++ b/tools/python/xen/xend/server/vfbif.py
@@ -14,7 +14,8 @@ def spawn_detached(path, args, env):
os.waitpid(p, 0)
CONFIG_ENTRIES = ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', 'vncunused',
- 'display', 'xauthority', 'keymap' ]
+ 'display', 'xauthority', 'keymap',
+ 'uuid', 'location', 'protocol']
class VfbifController(DevController):
"""Virtual frame buffer controller. Handles all vfb devices for a domain.
@@ -27,10 +28,11 @@ class VfbifController(DevController):
def getDeviceDetails(self, config):
"""@see DevController.getDeviceDetails"""
- back = dict([(k, config[k]) for k in CONFIG_ENTRIES
+ back = dict([(k, str(config[k])) for k in CONFIG_ENTRIES
if config.has_key(k)])
- return (0, back, {})
+ devid = 0
+ return (devid, back, {})
def getDeviceConfiguration(self, devid):
@@ -44,6 +46,10 @@ class VfbifController(DevController):
def createDevice(self, config):
DevController.createDevice(self, config)
+ if self.vm.info.get('HVM_boot'):
+ # is HVM, so qemu-dm will handle the vfb.
+ return
+
std_args = [ "--domid", "%d" % self.vm.getDomid(),
"--title", self.vm.getName() ]
t = config.get("type", None)
@@ -82,6 +88,42 @@ class VfbifController(DevController):
else:
raise VmError('Unknown vfb type %s (%s)' % (t, repr(config)))
+
+ def waitForDevice(self, devid):
+ if self.vm.info.get('HVM_boot'):
+ log.debug('skip waiting for HVM vfb')
+ # is a qemu-dm managed device, don't wait for hotplug for these.
+ return
+
+ DevController.waitForDevice(self, devid)
+
+
+ def reconfigureDevice(self, _, config):
+ """ Only allow appending location information of vnc port into
+ xenstore."""
+
+ if 'location' in config:
+ (devid, back, front) = self.getDeviceDetails(config)
+ self.writeBackend(devid, 'location', config['location'])
+ return back.get('uuid')
+
+ raise VmError('Refusing to reconfigure device vfb:%d' % devid)
+
+ def destroyDevice(self, devid, force):
+ if self.vm.info.get('HVM_boot'):
+ # remove the backend xenstore entries for HVM guests no matter
+ # what
+ DevController.destroyDevice(self, devid, True)
+ else:
+ DevController.destroyDevice(self, devid, force)
+
+
+ def migrate(self, deviceConfig, network, dst, step, domName):
+ if self.vm.info.get('HVM_boot'):
+ return 0
+ return DevController.migrate(self, deviceConfig, network, dst, step,
+ domName)
+
class VkbdifController(DevController):
"""Virtual keyboard controller. Handles all vkbd devices for a domain.
"""
@@ -92,3 +134,24 @@ class VkbdifController(DevController):
back = {}
front = {}
return (devid, back, front)
+
+ def waitForDevice(self, config):
+ if self.vm.info.get('HVM_boot'):
+ # is a qemu-dm managed device, don't wait for hotplug for these.
+ return
+
+ DevController.waitForDevice(self, config)
+
+ def destroyDevice(self, devid, force):
+ if self.vm.info.get('HVM_boot'):
+ # remove the backend xenstore entries for HVM guests no matter
+ # what
+ DevController.destroyDevice(self, devid, True)
+ else:
+ DevController.destroyDevice(self, devid, force)
+
+ def migrate(self, deviceConfig, network, dst, step, domName):
+ if self.vm.info.get('HVM_boot'):
+ return 0
+ return DevController.migrate(self, deviceConfig, network, dst, step,
+ domName)
diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py
index ac90ff177c..450e3283d1 100644
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -594,9 +594,9 @@ def configure_vfbs(config_devs, vals):
'xauthority', 'type', 'vncpasswd' ]:
err("configuration option %s unknown to vfbs" % k)
config.append([k,v])
- for n in iter(dir(vals)):
- if n == "keymap":
- config.append(['keymap',vals.keymap])
+ if not d.has_key("keymap"):
+ if vals.keymap:
+ config.append(['keymap',vals.keymap])
if not d.has_key("display") and os.environ.has_key("DISPLAY"):
config.append(["display", os.environ['DISPLAY']])
if not d.has_key("xauthority"):
diff --git a/tools/python/xen/xm/messages/en/xen-xm.po b/tools/python/xen/xm/messages/en/xen-xm.po
index ff4b4ea75b..d422b2e6b8 100644
--- a/tools/python/xen/xm/messages/en/xen-xm.po
+++ b/tools/python/xen/xm/messages/en/xen-xm.po
@@ -12,14 +12,14 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# ============================================================================
-# Copyright (c) 2006 XenSource Inc.
+# Copyright (c) 2006-2007 XenSource Inc.
# ============================================================================
#
#
msgid ""
msgstr ""
"Project-Id-Version: Xen-xm 3.0\n"
-"PO-Revision-Date: 2006-12-28 15:43+0000\n"
+"PO-Revision-Date: 2007-01-30 17:15+0000\n"
"Last-Translator: Ewan Mellor <ewan@xensource.com>\n"
"Language-Team: xen-devel <xen-devel@lists.xensource.com>\n"
"MIME-Version: 1.0\n"
@@ -47,9 +47,21 @@ msgstr "The host_cpu handle %(1)s is invalid."
msgid "HOST_HANDLE_INVALID"
msgstr "The host handle %(1)s is invalid."
+msgid "HOST_METRICS_HANDLE_INVALID"
+msgstr "The host_metrics handle %(1)s is invalid."
+
+msgid "PIF_HANDLE_INVALID"
+msgstr "The PIF handle %(1)s is invalid."
+
+msgid "PIF_METRICS_HANDLE_INVALID"
+msgstr "The PIF_METRICS handle %(1)s is invalid."
+
msgid "SR_HANDLE_INVALID"
msgstr "The SR handle %(1)s is invalid."
+msgid "TASK_HANDLE_INVALID"
+msgstr "The task handle %(1)s is invalid."
+
msgid "VBD_HANDLE_INVALID"
msgstr "The VBD handle %(1)s is invalid."
@@ -62,11 +74,23 @@ msgstr "The VIF handle %(1)s is invalid."
msgid "VM_HANDLE_INVALID"
msgstr "The VM handle %(1)s is invalid."
+msgid "VM_METRICS_HANDLE_INVALID"
+msgstr "The VM_metrics handle %(1)s is invalid."
+
msgid "VTPM_HANDLE_INVALID"
msgstr "The VTPM handle %(1)s is invalid."
+msgid "OPERATION_NOT_ALLOWED"
+msgstr "You attempted an operation that was not allowed."
+
msgid "NETWORK_ALREADY_CONNECTED"
msgstr "The network you specified already has a PIF attached to it, and so another one may not be attached."
+msgid "PIF_IS_PHYSICAL"
+msgstr "The PIF %(1)s corresponds to a physical interface, and so may not be destroyed."
+
+msgid "VLAN_TAG_INVALID"
+msgstr "The VLAN tag you gave (%(1)s) is invalid -- it must be between 0 and 4095."
+
msgid "VM_BAD_POWER_STATE"
msgstr "The VM must be %(2)s to perform the requested operation (it is currently %(3)s)."
diff --git a/tools/security/Makefile b/tools/security/Makefile
index cd0835a910..d29a1926bb 100644
--- a/tools/security/Makefile
+++ b/tools/security/Makefile
@@ -86,7 +86,7 @@ install:
endif
.PHONY: build
-build: mk-symlinks $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
+build: $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
python python/setup.py build
chmod 700 $(ACM_SCRIPTS)
@@ -104,7 +104,6 @@ clean:
$(RM) $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS)
$(RM) $(ACM_OBJS)
$(RM) $(PROG_DEPS)
- $(RM) -r xen
$(RM) -r build
.PHONY: mrproper
diff --git a/tools/xenfb/Makefile b/tools/xenfb/Makefile
index e7c76e73b5..b9bd3ba1e6 100644
--- a/tools/xenfb/Makefile
+++ b/tools/xenfb/Makefile
@@ -12,7 +12,7 @@ INSTALL_DIR = $(INSTALL) -d -m0755
all: build
.PHONY: build
-build: mk-symlinks
+build:
$(MAKE) vncfb sdlfb
install: all
diff --git a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py
index 89975d077f..4798dc13c6 100644
--- a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py
+++ b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py
@@ -4,14 +4,22 @@
# Author: Stefan Berger <stefanb@us.ibm.com>
# Test to test the vtpm class through the Xen-API
+#
+# Tested methods:
+# VTPM: get_uuid, get_backend, get_by_uuid, get_record
+# create, destroy, get_VM
+# VM: get_VTPMS
from XmTestLib import xapi
from XmTestLib.XenAPIDomain import XmTestAPIDomain
from XmTestLib import *
+from xen.xend import XendDomain
from vtpm_utils import *
import commands
import os
+VTPM_RECORD_KEYS = [ 'backend', 'VM', 'uuid' ]
+
try:
# XmTestAPIDomain tries to establish a connection to XenD
domain = XmTestAPIDomain()
@@ -20,52 +28,131 @@ except Exception, e:
vm_uuid = domain.get_uuid()
vtpmcfg = {}
-vtpmcfg['type'] = "paravirtualised"
-vtpmcfg['backend'] = "Domain-0"
-vtpmcfg['instance'] = 1
+vtpmcfg['backend'] = XendDomain.DOM0_UUID
vtpmcfg['VM'] = vm_uuid
session = xapi.connect()
vtpm_uuid = session.xenapi.VTPM.create(vtpmcfg)
-vtpm_id = session.xenapi.VTPM.get_instance(vtpm_uuid)
vtpm_be = session.xenapi.VTPM.get_backend(vtpm_uuid)
if vtpm_be != vtpmcfg['backend']:
FAIL("vTPM's backend is in '%s', expected: '%s'" %
(vtpm_be, vtpmcfg['backend']))
-driver = session.xenapi.VTPM.get_driver(vtpm_uuid)
-if driver != vtpmcfg['type']:
- FAIL("vTPM has driver type '%s', expected: '%s'" %
- (driver, vtpmcfg['type']))
-
vtpm_rec = session.xenapi.VTPM.get_record(vtpm_uuid)
-if vtpm_rec['driver'] != vtpmcfg['type']:
- FAIL("vTPM record shows driver type '%s', expected: '%s'" %
- (vtpm_rec['driver'], vtpmcfg['type']))
+miss_keys = []
+for k in VTPM_RECORD_KEYS:
+ if k not in vtpm_rec.keys():
+ miss_keys.append(k)
+if len(miss_keys) > 0:
+ FAIL("vTPM record is missing key(s): %s" % miss_keys)
+
if vtpm_rec['uuid'] != vtpm_uuid:
FAIL("vTPM record shows vtpm uuid '%s', expected: '%s'" %
(vtpm_rec['uuid'], vtpm_uuid))
if vtpm_rec['VM'] != vm_uuid:
FAIL("vTPM record shows VM uuid '%s', expected: '%s'" %
(vtpm_rec['VM'], vm_uuid))
+if vtpm_rec['backend'] != vtpmcfg['backend']:
+ FAIL("vTPM record shows VM bakcned '%s', expected: '%s'" %
+ (vtpm_rev['backend'], vtpmcfg['backend']))
+
+badkeys = []
+keys = vtpm_rec.keys()
+for k in keys:
+ if k not in VTPM_RECORD_KEYS:
+ badkeys.append(k)
+if len(badkeys) > 0:
+ FAIL("Unexpected attributes in result: %s" % badkeys)
+
+if vm_uuid != session.xenapi.VTPM.get_VM(vtpm_uuid):
+ FAIL("VM uuid from VTPM.get_VM different (%s) than expected (%s)." %
+ (vm_ref, vm_uuid))
+
+uuid = session.xenapi.VTPM.get_uuid(vtpm_uuid)
+if uuid != vtpm_uuid:
+ FAIL("vTPM from VTPM.get_uuid different (%s) than expected (%s)." %
+ (uuid, vtpm_uuid))
+
+vtpm_ref = session.xenapi.VTPM.get_by_uuid(vtpm_uuid)
+if vtpm_ref != vtpm_uuid:
+ FAIL("vTPM from VTPM.get_by_uuid different (%s) than expected (%s)." %
+ (vtpm_ref, vtpm_uuid))
+
+vm_vtpms = session.xenapi.VM.get_VTPMs(vm_uuid)
+if len(vm_vtpms) != 1:
+ FAIL("Number of vTPMs from get_VTPMs is (%d) not what was expected (%d)" %
+ (len(vm_vtpms), 1))
+if vtpm_uuid not in vm_vtpms:
+ FAIL("Other vTPM uuid (%s) returned from VM.get_VTPMs than expected (%s)" %
+ (vm_vtpms[0], vtpm_uuid))
-success = domain.start()
+try:
+ console = domain.start()
+except DomainError, e:
+ FAIL("Unable to create domain (%s)" % domName)
-console = domain.getConsole()
+try:
+ console.sendInput("input")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
- FAIL("No result from dumping the PCRs")
+ FAIL("1. No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
+if not re.search("PCR-00:",run["output"]):
+ saveLog(console.getHistory())
+ FAIL("1. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
+
+try:
+ rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+ #Should never get here
+ FAIL("Could destroy vTPM while VM is running")
+except:
+ pass
+
+rc = session.xenapi.VM.suspend(vm_uuid)
+if rc:
+ FAIL("Could not suspend VM")
+
+try:
+ rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+ #May not throw an exception in 'suspend' state
+except:
+ pass
+
+rc = session.xenapi.VM.resume(vm_uuid, False)
+if rc:
+ FAIL("Could not resume VM")
+
+try:
+ console = domain.getConsole()
+except ConsoleError, e:
+ FAIL(str(e))
+
+try:
+ run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ FAIL("2. No result from dumping the PCRs. vTPM has been removed?")
+
+if not re.search("PCR-00:",run["output"]):
+ saveLog(console.getHistory())
+ FAIL("2. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
+
domain.stop()
+
+rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+if not rc:
+ FAIL("Could NOT destroy vTPM while domain is halted.")
+
domain.destroy()
diff --git a/xen/Makefile b/xen/Makefile
index bd6a26dfaf..ae2a41408c 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -22,7 +22,7 @@ build install debug clean distclean cscope TAGS tags MAP::
_build: $(TARGET).gz
.PHONY: _install
-_install: $(TARGET).gz
+_install: $(TARGET).gz build-headers
[ -d $(DESTDIR)/boot ] || $(INSTALL_DIR) $(DESTDIR)/boot
$(INSTALL_DATA) $(TARGET).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_FULLVERSION).gz
ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).$(XEN_SUBVERSION).gz
@@ -69,7 +69,7 @@ $(TARGET).gz: $(TARGET)
gzip -f -9 < $< > $@.new
mv $@.new $@
-$(TARGET): delete-unfresh-files
+$(TARGET): delete-unfresh-files build-headers
$(MAKE) -C tools
$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/acm_policy.h
@@ -133,6 +133,11 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
echo ""; \
echo "#endif") <$< >$@
+# generate header files
+.PHONY: build-headers
+build-headers:
+ $(MAKE) -C include/public/foreign
+
SUBDIRS = acm arch/$(TARGET_ARCH) common drivers
define all_sources
( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
diff --git a/xen/acm/acm_chinesewall_hooks.c b/xen/acm/acm_chinesewall_hooks.c
index 98aea6e428..a2071668b4 100644
--- a/xen/acm/acm_chinesewall_hooks.c
+++ b/xen/acm/acm_chinesewall_hooks.c
@@ -132,26 +132,26 @@ static int chwall_dump_policy(u8 * buf, u32 buf_size)
if (buf_size < sizeof(struct acm_chwall_policy_buffer))
return -EINVAL;
- chwall_buf->chwall_max_types = htonl(chwall_bin_pol.max_types);
- chwall_buf->chwall_max_ssidrefs = htonl(chwall_bin_pol.max_ssidrefs);
- chwall_buf->policy_code = htonl(ACM_CHINESE_WALL_POLICY);
+ chwall_buf->chwall_max_types = cpu_to_be32(chwall_bin_pol.max_types);
+ chwall_buf->chwall_max_ssidrefs = cpu_to_be32(chwall_bin_pol.max_ssidrefs);
+ chwall_buf->policy_code = cpu_to_be32(ACM_CHINESE_WALL_POLICY);
chwall_buf->chwall_ssid_offset =
- htonl(sizeof(struct acm_chwall_policy_buffer));
+ cpu_to_be32(sizeof(struct acm_chwall_policy_buffer));
chwall_buf->chwall_max_conflictsets =
- htonl(chwall_bin_pol.max_conflictsets);
+ cpu_to_be32(chwall_bin_pol.max_conflictsets);
chwall_buf->chwall_conflict_sets_offset =
- htonl(ntohl(chwall_buf->chwall_ssid_offset) +
+ cpu_to_be32(be32_to_cpu(chwall_buf->chwall_ssid_offset) +
sizeof(domaintype_t) * chwall_bin_pol.max_ssidrefs *
chwall_bin_pol.max_types);
chwall_buf->chwall_running_types_offset =
- htonl(ntohl(chwall_buf->chwall_conflict_sets_offset) +
+ cpu_to_be32(be32_to_cpu(chwall_buf->chwall_conflict_sets_offset) +
sizeof(domaintype_t) * chwall_bin_pol.max_conflictsets *
chwall_bin_pol.max_types);
chwall_buf->chwall_conflict_aggregate_offset =
- htonl(ntohl(chwall_buf->chwall_running_types_offset) +
+ cpu_to_be32(be32_to_cpu(chwall_buf->chwall_running_types_offset) +
sizeof(domaintype_t) * chwall_bin_pol.max_types);
- ret = ntohl(chwall_buf->chwall_conflict_aggregate_offset) +
+ ret = be32_to_cpu(chwall_buf->chwall_conflict_aggregate_offset) +
sizeof(domaintype_t) * chwall_bin_pol.max_types;
ret = (ret + 7) & ~7;
@@ -160,21 +160,21 @@ static int chwall_dump_policy(u8 * buf, u32 buf_size)
return -EINVAL;
/* now copy buffers over */
- arrcpy16((u16 *) (buf + ntohl(chwall_buf->chwall_ssid_offset)),
+ arrcpy16((u16 *) (buf + be32_to_cpu(chwall_buf->chwall_ssid_offset)),
chwall_bin_pol.ssidrefs,
chwall_bin_pol.max_ssidrefs * chwall_bin_pol.max_types);
arrcpy16((u16 *) (buf +
- ntohl(chwall_buf->chwall_conflict_sets_offset)),
+ be32_to_cpu(chwall_buf->chwall_conflict_sets_offset)),
chwall_bin_pol.conflict_sets,
chwall_bin_pol.max_conflictsets * chwall_bin_pol.max_types);
arrcpy16((u16 *) (buf +
- ntohl(chwall_buf->chwall_running_types_offset)),
+ be32_to_cpu(chwall_buf->chwall_running_types_offset)),
chwall_bin_pol.running_types, chwall_bin_pol.max_types);
arrcpy16((u16 *) (buf +
- ntohl(chwall_buf->chwall_conflict_aggregate_offset)),
+ be32_to_cpu(chwall_buf->chwall_conflict_aggregate_offset)),
chwall_bin_pol.conflict_aggregate_set,
chwall_bin_pol.max_types);
return ret;
@@ -267,20 +267,20 @@ static int chwall_set_policy(u8 * buf, u32 buf_size)
return -EINVAL;
/* rewrite the policy due to endianess */
- chwall_buf->policy_code = ntohl(chwall_buf->policy_code);
- chwall_buf->policy_version = ntohl(chwall_buf->policy_version);
- chwall_buf->chwall_max_types = ntohl(chwall_buf->chwall_max_types);
+ chwall_buf->policy_code = be32_to_cpu(chwall_buf->policy_code);
+ chwall_buf->policy_version = be32_to_cpu(chwall_buf->policy_version);
+ chwall_buf->chwall_max_types = be32_to_cpu(chwall_buf->chwall_max_types);
chwall_buf->chwall_max_ssidrefs =
- ntohl(chwall_buf->chwall_max_ssidrefs);
+ be32_to_cpu(chwall_buf->chwall_max_ssidrefs);
chwall_buf->chwall_max_conflictsets =
- ntohl(chwall_buf->chwall_max_conflictsets);
- chwall_buf->chwall_ssid_offset = ntohl(chwall_buf->chwall_ssid_offset);
+ be32_to_cpu(chwall_buf->chwall_max_conflictsets);
+ chwall_buf->chwall_ssid_offset = be32_to_cpu(chwall_buf->chwall_ssid_offset);
chwall_buf->chwall_conflict_sets_offset =
- ntohl(chwall_buf->chwall_conflict_sets_offset);
+ be32_to_cpu(chwall_buf->chwall_conflict_sets_offset);
chwall_buf->chwall_running_types_offset =
- ntohl(chwall_buf->chwall_running_types_offset);
+ be32_to_cpu(chwall_buf->chwall_running_types_offset);
chwall_buf->chwall_conflict_aggregate_offset =
- ntohl(chwall_buf->chwall_conflict_aggregate_offset);
+ be32_to_cpu(chwall_buf->chwall_conflict_aggregate_offset);
/* policy type and version checks */
if ((chwall_buf->policy_code != ACM_CHINESE_WALL_POLICY) ||
diff --git a/xen/acm/acm_core.c b/xen/acm/acm_core.c
index 5ab04e8b3c..c4fde03fb0 100644
--- a/xen/acm/acm_core.c
+++ b/xen/acm/acm_core.c
@@ -62,35 +62,20 @@ struct acm_binary_policy acm_bin_pol;
/* acm binary policy lock */
DEFINE_RWLOCK(acm_bin_pol_rwlock);
-/* until we have endian support in Xen, we discover it at runtime */
-u8 little_endian = 1;
-void
-acm_set_endian(void)
-{
- u32 test = 1;
- if (*((u8 *)&test) == 1)
- {
- printkd("ACM module running in LITTLE ENDIAN.\n");
- little_endian = 1;
- }
- else
- {
- printkd("ACM module running in BIG ENDIAN.\n");
- little_endian = 0;
- }
-}
-
int
-acm_set_policy_reference(u8 * buf, u32 buf_size)
+acm_set_policy_reference(u8 *buf, u32 buf_size)
{
struct acm_policy_reference_buffer *pr = (struct acm_policy_reference_buffer *)buf;
- acm_bin_pol.policy_reference_name = (char *)xmalloc_array(u8, ntohl(pr->len));
+ acm_bin_pol.policy_reference_name = (char *)xmalloc_array(u8, be32_to_cpu(pr->len));
if (!acm_bin_pol.policy_reference_name)
return -ENOMEM;
- strcpy(acm_bin_pol.policy_reference_name, (char *)(buf + sizeof(struct acm_policy_reference_buffer)));
- printk("%s: Activating policy %s\n", __func__, acm_bin_pol.policy_reference_name);
+ strlcpy(acm_bin_pol.policy_reference_name,
+ (char *)(buf + sizeof(struct acm_policy_reference_buffer)),
+ be32_to_cpu(pr->len));
+ printk("%s: Activating policy %s\n", __func__,
+ acm_bin_pol.policy_reference_name);
return 0;
}
@@ -105,9 +90,10 @@ acm_dump_policy_reference(u8 *buf, u32 buf_size)
return -EINVAL;
memset(buf, 0, ret);
- pr_buf->len = htonl(strlen(acm_bin_pol.policy_reference_name) + 1); /* including stringend '\0' */
- strcpy((char *)(buf + sizeof(struct acm_policy_reference_buffer)),
- acm_bin_pol.policy_reference_name);
+ pr_buf->len = cpu_to_be32(strlen(acm_bin_pol.policy_reference_name) + 1); /* including stringend '\0' */
+ strlcpy((char *)(buf + sizeof(struct acm_policy_reference_buffer)),
+ acm_bin_pol.policy_reference_name,
+ be32_to_cpu(pr_buf->len));
return ret;
}
@@ -198,7 +184,7 @@ acm_is_policy(char *buf, unsigned long len)
return 0;
pol = (struct acm_policy_buffer *)buf;
- return ntohl(pol->magic) == ACM_MAGIC;
+ return be32_to_cpu(pol->magic) == ACM_MAGIC;
}
@@ -213,7 +199,7 @@ acm_setup(char *policy_start,
return rc;
pol = (struct acm_policy_buffer *)policy_start;
- if (ntohl(pol->magic) != ACM_MAGIC)
+ if (be32_to_cpu(pol->magic) != ACM_MAGIC)
return rc;
rc = do_acm_set_policy((void *)policy_start, (u32)policy_len);
@@ -237,8 +223,6 @@ acm_init(char *policy_start,
{
int ret = ACM_OK;
- acm_set_endian();
-
/* first try to load the boot policy (uses its own locks) */
acm_setup(policy_start, policy_len);
diff --git a/xen/acm/acm_policy.c b/xen/acm/acm_policy.c
index ecfdb90744..0f143303cf 100644
--- a/xen/acm/acm_policy.c
+++ b/xen/acm/acm_policy.c
@@ -63,9 +63,9 @@ do_acm_set_policy(void *buf, u32 buf_size)
{
struct acm_policy_buffer *pol = (struct acm_policy_buffer *)buf;
/* some sanity checking */
- if ((ntohl(pol->magic) != ACM_MAGIC) ||
- (buf_size != ntohl(pol->len)) ||
- (ntohl(pol->policy_version) != ACM_POLICY_VERSION))
+ if ((be32_to_cpu(pol->magic) != ACM_MAGIC) ||
+ (buf_size != be32_to_cpu(pol->len)) ||
+ (be32_to_cpu(pol->policy_version) != ACM_POLICY_VERSION))
{
printk("%s: ERROR in Magic, Version, or buf size.\n", __func__);
goto error_free;
@@ -73,8 +73,8 @@ do_acm_set_policy(void *buf, u32 buf_size)
if (acm_active_security_policy == ACM_POLICY_UNDEFINED) {
/* setup the policy with the boot policy */
- if (acm_init_binary_policy((ntohl(pol->secondary_policy_code) << 4) |
- ntohl(pol->primary_policy_code))) {
+ if (acm_init_binary_policy((be32_to_cpu(pol->secondary_policy_code) << 4) |
+ be32_to_cpu(pol->primary_policy_code))) {
goto error_free;
}
acm_active_security_policy =
@@ -82,8 +82,8 @@ do_acm_set_policy(void *buf, u32 buf_size)
}
/* once acm_active_security_policy is set, it cannot be changed */
- if ((ntohl(pol->primary_policy_code) != acm_bin_pol.primary_policy_code) ||
- (ntohl(pol->secondary_policy_code) != acm_bin_pol.secondary_policy_code))
+ if ((be32_to_cpu(pol->primary_policy_code) != acm_bin_pol.primary_policy_code) ||
+ (be32_to_cpu(pol->secondary_policy_code) != acm_bin_pol.secondary_policy_code))
{
printkd("%s: Wrong policy type in boot policy!\n", __func__);
goto error_free;
@@ -93,21 +93,21 @@ do_acm_set_policy(void *buf, u32 buf_size)
write_lock(&acm_bin_pol_rwlock);
/* set label reference name */
- if (acm_set_policy_reference(buf + ntohl(pol->policy_reference_offset),
- ntohl(pol->primary_buffer_offset) -
- ntohl(pol->policy_reference_offset)))
+ if (acm_set_policy_reference(buf + be32_to_cpu(pol->policy_reference_offset),
+ be32_to_cpu(pol->primary_buffer_offset) -
+ be32_to_cpu(pol->policy_reference_offset)))
goto error_lock_free;
/* set primary policy data */
- if (acm_primary_ops->set_binary_policy(buf + ntohl(pol->primary_buffer_offset),
- ntohl(pol->secondary_buffer_offset) -
- ntohl(pol->primary_buffer_offset)))
+ if (acm_primary_ops->set_binary_policy(buf + be32_to_cpu(pol->primary_buffer_offset),
+ be32_to_cpu(pol->secondary_buffer_offset) -
+ be32_to_cpu(pol->primary_buffer_offset)))
goto error_lock_free;
/* set secondary policy data */
- if (acm_secondary_ops->set_binary_policy(buf + ntohl(pol->secondary_buffer_offset),
- ntohl(pol->len) -
- ntohl(pol->secondary_buffer_offset)))
+ if (acm_secondary_ops->set_binary_policy(buf + be32_to_cpu(pol->secondary_buffer_offset),
+ be32_to_cpu(pol->len) -
+ be32_to_cpu(pol->secondary_buffer_offset)))
goto error_lock_free;
write_unlock(&acm_bin_pol_rwlock);
@@ -136,38 +136,38 @@ acm_get_policy(XEN_GUEST_HANDLE(void) buf, u32 buf_size)
read_lock(&acm_bin_pol_rwlock);
bin_pol = (struct acm_policy_buffer *)policy_buffer;
- bin_pol->magic = htonl(ACM_MAGIC);
- bin_pol->primary_policy_code = htonl(acm_bin_pol.primary_policy_code);
- bin_pol->secondary_policy_code = htonl(acm_bin_pol.secondary_policy_code);
-
- bin_pol->len = htonl(sizeof(struct acm_policy_buffer));
- bin_pol->policy_reference_offset = htonl(ntohl(bin_pol->len));
- bin_pol->primary_buffer_offset = htonl(ntohl(bin_pol->len));
- bin_pol->secondary_buffer_offset = htonl(ntohl(bin_pol->len));
+ bin_pol->magic = cpu_to_be32(ACM_MAGIC);
+ bin_pol->primary_policy_code = cpu_to_be32(acm_bin_pol.primary_policy_code);
+ bin_pol->secondary_policy_code = cpu_to_be32(acm_bin_pol.secondary_policy_code);
+
+ bin_pol->len = cpu_to_be32(sizeof(struct acm_policy_buffer));
+ bin_pol->policy_reference_offset = cpu_to_be32(be32_to_cpu(bin_pol->len));
+ bin_pol->primary_buffer_offset = cpu_to_be32(be32_to_cpu(bin_pol->len));
+ bin_pol->secondary_buffer_offset = cpu_to_be32(be32_to_cpu(bin_pol->len));
- ret = acm_dump_policy_reference(policy_buffer + ntohl(bin_pol->policy_reference_offset),
- buf_size - ntohl(bin_pol->policy_reference_offset));
+ ret = acm_dump_policy_reference(policy_buffer + be32_to_cpu(bin_pol->policy_reference_offset),
+ buf_size - be32_to_cpu(bin_pol->policy_reference_offset));
if (ret < 0)
goto error_free_unlock;
- bin_pol->len = htonl(ntohl(bin_pol->len) + ret);
- bin_pol->primary_buffer_offset = htonl(ntohl(bin_pol->len));
+ bin_pol->len = cpu_to_be32(be32_to_cpu(bin_pol->len) + ret);
+ bin_pol->primary_buffer_offset = cpu_to_be32(be32_to_cpu(bin_pol->len));
- ret = acm_primary_ops->dump_binary_policy (policy_buffer + ntohl(bin_pol->primary_buffer_offset),
- buf_size - ntohl(bin_pol->primary_buffer_offset));
+ ret = acm_primary_ops->dump_binary_policy (policy_buffer + be32_to_cpu(bin_pol->primary_buffer_offset),
+ buf_size - be32_to_cpu(bin_pol->primary_buffer_offset));
if (ret < 0)
goto error_free_unlock;
- bin_pol->len = htonl(ntohl(bin_pol->len) + ret);
- bin_pol->secondary_buffer_offset = htonl(ntohl(bin_pol->len));
+ bin_pol->len = cpu_to_be32(be32_to_cpu(bin_pol->len) + ret);
+ bin_pol->secondary_buffer_offset = cpu_to_be32(be32_to_cpu(bin_pol->len));
- ret = acm_secondary_ops->dump_binary_policy(policy_buffer + ntohl(bin_pol->secondary_buffer_offset),
- buf_size - ntohl(bin_pol->secondary_buffer_offset));
+ ret = acm_secondary_ops->dump_binary_policy(policy_buffer + be32_to_cpu(bin_pol->secondary_buffer_offset),
+ buf_size - be32_to_cpu(bin_pol->secondary_buffer_offset));
if (ret < 0)
goto error_free_unlock;
- bin_pol->len = htonl(ntohl(bin_pol->len) + ret);
- if (copy_to_guest(buf, policy_buffer, ntohl(bin_pol->len)))
+ bin_pol->len = cpu_to_be32(be32_to_cpu(bin_pol->len) + ret);
+ if (copy_to_guest(buf, policy_buffer, be32_to_cpu(bin_pol->len)))
goto error_free_unlock;
read_unlock(&acm_bin_pol_rwlock);
@@ -204,12 +204,12 @@ acm_dump_statistics(XEN_GUEST_HANDLE(void) buf, u16 buf_size)
if (len2 < 0)
goto error_lock_free;
- acm_stats.magic = htonl(ACM_MAGIC);
- acm_stats.primary_policy_code = htonl(acm_bin_pol.primary_policy_code);
- acm_stats.secondary_policy_code = htonl(acm_bin_pol.secondary_policy_code);
- acm_stats.primary_stats_offset = htonl(sizeof(struct acm_stats_buffer));
- acm_stats.secondary_stats_offset = htonl(sizeof(struct acm_stats_buffer) + len1);
- acm_stats.len = htonl(sizeof(struct acm_stats_buffer) + len1 + len2);
+ acm_stats.magic = cpu_to_be32(ACM_MAGIC);
+ acm_stats.primary_policy_code = cpu_to_be32(acm_bin_pol.primary_policy_code);
+ acm_stats.secondary_policy_code = cpu_to_be32(acm_bin_pol.secondary_policy_code);
+ acm_stats.primary_stats_offset = cpu_to_be32(sizeof(struct acm_stats_buffer));
+ acm_stats.secondary_stats_offset = cpu_to_be32(sizeof(struct acm_stats_buffer) + len1);
+ acm_stats.len = cpu_to_be32(sizeof(struct acm_stats_buffer) + len1 + len2);
memcpy(stats_buffer, &acm_stats, sizeof(struct acm_stats_buffer));
diff --git a/xen/acm/acm_simple_type_enforcement_hooks.c b/xen/acm/acm_simple_type_enforcement_hooks.c
index b5b931fa6b..c77023f875 100644
--- a/xen/acm/acm_simple_type_enforcement_hooks.c
+++ b/xen/acm/acm_simple_type_enforcement_hooks.c
@@ -143,11 +143,11 @@ ste_dump_policy(u8 *buf, u32 buf_size) {
if (buf_size < sizeof(struct acm_ste_policy_buffer))
return -EINVAL;
- ste_buf->ste_max_types = htonl(ste_bin_pol.max_types);
- ste_buf->ste_max_ssidrefs = htonl(ste_bin_pol.max_ssidrefs);
- ste_buf->policy_code = htonl(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY);
- ste_buf->ste_ssid_offset = htonl(sizeof(struct acm_ste_policy_buffer));
- ret = ntohl(ste_buf->ste_ssid_offset) +
+ ste_buf->ste_max_types = cpu_to_be32(ste_bin_pol.max_types);
+ ste_buf->ste_max_ssidrefs = cpu_to_be32(ste_bin_pol.max_ssidrefs);
+ ste_buf->policy_code = cpu_to_be32(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY);
+ ste_buf->ste_ssid_offset = cpu_to_be32(sizeof(struct acm_ste_policy_buffer));
+ ret = be32_to_cpu(ste_buf->ste_ssid_offset) +
sizeof(domaintype_t)*ste_bin_pol.max_ssidrefs*ste_bin_pol.max_types;
ret = (ret + 7) & ~7;
@@ -156,7 +156,7 @@ ste_dump_policy(u8 *buf, u32 buf_size) {
return -EINVAL;
/* now copy buffer over */
- arrcpy(buf + ntohl(ste_buf->ste_ssid_offset),
+ arrcpy(buf + be32_to_cpu(ste_buf->ste_ssid_offset),
ste_bin_pol.ssidrefs,
sizeof(domaintype_t),
ste_bin_pol.max_ssidrefs*ste_bin_pol.max_types);
@@ -287,11 +287,11 @@ ste_set_policy(u8 *buf, u32 buf_size)
return -EINVAL;
/* Convert endianess of policy */
- ste_buf->policy_code = ntohl(ste_buf->policy_code);
- ste_buf->policy_version = ntohl(ste_buf->policy_version);
- ste_buf->ste_max_types = ntohl(ste_buf->ste_max_types);
- ste_buf->ste_max_ssidrefs = ntohl(ste_buf->ste_max_ssidrefs);
- ste_buf->ste_ssid_offset = ntohl(ste_buf->ste_ssid_offset);
+ ste_buf->policy_code = be32_to_cpu(ste_buf->policy_code);
+ ste_buf->policy_version = be32_to_cpu(ste_buf->policy_version);
+ ste_buf->ste_max_types = be32_to_cpu(ste_buf->ste_max_types);
+ ste_buf->ste_max_ssidrefs = be32_to_cpu(ste_buf->ste_max_ssidrefs);
+ ste_buf->ste_ssid_offset = be32_to_cpu(ste_buf->ste_ssid_offset);
/* policy type and version checks */
if ((ste_buf->policy_code != ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY) ||
@@ -348,12 +348,12 @@ ste_dump_stats(u8 *buf, u16 buf_len)
struct acm_ste_stats_buffer stats;
/* now send the hook counts to user space */
- stats.ec_eval_count = htonl(atomic_read(&ste_bin_pol.ec_eval_count));
- stats.gt_eval_count = htonl(atomic_read(&ste_bin_pol.gt_eval_count));
- stats.ec_denied_count = htonl(atomic_read(&ste_bin_pol.ec_denied_count));
- stats.gt_denied_count = htonl(atomic_read(&ste_bin_pol.gt_denied_count));
- stats.ec_cachehit_count = htonl(atomic_read(&ste_bin_pol.ec_cachehit_count));
- stats.gt_cachehit_count = htonl(atomic_read(&ste_bin_pol.gt_cachehit_count));
+ stats.ec_eval_count = cpu_to_be32(atomic_read(&ste_bin_pol.ec_eval_count));
+ stats.gt_eval_count = cpu_to_be32(atomic_read(&ste_bin_pol.gt_eval_count));
+ stats.ec_denied_count = cpu_to_be32(atomic_read(&ste_bin_pol.ec_denied_count));
+ stats.gt_denied_count = cpu_to_be32(atomic_read(&ste_bin_pol.gt_denied_count));
+ stats.ec_cachehit_count = cpu_to_be32(atomic_read(&ste_bin_pol.ec_cachehit_count));
+ stats.gt_cachehit_count = cpu_to_be32(atomic_read(&ste_bin_pol.gt_cachehit_count));
if (buf_len < sizeof(struct acm_ste_stats_buffer))
return -ENOMEM;
diff --git a/xen/arch/ia64/linux-xen/perfmon.c b/xen/arch/ia64/linux-xen/perfmon.c
index cc776c631a..6ee588e26c 100644
--- a/xen/arch/ia64/linux-xen/perfmon.c
+++ b/xen/arch/ia64/linux-xen/perfmon.c
@@ -2305,7 +2305,7 @@ pfm_alloc_fd(struct file **cfile)
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
- sprintf(name, "[%lu]", inode->i_ino);
+ snprintf(name, sizeof(name), "[%lu]", inode->i_ino);
this.name = name;
this.len = strlen(name);
this.hash = inode->i_ino;
diff --git a/xen/arch/ia64/linux-xen/setup.c b/xen/arch/ia64/linux-xen/setup.c
index e725b1c960..548419b966 100644
--- a/xen/arch/ia64/linux-xen/setup.c
+++ b/xen/arch/ia64/linux-xen/setup.c
@@ -424,8 +424,7 @@ setup_arch (char **cmdline_p)
else
len = strlen (mvec_name);
len = min(len, sizeof (str) - 1);
- strncpy (str, mvec_name, len);
- str[len] = '\0';
+ strlcpy (str, mvec_name, len);
mvec_name = str;
} else
mvec_name = acpi_get_sysname();
@@ -551,7 +550,7 @@ show_cpuinfo (struct seq_file *m, void *v)
switch (c->family) {
case 0x07: memcpy(family, "Itanium", 8); break;
case 0x1f: memcpy(family, "Itanium 2", 10); break;
- default: sprintf(family, "%u", c->family); break;
+ default: snprintf(family, sizeof(family), "%u", c->family); break;
}
/* build the feature string: */
@@ -564,7 +563,7 @@ show_cpuinfo (struct seq_file *m, void *v)
*cp++ = sep;
sep = ',';
*cp++ = ' ';
- strcpy(cp, feature_bits[i].feature_name);
+ strlcpy(cp, feature_bits[i].feature_name, sizeof(features));
cp += strlen(feature_bits[i].feature_name);
mask &= ~feature_bits[i].mask;
}
@@ -573,7 +572,7 @@ show_cpuinfo (struct seq_file *m, void *v)
/* print unknown features as a hex value: */
if (sep)
*cp++ = sep;
- sprintf(cp, " 0x%lx", mask);
+ snprintf(cp, sizeof(features) - (cp - features), " 0x%lx", mask);
}
seq_printf(m,
diff --git a/xen/arch/ia64/linux-xen/sn/kernel/io_init.c b/xen/arch/ia64/linux-xen/sn/kernel/io_init.c
index 3f1f5b7a3c..72a3b18f85 100644
--- a/xen/arch/ia64/linux-xen/sn/kernel/io_init.c
+++ b/xen/arch/ia64/linux-xen/sn/kernel/io_init.c
@@ -754,7 +754,7 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address)
geoid = cnodeid_get_geoid(cnode);
moduleid = geo_module(geoid);
- sprintf(address, "module_%c%c%c%c%.2d",
+ snprintf(address, 15, "module_%c%c%c%c%.2d",
'0'+RACK_GET_CLASS(MODULE_GET_RACK(moduleid)),
'0'+RACK_GET_GROUP(MODULE_GET_RACK(moduleid)),
'0'+RACK_GET_NUM(MODULE_GET_RACK(moduleid)),
@@ -764,7 +764,7 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address)
bricktype = MODULE_GET_BTYPE(moduleid);
if ((bricktype == L1_BRICKTYPE_191010) ||
(bricktype == L1_BRICKTYPE_1932))
- sprintf(address, "%s^%d", address, geo_slot(geoid));
+ snprintf(address, 15+8, "%s^%d", address, geo_slot(geoid));
}
#endif
diff --git a/xen/arch/ia64/linux-xen/unaligned.c b/xen/arch/ia64/linux-xen/unaligned.c
index 2cf6e806dc..b56867a513 100644
--- a/xen/arch/ia64/linux-xen/unaligned.c
+++ b/xen/arch/ia64/linux-xen/unaligned.c
@@ -1792,7 +1792,7 @@ printk("ia64_handle_unaligned: called, not working yet\n");
char buf[200]; /* comm[] is at most 16 bytes... */
size_t len;
- len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, "
+ len = snprintf(buf, sizeof(buf), "%s(%d): unaligned access to 0x%016lx, "
"ip=0x%016lx\n\r", current->comm, current->pid,
ifa, regs->cr_iip + ipsr->ri);
/*
diff --git a/xen/arch/ia64/xen/dom_fw.c b/xen/arch/ia64/xen/dom_fw.c
index 8130486472..bc04d21b2a 100644
--- a/xen/arch/ia64/xen/dom_fw.c
+++ b/xen/arch/ia64/xen/dom_fw.c
@@ -333,13 +333,13 @@ dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables)
memset(tables, 0, sizeof(struct fake_acpi_tables));
/* setup XSDT (64bit version of RSDT) */
- strncpy(xsdt->signature, XSDT_SIG, 4);
+ memcpy(xsdt->signature, XSDT_SIG, sizeof(xsdt->signature));
/* XSDT points to both the FADT and the MADT, so add one entry */
xsdt->length = sizeof(struct xsdt_descriptor_rev2) + sizeof(u64);
xsdt->revision = 1;
- strcpy(xsdt->oem_id, "XEN");
- strcpy(xsdt->oem_table_id, "Xen/ia64");
- strcpy(xsdt->asl_compiler_id, "XEN");
+ memcpy(xsdt->oem_id, "XEN", 3);
+ memcpy(xsdt->oem_table_id, "Xen/ia64", 8);
+ memcpy(xsdt->asl_compiler_id, "XEN", 3);
xsdt->asl_compiler_revision = (xen_major_version() << 16) |
xen_minor_version();
@@ -349,16 +349,16 @@ dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables)
xsdt->checksum = generate_acpi_checksum(xsdt, xsdt->length);
/* setup FADT */
- strncpy(fadt->signature, FADT_SIG, 4);
+ memcpy(fadt->signature, FADT_SIG, sizeof(fadt->signature));
fadt->length = sizeof(struct fadt_descriptor_rev2);
fadt->revision = FADT2_REVISION_ID;
- strcpy(fadt->oem_id, "XEN");
- strcpy(fadt->oem_table_id, "Xen/ia64");
- strcpy(fadt->asl_compiler_id, "XEN");
+ memcpy(fadt->oem_id, "XEN", 3);
+ memcpy(fadt->oem_table_id, "Xen/ia64", 8);
+ memcpy(fadt->asl_compiler_id, "XEN", 3);
fadt->asl_compiler_revision = (xen_major_version() << 16) |
xen_minor_version();
- strncpy(facs->signature, FACS_SIG, 4);
+ memcpy(facs->signature, FACS_SIG, sizeof(facs->signature));
facs->version = 1;
facs->length = sizeof(struct facs_descriptor_rev2);
@@ -386,8 +386,8 @@ dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables)
fadt->checksum = generate_acpi_checksum(fadt, fadt->length);
/* setup RSDP */
- strncpy(rsdp->signature, RSDP_SIG, 8);
- strcpy(rsdp->oem_id, "XEN");
+ memcpy(rsdp->signature, RSDP_SIG, strlen(RSDP_SIG));
+ memcpy(rsdp->oem_id, "XEN", 3);
rsdp->revision = 2; /* ACPI 2.0 includes XSDT */
rsdp->length = sizeof(struct acpi20_table_rsdp);
rsdp->xsdt_address = ACPI_TABLE_MPA(xsdt);
@@ -397,11 +397,11 @@ dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables)
rsdp->ext_checksum = generate_acpi_checksum(rsdp, rsdp->length);
/* setup DSDT with trivial namespace. */
- strncpy(dsdt->signature, DSDT_SIG, 4);
+ memcpy(dsdt->signature, DSDT_SIG, strlen(DSDT_SIG));
dsdt->revision = 1;
- strcpy(dsdt->oem_id, "XEN");
- strcpy(dsdt->oem_table_id, "Xen/ia64");
- strcpy(dsdt->asl_compiler_id, "XEN");
+ memcpy(dsdt->oem_id, "XEN", 3);
+ memcpy(dsdt->oem_table_id, "Xen/ia64", 8);
+ memcpy(dsdt->asl_compiler_id, "XEN", 3);
dsdt->asl_compiler_revision = (xen_major_version() << 16) |
xen_minor_version();
@@ -409,7 +409,7 @@ dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables)
tables->aml[0] = 0x10; /* Scope */
tables->aml[1] = 0x40; /* length/offset to next object (patched) */
tables->aml[2] = 0x00;
- strncpy((char *)&tables->aml[3], "_SB_", 4);
+ memcpy(&tables->aml[3], "_SB_", 4);
/* The processor object isn't absolutely necessary, revist for SMP */
aml_len = 7;
@@ -437,11 +437,11 @@ dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables)
dsdt->checksum = generate_acpi_checksum(dsdt, dsdt->length);
/* setup MADT */
- strncpy(madt->header.signature, APIC_SIG, 4);
+ memcpy(madt->header.signature, APIC_SIG, sizeof(madt->header.signature));
madt->header.revision = 2;
- strcpy(madt->header.oem_id, "XEN");
- strcpy(madt->header.oem_table_id, "Xen/ia64");
- strcpy(madt->header.asl_compiler_id, "XEN");
+ memcpy(madt->header.oem_id, "XEN", 3);
+ memcpy(madt->header.oem_table_id, "Xen/ia64", 8);
+ memcpy(madt->header.asl_compiler_id, "XEN", 3);
madt->header.asl_compiler_revision = (xen_major_version() << 16) |
xen_minor_version();
@@ -770,8 +770,8 @@ dom_fw_init(struct domain *d,
tables->sal_systab.sal_rev_major = 0;
tables->sal_systab.entry_count = 2;
- strcpy((char *)tables->sal_systab.oem_id, "Xen/ia64");
- strcpy((char *)tables->sal_systab.product_id, "Xen/ia64");
+ memcpy((char *)tables->sal_systab.oem_id, "Xen/ia64", 8);
+ memcpy((char *)tables->sal_systab.product_id, "Xen/ia64", 8);
/* PAL entry point: */
tables->sal_ed.type = SAL_DESC_ENTRY_POINT;
diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c
index 314f2c79b1..4f870ff7cd 100644
--- a/xen/arch/ia64/xen/domain.c
+++ b/xen/arch/ia64/xen/domain.c
@@ -1146,7 +1146,7 @@ int construct_dom0(struct domain *d,
panic("can't allocate start info page");
si = page_to_virt(start_info_page);
memset(si, 0, PAGE_SIZE);
- sprintf(si->magic, "xen-%i.%i-ia64",
+ snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-ia64",
xen_major_version(), xen_minor_version());
si->nr_pages = max_pages;
si->flags = SIF_INITDOMAIN|SIF_PRIVILEGED;
@@ -1162,8 +1162,7 @@ int construct_dom0(struct domain *d,
dom_fw_setup(d, bp_mpa, max_pages * PAGE_SIZE);
/* Fill boot param. */
- strncpy((char *)si->cmd_line, dom0_command_line, sizeof(si->cmd_line));
- si->cmd_line[sizeof(si->cmd_line)-1] = 0;
+ strlcpy((char *)si->cmd_line, dom0_command_line, sizeof(si->cmd_line));
bp = (struct ia64_boot_param *)((unsigned char *)si +
sizeof(start_info_t));
diff --git a/xen/arch/ia64/xen/gdbstub.c b/xen/arch/ia64/xen/gdbstub.c
index 446b7a8c5e..548ec6e51a 100644
--- a/xen/arch/ia64/xen/gdbstub.c
+++ b/xen/arch/ia64/xen/gdbstub.c
@@ -289,13 +289,13 @@ gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
}
dbg_printk("Register read regnum = 0x%lx, val = 0x%lx\n", regnum, reg);
- sprintf(buf, "%.08lx", swab64(reg));
+ snprintf(buf, sizeof(buf), "%.08lx", swab64(reg));
out:
return gdb_send_reply(buf, ctx);
out_err:
dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
- sprintf(buf, "%s", "x");
+ safe_strcpy(buf, "x");
goto out;
}
#else
@@ -639,7 +639,7 @@ kgdb_get_reg(int regnum, struct unw_frame_info *info,
outbuffer[size*2] = 0;
}
else
- strcpy(outbuffer, "E0");
+ strlcpy(outbuffer, "E0", sizeof("E0"));
return;
#else
@@ -756,19 +756,19 @@ gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
if (arg.error > 0) {
// notify gdb that this register is not supported.
// see fetch_register_using_p() in gdb/remote.c.
- sprintf(buf, "%s", "x");
+ safe_strcpy(buf, "x");
} else if (IA64_FR0_REGNUM <= regnum && regnum <= IA64_FR0_REGNUM + 127) {
- sprintf(buf, "%.016lx", swab64(freg.u.bits[0]));
- sprintf(buf + 16, "%.016lx", swab64(freg.u.bits[1]));
+ snprintf(buf, sizeof(buf), "%.016lx", swab64(freg.u.bits[0]));
+ snprintf(buf + 16, sizeof(buf) - 16, "%.016lx", swab64(freg.u.bits[1]));
} else {
- sprintf(buf, "%.016lx", swab64(reg));
+ snprintf(buf, sizeof(buf), "%.016lx", swab64(reg));
}
out:
return gdb_send_reply(buf, ctx);
out_err:
dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
- sprintf(buf, "%s", "E0");
+ safe_strcpy(buf, "E0");
goto out;
}
#endif
diff --git a/xen/arch/ia64/xen/oprofile/perfmon.c b/xen/arch/ia64/xen/oprofile/perfmon.c
index 3a26a04dd9..0488e1298b 100644
--- a/xen/arch/ia64/xen/oprofile/perfmon.c
+++ b/xen/arch/ia64/xen/oprofile/perfmon.c
@@ -119,8 +119,7 @@ int
xenoprof_arch_init(int *num_events, int *is_primary, char *cpu_type)
{
*num_events = 0;
- strncpy(cpu_type, get_cpu_type(), XENOPROF_CPU_TYPE_SIZE - 1);
- cpu_type[XENOPROF_CPU_TYPE_SIZE - 1] = '\0';
+ strlcpy(cpu_type, get_cpu_type(), XENOPROF_CPU_TYPE_SIZE);
*is_primary = 0;
if (xenoprof_primary_profiler == NULL) {
diff --git a/xen/arch/ia64/xen/xensetup.c b/xen/arch/ia64/xen/xensetup.c
index e63378cd23..84a93d5046 100644
--- a/xen/arch/ia64/xen/xensetup.c
+++ b/xen/arch/ia64/xen/xensetup.c
@@ -553,20 +553,21 @@ printk("num_online_cpus=%d, max_cpus=%d\n",num_online_cpus(),max_cpus);
startup_cpu_idle_loop();
}
-void arch_get_xen_caps(xen_capabilities_info_t info)
+void arch_get_xen_caps(xen_capabilities_info_t *info)
{
- char *p=info;
int major = xen_major_version();
int minor = xen_minor_version();
+ char s[32];
- p += sprintf(p,"xen-%d.%d-ia64 ", major, minor);
+ (*info)[0] = '\0';
- if (vmx_enabled)
- p += sprintf(p,"hvm-%d.%d-ia64 ", major, minor);
-
- *(p-1) = 0;
-
- BUG_ON((p-info)>sizeof(xen_capabilities_info_t));
+ snprintf(s, sizeof(s), "xen-%d.%d-ia64 ", major, minor);
+ safe_strcat(*info, s);
+ if (vmx_enabled)
+ {
+ snprintf(s, sizeof(s), "hvm-%d.%d-ia64 ", major, minor);
+ safe_strcat(*info, s);
+ }
}
diff --git a/xen/arch/powerpc/domain_build.c b/xen/arch/powerpc/domain_build.c
index 0f283678f8..080c1ab1b6 100644
--- a/xen/arch/powerpc/domain_build.c
+++ b/xen/arch/powerpc/domain_build.c
@@ -185,7 +185,7 @@ int construct_dom0(struct domain *d,
si = (start_info_t *)(rma_addr(&d->arch, RMA_START_INFO) + rma);
printk("xen_start_info: %p\n", si);
- sprintf(si->magic, "xen-%i.%i-powerpc%d%s",
+ snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-powerpc%d%s",
xen_major_version(), xen_minor_version(), BITS_PER_LONG, "HV");
si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
@@ -290,7 +290,7 @@ int construct_dom0(struct domain *d,
memset(si->cmd_line, 0, sizeof(si->cmd_line));
if ( cmdline != NULL )
- strncpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)-1);
+ strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line));
v->arch.ctxt.msr = msr;
v->arch.ctxt.pc = pc;
diff --git a/xen/arch/powerpc/of-devtree.c b/xen/arch/powerpc/of-devtree.c
index 03ac256738..9296a4505a 100644
--- a/xen/arch/powerpc/of-devtree.c
+++ b/xen/arch/powerpc/of-devtree.c
@@ -358,8 +358,7 @@ static ofdn_t ofd_node_create(
n->on_io = 0;
n->on_pathlen = pathlen;
n->on_last = ofd_pathsplit_left(path, '/', pathlen);
- strncpy(n->on_path, path, pathlen);
- n->on_path[n->on_pathlen] = 0;
+ strlcpy(n->on_path, path, pathlen);
return pos;
}
diff --git a/xen/arch/powerpc/ofd_fixup.c b/xen/arch/powerpc/ofd_fixup.c
index d4cae92f31..c05daf8b35 100644
--- a/xen/arch/powerpc/ofd_fixup.c
+++ b/xen/arch/powerpc/ofd_fixup.c
@@ -267,7 +267,7 @@ static ofdn_t ofd_chosen_props(void *m, const char *cmdline)
&path[1], sizeof (path) - 1);
}
- strcpy(bootargs, cmdline);
+ strlcpy(bootargs, cmdline, sizeof(bootargs));
bsz = strlen(bootargs) + 1;
rm = sizeof (bootargs) - bsz;
diff --git a/xen/arch/powerpc/setup.c b/xen/arch/powerpc/setup.c
index 440acbbb1e..ad4ea33fe2 100644
--- a/xen/arch/powerpc/setup.c
+++ b/xen/arch/powerpc/setup.c
@@ -444,8 +444,8 @@ void __init __start_xen_ppc(
}
-extern void arch_get_xen_caps(xen_capabilities_info_t info);
-void arch_get_xen_caps(xen_capabilities_info_t info)
+extern void arch_get_xen_caps(xen_capabilities_info_t *info);
+void arch_get_xen_caps(xen_capabilities_info_t *info)
{
}
diff --git a/xen/arch/x86/cpu/centaur.c b/xen/arch/x86/cpu/centaur.c
index 09e5498c2d..7744b5b5e5 100644
--- a/xen/arch/x86/cpu/centaur.c
+++ b/xen/arch/x86/cpu/centaur.c
@@ -437,7 +437,8 @@ static void __init init_centaur(struct cpuinfo_x86 *c)
/* Add L1 data and code cache sizes. */
c->x86_cache_size = (cc>>24)+(dd>>24);
}
- sprintf( c->x86_model_id, "WinChip %s", name );
+ snprintf( c->x86_model_id, sizeof(c->x86_model_id),
+ "WinChip %s", name );
break;
case 6:
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 63237c82f4..956bd190a1 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -30,9 +30,9 @@ static void default_init(struct cpuinfo_x86 * c)
if (c->cpuid_level == -1) {
/* No cpuid. It must be an ancient CPU */
if (c->x86 == 4)
- strcpy(c->x86_model_id, "486");
+ safe_strcpy(c->x86_model_id, "486");
else if (c->x86 == 3)
- strcpy(c->x86_model_id, "386");
+ safe_strcpy(c->x86_model_id, "386");
}
}
@@ -383,11 +383,11 @@ void __devinit identify_cpu(struct cpuinfo_x86 *c)
char *p;
p = table_lookup_model(c);
if ( p )
- strcpy(c->x86_model_id, p);
+ safe_strcpy(c->x86_model_id, p);
else
/* Last resort... */
- sprintf(c->x86_model_id, "%02x/%02x",
- c->x86_vendor, c->x86_model);
+ snprintf(c->x86_model_id, sizeof(c->x86_model_id),
+ "%02x/%02x", c->x86_vendor, c->x86_model);
}
/* Now the feature flags better reflect actual CPU features! */
diff --git a/xen/arch/x86/cpu/cyrix.c b/xen/arch/x86/cpu/cyrix.c
index d44f6e890e..705afbf18f 100644
--- a/xen/arch/x86/cpu/cyrix.c
+++ b/xen/arch/x86/cpu/cyrix.c
@@ -181,7 +181,6 @@ static void __init geode_configure(void)
static void __init init_cyrix(struct cpuinfo_x86 *c)
{
unsigned char dir0, dir0_msn, dir0_lsn, dir1 = 0;
- char *buf = c->x86_model_id;
const char *p = NULL;
/* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
@@ -302,8 +301,8 @@ static void __init init_cyrix(struct cpuinfo_x86 *c)
dir0_msn = 7;
break;
}
- strcpy(buf, Cx86_model[dir0_msn & 7]);
- if (p) strcat(buf, p);
+ safe_strcpy(c->x86_model_id, Cx86_model[dir0_msn & 7]);
+ if (p) safe_strcat(c->x86_model_id, p);
return;
}
@@ -339,7 +338,7 @@ static void cyrix_identify(struct cpuinfo_x86 * c)
if ( c->x86 == 4 && test_cyrix_52div() ) {
unsigned char dir0, dir1;
- strcpy(c->x86_vendor_id, "CyrixInstead");
+ safe_strcpy(c->x86_vendor_id, "CyrixInstead");
c->x86_vendor = X86_VENDOR_CYRIX;
/* Actually enable cpuid on the older cyrix */
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 1aff3d0d4f..5fcad2403a 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -152,7 +152,7 @@ static void __devinit init_intel(struct cpuinfo_x86 *c)
}
if ( p )
- strcpy(c->x86_model_id, p);
+ safe_strcpy(c->x86_model_id, p);
c->x86_max_cores = num_cpu_cores(c);
diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 89b65b7a3c..2d49d412fc 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -159,7 +159,7 @@ static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
return;
dmi_ident[slot] = alloc_bootmem(strlen(p)+1);
if(dmi_ident[slot])
- strcpy(dmi_ident[slot], p);
+ safe_strcpy(dmi_ident[slot], p);
else
printk(KERN_ERR "dmi_save_ident: out of memory.\n");
}
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index a99871c72a..653ceafb0b 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1412,7 +1412,13 @@ static void vcpu_destroy_pagetables(struct vcpu *v)
put_page_and_type(mfn_to_page(pfn));
}
- v->arch.guest_table = pagetable_null();
+ if ( is_hvm_vcpu(v) )
+ v->arch.guest_table = pagetable_null();
+ else
+ l4e_write(
+ (l4_pgentry_t *) __va(pagetable_get_paddr(v->arch.guest_table)),
+ l4e_empty());
+
v->arch.cr3 = 0;
return;
}
diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
index 5e505bf4af..b32f57861c 100644
--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -821,7 +821,7 @@ int construct_dom0(struct domain *d,
si->pt_base = vpt_start + 2 * PAGE_SIZE * !!IS_COMPAT(d);
si->nr_pt_frames = nr_pt_pages;
si->mfn_list = vphysmap_start;
- sprintf(si->magic, "xen-%i.%i-x86_%d%s",
+ snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-x86_%d%s",
xen_major_version(), xen_minor_version(),
elf_64bit(&elf) ? 64 : 32,
parms.pae ? "p" : "");
@@ -871,7 +871,7 @@ int construct_dom0(struct domain *d,
memset(si->cmd_line, 0, sizeof(si->cmd_line));
if ( cmdline != NULL )
- strncpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)-1);
+ strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line));
if ( fill_console_start_info((void *)(si + 1)) )
{
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 9646b96507..db18c7cecf 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -290,7 +290,6 @@ long arch_do_domctl(
{
struct hvm_domain_context *c;
struct domain *d;
- struct vcpu *v;
ret = -ESRCH;
if ( (d = get_domain_by_id(domctl->domain)) == NULL )
@@ -299,15 +298,18 @@ long arch_do_domctl(
ret = -ENOMEM;
if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
goto sethvmcontext_out;
-
- v = d->vcpu[0];
ret = -EFAULT;
-
if ( copy_from_guest(c, domctl->u.hvmcontext.ctxt, 1) != 0 )
goto sethvmcontext_out;
+ c->size = sizeof (c->data);
+ c->cur = 0;
+
+ ret = -EINVAL;
+ if ( !is_hvm_domain(d) )
+ goto sethvmcontext_out;
- ret = arch_sethvm_ctxt(v, c);
+ ret = hvm_load(d, c);
xfree(c);
@@ -321,7 +323,6 @@ long arch_do_domctl(
{
struct hvm_domain_context *c;
struct domain *d;
- struct vcpu *v;
ret = -ESRCH;
if ( (d = get_domain_by_id(domctl->domain)) == NULL )
@@ -330,15 +331,15 @@ long arch_do_domctl(
ret = -ENOMEM;
if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
goto gethvmcontext_out;
-
- v = d->vcpu[0];
-
+ memset(c, 0, sizeof(*c));
+ c->size = sizeof (c->data);
+
ret = -ENODATA;
- if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
+ if ( !is_hvm_domain(d) )
goto gethvmcontext_out;
ret = 0;
- if (arch_gethvm_ctxt(v, c) == -1)
+ if (hvm_save(d, c) != 0)
ret = -EFAULT;
if ( copy_to_guest(domctl->u.hvmcontext.ctxt, c, 1) )
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d863ac769d..3ecaf9d7de 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -168,19 +168,11 @@ int hvm_domain_initialise(struct domain *d)
void hvm_domain_destroy(struct domain *d)
{
- HVMStateEntry *se, *dse;
pit_deinit(d);
rtc_deinit(d);
pmtimer_deinit(d);
hpet_deinit(d);
- se = d->arch.hvm_domain.first_se;
- while (se) {
- dse = se;
- se = se->next;
- xfree(dse);
- }
-
if ( d->arch.hvm_domain.shared_page_va )
unmap_domain_page_global(
(void *)d->arch.hvm_domain.shared_page_va);
@@ -189,45 +181,58 @@ void hvm_domain_destroy(struct domain *d)
unmap_domain_page_global((void *)d->arch.hvm_domain.buffered_io_va);
}
-#define HVM_VCPU_CTXT_MAGIC 0x85963130
-void hvm_save_cpu_ctxt(hvm_domain_context_t *h, void *opaque)
+static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
{
- struct vcpu *v = opaque;
+ struct vcpu *v;
+ struct hvm_hw_cpu ctxt;
- if ( test_bit(_VCPUF_down, &v->vcpu_flags) ) {
- hvm_put_32u(h, 0x0);
- return;
+ for_each_vcpu(d, v)
+ {
+ /* We don't need to save state for a vcpu that is down; the restore
+ * code will leave it down if there is nothing saved. */
+ if ( test_bit(_VCPUF_down, &v->vcpu_flags) )
+ continue;
+
+ hvm_funcs.save_cpu_ctxt(v, &ctxt);
+ if ( hvm_save_entry(CPU, v->vcpu_id, h, &ctxt) != 0 )
+ return 1;
}
-
- hvm_put_32u(h, HVM_VCPU_CTXT_MAGIC);
- hvm_funcs.save_cpu_ctxt(h, opaque);
+ return 0;
}
-int hvm_load_cpu_ctxt(hvm_domain_context_t *h, void *opaque, int version)
+static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
{
- struct vcpu *v = opaque;
+ int vcpuid;
+ struct vcpu *v;
+ struct hvm_hw_cpu ctxt;
- if ( hvm_get_32u(h) != HVM_VCPU_CTXT_MAGIC )
- return 0;
+ /* Which vcpu is this? */
+ vcpuid = hvm_load_instance(h);
+ if ( vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL )
+ {
+ gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+ return -EINVAL;
+ }
+
+ if ( hvm_load_entry(CPU, h, &ctxt) != 0 )
+ return -EINVAL;
- if ( hvm_funcs.load_cpu_ctxt(h, opaque, version) < 0 )
+ if ( hvm_funcs.load_cpu_ctxt(v, &ctxt) < 0 )
return -EINVAL;
- /* Auxiliary processors shoudl be woken immediately. */
+ /* Auxiliary processors should be woken immediately. */
if ( test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) )
vcpu_wake(v);
return 0;
}
+HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_cpu_ctxt, hvm_load_cpu_ctxt);
+
int hvm_vcpu_initialise(struct vcpu *v)
{
int rc;
- hvm_register_savevm(v->domain, "xen_hvm_cpu", v->vcpu_id, 1,
- hvm_save_cpu_ctxt, hvm_load_cpu_ctxt,
- (void *)v);
-
if ( (rc = vlapic_init(v)) != 0 )
return rc;
@@ -249,13 +254,10 @@ int hvm_vcpu_initialise(struct vcpu *v)
return 0;
pit_init(v, cpu_khz);
- rtc_init(v, RTC_PORT(0), RTC_IRQ);
+ rtc_init(v, RTC_PORT(0));
pmtimer_init(v, ACPI_PM_TMR_BLK_ADDRESS);
hpet_init(v);
- /* init hvm sharepage */
- shpage_init(v->domain, get_sp(v->domain));
-
/* Init guest TSC to start from zero. */
hvm_set_guest_time(v, 0);
diff --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/hvm/i8254.c
index 61f997c051..5473f914f4 100644
--- a/xen/arch/x86/hvm/i8254.c
+++ b/xen/arch/x86/hvm/i8254.c
@@ -411,35 +411,31 @@ static void pit_info(PITState *pit)
}
#endif
-static void pit_save(hvm_domain_context_t *h, void *opaque)
+static int pit_save(struct domain *d, hvm_domain_context_t *h)
{
- struct domain *d = opaque;
PITState *pit = &d->arch.hvm_domain.pl_time.vpit;
pit_info(pit);
/* Save the PIT hardware state */
- hvm_put_struct(h, &pit->hw);
+ return hvm_save_entry(PIT, 0, h, &pit->hw);
}
-static int pit_load(hvm_domain_context_t *h, void *opaque, int version_id)
+static int pit_load(struct domain *d, hvm_domain_context_t *h)
{
- struct domain *d = opaque;
PITState *pit = &d->arch.hvm_domain.pl_time.vpit;
int i;
- if (version_id != 1)
- return -EINVAL;
-
/* Restore the PIT hardware state */
- hvm_get_struct(h, &pit->hw);
+ if ( hvm_load_entry(PIT, h, &pit->hw) )
+ return 1;
/* Recreate platform timers from hardware state. There will be some
* time jitter here, but the wall-clock will have jumped massively, so
* we hope the guest can handle it. */
for(i = 0; i < 3; i++) {
- pit_load_count(pit, i, pit_get_count(pit, i));
+ pit_load_count(pit, i, pit->hw.channels[i].count);
pit->pt[i].last_plt_gtime = hvm_get_guest_time(d->vcpu[0]);
}
@@ -447,6 +443,8 @@ static int pit_load(hvm_domain_context_t *h, void *opaque, int version_id)
return 0;
}
+HVM_REGISTER_SAVE_RESTORE(PIT, pit_save, pit_load);
+
static void pit_reset(void *opaque)
{
PITState *pit = opaque;
@@ -474,7 +472,6 @@ void pit_init(struct vcpu *v, unsigned long cpu_khz)
pt++; pt->vcpu = v;
pt++; pt->vcpu = v;
- hvm_register_savevm(v->domain, "xen_hvm_i8254", PIT_BASE, 1, pit_save, pit_load, v->domain);
register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io);
/* register the speaker port */
register_portio_handler(v->domain, 0x61, 1, handle_speaker_io);
diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c
index 9a454c6290..802f67e077 100644
--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -157,307 +157,179 @@ static inline void hvm_mmio_access(struct vcpu *v,
}
}
-
-int hvm_register_savevm(struct domain *d,
- const char *idstr,
- int instance_id,
- int version_id,
- SaveStateHandler *save_state,
- LoadStateHandler *load_state,
- void *opaque)
+/* List of handlers for various HVM save and restore types */
+static struct {
+ hvm_save_handler save;
+ hvm_load_handler load;
+ const char *name;
+} hvm_sr_handlers [HVM_SAVE_CODE_MAX + 1] = {{NULL, NULL, "<?>"},};
+
+/* Init-time function to add entries to that list */
+void hvm_register_savevm(uint16_t typecode,
+ const char *name,
+ hvm_save_handler save_state,
+ hvm_load_handler load_state)
{
- HVMStateEntry *se, **pse;
-
- if ( (se = xmalloc(struct HVMStateEntry)) == NULL ){
- printk("allocat hvmstate entry fail.\n");
- return -1;
- }
-
- strncpy(se->idstr, idstr, HVM_SE_IDSTR_LEN);
-
- se->instance_id = instance_id;
- se->version_id = version_id;
- se->save_state = save_state;
- se->load_state = load_state;
- se->opaque = opaque;
- se->next = NULL;
-
- /* add at the end of list */
- pse = &d->arch.hvm_domain.first_se;
- while (*pse != NULL)
- pse = &(*pse)->next;
- *pse = se;
- return 0;
+ ASSERT(typecode <= HVM_SAVE_CODE_MAX);
+ ASSERT(hvm_sr_handlers[typecode].save == NULL);
+ ASSERT(hvm_sr_handlers[typecode].load == NULL);
+ hvm_sr_handlers[typecode].save = save_state;
+ hvm_sr_handlers[typecode].load = load_state;
+ hvm_sr_handlers[typecode].name = name;
}
-int hvm_save(struct vcpu *v, hvm_domain_context_t *h)
+
+int hvm_save(struct domain *d, hvm_domain_context_t *h)
{
- uint32_t len, len_pos, cur_pos;
uint32_t eax, ebx, ecx, edx;
- HVMStateEntry *se;
- char *chgset;
+ char *c;
struct hvm_save_header hdr;
-
- if (!is_hvm_vcpu(v)) {
- printk("hvm_save only for hvm guest!\n");
- return -1;
- }
-
- memset(h, 0, sizeof(hvm_domain_context_t));
+ struct hvm_save_end end;
+ hvm_save_handler handler;
+ uint16_t i;
hdr.magic = HVM_FILE_MAGIC;
hdr.version = HVM_FILE_VERSION;
+
+ /* Save some CPUID bits */
cpuid(1, &eax, &ebx, &ecx, &edx);
hdr.cpuid = eax;
- hvm_put_struct(h, &hdr);
-
- /* save xen changeset */
- chgset = strrchr(XEN_CHANGESET, ' ');
- if ( chgset )
- chgset++;
- else
- chgset = XEN_CHANGESET;
-
- len = strlen(chgset);
- hvm_put_8u(h, len);
- hvm_put_buffer(h, chgset, len);
-
- for(se = v->domain->arch.hvm_domain.first_se; se != NULL; se = se->next) {
- /* ID string */
- len = strnlen(se->idstr, HVM_SE_IDSTR_LEN);
- hvm_put_8u(h, len);
- hvm_put_buffer(h, se->idstr, len);
- hvm_put_32u(h, se->instance_id);
- hvm_put_32u(h, se->version_id);
+ /* Save xen changeset */
+ c = strrchr(XEN_CHANGESET, ':');
+ if ( c )
+ hdr.changeset = simple_strtoll(c, NULL, 16);
+ else
+ hdr.changeset = -1ULL; /* Unknown */
- /* record size */
- len_pos = hvm_ctxt_tell(h);
- hvm_put_32u(h, 0);
-
- se->save_state(h, se->opaque);
-
- cur_pos = hvm_ctxt_tell(h);
- len = cur_pos - len_pos - 4;
- hvm_ctxt_seek(h, len_pos);
- hvm_put_32u(h, len);
- hvm_ctxt_seek(h, cur_pos);
+ if ( hvm_save_entry(HEADER, 0, h, &hdr) != 0 )
+ {
+ gdprintk(XENLOG_ERR, "HVM save: failed to write header\n");
+ return -1;
+ }
+ /* Save all available kinds of state */
+ for ( i = 0; i <= HVM_SAVE_CODE_MAX; i++ )
+ {
+ handler = hvm_sr_handlers[i].save;
+ if ( handler != NULL )
+ {
+ gdprintk(XENLOG_INFO, "HVM save: %s\n", hvm_sr_handlers[i].name);
+ if ( handler(d, h) != 0 )
+ {
+ gdprintk(XENLOG_ERR,
+ "HVM save: failed to save type %"PRIu16"\n", i);
+ return -1;
+ }
+ }
}
- h->size = hvm_ctxt_tell(h);
- hvm_ctxt_seek(h, 0);
-
- if (h->size >= HVM_CTXT_SIZE) {
- printk("hvm_domain_context overflow when hvm_save! need %"PRId32" bytes for use.\n", h->size);
+ /* Save an end-of-file marker */
+ if ( hvm_save_entry(END, 0, h, &end) != 0 )
+ {
+ /* Run out of data */
+ gdprintk(XENLOG_ERR, "HVM save: no room for end marker.\n");
return -1;
}
+ /* Save macros should not have let us overrun */
+ ASSERT(h->cur <= h->size);
return 0;
-
-}
-
-static HVMStateEntry *find_se(struct domain *d, const char *idstr, int instance_id)
-{
- HVMStateEntry *se;
-
- for(se = d->arch.hvm_domain.first_se; se != NULL; se = se->next) {
- if (!strncmp(se->idstr, idstr, HVM_SE_IDSTR_LEN) &&
- instance_id == se->instance_id){
- return se;
- }
- }
- return NULL;
}
-int hvm_load(struct vcpu *v, hvm_domain_context_t *h)
+int hvm_load(struct domain *d, hvm_domain_context_t *h)
{
- uint32_t len, rec_len, rec_pos, instance_id, version_id;
uint32_t eax, ebx, ecx, edx;
- HVMStateEntry *se;
- char idstr[HVM_SE_IDSTR_LEN];
- xen_changeset_info_t chgset;
- char *cur_chgset;
- int ret;
+ char *c;
+ uint64_t cset;
struct hvm_save_header hdr;
-
- if (!is_hvm_vcpu(v)) {
- printk("hvm_load only for hvm guest!\n");
- return -1;
- }
-
- if (h->size >= HVM_CTXT_SIZE) {
- printk("hvm_load fail! seems hvm_domain_context overflow when hvm_save! need %"PRId32" bytes.\n", h->size);
+ struct hvm_save_descriptor *desc;
+ hvm_load_handler handler;
+ struct vcpu *v;
+
+ /* Read the save header, which must be first */
+ if ( hvm_load_entry(HEADER, h, &hdr) != 0 )
return -1;
- }
-
- hvm_ctxt_seek(h, 0);
-
- hvm_get_struct(h, &hdr);
if (hdr.magic != HVM_FILE_MAGIC) {
- printk("HVM restore magic dismatch!\n");
+ gdprintk(XENLOG_ERR,
+ "HVM restore: bad magic number %#"PRIx32"\n", hdr.magic);
return -1;
}
if (hdr.version != HVM_FILE_VERSION) {
- printk("HVM restore version dismatch!\n");
+ gdprintk(XENLOG_ERR,
+ "HVM restore: unsupported version %u\n", hdr.version);
return -1;
}
- /* check cpuid */
cpuid(1, &eax, &ebx, &ecx, &edx);
- /*TODO: need difine how big difference is acceptable */
+ /*TODO: need to define how big a difference is acceptable */
if (hdr.cpuid != eax)
- printk("warnings: try to restore hvm guest(0x%"PRIx32") "
- "on a different type processor(0x%"PRIx32").\n",
- hdr.cpuid,
- eax);
+ gdprintk(XENLOG_WARNING, "HVM restore: saved CPUID (%#"PRIx32") "
+ "does not match host (%#"PRIx32").\n", hdr.cpuid, eax);
- /* check xen change set */
- cur_chgset = strrchr(XEN_CHANGESET, ' ');
- if ( cur_chgset )
- cur_chgset++;
+ c = strrchr(XEN_CHANGESET, ':');
+ if ( hdr.changeset == -1ULL )
+ gdprintk(XENLOG_WARNING,
+ "HVM restore: Xen changeset was not saved.\n");
+ else if ( c == NULL )
+ gdprintk(XENLOG_WARNING,
+ "HVM restore: Xen changeset is not available.\n");
else
- cur_chgset = XEN_CHANGESET;
-
- len = hvm_get_8u(h);
- if (len > 20) { /*typical length is 18 -- "revision number:changeset id" */
- printk("wrong change set length %d when hvm restore!\n", len);
- return -1;
+ {
+ cset = simple_strtoll(c, NULL, 16);
+ if ( hdr.changeset != cset )
+ gdprintk(XENLOG_WARNING, "HVM restore: saved Xen changeset (%#"PRIx64
+ ") does not match host (%#"PRIx64").\n", hdr.changeset, cset);
}
- hvm_get_buffer(h, chgset, len);
- chgset[len] = '\0';
- if (strncmp(cur_chgset, chgset, len + 1))
- printk("warnings: try to restore hvm guest(%s) on a different changeset %s.\n",
- chgset, cur_chgset);
-
-
- if ( !strcmp(cur_chgset, "unavailable") )
- printk("warnings: try to restore hvm guest when changeset is unavailable.\n");
-
+ /* Down all the vcpus: we only re-enable the ones that had state saved. */
+ for_each_vcpu(d, v)
+ if ( test_and_set_bit(_VCPUF_down, &v->vcpu_flags) )
+ vcpu_sleep_nosync(v);
while(1) {
- if (hvm_ctxt_end(h)) {
- break;
- }
- /* ID string */
- len = hvm_get_8u(h);
- if (len > HVM_SE_IDSTR_LEN) {
- printk("wrong HVM save entry idstr len %d!", len);
+ if ( h->size - h->cur < sizeof(struct hvm_save_descriptor) )
+ {
+ /* Run out of data */
+ gdprintk(XENLOG_ERR,
+ "HVM restore: save did not end with a null entry\n");
return -1;
}
-
- hvm_get_buffer(h, idstr, len);
- idstr[len] = '\0';
-
- instance_id = hvm_get_32u(h);
- version_id = hvm_get_32u(h);
-
- printk("HVM S/R Loading \"%s\" instance %#x\n", idstr, instance_id);
-
- rec_len = hvm_get_32u(h);
- rec_pos = hvm_ctxt_tell(h);
-
- se = find_se(v->domain, idstr, instance_id);
- if (se == NULL) {
- printk("warnings: hvm load can't find device %s's instance %d!\n",
- idstr, instance_id);
- } else {
- ret = se->load_state(h, se->opaque, version_id);
- if (ret < 0)
- printk("warnings: loading state fail for device %s instance %d!\n",
- idstr, instance_id);
+
+ /* Read the typecode of the next entry and check for the end-marker */
+ desc = (struct hvm_save_descriptor *)(&h->data[h->cur]);
+ if ( desc->typecode == 0 )
+ return 0;
+
+ /* Find the handler for this entry */
+ if ( desc->typecode > HVM_SAVE_CODE_MAX
+ || (handler = hvm_sr_handlers[desc->typecode].load) == NULL )
+ {
+ gdprintk(XENLOG_ERR,
+ "HVM restore: unknown entry typecode %u\n",
+ desc->typecode);
+ return -1;
}
-
- /* make sure to jump end of record */
- if ( hvm_ctxt_tell(h) - rec_pos != rec_len) {
- printk("wrong hvm record size, maybe some dismatch between save&restore handler!\n");
+ /* Load the entry */
+ gdprintk(XENLOG_INFO, "HVM restore: %s %"PRIu16"\n",
+ hvm_sr_handlers[desc->typecode].name, desc->instance);
+ if ( handler(d, h) != 0 )
+ {
+ gdprintk(XENLOG_ERR,
+ "HVM restore: failed to load entry %u/%u\n",
+ desc->typecode, desc->instance);
+ return -1;
}
- hvm_ctxt_seek(h, rec_pos + rec_len);
}
- return 0;
-}
-
-int arch_gethvm_ctxt(
- struct vcpu *v, struct hvm_domain_context *c)
-{
- if ( !is_hvm_vcpu(v) )
- return -1;
-
- return hvm_save(v, c);
-
-}
-
-int arch_sethvm_ctxt(
- struct vcpu *v, struct hvm_domain_context *c)
-{
- return hvm_load(v, c);
-}
-
-#ifdef HVM_DEBUG_SUSPEND
-static void shpage_info(shared_iopage_t *sh)
-{
-
- vcpu_iodata_t *p = &sh->vcpu_iodata[0];
- ioreq_t *req = &p->vp_ioreq;
- printk("*****sharepage_info******!\n");
- printk("vp_eport=%d\n", p->vp_eport);
- printk("io packet: "
- "state:%x, pvalid: %x, dir:%x, port: %"PRIx64", "
- "data: %"PRIx64", count: %"PRIx64", size: %"PRIx64"\n",
- req->state, req->data_is_ptr, req->dir, req->addr,
- req->data, req->count, req->size);
-}
-#else
-static void shpage_info(shared_iopage_t *sh)
-{
+ /* Not reached */
}
-#endif
-
-static void shpage_save(hvm_domain_context_t *h, void *opaque)
-{
- /* XXX:no action required for shpage save/restore, since it's in guest memory
- * keep it for debug purpose only */
-#if 0
- struct shared_iopage *s = opaque;
- /* XXX:smp */
- struct ioreq *req = &s->vcpu_iodata[0].vp_ioreq;
-
- shpage_info(s);
-
- hvm_put_buffer(h, (char*)req, sizeof(struct ioreq));
-#endif
-}
-
-static int shpage_load(hvm_domain_context_t *h, void *opaque, int version_id)
-{
- struct shared_iopage *s = opaque;
-#if 0
- /* XXX:smp */
- struct ioreq *req = &s->vcpu_iodata[0].vp_ioreq;
-
- if (version_id != 1)
- return -EINVAL;
-
- hvm_get_buffer(h, (char*)req, sizeof(struct ioreq));
-
-
-#endif
- shpage_info(s);
- return 0;
-}
-
-void shpage_init(struct domain *d, shared_iopage_t *sp)
-{
- hvm_register_savevm(d, "xen_hvm_shpage", 0x10, 1, shpage_save, shpage_load, sp);
-}
int hvm_buffered_io_intercept(ioreq_t *p)
{
diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index c8c76fbc3d..d2ee7f8825 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -33,26 +33,26 @@
void rtc_periodic_cb(struct vcpu *v, void *opaque)
{
RTCState *s = opaque;
- s->cmos_data[RTC_REG_C] |= 0xc0;
+ s->hw.cmos_data[RTC_REG_C] |= 0xc0;
}
int is_rtc_periodic_irq(void *opaque)
{
RTCState *s = opaque;
- return !(s->cmos_data[RTC_REG_C] & RTC_AF ||
- s->cmos_data[RTC_REG_C] & RTC_UF);
+ return !(s->hw.cmos_data[RTC_REG_C] & RTC_AF ||
+ s->hw.cmos_data[RTC_REG_C] & RTC_UF);
}
/* Enable/configure/disable the periodic timer based on the RTC_PIE and
* RTC_RATE_SELECT settings */
-static void rtc_timer_update(RTCState *s)
+static void rtc_timer_update(RTCState *s, struct vcpu *v)
{
int period_code;
int period;
- period_code = s->cmos_data[RTC_REG_A] & RTC_RATE_SELECT;
- if ( (period_code != 0) && (s->cmos_data[RTC_REG_B] & RTC_PIE) )
+ period_code = s->hw.cmos_data[RTC_REG_A] & RTC_RATE_SELECT;
+ if ( (period_code != 0) && (s->hw.cmos_data[RTC_REG_B] & RTC_PIE) )
{
if ( period_code <= 2 )
period_code += 7;
@@ -62,7 +62,7 @@ static void rtc_timer_update(RTCState *s)
#ifdef DEBUG_RTC
printk("HVM_RTC: period = %uns\n", period);
#endif
- create_periodic_time(current, &s->pt, period, RTC_IRQ, 0, rtc_periodic_cb, s);
+ create_periodic_time(v, &s->pt, period, RTC_IRQ, 0, rtc_periodic_cb, s);
}
else
destroy_periodic_time(&s->pt);
@@ -76,24 +76,24 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
if ( (addr & 1) == 0 )
{
- s->cmos_index = data & 0x7f;
- return (s->cmos_index < RTC_SIZE);
+ s->hw.cmos_index = data & 0x7f;
+ return (s->hw.cmos_index < RTC_CMOS_SIZE);
}
- if (s->cmos_index >= RTC_SIZE)
+ if (s->hw.cmos_index >= RTC_CMOS_SIZE)
return 0;
#ifdef DEBUG_RTC
printk("HVM_RTC: write index=0x%02x val=0x%02x\n",
- s->cmos_index, data);
+ s->hw.cmos_index, data);
#endif
- switch ( s->cmos_index )
+ switch ( s->hw.cmos_index )
{
case RTC_SECONDS_ALARM:
case RTC_MINUTES_ALARM:
case RTC_HOURS_ALARM:
- s->cmos_data[s->cmos_index] = data;
+ s->hw.cmos_data[s->hw.cmos_index] = data;
break;
case RTC_SECONDS:
case RTC_MINUTES:
@@ -102,32 +102,32 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
case RTC_DAY_OF_MONTH:
case RTC_MONTH:
case RTC_YEAR:
- s->cmos_data[s->cmos_index] = data;
+ s->hw.cmos_data[s->hw.cmos_index] = data;
/* if in set mode, do not update the time */
- if ( !(s->cmos_data[RTC_REG_B] & RTC_SET) )
+ if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) )
rtc_set_time(s);
break;
case RTC_REG_A:
/* UIP bit is read only */
- s->cmos_data[RTC_REG_A] = (data & ~RTC_UIP) |
- (s->cmos_data[RTC_REG_A] & RTC_UIP);
- rtc_timer_update(s);
+ s->hw.cmos_data[RTC_REG_A] = (data & ~RTC_UIP) |
+ (s->hw.cmos_data[RTC_REG_A] & RTC_UIP);
+ rtc_timer_update(s, current);
break;
case RTC_REG_B:
if ( data & RTC_SET )
{
/* set mode: reset UIP mode */
- s->cmos_data[RTC_REG_A] &= ~RTC_UIP;
+ s->hw.cmos_data[RTC_REG_A] &= ~RTC_UIP;
data &= ~RTC_UIE;
}
else
{
/* if disabling set mode, update the time */
- if ( s->cmos_data[RTC_REG_B] & RTC_SET )
+ if ( s->hw.cmos_data[RTC_REG_B] & RTC_SET )
rtc_set_time(s);
}
- s->cmos_data[RTC_REG_B] = data;
- rtc_timer_update(s);
+ s->hw.cmos_data[RTC_REG_B] = data;
+ rtc_timer_update(s, current);
break;
case RTC_REG_C:
case RTC_REG_D:
@@ -140,7 +140,7 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
static inline int to_bcd(RTCState *s, int a)
{
- if ( s->cmos_data[RTC_REG_B] & 0x04 )
+ if ( s->hw.cmos_data[RTC_REG_B] & 0x04 )
return a;
else
return ((a / 10) << 4) | (a % 10);
@@ -148,7 +148,7 @@ static inline int to_bcd(RTCState *s, int a)
static inline int from_bcd(RTCState *s, int a)
{
- if ( s->cmos_data[RTC_REG_B] & 0x04 )
+ if ( s->hw.cmos_data[RTC_REG_B] & 0x04 )
return a;
else
return ((a >> 4) * 10) + (a & 0x0f);
@@ -158,40 +158,40 @@ static void rtc_set_time(RTCState *s)
{
struct tm *tm = &s->current_tm;
- tm->tm_sec = from_bcd(s, s->cmos_data[RTC_SECONDS]);
- tm->tm_min = from_bcd(s, s->cmos_data[RTC_MINUTES]);
- tm->tm_hour = from_bcd(s, s->cmos_data[RTC_HOURS] & 0x7f);
- if ( !(s->cmos_data[RTC_REG_B] & 0x02) &&
- (s->cmos_data[RTC_HOURS] & 0x80) )
+ tm->tm_sec = from_bcd(s, s->hw.cmos_data[RTC_SECONDS]);
+ tm->tm_min = from_bcd(s, s->hw.cmos_data[RTC_MINUTES]);
+ tm->tm_hour = from_bcd(s, s->hw.cmos_data[RTC_HOURS] & 0x7f);
+ if ( !(s->hw.cmos_data[RTC_REG_B] & 0x02) &&
+ (s->hw.cmos_data[RTC_HOURS] & 0x80) )
tm->tm_hour += 12;
- tm->tm_wday = from_bcd(s, s->cmos_data[RTC_DAY_OF_WEEK]);
- tm->tm_mday = from_bcd(s, s->cmos_data[RTC_DAY_OF_MONTH]);
- tm->tm_mon = from_bcd(s, s->cmos_data[RTC_MONTH]) - 1;
- tm->tm_year = from_bcd(s, s->cmos_data[RTC_YEAR]) + 100;
+ tm->tm_wday = from_bcd(s, s->hw.cmos_data[RTC_DAY_OF_WEEK]);
+ tm->tm_mday = from_bcd(s, s->hw.cmos_data[RTC_DAY_OF_MONTH]);
+ tm->tm_mon = from_bcd(s, s->hw.cmos_data[RTC_MONTH]) - 1;
+ tm->tm_year = from_bcd(s, s->hw.cmos_data[RTC_YEAR]) + 100;
}
static void rtc_copy_date(RTCState *s)
{
const struct tm *tm = &s->current_tm;
- s->cmos_data[RTC_SECONDS] = to_bcd(s, tm->tm_sec);
- s->cmos_data[RTC_MINUTES] = to_bcd(s, tm->tm_min);
- if ( s->cmos_data[RTC_REG_B] & RTC_24H )
+ s->hw.cmos_data[RTC_SECONDS] = to_bcd(s, tm->tm_sec);
+ s->hw.cmos_data[RTC_MINUTES] = to_bcd(s, tm->tm_min);
+ if ( s->hw.cmos_data[RTC_REG_B] & RTC_24H )
{
/* 24 hour format */
- s->cmos_data[RTC_HOURS] = to_bcd(s, tm->tm_hour);
+ s->hw.cmos_data[RTC_HOURS] = to_bcd(s, tm->tm_hour);
}
else
{
/* 12 hour format */
- s->cmos_data[RTC_HOURS] = to_bcd(s, tm->tm_hour % 12);
+ s->hw.cmos_data[RTC_HOURS] = to_bcd(s, tm->tm_hour % 12);
if ( tm->tm_hour >= 12 )
- s->cmos_data[RTC_HOURS] |= 0x80;
+ s->hw.cmos_data[RTC_HOURS] |= 0x80;
}
- s->cmos_data[RTC_DAY_OF_WEEK] = to_bcd(s, tm->tm_wday);
- s->cmos_data[RTC_DAY_OF_MONTH] = to_bcd(s, tm->tm_mday);
- s->cmos_data[RTC_MONTH] = to_bcd(s, tm->tm_mon + 1);
- s->cmos_data[RTC_YEAR] = to_bcd(s, tm->tm_year % 100);
+ s->hw.cmos_data[RTC_DAY_OF_WEEK] = to_bcd(s, tm->tm_wday);
+ s->hw.cmos_data[RTC_DAY_OF_MONTH] = to_bcd(s, tm->tm_mday);
+ s->hw.cmos_data[RTC_MONTH] = to_bcd(s, tm->tm_mon + 1);
+ s->hw.cmos_data[RTC_YEAR] = to_bcd(s, tm->tm_year % 100);
}
/* month is between 0 and 11. */
@@ -251,7 +251,7 @@ static void rtc_update_second(void *opaque)
RTCState *s = opaque;
/* if the oscillator is not in normal operation, we do not update */
- if ( (s->cmos_data[RTC_REG_A] & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ )
+ if ( (s->hw.cmos_data[RTC_REG_A] & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ )
{
s->next_second_time += 1000000000ULL;
set_timer(&s->second_timer, s->next_second_time);
@@ -260,8 +260,8 @@ static void rtc_update_second(void *opaque)
{
rtc_next_second(&s->current_tm);
- if ( !(s->cmos_data[RTC_REG_B] & RTC_SET) )
- s->cmos_data[RTC_REG_A] |= RTC_UIP;
+ if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) )
+ s->hw.cmos_data[RTC_REG_A] |= RTC_UIP;
/* Delay time before update cycle */
set_timer(&s->second_timer2, s->next_second_time + 244000);
@@ -272,38 +272,38 @@ static void rtc_update_second2(void *opaque)
{
RTCState *s = opaque;
- if ( !(s->cmos_data[RTC_REG_B] & RTC_SET) )
+ if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) )
rtc_copy_date(s);
/* check alarm */
- if ( s->cmos_data[RTC_REG_B] & RTC_AIE )
+ if ( s->hw.cmos_data[RTC_REG_B] & RTC_AIE )
{
- if ( ((s->cmos_data[RTC_SECONDS_ALARM] & 0xc0) == 0xc0 ||
- from_bcd(s, s->cmos_data[RTC_SECONDS_ALARM]) ==
+ if ( ((s->hw.cmos_data[RTC_SECONDS_ALARM] & 0xc0) == 0xc0 ||
+ from_bcd(s, s->hw.cmos_data[RTC_SECONDS_ALARM]) ==
s->current_tm.tm_sec) &&
- ((s->cmos_data[RTC_MINUTES_ALARM] & 0xc0) == 0xc0 ||
- from_bcd(s, s->cmos_data[RTC_MINUTES_ALARM]) ==
+ ((s->hw.cmos_data[RTC_MINUTES_ALARM] & 0xc0) == 0xc0 ||
+ from_bcd(s, s->hw.cmos_data[RTC_MINUTES_ALARM]) ==
s->current_tm.tm_min) &&
- ((s->cmos_data[RTC_HOURS_ALARM] & 0xc0) == 0xc0 ||
- from_bcd(s, s->cmos_data[RTC_HOURS_ALARM]) ==
+ ((s->hw.cmos_data[RTC_HOURS_ALARM] & 0xc0) == 0xc0 ||
+ from_bcd(s, s->hw.cmos_data[RTC_HOURS_ALARM]) ==
s->current_tm.tm_hour) )
{
- s->cmos_data[RTC_REG_C] |= 0xa0;
- hvm_isa_irq_deassert(s->pt.vcpu->domain, s->irq);
- hvm_isa_irq_assert(s->pt.vcpu->domain, s->irq);
+ s->hw.cmos_data[RTC_REG_C] |= 0xa0;
+ hvm_isa_irq_deassert(s->pt.vcpu->domain, RTC_IRQ);
+ hvm_isa_irq_assert(s->pt.vcpu->domain, RTC_IRQ);
}
}
/* update ended interrupt */
- if ( s->cmos_data[RTC_REG_B] & RTC_UIE )
+ if ( s->hw.cmos_data[RTC_REG_B] & RTC_UIE )
{
- s->cmos_data[RTC_REG_C] |= 0x90;
- hvm_isa_irq_deassert(s->pt.vcpu->domain, s->irq);
- hvm_isa_irq_assert(s->pt.vcpu->domain, s->irq);
+ s->hw.cmos_data[RTC_REG_C] |= 0x90;
+ hvm_isa_irq_deassert(s->pt.vcpu->domain, RTC_IRQ);
+ hvm_isa_irq_assert(s->pt.vcpu->domain, RTC_IRQ);
}
/* clear update in progress bit */
- s->cmos_data[RTC_REG_A] &= ~RTC_UIP;
+ s->hw.cmos_data[RTC_REG_A] &= ~RTC_UIP;
s->next_second_time += 1000000000ULL;
set_timer(&s->second_timer, s->next_second_time);
@@ -317,7 +317,7 @@ static uint32_t rtc_ioport_read(void *opaque, uint32_t addr)
if ( (addr & 1) == 0 )
return 0xff;
- switch ( s->cmos_index )
+ switch ( s->hw.cmos_index )
{
case RTC_SECONDS:
case RTC_MINUTES:
@@ -326,24 +326,24 @@ static uint32_t rtc_ioport_read(void *opaque, uint32_t addr)
case RTC_DAY_OF_MONTH:
case RTC_MONTH:
case RTC_YEAR:
- ret = s->cmos_data[s->cmos_index];
+ ret = s->hw.cmos_data[s->hw.cmos_index];
break;
case RTC_REG_A:
- ret = s->cmos_data[s->cmos_index];
+ ret = s->hw.cmos_data[s->hw.cmos_index];
break;
case RTC_REG_C:
- ret = s->cmos_data[s->cmos_index];
- hvm_isa_irq_deassert(s->pt.vcpu->domain, s->irq);
- s->cmos_data[RTC_REG_C] = 0x00;
+ ret = s->hw.cmos_data[s->hw.cmos_index];
+ hvm_isa_irq_deassert(s->pt.vcpu->domain, RTC_IRQ);
+ s->hw.cmos_data[RTC_REG_C] = 0x00;
break;
default:
- ret = s->cmos_data[s->cmos_index];
+ ret = s->hw.cmos_data[s->hw.cmos_index];
break;
}
#ifdef DEBUG_RTC
printk("HVM_RTC: read index=0x%02x val=0x%02x\n",
- s->cmos_index, ret);
+ s->hw.cmos_index, ret);
#endif
return ret;
@@ -365,7 +365,7 @@ static int handle_rtc_io(ioreq_t *p)
if ( rtc_ioport_write(vrtc, p->addr, p->data & 0xFF) )
return 1;
}
- else if ( (p->dir == 1) && (vrtc->cmos_index < RTC_SIZE) ) /* read */
+ else if ( (p->dir == 1) && (vrtc->hw.cmos_index < RTC_CMOS_SIZE) ) /* read */
{
p->data = rtc_ioport_read(vrtc, p->addr);
return 1;
@@ -388,16 +388,47 @@ void rtc_migrate_timers(struct vcpu *v)
}
}
-void rtc_init(struct vcpu *v, int base, int irq)
+/* Save RTC hardware state */
+static int rtc_save(struct domain *d, hvm_domain_context_t *h)
+{
+ return hvm_save_entry(RTC, 0, h, &d->arch.hvm_domain.pl_time.vrtc.hw);
+}
+
+/* Reload the hardware state from a saved domain */
+static int rtc_load(struct domain *d, hvm_domain_context_t *h)
+{
+ RTCState *s = &d->arch.hvm_domain.pl_time.vrtc;
+
+ /* Restore the registers */
+ if ( hvm_load_entry(RTC, h, &s->hw) != 0 )
+ return -EINVAL;
+
+ /* Reset the wall-clock time. In normal running, this runs with host
+ * time, so let's keep doing that. */
+ s->current_tm = gmtime(get_localtime(d));
+ rtc_copy_date(s);
+ s->next_second_time = NOW() + 1000000000ULL;
+ stop_timer(&s->second_timer);
+ set_timer(&s->second_timer2, s->next_second_time);
+
+ /* Reset the periodic interrupt timer based on the registers */
+ rtc_timer_update(s, d->vcpu[0]);
+
+ return 0;
+}
+
+HVM_REGISTER_SAVE_RESTORE(RTC, rtc_save, rtc_load);
+
+
+void rtc_init(struct vcpu *v, int base)
{
RTCState *s = &v->domain->arch.hvm_domain.pl_time.vrtc;
s->pt.vcpu = v;
- s->irq = irq;
- s->cmos_data[RTC_REG_A] = RTC_REF_CLCK_32KHZ | 6; /* ~1kHz */
- s->cmos_data[RTC_REG_B] = RTC_24H;
- s->cmos_data[RTC_REG_C] = 0;
- s->cmos_data[RTC_REG_D] = RTC_VRT;
+ s->hw.cmos_data[RTC_REG_A] = RTC_REF_CLCK_32KHZ | 6; /* ~1kHz */
+ s->hw.cmos_data[RTC_REG_B] = RTC_24H;
+ s->hw.cmos_data[RTC_REG_C] = 0;
+ s->hw.cmos_data[RTC_REG_D] = RTC_VRT;
s->current_tm = gmtime(get_localtime(v->domain));
rtc_copy_date(s);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 7a656865eb..b2637a7807 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -603,29 +603,16 @@ void svm_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
// dump_msr_state(guest_state);
}
-void svm_save_vmcb_ctxt(hvm_domain_context_t *h, void *opaque)
+void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
- struct vcpu *v = opaque;
- struct hvm_hw_cpu ctxt;
-
- svm_save_cpu_state(v, &ctxt);
-
- svm_vmcs_save(v, &ctxt);
-
- hvm_put_struct(h, &ctxt);
+ svm_save_cpu_state(v, ctxt);
+ svm_vmcs_save(v, ctxt);
}
-int svm_load_vmcb_ctxt(hvm_domain_context_t *h, void *opaque, int version)
+int svm_load_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
- struct vcpu *v = opaque;
- struct hvm_hw_cpu ctxt;
-
- if (version != 1)
- return -EINVAL;
-
- hvm_get_struct(h, &ctxt);
- svm_load_cpu_state(v, &ctxt);
- if (svm_vmcb_restore(v, &ctxt)) {
+ svm_load_cpu_state(v, ctxt);
+ if (svm_vmcb_restore(v, ctxt)) {
printk("svm_vmcb restore failed!\n");
domain_crash(v->domain);
return -EINVAL;
@@ -2141,8 +2128,8 @@ static inline void svm_do_msr_access(
switch (ecx)
{
case MSR_IA32_TIME_STAMP_COUNTER:
- pt_reset(v);
hvm_set_guest_time(v, msr_content);
+ pt_reset(v);
break;
case MSR_IA32_SYSENTER_CS:
vmcb->sysenter_cs = msr_content;
diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 3efe1286cd..d43eced740 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -523,50 +523,58 @@ static void hvmirq_info(struct hvm_hw_irq *hvm_irq)
}
#endif
-static void ioapic_save(hvm_domain_context_t *h, void *opaque)
+
+static int ioapic_save(struct domain *d, hvm_domain_context_t *h)
{
- struct domain *d = opaque;
struct hvm_hw_vioapic *s = domain_vioapic(d);
- struct hvm_hw_irq *hvm_irq = &d->arch.hvm_domain.irq;
-
ioapic_info(s);
- hvmirq_info(hvm_irq);
/* save io-apic state*/
- hvm_put_struct(h, s);
+ return ( hvm_save_entry(IOAPIC, 0, h, s) );
+}
+
+static int ioapic_save_irqs(struct domain *d, hvm_domain_context_t *h)
+{
+ struct hvm_hw_irq *hvm_irq = &d->arch.hvm_domain.irq;
+ hvmirq_info(hvm_irq);
- /* save hvm irq state */
- hvm_put_struct(h, hvm_irq);
+ /* save IRQ state*/
+ return ( hvm_save_entry(IRQ, 0, h, hvm_irq) );
}
-static int ioapic_load(hvm_domain_context_t *h, void *opaque, int version_id)
+
+static int ioapic_load(struct domain *d, hvm_domain_context_t *h)
{
- struct domain *d = opaque;
struct hvm_hw_vioapic *s = domain_vioapic(d);
- struct hvm_hw_irq *hvm_irq = &d->arch.hvm_domain.irq;
- if (version_id != 1)
+ /* restore ioapic state */
+ if ( hvm_load_entry(IOAPIC, h, s) != 0 )
return -EINVAL;
- /* restore ioapic state */
- hvm_get_struct(h, s);
+ ioapic_info(s);
+ return 0;
+}
+
+static int ioapic_load_irqs(struct domain *d, hvm_domain_context_t *h)
+{
+ struct hvm_hw_irq *hvm_irq = &d->arch.hvm_domain.irq;
/* restore irq state */
- hvm_get_struct(h, hvm_irq);
+ if ( hvm_load_entry(IRQ, h, hvm_irq) != 0 )
+ return -EINVAL;
- ioapic_info(s);
hvmirq_info(hvm_irq);
-
return 0;
}
+HVM_REGISTER_SAVE_RESTORE(IOAPIC, ioapic_save, ioapic_load);
+HVM_REGISTER_SAVE_RESTORE(IRQ, ioapic_save_irqs, ioapic_load_irqs);
+
void vioapic_init(struct domain *d)
{
struct hvm_hw_vioapic *vioapic = domain_vioapic(d);
int i;
- hvm_register_savevm(d, "xen_hvm_ioapic", 0, 1, ioapic_save, ioapic_load, d);
-
memset(vioapic, 0, sizeof(*vioapic));
for ( i = 0; i < VIOAPIC_NUM_PINS; i++ )
vioapic->redirtbl[i].fields.mask = 1;
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index e3456f391a..4ac13ba9c4 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -810,49 +810,106 @@ static void lapic_info(struct vlapic *s)
}
#endif
-static void lapic_save(hvm_domain_context_t *h, void *opaque)
+/* rearm the actimer if needed, after a HVM restore */
+static void lapic_rearm(struct vlapic *s)
{
- struct vlapic *s = opaque;
-
- lapic_info(s);
-
- hvm_put_struct(h, &s->hw);
- hvm_put_struct(h, s->regs);
-}
-
-static int lapic_load(hvm_domain_context_t *h, void *opaque, int version_id)
-{
- struct vlapic *s = opaque;
- struct vcpu *v = vlapic_vcpu(s);
unsigned long tmict;
- if (version_id != 1)
- return -EINVAL;
-
- hvm_get_struct(h, &s->hw);
- hvm_get_struct(h, s->regs);
-
- /* rearm the actiemr if needed */
tmict = vlapic_get_reg(s, APIC_TMICT);
if (tmict > 0) {
uint64_t period = APIC_BUS_CYCLE_NS * (uint32_t)tmict * s->hw.timer_divisor;
+ uint32_t lvtt = vlapic_get_reg(s, APIC_LVTT);
- create_periodic_time(v, &s->pt, period, s->pt.irq,
+ s->pt.irq = lvtt & APIC_VECTOR_MASK;
+ create_periodic_time(vlapic_vcpu(s), &s->pt, period, s->pt.irq,
vlapic_lvtt_period(s), NULL, s);
printk("lapic_load to rearm the actimer:"
"bus cycle is %uns, "
- "saved tmict count %lu, period %"PRIu64"ns\n",
- APIC_BUS_CYCLE_NS, tmict, period);
+ "saved tmict count %lu, period %"PRIu64"ns, irq=%"PRIu8"\n",
+ APIC_BUS_CYCLE_NS, tmict, period, s->pt.irq);
+ }
+
+ lapic_info(s);
+}
+
+static int lapic_save_hidden(struct domain *d, hvm_domain_context_t *h)
+{
+ struct vcpu *v;
+ struct vlapic *s;
+
+ for_each_vcpu(d, v)
+ {
+ s = vcpu_vlapic(v);
+ lapic_info(s);
+
+ if ( hvm_save_entry(LAPIC, v->vcpu_id, h, &s->hw) != 0 )
+ return 1;
+ }
+ return 0;
+}
+static int lapic_save_regs(struct domain *d, hvm_domain_context_t *h)
+{
+ struct vcpu *v;
+ struct vlapic *s;
+
+ for_each_vcpu(d, v)
+ {
+ s = vcpu_vlapic(v);
+ if ( hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, s->regs) != 0 )
+ return 1;
}
+ return 0;
+}
+static int lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
+{
+ uint16_t vcpuid;
+ struct vcpu *v;
+ struct vlapic *s;
+
+ /* Which vlapic to load? */
+ vcpuid = hvm_load_instance(h);
+ if ( vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL )
+ {
+ gdprintk(XENLOG_ERR, "HVM restore: domain has no vlapic %u\n", vcpuid);
+ return -EINVAL;
+ }
+ s = vcpu_vlapic(v);
+
+ if ( hvm_load_entry(LAPIC, h, &s->hw) != 0 )
+ return -EINVAL;
lapic_info(s);
+ return 0;
+}
+static int lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
+{
+ uint16_t vcpuid;
+ struct vcpu *v;
+ struct vlapic *s;
+
+ /* Which vlapic to load? */
+ vcpuid = hvm_load_instance(h);
+ if ( vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL )
+ {
+ gdprintk(XENLOG_ERR, "HVM restore: domain has no vlapic %u\n", vcpuid);
+ return -EINVAL;
+ }
+ s = vcpu_vlapic(v);
+
+ if ( hvm_load_entry(LAPIC_REGS, h, s->regs) != 0 )
+ return -EINVAL;
+
+ lapic_rearm(s);
return 0;
}
+HVM_REGISTER_SAVE_RESTORE(LAPIC, lapic_save_hidden, lapic_load_hidden);
+HVM_REGISTER_SAVE_RESTORE(LAPIC_REGS, lapic_save_regs, lapic_load_regs);
+
int vlapic_init(struct vcpu *v)
{
struct vlapic *vlapic = vcpu_vlapic(v);
@@ -871,7 +928,6 @@ int vlapic_init(struct vcpu *v)
vlapic->regs = map_domain_page_global(page_to_mfn(vlapic->regs_page));
memset(vlapic->regs, 0, PAGE_SIZE);
- hvm_register_savevm(v->domain, "xen_hvm_lapic", v->vcpu_id, 1, lapic_save, lapic_load, vlapic);
vlapic_reset(vlapic);
vlapic->hw.apic_base_msr = MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 016fd0926a..c3a2ed4585 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -364,19 +364,9 @@ static inline void __restore_debug_registers(struct vcpu *v)
/* DR7 is loaded from the VMCS. */
}
-static int __get_instruction_length(void);
int vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c)
-{
- unsigned long inst_len;
-
- inst_len = __get_instruction_length();
+{
c->eip = __vmread(GUEST_RIP);
-
-#ifdef HVM_DEBUG_SUSPEND
- printk("vmx_vmcs_save: inst_len=0x%lx, eip=0x%"PRIx64".\n",
- inst_len, c->eip);
-#endif
-
c->esp = __vmread(GUEST_RSP);
c->eflags = __vmread(GUEST_RFLAGS);
@@ -632,30 +622,18 @@ void vmx_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
}
-void vmx_save_vmcs_ctxt(hvm_domain_context_t *h, void *opaque)
+void vmx_save_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
- struct vcpu *v = opaque;
- struct hvm_hw_cpu ctxt;
-
- vmx_save_cpu_state(v, &ctxt);
+ vmx_save_cpu_state(v, ctxt);
vmx_vmcs_enter(v);
- vmx_vmcs_save(v, &ctxt);
+ vmx_vmcs_save(v, ctxt);
vmx_vmcs_exit(v);
-
- hvm_put_struct(h, &ctxt);
}
-int vmx_load_vmcs_ctxt(hvm_domain_context_t *h, void *opaque, int version)
+int vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
- struct vcpu *v = opaque;
- struct hvm_hw_cpu ctxt;
-
- if (version != 1)
- return -EINVAL;
-
- hvm_get_struct(h, &ctxt);
- vmx_load_cpu_state(v, &ctxt);
- if (vmx_vmcs_restore(v, &ctxt)) {
+ vmx_load_cpu_state(v, ctxt);
+ if (vmx_vmcs_restore(v, ctxt)) {
printk("vmx_vmcs restore failed!\n");
domain_crash(v->domain);
return -EINVAL;
@@ -2346,8 +2324,8 @@ static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
switch (ecx) {
case MSR_IA32_TIME_STAMP_COUNTER:
- pt_reset(v);
hvm_set_guest_time(v, msr_content);
+ pt_reset(v);
break;
case MSR_IA32_SYSENTER_CS:
__vmwrite(GUEST_SYSENTER_CS, msr_content);
diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 290b5f3129..41e3ed11a4 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -404,27 +404,44 @@ static void vpic_info(struct hvm_hw_vpic *s)
}
#endif
-static void vpic_save(hvm_domain_context_t *h, void *opaque)
+static int vpic_save(struct domain *d, hvm_domain_context_t *h)
{
- struct hvm_hw_vpic *s = opaque;
-
- vpic_info(s);
- hvm_put_struct(h, s);
+ struct hvm_hw_vpic *s;
+ int i;
+
+ /* Save the state of both PICs */
+ for ( i = 0; i < 2 ; i++ )
+ {
+ s = &d->arch.hvm_domain.vpic[i];
+ vpic_info(s);
+ if ( hvm_save_entry(PIC, i, h, s) )
+ return 1;
+ }
+
+ return 0;
}
-static int vpic_load(hvm_domain_context_t *h, void *opaque, int version_id)
+static int vpic_load(struct domain *d, hvm_domain_context_t *h)
{
- struct hvm_hw_vpic *s = opaque;
+ struct hvm_hw_vpic *s;
+ uint16_t inst;
- if (version_id != 1)
+ /* Which PIC is this? */
+ inst = hvm_load_instance(h);
+ if ( inst > 1 )
return -EINVAL;
+ s = &d->arch.hvm_domain.vpic[inst];
- hvm_get_struct(h, s);
- vpic_info(s);
+ /* Load the state */
+ if ( hvm_load_entry(PIC, h, s) != 0 )
+ return -EINVAL;
+ vpic_info(s);
return 0;
}
+HVM_REGISTER_SAVE_RESTORE(PIC, vpic_save, vpic_load);
+
void vpic_init(struct domain *d)
{
struct hvm_hw_vpic *vpic;
@@ -434,14 +451,12 @@ void vpic_init(struct domain *d)
memset(vpic, 0, sizeof(*vpic));
vpic->is_master = 1;
vpic->elcr = 1 << 2;
- hvm_register_savevm(d, "xen_hvm_i8259", 0x20, 1, vpic_save, vpic_load, vpic);
register_portio_handler(d, 0x20, 2, vpic_intercept_pic_io);
register_portio_handler(d, 0x4d0, 1, vpic_intercept_elcr_io);
/* Slave PIC. */
vpic++;
memset(vpic, 0, sizeof(*vpic));
- hvm_register_savevm(d, "xen_hvm_i8259", 0xa0, 1, vpic_save, vpic_load, vpic);
register_portio_handler(d, 0xa0, 2, vpic_intercept_pic_io);
register_portio_handler(d, 0x4d1, 1, vpic_intercept_elcr_io);
}
diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c
index ffefe3bf2d..518691337c 100644
--- a/xen/arch/x86/oprofile/nmi_int.c
+++ b/xen/arch/x86/oprofile/nmi_int.c
@@ -22,6 +22,7 @@
#include <asm/regs.h>
#include <asm/current.h>
#include <xen/delay.h>
+#include <xen/string.h>
#include "op_counter.h"
#include "op_x86_model.h"
@@ -39,7 +40,6 @@ extern int is_active(struct domain *d);
extern int active_id(struct domain *d);
extern int is_profiled(struct domain *d);
-extern size_t strlcpy(char *dest, const char *src, size_t size);
static int nmi_callback(struct cpu_user_regs *regs, int cpu)
@@ -276,20 +276,20 @@ static int __init p4_init(char * cpu_type)
}
#ifndef CONFIG_SMP
- strncpy (cpu_type, "i386/p4", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/p4", XENOPROF_CPU_TYPE_SIZE);
model = &op_p4_spec;
return 1;
#else
switch (smp_num_siblings) {
case 1:
- strncpy (cpu_type, "i386/p4",
- XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/p4",
+ XENOPROF_CPU_TYPE_SIZE);
model = &op_p4_spec;
return 1;
case 2:
- strncpy (cpu_type, "i386/p4-ht",
- XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/p4-ht",
+ XENOPROF_CPU_TYPE_SIZE);
model = &op_p4_ht2_spec;
return 1;
}
@@ -311,17 +311,17 @@ static int __init ppro_init(char *cpu_type)
return 0;
}
else if (cpu_model == 15)
- strncpy (cpu_type, "i386/core_2", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/core_2", XENOPROF_CPU_TYPE_SIZE);
else if (cpu_model == 14)
- strncpy (cpu_type, "i386/core", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/core", XENOPROF_CPU_TYPE_SIZE);
else if (cpu_model == 9)
- strncpy (cpu_type, "i386/p6_mobile", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/p6_mobile", XENOPROF_CPU_TYPE_SIZE);
else if (cpu_model > 5)
- strncpy (cpu_type, "i386/piii", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/piii", XENOPROF_CPU_TYPE_SIZE);
else if (cpu_model > 2)
- strncpy (cpu_type, "i386/pii", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/pii", XENOPROF_CPU_TYPE_SIZE);
else
- strncpy (cpu_type, "i386/ppro", XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/ppro", XENOPROF_CPU_TYPE_SIZE);
model = &op_ppro_spec;
return 1;
@@ -346,9 +346,6 @@ int nmi_init(int *num_events, int *is_primary, char *cpu_type)
}
}
- /* Make sure string is NULL terminated */
- cpu_type[XENOPROF_CPU_TYPE_SIZE - 1] = 0;
-
switch (vendor) {
case X86_VENDOR_AMD:
/* Needs to be at least an Athlon (or hammer in 32bit mode) */
@@ -361,15 +358,15 @@ int nmi_init(int *num_events, int *is_primary, char *cpu_type)
return -ENODEV;
case 6:
model = &op_athlon_spec;
- strncpy (cpu_type, "i386/athlon",
- XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "i386/athlon",
+ XENOPROF_CPU_TYPE_SIZE);
break;
case 0xf:
model = &op_athlon_spec;
/* Actually it could be i386/hammer too, but give
user space an consistent name. */
- strncpy (cpu_type, "x86-64/hammer",
- XENOPROF_CPU_TYPE_SIZE - 1);
+ strlcpy (cpu_type, "x86-64/hammer",
+ XENOPROF_CPU_TYPE_SIZE);
break;
}
break;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 96d49203ca..0e010e2724 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -111,8 +111,7 @@ char acpi_param[10] = "";
static void parse_acpi_param(char *s)
{
/* Save the parameter so it can be propagated to domain0. */
- strncpy(acpi_param, s, sizeof(acpi_param));
- acpi_param[sizeof(acpi_param)-1] = '\0';
+ safe_strcpy(acpi_param, s);
/* Interpret the parameter for use within Xen. */
if ( !strcmp(s, "off") )
@@ -749,22 +748,22 @@ void __init __start_xen(multiboot_info_t *mbi)
if ( (cmdline = strchr(cmdline, ' ')) != NULL )
{
while ( *cmdline == ' ' ) cmdline++;
- strcpy(dom0_cmdline, cmdline);
+ safe_strcpy(dom0_cmdline, cmdline);
}
- cmdline = dom0_cmdline;
-
/* Append any extra parameters. */
- if ( skip_ioapic_setup && !strstr(cmdline, "noapic") )
- strcat(cmdline, " noapic");
+ if ( skip_ioapic_setup && !strstr(dom0_cmdline, "noapic") )
+ safe_strcat(dom0_cmdline, " noapic");
if ( acpi_skip_timer_override &&
- !strstr(cmdline, "acpi_skip_timer_override") )
- strcat(cmdline, " acpi_skip_timer_override");
- if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") )
+ !strstr(dom0_cmdline, "acpi_skip_timer_override") )
+ safe_strcat(dom0_cmdline, " acpi_skip_timer_override");
+ if ( (strlen(acpi_param) != 0) && !strstr(dom0_cmdline, "acpi=") )
{
- strcat(cmdline, " acpi=");
- strcat(cmdline, acpi_param);
+ safe_strcat(dom0_cmdline, " acpi=");
+ safe_strcat(dom0_cmdline, acpi_param);
}
+
+ cmdline = dom0_cmdline;
}
if ( (initrdidx > 0) && (initrdidx < mbi->mods_count) )
@@ -801,49 +800,55 @@ void __init __start_xen(multiboot_info_t *mbi)
startup_cpu_idle_loop();
}
-void arch_get_xen_caps(xen_capabilities_info_t info)
+void arch_get_xen_caps(xen_capabilities_info_t *info)
{
- char *p = info;
int major = xen_major_version();
int minor = xen_minor_version();
+ char s[32];
+
+ (*info)[0] = '\0';
#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
- p += sprintf(p, "xen-%d.%d-x86_32 ", major, minor);
+ snprintf(s, sizeof(s), "xen-%d.%d-x86_32 ", major, minor);
+ safe_strcat(*info, s);
if ( hvm_enabled )
- p += sprintf(p, "hvm-%d.%d-x86_32 ", major, minor);
+ {
+ snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
+ safe_strcat(*info, s);
+ }
#elif defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
- p += sprintf(p, "xen-%d.%d-x86_32p ", major, minor);
+ snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
+ safe_strcat(*info, s);
if ( hvm_enabled )
{
- p += sprintf(p, "hvm-%d.%d-x86_32 ", major, minor);
- p += sprintf(p, "hvm-%d.%d-x86_32p ", major, minor);
+ snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
+ safe_strcat(*info, s);
+ snprintf(s, sizeof(s), "hvm-%d.%d-x86_32p ", major, minor);
+ safe_strcat(*info, s);
}
#elif defined(CONFIG_X86_64)
- p += sprintf(p, "xen-%d.%d-x86_64 ", major, minor);
+ snprintf(s, sizeof(s), "xen-%d.%d-x86_64 ", major, minor);
+ safe_strcat(*info, s);
#ifdef CONFIG_COMPAT
- p += sprintf(p, "xen-%d.%d-x86_32p ", major, minor);
+ snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
+ safe_strcat(*info, s);
#endif
if ( hvm_enabled )
{
- p += sprintf(p, "hvm-%d.%d-x86_32 ", major, minor);
- p += sprintf(p, "hvm-%d.%d-x86_32p ", major, minor);
- p += sprintf(p, "hvm-%d.%d-x86_64 ", major, minor);
+ snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
+ safe_strcat(*info, s);
+ snprintf(s, sizeof(s), "hvm-%d.%d-x86_32p ", major, minor);
+ safe_strcat(*info, s);
+ snprintf(s, sizeof(s), "hvm-%d.%d-x86_64 ", major, minor);
+ safe_strcat(*info, s);
}
-#else
-
- p++;
-
#endif
-
- *(p-1) = 0;
-
- BUG_ON((p - info) > sizeof(xen_capabilities_info_t));
}
/*
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 387b18c20a..b57f34f4f0 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -274,7 +274,7 @@ static char *freq_string(u64 freq)
unsigned int x, y;
y = (unsigned int)do_div(freq, 1000000) / 1000;
x = (unsigned int)freq;
- sprintf(s, "%u.%03uMHz", x, y);
+ snprintf(s, sizeof(s), "%u.%03uMHz", x, y);
return s;
}
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c
index 8c863080e0..b9dfd08bbc 100644
--- a/xen/common/gdbstub.c
+++ b/xen/common/gdbstub.c
@@ -268,7 +268,7 @@ gdb_send_packet(struct gdb_context *ctx)
char buf[3];
int count;
- sprintf(buf, "%.02x\n", ctx->out_csum);
+ snprintf(buf, sizeof(buf), "%.02x\n", ctx->out_csum);
gdb_write_to_packet_char('#', ctx);
gdb_write_to_packet(buf, 2, ctx);
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 016270b2c5..fa448b07a3 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -72,8 +72,7 @@ void cmdline_parse(char *cmdline)
switch ( param->type )
{
case OPT_STR:
- strncpy(param->var, optval, param->len);
- ((char *)param->var)[param->len-1] = '\0';
+ strlcpy(param->var, optval, param->len);
break;
case OPT_UINT:
*(unsigned int *)param->var =
@@ -163,10 +162,10 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE(void) arg)
case XENVER_capabilities:
{
xen_capabilities_info_t info;
- extern void arch_get_xen_caps(xen_capabilities_info_t info);
+ extern void arch_get_xen_caps(xen_capabilities_info_t *info);
memset(info, 0, sizeof(info));
- arch_get_xen_caps(info);
+ arch_get_xen_caps(&info);
if ( copy_to_guest(arg, (char *)info, sizeof(info)) )
return -EFAULT;
diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index 5727cdcaa8..04a1468d3a 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -131,7 +131,7 @@ __initcall(register_crashdump_trigger);
static void setup_note(Elf_Note *n, const char *name, int type, int descsz)
{
- strcpy(ELFNOTE_NAME(n), name);
+ safe_strcpy(ELFNOTE_NAME(n), name);
n->namesz = strlen(name);
n->descsz = descsz;
n->type = type;
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 244273addf..6568407bb2 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -67,8 +67,7 @@ void register_keyhandler(
ASSERT(key_table[key].u.handler == NULL);
key_table[key].u.handler = handler;
key_table[key].flags = 0;
- strncpy(key_table[key].desc, desc, STR_MAX);
- key_table[key].desc[STR_MAX-1] = '\0';
+ safe_strcpy(key_table[key].desc, desc);
}
void register_irq_keyhandler(
@@ -77,8 +76,7 @@ void register_irq_keyhandler(
ASSERT(key_table[key].u.irq_handler == NULL);
key_table[key].u.irq_handler = handler;
key_table[key].flags = KEYHANDLER_IRQ_CALLBACK;
- strncpy(key_table[key].desc, desc, STR_MAX);
- key_table[key].desc[STR_MAX-1] = '\0';
+ safe_strcpy(key_table[key].desc, desc);
}
static void show_handlers(unsigned char key)
diff --git a/xen/common/lib.c b/xen/common/lib.c
index c3e77d3cfa..2f1a005ca4 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -2,6 +2,7 @@
#include <xen/ctype.h>
#include <xen/lib.h>
#include <xen/types.h>
+#include <asm/byteorder.h>
/* for ctype.h */
unsigned char _ctype[] = {
@@ -80,9 +81,15 @@ union uu {
long sl[2]; /* as two signed longs */
unsigned long ul[2]; /* as two unsigned longs */
};
-/* XXX RN: Yuck hardcoded endianess :) */
+
+#ifdef __BIG_ENDIAN
+#define _QUAD_HIGHWORD 0
+#define _QUAD_LOWWORD 1
+#else /* __LITTLE_ENDIAN */
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
+#endif
+
/*
* Define high and low longwords.
*/
diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
index c19339ab01..9d45b8ae21 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -128,16 +128,16 @@ int elf_xen_parse_note(struct elf_binary *elf,
switch (type)
{
case XEN_ELFNOTE_LOADER:
- strncpy(parms->loader, str, sizeof(parms->loader));
+ safe_strcpy(parms->loader, str);
break;
case XEN_ELFNOTE_GUEST_OS:
- strncpy(parms->guest_os, str, sizeof(parms->guest_os));
+ safe_strcpy(parms->guest_os, str);
break;
case XEN_ELFNOTE_GUEST_VERSION:
- strncpy(parms->guest_ver, str, sizeof(parms->guest_ver));
+ safe_strcpy(parms->guest_ver, str);
break;
case XEN_ELFNOTE_XEN_VERSION:
- strncpy(parms->xen_ver, str, sizeof(parms->xen_ver));
+ safe_strcpy(parms->xen_ver, str);
break;
case XEN_ELFNOTE_PAE_MODE:
if (0 == strcmp(str, "yes"))
@@ -224,13 +224,13 @@ int elf_xen_parse_guest_info(struct elf_binary *elf,
/* strings */
if (0 == strcmp(name, "LOADER"))
- strncpy(parms->loader, value, sizeof(parms->loader));
+ safe_strcpy(parms->loader, value);
if (0 == strcmp(name, "GUEST_OS"))
- strncpy(parms->guest_os, value, sizeof(parms->guest_os));
+ safe_strcpy(parms->guest_os, value);
if (0 == strcmp(name, "GUEST_VER"))
- strncpy(parms->guest_ver, value, sizeof(parms->guest_ver));
+ safe_strcpy(parms->guest_ver, value);
if (0 == strcmp(name, "XEN_VER"))
- strncpy(parms->xen_ver, value, sizeof(parms->xen_ver));
+ safe_strcpy(parms->xen_ver, value);
if (0 == strcmp(name, "PAE"))
{
if (0 == strcmp(value, "yes[extended-cr3]"))
diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-private.h
index 4d9ef5ba4f..c404638f66 100644
--- a/xen/common/libelf/libelf-private.h
+++ b/xen/common/libelf/libelf-private.h
@@ -50,6 +50,11 @@
xc_set_error(XC_INVALID_KERNEL, fmt , ## args ); \
} while (0)
+#define safe_strcpy(d,s) \
+do { strncpy((d),(s),sizeof((d))-1); \
+ (d)[sizeof((d))-1] = '\0'; \
+} while (0)
+
#endif
#endif /* __LIBELF_PRIVATE_H_ */
diff --git a/xen/common/perfc.c b/xen/common/perfc.c
index 5ab8c6e9f3..bbff5d7b5c 100644
--- a/xen/common/perfc.c
+++ b/xen/common/perfc.c
@@ -148,9 +148,7 @@ static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc,
{
for ( i = 0; i < NR_PERFCTRS; i++ )
{
- strncpy(perfc_d[i].name, perfc_info[i].name,
- sizeof(perfc_d[i].name));
- perfc_d[i].name[sizeof(perfc_d[i].name)-1] = '\0';
+ safe_strcpy(perfc_d[i].name, perfc_info[i].name);
switch ( perfc_info[i].type )
{
diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index d90a39b67b..79a09f894e 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -283,12 +283,11 @@ struct rangeset *rangeset_new(
if ( name != NULL )
{
- strncpy(r->name, name, sizeof(r->name));
- r->name[sizeof(r->name)-1] = '\0';
+ safe_strcpy(r->name, name);
}
else
{
- sprintf(r->name, "(no name)");
+ snprintf(r->name, sizeof(r->name), "(no name)");
}
if ( (r->domain = d) != NULL )
diff --git a/xen/common/string.c b/xen/common/string.c
index df8874c298..562f6cb585 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -41,44 +41,6 @@ int strnicmp(const char *s1, const char *s2, size_t len)
}
#endif
-#ifndef __HAVE_ARCH_STRCPY
-/**
- * strcpy - Copy a %NUL terminated string
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- */
-char * strcpy(char * dest,const char *src)
-{
- char *tmp = dest;
-
- while ((*dest++ = *src++) != '\0')
- /* nothing */;
- return tmp;
-}
-#endif
-
-#ifndef __HAVE_ARCH_STRNCPY
-/**
- * strncpy - Copy a length-limited, %NUL-terminated string
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- * @count: The maximum number of bytes to copy
- *
- * Note that unlike userspace strncpy, this does not %NUL-pad the buffer.
- * However, the result is not %NUL-terminated if the source exceeds
- * @count bytes.
- */
-char * strncpy(char * dest,const char *src,size_t count)
-{
- char *tmp = dest;
-
- while (count-- && (*dest++ = *src++) != '\0')
- /* nothing */;
-
- return tmp;
-}
-#endif
-
#ifndef __HAVE_ARCH_STRLCPY
/**
* strlcpy - Copy a %NUL terminated string into a sized buffer
@@ -105,52 +67,33 @@ size_t strlcpy(char *dest, const char *src, size_t size)
EXPORT_SYMBOL(strlcpy);
#endif
-#ifndef __HAVE_ARCH_STRCAT
-/**
- * strcat - Append one %NUL-terminated string to another
- * @dest: The string to be appended to
- * @src: The string to append to it
- */
-char * strcat(char * dest, const char * src)
-{
- char *tmp = dest;
-
- while (*dest)
- dest++;
- while ((*dest++ = *src++) != '\0')
- ;
-
- return tmp;
-}
-#endif
-
-#ifndef __HAVE_ARCH_STRNCAT
+#ifndef __HAVE_ARCH_STRLCAT
/**
- * strncat - Append a length-limited, %NUL-terminated string to another
- * @dest: The string to be appended to
- * @src: The string to append to it
- * @count: The maximum numbers of bytes to copy
+ * strlcat - Append a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
*
- * Note that in contrast to strncpy, strncat ensures the result is
- * terminated.
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero).
*/
-char * strncat(char *dest, const char *src, size_t count)
+size_t strlcat(char *dest, const char *src, size_t size)
{
- char *tmp = dest;
+ size_t slen = strlen(src);
+ size_t dlen = strnlen(dest, size);
+ char *p = dest + dlen;
- if (count) {
- while (*dest)
- dest++;
- while ((*dest++ = *src++)) {
- if (--count == 0) {
- *dest = '\0';
- break;
- }
- }
- }
+ while ((p - dest) < size)
+ if ((*p++ = *src++) == '\0')
+ break;
+
+ if (dlen < size)
+ *(p-1) = '\0';
- return tmp;
+ return slen + dlen;
}
+EXPORT_SYMBOL(strlcat);
#endif
#ifndef __HAVE_ARCH_STRCMP
diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index fba6cf0867..f4134b7ed5 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -142,15 +142,17 @@ void __print_symbol(const char *fmt, unsigned long address)
const char *name;
unsigned long offset, size;
char namebuf[KSYM_NAME_LEN+1];
- char buffer[sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN +
- 2*(BITS_PER_LONG*3/10) + 1];
+
+#define BUFFER_SIZE sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN + \
+ 2*(BITS_PER_LONG*3/10) + 1
+ char buffer[BUFFER_SIZE];
name = symbols_lookup(address, &size, &offset, namebuf);
if (!name)
- sprintf(buffer, "???");
+ snprintf(buffer, BUFFER_SIZE, "???");
else
- sprintf(buffer, "%s+%#lx/%#lx", name, offset, size);
+ snprintf(buffer, BUFFER_SIZE, "%s+%#lx/%#lx", name, offset, size);
printk(fmt, buffer);
}
diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c
index 3ed7b7052a..355305fa57 100644
--- a/xen/common/vsprintf.c
+++ b/xen/common/vsprintf.c
@@ -182,15 +182,6 @@ static char *number(
tmp[i++]='0';
else while (num != 0)
tmp[i++] = digits[do_div(num,base)];
-#if 0
- else
- {
- /* XXX KAF: force unsigned mod and div. */
- unsigned long long num2=(unsigned long long)num;
- unsigned int base2=(unsigned int)base;
- while (num2 != 0) { tmp[i++] = digits[num2%base2]; num2 /= base2; }
- }
-#endif
if (i > precision)
precision = i;
size -= precision;
@@ -570,49 +561,6 @@ int scnprintf(char * buf, size_t size, const char *fmt, ...)
}
EXPORT_SYMBOL(scnprintf);
-/**
- * vsprintf - Format a string and place it in a buffer
- * @buf: The buffer to place the result into
- * @fmt: The format string to use
- * @args: Arguments for the format string
- *
- * The function returns the number of characters written
- * into @buf. Use vsnprintf or vscnprintf in order to avoid
- * buffer overflows.
- *
- * Call this function if you are already dealing with a va_list.
- * You probably want sprintf instead.
- */
-int vsprintf(char *buf, const char *fmt, va_list args)
-{
- return vsnprintf(buf, INT_MAX, fmt, args);
-}
-
-EXPORT_SYMBOL(vsprintf);
-
-/**
- * sprintf - Format a string and place it in a buffer
- * @buf: The buffer to place the result into
- * @fmt: The format string to use
- * @...: Arguments for the format string
- *
- * The function returns the number of characters written
- * into @buf. Use snprintf or scnprintf in order to avoid
- * buffer overflows.
- */
-int sprintf(char * buf, const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args, fmt);
- i=vsnprintf(buf, INT_MAX, fmt, args);
- va_end(args);
- return i;
-}
-
-EXPORT_SYMBOL(sprintf);
-
/*
* Local variables:
* mode: C
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 457ab393aa..01eda8a06d 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -481,7 +481,7 @@ void printk(const char *fmt, ...)
void set_printk_prefix(const char *prefix)
{
- strcpy(printk_prefix, prefix);
+ safe_strcpy(printk_prefix, prefix);
}
void init_console(void)
@@ -771,7 +771,7 @@ void debugtrace_printk(const char *fmt, ...)
ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
- sprintf(buf, "%u ", ++count);
+ snprintf(buf, sizeof(buf), "%u ", ++count);
va_start(args, fmt);
(void)vsnprintf(buf + strlen(buf), sizeof(buf), fmt, args);
diff --git a/xen/include/acm/acm_endian.h b/xen/include/acm/acm_endian.h
index 49d23b5d04..11781dd4f4 100644
--- a/xen/include/acm/acm_endian.h
+++ b/xen/include/acm/acm_endian.h
@@ -22,57 +22,27 @@
#ifndef _ACM_ENDIAN_H
#define _ACM_ENDIAN_H
-/* don't use these functions in performance critical sections! */
-
-/* set during initialization by testing */
-extern u8 little_endian;
-
-static inline u32 ntohl(u32 x)
-{
- if (little_endian)
- return
- ( (((x) >> 24) & 0xff )|
- (((x) >> 8) & 0xff00 )|
- (((x) << 8) & 0xff0000 )|
- (((x) << 24) & 0xff000000) );
- else
- return x;
-}
-
-static inline u16 ntohs(u16 x)
-{
- if (little_endian)
- return
- ( (((x) >> 8) & 0xff )|
- (((x) << 8) & 0xff00 ) );
- else
- return x;
-}
-
-#define htonl(x) ntohl(x)
-#define htons(x) ntohs(x)
+#include <asm/byteorder.h>
static inline void arrcpy16(u16 *dest, const u16 *src, size_t n)
{
- unsigned int i = 0;
- while (i < n) {
- dest[i] = htons(src[i]);
- i++;
- }
+ unsigned int i;
+ for ( i = 0; i < n; i++ )
+ dest[i] = cpu_to_be16(src[i]);
}
static inline void arrcpy32(u32 *dest, const u32 *src, size_t n)
{
- unsigned int i = 0;
- while (i < n) {
- dest[i] = htonl(src[i]);
- i++;
- }
+ unsigned int i;
+ for ( i = 0; i < n; i++ )
+ dest[i] = cpu_to_be32(src[i]);
}
-static inline void arrcpy(void *dest, const void *src, unsigned int elsize, size_t n)
+static inline void arrcpy(
+ void *dest, const void *src, unsigned int elsize, size_t n)
{
- switch (elsize) {
+ switch ( elsize )
+ {
case sizeof(u16):
arrcpy16((u16 *)dest, (u16 *)src, n);
break;
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index eda4a3d028..f0b818462b 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -28,20 +28,6 @@
#include <public/hvm/params.h>
#include <public/hvm/save.h>
-typedef void SaveStateHandler(hvm_domain_context_t *h, void *opaque);
-typedef int LoadStateHandler(hvm_domain_context_t *h, void *opaque, int version_id);
-
-#define HVM_SE_IDSTR_LEN 32
-typedef struct HVMStateEntry {
- char idstr[HVM_SE_IDSTR_LEN];
- int instance_id;
- int version_id;
- SaveStateHandler *save_state;
- LoadStateHandler *load_state;
- void *opaque;
- struct HVMStateEntry *next;
-} HVMStateEntry;
-
struct hvm_domain {
unsigned long shared_page_va;
unsigned long buffered_io_va;
@@ -65,7 +51,6 @@ struct hvm_domain {
uint64_t params[HVM_NR_PARAMS];
struct hvm_domain_context *hvm_ctxt;
- HVMStateEntry *first_se;
};
#endif /* __ASM_X86_HVM_DOMAIN_H__ */
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 29ff322662..953cc60b3c 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -83,8 +83,8 @@ struct hvm_function_table {
struct vcpu *v, struct cpu_user_regs *r);
/* save and load hvm guest cpu context for save/restore */
- void (*save_cpu_ctxt)(hvm_domain_context_t *h, void *opaque);
- int (*load_cpu_ctxt)(hvm_domain_context_t *h, void *opaque, int version);
+ void (*save_cpu_ctxt)(struct vcpu *v, struct hvm_hw_cpu *ctxt);
+ int (*load_cpu_ctxt)(struct vcpu *v, struct hvm_hw_cpu *ctxt);
/*
* Examine specifics of the guest state:
diff --git a/xen/include/asm-x86/hvm/support.h b/xen/include/asm-x86/hvm/support.h
index 2d15019bb7..066fba87d0 100644
--- a/xen/include/asm-x86/hvm/support.h
+++ b/xen/include/asm-x86/hvm/support.h
@@ -119,136 +119,122 @@ extern unsigned int opt_hvm_debug_level;
#define TRACE_VMEXIT(index, value) \
current->arch.hvm_vcpu.hvm_trace_values[index] = (value)
-/* save/restore support */
-
-//#define HVM_DEBUG_SUSPEND
-
-extern int hvm_register_savevm(struct domain *d,
- const char *idstr,
- int instance_id,
- int version_id,
- SaveStateHandler *save_state,
- LoadStateHandler *load_state,
- void *opaque);
-
-static inline void hvm_ctxt_seek(hvm_domain_context_t *h, unsigned int pos)
-{
- h->cur = pos;
-}
-
-static inline uint32_t hvm_ctxt_tell(hvm_domain_context_t *h)
-{
- return h->cur;
-}
-
-static inline int hvm_ctxt_end(hvm_domain_context_t *h)
-{
- return (h->cur >= h->size || h->cur >= HVM_CTXT_SIZE);
-}
+/*
+ * Save/restore support
+ */
-static inline void hvm_put_byte(hvm_domain_context_t *h, unsigned int i)
+/* Marshalling an entry: check space and fill in the header */
+static inline int _hvm_init_entry(struct hvm_domain_context *h,
+ uint16_t tc, uint16_t inst, uint32_t len)
{
- if (h->cur >= HVM_CTXT_SIZE) {
- h->cur++;
- return;
+ struct hvm_save_descriptor *d
+ = (struct hvm_save_descriptor *)&h->data[h->cur];
+ if ( h->size - h->cur < len + sizeof (*d) )
+ {
+ gdprintk(XENLOG_WARNING,
+ "HVM save: no room for %"PRIu32" + %u bytes "
+ "for typecode %"PRIu16"\n",
+ len, (unsigned) sizeof (*d), tc);
+ return -1;
}
- h->data[h->cur++] = (char)i;
-}
-
-static inline void hvm_put_8u(hvm_domain_context_t *h, uint8_t b)
-{
- hvm_put_byte(h, b);
-}
-
-static inline void hvm_put_16u(hvm_domain_context_t *h, uint16_t b)
-{
- hvm_put_8u(h, b >> 8);
- hvm_put_8u(h, b);
-}
-
-static inline void hvm_put_32u(hvm_domain_context_t *h, uint32_t b)
-{
- hvm_put_16u(h, b >> 16);
- hvm_put_16u(h, b);
-}
-
-static inline void hvm_put_64u(hvm_domain_context_t *h, uint64_t b)
-{
- hvm_put_32u(h, b >> 32);
- hvm_put_32u(h, b);
-}
-
-static inline void hvm_put_buffer(hvm_domain_context_t *h, const char *buf, int len)
-{
- memcpy(&h->data[h->cur], buf, len);
- h->cur += len;
+ d->typecode = tc;
+ d->instance = inst;
+ d->length = len;
+ h->cur += sizeof (*d);
+ return 0;
}
-static inline char hvm_get_byte(hvm_domain_context_t *h)
+/* Marshalling: copy the contents in a type-safe way */
+#define _hvm_write_entry(_x, _h, _src) do { \
+ *(HVM_SAVE_TYPE(_x) *)(&(_h)->data[(_h)->cur]) = *(_src); \
+ (_h)->cur += HVM_SAVE_LENGTH(_x); \
+} while (0)
+
+/* Marshalling: init and copy; evaluates to zero on success */
+#define hvm_save_entry(_x, _inst, _h, _src) ({ \
+ int r; \
+ r = _hvm_init_entry((_h), HVM_SAVE_CODE(_x), \
+ (_inst), HVM_SAVE_LENGTH(_x)); \
+ if ( r == 0 ) \
+ _hvm_write_entry(_x, (_h), (_src)); \
+ r; })
+
+/* Unmarshalling: test an entry's size and typecode and record the instance */
+static inline int _hvm_check_entry(struct hvm_domain_context *h,
+ uint16_t type, uint32_t len)
{
- if (h->cur >= HVM_CTXT_SIZE) {
- printk("hvm_get_byte overflow.\n");
+ struct hvm_save_descriptor *d
+ = (struct hvm_save_descriptor *)&h->data[h->cur];
+ if ( len + sizeof (*d) > h->size - h->cur)
+ {
+ gdprintk(XENLOG_WARNING,
+ "HVM restore: not enough data left to read %u bytes "
+ "for type %u\n", len, type);
return -1;
- }
-
- if (h->cur >= h->size) {
- printk("hvm_get_byte exceed data area.\n");
+ }
+ if ( type != d->typecode || len != d->length )
+ {
+ gdprintk(XENLOG_WARNING,
+ "HVM restore mismatch: expected type %u length %u, "
+ "saw type %u length %u\n", type, len, d->typecode, d->length);
return -1;
}
-
- return h->data[h->cur++];
+ h->cur += sizeof (*d);
+ return 0;
}
-static inline uint8_t hvm_get_8u(hvm_domain_context_t *h)
+/* Unmarshalling: copy the contents in a type-safe way */
+#define _hvm_read_entry(_x, _h, _dst) do { \
+ *(_dst) = *(HVM_SAVE_TYPE(_x) *) (&(_h)->data[(_h)->cur]); \
+ (_h)->cur += HVM_SAVE_LENGTH(_x); \
+} while (0)
+
+/* Unmarshalling: check, then copy. Evaluates to zero on success. */
+#define hvm_load_entry(_x, _h, _dst) ({ \
+ int r; \
+ r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), HVM_SAVE_LENGTH(_x)); \
+ if ( r == 0 ) \
+ _hvm_read_entry(_x, (_h), (_dst)); \
+ r; })
+
+/* Unmarshalling: what is the instance ID of the next entry? */
+static inline uint16_t hvm_load_instance(struct hvm_domain_context *h)
{
- return hvm_get_byte(h);
+ struct hvm_save_descriptor *d
+ = (struct hvm_save_descriptor *)&h->data[h->cur];
+ return d->instance;
}
-static inline uint16_t hvm_get_16u(hvm_domain_context_t *h)
-{
- uint16_t v;
- v = hvm_get_8u(h) << 8;
- v |= hvm_get_8u(h);
-
- return v;
-}
-
-static inline uint32_t hvm_get_32u(hvm_domain_context_t *h)
-{
- uint32_t v;
- v = hvm_get_16u(h) << 16;
- v |= hvm_get_16u(h);
-
- return v;
-}
-
-static inline uint64_t hvm_get_64u(hvm_domain_context_t *h)
-{
- uint64_t v;
- v = (uint64_t)hvm_get_32u(h) << 32;
- v |= hvm_get_32u(h);
-
- return v;
-}
-
-static inline void hvm_get_buffer(hvm_domain_context_t *h, char *buf, int len)
-{
- memcpy(buf, &h->data[h->cur], len);
- h->cur += len;
-}
-
-#define hvm_put_struct(_h, _p) \
- hvm_put_buffer((_h), (char *)(_p), sizeof(*(_p)))
-#define hvm_get_struct(_h, _p) \
- hvm_get_buffer((_h), (char *)(_p), sizeof(*(_p)))
-
-int hvm_save(struct vcpu*, hvm_domain_context_t *h);
-int hvm_load(struct vcpu*, hvm_domain_context_t *h);
-
-int arch_sethvm_ctxt(struct vcpu *v, struct hvm_domain_context *c);
-int arch_gethvm_ctxt(struct vcpu *v, struct hvm_domain_context *c);
-
-void shpage_init(struct domain *d, shared_iopage_t *sp);
+/* Handler types for different types of save-file entry.
+ * The save handler may save multiple instances of a type into the buffer;
+ * the load handler will be called once for each instance found when
+ * restoring. Both return non-zero on error. */
+typedef int (*hvm_save_handler) (struct domain *d,
+ hvm_domain_context_t *h);
+typedef int (*hvm_load_handler) (struct domain *d,
+ hvm_domain_context_t *h);
+
+/* Init-time function to declare a pair of handlers for a type */
+void hvm_register_savevm(uint16_t typecode,
+ const char *name,
+ hvm_save_handler save_state,
+ hvm_load_handler load_state);
+
+/* Syntactic sugar around that function */
+#define HVM_REGISTER_SAVE_RESTORE(_x, _save, _load) \
+static int __hvm_register_##_x##_save_and_restore(void) \
+{ \
+ hvm_register_savevm(HVM_SAVE_CODE(_x), #_x, &_save, &_load); \
+ return 0; \
+} \
+__initcall(__hvm_register_##_x##_save_and_restore);
+
+
+/* Entry points for saving and restoring HVM domain state */
+int hvm_save(struct domain *d, hvm_domain_context_t *h);
+int hvm_load(struct domain *d, hvm_domain_context_t *h);
+
+/* End of save/restore */
extern char hvm_io_bitmap[];
extern int hvm_enabled;
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index d502a13eb3..f51e16948a 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -97,12 +97,11 @@ typedef struct PITState {
struct periodic_time pt[3];
} PITState;
-#define RTC_SIZE 14
typedef struct RTCState {
- uint8_t cmos_data[RTC_SIZE]; /* Only handle time/interrupt part in HV */
- uint8_t cmos_index;
+ /* Hardware state */
+ struct hvm_hw_rtc hw;
+ /* RTC's idea of the current time */
struct tm current_tm;
- int irq;
/* second update */
int64_t next_second_time;
struct timer second_timer;
@@ -145,7 +144,7 @@ void pit_init(struct vcpu *v, unsigned long cpu_khz);
void pit_stop_channel0_irq(PITState * pit);
void pit_migrate_timers(struct vcpu *v);
void pit_deinit(struct domain *d);
-void rtc_init(struct vcpu *v, int base, int irq);
+void rtc_init(struct vcpu *v, int base);
void rtc_migrate_timers(struct vcpu *v);
void rtc_deinit(struct domain *d);
int is_rtc_periodic_irq(void *opaque);
diff --git a/xen/include/public/foreign/Makefile b/xen/include/public/foreign/Makefile
index 599ce2f4fc..7f91dd87b9 100644
--- a/xen/include/public/foreign/Makefile
+++ b/xen/include/public/foreign/Makefile
@@ -14,12 +14,8 @@ clean:
rm -f *.pyc *.o *~
check-headers: checker
-ifeq ($(CROSS_COMPILE),)
./checker > $(XEN_TARGET_ARCH).size
diff -u reference.size $(XEN_TARGET_ARCH).size
-else
- @echo "cross build: skipping check"
-endif
x86_32.h: ../arch-x86/xen-x86_32.h ../arch-x86/xen.h ../xen.h $(scripts)
python mkheader.py $* $@ $(filter %.h,$^)
diff --git a/xen/include/public/hvm/save.h b/xen/include/public/hvm/save.h
index 9bd3e05667..fbf160b8ef 100644
--- a/xen/include/public/hvm/save.h
+++ b/xen/include/public/hvm/save.h
@@ -40,24 +40,52 @@
*/
/*
- * Save/restore header
+ * Each entry is preceded by a descriptor giving its type and length
+ */
+struct hvm_save_descriptor {
+ uint16_t typecode; /* Used to demux the various types below */
+ uint16_t instance; /* Further demux within a type */
+ uint32_t length; /* In bytes, *not* including this descriptor */
+};
+
+
+/*
+ * Each entry has a datatype associated with it: for example, the CPU state
+ * is saved as a HVM_SAVE_TYPE(CPU), which has HVM_SAVE_LENGTH(CPU),
+ * and is identified by a descriptor with typecode HVM_SAVE_CODE(CPU).
+ * DECLARE_HVM_SAVE_TYPE binds these things together with some type-system
+ * ugliness.
*/
-#define HVM_SAVE_TYPE_HEADER 0
+#define DECLARE_HVM_SAVE_TYPE(_x, _code, _type) \
+ struct __HVM_SAVE_TYPE_##_x { _type t; char c[_code]; }
+
+#define HVM_SAVE_TYPE(_x) typeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->t)
+#define HVM_SAVE_LENGTH(_x) (sizeof (HVM_SAVE_TYPE(_x)))
+#define HVM_SAVE_CODE(_x) (sizeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->c))
+
+
+/*
+ * Save/restore header: general info about the save file.
+ */
#define HVM_FILE_MAGIC 0x54381286
#define HVM_FILE_VERSION 0x00000001
struct hvm_save_header {
- uint32_t magic;
- uint32_t version;
- uint32_t cpuid;
+ uint32_t magic; /* Must be HVM_FILE_MAGIC */
+ uint32_t version; /* File format version */
+ uint64_t changeset; /* Version of Xen that saved this file */
+ uint32_t cpuid; /* CPUID[0x01][%eax] on the saving machine */
};
+DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);
+
+
/*
* Processor
*/
-#define HVM_SAVE_TYPE_CPU 1
+
struct hvm_hw_cpu {
uint64_t eip;
uint64_t esp;
@@ -124,11 +152,13 @@ struct hvm_hw_cpu {
uint64_t tsc;
};
+DECLARE_HVM_SAVE_TYPE(CPU, 2, struct hvm_hw_cpu);
+
/*
* PIT
*/
-#define HVM_SAVE_TYPE_PIT 2
+
struct hvm_hw_pit {
struct hvm_hw_pit_channel {
int64_t count_load_time;
@@ -148,11 +178,13 @@ struct hvm_hw_pit {
uint32_t speaker_data_on;
};
+DECLARE_HVM_SAVE_TYPE(PIT, 3, struct hvm_hw_pit);
+
/*
* PIC
*/
-#define HVM_SAVE_TYPE_PIC 3
+
struct hvm_hw_vpic {
/* IR line bitmasks. */
uint8_t irr;
@@ -201,11 +233,12 @@ struct hvm_hw_vpic {
uint8_t int_output;
};
+DECLARE_HVM_SAVE_TYPE(PIC, 4, struct hvm_hw_vpic);
+
/*
* IO-APIC
*/
-#define HVM_SAVE_TYPE_IOAPIC 4
#ifdef __ia64__
#define VIOAPIC_IS_IOSAPIC 1
@@ -242,11 +275,13 @@ struct hvm_hw_vioapic {
} redirtbl[VIOAPIC_NUM_PINS];
};
+DECLARE_HVM_SAVE_TYPE(IOAPIC, 5, struct hvm_hw_vioapic);
+
/*
* IRQ
*/
-#define HVM_SAVE_TYPE_IRQ 5
+
struct hvm_hw_irq {
/*
* Virtual interrupt wires for a single PCI bus.
@@ -309,22 +344,55 @@ struct hvm_hw_irq {
u8 round_robin_prev_vcpu;
};
+DECLARE_HVM_SAVE_TYPE(IRQ, 6, struct hvm_hw_irq);
/*
* LAPIC
*/
-#define HVM_SAVE_TYPE_LAPIC 6
+
struct hvm_hw_lapic {
uint64_t apic_base_msr;
uint32_t disabled; /* VLAPIC_xx_DISABLED */
uint32_t timer_divisor;
};
-#define HVM_SAVE_TYPE_LAPIC_REGS 7
+DECLARE_HVM_SAVE_TYPE(LAPIC, 7, struct hvm_hw_lapic);
struct hvm_hw_lapic_regs {
/* A 4k page of register state */
uint8_t data[0x400];
};
+DECLARE_HVM_SAVE_TYPE(LAPIC_REGS, 8, struct hvm_hw_lapic_regs);
+
+
+/*
+ * RTC
+ */
+
+#define RTC_CMOS_SIZE 14
+struct hvm_hw_rtc {
+ /* CMOS bytes */
+ uint8_t cmos_data[RTC_CMOS_SIZE];
+ /* Index register for 2-part operations */
+ uint8_t cmos_index;
+};
+
+DECLARE_HVM_SAVE_TYPE(RTC, 9, struct hvm_hw_rtc);
+
+
+/*
+ * Largest type-code in use
+ */
+#define HVM_SAVE_CODE_MAX 9
+
+
+/*
+ * The series of save records is teminated by a zero-type, zero-length
+ * descriptor.
+ */
+
+struct hvm_save_end {};
+DECLARE_HVM_SAVE_TYPE(END, 0, struct hvm_save_end);
+
#endif /* __XEN_PUBLIC_HVM_SAVE_H__ */
diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index 8a815534e4..40eb80a390 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -11,10 +11,6 @@
#include <xen/types.h>
#include <xen/byteorder/swab.h>
-#define __constant_htonl(x) ((__force __be32)(__u32)(x))
-#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
-#define __constant_htons(x) ((__force __be16)(__u16)(x))
-#define __constant_ntohs(x) ((__force __u16)(__be16)(x))
#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 24ac42701e..4955632793 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -11,10 +11,6 @@
#include <xen/types.h>
#include <xen/byteorder/swab.h>
-#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
-#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
-#define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
-#define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 44ad7874cc..78c57faf06 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -60,10 +60,8 @@ extern int __printk_ratelimit(int ratelimit_ms, int ratelimit_burst);
extern int printk_ratelimit(void);
/* vsprintf.c */
-extern int sprintf(char * buf, const char * fmt, ...)
- __attribute__ ((format (printf, 2, 3)));
-extern int vsprintf(char *buf, const char *, va_list)
- __attribute__ ((format (printf, 2, 0)));
+#define sprintf __xen_has_no_sprintf__
+#define vsprintf __xen_has_no_vsprintf__
extern int snprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
index 347ca8358a..d0c23a1411 100644
--- a/xen/include/xen/string.h
+++ b/xen/include/xen/string.h
@@ -19,20 +19,20 @@ extern __kernel_size_t strspn(const char *,const char *);
*/
#include <asm/string.h>
-#ifndef __HAVE_ARCH_STRCPY
-extern char * strcpy(char *,const char *);
-#endif
-#ifndef __HAVE_ARCH_STRNCPY
-extern char * strncpy(char *,const char *, __kernel_size_t);
-#endif
+/*
+ * These string functions are considered too dangerous for normal use.
+ * Use safe_strcpy(), safe_strcat(), strlcpy(), strlcat() as appropriate.
+ */
+#define strcpy __xen_has_no_strcpy__
+#define strcat __xen_has_no_strcat__
+#define strncpy __xen_has_no_strncpy__
+#define strncat __xen_has_no_strncat__
+
#ifndef __HAVE_ARCH_STRLCPY
extern size_t strlcpy(char *,const char *, __kernel_size_t);
#endif
-#ifndef __HAVE_ARCH_STRCAT
-extern char * strcat(char *, const char *);
-#endif
-#ifndef __HAVE_ARCH_STRNCAT
-extern char * strncat(char *, const char *, __kernel_size_t);
+#ifndef __HAVE_ARCH_STRLCAT
+extern size_t strlcat(char *,const char *, __kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRCMP
extern int strcmp(const char *,const char *);
@@ -82,9 +82,8 @@ extern void * memchr(const void *,int,__kernel_size_t);
}
#endif
-#define safe_strcpy(d,s) \
-do { strncpy((d),(s),sizeof((d))); \
- (d)[sizeof((d))-1] = '\0'; \
-} while (0)
+/* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */
+#define safe_strcpy(d, s) (strlcpy(d, s, sizeof(d)) >= sizeof(d))
+#define safe_strcat(d, s) (strlcat(d, s, sizeof(d)) >= sizeof(d))
#endif /* _LINUX_STRING_H_ */