[libvirt] [PATCHv2 0/4] API for modification of domain metadata
by Peter Krempa
This is a corrected version of the domain metadata modification API.
I dropped the limit on length of the domain title and added skipping
of newlines added at the end of file by some editors, which made
--edit unusable with --title for the new desc command.
Peter Krempa (4):
xml: Add element <title> to allow short description of domains
API: Add api to set and get domain metadata
virsh: Add support for modifying domain description and titles
qemu: Add support for virDomainGetMetadata and virDomainSetMetadata
docs/formatdomain.html.in | 6 +
docs/schemas/domaincommon.rng | 13 +-
include/libvirt/libvirt.h.in | 24 ++
include/libvirt/virterror.h | 1 +
src/conf/domain_conf.c | 11 +
src/conf/domain_conf.h | 1 +
src/driver.h | 16 ++
src/libvirt.c | 181 +++++++++++++
src/libvirt_public.syms | 2 +
src/qemu/qemu_driver.c | 174 ++++++++++++
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 24 ++-
src/util/virterror.c | 6 +
.../qemu-simple-description-title.xml | 27 ++
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 5 +
tools/virsh.c | 283 ++++++++++++++++++--
tools/virsh.pod | 34 +++-
17 files changed, 787 insertions(+), 23 deletions(-)
create mode 100644 tests/domainschemadata/qemu-simple-description-title.xml
--
1.7.3.4
13 years, 2 months
[libvirt] [PATCH] XenXs: Update documentation
by Philipp Hahn
Fix several references to now renamed functions and parameters when the
functions were moved from src/xen/ to src/xenxs/.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
src/xenxs/xen_sxpr.c | 222 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 185 insertions(+), 37 deletions(-)
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 09e7730..03a0eb1 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -37,7 +37,7 @@
#include "xenxs_private.h"
#include "xen_sxpr.h"
-/* Get a domain id from a sexpr string */
+/* Get a domain id from a S-expression string */
int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion)
{
struct sexpr *root = string2sexpr(sexpr);
@@ -50,7 +50,7 @@ int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion)
return id;
}
-/* Get a domain id from a sexpr */
+/* Get a domain id from a S-expression */
int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion)
{
int id = -1;
@@ -66,16 +66,15 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion)
/*****************************************************************
******
- ****** Parsing of SEXPR into virDomainDef objects
+ ****** Parsing of S-Expression into virDomainDef objects
******
*****************************************************************/
/**
- * xenParseSxprOS
+ * xenParseSxprOS:
* @node: the root of the parsed S-Expression
* @def: the domain config
- * @hvm: true or 1 if no contains HVM S-Expression
- * @bootloader: true or 1 if a bootloader is defined
+ * @hvm: true or 1 if node contains HVM S-Expression
*
* Parse the xend sexp for description of os and append it to buf.
*
@@ -166,6 +165,16 @@ no_memory:
return -1;
}
+
+/**
+ * xenParseSxprChar:
+ * @value: A string describing a character device.
+ * @tty: the console pty path
+ *
+ * Parse the xend S-expression for description of a character device.
+ *
+ * Returns a character device object or NULL in case of failure.
+ */
virDomainChrDefPtr
xenParseSxprChar(const char *value,
const char *tty)
@@ -316,13 +325,15 @@ error:
return NULL;
}
+
/**
- * xend_parse_sexp_desc_disks
- * @conn: connection
- * @root: root sexpr
+ * xenParseSxprDisks:
+ * @def: the domain config
+ * @root: root S-expression
+ * @hvm: true or 1 if node contains HVM S-Expression
* @xendConfigVersion: version of xend
*
- * This parses out block devices from the domain sexpr
+ * This parses out block devices from the domain S-expression
*
* Returns 0 if successful or -1 if failed.
*/
@@ -518,6 +529,15 @@ error:
}
+/**
+ * xenParseSxprNets:
+ * @def: the domain config
+ * @root: root S-expression
+ *
+ * This parses out network devices from the domain S-expression
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
static int
xenParseSxprNets(virDomainDefPtr def,
const struct sexpr *root)
@@ -614,6 +634,15 @@ cleanup:
}
+/**
+ * xenParseSxprSound:
+ * @def: the domain config
+ * @str: comma separated list of sound models
+ *
+ * This parses out sound devices from the domain S-expression
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
int
xenParseSxprSound(virDomainDefPtr def,
const char *str)
@@ -692,6 +721,15 @@ error:
}
+/**
+ * xenParseSxprUSB:
+ * @def: the domain config
+ * @root: root S-expression
+ *
+ * This parses out USB devices from the domain S-expression
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
static int
xenParseSxprUSB(virDomainDefPtr def,
const struct sexpr *root)
@@ -733,6 +771,19 @@ no_memory:
return -1;
}
+
+/*
+ * xenParseSxprGraphicsOld:
+ * @def: the domain config
+ * @root: root S-expression
+ * @hvm: true or 1 if root contains HVM S-Expression
+ * @xendConfigVersion: version of xend
+ * @vncport: VNC port number
+ *
+ * This parses out VNC devices from the domain S-expression
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
static int
xenParseSxprGraphicsOld(virDomainDefPtr def,
const struct sexpr *root,
@@ -821,6 +872,16 @@ error:
}
+/*
+ * xenParseSxprGraphicsNew:
+ * @def: the domain config
+ * @root: root S-expression
+ * @vncport: VNC port number
+ *
+ * This parses out VNC devices from the domain S-expression
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
static int
xenParseSxprGraphicsNew(virDomainDefPtr def,
const struct sexpr *root, int vncport)
@@ -918,11 +979,13 @@ error:
return -1;
}
+
/**
- * xenParseSxprPCI
+ * xenParseSxprPCI:
+ * @def: the domain config
* @root: root sexpr
*
- * This parses out block devices from the domain sexpr
+ * This parses out PCI devices from the domain sexpr
*
* Returns 0 if successful or -1 if failed.
*/
@@ -1044,16 +1107,17 @@ error:
/**
* xenParseSxpr:
- * @conn: the connection associated with the XML
* @root: the root of the parsed S-Expression
* @xendConfigVersion: version of xend
* @cpus: set of cpus the domain may be pinned to
+ * @tty: the console pty path
+ * @vncport: VNC port number
*
- * Parse the xend sexp description and turn it into the XML format similar
- * to the one unsed for creation.
+ * Parse the xend S-expression description and turn it into a virDomainDefPtr
+ * representing these settings as closeley as is practical.
*
- * Returns the 0 terminated XML string or NULL in case of error.
- * the caller must free() the returned value.
+ * Returns the domain config or NULL in case of error.
+ * The caller must free() the returned value.
*/
virDomainDefPtr
xenParseSxpr(const struct sexpr *root,
@@ -1424,6 +1488,20 @@ error:
return NULL;
}
+
+/**
+ * xenParseSxprString:
+ * @sexpr: the root of the parsed S-Expression
+ * @xendConfigVersion: version of xend
+ * @tty: the console pty path
+ * @vncport: VNC port number
+ *
+ * Parse the xend S-expression description and turn it into a virDomainDefPtr
+ * representing these settings as closeley as is practical.
+ *
+ * Returns the domain config or NULL in case of error.
+ * The caller must free() the returned value.
+ */
virDomainDefPtr
xenParseSxprString(const char *sexpr,
int xendConfigVersion, char *tty, int vncport)
@@ -1449,15 +1527,12 @@ xenParseSxprString(const char *sexpr,
/**
- * virtDomainParseXMLGraphicsDescVFB:
- * @conn: pointer to the hypervisor connection
- * @node: node containing graphics description
- * @buf: a buffer for the result S-Expr
+ * xenFormatSxprGraphicsNew:
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
*
- * Parse the graphics part of the XML description and add it to the S-Expr
- * in buf. This is a temporary interface as the S-Expr interface will be
- * replaced by XML-RPC in the future. However the XML format should stay
- * valid over time.
+ * Convert the graphics part of the domain description into a S-expression
+ * in buf. (HVM > 3.0.4 or PV > 3.0.3)
*
* Returns 0 in case of success, -1 in case of error
*/
@@ -1508,6 +1583,17 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
}
+/**
+ * xenFormatSxprGraphicsOld:
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
+ * @xendConfigVersion: version of xend
+ *
+ * Convert the graphics part of the domain description into a S-expression
+ * in buf. (HVM <= 3.0.4 or PV <= 3.0.3)
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
static int
xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
virBufferPtr buf,
@@ -1553,6 +1639,17 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
return 0;
}
+
+/**
+ * xenFormatSxprChr:
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
+ *
+ * Convert the character deivce part of the domain config into a S-expression
+ * in buf.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
int
xenFormatSxprChr(virDomainChrDefPtr def,
virBufferPtr buf)
@@ -1631,15 +1728,14 @@ xenFormatSxprChr(virDomainChrDefPtr def,
/**
- * virDomainParseXMLDiskDesc:
- * @node: node containing disk description
- * @buf: a buffer for the result S-Expr
+ * xenFormatSxprDisk:
+ * @node: node containing the disk description
+ * @buf: a buffer for the result S-expression
+ * @hvm: true or 1 if domain is HVM
* @xendConfigVersion: xend configuration file format
+ * @isAttach: create expression for device attach (1).
*
- * Parse the one disk in the XML description and add it to the S-Expr in buf
- * This is a temporary interface as the S-Expr interface
- * will be replaced by XML-RPC in the future. However the XML format should
- * stay valid over time.
+ * Convert the disk device part of the domain config into a S-expresssion in buf.
*
* Returns 0 in case of success, -1 in case of error.
*/
@@ -1757,12 +1853,15 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
}
/**
- * xenFormatSxprNet
- * @node: node containing the interface description
- * @buf: a buffer for the result S-Expr
+ * xenFormatSxprNet:
+ * @conn: connection
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
+ * @hvm: true or 1 if domain is HVM
* @xendConfigVersion: xend configuration file format
+ * @isAttach: create expression for device attach (1).
*
- * Parse the one interface the XML description and add it to the S-Expr in buf
+ * Convert the interface description of the domain config into a S-expression in buf.
* This is a temporary interface as the S-Expr interface
* will be replaced by XML-RPC in the future. However the XML format should
* stay valid over time.
@@ -1893,6 +1992,15 @@ xenFormatSxprNet(virConnectPtr conn,
}
+/**
+ * xenFormatSxprPCI:
+ * @def: the device config
+ * @buf: a buffer for the result S-expression
+ *
+ * Convert a single PCI device part of the domain config into a S-expresssion in buf.
+ *
+ * Returns 0 in case of success, -1 in case of error.
+ */
static void
xenFormatSxprPCI(virDomainHostdevDefPtr def,
virBufferPtr buf)
@@ -1904,6 +2012,17 @@ xenFormatSxprPCI(virDomainHostdevDefPtr def,
def->source.subsys.u.pci.function);
}
+
+/**
+ * xenFormatSxprOnePCI:
+ * @def: the device config
+ * @buf: a buffer for the result S-expression
+ * @detach: create expression for device detach (1).
+ *
+ * Convert a single PCI device part of the domain config into a S-expresssion in buf.
+ *
+ * Returns 0 in case of success, -1 in case of error.
+ */
int
xenFormatSxprOnePCI(virDomainHostdevDefPtr def,
virBufferPtr buf,
@@ -1926,6 +2045,16 @@ xenFormatSxprOnePCI(virDomainHostdevDefPtr def,
return 0;
}
+
+/**
+ * xenFormatSxprAllPCI:
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
+ *
+ * Convert all PCI device parts of the domain config into a S-expresssion in buf.
+ *
+ * Returns 0 in case of success, -1 in case of error.
+ */
static int
xenFormatSxprAllPCI(virDomainDefPtr def,
virBufferPtr buf)
@@ -1973,6 +2102,16 @@ xenFormatSxprAllPCI(virDomainDefPtr def,
return 0;
}
+
+/**
+ * xenFormatSxprSound:
+ * @def: the domain config
+ * @buf: a buffer for the result S-expression
+ *
+ * Convert all sound device parts of the domain config into S-expression in buf.
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
int
xenFormatSxprSound(virDomainDefPtr def,
virBufferPtr buf)
@@ -2001,6 +2140,15 @@ xenFormatSxprSound(virDomainDefPtr def,
}
+/**
+ * xenFormatSxprInput:
+ * @input: the input config
+ * @buf: a buffer for the result S-expression
+ *
+ * Convert all input device parts of the domain config into S-expression in buf.
+ *
+ * Returns 0 if successful or -1 if failed.
+ */
static int
xenFormatSxprInput(virDomainInputDefPtr input,
virBufferPtr buf)
@@ -2033,7 +2181,7 @@ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
* @def: domain config definition
* @xendConfigVersion: xend configuration file format
*
- * Generate an SEXPR representing the domain configuration.
+ * Generate an S-expression representing the domain configuration.
*
* Returns the 0 terminated S-Expr string or NULL in case of error.
* the caller must free() the returned value.
--
1.7.1
13 years, 2 months
[libvirt] [PATCH RFC 0/4] Allow hibernation on guests
by Michal Privoznik
As we've added guest agent recently, the whole world
of new functionality has opened. As this patch set,
which allows domains to enter S4 state.
What is needed for this?
Patched qemu. As this is not in qemu git, but patches
are await to be pushed in very short future. They can
be found here:
http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg03261.html
Despite that, if anybody is willing to give me review
if I am going the right way, I'd appreciate it.
One thing, that you'll probably notice is this
'set-support-level' command. Basically, it tells GA what qemu version
is it running on. Ideally, this should be done as soon as
GA starts up. However, that cannot be determined from outside
world as GA doesn't emit any events yet.
Ideally^2 this command should be left out as it should be qemu
who tells its own agent this kind of information.
Anyway, I was going to call this command in qemuProcess{Startup,
Reconnect,Attach}, but it won't work. We need to un-pause guest CPUs
so guest can boot and start GA, but that implies returning from qemuProcess*.
So I am setting this just before 'guest-suspend' command, as
there is one more thing about GA. It is unable to remember anything
upon its restart (GA process). Which has BTW show flaw
in our current code with FS freeze & thaw. If we freeze guest
FS, and somebody restart GA, the simple FS Thaw will not succeed as
GA thinks FS are not frozen. But that's a different cup of tea.
Because of what written above, we need to call set-level
on every suspend.
Michal Privoznik (4):
qemu-agent: Allow setting supported level
qemu-agent: Create suspend function
Create new virDrvDomainSuspendFlags API
Wire up qemu agent for suspend
include/libvirt/libvirt.h.in | 8 +++
src/driver.h | 4 ++
src/libvirt.c | 55 ++++++++++++++++++++++
src/libvirt_public.syms | 1 +
src/qemu/qemu_agent.c | 105 ++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 13 +++++
src/qemu/qemu_driver.c | 57 +++++++++++++++++++---
src/qemu/qemu_process.c | 45 +++++++++++++++++-
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 9 +++-
src/remote_protocol-structs | 5 ++
tools/virsh.c | 30 ++++++++++--
12 files changed, 317 insertions(+), 16 deletions(-)
--
1.7.3.4
13 years, 2 months
[libvirt] [PATCHv2] simplify block of codes
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
Using new function 'virTypedParameterArrayClear' to simplify block of codes.
* daemon/remote.c, src/remote/remote_driver.c: simplify codes.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
daemon/remote.c | 6 +-----
src/remote/remote_driver.c | 16 ++++------------
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index cb8423a..e7d9b2f 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -848,11 +848,7 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val,
cleanup:
if (rv < 0) {
- int j;
- for (j = 0; j < i; ++j) {
- if (params[j].type == VIR_TYPED_PARAM_STRING)
- VIR_FREE(params[j].value.s);
- }
+ virTypedParameterArrayClear(params, i);
VIR_FREE(params);
}
return params;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 61b96e9..15a20ff 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -46,6 +46,7 @@
#include "virfile.h"
#include "command.h"
#include "intprops.h"
+#include "virtypedparam.h"
#define VIR_FROM_THIS VIR_FROM_REMOTE
@@ -1417,12 +1418,8 @@ remoteDeserializeTypedParameters(remote_typed_param *ret_params_val,
rv = 0;
cleanup:
- if (rv < 0) {
- int j;
- for (j = 0; j < i; j++)
- if (params[j].type == VIR_TYPED_PARAM_STRING)
- VIR_FREE(params[j].value.s);
- }
+ if (rv < 0)
+ virTypedParameterArrayClear(params, *nparams);
return rv;
}
@@ -2386,12 +2383,7 @@ static int remoteDomainGetCPUStats(virDomainPtr domain,
cleanup:
if (rv < 0) {
int max = nparams * ncpus;
- int i;
-
- for (i = 0; i < max; i++) {
- if (params[i].type == VIR_TYPED_PARAM_STRING)
- VIR_FREE(params[i].value.s);
- }
+ virTypedParameterArrayClear(params, max);
}
xdr_free ((xdrproc_t) xdr_remote_domain_get_cpu_stats_ret,
(char *) &ret);
--
1.7.1
13 years, 2 months
[libvirt] [PATCH 0/6] qemu: add suport for "romfile", and associated cleanups
by Laine Stump
This patchset started out as cleanup to make it easier to add in
support for doing PCI passthrough via the <interface> element (to be
used to attach a host network device to a guest after performing some
network-device-specific setup), but turned out to also make it much
easier to add support for QEMU's "romfile" option, as requested in
https://bugzilla.redhat.com/show_bug.cgi?id=781562
Patch 1 is trivial, and probably qualifies for pushing under the
trivial rule, but it's just as easy to leave it in with the
rest. Patches 2-4 reorganize some data definitions, and the code
associated with them, with no functional change. Patch 5 expands
support for "rombar" to network devices (as long as they attach to the
guest PCI bus), and Patch 6 adds support for "romfile" to both generic
PCI devices and network devices.
13 years, 2 months
[libvirt] Segfault fixed
by Hendrik Schwartke
Hi,
there is a segfault in qemu_monitor_text.c. If some error accurs in
qemuMonitorTextGetBlockInfo then the cleanup code calls VIR_FREE(info)
without ensuring that info is initialized.
Patch based on c6ec021b3c19c3ecc97d60d35b12eaa0b94da701:
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index a33d192..fb3309b 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -774,7 +774,7 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
int qemuMonitorTextGetBlockInfo(qemuMonitorPtr mon,
virHashTablePtr table)
{
- struct qemuDomainDiskInfo *info;
+ struct qemuDomainDiskInfo *info=NULL;
char *reply = NULL;
int ret = -1;
char *dummy;
13 years, 2 months
[libvirt] [PATCH] xen: Don't add <console> to xml for dom0
by Cole Robinson
It just doesn't really make sense and confuses virt-manager
---
src/xenxs/xen_sxpr.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 7a53f94..09e7730 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -1392,7 +1392,7 @@ xenParseSxpr(const struct sexpr *root,
chr->target.port = 0;
def->parallels[def->nparallels++] = chr;
}
- } else {
+ } else if (def->id != 0) {
def->nconsoles = 1;
if (VIR_ALLOC_N(def->consoles, 1) < 0)
goto no_memory;
--
1.7.7.5
13 years, 2 months
[libvirt] [PATCH] Add virt-host-validate.1 to Mingw32 RPM spec file list
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Pushed under trivial rule
---
mingw32-libvirt.spec.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/mingw32-libvirt.spec.in b/mingw32-libvirt.spec.in
index 961c3ba..7937e22 100644
--- a/mingw32-libvirt.spec.in
+++ b/mingw32-libvirt.spec.in
@@ -185,6 +185,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mingw32_mandir}/man1/virsh.1*
%{_mingw32_mandir}/man1/virt-xml-validate.1*
%{_mingw32_mandir}/man1/virt-pki-validate.1*
+%{_mingw32_mandir}/man1/virt-host-validate.1*
%changelog
--
1.7.7.6
13 years, 2 months