mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools: drop libxen
This was a C interface to a very early version of the XenAPI, it has not kept up with developments to the API e.g. in xapi. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
9e8672f1c3
commit
185bb58be3
117 files changed
-23744
No files matched your search
@@ -198,9 +198,6 @@ tools/hotplug/common/hotplugpath.sh
|
|||||||
tools/include/xen/*
|
tools/include/xen/*
|
||||||
tools/include/xen-foreign/*.(c|h|size)
|
tools/include/xen-foreign/*.(c|h|size)
|
||||||
tools/include/xen-foreign/checker
|
tools/include/xen-foreign/checker
|
||||||
tools/libxen/libxenapi-
|
|
||||||
tools/libxen/test/test_bindings
|
|
||||||
tools/libxen/test/test_event_handling
|
|
||||||
tools/libxl/libxlu_cfg_y.output
|
tools/libxl/libxlu_cfg_y.output
|
||||||
tools/libxl/xl
|
tools/libxl/xl
|
||||||
tools/libxl/testenum
|
tools/libxl/testenum
|
||||||
|
|||||||
@@ -186,9 +186,6 @@
|
|||||||
^tools/include/xen/.*$
|
^tools/include/xen/.*$
|
||||||
^tools/include/xen-foreign/.*\.(c|h|size)$
|
^tools/include/xen-foreign/.*\.(c|h|size)$
|
||||||
^tools/include/xen-foreign/checker$
|
^tools/include/xen-foreign/checker$
|
||||||
^tools/libxen/libxenapi-
|
|
||||||
^tools/libxen/test/test_bindings$
|
|
||||||
^tools/libxen/test/test_event_handling$
|
|
||||||
^tools/libxl/_.*\.h$
|
^tools/libxl/_.*\.h$
|
||||||
^tools/libxl/_.*\.c$
|
^tools/libxl/_.*\.c$
|
||||||
^tools/libxl/libxlu_cfg_y\.output$
|
^tools/libxl/libxlu_cfg_y\.output$
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ GIT_HTTP := @githttp@
|
|||||||
|
|
||||||
# Optional components
|
# Optional components
|
||||||
XENSTAT_XENTOP := @monitors@
|
XENSTAT_XENTOP := @monitors@
|
||||||
LIBXENAPI_BINDINGS := @xenapi@
|
|
||||||
OCAML_TOOLS := @ocamltools@
|
OCAML_TOOLS := @ocamltools@
|
||||||
FLASK_POLICY := @xsmpolicy@
|
FLASK_POLICY := @xsmpolicy@
|
||||||
CONFIG_OVMF := @ovmf@
|
CONFIG_OVMF := @ovmf@
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ SUBDIRS-$(CONFIG_Linux) += blktap2
|
|||||||
SUBDIRS-$(CONFIG_NetBSD) += blktap2
|
SUBDIRS-$(CONFIG_NetBSD) += blktap2
|
||||||
SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
|
SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
|
||||||
SUBDIRS-y += libfsimage
|
SUBDIRS-y += libfsimage
|
||||||
SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
|
|
||||||
SUBDIRS-$(CONFIG_Linux) += libvchan
|
SUBDIRS-$(CONFIG_Linux) += libvchan
|
||||||
|
|
||||||
# do not recurse in to a dir we are about to delete
|
# do not recurse in to a dir we are about to delete
|
||||||
|
|||||||
Vendored
-120
@@ -694,7 +694,6 @@ rombios
|
|||||||
ovmf
|
ovmf
|
||||||
xsmpolicy
|
xsmpolicy
|
||||||
ocamltools
|
ocamltools
|
||||||
xenapi
|
|
||||||
monitors
|
monitors
|
||||||
githttp
|
githttp
|
||||||
FILE_OFFSET_BITS
|
FILE_OFFSET_BITS
|
||||||
@@ -757,7 +756,6 @@ enable_option_checking
|
|||||||
enable_largefile
|
enable_largefile
|
||||||
enable_githttp
|
enable_githttp
|
||||||
enable_monitors
|
enable_monitors
|
||||||
enable_xenapi
|
|
||||||
enable_ocamltools
|
enable_ocamltools
|
||||||
enable_xsmpolicy
|
enable_xsmpolicy
|
||||||
enable_ovmf
|
enable_ovmf
|
||||||
@@ -1418,7 +1416,6 @@ Optional Features:
|
|||||||
DISABLED)
|
DISABLED)
|
||||||
--disable-monitors Disable xenstat and xentop monitoring tools (default
|
--disable-monitors Disable xenstat and xentop monitoring tools (default
|
||||||
is ENABLED)
|
is ENABLED)
|
||||||
--enable-xenapi Enable Xen API Bindings (default is DISABLED)
|
|
||||||
--disable-ocamltools Disable Ocaml tools (default is ENABLED)
|
--disable-ocamltools Disable Ocaml tools (default is ENABLED)
|
||||||
--disable-xsmpolicy Disable XSM policy compilation (default is ENABLED)
|
--disable-xsmpolicy Disable XSM policy compilation (default is ENABLED)
|
||||||
--enable-ovmf Enable OVMF (default is DISABLED)
|
--enable-ovmf Enable OVMF (default is DISABLED)
|
||||||
@@ -3583,29 +3580,6 @@ monitors=$ax_cv_monitors
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-xenapi was given.
|
|
||||||
if test "${enable_xenapi+set}" = set; then :
|
|
||||||
enableval=$enable_xenapi;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test "x$enable_xenapi" = "xno"; then :
|
|
||||||
|
|
||||||
ax_cv_xenapi="n"
|
|
||||||
|
|
||||||
elif test "x$enable_xenapi" = "xyes"; then :
|
|
||||||
|
|
||||||
ax_cv_xenapi="y"
|
|
||||||
|
|
||||||
elif test -z $ax_cv_xenapi; then :
|
|
||||||
|
|
||||||
ax_cv_xenapi="n"
|
|
||||||
|
|
||||||
fi
|
|
||||||
xenapi=$ax_cv_xenapi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-ocamltools was given.
|
# Check whether --enable-ocamltools was given.
|
||||||
if test "${enable_ocamltools+set}" = set; then :
|
if test "${enable_ocamltools+set}" = set; then :
|
||||||
enableval=$enable_ocamltools;
|
enableval=$enable_ocamltools;
|
||||||
@@ -4675,100 +4649,6 @@ fi
|
|||||||
if test x"${PERL}" = x"no"
|
if test x"${PERL}" = x"no"
|
||||||
then
|
then
|
||||||
as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
|
as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
|
||||||
fi
|
|
||||||
if test "x$xenapi" = "xy"; then :
|
|
||||||
|
|
||||||
# Extract the first word of "curl-config", so it can be a program name with args.
|
|
||||||
set dummy curl-config; ac_word=$2
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
||||||
$as_echo_n "checking for $ac_word... " >&6; }
|
|
||||||
if ${ac_cv_path_CURL+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
case $CURL in
|
|
||||||
[\\/]* | ?:[\\/]*)
|
|
||||||
ac_cv_path_CURL="$CURL" # Let the user override the test with a path.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
|
||||||
for as_dir in $PATH
|
|
||||||
do
|
|
||||||
IFS=$as_save_IFS
|
|
||||||
test -z "$as_dir" && as_dir=.
|
|
||||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
|
||||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
|
||||||
ac_cv_path_CURL="$as_dir/$ac_word$ac_exec_ext"
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
IFS=$as_save_IFS
|
|
||||||
|
|
||||||
test -z "$ac_cv_path_CURL" && ac_cv_path_CURL="no"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
CURL=$ac_cv_path_CURL
|
|
||||||
if test -n "$CURL"; then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL" >&5
|
|
||||||
$as_echo "$CURL" >&6; }
|
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test x"${CURL}" = x"no"
|
|
||||||
then
|
|
||||||
as_fn_error $? "Unable to find curl-config, please install curl-config" "$LINENO" 5
|
|
||||||
fi
|
|
||||||
# Extract the first word of "xml2-config", so it can be a program name with args.
|
|
||||||
set dummy xml2-config; ac_word=$2
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
||||||
$as_echo_n "checking for $ac_word... " >&6; }
|
|
||||||
if ${ac_cv_path_XML+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
case $XML in
|
|
||||||
[\\/]* | ?:[\\/]*)
|
|
||||||
ac_cv_path_XML="$XML" # Let the user override the test with a path.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
|
||||||
for as_dir in $PATH
|
|
||||||
do
|
|
||||||
IFS=$as_save_IFS
|
|
||||||
test -z "$as_dir" && as_dir=.
|
|
||||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
|
||||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
|
||||||
ac_cv_path_XML="$as_dir/$ac_word$ac_exec_ext"
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
IFS=$as_save_IFS
|
|
||||||
|
|
||||||
test -z "$ac_cv_path_XML" && ac_cv_path_XML="no"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
XML=$ac_cv_path_XML
|
|
||||||
if test -n "$XML"; then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML" >&5
|
|
||||||
$as_echo "$XML" >&6; }
|
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test x"${XML}" = x"no"
|
|
||||||
then
|
|
||||||
as_fn_error $? "Unable to find xml2-config, please install xml2-config" "$LINENO" 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
for ac_prog in gawk mawk nawk awk
|
for ac_prog in gawk mawk nawk awk
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ m4_include([../m4/ax_compare_version.m4])
|
|||||||
# Enable/disable options
|
# Enable/disable options
|
||||||
AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
|
AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
|
||||||
AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
|
AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
|
||||||
AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings])
|
|
||||||
AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
|
AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
|
||||||
AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
|
AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
|
||||||
AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
|
AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
|
||||||
@@ -150,10 +149,6 @@ AC_PROG_INSTALL
|
|||||||
AC_PATH_PROG([BISON], [bison])
|
AC_PATH_PROG([BISON], [bison])
|
||||||
AC_PATH_PROG([FLEX], [flex])
|
AC_PATH_PROG([FLEX], [flex])
|
||||||
AX_PATH_PROG_OR_FAIL([PERL], [perl])
|
AX_PATH_PROG_OR_FAIL([PERL], [perl])
|
||||||
AS_IF([test "x$xenapi" = "xy"], [
|
|
||||||
AX_PATH_PROG_OR_FAIL([CURL], [curl-config])
|
|
||||||
AX_PATH_PROG_OR_FAIL([XML], [xml2-config])
|
|
||||||
])
|
|
||||||
AS_IF([test "x$ocamltools" = "xy"], [
|
AS_IF([test "x$ocamltools" = "xy"], [
|
||||||
AC_PROG_OCAML
|
AC_PROG_OCAML
|
||||||
AC_PROG_FINDLIB
|
AC_PROG_FINDLIB
|
||||||
|
|||||||
@@ -1,510 +0,0 @@
|
|||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 2.1, February 1999
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
|
||||||
can use it too, but we suggest you first think carefully about whether
|
|
||||||
this license or the ordinary General Public License is the better
|
|
||||||
strategy to use in any particular case, based on the explanations
|
|
||||||
below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish); that you receive source code or can get
|
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
|
||||||
you if you distribute copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
|
||||||
permission to copy, distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
|
||||||
there is no warranty for the free library. Also, if the library is
|
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
|
||||||
author's reputation will not be affected by problems that might be
|
|
||||||
introduced by others.
|
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
|
||||||
General Public License, applies to certain designated libraries, and
|
|
||||||
is quite different from the ordinary General Public License. We use
|
|
||||||
this license for certain libraries in order to permit linking those
|
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it
|
|
||||||
becomes a de-facto standard. To achieve this, non-free programs must
|
|
||||||
be allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow. Pay close attention to the difference between a
|
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
|
||||||
program which contains a notice placed by the copyright holder or
|
|
||||||
other authorized party saying it may be distributed under the terms of
|
|
||||||
this Lesser General Public License (also called "this License").
|
|
||||||
Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control
|
|
||||||
compilation and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
|
||||||
writing it). Whether that is true depends on what the Library does
|
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty; and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
|
||||||
and you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
|
||||||
of it, thus forming a work based on the Library, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at least
|
|
||||||
three years, to give the same user the materials specified in
|
|
||||||
Subsection 6a, above, for a charge no more than the cost of
|
|
||||||
performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply, and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding those
|
|
||||||
countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
|
||||||
possible use to the public, we recommend making it free software that
|
|
||||||
everyone can redistribute and change. You can do so by permitting
|
|
||||||
redistribution under these terms (or, alternatively, under the terms
|
|
||||||
of the ordinary General Public License).
|
|
||||||
|
|
||||||
To apply these terms, attach the following notices to the library.
|
|
||||||
It is safest to attach them to the start of each source file to most
|
|
||||||
effectively convey the exclusion of warranty; and each file should
|
|
||||||
have at least the "copyright" line and a pointer to where the full
|
|
||||||
notice is found.
|
|
||||||
|
|
||||||
|
|
||||||
<one line to give the library's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or
|
|
||||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
|
||||||
if necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
|
||||||
library `Frob' (a library for tweaking knobs) written by James
|
|
||||||
Random Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1990
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
That's all there is to it!
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2006-2007, 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
|
|
||||||
#
|
|
||||||
XEN_ROOT=$(CURDIR)/../..
|
|
||||||
include $(XEN_ROOT)/tools/Rules.mk
|
|
||||||
|
|
||||||
MAJOR = 1.0
|
|
||||||
MINOR = 0
|
|
||||||
|
|
||||||
CFLAGS += -Iinclude \
|
|
||||||
-fPIC
|
|
||||||
|
|
||||||
ifeq ($(LIBXENAPI_BINDINGS),y)
|
|
||||||
CFLAGS += $(shell $(XML2_CONFIG) --cflags) \
|
|
||||||
$(shell $(CURL_CONFIG) --cflags)
|
|
||||||
|
|
||||||
LDFLAGS += $(shell $(XML2_CONFIG) --libs) \
|
|
||||||
$(shell $(CURL_CONFIG) --libs)
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBXENAPI_HDRS = $(wildcard include/xen/api/*.h) include/xen/api/xen_all.h
|
|
||||||
LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
|
|
||||||
|
|
||||||
TEST_PROGRAMS = test/test_bindings test/test_event_handling
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: libxenapi.so libxenapi.a
|
|
||||||
|
|
||||||
libxenapi.so: libxenapi.so.$(MAJOR)
|
|
||||||
ln -sf $< $@
|
|
||||||
|
|
||||||
libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
|
|
||||||
ln -sf $< $@
|
|
||||||
|
|
||||||
libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
|
|
||||||
$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(APPEND_LDFLAGS)
|
|
||||||
|
|
||||||
libxenapi.a: $(LIBXENAPI_OBJS)
|
|
||||||
$(AR) rcs libxenapi.a $^
|
|
||||||
|
|
||||||
$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
|
|
||||||
$(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi $(APPEND_LDFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: all
|
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/api
|
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
|
|
||||||
$(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
|
|
||||||
ln -sf libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenapi.so.$(MAJOR)
|
|
||||||
ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenapi.so
|
|
||||||
$(INSTALL_DATA) libxenapi.a $(DESTDIR)$(LIBDIR)
|
|
||||||
set -e; for i in $(LIBXENAPI_HDRS); do \
|
|
||||||
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEDIR)/xen/api; \
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f `find -name *.o`
|
|
||||||
rm -f libxenapi.so*
|
|
||||||
rm -f libxenapi.a
|
|
||||||
rm -f $(TEST_PROGRAMS)
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2006-2007, 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
|
|
||||||
#
|
|
||||||
|
|
||||||
MAJOR = 1.0
|
|
||||||
MINOR = 0
|
|
||||||
|
|
||||||
CFLAGS = -Iinclude \
|
|
||||||
$(shell xml2-config --cflags) \
|
|
||||||
$(shell curl-config --cflags) \
|
|
||||||
-W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
|
|
||||||
|
|
||||||
LDFLAGS = $(shell xml2-config --libs) \
|
|
||||||
$(shell curl-config --libs)
|
|
||||||
|
|
||||||
# -h for Solaris
|
|
||||||
SONAME_LDFLAG ?= -soname
|
|
||||||
# -R /usr/sfw/$(LIBDIR) -shared for Solaris
|
|
||||||
SHLIB_LDFLAGS ?= -shared
|
|
||||||
|
|
||||||
# ginstall for Solaris
|
|
||||||
INSTALL = install
|
|
||||||
INSTALL_DIR = $(INSTALL) -d -m0755 -p
|
|
||||||
INSTALL_DATA = $(INSTALL) -m0644 -p
|
|
||||||
|
|
||||||
LIBXENAPI_HDRS = $(wildcard include/*.h)
|
|
||||||
LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
|
|
||||||
|
|
||||||
TEST_PROGRAMS = test/test_bindings test/test_event_handling
|
|
||||||
|
|
||||||
TARBALL_DEST = libxenapi-$(MAJOR).$(MINOR)
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: $(TEST_PROGRAMS)
|
|
||||||
|
|
||||||
libxenapi.so: libxenapi.so.$(MAJOR)
|
|
||||||
ln -sf $< $@
|
|
||||||
|
|
||||||
libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
|
|
||||||
ln -sf $< $@
|
|
||||||
|
|
||||||
libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
|
|
||||||
$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
|
|
||||||
|
|
||||||
libxenapi.a: $(LIBXENAPI_OBJS)
|
|
||||||
$(AR) rcs libxenapi.a $^
|
|
||||||
|
|
||||||
$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
|
|
||||||
$(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: all
|
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/api
|
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
|
|
||||||
$(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
|
|
||||||
ln -sf libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenapi.so.$(MAJOR)
|
|
||||||
ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenapi.so
|
|
||||||
$(INSTALL_DATA) libxenapi.a $(DESTDIR)$(LIBDIR)
|
|
||||||
set -e; for i in $(LIBXENAPI_HDRS); do \
|
|
||||||
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEDIR)/xen/api; \
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: tarball
|
|
||||||
tarball: $(TARBALL_DEST).tar.bz2
|
|
||||||
|
|
||||||
$(TARBALL_DEST).tar.bz2: all
|
|
||||||
rm -Rf $(TARBALL_DEST)
|
|
||||||
mkdir -p $(TARBALL_DEST)/include/xen/api
|
|
||||||
mkdir -p $(TARBALL_DEST)/src
|
|
||||||
mkdir -p $(TARBALL_DEST)/test
|
|
||||||
cp COPYING $(TARBALL_DEST)
|
|
||||||
cp Makefile.dist $(TARBALL_DEST)/Makefile
|
|
||||||
cp Makefile.dist $(TARBALL_DEST)/Makefile.dist
|
|
||||||
cp README $(TARBALL_DEST)
|
|
||||||
cp include/*.h $(TARBALL_DEST)/include
|
|
||||||
cp include/xen/api/*.h $(TARBALL_DEST)/include/xen/api
|
|
||||||
cp src/*.c $(TARBALL_DEST)/src
|
|
||||||
cp test/*.c $(TARBALL_DEST)/test
|
|
||||||
fakeroot chown root:root -R $(TARBALL_DEST)
|
|
||||||
fakeroot tar cjf $(TARBALL_DEST).tar.bz2 $(TARBALL_DEST)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f `find -name *.o`
|
|
||||||
rm -f libxenapi.so*
|
|
||||||
rm -f libxenapi.a
|
|
||||||
rm -f $(TEST_PROGRAMS)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: uberheader
|
|
||||||
uberheader: include/xen/api/xen_all.h
|
|
||||||
include/xen/api/xen_all.h::
|
|
||||||
echo "/* This file is autogenerated */" >$@
|
|
||||||
echo "#ifndef XEN_API_XEN_ALL_H" >>$@
|
|
||||||
echo "#define XEN_API_XEN_ALL_H" >>$@
|
|
||||||
ls include/xen/api/*.h | grep -v xen_all.h | grep -v _decl.h | \
|
|
||||||
sed 's,^include/\(.*\)$$,#include <\1>,g' >>$@
|
|
||||||
echo "#endif" >>$@
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
Xen API C Bindings
|
|
||||||
==================
|
|
||||||
|
|
||||||
This distribution is the source code to the proposed Xen API C bindings.
|
|
||||||
|
|
||||||
The Xen API project will define an XML-RPC protocol for remote and local
|
|
||||||
management of Xen-based systems, and a set of bindings for these XML-RPC calls
|
|
||||||
into a number of languages (this package contains those to the C language).
|
|
||||||
|
|
||||||
The intention is to standardise these XML-RPC calls, and then the Xen project
|
|
||||||
will guarantee that that wire protocol will be supported for the long term.
|
|
||||||
The bindings will also be supported in the Xen tree, giving a stable
|
|
||||||
foundation for Xen management tools and middlewares, in particular the Xen CIM
|
|
||||||
providers and libvirt.
|
|
||||||
|
|
||||||
THIS IS A WORK IN PROGRESS. The API and bindings are under active design and
|
|
||||||
development, and this is a snapshot release for developers only. Both the API
|
|
||||||
and the C bindings are scheduled to be stabilised by the Xen 3.0.4 release
|
|
||||||
i.e. October 2006 at the earliest.
|
|
||||||
|
|
||||||
These bindings are open-source (LGPL), and will be committed as libraries to
|
|
||||||
the Xen trees for all to use after the Xen 3.0.3 release.
|
|
||||||
|
|
||||||
We welcome any discussion about this library and the API in general. Please
|
|
||||||
join the Xen-API mailing list if you are interested in this project. I (Ewan
|
|
||||||
Mellor) will collate all the feedback from that list and push out new versions
|
|
||||||
of the document and the bindings as and when.
|
|
||||||
|
|
||||||
|
|
||||||
URLs
|
|
||||||
----
|
|
||||||
|
|
||||||
Xen-API wiki page:
|
|
||||||
http://wiki.xensource.com/xenwiki/XenApi
|
|
||||||
|
|
||||||
Xen-API mailing list:
|
|
||||||
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
|
|
||||||
|
|
||||||
|
|
||||||
Usage
|
|
||||||
-----
|
|
||||||
|
|
||||||
The bindings depend upon libxml2, the XML toolkit from the GNOME project; the
|
|
||||||
test program depends upon libcurl3 also. On Debian, you need the packages
|
|
||||||
libxml2-dev and libcurl3-dev.
|
|
||||||
|
|
||||||
To compile, type make. To compile the test also, type make
|
|
||||||
test/test_bindings, remembering the additional dependency.
|
|
||||||
|
|
||||||
To run the test, do
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH=. ./test/test_bindings <url> <username> <password>
|
|
||||||
|
|
||||||
where <url> is the fragment of the server URL that follows the http://, for
|
|
||||||
example "localhost:8005/RPC2".
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/* This file is autogenerated */
|
|
||||||
#ifndef XEN_API_XEN_ALL_H
|
|
||||||
#define XEN_API_XEN_ALL_H
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_console.h>
|
|
||||||
#include <xen/api/xen_console_protocol.h>
|
|
||||||
#include <xen/api/xen_crashdump.h>
|
|
||||||
#include <xen/api/xen_event.h>
|
|
||||||
#include <xen/api/xen_event_operation.h>
|
|
||||||
#include <xen/api/xen_host_cpu.h>
|
|
||||||
#include <xen/api/xen_host.h>
|
|
||||||
#include <xen/api/xen_host_metrics.h>
|
|
||||||
#include <xen/api/xen_int_float_map.h>
|
|
||||||
#include <xen/api/xen_int_int_map.h>
|
|
||||||
#include <xen/api/xen_int_string_set_map.h>
|
|
||||||
#include <xen/api/xen_network.h>
|
|
||||||
#include <xen/api/xen_on_crash_behaviour.h>
|
|
||||||
#include <xen/api/xen_on_normal_exit.h>
|
|
||||||
#include <xen/api/xen_pbd.h>
|
|
||||||
#include <xen/api/xen_pif.h>
|
|
||||||
#include <xen/api/xen_pif_metrics.h>
|
|
||||||
#include <xen/api/xen_sr.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_user.h>
|
|
||||||
#include <xen/api/xen_vbd.h>
|
|
||||||
#include <xen/api/xen_vbd_metrics.h>
|
|
||||||
#include <xen/api/xen_vbd_mode.h>
|
|
||||||
#include <xen/api/xen_vbd_type.h>
|
|
||||||
#include <xen/api/xen_vdi.h>
|
|
||||||
#include <xen/api/xen_vdi_type.h>
|
|
||||||
#include <xen/api/xen_vif.h>
|
|
||||||
#include <xen/api/xen_vif_metrics.h>
|
|
||||||
#include <xen/api/xen_vm_guest_metrics.h>
|
|
||||||
#include <xen/api/xen_vm.h>
|
|
||||||
#include <xen/api/xen_vm_metrics.h>
|
|
||||||
#include <xen/api/xen_vm_power_state.h>
|
|
||||||
#include <xen/api/xen_xspolicy.h>
|
|
||||||
#include <xen/api/xen_cpu_pool.h>
|
|
||||||
#endif
|
|
||||||
@@ -1,211 +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_COMMON_H
|
|
||||||
#define XEN_COMMON_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "xen/api/xen_host_decl.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef bool (*xen_result_func)(const void *data, size_t len,
|
|
||||||
void *result_handle);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* len does not include a terminating \0.
|
|
||||||
*/
|
|
||||||
typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
|
|
||||||
void *result_handle,
|
|
||||||
xen_result_func result_func);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
xen_call_func call_func;
|
|
||||||
void *handle;
|
|
||||||
const char *session_id;
|
|
||||||
bool ok;
|
|
||||||
char **error_description;
|
|
||||||
int error_description_count;
|
|
||||||
} xen_session;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_session_record
|
|
||||||
{
|
|
||||||
char *uuid;
|
|
||||||
struct xen_host_record_opt *this_host;
|
|
||||||
char *this_user;
|
|
||||||
time_t last_active;
|
|
||||||
} xen_session_record;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_session_record.
|
|
||||||
*/
|
|
||||||
extern xen_session_record *
|
|
||||||
xen_session_record_alloc(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_session_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_session_record_free(xen_session_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
struct xen_task_;
|
|
||||||
typedef struct xen_task_ * xen_task_id;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int progress;
|
|
||||||
long eta;
|
|
||||||
/* !!! RESULT */
|
|
||||||
} xen_task_status;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int major;
|
|
||||||
int minor;
|
|
||||||
int patch;
|
|
||||||
char *extraversion;
|
|
||||||
} xen_version;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_version, and all referenced values.
|
|
||||||
*/
|
|
||||||
extern void xen_version_free(xen_version *version);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the version of this client-side library. This will be the major,
|
|
||||||
* minor, and extraversion of the Xen release with which it was released,
|
|
||||||
* plus the library's own version as the patch.
|
|
||||||
*/
|
|
||||||
extern xen_version *xen_get_client_side_version(void);
|
|
||||||
|
|
||||||
|
|
||||||
extern bool
|
|
||||||
xen_uuid_string_to_bytes(char *uuid, char **bytes);
|
|
||||||
|
|
||||||
|
|
||||||
extern bool
|
|
||||||
xen_uuid_bytes_to_string(char *bytes, char **uuid);
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_uuid_free(char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_uuid_bytes_free(char *bytes);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise this library. Call this before starting to use this library.
|
|
||||||
* Note that since this library depends upon libxml2, you should also call
|
|
||||||
* xmlInitParser as appropriate for your program.
|
|
||||||
*/
|
|
||||||
extern
|
|
||||||
void xen_init(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear up this library. Call when you have finished using this library.
|
|
||||||
* Note that since this library depends upon libxml2, you should also call
|
|
||||||
* xmlCleanupParser as appropriate for your program.
|
|
||||||
*/
|
|
||||||
extern
|
|
||||||
void xen_fini(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log in at the server, and allocate a xen_session to represent this session.
|
|
||||||
*/
|
|
||||||
extern xen_session *
|
|
||||||
xen_session_login_with_password(xen_call_func call_func, void *handle,
|
|
||||||
const char *uname, const char *pwd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log out at the server, and free the xen_session.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_session_logout(xen_session *session);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear any error condition recorded on this session.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
xen_session_clear_error(xen_session *session);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the UUID of the second given session. Set *result to point at a
|
|
||||||
* string, yours to free.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_session_get_uuid(xen_session *session, char **result,
|
|
||||||
xen_session *self_session);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the this_host field of the second given session. Set *result to be a
|
|
||||||
* handle to that host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_session_get_this_host(xen_session *session, xen_host *result,
|
|
||||||
xen_session *self_session);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the this_user field of the second given session. Set *result to point
|
|
||||||
* at a string, yours to free.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_session_get_this_user(xen_session *session, char **result,
|
|
||||||
xen_session *self_session);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_active field of the given session, and place it in *result.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_session_get_last_active(xen_session *session, time_t *result,
|
|
||||||
xen_session *self_session);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the second given session.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_session_get_record(xen_session *session, xen_session_record **result,
|
|
||||||
xen_session *self_session);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,247 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_CONSOLE_H
|
|
||||||
#define XEN_CONSOLE_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_console_decl.h>
|
|
||||||
#include <xen/api/xen_console_protocol.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vm_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The console class.
|
|
||||||
*
|
|
||||||
* A console.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console. The given handle must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_free(xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_console_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_console *contents[];
|
|
||||||
} xen_console_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_console_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_console_set *
|
|
||||||
xen_console_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_set_free(xen_console_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_console_record
|
|
||||||
{
|
|
||||||
xen_console handle;
|
|
||||||
char *uuid;
|
|
||||||
enum xen_console_protocol protocol;
|
|
||||||
char *location;
|
|
||||||
struct xen_vm_record_opt *vm;
|
|
||||||
xen_string_string_map *other_config;
|
|
||||||
} xen_console_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_console_record.
|
|
||||||
*/
|
|
||||||
extern xen_console_record *
|
|
||||||
xen_console_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_record_free(xen_console_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_console_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_console handle;
|
|
||||||
xen_console_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_console_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_console_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_console_record_opt *
|
|
||||||
xen_console_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console_record_opt, and all referenced values.
|
|
||||||
* The given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_record_opt_free(xen_console_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_console_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_console_record *contents[];
|
|
||||||
} xen_console_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_console_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_console_record_set *
|
|
||||||
xen_console_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console_record_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_record_set_free(xen_console_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_console_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_console_record_opt *contents[];
|
|
||||||
} xen_console_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_console_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_console_record_opt_set *
|
|
||||||
xen_console_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console_record_opt_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_record_opt_set_free(xen_console_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the console instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new console instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_create(xen_session *session, xen_console *result, xen_console_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified console instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_destroy(xen_session *session, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_uuid(xen_session *session, char **result, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the protocol field of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the location field of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_location(xen_session *session, char **result, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VM field of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the other_config field of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the other_config field of the given console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the other_config field of the given
|
|
||||||
* console.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* other_config field of the given console. If the key is not in that Map,
|
|
||||||
* then do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the consoles known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_console_get_all(xen_session *session, struct xen_console_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_CONSOLE_DECL_H
|
|
||||||
#define XEN_CONSOLE_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_console;
|
|
||||||
|
|
||||||
struct xen_console_set;
|
|
||||||
struct xen_console_record;
|
|
||||||
struct xen_console_record_set;
|
|
||||||
struct xen_console_record_opt;
|
|
||||||
struct xen_console_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_CONSOLE_PROTOCOL_H
|
|
||||||
#define XEN_CONSOLE_PROTOCOL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_console_protocol
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* VT100 terminal
|
|
||||||
*/
|
|
||||||
XEN_CONSOLE_PROTOCOL_VT100,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remote FrameBuffer protocol (as used in VNC)
|
|
||||||
*/
|
|
||||||
XEN_CONSOLE_PROTOCOL_RFB,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remote Desktop Protocol
|
|
||||||
*/
|
|
||||||
XEN_CONSOLE_PROTOCOL_RDP
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_console_protocol_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_console_protocol contents[];
|
|
||||||
} xen_console_protocol_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_console_protocol_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_console_protocol_set *
|
|
||||||
xen_console_protocol_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_console_protocol_set. The given set must have
|
|
||||||
* been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_console_protocol_set_free(xen_console_protocol_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_console_protocol_to_string(enum xen_console_protocol 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_console_protocol
|
|
||||||
xen_console_protocol_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,424 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_POOL_H
|
|
||||||
#define XEN_CPU_POOL_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_host_cpu_decl.h>
|
|
||||||
#include <xen/api/xen_host.h>
|
|
||||||
#include <xen/api/xen_vm_decl.h>
|
|
||||||
#include <xen/api/xen_vm.h>
|
|
||||||
#include <xen/api/xen_cpu_pool_decl.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The cpu_pool class.
|
|
||||||
*
|
|
||||||
* Management of CPU pools.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_cpu_pool. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_cpu_pool_free(xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_cpu_pool_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_cpu_pool *contents[];
|
|
||||||
} xen_cpu_pool_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_cpu_pool_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_cpu_pool_set *
|
|
||||||
xen_cpu_pool_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_cpu_pool_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_cpu_pool_set_free(xen_cpu_pool_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_cpu_pool_record
|
|
||||||
{
|
|
||||||
xen_cpu_pool handle;
|
|
||||||
char *uuid;
|
|
||||||
char *name_label;
|
|
||||||
char *name_description;
|
|
||||||
struct xen_host_record_opt *resident_on;
|
|
||||||
bool auto_power_on;
|
|
||||||
struct xen_vm_record_opt_set *started_vms;
|
|
||||||
int64_t ncpu;
|
|
||||||
char *sched_policy;
|
|
||||||
struct xen_string_set *proposed_cpus;
|
|
||||||
struct xen_host_cpu_record_opt_set *host_cpus;
|
|
||||||
bool activated;
|
|
||||||
xen_string_string_map *other_config;
|
|
||||||
} xen_cpu_pool_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_cpu_pool_record.
|
|
||||||
*/
|
|
||||||
extern xen_cpu_pool_record *
|
|
||||||
xen_cpu_pool_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_cpu_pool_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_cpu_pool_record_free(xen_cpu_pool_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_cpu_pool_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_cpu_pool handle;
|
|
||||||
xen_cpu_pool_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_cpu_pool_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_cpu_pool_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_cpu_pool_record_opt *
|
|
||||||
xen_cpu_pool_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_cpu_pool_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_cpu_pool_record_opt_free(xen_cpu_pool_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_cpu_pool_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_cpu_pool_record *contents[];
|
|
||||||
} xen_cpu_pool_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_cpu_pool_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_cpu_pool_record_set *
|
|
||||||
xen_cpu_pool_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_cpu_pool_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_cpu_pool_record_set_free(xen_cpu_pool_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_cpu_pool_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_cpu_pool_record_opt *contents[];
|
|
||||||
} xen_cpu_pool_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_cpu_pool_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_cpu_pool_record_opt_set *
|
|
||||||
xen_cpu_pool_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_cpu_pool_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_cpu_pool_record_opt_set_free(xen_cpu_pool_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_record(xen_session *session, xen_cpu_pool_record **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the cpu_pool instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_by_uuid(xen_session *session, xen_cpu_pool *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new cpu_pool instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_create(xen_session *session, xen_cpu_pool *result,
|
|
||||||
xen_cpu_pool_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified VBD instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_destroy(xen_session *session, xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_uuid(xen_session *session, char **result, xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deactivate the given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_deactivate(xen_session *session, xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activate the given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_activate(xen_session *session, xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a physical cpu to the active pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_add_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a physical cpu from the active pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_remove_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the cpu_pools known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_all(xen_session *session, struct xen_cpu_pool_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the cpu_pool with given name.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_by_name_label(xen_session *session,
|
|
||||||
struct xen_cpu_pool_set **result, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get activation state of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_activated(xen_session *session, bool *result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get auto_power_on option of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_auto_power_on(xen_session *session, bool *result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get host_cpu refs of all physical cpus of cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_host_CPUs(xen_session *session, struct xen_host_cpu_set **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get name description field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_name_description(xen_session *session, char **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get name label field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_name_label(xen_session *session, char **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get count of physical cpus to attach to cpu_pool on activation.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_ncpu(xen_session *session, int64_t *result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get proposed_CPUs field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_proposed_CPUs(xen_session *session, struct xen_string_set **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the other_config field of the given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_other_config(xen_session *session, xen_string_string_map **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get host the cpu_pool is resident on.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_resident_on(xen_session *session, xen_host *result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get sched_policy field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_sched_policy(xen_session *session, char **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get set of started vms in given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_get_started_VMs(xen_session *session, xen_vm_set **result,
|
|
||||||
xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set auto_power_on field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_auto_power_on(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
bool auto_power_on);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set proposed_CPUs field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_string_set *proposed_cpus);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a proposed cpu to proposed_CPUs field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_add_to_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char* proposed_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a proposed cpu from proposed_CPUs field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_remove_from_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char* proposed_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set name_label field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_name_label(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set name_description field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_name_description(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *descr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set ncpu field of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_ncpu(xen_session *session, xen_cpu_pool cpu_pool, int64_t ncpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the other_config field of the given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_other_config(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_string_string_map *other_config);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the other_config field of the given
|
|
||||||
* cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_add_to_other_config(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* other_config field of the given cpu_pool. If the key is not in that Map, then
|
|
||||||
* do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_remove_from_other_config(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *key);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set sched_policy of given cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_cpu_pool_set_sched_policy(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *sched_policy);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_POOL_DECL_H
|
|
||||||
#define XEN_CPU_POOL_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_cpu_pool;
|
|
||||||
|
|
||||||
struct xen_cpu_pool_set;
|
|
||||||
struct xen_cpu_pool_record;
|
|
||||||
struct xen_cpu_pool_record_set;
|
|
||||||
struct xen_cpu_pool_record_opt;
|
|
||||||
struct xen_cpu_pool_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_crashdump_decl.h>
|
|
||||||
#include <xen/api/xen_vdi_decl.h>
|
|
||||||
#include <xen/api/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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified crashdump.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_crashdump_destroy(xen_session *session, xen_crashdump self);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_DECL_H
|
|
||||||
#define XEN_CRASHDUMP_DECL_H
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_EVENT_H
|
|
||||||
#define XEN_EVENT_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_event_decl.h>
|
|
||||||
#include <xen/api/xen_event_operation.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The event class.
|
|
||||||
*
|
|
||||||
* Asynchronous event registration and handling.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_event_record
|
|
||||||
{
|
|
||||||
int64_t id;
|
|
||||||
time_t timestamp;
|
|
||||||
char *class;
|
|
||||||
enum xen_event_operation operation;
|
|
||||||
char *ref;
|
|
||||||
char *obj_uuid;
|
|
||||||
} xen_event_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_event_record.
|
|
||||||
*/
|
|
||||||
extern xen_event_record *
|
|
||||||
xen_event_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_event_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_event_record_free(xen_event_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_event_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_event_record *contents[];
|
|
||||||
} xen_event_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_event_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_event_record_set *
|
|
||||||
xen_event_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_event_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_event_record_set_free(xen_event_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers this session with the event system. Specifying the empty
|
|
||||||
* list will register for all classes.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_event_register(xen_session *session, struct xen_string_set *classes);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unregisters this session with the event system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_event_unregister(xen_session *session, struct xen_string_set *classes);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Blocking call which returns a (possibly empty) batch of events.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_event_next(xen_session *session, struct xen_event_record_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_EVENT_DECL_H
|
|
||||||
#define XEN_EVENT_DECL_H
|
|
||||||
|
|
||||||
struct xen_event_record;
|
|
||||||
struct xen_event_record_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_EVENT_OPERATION_H
|
|
||||||
#define XEN_EVENT_OPERATION_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_event_operation
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* An object has been created
|
|
||||||
*/
|
|
||||||
XEN_EVENT_OPERATION_ADD,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An object has been deleted
|
|
||||||
*/
|
|
||||||
XEN_EVENT_OPERATION_DEL,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An object has been modified
|
|
||||||
*/
|
|
||||||
XEN_EVENT_OPERATION_MOD
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_event_operation_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_event_operation contents[];
|
|
||||||
} xen_event_operation_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_event_operation_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_event_operation_set *
|
|
||||||
xen_event_operation_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_event_operation_set. The given set must have
|
|
||||||
* been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_event_operation_set_free(xen_event_operation_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_event_operation_to_string(enum xen_event_operation 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_event_operation
|
|
||||||
xen_event_operation_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,505 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_H
|
|
||||||
#define XEN_HOST_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host_cpu_decl.h>
|
|
||||||
#include <xen/api/xen_host_decl.h>
|
|
||||||
#include <xen/api/xen_host_metrics_decl.h>
|
|
||||||
#include <xen/api/xen_pbd_decl.h>
|
|
||||||
#include <xen/api/xen_pif_decl.h>
|
|
||||||
#include <xen/api/xen_sr_decl.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vm_decl.h>
|
|
||||||
#include <xen/api/xen_cpu_pool_decl.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The host class.
|
|
||||||
*
|
|
||||||
* A physical host.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_free(xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_host *contents[];
|
|
||||||
} xen_host_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_host_set *
|
|
||||||
xen_host_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_set_free(xen_host_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_record
|
|
||||||
{
|
|
||||||
xen_host handle;
|
|
||||||
char *uuid;
|
|
||||||
char *name_label;
|
|
||||||
char *name_description;
|
|
||||||
int64_t api_version_major;
|
|
||||||
int64_t api_version_minor;
|
|
||||||
char *api_version_vendor;
|
|
||||||
xen_string_string_map *api_version_vendor_implementation;
|
|
||||||
bool enabled;
|
|
||||||
xen_string_string_map *software_version;
|
|
||||||
xen_string_string_map *other_config;
|
|
||||||
struct xen_string_set *capabilities;
|
|
||||||
xen_string_string_map *cpu_configuration;
|
|
||||||
char *sched_policy;
|
|
||||||
struct xen_string_set *supported_bootloaders;
|
|
||||||
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;
|
|
||||||
struct xen_cpu_pool_record_opt_set *resident_cpu_pools;
|
|
||||||
} xen_host_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_record.
|
|
||||||
*/
|
|
||||||
extern xen_host_record *
|
|
||||||
xen_host_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_record_free(xen_host_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_host handle;
|
|
||||||
xen_host_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_host_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_host_record_opt *
|
|
||||||
xen_host_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_record_opt_free(xen_host_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_host_record *contents[];
|
|
||||||
} xen_host_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_host_record_set *
|
|
||||||
xen_host_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_record_set_free(xen_host_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_host_record_opt *contents[];
|
|
||||||
} xen_host_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_host_record_opt_set *
|
|
||||||
xen_host_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_record_opt_set_free(xen_host_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the host instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the host instances with the given label.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_uuid(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/label field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_name_label(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/description field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_name_description(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the API_version/major field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the API_version/minor field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the API_version/vendor field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the API_version/vendor_implementation field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the enabled field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_enabled(xen_session *session, bool *result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the software_version field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 capabilities field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the cpu_configuration field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the sched_policy field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_sched_policy(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the supported_bootloaders field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the resident_VMs field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
xen_host_set_name_label(xen_session *session, xen_host host, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/description field of the given host.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_set_name_description(xen_session *session, xen_host host, char *description);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_disable(xen_session *session, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Puts the host into a state in which new VMs can be started.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_enable(xen_session *session, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shutdown the host. (This function can only be called if there are no
|
|
||||||
* currently running VMs on the host and it is disabled.).
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_shutdown(xen_session *session, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reboot the host. (This function can only be called if there are no
|
|
||||||
* currently running VMs on the host and it is disabled.).
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_reboot(xen_session *session, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the host xen dmesg.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_dmesg(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the host xen dmesg, and clear the buffer.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_dmesg_clear(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the host's log file.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_log(xen_session *session, char **result, xen_host host);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inject the given string as debugging keys into Xen.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List all supported methods.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_list_methods(xen_session *session, struct xen_string_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the hosts known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_all(xen_session *session, struct xen_host_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get list of resident cpu pools.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_set **result,
|
|
||||||
xen_host host);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,263 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_CPU_H
|
|
||||||
#define XEN_HOST_CPU_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host_cpu_decl.h>
|
|
||||||
#include <xen/api/xen_host_decl.h>
|
|
||||||
#include <xen/api/xen_cpu_pool_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The host_cpu class.
|
|
||||||
*
|
|
||||||
* A physical CPU.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_cpu. The given handle must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_cpu_free(xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_cpu_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_host_cpu *contents[];
|
|
||||||
} xen_host_cpu_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_cpu_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_host_cpu_set *
|
|
||||||
xen_host_cpu_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_cpu_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_cpu_set_free(xen_host_cpu_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_cpu_record
|
|
||||||
{
|
|
||||||
xen_host_cpu handle;
|
|
||||||
char *uuid;
|
|
||||||
struct xen_host_record_opt *host;
|
|
||||||
int64_t number;
|
|
||||||
char *vendor;
|
|
||||||
int64_t speed;
|
|
||||||
char *modelname;
|
|
||||||
char *stepping;
|
|
||||||
char *flags;
|
|
||||||
char *features;
|
|
||||||
double utilisation;
|
|
||||||
struct xen_cpu_pool_record_opt_set *cpu_pools;
|
|
||||||
} xen_host_cpu_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_cpu_record.
|
|
||||||
*/
|
|
||||||
extern xen_host_cpu_record *
|
|
||||||
xen_host_cpu_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_cpu_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_cpu_record_free(xen_host_cpu_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_cpu_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_host_cpu handle;
|
|
||||||
xen_host_cpu_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_host_cpu_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_cpu_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_host_cpu_record_opt *
|
|
||||||
xen_host_cpu_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_cpu_record_opt, and all referenced values.
|
|
||||||
* The given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_cpu_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_host_cpu_record *contents[];
|
|
||||||
} xen_host_cpu_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_cpu_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_host_cpu_record_set *
|
|
||||||
xen_host_cpu_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_cpu_record_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_cpu_record_set_free(xen_host_cpu_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_host_cpu_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_host_cpu_record_opt *contents[];
|
|
||||||
} xen_host_cpu_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_host_cpu_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_host_cpu_record_opt_set *
|
|
||||||
xen_host_cpu_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_host_cpu_record_opt_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the host_cpu instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the host field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the number field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the vendor field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the speed field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the modelname field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the stepping field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the flags field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the features field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the utilisation field of the given host_cpu.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the host_cpus known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the ref of the cpu_pool to which the host_cpu belongs.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the host_cpus not assigned to a cpu_pool.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_CPU_DECL_H
|
|
||||||
#define XEN_HOST_CPU_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_host_cpu;
|
|
||||||
|
|
||||||
struct xen_host_cpu_set;
|
|
||||||
struct xen_host_cpu_record;
|
|
||||||
struct xen_host_cpu_record_set;
|
|
||||||
struct xen_host_cpu_record_opt;
|
|
||||||
struct xen_host_cpu_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_DECL_H
|
|
||||||
#define XEN_HOST_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_host;
|
|
||||||
|
|
||||||
struct xen_host_set;
|
|
||||||
struct xen_host_record;
|
|
||||||
struct xen_host_record_set;
|
|
||||||
struct xen_host_record_opt;
|
|
||||||
struct xen_host_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_common.h>
|
|
||||||
#include <xen/api/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;
|
|
||||||
int64_t memory_total;
|
|
||||||
int64_t memory_free;
|
|
||||||
time_t last_updated;
|
|
||||||
} 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 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_updated field of the given host_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the host_metrics instances known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_DECL_H
|
|
||||||
#define XEN_HOST_METRICS_DECL_H
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_INT_FLOAT_MAP_H
|
|
||||||
#define XEN_INT_FLOAT_MAP_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_int_float_map_contents
|
|
||||||
{
|
|
||||||
int64_t key;
|
|
||||||
double val;
|
|
||||||
} xen_int_float_map_contents;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_int_float_map
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_int_float_map_contents contents[];
|
|
||||||
} xen_int_float_map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_int_float_map of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_int_float_map *
|
|
||||||
xen_int_float_map_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_int_float_map, and all referenced values. The
|
|
||||||
* given map must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_int_float_map_free(xen_int_float_map *map);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_INT_INT_MAP_H
|
|
||||||
#define XEN_INT_INT_MAP_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_int_int_map_contents
|
|
||||||
{
|
|
||||||
int64_t key;
|
|
||||||
int64_t val;
|
|
||||||
} xen_int_int_map_contents;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_int_int_map
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_int_int_map_contents contents[];
|
|
||||||
} xen_int_int_map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_int_int_map of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_int_int_map *
|
|
||||||
xen_int_int_map_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_int_int_map, and all referenced values. The
|
|
||||||
* given map must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_int_int_map_free(xen_int_int_map *map);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_INT_STRING_SET_MAP_H
|
|
||||||
#define XEN_INT_STRING_SET_MAP_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_int_string_set_map_contents
|
|
||||||
{
|
|
||||||
int64_t key;
|
|
||||||
struct xen_string_set *val;
|
|
||||||
} xen_int_string_set_map_contents;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_int_string_set_map
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_int_string_set_map_contents contents[];
|
|
||||||
} xen_int_string_set_map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_int_string_set_map of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_int_string_set_map *
|
|
||||||
xen_int_string_set_map_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_int_string_set_map, and all referenced values.
|
|
||||||
* The given map must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_int_string_set_map_free(xen_int_string_set_map *map);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_NETWORK_H
|
|
||||||
#define XEN_NETWORK_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_network_decl.h>
|
|
||||||
#include <xen/api/xen_pif_decl.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vif_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The network class.
|
|
||||||
*
|
|
||||||
* A virtual network.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_network. The given handle must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_network_free(xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_network_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_network *contents[];
|
|
||||||
} xen_network_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_network_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_network_set *
|
|
||||||
xen_network_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_network_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_network_set_free(xen_network_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_network_record
|
|
||||||
{
|
|
||||||
xen_network handle;
|
|
||||||
char *uuid;
|
|
||||||
char *name_label;
|
|
||||||
char *name_description;
|
|
||||||
struct xen_vif_record_opt_set *vifs;
|
|
||||||
struct xen_pif_record_opt_set *pifs;
|
|
||||||
xen_string_string_map *other_config;
|
|
||||||
} xen_network_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_network_record.
|
|
||||||
*/
|
|
||||||
extern xen_network_record *
|
|
||||||
xen_network_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_network_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_network_record_free(xen_network_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_network_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_network handle;
|
|
||||||
xen_network_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_network_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_network_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_network_record_opt *
|
|
||||||
xen_network_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_network_record_opt, and all referenced values.
|
|
||||||
* The given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_network_record_opt_free(xen_network_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_network_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_network_record *contents[];
|
|
||||||
} xen_network_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_network_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_network_record_set *
|
|
||||||
xen_network_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_network_record_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_network_record_set_free(xen_network_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_network_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_network_record_opt *contents[];
|
|
||||||
} xen_network_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_network_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_network_record_opt_set *
|
|
||||||
xen_network_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_network_record_opt_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_network_record_opt_set_free(xen_network_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_record(xen_session *session, xen_network_record **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the network instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new network instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_create(xen_session *session, xen_network *result, xen_network_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified network instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_destroy(xen_session *session, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the network instances with the given label.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_uuid(xen_session *session, char **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/label field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_name_label(xen_session *session, char **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/description field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_name_description(xen_session *session, char **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VIFs field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PIFs field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the other_config field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_other_config(xen_session *session, xen_string_string_map **result, xen_network network);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/label field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_set_name_label(xen_session *session, xen_network network, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/description field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_set_name_description(xen_session *session, xen_network network, char *description);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the other_config field of the given network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_set_other_config(xen_session *session, xen_network network, xen_string_string_map *other_config);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the other_config field of the given
|
|
||||||
* network.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_add_to_other_config(xen_session *session, xen_network network, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* other_config field of the given network. If the key is not in that Map,
|
|
||||||
* then do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_remove_from_other_config(xen_session *session, xen_network network, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the networks known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_network_get_all(xen_session *session, struct xen_network_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_NETWORK_DECL_H
|
|
||||||
#define XEN_NETWORK_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_network;
|
|
||||||
|
|
||||||
struct xen_network_set;
|
|
||||||
struct xen_network_record;
|
|
||||||
struct xen_network_record_set;
|
|
||||||
struct xen_network_record_opt;
|
|
||||||
struct xen_network_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_ON_CRASH_BEHAVIOUR_H
|
|
||||||
#define XEN_ON_CRASH_BEHAVIOUR_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_on_crash_behaviour
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* destroy the VM state
|
|
||||||
*/
|
|
||||||
XEN_ON_CRASH_BEHAVIOUR_DESTROY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* record a coredump and then destroy the VM state
|
|
||||||
*/
|
|
||||||
XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* restart the VM
|
|
||||||
*/
|
|
||||||
XEN_ON_CRASH_BEHAVIOUR_RESTART,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* record a coredump and then restart the VM
|
|
||||||
*/
|
|
||||||
XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* leave the crashed VM as-is
|
|
||||||
*/
|
|
||||||
XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* rename the crashed VM and start a new copy
|
|
||||||
*/
|
|
||||||
XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_on_crash_behaviour_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_on_crash_behaviour contents[];
|
|
||||||
} xen_on_crash_behaviour_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_on_crash_behaviour_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_on_crash_behaviour_set *
|
|
||||||
xen_on_crash_behaviour_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_on_crash_behaviour_set. The given set must have
|
|
||||||
* been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour 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_on_crash_behaviour
|
|
||||||
xen_on_crash_behaviour_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_ON_NORMAL_EXIT_H
|
|
||||||
#define XEN_ON_NORMAL_EXIT_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_on_normal_exit
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* destroy the VM state
|
|
||||||
*/
|
|
||||||
XEN_ON_NORMAL_EXIT_DESTROY,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* restart the VM
|
|
||||||
*/
|
|
||||||
XEN_ON_NORMAL_EXIT_RESTART
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_on_normal_exit_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_on_normal_exit contents[];
|
|
||||||
} xen_on_normal_exit_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_on_normal_exit_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_on_normal_exit_set *
|
|
||||||
xen_on_normal_exit_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_on_normal_exit_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_on_normal_exit_set_free(xen_on_normal_exit_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_on_normal_exit_to_string(enum xen_on_normal_exit 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_on_normal_exit
|
|
||||||
xen_on_normal_exit_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host_decl.h>
|
|
||||||
#include <xen/api/xen_pbd_decl.h>
|
|
||||||
#include <xen/api/xen_sr_decl.h>
|
|
||||||
#include <xen/api/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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the PBDs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pbd_get_all(xen_session *session, struct xen_pbd_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_H
|
|
||||||
#define XEN_PIF_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host_decl.h>
|
|
||||||
#include <xen/api/xen_network_decl.h>
|
|
||||||
#include <xen/api/xen_pif_decl.h>
|
|
||||||
#include <xen/api/xen_pif_metrics_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The PIF class.
|
|
||||||
*
|
|
||||||
* A physical network interface (note separate VLANs are represented as
|
|
||||||
* several PIFs).
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_pif. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_pif_free(xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_pif_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_pif *contents[];
|
|
||||||
} xen_pif_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_pif_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_pif_set *
|
|
||||||
xen_pif_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_pif_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_pif_set_free(xen_pif_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_pif_record
|
|
||||||
{
|
|
||||||
xen_pif handle;
|
|
||||||
char *uuid;
|
|
||||||
char *device;
|
|
||||||
struct xen_network_record_opt *network;
|
|
||||||
struct xen_host_record_opt *host;
|
|
||||||
char *mac;
|
|
||||||
int64_t mtu;
|
|
||||||
int64_t vlan;
|
|
||||||
struct xen_pif_metrics_record_opt *metrics;
|
|
||||||
} xen_pif_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_pif_record.
|
|
||||||
*/
|
|
||||||
extern xen_pif_record *
|
|
||||||
xen_pif_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_pif_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_pif_record_free(xen_pif_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_pif_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_pif handle;
|
|
||||||
xen_pif_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_pif_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_pif_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_pif_record_opt *
|
|
||||||
xen_pif_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_pif_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_pif_record_opt_free(xen_pif_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_pif_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_pif_record *contents[];
|
|
||||||
} xen_pif_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_pif_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_pif_record_set *
|
|
||||||
xen_pif_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_pif_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_pif_record_set_free(xen_pif_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_pif_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_pif_record_opt *contents[];
|
|
||||||
} xen_pif_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_pif_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_pif_record_opt_set *
|
|
||||||
xen_pif_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_pif_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_pif_record_opt_set_free(xen_pif_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the PIF instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the device field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_device(xen_session *session, char **result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the network field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the host field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the MAC field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_mac(xen_session *session, char **result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the MTU field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
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, int64_t *result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the metrics field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the device field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_set_device(xen_session *session, xen_pif pif, char *device);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the MAC field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the MTU field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the VLAN field of the given PIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a VLAN interface from an existing physical interface.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the interface (provided it is a synthetic interface like a
|
|
||||||
* VLAN; fail if it is a physical interface).
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_destroy(xen_session *session, xen_pif self);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the PIFs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_get_all(xen_session *session, struct xen_pif_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_DECL_H
|
|
||||||
#define XEN_PIF_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_pif;
|
|
||||||
|
|
||||||
struct xen_pif_set;
|
|
||||||
struct xen_pif_record;
|
|
||||||
struct xen_pif_record_set;
|
|
||||||
struct xen_pif_record_opt;
|
|
||||||
struct xen_pif_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_common.h>
|
|
||||||
#include <xen/api/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;
|
|
||||||
double io_read_kbs;
|
|
||||||
double io_write_kbs;
|
|
||||||
time_t last_updated;
|
|
||||||
} 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 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_updated field of the given PIF_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, xen_pif_metrics pif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the PIF_metrics instances known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_SR_H
|
|
||||||
#define XEN_SR_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_pbd_decl.h>
|
|
||||||
#include <xen/api/xen_sr_decl.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_vdi_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The SR class.
|
|
||||||
*
|
|
||||||
* A storage repository.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_sr. The given handle must have been allocated by
|
|
||||||
* this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_sr_free(xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_sr_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_sr *contents[];
|
|
||||||
} xen_sr_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_sr_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_sr_set *
|
|
||||||
xen_sr_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_sr_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_sr_set_free(xen_sr_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_sr_record
|
|
||||||
{
|
|
||||||
xen_sr handle;
|
|
||||||
char *uuid;
|
|
||||||
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;
|
|
||||||
char *type;
|
|
||||||
char *content_type;
|
|
||||||
} xen_sr_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_sr_record.
|
|
||||||
*/
|
|
||||||
extern xen_sr_record *
|
|
||||||
xen_sr_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_sr_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_sr_record_free(xen_sr_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_sr_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_sr handle;
|
|
||||||
xen_sr_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_sr_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_sr_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_sr_record_opt *
|
|
||||||
xen_sr_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_sr_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_sr_record_opt_free(xen_sr_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_sr_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_sr_record *contents[];
|
|
||||||
} xen_sr_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_sr_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_sr_record_set *
|
|
||||||
xen_sr_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_sr_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_sr_record_set_free(xen_sr_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_sr_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_sr_record_opt *contents[];
|
|
||||||
} xen_sr_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_sr_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_sr_record_opt_set *
|
|
||||||
xen_sr_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_sr_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_sr_record_opt_set_free(xen_sr_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the SR instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the SR instances with the given label.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/label field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/description field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VDIs field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
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
|
|
||||||
xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the physical_utilisation field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the physical_size field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_type(xen_session *session, char **result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the content_type field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_content_type(xen_session *session, char **result, xen_sr sr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/label field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/description field of the given SR.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_set_name_description(xen_session *session, xen_sr sr, char *description);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a set of all the SR types supported by the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_supported_types(xen_session *session, struct xen_string_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the SRs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_sr_get_all(xen_session *session, struct xen_sr_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_SR_DECL_H
|
|
||||||
#define XEN_SR_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_sr;
|
|
||||||
|
|
||||||
struct xen_sr_set;
|
|
||||||
struct xen_sr_record;
|
|
||||||
struct xen_sr_record_set;
|
|
||||||
struct xen_sr_record_opt;
|
|
||||||
struct xen_sr_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_STRING_SET_H
|
|
||||||
#define XEN_STRING_SET_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_string_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
char *contents[];
|
|
||||||
} xen_string_set;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_string_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_string_set *
|
|
||||||
xen_string_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_string_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_string_set_free(xen_string_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_STRING_STRING_MAP_H
|
|
||||||
#define XEN_STRING_STRING_MAP_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_string_string_map_contents
|
|
||||||
{
|
|
||||||
char *key;
|
|
||||||
char *val;
|
|
||||||
} xen_string_string_map_contents;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_string_string_map
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_string_string_map_contents contents[];
|
|
||||||
} xen_string_string_map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_string_string_map of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_string_string_map *
|
|
||||||
xen_string_string_map_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_string_string_map, and all referenced values.
|
|
||||||
* The given map must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_string_string_map_free(xen_string_string_map *map);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_USER_H
|
|
||||||
#define XEN_USER_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_user_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The user class.
|
|
||||||
*
|
|
||||||
* A user of the system.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_user. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_user_free(xen_user user);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_user_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_user *contents[];
|
|
||||||
} xen_user_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_user_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_user_set *
|
|
||||||
xen_user_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_user_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_user_set_free(xen_user_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_user_record
|
|
||||||
{
|
|
||||||
xen_user handle;
|
|
||||||
char *uuid;
|
|
||||||
char *short_name;
|
|
||||||
char *fullname;
|
|
||||||
} xen_user_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_user_record.
|
|
||||||
*/
|
|
||||||
extern xen_user_record *
|
|
||||||
xen_user_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_user_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_user_record_free(xen_user_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_user_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_user handle;
|
|
||||||
xen_user_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_user_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_user_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_user_record_opt *
|
|
||||||
xen_user_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_user_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_user_record_opt_free(xen_user_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_user_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_user_record *contents[];
|
|
||||||
} xen_user_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_user_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_user_record_set *
|
|
||||||
xen_user_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_user_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_user_record_set_free(xen_user_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_user_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_user_record_opt *contents[];
|
|
||||||
} xen_user_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_user_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_user_record_opt_set *
|
|
||||||
xen_user_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_user_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_user_record_opt_set_free(xen_user_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given user.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_get_record(xen_session *session, xen_user_record **result, xen_user user);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the user instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new user instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_create(xen_session *session, xen_user *result, xen_user_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified user instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_destroy(xen_session *session, xen_user user);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given user.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_get_uuid(xen_session *session, char **result, xen_user user);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the short_name field of the given user.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_get_short_name(xen_session *session, char **result, xen_user user);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the fullname field of the given user.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_get_fullname(xen_session *session, char **result, xen_user user);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the fullname field of the given user.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_user_set_fullname(xen_session *session, xen_user user, char *fullname);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_USER_DECL_H
|
|
||||||
#define XEN_USER_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_user;
|
|
||||||
|
|
||||||
struct xen_user_set;
|
|
||||||
struct xen_user_record;
|
|
||||||
struct xen_user_record_set;
|
|
||||||
struct xen_user_record_opt;
|
|
||||||
struct xen_user_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,390 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VBD_H
|
|
||||||
#define XEN_VBD_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vbd_decl.h>
|
|
||||||
#include <xen/api/xen_vbd_metrics_decl.h>
|
|
||||||
#include <xen/api/xen_vbd_mode.h>
|
|
||||||
#include <xen/api/xen_vbd_type.h>
|
|
||||||
#include <xen/api/xen_vdi_decl.h>
|
|
||||||
#include <xen/api/xen_vm_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VBD class.
|
|
||||||
*
|
|
||||||
* A virtual block device.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_free(xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vbd *contents[];
|
|
||||||
} xen_vbd_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_set *
|
|
||||||
xen_vbd_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_set_free(xen_vbd_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_record
|
|
||||||
{
|
|
||||||
xen_vbd handle;
|
|
||||||
char *uuid;
|
|
||||||
struct xen_vm_record_opt *vm;
|
|
||||||
struct xen_vdi_record_opt *vdi;
|
|
||||||
char *device;
|
|
||||||
bool bootable;
|
|
||||||
enum xen_vbd_mode mode;
|
|
||||||
enum xen_vbd_type type;
|
|
||||||
bool currently_attached;
|
|
||||||
int64_t status_code;
|
|
||||||
char *status_detail;
|
|
||||||
xen_string_string_map *runtime_properties;
|
|
||||||
char *qos_algorithm_type;
|
|
||||||
xen_string_string_map *qos_algorithm_params;
|
|
||||||
struct xen_string_set *qos_supported_algorithms;
|
|
||||||
struct xen_vbd_metrics_record_opt *metrics;
|
|
||||||
} xen_vbd_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_record.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_record *
|
|
||||||
xen_vbd_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_record_free(xen_vbd_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vbd handle;
|
|
||||||
xen_vbd_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vbd_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_record_opt *
|
|
||||||
xen_vbd_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_record_opt_free(xen_vbd_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vbd_record *contents[];
|
|
||||||
} xen_vbd_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_record_set *
|
|
||||||
xen_vbd_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_record_set_free(xen_vbd_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vbd_record_opt *contents[];
|
|
||||||
} xen_vbd_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_record_opt_set *
|
|
||||||
xen_vbd_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_record_opt_set_free(xen_vbd_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VBD instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new VBD instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified VBD instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_destroy(xen_session *session, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VM field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VDI field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the device field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the bootable field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mode field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the currently_attached field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_currently_attached(xen_session *session, bool *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the status_code field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_status_code(xen_session *session, int64_t *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the status_detail field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_status_detail(xen_session *session, char **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the runtime_properties field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the qos/algorithm_type field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the qos/algorithm_params field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the qos/supported_algorithms field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the metrics field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the device field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the bootable field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the mode field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the type field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the qos/algorithm_type field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the qos/algorithm_params field of the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the qos/algorithm_params field of
|
|
||||||
* the given VBD.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* qos/algorithm_params field of the given VBD. If the key is not in that
|
|
||||||
* Map, then do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the media in the device for CDROM-like devices only. For
|
|
||||||
* other devices, detach the VBD and attach a new one.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hotplug the specified VBD, dynamically attaching it to the running
|
|
||||||
* VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_plug(xen_session *session, xen_vbd self);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hot-unplug the specified VBD, dynamically unattaching it from the
|
|
||||||
* running VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_unplug(xen_session *session, xen_vbd self);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VBDs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VBD_DECL_H
|
|
||||||
#define XEN_VBD_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vbd;
|
|
||||||
|
|
||||||
struct xen_vbd_set;
|
|
||||||
struct xen_vbd_record;
|
|
||||||
struct xen_vbd_record_set;
|
|
||||||
struct xen_vbd_record_opt;
|
|
||||||
struct xen_vbd_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VBD_METRICS_H
|
|
||||||
#define XEN_VBD_METRICS_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_vbd_metrics_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VBD_metrics class.
|
|
||||||
*
|
|
||||||
* The metrics associated with a virtual block device.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_metrics. The given handle must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_metrics_free(xen_vbd_metrics vbd_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_metrics_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vbd_metrics *contents[];
|
|
||||||
} xen_vbd_metrics_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_metrics_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_metrics_set *
|
|
||||||
xen_vbd_metrics_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_metrics_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_metrics_set_free(xen_vbd_metrics_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_metrics_record
|
|
||||||
{
|
|
||||||
xen_vbd_metrics handle;
|
|
||||||
char *uuid;
|
|
||||||
double io_read_kbs;
|
|
||||||
double io_write_kbs;
|
|
||||||
time_t last_updated;
|
|
||||||
} xen_vbd_metrics_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_metrics_record.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_metrics_record *
|
|
||||||
xen_vbd_metrics_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_metrics_record, and all referenced values.
|
|
||||||
* The given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_metrics_record_free(xen_vbd_metrics_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_metrics_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vbd_metrics handle;
|
|
||||||
xen_vbd_metrics_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vbd_metrics_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_metrics_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_metrics_record_opt *
|
|
||||||
xen_vbd_metrics_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_metrics_record_opt, and all referenced
|
|
||||||
* values. The given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_metrics_record_opt_free(xen_vbd_metrics_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_metrics_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vbd_metrics_record *contents[];
|
|
||||||
} xen_vbd_metrics_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_metrics_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_metrics_record_set *
|
|
||||||
xen_vbd_metrics_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_metrics_record_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_metrics_record_set_free(xen_vbd_metrics_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_metrics_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vbd_metrics_record_opt *contents[];
|
|
||||||
} xen_vbd_metrics_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_metrics_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_metrics_record_opt_set *
|
|
||||||
xen_vbd_metrics_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_metrics_record_opt_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_metrics_record_opt_set_free(xen_vbd_metrics_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given VBD_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record **result, xen_vbd_metrics vbd_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VBD_metrics instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VBD_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics vbd_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the io/read_kbs field of the given VBD_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the io/write_kbs field of the given VBD_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_updated field of the given VBD_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VBD_metrics instances known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VBD_METRICS_DECL_H
|
|
||||||
#define XEN_VBD_METRICS_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vbd_metrics;
|
|
||||||
|
|
||||||
struct xen_vbd_metrics_set;
|
|
||||||
struct xen_vbd_metrics_record;
|
|
||||||
struct xen_vbd_metrics_record_set;
|
|
||||||
struct xen_vbd_metrics_record_opt;
|
|
||||||
struct xen_vbd_metrics_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VBD_MODE_H
|
|
||||||
#define XEN_VBD_MODE_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_vbd_mode
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* disk is mounted read-only
|
|
||||||
*/
|
|
||||||
XEN_VBD_MODE_RO,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* disk is mounted read-write
|
|
||||||
*/
|
|
||||||
XEN_VBD_MODE_RW
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_mode_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_vbd_mode contents[];
|
|
||||||
} xen_vbd_mode_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_mode_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_mode_set *
|
|
||||||
xen_vbd_mode_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_mode_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_mode_set_free(xen_vbd_mode_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_vbd_mode_to_string(enum xen_vbd_mode 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_vbd_mode
|
|
||||||
xen_vbd_mode_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VBD_TYPE_H
|
|
||||||
#define XEN_VBD_TYPE_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_vbd_type
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* VBD will appear to guest as CD
|
|
||||||
*/
|
|
||||||
XEN_VBD_TYPE_CD,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VBD will appear to guest as disk
|
|
||||||
*/
|
|
||||||
XEN_VBD_TYPE_DISK
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vbd_type_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_vbd_type contents[];
|
|
||||||
} xen_vbd_type_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vbd_type_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vbd_type_set *
|
|
||||||
xen_vbd_type_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vbd_type_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vbd_type_set_free(xen_vbd_type_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_vbd_type_to_string(enum xen_vbd_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_vbd_type
|
|
||||||
xen_vbd_type_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,360 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VDI_H
|
|
||||||
#define XEN_VDI_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_crashdump_decl.h>
|
|
||||||
#include <xen/api/xen_sr_decl.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vbd_decl.h>
|
|
||||||
#include <xen/api/xen_vdi_decl.h>
|
|
||||||
#include <xen/api/xen_vdi_type.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VDI class.
|
|
||||||
*
|
|
||||||
* A virtual disk image.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_free(xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vdi_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vdi *contents[];
|
|
||||||
} xen_vdi_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vdi_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vdi_set *
|
|
||||||
xen_vdi_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_set_free(xen_vdi_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vdi_record
|
|
||||||
{
|
|
||||||
xen_vdi handle;
|
|
||||||
char *uuid;
|
|
||||||
char *name_label;
|
|
||||||
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;
|
|
||||||
enum xen_vdi_type type;
|
|
||||||
bool sharable;
|
|
||||||
bool read_only;
|
|
||||||
xen_string_string_map *other_config;
|
|
||||||
} xen_vdi_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vdi_record.
|
|
||||||
*/
|
|
||||||
extern xen_vdi_record *
|
|
||||||
xen_vdi_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_record_free(xen_vdi_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vdi_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vdi handle;
|
|
||||||
xen_vdi_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vdi_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vdi_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vdi_record_opt *
|
|
||||||
xen_vdi_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_record_opt_free(xen_vdi_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vdi_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vdi_record *contents[];
|
|
||||||
} xen_vdi_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vdi_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vdi_record_set *
|
|
||||||
xen_vdi_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_record_set_free(xen_vdi_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vdi_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vdi_record_opt *contents[];
|
|
||||||
} xen_vdi_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vdi_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vdi_record_opt_set *
|
|
||||||
xen_vdi_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_record_opt_set_free(xen_vdi_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VDI instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new VDI instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified VDI instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_destroy(xen_session *session, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the VDI instances with the given label.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/label field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/description field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the SR field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VBDs field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
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
|
|
||||||
xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the physical_utilisation field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the sharable field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the read_only field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the other_config field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/label field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/description field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_name_description(xen_session *session, xen_vdi vdi, char *description);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the virtual_size field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_virtual_size(xen_session *session, xen_vdi vdi, int64_t virtual_size);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the sharable field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_sharable(xen_session *session, xen_vdi vdi, bool sharable);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the read_only field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the other_config field of the given VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the other_config field of the given
|
|
||||||
* VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* other_config field of the given VDI. If the key is not in that Map, then
|
|
||||||
* do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VDIs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_all(xen_session *session, struct xen_vdi_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the security label of a VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_set_security_label(xen_session *session, int64_t *result, xen_vdi vdi,
|
|
||||||
char *label, char *oldlabel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the security label of a VDI.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vdi_get_security_label(xen_session *session, char **result, xen_vdi vdi);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VDI_DECL_H
|
|
||||||
#define XEN_VDI_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vdi;
|
|
||||||
|
|
||||||
struct xen_vdi_set;
|
|
||||||
struct xen_vdi_record;
|
|
||||||
struct xen_vdi_record_set;
|
|
||||||
struct xen_vdi_record_opt;
|
|
||||||
struct xen_vdi_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VDI_TYPE_H
|
|
||||||
#define XEN_VDI_TYPE_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_vdi_type
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* a disk that may be replaced on upgrade
|
|
||||||
*/
|
|
||||||
XEN_VDI_TYPE_SYSTEM,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a disk that is always preserved on upgrade
|
|
||||||
*/
|
|
||||||
XEN_VDI_TYPE_USER,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a disk that may be reformatted on upgrade
|
|
||||||
*/
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vdi_type_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_vdi_type contents[];
|
|
||||||
} xen_vdi_type_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vdi_type_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vdi_type_set *
|
|
||||||
xen_vdi_type_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vdi_type_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vdi_type_set_free(xen_vdi_type_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_vdi_type_to_string(enum xen_vdi_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_vdi_type
|
|
||||||
xen_vdi_type_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,379 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VIF_H
|
|
||||||
#define XEN_VIF_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_network_decl.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vif_decl.h>
|
|
||||||
#include <xen/api/xen_vif_metrics_decl.h>
|
|
||||||
#include <xen/api/xen_vm_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VIF class.
|
|
||||||
*
|
|
||||||
* A virtual network interface.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_free(xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vif *contents[];
|
|
||||||
} xen_vif_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vif_set *
|
|
||||||
xen_vif_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_set_free(xen_vif_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_record
|
|
||||||
{
|
|
||||||
xen_vif handle;
|
|
||||||
char *uuid;
|
|
||||||
char *device;
|
|
||||||
struct xen_network_record_opt *network;
|
|
||||||
struct xen_vm_record_opt *vm;
|
|
||||||
char *mac;
|
|
||||||
int64_t mtu;
|
|
||||||
bool currently_attached;
|
|
||||||
int64_t status_code;
|
|
||||||
char *status_detail;
|
|
||||||
xen_string_string_map *runtime_properties;
|
|
||||||
char *qos_algorithm_type;
|
|
||||||
xen_string_string_map *qos_algorithm_params;
|
|
||||||
struct xen_string_set *qos_supported_algorithms;
|
|
||||||
struct xen_vif_metrics_record_opt *metrics;
|
|
||||||
} xen_vif_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_record.
|
|
||||||
*/
|
|
||||||
extern xen_vif_record *
|
|
||||||
xen_vif_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_record_free(xen_vif_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vif handle;
|
|
||||||
xen_vif_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vif_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vif_record_opt *
|
|
||||||
xen_vif_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_record_opt_free(xen_vif_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vif_record *contents[];
|
|
||||||
} xen_vif_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vif_record_set *
|
|
||||||
xen_vif_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_record_set_free(xen_vif_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vif_record_opt *contents[];
|
|
||||||
} xen_vif_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vif_record_opt_set *
|
|
||||||
xen_vif_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_record_opt_set_free(xen_vif_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VIF instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new VIF instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy the specified VIF instance.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_destroy(xen_session *session, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the device field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_device(xen_session *session, char **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the network field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VM field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the MAC field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_mac(xen_session *session, char **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the MTU field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the currently_attached field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_currently_attached(xen_session *session, bool *result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the status_code field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_status_code(xen_session *session, int64_t *result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the status_detail field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_status_detail(xen_session *session, char **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the runtime_properties field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the qos/algorithm_type field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the qos/algorithm_params field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the qos/supported_algorithms field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the metrics field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the device field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_set_device(xen_session *session, xen_vif vif, char *device);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the MAC field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the MTU field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the qos/algorithm_type field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the qos/algorithm_params field of the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the qos/algorithm_params field of
|
|
||||||
* the given VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* qos/algorithm_params field of the given VIF. If the key is not in that
|
|
||||||
* Map, then do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hotplug the specified VIF, dynamically attaching it to the running
|
|
||||||
* VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_plug(xen_session *session, xen_vif self);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hot-unplug the specified VIF, dynamically unattaching it from the
|
|
||||||
* running VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_unplug(xen_session *session, xen_vif self);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VIFs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_all(xen_session *session, struct xen_vif_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the security label of a VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_set_security_label(xen_session *session, int64_t *result, xen_vif vif,
|
|
||||||
char *label, char *oldlabel);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the security label of a VIF.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_get_security_label(xen_session *session, char **result, xen_vif vif);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VIF_DECL_H
|
|
||||||
#define XEN_VIF_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vif;
|
|
||||||
|
|
||||||
struct xen_vif_set;
|
|
||||||
struct xen_vif_record;
|
|
||||||
struct xen_vif_record_set;
|
|
||||||
struct xen_vif_record_opt;
|
|
||||||
struct xen_vif_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VIF_METRICS_H
|
|
||||||
#define XEN_VIF_METRICS_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_vif_metrics_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VIF_metrics class.
|
|
||||||
*
|
|
||||||
* The metrics associated with a virtual network device.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_metrics. The given handle must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_metrics_free(xen_vif_metrics vif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_metrics_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vif_metrics *contents[];
|
|
||||||
} xen_vif_metrics_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_metrics_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vif_metrics_set *
|
|
||||||
xen_vif_metrics_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_metrics_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_metrics_set_free(xen_vif_metrics_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_metrics_record
|
|
||||||
{
|
|
||||||
xen_vif_metrics handle;
|
|
||||||
char *uuid;
|
|
||||||
double io_read_kbs;
|
|
||||||
double io_write_kbs;
|
|
||||||
time_t last_updated;
|
|
||||||
} xen_vif_metrics_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_metrics_record.
|
|
||||||
*/
|
|
||||||
extern xen_vif_metrics_record *
|
|
||||||
xen_vif_metrics_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_metrics_record, and all referenced values.
|
|
||||||
* The given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_metrics_record_free(xen_vif_metrics_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_metrics_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vif_metrics handle;
|
|
||||||
xen_vif_metrics_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vif_metrics_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_metrics_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vif_metrics_record_opt *
|
|
||||||
xen_vif_metrics_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_metrics_record_opt, and all referenced
|
|
||||||
* values. The given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_metrics_record_opt_free(xen_vif_metrics_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_metrics_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vif_metrics_record *contents[];
|
|
||||||
} xen_vif_metrics_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_metrics_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vif_metrics_record_set *
|
|
||||||
xen_vif_metrics_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_metrics_record_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_metrics_record_set_free(xen_vif_metrics_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vif_metrics_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vif_metrics_record_opt *contents[];
|
|
||||||
} xen_vif_metrics_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vif_metrics_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vif_metrics_record_opt_set *
|
|
||||||
xen_vif_metrics_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vif_metrics_record_opt_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vif_metrics_record_opt_set_free(xen_vif_metrics_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given VIF_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_record(xen_session *session, xen_vif_metrics_record **result, xen_vif_metrics vif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VIF_metrics instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_by_uuid(xen_session *session, xen_vif_metrics *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VIF_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_uuid(xen_session *session, char **result, xen_vif_metrics vif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the io/read_kbs field of the given VIF_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the io/write_kbs field of the given VIF_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_updated field of the given VIF_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, xen_vif_metrics vif_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VIF_metrics instances known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vif_metrics_get_all(xen_session *session, struct xen_vif_metrics_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_VIF_METRICS_DECL_H
|
|
||||||
#define XEN_VIF_METRICS_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vif_metrics;
|
|
||||||
|
|
||||||
struct xen_vif_metrics_set;
|
|
||||||
struct xen_vif_metrics_record;
|
|
||||||
struct xen_vif_metrics_record_set;
|
|
||||||
struct xen_vif_metrics_record_opt;
|
|
||||||
struct xen_vif_metrics_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,931 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_H
|
|
||||||
#define XEN_VM_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_console_decl.h>
|
|
||||||
#include <xen/api/xen_crashdump_decl.h>
|
|
||||||
#include <xen/api/xen_host_decl.h>
|
|
||||||
#include <xen/api/xen_on_crash_behaviour.h>
|
|
||||||
#include <xen/api/xen_on_normal_exit.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vbd_decl.h>
|
|
||||||
#include <xen/api/xen_vdi_decl.h>
|
|
||||||
#include <xen/api/xen_vif_decl.h>
|
|
||||||
#include <xen/api/xen_vm_decl.h>
|
|
||||||
#include <xen/api/xen_vm_guest_metrics_decl.h>
|
|
||||||
#include <xen/api/xen_vm_metrics_decl.h>
|
|
||||||
#include <xen/api/xen_vm_power_state.h>
|
|
||||||
#include <xen/api/xen_cpu_pool_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VM class.
|
|
||||||
*
|
|
||||||
* A virtual machine (or 'guest').
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm. The given handle must have been allocated by
|
|
||||||
* this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_free(xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vm *contents[];
|
|
||||||
} xen_vm_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_set *
|
|
||||||
xen_vm_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_set_free(xen_vm_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_record
|
|
||||||
{
|
|
||||||
xen_vm handle;
|
|
||||||
char *uuid;
|
|
||||||
enum xen_vm_power_state power_state;
|
|
||||||
char *name_label;
|
|
||||||
char *name_description;
|
|
||||||
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_dynamic_min;
|
|
||||||
int64_t memory_static_min;
|
|
||||||
xen_string_string_map *vcpus_params;
|
|
||||||
int64_t vcpus_max;
|
|
||||||
int64_t vcpus_at_startup;
|
|
||||||
enum xen_on_normal_exit actions_after_shutdown;
|
|
||||||
enum xen_on_normal_exit actions_after_reboot;
|
|
||||||
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;
|
|
||||||
char *pv_bootloader;
|
|
||||||
char *pv_kernel;
|
|
||||||
char *pv_ramdisk;
|
|
||||||
char *pv_args;
|
|
||||||
char *pv_bootloader_args;
|
|
||||||
char *hvm_boot_policy;
|
|
||||||
xen_string_string_map *hvm_boot_params;
|
|
||||||
xen_string_string_map *platform;
|
|
||||||
char *pci_bus;
|
|
||||||
xen_string_string_map *other_config;
|
|
||||||
int64_t domid;
|
|
||||||
bool is_control_domain;
|
|
||||||
struct xen_vm_metrics_record_opt *metrics;
|
|
||||||
struct xen_vm_guest_metrics_record_opt *guest_metrics;
|
|
||||||
char *security_label;
|
|
||||||
char *pool_name;
|
|
||||||
struct xen_cpu_pool_record_opt_set *cpu_pool;
|
|
||||||
} xen_vm_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_record.
|
|
||||||
*/
|
|
||||||
extern xen_vm_record *
|
|
||||||
xen_vm_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_record, and all referenced values. The given
|
|
||||||
* record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_record_free(xen_vm_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vm handle;
|
|
||||||
xen_vm_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vm_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vm_record_opt *
|
|
||||||
xen_vm_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_record_opt_free(xen_vm_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vm_record *contents[];
|
|
||||||
} xen_vm_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_record_set *
|
|
||||||
xen_vm_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_record_set_free(xen_vm_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vm_record_opt *contents[];
|
|
||||||
} xen_vm_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_record_opt_set *
|
|
||||||
xen_vm_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_record_opt_set, and all referenced values.
|
|
||||||
* The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_record_opt_set_free(xen_vm_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_record(xen_session *session, xen_vm_record **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VM instance with the specified UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_by_uuid(xen_session *session, xen_vm *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new VM instance, and return its handle.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_create(xen_session *session, xen_vm *result, xen_vm_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_destroy(xen_session *session, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the VM instances with the given label.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_uuid(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the power_state field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/label field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_name_label(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name/description field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_name_description(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the user_version field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_user_version(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the is_a_template field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_is_a_template(xen_session *session, bool *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the auto_power_on field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
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
|
|
||||||
xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the memory/static_max field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the memory/dynamic_max field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the memory/dynamic_min field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the memory/static_min field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VCPUs/params field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VCPUs/max field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VCPUs/at_startup field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the actions/after_shutdown field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_actions_after_shutdown(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the actions/after_reboot field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the actions/after_crash field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the consoles field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VIFs field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VBDs field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
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 PV/bootloader field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PV/kernel field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PV/ramdisk field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PV/args field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PV/bootloader_args field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the HVM/boot_policy field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the HVM/boot_params field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the platform field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_platform(xen_session *session, xen_string_string_map **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PCI_bus field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm 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 domid field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_domid(xen_session *session, int64_t *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_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the guest_metrics field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/label field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name/description field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_name_description(xen_session *session, xen_vm vm, char *description);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the user_version field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_user_version(xen_session *session, xen_vm vm, int64_t user_version);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the is_a_template field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_is_a_template(xen_session *session, xen_vm vm, bool is_a_template);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the auto_power_on field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the memory/static_max field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the memory/dynamic_max field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_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 memory/static_min field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the VCPUs/params field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the VCPUs/params field of the given
|
|
||||||
* VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the VCPUs/max field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the VCPUs/at_startup field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the actions/after_shutdown field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_shutdown);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the actions/after_reboot field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_reboot);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the actions/after_crash field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_crash_behaviour after_crash);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the PV/bootloader field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the PV/kernel field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the PV/ramdisk field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the PV/args field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the PV/bootloader_args field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char *bootloader_args);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the HVM/boot_policy field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the HVM/boot_params field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the HVM/boot_params field of the
|
|
||||||
* given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the
|
|
||||||
* HVM/boot_params field of the given VM. If the key is not in that Map, then
|
|
||||||
* do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the platform field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map *platform);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to the platform field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the given key and its corresponding value from the platform
|
|
||||||
* field of the given VM. If the key is not in that Map, then do nothing.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the PCI_bus field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the other_config field of the given VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_clone(xen_session *session, xen_vm *result, xen_vm vm, char *new_name);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start the specified VM. This function can only be called with the
|
|
||||||
* VM is in the Halted State.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_start(xen_session *session, xen_vm vm, bool start_paused);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pause the specified VM. This can only be called when the specified
|
|
||||||
* VM is in the Running state.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_pause(xen_session *session, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resume the specified VM. This can only be called when the specified
|
|
||||||
* VM is in the Paused state.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_unpause(xen_session *session, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop executing the specified VM without attempting a clean shutdown.
|
|
||||||
* Then perform poweroff action specified in VM configuration.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_hard_shutdown(xen_session *session, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop executing the specified VM without attempting a clean shutdown.
|
|
||||||
* Then perform reboot action specified in VM configuration
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_hard_reboot(xen_session *session, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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. 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set this VM's VCPUs/at_startup value, and set the same value on the
|
|
||||||
* VM, if running
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_vcpus_number_live(xen_session *session, xen_vm self, int64_t nvcpu);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the given key-value pair to VM.VCPUs_params, and apply that
|
|
||||||
* value on the running VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_add_to_vcpus_params_live(xen_session *session, xen_vm self, char *key, char *value);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set memory_dynamic_max in database and on running VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_memory_dynamic_max_live(xen_session *session, xen_vm self, int64_t max);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set memory_dynamic_min in database and on running VM.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_memory_dynamic_min_live(xen_session *session, xen_vm self, int64_t min);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send the given key as a sysrq to this VM. The key is specified as a
|
|
||||||
* single character (a String of length 1). This can only be called when the
|
|
||||||
* specified VM is in the Running state.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send the named trigger to this VM. This can only be called when the
|
|
||||||
* specified VM is in the Running state.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate the VM to another host. This can only be called when the
|
|
||||||
* specified VM is in the Running state.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_migrate(xen_session *session, xen_vm vm, char *dest, bool live, xen_string_string_map *options);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VMs known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_all(xen_session *session, struct xen_vm_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the security label of a domain.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_security_label(xen_session *session, int64_t *result, xen_vm vm,
|
|
||||||
char *label, char *oldlabel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the security label of a domain.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_security_label(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the cpu_pool ref field of a domain.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the pool_name field of a domain.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_get_pool_name(xen_session *session, char **result, xen_vm vm);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the pool_name field of a domain.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_set_pool_name(xen_session *session, xen_vm vm, char *pool_name);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate the VM to another cpu_pool (on the same host). This can only be
|
|
||||||
* called when the specified VM is in the Running state.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_cpu_pool_migrate(xen_session *session, xen_vm vm, xen_cpu_pool cpu_pool);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_DECL_H
|
|
||||||
#define XEN_VM_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vm;
|
|
||||||
|
|
||||||
struct xen_vm_set;
|
|
||||||
struct xen_vm_record;
|
|
||||||
struct xen_vm_record_set;
|
|
||||||
struct xen_vm_record_opt;
|
|
||||||
struct xen_vm_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_GUEST_METRICS_H
|
|
||||||
#define XEN_VM_GUEST_METRICS_H
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vm_guest_metrics_decl.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The VM_guest_metrics class.
|
|
||||||
*
|
|
||||||
* The metrics reported by the guest (as opposed to inferred from outside).
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_guest_metrics. The given handle must have
|
|
||||||
* been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_guest_metrics_free(xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_guest_metrics_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vm_guest_metrics *contents[];
|
|
||||||
} xen_vm_guest_metrics_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_guest_metrics_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_guest_metrics_set *
|
|
||||||
xen_vm_guest_metrics_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_guest_metrics_set. The given set must have
|
|
||||||
* been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_guest_metrics_set_free(xen_vm_guest_metrics_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_guest_metrics_record
|
|
||||||
{
|
|
||||||
xen_vm_guest_metrics handle;
|
|
||||||
char *uuid;
|
|
||||||
xen_string_string_map *os_version;
|
|
||||||
xen_string_string_map *pv_drivers_version;
|
|
||||||
xen_string_string_map *memory;
|
|
||||||
xen_string_string_map *disks;
|
|
||||||
xen_string_string_map *networks;
|
|
||||||
xen_string_string_map *other;
|
|
||||||
time_t last_updated;
|
|
||||||
} xen_vm_guest_metrics_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_guest_metrics_record.
|
|
||||||
*/
|
|
||||||
extern xen_vm_guest_metrics_record *
|
|
||||||
xen_vm_guest_metrics_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_guest_metrics_record, and all referenced
|
|
||||||
* values. The given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_guest_metrics_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_vm_guest_metrics handle;
|
|
||||||
xen_vm_guest_metrics_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_vm_guest_metrics_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_guest_metrics_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_vm_guest_metrics_record_opt *
|
|
||||||
xen_vm_guest_metrics_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_guest_metrics_record_opt, and all referenced
|
|
||||||
* values. The given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_guest_metrics_record_opt_free(xen_vm_guest_metrics_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_guest_metrics_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vm_guest_metrics_record *contents[];
|
|
||||||
} xen_vm_guest_metrics_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_guest_metrics_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_guest_metrics_record_set *
|
|
||||||
xen_vm_guest_metrics_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_guest_metrics_record_set, and all referenced
|
|
||||||
* values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_guest_metrics_record_set_free(xen_vm_guest_metrics_record_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_guest_metrics_record_opt_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_vm_guest_metrics_record_opt *contents[];
|
|
||||||
} xen_vm_guest_metrics_record_opt_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_guest_metrics_record_opt_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_guest_metrics_record_opt_set *
|
|
||||||
xen_vm_guest_metrics_record_opt_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_guest_metrics_record_opt_set, and all
|
|
||||||
* referenced values. The given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_guest_metrics_record_opt_set_free(xen_vm_guest_metrics_record_opt_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a record containing the current state of the given
|
|
||||||
* VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_record(xen_session *session, xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a reference to the VM_guest_metrics instance with the specified
|
|
||||||
* UUID.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics *result, char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the uuid field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the os_version field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_os_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PV_drivers_version field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the memory field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the disks field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the networks field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the other field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_updated field of the given VM_guest_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_guest_metrics vm_guest_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VM_guest_metrics instances known to the
|
|
||||||
* system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_guest_metrics_get_all(xen_session *session, struct xen_vm_guest_metrics_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_GUEST_METRICS_DECL_H
|
|
||||||
#define XEN_VM_GUEST_METRICS_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_vm_guest_metrics;
|
|
||||||
|
|
||||||
struct xen_vm_guest_metrics_set;
|
|
||||||
struct xen_vm_guest_metrics_record;
|
|
||||||
struct xen_vm_guest_metrics_record_set;
|
|
||||||
struct xen_vm_guest_metrics_record_opt;
|
|
||||||
struct xen_vm_guest_metrics_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_int_float_map.h>
|
|
||||||
#include <xen/api/xen_int_int_map.h>
|
|
||||||
#include <xen/api/xen_int_string_set_map.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/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;
|
|
||||||
int64_t memory_actual;
|
|
||||||
int64_t vcpus_number;
|
|
||||||
xen_int_float_map *vcpus_utilisation;
|
|
||||||
xen_int_int_map *vcpus_cpu;
|
|
||||||
xen_string_string_map *vcpus_params;
|
|
||||||
xen_int_string_set_map *vcpus_flags;
|
|
||||||
struct xen_string_set *state;
|
|
||||||
time_t start_time;
|
|
||||||
time_t last_updated;
|
|
||||||
} 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 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);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VCPUs/CPU field of the given VM_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, xen_vm_metrics vm_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VCPUs/params field of the given VM_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm_metrics vm_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the VCPUs/flags field of the given VM_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_vcpus_flags(xen_session *session, xen_int_string_set_map **result, xen_vm_metrics vm_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the state field of the given VM_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the start_time field of the given VM_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last_updated field of the given VM_metrics.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_metrics vm_metrics);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a list of all the VM_metrics instances known to the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_vm_metrics_get_all(xen_session *session, struct xen_vm_metrics_set **result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_POWER_STATE_H
|
|
||||||
#define XEN_VM_POWER_STATE_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum xen_vm_power_state
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Halted
|
|
||||||
*/
|
|
||||||
XEN_VM_POWER_STATE_HALTED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Paused
|
|
||||||
*/
|
|
||||||
XEN_VM_POWER_STATE_PAUSED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Running
|
|
||||||
*/
|
|
||||||
XEN_VM_POWER_STATE_RUNNING,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Suspended
|
|
||||||
*/
|
|
||||||
XEN_VM_POWER_STATE_SUSPENDED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Crashed
|
|
||||||
*/
|
|
||||||
XEN_VM_POWER_STATE_CRASHED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some other unknown state
|
|
||||||
*/
|
|
||||||
XEN_VM_POWER_STATE_UNKNOWN
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_vm_power_state_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
enum xen_vm_power_state contents[];
|
|
||||||
} xen_vm_power_state_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_vm_power_state_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_vm_power_state_set *
|
|
||||||
xen_vm_power_state_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_vm_power_state_set. The given set must have been
|
|
||||||
* allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_vm_power_state_set_free(xen_vm_power_state_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name corresponding to the given code. This string must
|
|
||||||
* not be modified or freed.
|
|
||||||
*/
|
|
||||||
extern const char *
|
|
||||||
xen_vm_power_state_to_string(enum xen_vm_power_state 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_vm_power_state
|
|
||||||
xen_vm_power_state_from_string(xen_session *session, const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,293 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, IBM Corp.
|
|
||||||
* Copyright (c) 2007, 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_XSPOLICY_H
|
|
||||||
#define XEN_XSPOLICY_H
|
|
||||||
|
|
||||||
#include "xen_common.h"
|
|
||||||
#include "xen_xspolicy_decl.h"
|
|
||||||
#include "xen_string_string_map.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The XSPolicy and associated data structures.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
typedef int64_t xs_type;
|
|
||||||
typedef int64_t xs_instantiationflags;
|
|
||||||
|
|
||||||
enum xs_type {
|
|
||||||
XS_POLICY_ACM = (1 << 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
enum xs_instantiationflags {
|
|
||||||
XS_INST_NONE = 0,
|
|
||||||
XS_INST_BOOT = (1 << 0),
|
|
||||||
XS_INST_LOAD = (1 << 1),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Error codes returned by xend following XSPolicy operations */
|
|
||||||
#define XSERR_BASE 0x1000
|
|
||||||
|
|
||||||
#define XSERR_SUCCESS 0
|
|
||||||
#define XSERR_GENERAL_FAILURE 1 + XSERR_BASE
|
|
||||||
#define XSERR_BAD_XML 2 + XSERR_BASE
|
|
||||||
#define XSERR_XML_PROCESSING 3 + XSERR_BASE
|
|
||||||
#define XSERR_POLICY_INCONSISTENT 4 + XSERR_BASE
|
|
||||||
#define XSERR_FILE_ERROR 5 + XSERR_BASE
|
|
||||||
#define XSERR_BAD_RESOURCE_FORMAT 6 + XSERR_BASE
|
|
||||||
#define XSERR_BAD_LABEL_FORMAT 7 + XSERR_BASE
|
|
||||||
#define XSERR_RESOURCE_NOT_LABELED 8 + XSERR_BASE
|
|
||||||
#define XSERR_RESOURCE_ALREADY_LABELED 9 + XSERR_BASE
|
|
||||||
#define XSERR_WRONG_POLICY_TYPE 10 + XSERR_BASE
|
|
||||||
#define XSERR_BOOTPOLICY_INSTALLED 11 + XSERR_BASE
|
|
||||||
#define XSERR_NO_DEFAULT_BOOT_TITLE 12 + XSERR_BASE
|
|
||||||
#define XSERR_POLICY_LOAD_FAILED 13 + XSERR_BASE
|
|
||||||
#define XSERR_POLICY_LOADED 14 + XSERR_BASE
|
|
||||||
#define XSERR_POLICY_TYPE_UNSUPPORTED 15 + XSERR_BASE
|
|
||||||
#define XSERR_BAD_CONFLICTSET 20 + XSERR_BASE
|
|
||||||
#define XSERR_RESOURCE_IN_USE 21 + XSERR_BASE
|
|
||||||
#define XSERR_BAD_POLICY_NAME 22 + XSERR_BASE
|
|
||||||
#define XSERR_RESOURCE_ACCESS 23 + XSERR_BASE
|
|
||||||
#define XSERR_HV_OP_FAILED 24 + XSERR_BASE
|
|
||||||
#define XSERR_BOOTPOLICY_INSTALL_ERROR 25 + XSERR_BASE
|
|
||||||
#define XSERR_VM_NOT_AUTHORIZED 26 + XSERR_BASE
|
|
||||||
#define XSERR_VM_IN_CONFLICT 27 + XSERR_BASE
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_xspolicy. The given handle must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_xspolicy_free(xen_xspolicy xspolicy);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_xspolicy_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_xspolicy *contents[];
|
|
||||||
} xen_xspolicy_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_xspolicy_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_xspolicy_set *
|
|
||||||
xen_xspolicy_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_xspolicy_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_xspolicy_set_free(xen_xspolicy_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_xspolicy_record
|
|
||||||
{
|
|
||||||
xen_xspolicy handle;
|
|
||||||
char *uuid;
|
|
||||||
char *repr;
|
|
||||||
xs_instantiationflags flags;
|
|
||||||
xs_type type;
|
|
||||||
} xen_xspolicy_record;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_xspolicy_record.
|
|
||||||
*/
|
|
||||||
extern xen_xspolicy_record *
|
|
||||||
xen_xspolicy_record_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_xspolicy_record, and all referenced values. The
|
|
||||||
* given record must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_xspolicy_record_free(xen_xspolicy_record *record);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_xspolicy_record_opt
|
|
||||||
{
|
|
||||||
bool is_record;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
xen_xspolicy handle;
|
|
||||||
xen_xspolicy_record *record;
|
|
||||||
} u;
|
|
||||||
} xen_xspolicy_record_opt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_xspolicy_record_opt.
|
|
||||||
*/
|
|
||||||
extern xen_xspolicy_record_opt *
|
|
||||||
xen_xspolicy_record_opt_alloc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_xspolicy_record_opt, and all referenced values. The
|
|
||||||
* given record_opt must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_xspolicy_record_opt_free(xen_xspolicy_record_opt *record_opt);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_xspolicy_record_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
xen_xspolicy_record *contents[];
|
|
||||||
} xen_xspolicy_record_set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_xspolicy_record_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_xspolicy_record_set *
|
|
||||||
xen_xspolicy_record_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_xspolicy_record_set, and all referenced values. The
|
|
||||||
* given set must have been allocated by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_xspolicy_record_set_free(xen_xspolicy_record_set *set);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Data structures and function declarations for an XS Policy's state
|
|
||||||
* information.
|
|
||||||
*/
|
|
||||||
typedef struct xen_xs_policystate
|
|
||||||
{
|
|
||||||
xen_xspolicy_record_opt *xs_ref;
|
|
||||||
int64_t xserr;
|
|
||||||
char *repr;
|
|
||||||
xs_type type;
|
|
||||||
xs_instantiationflags flags;
|
|
||||||
char *version;
|
|
||||||
char *errors;
|
|
||||||
} xen_xs_policystate;
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_xs_policystate_free(xen_xs_policystate *state);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the referenced policy's record.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_record(xen_session *session, xen_xspolicy_record **result,
|
|
||||||
xen_xspolicy xspolicy);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the UUID field of the given policy.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_uuid(xen_session *session, char **result,
|
|
||||||
xen_xspolicy xspolicy);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a policy given it's UUID
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_by_uuid(xen_session *session, xen_xspolicy *result,
|
|
||||||
char *uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the types of policies supported by the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_xstype(xen_session *session, xs_type *result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get information about the currently managed policy.
|
|
||||||
* (The API allows only one policy to be on the system.)
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_xspolicy(xen_session *session, xen_xs_policystate **result);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activate the referenced policy by loading it into the hypervisor.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_activate_xspolicy(xen_session *session, int64_t *result,
|
|
||||||
xen_xspolicy xspolicy,
|
|
||||||
xs_instantiationflags flags);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the system's policy to the given information comprising
|
|
||||||
* type of policy, the xml representation of the policy, some flags
|
|
||||||
* on whether to load the policy immediately and whether to overwrite
|
|
||||||
* an existing policy on the system.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result,
|
|
||||||
xs_type type, char *repr, int64_t flags,
|
|
||||||
bool overwrite);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to reset the system's policy to the DEFAULT policy for the
|
|
||||||
* respective policy type. This is done by updating the system and therefore
|
|
||||||
* underlies the same restrictions of a policy update. This operation may
|
|
||||||
* for example fail if other domains than Domain-0 are running and have
|
|
||||||
* different labels than Domain-0.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result,
|
|
||||||
xs_type type);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove any policy from having the system booted with.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_rm_xsbootpolicy(xen_session *session);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve all labeled resources.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_labeled_resources(xen_session *session,
|
|
||||||
xen_string_string_map **resources);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Label a resource such as for example a hard drive partition or file
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_set_resource_label(xen_session *session,
|
|
||||||
char *resource, char *label,
|
|
||||||
char *oldlabel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the label of a resource.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_get_resource_label(xen_session *session, char **label,
|
|
||||||
char *resource);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether a VM with the given VM-label could run.
|
|
||||||
*/
|
|
||||||
extern bool
|
|
||||||
xen_xspolicy_can_run(xen_session *session, int64_t *result,
|
|
||||||
char *security_label);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, IBM Corp.
|
|
||||||
* Copyright (c) 2007, 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_XSPOLICY_DECL_H
|
|
||||||
#define XEN_XSPOLICY_DECL_H
|
|
||||||
|
|
||||||
typedef void *xen_xspolicy;
|
|
||||||
|
|
||||||
struct xen_xspolicy_set;
|
|
||||||
struct xen_xspolicy_record;
|
|
||||||
struct xen_xspolicy_record_set;
|
|
||||||
struct xen_xspolicy_record_opt;
|
|
||||||
struct xen_xspolicy_record_opt_set;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_console_protocol. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_CONSOLE_PROTOCOL_INTERNAL_H
|
|
||||||
#define XEN_CONSOLE_PROTOCOL_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_console_protocol_abstract_type_;
|
|
||||||
extern const abstract_type xen_console_protocol_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_event_operation. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_EVENT_OPERATION_INTERNAL_H
|
|
||||||
#define XEN_EVENT_OPERATION_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_event_operation_abstract_type_;
|
|
||||||
extern const abstract_type xen_event_operation_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007 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_INTERNAL_H
|
|
||||||
#define XEN_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
|
|
||||||
|
|
||||||
enum abstract_typename
|
|
||||||
{
|
|
||||||
VOID,
|
|
||||||
STRING,
|
|
||||||
INT,
|
|
||||||
FLOAT,
|
|
||||||
BOOL,
|
|
||||||
DATETIME,
|
|
||||||
SET,
|
|
||||||
MAP,
|
|
||||||
STRUCT,
|
|
||||||
REF,
|
|
||||||
ENUM,
|
|
||||||
ENUMSET
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
void *contents[];
|
|
||||||
} arbitrary_set;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct struct_member struct_member;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct abstract_type
|
|
||||||
{
|
|
||||||
enum abstract_typename typename;
|
|
||||||
const struct abstract_type *child;
|
|
||||||
const char * (*enum_marshaller)(int);
|
|
||||||
int (*enum_demarshaller)(xen_session *, const char *);
|
|
||||||
size_t struct_size;
|
|
||||||
size_t member_count;
|
|
||||||
const struct_member *members;
|
|
||||||
} abstract_type;
|
|
||||||
|
|
||||||
|
|
||||||
struct struct_member
|
|
||||||
{
|
|
||||||
const char *key;
|
|
||||||
const struct abstract_type *type;
|
|
||||||
int offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type abstract_type_string;
|
|
||||||
extern const abstract_type abstract_type_int;
|
|
||||||
extern const abstract_type abstract_type_float;
|
|
||||||
extern const abstract_type abstract_type_bool;
|
|
||||||
extern const abstract_type abstract_type_datetime;
|
|
||||||
extern const abstract_type abstract_type_ref;
|
|
||||||
|
|
||||||
extern const abstract_type abstract_type_string_set;
|
|
||||||
extern const abstract_type abstract_type_ref_set;
|
|
||||||
|
|
||||||
extern const abstract_type abstract_type_string_string_map;
|
|
||||||
extern const abstract_type abstract_type_int_float_map;
|
|
||||||
extern const abstract_type abstract_type_int_int_map;
|
|
||||||
extern const abstract_type abstract_type_int_string_set_map;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct abstract_value
|
|
||||||
{
|
|
||||||
const abstract_type *type;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
const char *string_val;
|
|
||||||
int64_t int_val;
|
|
||||||
int enum_val;
|
|
||||||
double float_val;
|
|
||||||
bool bool_val;
|
|
||||||
arbitrary_set *set_val;
|
|
||||||
void *struct_val;
|
|
||||||
time_t datetime_val;
|
|
||||||
} u;
|
|
||||||
} abstract_value;
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_call_(xen_session *s, const char *method_name, abstract_value params[],
|
|
||||||
int param_count, const abstract_type *result_type, void *value);
|
|
||||||
|
|
||||||
|
|
||||||
#define XEN_CALL_(method_name__) \
|
|
||||||
xen_call_(session, method_name__, param_values, \
|
|
||||||
sizeof(param_values) / sizeof(param_values[0]), \
|
|
||||||
&result_type, result) \
|
|
||||||
|
|
||||||
|
|
||||||
extern char *
|
|
||||||
xen_strdup_(const char *in);
|
|
||||||
|
|
||||||
|
|
||||||
extern int
|
|
||||||
xen_enum_lookup_(xen_session *session, const char *str,
|
|
||||||
const char **lookup_table, int n);
|
|
||||||
|
|
||||||
#define ENUM_LOOKUP(session__, str__, lookup_table__) \
|
|
||||||
xen_enum_lookup_(session__, str__, lookup_table__, \
|
|
||||||
sizeof(lookup_table__) / \
|
|
||||||
sizeof(lookup_table__[0])) \
|
|
||||||
|
|
||||||
#define XEN_ALLOC(type__) \
|
|
||||||
type__ * \
|
|
||||||
type__ ## _alloc() \
|
|
||||||
{ \
|
|
||||||
return calloc(1, sizeof(type__)); \
|
|
||||||
} \
|
|
||||||
|
|
||||||
|
|
||||||
#define XEN_FREE(type__) \
|
|
||||||
void \
|
|
||||||
type__ ## _free(type__ handle) \
|
|
||||||
{ \
|
|
||||||
free(handle); \
|
|
||||||
} \
|
|
||||||
|
|
||||||
|
|
||||||
#define XEN_SET_ALLOC_FREE(type__) \
|
|
||||||
XEN_SET_ALLOC(type__) \
|
|
||||||
XEN_SET_FREE(type__)
|
|
||||||
|
|
||||||
|
|
||||||
#define XEN_SET_ALLOC(type__) \
|
|
||||||
type__ ## _set * \
|
|
||||||
type__ ## _set_alloc(size_t size) \
|
|
||||||
{ \
|
|
||||||
type__ ## _set *result = calloc(1, sizeof(type__ ## _set) + \
|
|
||||||
size * sizeof(type__)); \
|
|
||||||
result->size = size; \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define XEN_SET_FREE(type__) \
|
|
||||||
void type__ ## _set_free(type__ ## _set *set) \
|
|
||||||
{ \
|
|
||||||
if (set == NULL) \
|
|
||||||
return; \
|
|
||||||
for (size_t i = 0; i < set->size; i++) \
|
|
||||||
type__ ## _free(set->contents[i]); \
|
|
||||||
free(set); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define XEN_RECORD_OPT_FREE(type__) \
|
|
||||||
void type__ ## _record_opt_free(type__ ## _record_opt *opt) { \
|
|
||||||
if (opt == NULL) return; \
|
|
||||||
if (opt->is_record) \
|
|
||||||
type__ ## _record_free(opt->u.record); \
|
|
||||||
else \
|
|
||||||
type__ ## _free(opt->u.handle); \
|
|
||||||
free(opt); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_on_crash_behaviour. Internal to this library -- do not use from
|
|
||||||
* outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_ON_CRASH_BEHAVIOUR_INTERNAL_H
|
|
||||||
#define XEN_ON_CRASH_BEHAVIOUR_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_on_crash_behaviour_abstract_type_;
|
|
||||||
extern const abstract_type xen_on_crash_behaviour_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_on_normal_exit. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_ON_NORMAL_EXIT_INTERNAL_H
|
|
||||||
#define XEN_ON_NORMAL_EXIT_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_on_normal_exit_abstract_type_;
|
|
||||||
extern const abstract_type xen_on_normal_exit_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_vbd_mode. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_VBD_MODE_INTERNAL_H
|
|
||||||
#define XEN_VBD_MODE_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_vbd_mode_abstract_type_;
|
|
||||||
extern const abstract_type xen_vbd_mode_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_vbd_type. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_VBD_TYPE_INTERNAL_H
|
|
||||||
#define XEN_VBD_TYPE_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_vbd_type_abstract_type_;
|
|
||||||
extern const abstract_type xen_vbd_type_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_vdi_type. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_VDI_TYPE_INTERNAL_H
|
|
||||||
#define XEN_VDI_TYPE_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_vdi_type_abstract_type_;
|
|
||||||
extern const abstract_type xen_vdi_type_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Declarations of the abstract types used during demarshalling of enum
|
|
||||||
* xen_vm_power_state. Internal to this library -- do not use from outside.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XEN_VM_POWER_STATE_INTERNAL_H
|
|
||||||
#define XEN_VM_POWER_STATE_INTERNAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const abstract_type xen_vm_power_state_abstract_type_;
|
|
||||||
extern const abstract_type xen_vm_power_state_set_abstract_type_;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,298 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_console_protocol_internal.h"
|
|
||||||
#include "xen_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_console.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vm.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_FREE(xen_console)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_console)
|
|
||||||
XEN_ALLOC(xen_console_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_console_record)
|
|
||||||
XEN_ALLOC(xen_console_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_console)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_console_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_console_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_console_record, uuid) },
|
|
||||||
{ .key = "protocol",
|
|
||||||
.type = &xen_console_protocol_abstract_type_,
|
|
||||||
.offset = offsetof(xen_console_record, protocol) },
|
|
||||||
{ .key = "location",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_console_record, location) },
|
|
||||||
{ .key = "VM",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_console_record, vm) },
|
|
||||||
{ .key = "other_config",
|
|
||||||
.type = &abstract_type_string_string_map,
|
|
||||||
.offset = offsetof(xen_console_record, other_config) }
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_console_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_console_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_console_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_console_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_console_record_free(xen_console_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
free(record->location);
|
|
||||||
xen_vm_record_opt_free(record->vm);
|
|
||||||
xen_string_string_map_free(record->other_config);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_console_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("console.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_by_uuid(xen_session *session, xen_console *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_("console.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_create(xen_session *session, xen_console *result, xen_console_record *record)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &xen_console_record_abstract_type_,
|
|
||||||
.u.struct_val = record }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("console.create");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_destroy(xen_session *session, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "console.destroy", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_console_protocol_abstract_type_;
|
|
||||||
XEN_CALL_("console.get_protocol");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_location(xen_session *session, char **result, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("console.get_location");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("console.get_VM");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_string_map;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("console.get_other_config");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console },
|
|
||||||
{ .type = &abstract_type_string_string_map,
|
|
||||||
.u.set_val = (arbitrary_set *)other_config }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "console.set_other_config", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = key },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = value }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "console.add_to_other_config", param_values, 3, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = key }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "console.remove_from_other_config", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_all(xen_session *session, struct xen_console_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "console.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_console_get_uuid(xen_session *session, char **result, xen_console console)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = console }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("console.get_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_console_protocol.h>
|
|
||||||
#include "xen_console_protocol_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maintain this in the same order as the enum declaration!
|
|
||||||
*/
|
|
||||||
static const char *lookup_table[] =
|
|
||||||
{
|
|
||||||
"vt100",
|
|
||||||
"rfb",
|
|
||||||
"rdp"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern xen_console_protocol_set *
|
|
||||||
xen_console_protocol_set_alloc(size_t size)
|
|
||||||
{
|
|
||||||
return calloc(1, sizeof(xen_console_protocol_set) +
|
|
||||||
size * sizeof(enum xen_console_protocol));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_console_protocol_set_free(xen_console_protocol_set *set)
|
|
||||||
{
|
|
||||||
free(set);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
xen_console_protocol_to_string(enum xen_console_protocol val)
|
|
||||||
{
|
|
||||||
return lookup_table[val];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern enum xen_console_protocol
|
|
||||||
xen_console_protocol_from_string(xen_session *session, const char *str)
|
|
||||||
{
|
|
||||||
return ENUM_LOOKUP(session, str, lookup_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_console_protocol_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = ENUM,
|
|
||||||
.enum_marshaller =
|
|
||||||
(const char *(*)(int))&xen_console_protocol_to_string,
|
|
||||||
.enum_demarshaller =
|
|
||||||
(int (*)(xen_session *, const char *))&xen_console_protocol_from_string
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_console_protocol_set_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = SET,
|
|
||||||
.child = &xen_console_protocol_abstract_type_
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,671 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_cpu_pool.h>
|
|
||||||
#include <xen/api/xen_host_cpu.h>
|
|
||||||
|
|
||||||
XEN_FREE(xen_cpu_pool)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_cpu_pool)
|
|
||||||
XEN_ALLOC(xen_cpu_pool_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_cpu_pool_record)
|
|
||||||
XEN_ALLOC(xen_cpu_pool_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_cpu_pool)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_cpu_pool_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_cpu_pool_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, uuid) },
|
|
||||||
{ .key = "name_label",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, name_label) },
|
|
||||||
{ .key = "name_description",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, name_description) },
|
|
||||||
{ .key = "resident_on",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, resident_on) },
|
|
||||||
{ .key = "auto_power_on",
|
|
||||||
.type = &abstract_type_bool,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, auto_power_on) },
|
|
||||||
{ .key = "started_VMs",
|
|
||||||
.type = &abstract_type_ref_set,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, started_vms) },
|
|
||||||
{ .key = "ncpu",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, ncpu) },
|
|
||||||
{ .key = "sched_policy",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, sched_policy) },
|
|
||||||
{ .key = "proposed_CPUs",
|
|
||||||
.type = &abstract_type_string_set,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, proposed_cpus) },
|
|
||||||
{ .key = "host_CPUs",
|
|
||||||
.type = &abstract_type_ref_set,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, host_cpus) },
|
|
||||||
{ .key = "activated",
|
|
||||||
.type = &abstract_type_bool,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, activated) },
|
|
||||||
{ .key = "other_config",
|
|
||||||
.type = &abstract_type_string_string_map,
|
|
||||||
.offset = offsetof(xen_cpu_pool_record, other_config) },
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_cpu_pool_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_cpu_pool_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_cpu_pool_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_cpu_pool_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_cpu_pool_record_free(xen_cpu_pool_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
free(record->name_label);
|
|
||||||
free(record->name_description);
|
|
||||||
xen_host_record_opt_free(record->resident_on);
|
|
||||||
xen_vm_record_opt_set_free(record->started_vms);
|
|
||||||
free(record->sched_policy);
|
|
||||||
xen_string_set_free(record->proposed_cpus);
|
|
||||||
xen_host_cpu_record_opt_set_free(record->host_cpus);
|
|
||||||
xen_string_string_map_free(record->other_config);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_record(xen_session *session, xen_cpu_pool_record **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_cpu_pool_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_by_uuid(xen_session *session, xen_cpu_pool *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_("cpu_pool.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_create(xen_session *session, xen_cpu_pool *result,
|
|
||||||
xen_cpu_pool_record *record)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &xen_cpu_pool_record_abstract_type_,
|
|
||||||
.u.struct_val = record }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.create");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_destroy(xen_session *session, xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.destroy", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_uuid(xen_session *session, char **result, xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_deactivate(xen_session *session, xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.deactivate", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_activate(xen_session *session, xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.activate", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_add_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu },
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.add_host_CPU_live", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_remove_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu },
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.remove_host_CPU_live", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_all(xen_session *session, struct xen_cpu_pool_set **result)
|
|
||||||
{
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "cpu_pool.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_by_name_label(xen_session *session,
|
|
||||||
struct xen_cpu_pool_set **result, char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_by_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_activated(xen_session *session, bool *result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_bool;
|
|
||||||
|
|
||||||
XEN_CALL_("cpu_pool.get_activated");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_auto_power_on(xen_session *session, bool *result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_bool;
|
|
||||||
|
|
||||||
XEN_CALL_("cpu_pool.get_auto_power_on");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_host_CPUs(xen_session *session, struct xen_host_cpu_set **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_host_CPUs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_name_description(xen_session *session, char **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_name_description");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_name_label(xen_session *session, char **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_ncpu(xen_session *session, int64_t *result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("cpu_pool.get_ncpu");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_proposed_CPUs(xen_session *session, struct xen_string_set **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_proposed_CPUs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_other_config(xen_session *session, xen_string_string_map **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_string_map;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_other_config");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_resident_on(xen_session *session, xen_host *result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_resident_on");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_sched_policy(xen_session *session, char **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_sched_policy");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_get_started_VMs(xen_session *session, xen_vm_set **result,
|
|
||||||
xen_cpu_pool cpu_pool)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("cpu_pool.get_started_VMs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_auto_power_on(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
bool auto_power_on)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_bool,
|
|
||||||
.u.bool_val = auto_power_on }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_auto_power_on", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_string_set *proposed_cpus)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string_set,
|
|
||||||
.u.set_val = (arbitrary_set *)proposed_cpus }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_proposed_CPUs", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_add_to_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char* proposed_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = proposed_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.add_to_proposed_CPUs", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_remove_from_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char* proposed_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = proposed_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.remove_from_proposed_CPUs", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_name_label(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_name_label", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_name_description(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *descr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = descr }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_name_description", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_ncpu(xen_session *session, xen_cpu_pool cpu_pool, int64_t ncpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_int,
|
|
||||||
.u.int_val = ncpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_ncpu", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_other_config(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
xen_string_string_map *other_config)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string_string_map,
|
|
||||||
.u.set_val = (arbitrary_set *)other_config }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_other_config", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_add_to_other_config(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *key, char *value)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = key },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = value }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.add_to_other_config", param_values, 3, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_remove_from_other_config(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *key)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = key }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.remove_from_other_config", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_cpu_pool_set_sched_policy(xen_session *session, xen_cpu_pool cpu_pool,
|
|
||||||
char *sched_policy)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = cpu_pool },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sched_policy }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "cpu_pool.set_sched_policy", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_crashdump.h>
|
|
||||||
#include <xen/api/xen_vdi.h>
|
|
||||||
#include <xen/api/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_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_destroy(xen_session *session, xen_crashdump self)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = self }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "crashdump.destroy", param_values, 1, NULL, NULL);
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_event_operation_internal.h"
|
|
||||||
#include "xen_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_event.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_ALLOC(xen_event_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_event_record)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_event_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "id",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_event_record, id) },
|
|
||||||
{ .key = "timestamp",
|
|
||||||
.type = &abstract_type_datetime,
|
|
||||||
.offset = offsetof(xen_event_record, timestamp) },
|
|
||||||
{ .key = "class",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_event_record, class) },
|
|
||||||
{ .key = "operation",
|
|
||||||
.type = &xen_event_operation_abstract_type_,
|
|
||||||
.offset = offsetof(xen_event_record, operation) },
|
|
||||||
{ .key = "ref",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_event_record, ref) },
|
|
||||||
{ .key = "obj_uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_event_record, obj_uuid) }
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_event_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_event_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_event_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_event_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_event_record_set_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = SET,
|
|
||||||
.child = &xen_event_record_abstract_type_
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_event_record_free(xen_event_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->class);
|
|
||||||
free(record->ref);
|
|
||||||
free(record->obj_uuid);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_event_register(xen_session *session, struct xen_string_set *classes)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string_set,
|
|
||||||
.u.set_val = (arbitrary_set *)classes }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "event.register", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_event_unregister(xen_session *session, struct xen_string_set *classes)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string_set,
|
|
||||||
.u.set_val = (arbitrary_set *)classes }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "event.unregister", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_event_next(xen_session *session, struct xen_event_record_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = xen_event_record_set_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "event.next", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_event_operation.h>
|
|
||||||
#include "xen_event_operation_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maintain this in the same order as the enum declaration!
|
|
||||||
*/
|
|
||||||
static const char *lookup_table[] =
|
|
||||||
{
|
|
||||||
"add",
|
|
||||||
"del",
|
|
||||||
"mod"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern xen_event_operation_set *
|
|
||||||
xen_event_operation_set_alloc(size_t size)
|
|
||||||
{
|
|
||||||
return calloc(1, sizeof(xen_event_operation_set) +
|
|
||||||
size * sizeof(enum xen_event_operation));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_event_operation_set_free(xen_event_operation_set *set)
|
|
||||||
{
|
|
||||||
free(set);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
xen_event_operation_to_string(enum xen_event_operation val)
|
|
||||||
{
|
|
||||||
return lookup_table[val];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern enum xen_event_operation
|
|
||||||
xen_event_operation_from_string(xen_session *session, const char *str)
|
|
||||||
{
|
|
||||||
return ENUM_LOOKUP(session, str, lookup_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_event_operation_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = ENUM,
|
|
||||||
.enum_marshaller =
|
|
||||||
(const char *(*)(int))&xen_event_operation_to_string,
|
|
||||||
.enum_demarshaller =
|
|
||||||
(int (*)(xen_session *, const char *))&xen_event_operation_from_string
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,915 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host.h>
|
|
||||||
#include <xen/api/xen_host_cpu.h>
|
|
||||||
#include <xen/api/xen_host_metrics.h>
|
|
||||||
#include <xen/api/xen_pbd.h>
|
|
||||||
#include <xen/api/xen_pif.h>
|
|
||||||
#include <xen/api/xen_sr.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vm.h>
|
|
||||||
#include <xen/api/xen_cpu_pool.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_FREE(xen_host)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_host)
|
|
||||||
XEN_ALLOC(xen_host_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_host_record)
|
|
||||||
XEN_ALLOC(xen_host_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_host)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_host_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_host_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_record, uuid) },
|
|
||||||
{ .key = "name_label",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_record, name_label) },
|
|
||||||
{ .key = "name_description",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_record, name_description) },
|
|
||||||
{ .key = "API_version_major",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_host_record, api_version_major) },
|
|
||||||
{ .key = "API_version_minor",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_host_record, api_version_minor) },
|
|
||||||
{ .key = "API_version_vendor",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_record, api_version_vendor) },
|
|
||||||
{ .key = "API_version_vendor_implementation",
|
|
||||||
.type = &abstract_type_string_string_map,
|
|
||||||
.offset = offsetof(xen_host_record, api_version_vendor_implementation) },
|
|
||||||
{ .key = "enabled",
|
|
||||||
.type = &abstract_type_bool,
|
|
||||||
.offset = offsetof(xen_host_record, enabled) },
|
|
||||||
{ .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 = "capabilities",
|
|
||||||
.type = &abstract_type_string_set,
|
|
||||||
.offset = offsetof(xen_host_record, capabilities) },
|
|
||||||
{ .key = "cpu_configuration",
|
|
||||||
.type = &abstract_type_string_string_map,
|
|
||||||
.offset = offsetof(xen_host_record, cpu_configuration) },
|
|
||||||
{ .key = "sched_policy",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_record, sched_policy) },
|
|
||||||
{ .key = "supported_bootloaders",
|
|
||||||
.type = &abstract_type_string_set,
|
|
||||||
.offset = offsetof(xen_host_record, supported_bootloaders) },
|
|
||||||
{ .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) },
|
|
||||||
{ .key = "metrics",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_host_record, metrics) },
|
|
||||||
{ .key = "resident_cpu_pools",
|
|
||||||
.type = &abstract_type_ref_set,
|
|
||||||
.offset = offsetof(xen_host_record, resident_cpu_pools) }
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_host_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_host_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_host_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_host_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_host_record_free(xen_host_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
free(record->name_label);
|
|
||||||
free(record->name_description);
|
|
||||||
free(record->api_version_vendor);
|
|
||||||
xen_string_string_map_free(record->api_version_vendor_implementation);
|
|
||||||
xen_string_string_map_free(record->software_version);
|
|
||||||
xen_string_string_map_free(record->other_config);
|
|
||||||
xen_string_set_free(record->capabilities);
|
|
||||||
xen_string_string_map_free(record->cpu_configuration);
|
|
||||||
free(record->sched_policy);
|
|
||||||
xen_string_set_free(record->supported_bootloaders);
|
|
||||||
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);
|
|
||||||
xen_cpu_pool_record_opt_set_free(record->resident_cpu_pools);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_host_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_by_uuid(xen_session *session, xen_host *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.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host.get_by_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_name_label(xen_session *session, char **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_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_name_description(xen_session *session, char **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_name_description");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("host.get_API_version_major");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("host.get_API_version_minor");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_api_version_vendor(xen_session *session, char **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_API_version_vendor");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_api_version_vendor_implementation(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_API_version_vendor_implementation");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_enabled(xen_session *session, bool *result, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_bool;
|
|
||||||
|
|
||||||
XEN_CALL_("host.get_enabled");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_software_version(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_software_version");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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_capabilities(xen_session *session, struct xen_string_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_capabilities");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_cpu_configuration(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_cpu_configuration");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_sched_policy(xen_session *session, char **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_sched_policy");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_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_supported_bootloaders");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_resident_vms(xen_session *session, struct xen_vm_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_resident_VMs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host.get_PIFs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host.get_host_CPUs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.set_name_label", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_set_name_description(xen_session *session, xen_host host, char *description)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = description }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.set_name_description", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.disable", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_enable(xen_session *session, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.enable", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_shutdown(xen_session *session, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.shutdown", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_reboot(xen_session *session, xen_host host)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.reboot", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_dmesg(xen_session *session, char **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.dmesg");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_dmesg_clear(xen_session *session, char **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.dmesg_clear");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_log(xen_session *session, char **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_log");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = keys }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "host.send_debug_keys", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_list_methods(xen_session *session, struct xen_string_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "host.list_methods", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_all(xen_session *session, struct xen_host_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "host.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_uuid(xen_session *session, char **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_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_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_resident_cpu_pools");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,353 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host.h>
|
|
||||||
#include <xen/api/xen_host_cpu.h>
|
|
||||||
#include <xen/api/xen_cpu_pool.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_FREE(xen_host_cpu)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_host_cpu)
|
|
||||||
XEN_ALLOC(xen_host_cpu_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_host_cpu_record)
|
|
||||||
XEN_ALLOC(xen_host_cpu_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_host_cpu)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_host_cpu_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_host_cpu_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, uuid) },
|
|
||||||
{ .key = "host",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, host) },
|
|
||||||
{ .key = "number",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, number) },
|
|
||||||
{ .key = "vendor",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, vendor) },
|
|
||||||
{ .key = "speed",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, speed) },
|
|
||||||
{ .key = "modelname",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, modelname) },
|
|
||||||
{ .key = "stepping",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, stepping) },
|
|
||||||
{ .key = "flags",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, flags) },
|
|
||||||
{ .key = "features",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, features) },
|
|
||||||
{ .key = "utilisation",
|
|
||||||
.type = &abstract_type_float,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, utilisation) },
|
|
||||||
{ .key = "cpu_pool",
|
|
||||||
.type = &abstract_type_ref_set,
|
|
||||||
.offset = offsetof(xen_host_cpu_record, cpu_pools) },
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_host_cpu_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_host_cpu_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_host_cpu_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_host_cpu_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_host_cpu_record_free(xen_host_cpu_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
xen_host_record_opt_free(record->host);
|
|
||||||
free(record->vendor);
|
|
||||||
free(record->modelname);
|
|
||||||
free(record->stepping);
|
|
||||||
free(record->flags);
|
|
||||||
free(record->features);
|
|
||||||
xen_cpu_pool_record_opt_set_free(record->cpu_pools);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_host_cpu_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *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_cpu.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_host");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("host_cpu.get_number");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_vendor");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("host_cpu.get_speed");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_modelname");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_stepping");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_flags");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*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[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_float;
|
|
||||||
|
|
||||||
XEN_CALL_("host_cpu.get_utilisation");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "host_cpu.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host_cpu }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("host_cpu.get_cpu_pool");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result)
|
|
||||||
{
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "host_cpu.get_unassigned_cpus", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host_metrics.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 = "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) },
|
|
||||||
{ .key = "last_updated",
|
|
||||||
.type = &abstract_type_datetime,
|
|
||||||
.offset = offsetof(xen_host_metrics_record, last_updated) }
|
|
||||||
};
|
|
||||||
|
|
||||||
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);
|
|
||||||
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_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_last_updated(xen_session *session, time_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_datetime;
|
|
||||||
|
|
||||||
XEN_CALL_("host_metrics.get_last_updated");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "host_metrics.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_host_metrics_get_uuid(xen_session *session, char **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_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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 "xen_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_int_float_map.h>
|
|
||||||
|
|
||||||
|
|
||||||
xen_int_float_map *
|
|
||||||
xen_int_float_map_alloc(size_t size)
|
|
||||||
{
|
|
||||||
xen_int_float_map *result = calloc(1, sizeof(xen_int_float_map) +
|
|
||||||
size * sizeof(struct xen_int_float_map_contents));
|
|
||||||
result->size = size;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_int_float_map_free(xen_int_float_map *map)
|
|
||||||
{
|
|
||||||
free(map);
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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 "xen_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_int_int_map.h>
|
|
||||||
|
|
||||||
|
|
||||||
xen_int_int_map *
|
|
||||||
xen_int_int_map_alloc(size_t size)
|
|
||||||
{
|
|
||||||
xen_int_int_map *result = calloc(1, sizeof(xen_int_int_map) +
|
|
||||||
size * sizeof(struct xen_int_int_map_contents));
|
|
||||||
result->size = size;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_int_int_map_free(xen_int_int_map *map)
|
|
||||||
{
|
|
||||||
free(map);
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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 "xen_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_int_string_set_map.h>
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
|
|
||||||
|
|
||||||
xen_int_string_set_map *
|
|
||||||
xen_int_string_set_map_alloc(size_t size)
|
|
||||||
{
|
|
||||||
xen_int_string_set_map *result = calloc(1, sizeof(xen_int_string_set_map) +
|
|
||||||
size * sizeof(struct xen_int_string_set_map_contents));
|
|
||||||
result->size = size;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_int_string_set_map_free(xen_int_string_set_map *map)
|
|
||||||
{
|
|
||||||
size_t n;
|
|
||||||
|
|
||||||
if (map == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
n = map->size;
|
|
||||||
for (size_t i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
xen_string_set_free(map->contents[i].val);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(map);
|
|
||||||
}
|
|
||||||
@@ -1,371 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_network.h>
|
|
||||||
#include <xen/api/xen_pif.h>
|
|
||||||
#include <xen/api/xen_string_string_map.h>
|
|
||||||
#include <xen/api/xen_vif.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_FREE(xen_network)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_network)
|
|
||||||
XEN_ALLOC(xen_network_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_network_record)
|
|
||||||
XEN_ALLOC(xen_network_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_network)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_network_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_network_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_network_record, uuid) },
|
|
||||||
{ .key = "name_label",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_network_record, name_label) },
|
|
||||||
{ .key = "name_description",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_network_record, name_description) },
|
|
||||||
{ .key = "VIFs",
|
|
||||||
.type = &abstract_type_ref_set,
|
|
||||||
.offset = offsetof(xen_network_record, vifs) },
|
|
||||||
{ .key = "PIFs",
|
|
||||||
.type = &abstract_type_ref_set,
|
|
||||||
.offset = offsetof(xen_network_record, pifs) },
|
|
||||||
{ .key = "other_config",
|
|
||||||
.type = &abstract_type_string_string_map,
|
|
||||||
.offset = offsetof(xen_network_record, other_config) }
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_network_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_network_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_network_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_network_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_network_record_free(xen_network_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
free(record->name_label);
|
|
||||||
free(record->name_description);
|
|
||||||
xen_vif_record_opt_set_free(record->vifs);
|
|
||||||
xen_pif_record_opt_set_free(record->pifs);
|
|
||||||
xen_string_string_map_free(record->other_config);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_record(xen_session *session, xen_network_record **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_network_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_by_uuid(xen_session *session, xen_network *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_("network.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_create(xen_session *session, xen_network *result, xen_network_record *record)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &xen_network_record_abstract_type_,
|
|
||||||
.u.struct_val = record }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.create");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_destroy(xen_session *session, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "network.destroy", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_by_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_name_label(xen_session *session, char **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_name_description(xen_session *session, char **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_name_description");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_VIFs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_PIFs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_other_config(xen_session *session, xen_string_string_map **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_string_map;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_other_config");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_set_name_label(xen_session *session, xen_network network, char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "network.set_name_label", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_set_name_description(xen_session *session, xen_network network, char *description)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = description }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "network.set_name_description", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_set_other_config(xen_session *session, xen_network network, xen_string_string_map *other_config)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network },
|
|
||||||
{ .type = &abstract_type_string_string_map,
|
|
||||||
.u.set_val = (arbitrary_set *)other_config }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "network.set_other_config", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_add_to_other_config(xen_session *session, xen_network network, char *key, char *value)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = key },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = value }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "network.add_to_other_config", param_values, 3, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_remove_from_other_config(xen_session *session, xen_network network, char *key)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = key }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "network.remove_from_other_config", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_all(xen_session *session, struct xen_network_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "network.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_network_get_uuid(xen_session *session, char **result, xen_network network)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("network.get_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_on_crash_behaviour.h>
|
|
||||||
#include "xen_on_crash_behaviour_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maintain this in the same order as the enum declaration!
|
|
||||||
*/
|
|
||||||
static const char *lookup_table[] =
|
|
||||||
{
|
|
||||||
"destroy",
|
|
||||||
"coredump_and_destroy",
|
|
||||||
"restart",
|
|
||||||
"coredump_and_restart",
|
|
||||||
"preserve",
|
|
||||||
"rename_restart"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern xen_on_crash_behaviour_set *
|
|
||||||
xen_on_crash_behaviour_set_alloc(size_t size)
|
|
||||||
{
|
|
||||||
return calloc(1, sizeof(xen_on_crash_behaviour_set) +
|
|
||||||
size * sizeof(enum xen_on_crash_behaviour));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set)
|
|
||||||
{
|
|
||||||
free(set);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour val)
|
|
||||||
{
|
|
||||||
return lookup_table[val];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern enum xen_on_crash_behaviour
|
|
||||||
xen_on_crash_behaviour_from_string(xen_session *session, const char *str)
|
|
||||||
{
|
|
||||||
return ENUM_LOOKUP(session, str, lookup_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_on_crash_behaviour_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = ENUM,
|
|
||||||
.enum_marshaller =
|
|
||||||
(const char *(*)(int))&xen_on_crash_behaviour_to_string,
|
|
||||||
.enum_demarshaller =
|
|
||||||
(int (*)(xen_session *, const char *))&xen_on_crash_behaviour_from_string
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_on_crash_behaviour_set_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = SET,
|
|
||||||
.child = &xen_on_crash_behaviour_abstract_type_
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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/api/xen_on_normal_exit.h>
|
|
||||||
#include "xen_on_normal_exit_internal.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maintain this in the same order as the enum declaration!
|
|
||||||
*/
|
|
||||||
static const char *lookup_table[] =
|
|
||||||
{
|
|
||||||
"destroy",
|
|
||||||
"restart"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern xen_on_normal_exit_set *
|
|
||||||
xen_on_normal_exit_set_alloc(size_t size)
|
|
||||||
{
|
|
||||||
return calloc(1, sizeof(xen_on_normal_exit_set) +
|
|
||||||
size * sizeof(enum xen_on_normal_exit));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
xen_on_normal_exit_set_free(xen_on_normal_exit_set *set)
|
|
||||||
{
|
|
||||||
free(set);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
xen_on_normal_exit_to_string(enum xen_on_normal_exit val)
|
|
||||||
{
|
|
||||||
return lookup_table[val];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern enum xen_on_normal_exit
|
|
||||||
xen_on_normal_exit_from_string(xen_session *session, const char *str)
|
|
||||||
{
|
|
||||||
return ENUM_LOOKUP(session, str, lookup_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_on_normal_exit_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = ENUM,
|
|
||||||
.enum_marshaller =
|
|
||||||
(const char *(*)(int))&xen_on_normal_exit_to_string,
|
|
||||||
.enum_demarshaller =
|
|
||||||
(int (*)(xen_session *, const char *))&xen_on_normal_exit_from_string
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const abstract_type xen_on_normal_exit_set_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = SET,
|
|
||||||
.child = &xen_on_normal_exit_abstract_type_
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,249 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host.h>
|
|
||||||
#include <xen/api/xen_pbd.h>
|
|
||||||
#include <xen/api/xen_sr.h>
|
|
||||||
#include <xen/api/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_all(xen_session *session, struct xen_pbd_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "PBD.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pbd_get_uuid(xen_session *session, char **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_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,380 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_host.h>
|
|
||||||
#include <xen/api/xen_network.h>
|
|
||||||
#include <xen/api/xen_pif.h>
|
|
||||||
#include <xen/api/xen_pif_metrics.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_FREE(xen_pif)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_pif)
|
|
||||||
XEN_ALLOC(xen_pif_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_pif_record)
|
|
||||||
XEN_ALLOC(xen_pif_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_pif)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_pif_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_pif_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_pif_record, uuid) },
|
|
||||||
{ .key = "device",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_pif_record, device) },
|
|
||||||
{ .key = "network",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_pif_record, network) },
|
|
||||||
{ .key = "host",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_pif_record, host) },
|
|
||||||
{ .key = "MAC",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_pif_record, mac) },
|
|
||||||
{ .key = "MTU",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_pif_record, mtu) },
|
|
||||||
{ .key = "VLAN",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_pif_record, vlan) },
|
|
||||||
{ .key = "metrics",
|
|
||||||
.type = &abstract_type_ref,
|
|
||||||
.offset = offsetof(xen_pif_record, metrics) }
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_pif_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_pif_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_pif_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_pif_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_pif_record_free(xen_pif_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
free(record->device);
|
|
||||||
xen_network_record_opt_free(record->network);
|
|
||||||
xen_host_record_opt_free(record->host);
|
|
||||||
free(record->mac);
|
|
||||||
xen_pif_metrics_record_opt_free(record->metrics);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_pif_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_by_uuid(xen_session *session, xen_pif *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.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_device(xen_session *session, char **result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_device");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_network");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_host");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_mac(xen_session *session, char **result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_MAC");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("PIF.get_MTU");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("PIF.get_VLAN");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_metrics");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
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 = device }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "PIF.set_device", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
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 = mac }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "PIF.set_MAC", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
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_int,
|
|
||||||
.u.int_val = mtu }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "PIF.set_MTU", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
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_int,
|
|
||||||
.u.int_val = vlan }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "PIF.set_VLAN", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
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 = device },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = network },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = host },
|
|
||||||
{ .type = &abstract_type_int,
|
|
||||||
.u.int_val = vlan }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.create_VLAN");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_destroy(xen_session *session, xen_pif self)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = self }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "PIF.destroy", param_values, 1, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_all(xen_session *session, struct xen_pif_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "PIF.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = pif }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("PIF.get_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/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 = "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) },
|
|
||||||
{ .key = "last_updated",
|
|
||||||
.type = &abstract_type_datetime,
|
|
||||||
.offset = offsetof(xen_pif_metrics_record, last_updated) }
|
|
||||||
};
|
|
||||||
|
|
||||||
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);
|
|
||||||
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_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_last_updated(xen_session *session, time_t *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_datetime;
|
|
||||||
|
|
||||||
XEN_CALL_("PIF_metrics.get_last_updated");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "PIF_metrics.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_pif_metrics_get_uuid(xen_session *session, char **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_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,379 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_internal.h"
|
|
||||||
#include <xen/api/xen_common.h>
|
|
||||||
#include <xen/api/xen_pbd.h>
|
|
||||||
#include <xen/api/xen_sr.h>
|
|
||||||
#include <xen/api/xen_vdi.h>
|
|
||||||
|
|
||||||
|
|
||||||
XEN_FREE(xen_sr)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_sr)
|
|
||||||
XEN_ALLOC(xen_sr_record)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_sr_record)
|
|
||||||
XEN_ALLOC(xen_sr_record_opt)
|
|
||||||
XEN_RECORD_OPT_FREE(xen_sr)
|
|
||||||
XEN_SET_ALLOC_FREE(xen_sr_record_opt)
|
|
||||||
|
|
||||||
|
|
||||||
static const struct_member xen_sr_record_struct_members[] =
|
|
||||||
{
|
|
||||||
{ .key = "uuid",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_sr_record, uuid) },
|
|
||||||
{ .key = "name_label",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_sr_record, name_label) },
|
|
||||||
{ .key = "name_description",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_sr_record, name_description) },
|
|
||||||
{ .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) },
|
|
||||||
{ .key = "physical_utilisation",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_sr_record, physical_utilisation) },
|
|
||||||
{ .key = "physical_size",
|
|
||||||
.type = &abstract_type_int,
|
|
||||||
.offset = offsetof(xen_sr_record, physical_size) },
|
|
||||||
{ .key = "type",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_sr_record, type) },
|
|
||||||
{ .key = "content_type",
|
|
||||||
.type = &abstract_type_string,
|
|
||||||
.offset = offsetof(xen_sr_record, content_type) }
|
|
||||||
};
|
|
||||||
|
|
||||||
const abstract_type xen_sr_record_abstract_type_ =
|
|
||||||
{
|
|
||||||
.typename = STRUCT,
|
|
||||||
.struct_size = sizeof(xen_sr_record),
|
|
||||||
.member_count =
|
|
||||||
sizeof(xen_sr_record_struct_members) / sizeof(struct_member),
|
|
||||||
.members = xen_sr_record_struct_members
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_sr_record_free(xen_sr_record *record)
|
|
||||||
{
|
|
||||||
if (record == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
free(record->handle);
|
|
||||||
free(record->uuid);
|
|
||||||
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->content_type);
|
|
||||||
free(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = xen_sr_record_abstract_type_;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_record");
|
|
||||||
|
|
||||||
if (session->ok)
|
|
||||||
{
|
|
||||||
(*result)->handle = xen_strdup_((*result)->uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_by_uuid(xen_session *session, xen_sr *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_("SR.get_by_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_by_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_name_label");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_name_description");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_VDIs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_PBDs");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("SR.get_virtual_allocation");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("SR.get_physical_utilisation");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_int;
|
|
||||||
|
|
||||||
XEN_CALL_("SR.get_physical_size");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_type(xen_session *session, char **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_type");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_content_type(xen_session *session, char **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_content_type");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = label }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "SR.set_name_label", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_set_name_description(xen_session *session, xen_sr sr, char *description)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr },
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = description }
|
|
||||||
};
|
|
||||||
|
|
||||||
xen_call_(session, "SR.set_name_description", param_values, 2, NULL, NULL);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_supported_types(xen_session *session, struct xen_string_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "SR.get_supported_types", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_all(xen_session *session, struct xen_sr_set **result)
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string_set;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
xen_call_(session, "SR.get_all", NULL, 0, &result_type, result);
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr)
|
|
||||||
{
|
|
||||||
abstract_value param_values[] =
|
|
||||||
{
|
|
||||||
{ .type = &abstract_type_string,
|
|
||||||
.u.string_val = sr }
|
|
||||||
};
|
|
||||||
|
|
||||||
abstract_type result_type = abstract_type_string;
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
XEN_CALL_("SR.get_uuid");
|
|
||||||
return session->ok;
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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 "xen_internal.h"
|
|
||||||
#include <xen/api/xen_string_set.h>
|
|
||||||
|
|
||||||
|
|
||||||
xen_string_set *
|
|
||||||
xen_string_set_alloc(size_t size)
|
|
||||||
{
|
|
||||||
xen_string_set *result = calloc(1, sizeof(xen_string_set) +
|
|
||||||
size * sizeof(char *));
|
|
||||||
result->size = size;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xen_string_set_free(xen_string_set *set)
|
|
||||||
{
|
|
||||||
size_t n;
|
|
||||||
if (set == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
n = set->size;
|
|
||||||
for (size_t i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
free(set->contents[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(set);
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2006-2007, 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_STRING_SET_H
|
|
||||||
#define XEN_STRING_SET_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "xen_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct xen_string_set
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
char *contents[];
|
|
||||||
} xen_string_set;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a xen_string_set of the given size.
|
|
||||||
*/
|
|
||||||
extern xen_string_set *
|
|
||||||
xen_string_set_alloc(size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free the given xen_string_set. The given set must have been allocated
|
|
||||||
* by this library.
|
|
||||||
*/
|
|
||||||
extern void
|
|
||||||
xen_string_set_free(xen_string_set *set);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff.
Show more