2008-01-29 18:15:54 +00:00
|
|
|
#include <config.h>
|
2007-11-26 12:03:34 +00:00
|
|
|
|
2007-07-18 21:34:22 +00:00
|
|
|
#include <stdio.h>
|
2007-11-26 12:03:34 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2007-07-18 21:34:22 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
2013-04-16 13:41:44 +00:00
|
|
|
#include "testutils.h"
|
|
|
|
|
2007-11-26 12:03:34 +00:00
|
|
|
#ifdef WITH_QEMU
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
|
|
|
# include "qemu/qemu_conf.h"
|
2011-07-11 17:29:09 +00:00
|
|
|
# include "qemu/qemu_domain.h"
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "testutilsqemu.h"
|
2013-04-03 10:36:23 +00:00
|
|
|
# include "virstring.h"
|
2007-07-18 21:34:22 +00:00
|
|
|
|
2013-06-07 15:10:28 +00:00
|
|
|
# define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
static virQEMUDriver driver;
|
2007-07-18 21:34:22 +00:00
|
|
|
|
2011-04-24 22:25:10 +00:00
|
|
|
static int
|
2012-02-04 14:01:56 +00:00
|
|
|
testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
|
2011-04-24 22:25:10 +00:00
|
|
|
{
|
|
|
|
char *inXmlData = NULL;
|
|
|
|
char *outXmlData = NULL;
|
2007-07-18 21:34:22 +00:00
|
|
|
char *actual = NULL;
|
|
|
|
int ret = -1;
|
2010-07-24 22:18:18 +00:00
|
|
|
virDomainDefPtr def = NULL;
|
selinux: distinguish failure to label from request to avoid label
https://bugzilla.redhat.com/show_bug.cgi?id=924153
Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
an attribute relabel='no' in order to try and minimize the
impact of shutdown delays when an NFS server disappears. The idea
was that if a disk is on NFS and can't be labeled in the first
place, there is no need to attempt the (no-op) relabel on domain
shutdown. Unfortunately, the way this was implemented was by
modifying the domain XML so that the optimization would survive
libvirtd restart, but in a way that is indistinguishable from an
explicit user setting. Furthermore, once the setting is turned
on, libvirt avoids attempts at labeling, even for operations like
snapshot or blockcopy where the chain is being extended or pivoted
onto non-NFS, where SELinux labeling is once again possible. As
a result, it was impossible to do a blockcopy to pivot from an
NFS image file onto a local file.
The solution is to separate the semantics of a chain that must
not be labeled (which the user can set even on persistent domains)
vs. the optimization of not attempting a relabel on cleanup (a
live-only annotation), and using only the user's explicit notation
rather than the optimization as the decision on whether to skip
a label attempt in the first place. When upgrading an older
libvirtd to a newer, an NFS volume will still attempt the relabel;
but as the avoidance of a relabel was only an optimization, this
shouldn't cause any problems.
In the ideal future, libvirt will eventually have XML describing
EVERY file in the backing chain, with each file having a separate
<seclabel> element. At that point, libvirt will be able to track
more closely which files need a relabel attempt at shutdown. But
until we reach that point, the single <seclabel> for the entire
<disk> chain is treated as a hint - when a chain has only one
file, then we know it is accurate; but if the chain has more than
one file, we have to attempt relabel in spite of the attribute,
in case part of the chain is local and SELinux mattered for that
portion of the chain.
* src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
member.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
Parse it, for live images only.
(virSecurityDeviceLabelDefFormat): Output it.
(virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
(virDomainDiskSourceDefFormat, virDomainChrDefFormat)
(virDomainDiskDefFormat): Pass flags on through.
* src/security/security_selinux.c
(virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
when possible.
(virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
norelabel, if labeling fails.
(virSecuritySELinuxSetFileconHelper): Fix indentation.
* docs/formatdomain.html.in (seclabel): Document new xml.
* docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
* tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
New test files.
* tests/qemuxml2argvtest.c (mymain): Run the new tests.
* tests/qemuxml2xmltest.c (mymain): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
|
|
|
unsigned int flags = live ? 0 : VIR_DOMAIN_XML_INACTIVE;
|
2007-07-18 21:34:22 +00:00
|
|
|
|
2011-04-24 22:25:10 +00:00
|
|
|
if (virtTestLoadFile(inxml, &inXmlData) < 0)
|
2010-07-24 22:18:18 +00:00
|
|
|
goto fail;
|
2011-04-24 22:25:10 +00:00
|
|
|
if (virtTestLoadFile(outxml, &outXmlData) < 0)
|
2007-07-18 21:34:22 +00:00
|
|
|
goto fail;
|
|
|
|
|
2013-03-28 13:55:55 +00:00
|
|
|
if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlopt,
|
selinux: distinguish failure to label from request to avoid label
https://bugzilla.redhat.com/show_bug.cgi?id=924153
Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
an attribute relabel='no' in order to try and minimize the
impact of shutdown delays when an NFS server disappears. The idea
was that if a disk is on NFS and can't be labeled in the first
place, there is no need to attempt the (no-op) relabel on domain
shutdown. Unfortunately, the way this was implemented was by
modifying the domain XML so that the optimization would survive
libvirtd restart, but in a way that is indistinguishable from an
explicit user setting. Furthermore, once the setting is turned
on, libvirt avoids attempts at labeling, even for operations like
snapshot or blockcopy where the chain is being extended or pivoted
onto non-NFS, where SELinux labeling is once again possible. As
a result, it was impossible to do a blockcopy to pivot from an
NFS image file onto a local file.
The solution is to separate the semantics of a chain that must
not be labeled (which the user can set even on persistent domains)
vs. the optimization of not attempting a relabel on cleanup (a
live-only annotation), and using only the user's explicit notation
rather than the optimization as the decision on whether to skip
a label attempt in the first place. When upgrading an older
libvirtd to a newer, an NFS volume will still attempt the relabel;
but as the avoidance of a relabel was only an optimization, this
shouldn't cause any problems.
In the ideal future, libvirt will eventually have XML describing
EVERY file in the backing chain, with each file having a separate
<seclabel> element. At that point, libvirt will be able to track
more closely which files need a relabel attempt at shutdown. But
until we reach that point, the single <seclabel> for the entire
<disk> chain is treated as a hint - when a chain has only one
file, then we know it is accurate; but if the chain has more than
one file, we have to attempt relabel in spite of the attribute,
in case part of the chain is local and SELinux mattered for that
portion of the chain.
* src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
member.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
Parse it, for live images only.
(virSecurityDeviceLabelDefFormat): Output it.
(virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
(virDomainDiskSourceDefFormat, virDomainChrDefFormat)
(virDomainDiskDefFormat): Pass flags on through.
* src/security/security_selinux.c
(virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
when possible.
(virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
norelabel, if labeling fails.
(virSecuritySELinuxSetFileconHelper): Fix indentation.
* docs/formatdomain.html.in (seclabel): Document new xml.
* docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
* tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
New test files.
* tests/qemuxml2argvtest.c (mymain): Run the new tests.
* tests/qemuxml2xmltest.c (mymain): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
|
|
|
QEMU_EXPECTED_VIRT_TYPES, flags)))
|
2007-07-18 21:34:22 +00:00
|
|
|
goto fail;
|
|
|
|
|
2014-01-10 17:18:03 +00:00
|
|
|
if (!virDomainDefCheckABIStability(def, def)) {
|
|
|
|
fprintf(stderr, "ABI stability check failed on %s", inxml);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
selinux: distinguish failure to label from request to avoid label
https://bugzilla.redhat.com/show_bug.cgi?id=924153
Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
an attribute relabel='no' in order to try and minimize the
impact of shutdown delays when an NFS server disappears. The idea
was that if a disk is on NFS and can't be labeled in the first
place, there is no need to attempt the (no-op) relabel on domain
shutdown. Unfortunately, the way this was implemented was by
modifying the domain XML so that the optimization would survive
libvirtd restart, but in a way that is indistinguishable from an
explicit user setting. Furthermore, once the setting is turned
on, libvirt avoids attempts at labeling, even for operations like
snapshot or blockcopy where the chain is being extended or pivoted
onto non-NFS, where SELinux labeling is once again possible. As
a result, it was impossible to do a blockcopy to pivot from an
NFS image file onto a local file.
The solution is to separate the semantics of a chain that must
not be labeled (which the user can set even on persistent domains)
vs. the optimization of not attempting a relabel on cleanup (a
live-only annotation), and using only the user's explicit notation
rather than the optimization as the decision on whether to skip
a label attempt in the first place. When upgrading an older
libvirtd to a newer, an NFS volume will still attempt the relabel;
but as the avoidance of a relabel was only an optimization, this
shouldn't cause any problems.
In the ideal future, libvirt will eventually have XML describing
EVERY file in the backing chain, with each file having a separate
<seclabel> element. At that point, libvirt will be able to track
more closely which files need a relabel attempt at shutdown. But
until we reach that point, the single <seclabel> for the entire
<disk> chain is treated as a hint - when a chain has only one
file, then we know it is accurate; but if the chain has more than
one file, we have to attempt relabel in spite of the attribute,
in case part of the chain is local and SELinux mattered for that
portion of the chain.
* src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
member.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
Parse it, for live images only.
(virSecurityDeviceLabelDefFormat): Output it.
(virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
(virDomainDiskSourceDefFormat, virDomainChrDefFormat)
(virDomainDiskDefFormat): Pass flags on through.
* src/security/security_selinux.c
(virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
when possible.
(virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
norelabel, if labeling fails.
(virSecuritySELinuxSetFileconHelper): Fix indentation.
* docs/formatdomain.html.in (seclabel): Document new xml.
* docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
* tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
New test files.
* tests/qemuxml2argvtest.c (mymain): Run the new tests.
* tests/qemuxml2xmltest.c (mymain): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
|
|
|
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE | flags)))
|
2007-07-18 21:34:22 +00:00
|
|
|
goto fail;
|
|
|
|
|
2010-07-24 22:18:18 +00:00
|
|
|
if (STRNEQ(outXmlData, actual)) {
|
|
|
|
virtTestDifference(stderr, outXmlData, actual);
|
2007-07-18 21:34:22 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
fail:
|
2012-02-02 23:16:43 +00:00
|
|
|
VIR_FREE(inXmlData);
|
|
|
|
VIR_FREE(outXmlData);
|
|
|
|
VIR_FREE(actual);
|
2010-07-24 22:18:18 +00:00
|
|
|
virDomainDefFree(def);
|
2007-07-18 21:34:22 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
enum {
|
|
|
|
WHEN_INACTIVE = 1,
|
|
|
|
WHEN_ACTIVE = 2,
|
|
|
|
WHEN_EITHER = 3,
|
|
|
|
};
|
|
|
|
|
2010-07-24 22:18:18 +00:00
|
|
|
struct testInfo {
|
|
|
|
const char *name;
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
bool different;
|
|
|
|
int when;
|
2010-07-24 22:18:18 +00:00
|
|
|
};
|
|
|
|
|
2011-04-24 22:25:10 +00:00
|
|
|
static int
|
|
|
|
testCompareXMLToXMLHelper(const void *data)
|
|
|
|
{
|
2010-07-24 22:18:18 +00:00
|
|
|
const struct testInfo *info = data;
|
2011-04-24 22:25:10 +00:00
|
|
|
char *xml_in = NULL;
|
|
|
|
char *xml_out = NULL;
|
2014-04-17 13:23:21 +00:00
|
|
|
char *xml_out_active = NULL;
|
|
|
|
char *xml_out_inactive = NULL;
|
2011-04-24 22:25:10 +00:00
|
|
|
int ret = -1;
|
2010-07-24 22:18:18 +00:00
|
|
|
|
2011-04-24 22:25:10 +00:00
|
|
|
if (virAsprintf(&xml_in, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
|
|
|
|
abs_srcdir, info->name) < 0 ||
|
|
|
|
virAsprintf(&xml_out, "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
|
2014-04-17 13:23:21 +00:00
|
|
|
abs_srcdir, info->name) < 0 ||
|
|
|
|
virAsprintf(&xml_out_active,
|
|
|
|
"%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-active.xml",
|
|
|
|
abs_srcdir, info->name) < 0 ||
|
|
|
|
virAsprintf(&xml_out_inactive,
|
|
|
|
"%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-inactive.xml",
|
2011-04-24 22:25:10 +00:00
|
|
|
abs_srcdir, info->name) < 0)
|
|
|
|
goto cleanup;
|
2010-07-24 22:18:18 +00:00
|
|
|
|
2014-04-17 13:23:21 +00:00
|
|
|
if ((info->when & WHEN_INACTIVE)) {
|
|
|
|
char *out;
|
|
|
|
if (!info->different)
|
|
|
|
out = xml_in;
|
|
|
|
else if (virFileExists(xml_out_inactive))
|
|
|
|
out = xml_out_inactive;
|
|
|
|
else
|
|
|
|
out = xml_out;
|
|
|
|
|
|
|
|
if (testCompareXMLToXMLFiles(xml_in, out, false) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2013-09-25 14:56:05 +00:00
|
|
|
|
2014-04-17 13:23:21 +00:00
|
|
|
if ((info->when & WHEN_ACTIVE)) {
|
|
|
|
char *out;
|
|
|
|
if (!info->different)
|
|
|
|
out = xml_in;
|
|
|
|
else if (virFileExists(xml_out_active))
|
|
|
|
out = xml_out_active;
|
|
|
|
else
|
|
|
|
out = xml_out;
|
|
|
|
|
|
|
|
if (testCompareXMLToXMLFiles(xml_in, out, true) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2013-09-25 14:56:05 +00:00
|
|
|
|
|
|
|
ret = 0;
|
2010-07-24 22:18:18 +00:00
|
|
|
|
2014-03-25 06:53:44 +00:00
|
|
|
cleanup:
|
2012-02-02 23:16:43 +00:00
|
|
|
VIR_FREE(xml_in);
|
|
|
|
VIR_FREE(xml_out);
|
2014-04-17 13:23:21 +00:00
|
|
|
VIR_FREE(xml_out_active);
|
|
|
|
VIR_FREE(xml_out_inactive);
|
2010-07-24 22:18:18 +00:00
|
|
|
return ret;
|
2007-07-18 21:34:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
static int
|
2011-04-29 16:21:20 +00:00
|
|
|
mymain(void)
|
2007-07-18 21:34:22 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
if ((driver.caps = testQemuCapsInit()) == NULL)
|
2012-03-22 11:33:35 +00:00
|
|
|
return EXIT_FAILURE;
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2013-03-11 09:24:29 +00:00
|
|
|
if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
|
2013-03-05 15:17:24 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
# define DO_TEST_FULL(name, is_different, when) \
|
2010-07-24 22:18:18 +00:00
|
|
|
do { \
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
const struct testInfo info = {name, is_different, when}; \
|
2010-07-24 22:18:18 +00:00
|
|
|
if (virtTestRun("QEMU XML-2-XML " name, \
|
2013-09-20 18:13:35 +00:00
|
|
|
testCompareXMLToXMLHelper, &info) < 0) \
|
2010-07-24 22:18:18 +00:00
|
|
|
ret = -1; \
|
|
|
|
} while (0)
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define DO_TEST(name) \
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
DO_TEST_FULL(name, false, WHEN_EITHER)
|
2010-07-24 22:18:18 +00:00
|
|
|
|
|
|
|
# define DO_TEST_DIFFERENT(name) \
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
DO_TEST_FULL(name, true, WHEN_EITHER)
|
2010-07-24 22:18:18 +00:00
|
|
|
|
|
|
|
/* Unset or set all envvars here that are copied in qemudBuildCommandLine
|
|
|
|
* using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
|
|
|
|
* values for these envvars */
|
|
|
|
setenv("PATH", "/bin", 1);
|
2008-04-25 20:46:13 +00:00
|
|
|
|
|
|
|
DO_TEST("minimal");
|
2012-08-15 08:16:36 +00:00
|
|
|
DO_TEST("machine-core-on");
|
|
|
|
DO_TEST("machine-core-off");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("boot-cdrom");
|
|
|
|
DO_TEST("boot-network");
|
|
|
|
DO_TEST("boot-floppy");
|
2010-07-26 14:28:58 +00:00
|
|
|
DO_TEST("boot-multi");
|
2014-08-22 11:39:26 +00:00
|
|
|
DO_TEST("boot-menu-enable-with-timeout");
|
2010-07-26 14:28:58 +00:00
|
|
|
DO_TEST("boot-menu-disable");
|
2014-08-22 11:39:26 +00:00
|
|
|
DO_TEST_DIFFERENT("boot-menu-disable-with-timeout");
|
2011-01-13 10:46:43 +00:00
|
|
|
DO_TEST("boot-order");
|
2008-05-15 16:21:11 +00:00
|
|
|
DO_TEST("bootloader");
|
2012-09-18 10:32:07 +00:00
|
|
|
|
|
|
|
DO_TEST("reboot-timeout-enabled");
|
|
|
|
DO_TEST("reboot-timeout-disabled");
|
|
|
|
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("clock-utc");
|
|
|
|
DO_TEST("clock-localtime");
|
2012-01-27 13:49:52 +00:00
|
|
|
DO_TEST("cpu-kvmclock");
|
|
|
|
DO_TEST("cpu-host-kvmclock");
|
2014-02-04 18:02:04 +00:00
|
|
|
DO_TEST("clock-catchup");
|
2012-01-27 13:49:52 +00:00
|
|
|
DO_TEST("kvmclock");
|
2014-01-21 17:50:12 +00:00
|
|
|
DO_TEST("clock-timer-hyperv-rtc");
|
2012-09-13 13:27:07 +00:00
|
|
|
|
|
|
|
DO_TEST("cpu-eoi-disabled");
|
|
|
|
DO_TEST("cpu-eoi-enabled");
|
|
|
|
DO_TEST("eoi-disabled");
|
|
|
|
DO_TEST("eoi-enabled");
|
2013-09-23 16:32:11 +00:00
|
|
|
DO_TEST("pv-spinlock-disabled");
|
|
|
|
DO_TEST("pv-spinlock-enabled");
|
2012-09-13 13:27:07 +00:00
|
|
|
|
2012-10-17 12:55:18 +00:00
|
|
|
DO_TEST("hyperv");
|
2013-07-04 10:12:57 +00:00
|
|
|
DO_TEST("hyperv-off");
|
2012-10-17 12:55:18 +00:00
|
|
|
|
2014-08-21 17:04:45 +00:00
|
|
|
DO_TEST("kvm-features");
|
|
|
|
DO_TEST("kvm-features-off");
|
|
|
|
|
Support configuration of huge pages in guests
Add option to domain XML for
<memoryBacking>
<hugepages/>
</memoryBacking>
* configure.in: Add check for mntent.h
* qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
Add 'hugetlbfs_mount' config parameter
* src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
and pass it when hugepages are requested.
Load hugetlbfs_mount config parameter, search for mount if not given.
* src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
Create directory for QEMU hugepage usage, chowning if required.
* docs/formatdomain.html.in: Document memoryBacking/hugepages elements
* docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
* src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
helper API
* tests/qemuhelptest.c: Add -mem-path constants
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
handling
* tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
hugepage tests
2009-08-25 14:05:18 +00:00
|
|
|
DO_TEST("hugepages");
|
2014-07-23 15:37:20 +00:00
|
|
|
DO_TEST("hugepages-pages");
|
2014-07-23 15:37:21 +00:00
|
|
|
DO_TEST("hugepages-pages2");
|
|
|
|
DO_TEST("hugepages-pages3");
|
2014-09-08 09:34:22 +00:00
|
|
|
DO_TEST("hugepages-shared");
|
2013-05-14 05:25:50 +00:00
|
|
|
DO_TEST("nosharepages");
|
2010-04-21 14:28:21 +00:00
|
|
|
DO_TEST("disk-aio");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("disk-cdrom");
|
|
|
|
DO_TEST("disk-floppy");
|
|
|
|
DO_TEST("disk-many");
|
2008-05-15 16:05:41 +00:00
|
|
|
DO_TEST("disk-xenvbd");
|
2008-08-08 15:03:00 +00:00
|
|
|
DO_TEST("disk-usb");
|
2009-12-22 16:53:20 +00:00
|
|
|
DO_TEST("disk-virtio");
|
2009-11-16 18:08:29 +00:00
|
|
|
DO_TEST("floppy-drive-fat");
|
|
|
|
DO_TEST("disk-drive-fat");
|
2009-01-23 16:22:20 +00:00
|
|
|
DO_TEST("disk-drive-fmt-qcow");
|
2009-01-30 17:15:39 +00:00
|
|
|
DO_TEST("disk-drive-cache-v1-wt");
|
|
|
|
DO_TEST("disk-drive-cache-v1-wb");
|
|
|
|
DO_TEST("disk-drive-cache-v1-none");
|
2014-04-14 22:54:19 +00:00
|
|
|
DO_TEST("disk-drive-copy-on-read");
|
2013-02-25 17:44:22 +00:00
|
|
|
DO_TEST("disk-drive-network-nbd");
|
2013-02-25 17:44:23 +00:00
|
|
|
DO_TEST("disk-drive-network-nbd-export");
|
2013-02-25 17:44:25 +00:00
|
|
|
DO_TEST("disk-drive-network-nbd-ipv6");
|
|
|
|
DO_TEST("disk-drive-network-nbd-ipv6-export");
|
2013-02-25 17:44:24 +00:00
|
|
|
DO_TEST("disk-drive-network-nbd-unix");
|
2013-02-25 17:44:26 +00:00
|
|
|
DO_TEST("disk-drive-network-iscsi");
|
2013-03-21 11:53:53 +00:00
|
|
|
DO_TEST("disk-drive-network-iscsi-auth");
|
2010-07-24 22:18:18 +00:00
|
|
|
DO_TEST("disk-scsi-device");
|
2012-02-28 06:01:31 +00:00
|
|
|
DO_TEST("disk-scsi-vscsi");
|
|
|
|
DO_TEST("disk-scsi-virtio-scsi");
|
2013-04-05 16:21:23 +00:00
|
|
|
DO_TEST("disk-virtio-scsi-num_queues");
|
2014-05-22 18:22:52 +00:00
|
|
|
DO_TEST("disk-virtio-scsi-cmd_per_lun");
|
|
|
|
DO_TEST("disk-virtio-scsi-max_sectors");
|
2013-03-21 14:11:39 +00:00
|
|
|
DO_TEST("disk-scsi-megasas");
|
conf: alter disk mirror xml output
Now that we track a disk mirror as a virStorageSource, we might
as well update the XML to theoretically allow any type of
mirroring destination (not just a local file). A later patch
will also be reusing <mirror> to track the block commit of the
top layer of a chain, which is another case where libvirt needs
to update the backing chain after the job is finally pivoted,
and since backing chains can have network backing files as the
destination to commit into, it makes more sense to display that
in the XML.
This patch changes output-only XML; it was already documented
that <mirror> does not affect a domain definition at this point
(because qemu doesn't provide persistent bitmaps yet). Any
application that was starting a block copy job with older libvirt
and then relying on the domain XML to determine if it was
complete will no longer be able to access the file= and format=
attributes of mirror that were previously used. However, this is
not going to be a problem in practice: the only time a block copy
job works is on a transient domain, and any app that is managing
a transient domain probably already does enough of its own
bookkeeping to know which file it is mirroring into without
having to re-read it from the libvirt XML. The one thing that
was likely to be used in a mirroring job was the ready=
attribute, which is unchanged. Meanwhile, I made sure the schema
and parser still accept the old format, even if we no longer
output it, so that upgrading from an older version of libvirt is
seamless.
* docs/schemas/domaincommon.rng (diskMirror): Alter definition.
* src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two
styles of mirror elements.
(virDomainDiskDefFormat): Output new style.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New
file, copied from...
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here
before modernizing.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New
files.
* tests/qemuxml2xmltest.c (mymain): Test both styles.
Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-22 04:39:57 +00:00
|
|
|
DO_TEST_DIFFERENT("disk-mirror-old");
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
|
|
|
|
DO_TEST_FULL("disk-mirror", true, WHEN_INACTIVE);
|
2014-07-29 03:46:44 +00:00
|
|
|
DO_TEST_FULL("disk-active-commit", false, WHEN_ACTIVE);
|
conf: add <listen> subelement to domain <graphics> element
Once it's plugged in, the <listen> element will be an optional
replacement for the "listen" attribute that graphics elements already
have. If the <listen> element is type='address', it will have an
attribute called 'address' which will contain an IP address or dns
name that the guest's display server should listen on. If, however,
type='network', the <listen> element should have an attribute called
'network' that will be set to the name of a network configuration to
get the IP address from.
* docs/schemas/domain.rng: updated to allow the <listen> element
* docs/formatdomain.html.in: document the <listen> element and its
attributes.
* src/conf/domain_conf.[hc]:
1) The domain parser, formatter, and data structure are modified to
support 0 or more <listen> subelements to each <graphics>
element. The old style "legacy" listen attribute is also still
accepted, and will be stored internally just as if it were a
separate <listen> element. On output (i.e. format), the address
attribute of the first <listen> element of type 'address' will be
duplicated in the legacy "listen" attribute of the <graphic>
element.
2) The "listenAddr" attribute has been removed from the unions in
virDomainGRaphicsDef for graphics types vnc, rdp, and spice.
This attribute is now in the <listen> subelement (aka
virDomainGraphicsListenDef)
3) Helper functions were written to provide simple access
(both Get and Set) to the listen elements and their attributes.
* src/libvirt_private.syms: export the listen helper functions
* src/qemu/qemu_command.c, src/qemu/qemu_hotplug.c,
src/qemu/qemu_migration.c, src/vbox/vbox_tmpl.c,
src/vmx/vmx.c, src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c
Modify all these files to use the listen helper functions rather
than directly referencing the (now missing) listenAddr
attribute. There can be multiple <listen> elements to a single
<graphics>, but the drivers all currently only support one, so all
replacements of direct access with a helper function indicate index
"0".
* tests/* - only 3 of these are new files added explicitly to test the
new <listen> element. All the others have been modified to reflect
the fact that any legacy "listen" attributes passed in to the domain
parse will be saved in a <listen> element (i.e. one of the
virDomainGraphicsListenDefs), and during the domain format function,
both the <listen> element as well as the legacy attributes will be
output.
2011-07-07 04:20:28 +00:00
|
|
|
DO_TEST("graphics-listen-network");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("graphics-vnc");
|
2013-04-30 14:26:43 +00:00
|
|
|
DO_TEST("graphics-vnc-websocket");
|
2009-07-06 13:59:19 +00:00
|
|
|
DO_TEST("graphics-vnc-sasl");
|
|
|
|
DO_TEST("graphics-vnc-tls");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("graphics-sdl");
|
2008-12-11 11:44:30 +00:00
|
|
|
DO_TEST("graphics-sdl-fullscreen");
|
2010-03-05 17:12:52 +00:00
|
|
|
DO_TEST("graphics-spice");
|
2011-05-31 13:52:05 +00:00
|
|
|
DO_TEST("graphics-spice-compression");
|
qemu: Support vram for video of qxl type
For qemu names the primary vga as "qxl-vga":
1) if vram is specified for 2nd qxl device:
-vga qxl -global qxl-vga.vram_size=$SIZE \
-device qxl,id=video1,vram_size=$SIZE,...
2) if vram is not specified for 2nd qxl device, (use the default
set by global):
-vga qxl -global qxl-vga.vram_size=$SIZE \
-device qxl,id=video1,...
For qemu names all qxl devices as "qxl":
1) if vram is specified for 2nd qxl device:
-vga qxl -global qxl.vram_size=$SIZE \
-device qxl,id=video1,vram_size=$SIZE ...
2) if vram is not specified for 2nd qxl device:
-vga qxl -global qxl-vga.vram_size=$SIZE \
-device qxl,id=video1,...
"-global" is the only way to define vram_size for the primary qxl
device, regardless of how qemu names it, (It's not good a good
way, as original idea of "-global" is to set a global default for
a driver property, but to specify vram for first qxl device, we
have to use it).
For other qxl devices, as they are represented by "-device", could
specify it directly and seperately for each, and it overrides the
default set by "-global" if specified.
v1 - v2:
* modify "virDomainVideoDefaultRAM" so that it returns 16M as the
default vram_size for qxl device.
* vram_size * 1024 (qemu accepts bytes for vram_size).
* apply default vram_size for qxl device for which vram_size is
not specified.
* modify "graphics-spice" tests (more sensiable vram_size)
* Add an argument of virDomainDefPtr type for qemuBuildVideoDevStr,
to use virDomainVideoDefaultRAM in qemuBuildVideoDevStr).
v2 - v3:
* Modify default video memory size for qxl device from 16M to 24M
* Update codes to be consistent with changes on qemu_capabilities.*
2011-03-06 14:00:27 +00:00
|
|
|
DO_TEST("graphics-spice-qxl-vga");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("input-usbmouse");
|
|
|
|
DO_TEST("input-usbtablet");
|
2008-05-15 16:11:40 +00:00
|
|
|
DO_TEST("input-xen");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("misc-acpi");
|
2012-08-02 10:18:16 +00:00
|
|
|
DO_TEST("misc-disable-s3");
|
|
|
|
DO_TEST("misc-disable-suspends");
|
|
|
|
DO_TEST("misc-enable-s4");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("misc-no-reboot");
|
2014-07-11 17:47:31 +00:00
|
|
|
DO_TEST("net-vhostuser");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("net-user");
|
2008-04-30 12:30:55 +00:00
|
|
|
DO_TEST("net-virtio");
|
Add txmode attribute to interface XML for virtio backend
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=629662
Explanation
qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.
'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)
'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)
The resulting difference, according to the qemu developer who added
the option is:
bh makes tx more asynchronous and reduces latency, but potentially
causes more processor bandwidth contention since the cpu doing the
tx isn't necessarily the cpu where the guest generated the
packets.
Solution
This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:
<interface ...>
...
<model type='virtio'/>
<driver txmode='iothread'/>
...
</interface>
I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)
Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of
qemu -device virtio-net-pci,?
If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
2011-02-03 20:20:01 +00:00
|
|
|
DO_TEST("net-virtio-device");
|
2014-09-11 10:56:31 +00:00
|
|
|
DO_TEST("net-virtio-disable-offloads");
|
2009-01-30 17:17:58 +00:00
|
|
|
DO_TEST("net-eth");
|
|
|
|
DO_TEST("net-eth-ifname");
|
2011-06-26 08:09:00 +00:00
|
|
|
DO_TEST("net-virtio-network-portgroup");
|
2012-02-15 17:37:15 +00:00
|
|
|
DO_TEST("net-hostdev");
|
2013-04-25 11:58:37 +00:00
|
|
|
DO_TEST("net-hostdev-vfio");
|
2012-08-12 07:51:30 +00:00
|
|
|
DO_TEST("net-openvswitch");
|
2008-07-11 19:34:11 +00:00
|
|
|
DO_TEST("sound");
|
2012-05-15 22:55:11 +00:00
|
|
|
DO_TEST("sound-device");
|
2011-07-22 14:07:29 +00:00
|
|
|
DO_TEST("net-bandwidth");
|
2008-04-25 20:46:13 +00:00
|
|
|
|
|
|
|
DO_TEST("serial-vc");
|
|
|
|
DO_TEST("serial-pty");
|
|
|
|
DO_TEST("serial-dev");
|
|
|
|
DO_TEST("serial-file");
|
|
|
|
DO_TEST("serial-unix");
|
|
|
|
DO_TEST("serial-tcp");
|
|
|
|
DO_TEST("serial-udp");
|
|
|
|
DO_TEST("serial-tcp-telnet");
|
|
|
|
DO_TEST("serial-many");
|
2014-01-30 11:19:12 +00:00
|
|
|
DO_TEST("serial-spiceport");
|
|
|
|
DO_TEST("serial-spiceport-nospice");
|
2008-04-25 20:46:13 +00:00
|
|
|
DO_TEST("parallel-tcp");
|
|
|
|
DO_TEST("console-compat");
|
Allow multiple consoles per virtual guest
While Xen only has a single paravirt console, UML, and
QEMU both support multiple paravirt consoles. The LXC
driver can also be trivially made to support multiple
consoles. This patch extends the XML to allow multiple
<console> elements in the XML. It also makes the UML
and QEMU drivers support this config.
* src/conf/domain_conf.c, src/conf/domain_conf.h: Allow
multiple <console> devices
* src/lxc/lxc_driver.c, src/xen/xen_driver.c,
src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c: Update for
internal API changes
* src/security/security_selinux.c, src/security/virt-aa-helper.c:
Only label consoles that aren't a copy of the serial device
* src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
src/qemu/qemu_process.c, src/uml/uml_conf.c,
src/uml/uml_driver.c: Support multiple console devices
* tests/qemuxml2xmltest.c, tests/qemuxml2argvtest.c: Extra
tests for multiple virtio consoles. Set QEMU_CAPS_CHARDEV
for all console /channel tests
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args,
tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args
tests/qemuxml2argvdata/qemuxml2argv-console-virtio.args: Update
for correct chardev syntax
* tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args,
tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml: New
test file
2011-02-23 18:27:23 +00:00
|
|
|
DO_TEST("console-virtio-many");
|
2009-11-05 14:31:03 +00:00
|
|
|
DO_TEST("channel-guestfwd");
|
2010-02-18 16:52:03 +00:00
|
|
|
DO_TEST("channel-virtio");
|
2007-07-18 21:34:22 +00:00
|
|
|
|
2008-08-08 14:27:05 +00:00
|
|
|
DO_TEST("hostdev-usb-address");
|
2009-01-12 15:09:19 +00:00
|
|
|
DO_TEST("hostdev-pci-address");
|
2013-04-25 11:58:37 +00:00
|
|
|
DO_TEST("hostdev-vfio");
|
2012-01-25 00:54:12 +00:00
|
|
|
DO_TEST("pci-rom");
|
2008-08-08 14:27:05 +00:00
|
|
|
|
2010-04-27 10:01:32 +00:00
|
|
|
DO_TEST("encrypted-disk");
|
2012-03-05 21:52:07 +00:00
|
|
|
DO_TEST_DIFFERENT("memtune");
|
2013-12-09 10:32:48 +00:00
|
|
|
DO_TEST_DIFFERENT("memtune-unlimited");
|
2011-02-08 06:59:38 +00:00
|
|
|
DO_TEST("blkiotune");
|
2011-11-08 11:00:34 +00:00
|
|
|
DO_TEST("blkiotune-device");
|
2011-03-29 13:44:14 +00:00
|
|
|
DO_TEST("cputune");
|
2014-03-04 11:39:46 +00:00
|
|
|
DO_TEST("cputune-zero-shares");
|
2010-04-27 10:01:32 +00:00
|
|
|
|
2010-09-29 21:58:47 +00:00
|
|
|
DO_TEST("smp");
|
2014-08-22 22:15:30 +00:00
|
|
|
DO_TEST("iothreads");
|
2014-09-15 23:33:16 +00:00
|
|
|
DO_TEST_DIFFERENT("cputune-iothreads");
|
2014-08-25 19:59:32 +00:00
|
|
|
DO_TEST("iothreads-disk");
|
2010-12-09 18:25:11 +00:00
|
|
|
DO_TEST("lease");
|
2011-08-13 06:32:45 +00:00
|
|
|
DO_TEST("event_idx");
|
2013-04-10 10:19:37 +00:00
|
|
|
DO_TEST("vhost_queues");
|
2014-08-11 12:51:49 +00:00
|
|
|
DO_TEST("interface-driver");
|
qemu: add new disk device='lun' for bus='virtio' & type='block'
In the past, generic SCSI commands issued from a guest to a virtio
disk were always passed through to the underlying disk by qemu, and
the kernel would also pass them on.
As a result of CVE-2011-4127 (see:
http://seclists.org/oss-sec/2011/q4/536), qemu now honors its
scsi=on|off device option for virtio-blk-pci (which enables/disables
passthrough of generic SCSI commands), and the kernel will only allow
the commands for physical devices (not for partitions or logical
volumes). The default behavior of qemu is still to allow sending
generic SCSI commands to physical disks that are presented to a guest
as virtio-blk-pci devices, but libvirt prefers to disable those
commands in the standard virtio block devices, enabling it only when
specifically requested (hopefully indicating that the requester
understands what they're asking for). For this purpose, a new libvirt
disk device type (device='lun') has been created.
device='lun' is identical to the default device='disk', except that:
1) It is only allowed if bus='virtio', type='block', and the qemu
version is "new enough" to support it ("new enough" == qemu 0.11 or
better), otherwise the domain will fail to start and a
CONFIG_UNSUPPORTED error will be logged).
2) The option "scsi=on" will be added to the -device arg to allow
SG_IO commands (if device !='lun', "scsi=off" will be added to the
-device arg so that SG_IO commands are specifically forbidden).
Guests which continue to use disk device='disk' (the default) will no
longer be able to use SG_IO commands on the disk; those that have
their disk device changed to device='lun' will still be able to use SG_IO
commands.
*docs/formatdomain.html.in - document the new device attribute value.
*docs/schemas/domaincommon.rng - allow it in the RNG
*tests/* - update the args of several existing tests to add scsi=off, and
add one new test that will test scsi=on.
*src/conf/domain_conf.c - update domain XML parser and formatter
*src/qemu/qemu_(command|driver|hotplug).c - treat
VIR_DOMAIN_DISK_DEVICE_LUN *almost* identically to
VIR_DOMAIN_DISK_DEVICE_DISK, except as indicated above.
Note that no support for this new device value was added to any
hypervisor drivers other than qemu, because it's unclear what it might
mean (if anything) to those drivers.
2012-01-05 03:48:38 +00:00
|
|
|
DO_TEST("virtio-lun");
|
2010-09-29 21:58:47 +00:00
|
|
|
|
2011-09-02 15:09:14 +00:00
|
|
|
DO_TEST("usb-redir");
|
2011-11-15 09:02:50 +00:00
|
|
|
DO_TEST("blkdeviotune");
|
2011-09-02 15:09:14 +00:00
|
|
|
|
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 00:10:18 +00:00
|
|
|
DO_TEST_FULL("seclabel-dynamic-baselabel", false, WHEN_INACTIVE);
|
|
|
|
DO_TEST_FULL("seclabel-dynamic-override", false, WHEN_INACTIVE);
|
selinux: distinguish failure to label from request to avoid label
https://bugzilla.redhat.com/show_bug.cgi?id=924153
Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
an attribute relabel='no' in order to try and minimize the
impact of shutdown delays when an NFS server disappears. The idea
was that if a disk is on NFS and can't be labeled in the first
place, there is no need to attempt the (no-op) relabel on domain
shutdown. Unfortunately, the way this was implemented was by
modifying the domain XML so that the optimization would survive
libvirtd restart, but in a way that is indistinguishable from an
explicit user setting. Furthermore, once the setting is turned
on, libvirt avoids attempts at labeling, even for operations like
snapshot or blockcopy where the chain is being extended or pivoted
onto non-NFS, where SELinux labeling is once again possible. As
a result, it was impossible to do a blockcopy to pivot from an
NFS image file onto a local file.
The solution is to separate the semantics of a chain that must
not be labeled (which the user can set even on persistent domains)
vs. the optimization of not attempting a relabel on cleanup (a
live-only annotation), and using only the user's explicit notation
rather than the optimization as the decision on whether to skip
a label attempt in the first place. When upgrading an older
libvirtd to a newer, an NFS volume will still attempt the relabel;
but as the avoidance of a relabel was only an optimization, this
shouldn't cause any problems.
In the ideal future, libvirt will eventually have XML describing
EVERY file in the backing chain, with each file having a separate
<seclabel> element. At that point, libvirt will be able to track
more closely which files need a relabel attempt at shutdown. But
until we reach that point, the single <seclabel> for the entire
<disk> chain is treated as a hint - when a chain has only one
file, then we know it is accurate; but if the chain has more than
one file, we have to attempt relabel in spite of the attribute,
in case part of the chain is local and SELinux mattered for that
portion of the chain.
* src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
member.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
Parse it, for live images only.
(virSecurityDeviceLabelDefFormat): Output it.
(virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
(virDomainDiskSourceDefFormat, virDomainChrDefFormat)
(virDomainDiskDefFormat): Pass flags on through.
* src/security/security_selinux.c
(virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
when possible.
(virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
norelabel, if labeling fails.
(virSecuritySELinuxSetFileconHelper): Fix indentation.
* docs/formatdomain.html.in (seclabel): Document new xml.
* docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
* tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
New test files.
* tests/qemuxml2argvtest.c (mymain): Run the new tests.
* tests/qemuxml2xmltest.c (mymain): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
|
|
|
DO_TEST_FULL("seclabel-dynamic-labelskip", true, WHEN_INACTIVE);
|
2014-09-03 17:06:55 +00:00
|
|
|
DO_TEST_FULL("seclabel-dynamic-relabel", true, WHEN_INACTIVE);
|
2011-12-23 00:47:46 +00:00
|
|
|
DO_TEST("seclabel-static");
|
selinux: distinguish failure to label from request to avoid label
https://bugzilla.redhat.com/show_bug.cgi?id=924153
Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
an attribute relabel='no' in order to try and minimize the
impact of shutdown delays when an NFS server disappears. The idea
was that if a disk is on NFS and can't be labeled in the first
place, there is no need to attempt the (no-op) relabel on domain
shutdown. Unfortunately, the way this was implemented was by
modifying the domain XML so that the optimization would survive
libvirtd restart, but in a way that is indistinguishable from an
explicit user setting. Furthermore, once the setting is turned
on, libvirt avoids attempts at labeling, even for operations like
snapshot or blockcopy where the chain is being extended or pivoted
onto non-NFS, where SELinux labeling is once again possible. As
a result, it was impossible to do a blockcopy to pivot from an
NFS image file onto a local file.
The solution is to separate the semantics of a chain that must
not be labeled (which the user can set even on persistent domains)
vs. the optimization of not attempting a relabel on cleanup (a
live-only annotation), and using only the user's explicit notation
rather than the optimization as the decision on whether to skip
a label attempt in the first place. When upgrading an older
libvirtd to a newer, an NFS volume will still attempt the relabel;
but as the avoidance of a relabel was only an optimization, this
shouldn't cause any problems.
In the ideal future, libvirt will eventually have XML describing
EVERY file in the backing chain, with each file having a separate
<seclabel> element. At that point, libvirt will be able to track
more closely which files need a relabel attempt at shutdown. But
until we reach that point, the single <seclabel> for the entire
<disk> chain is treated as a hint - when a chain has only one
file, then we know it is accurate; but if the chain has more than
one file, we have to attempt relabel in spite of the attribute,
in case part of the chain is local and SELinux mattered for that
portion of the chain.
* src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
member.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
Parse it, for live images only.
(virSecurityDeviceLabelDefFormat): Output it.
(virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
(virDomainDiskSourceDefFormat, virDomainChrDefFormat)
(virDomainDiskDefFormat): Pass flags on through.
* src/security/security_selinux.c
(virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
when possible.
(virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
norelabel, if labeling fails.
(virSecuritySELinuxSetFileconHelper): Fix indentation.
* docs/formatdomain.html.in (seclabel): Document new xml.
* docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
* tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
* tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
New test files.
* tests/qemuxml2argvtest.c (mymain): Run the new tests.
* tests/qemuxml2xmltest.c (mymain): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
|
|
|
DO_TEST_FULL("seclabel-static-labelskip", false, WHEN_ACTIVE);
|
2014-09-03 17:06:55 +00:00
|
|
|
DO_TEST_DIFFERENT("seclabel-none");
|
2014-06-10 08:19:40 +00:00
|
|
|
DO_TEST("seclabel-dac-none");
|
2014-07-09 12:36:04 +00:00
|
|
|
DO_TEST("seclabel-dynamic-none");
|
2014-09-03 17:06:55 +00:00
|
|
|
DO_TEST_FULL("seclabel-dynamic-none-relabel", true, WHEN_INACTIVE);
|
numad: Set memory policy from numad advisory nodeset
Though numad will manage the memory allocation of task dynamically,
it wants management application (libvirt) to pre-set the memory
policy according to the advisory nodeset returned from querying numad,
(just like pre-bind CPU nodeset for domain process), and thus the
performance could benefit much more from it.
This patch introduces new XML tag 'placement', value 'auto' indicates
whether to set the memory policy with the advisory nodeset from numad,
and its value defaults to the value of <vcpu> placement, or 'static'
if 'nodeset' is specified. Example of the new XML tag's usage:
<numatune>
<memory placement='auto' mode='interleave'/>
</numatune>
Just like what current "numatune" does, the 'auto' numa memory policy
setting uses libnuma's API too.
If <vcpu> "placement" is "auto", and <numatune> is not specified
explicitly, a default <numatume> will be added with "placement"
set as "auto", and "mode" set as "strict".
The following XML can now fully drive numad:
1) <vcpu> placement is 'auto', no <numatune> is specified.
<vcpu placement='auto'>10</vcpu>
2) <vcpu> placement is 'auto', no 'placement' is specified for
<numatune>.
<vcpu placement='auto'>10</vcpu>
<numatune>
<memory mode='interleave'/>
</numatune>
And it's also able to control the CPU placement and memory policy
independently. e.g.
1) <vcpu> placement is 'auto', and <numatune> placement is 'static'
<vcpu placement='auto'>10</vcpu>
<numatune>
<memory mode='strict' nodeset='0-10,^7'/>
</numatune>
2) <vcpu> placement is 'static', and <numatune> placement is 'auto'
<vcpu placement='static' cpuset='0-24,^12'>10</vcpu>
<numatune>
<memory mode='interleave' placement='auto'/>
</numatume>
A follow up patch will change the XML formatting codes to always output
'placement' for <vcpu>, even it's 'static'.
2012-05-08 16:04:34 +00:00
|
|
|
DO_TEST("numad-static-vcpu-no-numatune");
|
2013-01-02 14:37:09 +00:00
|
|
|
DO_TEST("disk-scsi-lun-passthrough-sgio");
|
2011-12-23 00:47:46 +00:00
|
|
|
|
2012-12-06 10:23:02 +00:00
|
|
|
DO_TEST("disk-scsi-disk-vpd");
|
2014-04-14 22:54:12 +00:00
|
|
|
DO_TEST_DIFFERENT("disk-source-pool");
|
2013-07-18 17:18:03 +00:00
|
|
|
DO_TEST("disk-source-pool-mode");
|
2012-12-06 10:23:02 +00:00
|
|
|
|
2014-04-14 22:54:12 +00:00
|
|
|
DO_TEST_DIFFERENT("disk-drive-discard");
|
2013-05-14 12:44:54 +00:00
|
|
|
|
2013-02-12 16:56:00 +00:00
|
|
|
DO_TEST("virtio-rng-random");
|
|
|
|
DO_TEST("virtio-rng-egd");
|
|
|
|
|
2013-04-25 08:46:04 +00:00
|
|
|
DO_TEST("pseries-nvram");
|
|
|
|
|
2010-07-24 22:18:18 +00:00
|
|
|
/* These tests generate different XML */
|
|
|
|
DO_TEST_DIFFERENT("balloon-device-auto");
|
|
|
|
DO_TEST_DIFFERENT("channel-virtio-auto");
|
|
|
|
DO_TEST_DIFFERENT("console-compat-auto");
|
|
|
|
DO_TEST_DIFFERENT("disk-scsi-device-auto");
|
2010-07-14 17:02:04 +00:00
|
|
|
DO_TEST_DIFFERENT("console-virtio");
|
2011-04-14 16:05:14 +00:00
|
|
|
DO_TEST_DIFFERENT("serial-target-port-auto");
|
conf: add <listen> subelement to domain <graphics> element
Once it's plugged in, the <listen> element will be an optional
replacement for the "listen" attribute that graphics elements already
have. If the <listen> element is type='address', it will have an
attribute called 'address' which will contain an IP address or dns
name that the guest's display server should listen on. If, however,
type='network', the <listen> element should have an attribute called
'network' that will be set to the name of a network configuration to
get the IP address from.
* docs/schemas/domain.rng: updated to allow the <listen> element
* docs/formatdomain.html.in: document the <listen> element and its
attributes.
* src/conf/domain_conf.[hc]:
1) The domain parser, formatter, and data structure are modified to
support 0 or more <listen> subelements to each <graphics>
element. The old style "legacy" listen attribute is also still
accepted, and will be stored internally just as if it were a
separate <listen> element. On output (i.e. format), the address
attribute of the first <listen> element of type 'address' will be
duplicated in the legacy "listen" attribute of the <graphic>
element.
2) The "listenAddr" attribute has been removed from the unions in
virDomainGRaphicsDef for graphics types vnc, rdp, and spice.
This attribute is now in the <listen> subelement (aka
virDomainGraphicsListenDef)
3) Helper functions were written to provide simple access
(both Get and Set) to the listen elements and their attributes.
* src/libvirt_private.syms: export the listen helper functions
* src/qemu/qemu_command.c, src/qemu/qemu_hotplug.c,
src/qemu/qemu_migration.c, src/vbox/vbox_tmpl.c,
src/vmx/vmx.c, src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c
Modify all these files to use the listen helper functions rather
than directly referencing the (now missing) listenAddr
attribute. There can be multiple <listen> elements to a single
<graphics>, but the drivers all currently only support one, so all
replacements of direct access with a helper function indicate index
"0".
* tests/* - only 3 of these are new files added explicitly to test the
new <listen> element. All the others have been modified to reflect
the fact that any legacy "listen" attributes passed in to the domain
parse will be saved in a <listen> element (i.e. one of the
virDomainGraphicsListenDefs), and during the domain format function,
both the <listen> element as well as the legacy attributes will be
output.
2011-07-07 04:20:28 +00:00
|
|
|
DO_TEST_DIFFERENT("graphics-listen-network2");
|
2011-12-21 13:27:16 +00:00
|
|
|
DO_TEST_DIFFERENT("graphics-spice-timeout");
|
numad: Set memory policy from numad advisory nodeset
Though numad will manage the memory allocation of task dynamically,
it wants management application (libvirt) to pre-set the memory
policy according to the advisory nodeset returned from querying numad,
(just like pre-bind CPU nodeset for domain process), and thus the
performance could benefit much more from it.
This patch introduces new XML tag 'placement', value 'auto' indicates
whether to set the memory policy with the advisory nodeset from numad,
and its value defaults to the value of <vcpu> placement, or 'static'
if 'nodeset' is specified. Example of the new XML tag's usage:
<numatune>
<memory placement='auto' mode='interleave'/>
</numatune>
Just like what current "numatune" does, the 'auto' numa memory policy
setting uses libnuma's API too.
If <vcpu> "placement" is "auto", and <numatune> is not specified
explicitly, a default <numatume> will be added with "placement"
set as "auto", and "mode" set as "strict".
The following XML can now fully drive numad:
1) <vcpu> placement is 'auto', no <numatune> is specified.
<vcpu placement='auto'>10</vcpu>
2) <vcpu> placement is 'auto', no 'placement' is specified for
<numatune>.
<vcpu placement='auto'>10</vcpu>
<numatune>
<memory mode='interleave'/>
</numatune>
And it's also able to control the CPU placement and memory policy
independently. e.g.
1) <vcpu> placement is 'auto', and <numatune> placement is 'static'
<vcpu placement='auto'>10</vcpu>
<numatune>
<memory mode='strict' nodeset='0-10,^7'/>
</numatune>
2) <vcpu> placement is 'static', and <numatune> placement is 'auto'
<vcpu placement='static' cpuset='0-24,^12'>10</vcpu>
<numatune>
<memory mode='interleave' placement='auto'/>
</numatume>
A follow up patch will change the XML formatting codes to always output
'placement' for <vcpu>, even it's 'static'.
2012-05-08 16:04:34 +00:00
|
|
|
DO_TEST_DIFFERENT("numad-auto-vcpu-no-numatune");
|
2012-05-08 16:04:35 +00:00
|
|
|
DO_TEST_DIFFERENT("numad-auto-memory-vcpu-no-cpuset-and-placement");
|
|
|
|
DO_TEST_DIFFERENT("numad-auto-memory-vcpu-cpuset");
|
2012-05-14 10:16:22 +00:00
|
|
|
DO_TEST_DIFFERENT("usb-ich9-ehci-addr");
|
2010-07-24 22:18:18 +00:00
|
|
|
|
2012-01-24 02:26:18 +00:00
|
|
|
DO_TEST_DIFFERENT("metadata");
|
|
|
|
|
2013-04-12 20:55:46 +00:00
|
|
|
DO_TEST("tpm-passthrough");
|
2013-04-19 10:38:53 +00:00
|
|
|
DO_TEST("pci-bridge");
|
qemu: set/validate slot/connection type when assigning slots for PCI devices
Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports
all share the same namespace, they are all defined as controllers of
type='pci' in libvirt (but with a differing model attribute). Each of
these controllers has a certain connection type upstream, allows
certain connection types downstream, and each can either allow a
single downstream connection at slot 0, or connections from slot 1 -
31.
Right now, we only support the pci-root and pci-bridge devices, both
of which only allow PCI devices to connect, and both which have usable
slots 1 - 31. In preparation for adding other types of controllers
that have different capabilities, this patch 1) adds info to the
qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets
those capabilities appropriately for pci-root and pci-bridge devices,
and 3) validates that the controller being connected to is the proper
type when allocating slots or validating that a user-selected slot is
appropriate for a device..
Having this infrastructure in place will make it much easier to add
support for the other PCI controller types.
While it would be possible to do all the necessary checking by just
storing the controller model in the qemyuDomainPCIAddressBus, it
greatly simplifies all the validation code to also keep a "flags",
"minSlot" and "maxSlot" for each - that way we can just check those
attributes rather than requiring a nearly identical switch statement
everywhere we need to validate compatibility.
You may notice many places where the flags are seemingly hard-coded to
QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI
This is currently the correct value for all PCI devices, and in the
future will be the default, with small bits of code added to change to
the flags for the few devices which are the exceptions to this rule.
Finally, there are a few places with "FIXME" comments. Note that these
aren't indicating places that are broken according to the currently
supported devices, they are places that will need fixing when support
for new PCI controller models is added.
To assure that there was no regression in the auto-allocation of PCI
addresses or auto-creation of integrated pci-root, ide, and usb
controllers, a new test case (pci-bridge-many-disks) has been added to
both the qemuxml2argv and qemuxml2xml tests. This new test defines a
domain with several dozen virtio disks but no pci-root or
pci-bridges. The .args file of the new test case was created using
libvirt sources from before this patch, and the test still passes
after this patch has been applied.
2013-07-15 00:09:44 +00:00
|
|
|
DO_TEST_DIFFERENT("pci-bridge-many-disks");
|
2013-04-19 10:38:53 +00:00
|
|
|
DO_TEST_DIFFERENT("pci-autoadd-addr");
|
|
|
|
DO_TEST_DIFFERENT("pci-autoadd-idx");
|
qemu: add dmi-to-pci-bridge controller
This PCI controller, named "dmi-to-pci-bridge" in the libvirt config,
and implemented with qemu's "i82801b11-bridge" device, connects to a
PCI Express slot (e.g. one of the slots provided by the pcie-root
controller, aka "pcie.0" on the qemu commandline), and provides 31
*non-hot-pluggable* PCI (*not* PCIe) slots, numbered 1-31.
Any time a machine is defined which has a pcie-root controller
(i.e. any q35-based machinetype), libvirt will automatically add a
dmi-to-pci-bridge controller if one doesn't exist, and also add a
pci-bridge controller. The reasoning here is that any useful domain
will have either an immediate (startup time) or eventual (subsequent
hot-plug) need for a standard PCI slot; since the pcie-root controller
only provides PCIe slots, we need to connect a dmi-to-pci-bridge
controller to it in order to get a non-hot-plug PCI slot that we can
then use to connect a pci-bridge - the slots provided by the
pci-bridge will be both standard PCI and hot-pluggable.
Since pci-bridge devices themselves can not be hot-plugged into a
running system (although you can hot-plug other devices into a
pci-bridge's slots), any new pci-bridge controller that is added can
(and will) be plugged into the dmi-to-pci-bridge as long as it has
empty slots available.
This patch is also changing the qemuxml2xml-pcie test from a "DO_TEST"
to a "DO_DIFFERENT_TEST". This is so that the "before" xml can omit
the automatically added dmi-to-pci-bridge and pci-bridge devices, and
the "after" xml can include it - this way we are testing if libvirt is
properly adding these devices.
2013-07-31 01:37:32 +00:00
|
|
|
DO_TEST_DIFFERENT("pcie-root");
|
qemu: fix handling of default/implicit devices for q35
This patch adds in special handling for a few devices that need to be
treated differently for q35 domains:
usb - there is no implicit/default usb controller for the q35
machinetype. This is done because normally the default usb controller
is added to a domain by just adding "-usb" to the qemu commandline,
and it's assumed that this will add a single piix3 usb1 controller at
slot 1 function 2. That's not what happens when the machinetype is
q35, though. Instead, adding -usb to the commandline adds 3 usb
(version 2) controllers to the domain at slot 0x1D.{1,2,7}. Rather
than having
<controller type='usb' index='0'/>
translate into 3 separate devices on the PCI bus, it's cleaner to not
automatically add a default usb device; one can always be added
explicitly if desired. Or we may decide that on q35 machines, 3 usb
controllers will be automatically added when none is given. But for
this initial commit, at least we aren't locking ourselves into
something we later won't want.
video - qemu always initializes the primary video device immediately
after any integrated devices for the machinetype. Unless instructed
otherwise (by using "-device vga..." instead of "-vga" which libvirt
uses in many cases to work around deficiencies and bugs in various
qemu versions) qemu will always pick the first unused slot. In the
case of the "pc" machinetype and its derivatives, this is always slot
2, but on q35 machinetypes, the first free slot is slot 1 (since the
q35's integrated peripheral devices are placed in other slots,
e.g. slot 0x1f). In order to make the PCI address of the video device
predictable, that slot (1 or 2, depending on machinetype) is reserved
even when no video device has been specified.
sata - a q35 machine always has a sata controller implicitly added at
slot 0x1F, function 2. There is no way to avoid this controller, so we
always add it. Note that the xml2xml tests for the pcie-root and q35
cases were changed to use DO_TEST_DIFFERENT() so that we can check for
the sata controller being automatically added. This is especially
important because we can't check for it in the xml2argv output (it has
no effect on that output since it's an implicit device).
ide - q35 has no ide controllers.
isa and smbus controllers - these two are always present in a q35 (at
slot 0x1F functions 0 and 3) but we have no way of modelling them in
our config. We do need to reserve those functions so that the user
doesn't attempt to put anything else there though. (note that the "pc"
machine type also has an ISA controller, which we also ignore).
2013-08-02 08:55:55 +00:00
|
|
|
DO_TEST_DIFFERENT("q35");
|
2013-04-12 20:55:46 +00:00
|
|
|
|
qemu: Build qemu command line for scsi host device
Except the scsi host device's controller is "lsilogic", mapping
between the libvirt attributes and scsi-generic properties is:
libvirt qemu
-----------------------------------------
controller bus ($libvirt_controller.0)
bus channel
target scsi-id
unit lun
For scsi host device with "lsilogic" controller, the mapping is:
('target (libvirt)' must be 0, as it's not used; 'unit (libvirt)
must <= 7).
libvirt qemu
----------------------------------------------------------
controller && bus bus ($libvirt_controller.$libvirt_bus)
unit scsi-id
It's not good to hardcode/hard-check limits of these attributes,
and even worse, these limits are not documented, one has to find
out by either testing or reading the qemu code, I'm looking forward
to qemu expose limits like these one day). For example, exposing
"max_target", "max_lun" for megasas:
static const struct SCSIBusInfo megasas_scsi_info = {
.tcq = true,
.max_target = MFI_MAX_LD,
.max_lun = 255,
.transfer_data = megasas_xfer_complete,
.get_sg_list = megasas_get_sg_list,
.complete = megasas_command_complete,
.cancel = megasas_command_cancel,
};
Example of the qemu command line (lsilogic controller):
-drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
-device scsi-generic,bus=scsi0.0,scsi-id=8,\
drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0
Example of the qemu command line (virtio-scsi controller):
-drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=128,lun=128,\
drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0
Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
2013-05-03 18:07:23 +00:00
|
|
|
DO_TEST("hostdev-scsi-lsi");
|
|
|
|
DO_TEST("hostdev-scsi-virtio-scsi");
|
2013-05-03 18:07:25 +00:00
|
|
|
DO_TEST("hostdev-scsi-readonly");
|
2013-05-03 18:07:20 +00:00
|
|
|
|
2013-05-14 09:03:02 +00:00
|
|
|
DO_TEST("disk-copy_on_read");
|
2013-05-03 18:07:33 +00:00
|
|
|
DO_TEST("hostdev-scsi-shareable");
|
2013-05-03 18:07:40 +00:00
|
|
|
DO_TEST("hostdev-scsi-sgio");
|
2014-09-09 22:48:57 +00:00
|
|
|
DO_TEST("hostdev-scsi-rawio");
|
2013-05-14 09:03:02 +00:00
|
|
|
|
conf: Generate address for scsi host device automatically
With unknown good reasons, the attribute "bus" of scsi device
address is always set to 0, same for attribute "target". (See
virDomainDiskDefAssignAddress).
Though we might need to change the algorithm to honor "bus"
and "target" too, that's a different issue. The address generator
for scsi host device in this patch just follows the unknown
good reasons, only considering the "controller" and "unit".
It walks through all scsi controllers and their units, to see
if the address $controller:0:0:$unit can be used (if not used
by any disk or scsi host device yet), if found one, it sits on
it, otherwise, it creates a new controller (actually the controller
is implicitly created by someone else), and sits on
$new_controller:0:0:0 instead.
2013-05-31 10:09:24 +00:00
|
|
|
DO_TEST_DIFFERENT("hostdev-scsi-autogen-address");
|
|
|
|
|
2014-07-09 14:08:34 +00:00
|
|
|
DO_TEST("hostdev-scsi-lsi-iscsi");
|
|
|
|
DO_TEST("hostdev-scsi-lsi-iscsi-auth");
|
|
|
|
DO_TEST("hostdev-scsi-virtio-iscsi");
|
|
|
|
DO_TEST("hostdev-scsi-virtio-iscsi-auth");
|
|
|
|
|
2013-06-17 14:17:36 +00:00
|
|
|
DO_TEST_DIFFERENT("s390-defaultconsole");
|
|
|
|
|
2013-08-12 11:39:04 +00:00
|
|
|
DO_TEST("pcihole64");
|
|
|
|
DO_TEST_DIFFERENT("pcihole64-gib");
|
|
|
|
DO_TEST("pcihole64-none");
|
|
|
|
DO_TEST("pcihole64-q35");
|
|
|
|
|
2013-12-09 09:11:15 +00:00
|
|
|
DO_TEST("panic");
|
|
|
|
|
2014-04-17 13:37:51 +00:00
|
|
|
DO_TEST_DIFFERENT("disk-backing-chains");
|
|
|
|
|
2014-05-16 12:31:28 +00:00
|
|
|
DO_TEST("chardev-label");
|
|
|
|
|
2014-05-22 07:13:05 +00:00
|
|
|
DO_TEST_DIFFERENT("cpu-numa1");
|
|
|
|
DO_TEST_DIFFERENT("cpu-numa2");
|
2014-06-17 12:16:59 +00:00
|
|
|
DO_TEST("cpu-numa-disjoint");
|
2014-09-08 09:34:22 +00:00
|
|
|
DO_TEST("cpu-numa-memshared");
|
2014-05-22 07:13:05 +00:00
|
|
|
|
2014-06-09 13:00:22 +00:00
|
|
|
DO_TEST_DIFFERENT("numatune-auto-prefer");
|
2014-07-15 09:39:44 +00:00
|
|
|
DO_TEST_DIFFERENT("numatune-memnode");
|
|
|
|
DO_TEST("numatune-memnode-no-memory");
|
2014-06-09 13:00:22 +00:00
|
|
|
|
2014-08-06 11:18:53 +00:00
|
|
|
DO_TEST("bios-nvram");
|
|
|
|
|
2014-09-11 15:11:28 +00:00
|
|
|
DO_TEST("tap-vhost");
|
|
|
|
|
2013-02-01 12:26:18 +00:00
|
|
|
virObjectUnref(driver.caps);
|
2013-03-31 18:03:42 +00:00
|
|
|
virObjectUnref(driver.xmlopt);
|
2007-07-18 21:34:22 +00:00
|
|
|
|
2014-03-17 09:38:38 +00:00
|
|
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
2007-07-18 21:34:22 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
VIRT_TEST_MAIN(mymain)
|
|
|
|
|
2007-11-26 12:03:34 +00:00
|
|
|
#else
|
|
|
|
|
2011-07-28 15:48:12 +00:00
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
return EXIT_AM_SKIP;
|
|
|
|
}
|
2007-11-26 12:03:34 +00:00
|
|
|
|
|
|
|
#endif /* WITH_QEMU */
|