[libvirt] [PATCH 00/10] Convert secret driver to use hashed object
by John Ferlan
This series replaces the usage of linked list in secret driver with a
hashed object list as was suggested in the review in the last patch of
the previous secret driver changes series:
http://www.redhat.com/archives/libvir-list/2016-February/msg01274.html
Patch 1 - starts the ball rolling
Patch 2 - is yet another code optimization (as found in bridge_driver)
Patches 3-8 - Add the new API's "slowly" (for review purposes)
Patch 9 - replaces the usage of linked lists with the hashed object
Patch 10 - moves the secretLoadAllConfigs to secret_conf
The changes are loosely modeled after both virdomainobj and network_conf
functionality. The real meat and potato(e)s is found in patches 5 and 9.
Other functions should be relatively straightforward.
I've done testing of various virsh secret-* commands (both valid and invalid
options) as well as performing driver start, stop, and reload testing.
Each patch was built using 'check' and 'syntax-check'.
The end result is much more code in secret_conf and much less in secret_driver.
John Ferlan (10):
secret: Move virSecretObj to secret_conf.h
Add secretObjFromSecret
secret: Add hashed virSecretObj and virSecretObjList
secret: Introduce virSecretObjListFindBy{UUID|Usage} support
secret: Introduce virSecretObjListAdd* and virSecretObjListRemove
secret: Introduce virSecretObjListNumOfSecrets
secret: Introduce virSecretObjListExport
secret: Introduce virSecretObjListGetUUIDs
secret: Use the hashed virSecretObjList
secret: Move and rename secretLoadAllConfigs
src/conf/secret_conf.c | 819 ++++++++++++++++++++++++++++++++++++++++++++-
src/conf/secret_conf.h | 76 ++++-
src/libvirt_private.syms | 11 +
src/secret/secret_driver.c | 647 +++--------------------------------
4 files changed, 957 insertions(+), 596 deletions(-)
--
2.5.0
8 years, 11 months
[libvirt] [RFC 0/6] Probe and expose GIC capabilities
by Andrea Bolognani
This series implements support for asking QEMU what GIC versions can
be used for guests, eg:
<features>
<gic version='2'/>
</features>
and exposing such information to users via domain capabilities.
QEMU patches that implement the query-gic-capabilities QMP command:
https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg04465.html
Cheers.
Andrea Bolognani (6):
conf: Get rid of virDomainCapsDevice
qemu: Probe GIC capabilities
schema: Validate GIC capabilities
conf: Expose GIC capabilities
qemu: Fill in GIC capabilities
qemu: Cache GIC capabilities
docs/schemas/domaincaps.rng | 18 +++
src/conf/domain_capabilities.c | 26 +++-
src/conf/domain_capabilities.h | 24 ++--
src/qemu/qemu_capabilities.c | 157 ++++++++++++++++++++-
src/qemu/qemu_monitor.c | 10 ++
src/qemu/qemu_monitor.h | 4 +
src/qemu/qemu_monitor_json.c | 90 ++++++++++++
src/qemu/qemu_monitor_json.h | 4 +
src/util/virgic.h | 13 ++
tests/domaincapsschemadata/domaincaps-basic.xml | 3 +
tests/domaincapsschemadata/domaincaps-full.xml | 3 +
.../domaincaps-qemu_1.6.50-1.xml | 3 +
tests/domaincapstest.c | 8 +-
13 files changed, 341 insertions(+), 22 deletions(-)
--
2.5.5
8 years, 11 months
[libvirt] [PATCH v4 0/2] persistent live migration with specified XML
by Dmitry Andreev
v4: wrong param name in commit msg
v3:
- use shorter name for param and rename args
- move qemuMigrationCookieAddPersistent out from
qemuMigrationBakeCookie
- rebase to master
v2: reimplemented with new migration param
Libvirt doesn't allow to specify destination persistent domain
configuration. VIR_MIGRATE_PARAM_DEST_XML migration param is used for
active configuration and persistent configuration is taken from source
domain. The problem is mentioned in this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=835300
This patch-set introduces new migration param VIR_MIGRATE_PARAM_PERSIST_XML
and implements its support in qemu driver.
Dmitry Andreev (2):
qemuMigrationCookieAddPersistent: move it out and change argument type
qemu: migration: new migration param for persistent destination XML
include/libvirt/libvirt-domain.h | 15 ++++++++++
src/qemu/qemu_driver.c | 12 +++++---
src/qemu/qemu_migration.c | 64 ++++++++++++++++++++++++----------------
src/qemu/qemu_migration.h | 2 ++
4 files changed, 63 insertions(+), 30 deletions(-)
--
1.8.3.1
8 years, 11 months
[libvirt] [PATCH] ZFS: Support sparse volumes
by Richard Laager
By default, `zfs create -V ...` reserves space for the entire volsize,
plus some extra (which attempts to account for overhead).
If `zfs create -s -V ...` is used instead, zvols are (fully) sparse.
A middle ground (partial allocation) can be achieved with
`zfs create -s -o refreservation=... -V ...`. Both libvirt and ZFS
support this approach, so the ZFS storage backend should support it.
Signed-off-by: Richard Laager <rlaager(a)wiktel.com>
---
src/storage/storage_backend_zfs.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c
index 2e6e407..6dc3cec 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -112,7 +112,7 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
if (!(tokens = virStringSplitCount(volume_string, "\t", 0, &count)))
return -1;
- if (count != 2)
+ if (count != 3)
goto cleanup;
if (!(name_tokens = virStringSplit(tokens[0], "/", 2)))
@@ -151,6 +151,20 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
goto cleanup;
}
+ if (virStrToLong_ull(tokens[2], NULL, 10, &volume->target.allocation) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed refreservation reported"));
+ goto cleanup;
+ }
+ if (volume->target.allocation >= volume->target.capacity) {
+ /* A zvol created without -s will have a refreservation slightly larger
+ * than volblocksize.
+ */
+ volume->target.allocation = volume->target.capacity;
+ } else {
+ volume->target.sparse = true;
+ }
+
if (is_new_vol &&
VIR_APPEND_ELEMENT(pool->volumes.objs,
pool->volumes.count,
@@ -190,7 +204,7 @@ virStorageBackendZFSFindVols(virStoragePoolObjPtr pool,
cmd = virCommandNewArgList(ZFS,
"list", "-Hp",
"-t", "volume", "-r",
- "-o", "name,volsize",
+ "-o", "name,volsize,refreservation",
pool->def->source.name,
NULL);
virCommandSetOutputBuffer(cmd, &volumes_list);
@@ -320,15 +334,28 @@ virStorageBackendZFSCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
goto cleanup;
/**
* $ zfs create -o volmode=dev -V 10240K test/volname
+ * $ zfs create -o volmode=dev -s -V 10240K test/volname
+ * $ zfs create -o volmode=dev -s -o refreservation=1024K -V 10240K test/volname
*
* -o volmode=dev -- we want to get volumes exposed as cdev
* devices. If we don't specify that zfs
* will lookup vfs.zfs.vol.mode sysctl value
+ * -s -- create a sparse volume
+ * -o refreservation -- reserve the specified amount of space
* -V -- tells to create a volume with the specified size
*/
cmd = virCommandNewArgList(ZFS, "create", NULL);
if (volmode_needed)
virCommandAddArgList(cmd, "-o", "volmode=dev", NULL);
+ if (vol->target.capacity != vol->target.allocation) {
+ virCommandAddArg(cmd, "-s");
+ if (vol->target.allocation > 0) {
+ virCommandAddArg(cmd, "-o");
+ virCommandAddArgFormat(cmd, "refreservation=%lluK",
+ VIR_DIV_UP(vol->target.allocation, 1024));
+ }
+ vol->target.sparse = true;
+ }
virCommandAddArg(cmd, "-V");
virCommandAddArgFormat(cmd, "%lluK",
VIR_DIV_UP(vol->target.capacity, 1024));
--
2.1.4
8 years, 11 months
[libvirt] [PATCH 0/6] vz: misc fixes
by Nikolay Shirokovskiy
Mikhail Feoktistov (2):
vz: handle sourceless cdroms
vz: fix template ct creation
Nikolay Shirokovskiy (4):
vz: remove check for auto file format for disks
vz: fix vzCheckUnsupportedDisks format checks for cdroms
vz: fix error message for readonly fs
vz: make error path code idiomatic
src/vz/vz_sdk.c | 31 ++++++++++++++++++++-----------
src/vz/vz_utils.c | 23 +++++++++--------------
2 files changed, 29 insertions(+), 25 deletions(-)
--
1.8.3.1
8 years, 12 months
[libvirt] [PATCH] virsh: support up to 64 migration options for command
by Nikolay Shirokovskiy
Upcoming compression options for migration command patch
series hits current limit of 32 possible options for a command.
Lets take one step further and support 64 possible options.
And all it takes is moving from 32 bit integers to 64 bit ones.
The only less then trivial change i found is moving from
'ffs' to 'ffsl'.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
tools/vsh.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 6bdc082..5659110 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -40,7 +40,6 @@
#include <limits.h>
#include <sys/stat.h>
#include <inttypes.h>
-#include <strings.h>
#include <signal.h>
#if WITH_READLINE
@@ -329,8 +328,8 @@ vshCmddefGetInfo(const vshCmdDef * cmd, const char *name)
/* Validate that the options associated with cmd can be parsed. */
static int
-vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
- uint32_t *opts_required)
+vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg,
+ uint64_t *opts_required)
{
size_t i;
bool optional = false;
@@ -344,7 +343,7 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
for (i = 0; cmd->opts[i].name; i++) {
const vshCmdOptDef *opt = &cmd->opts[i];
- if (i > 31)
+ if (i > 63)
return -1; /* too many options */
if (opt->type == VSH_OT_BOOL) {
optional = true;
@@ -407,7 +406,7 @@ static vshCmdOptDef helpopt = {
};
static const vshCmdOptDef *
vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
- uint32_t *opts_seen, int *opt_index, char **optstr)
+ uint64_t *opts_seen, int *opt_index, char **optstr)
{
size_t i;
const vshCmdOptDef *ret = NULL;
@@ -464,8 +463,8 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
}
static const vshCmdOptDef *
-vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
- uint32_t *opts_seen)
+vshCmddefGetData(const vshCmdDef *cmd, uint64_t *opts_need_arg,
+ uint64_t *opts_seen)
{
size_t i;
const vshCmdOptDef *opt;
@@ -474,7 +473,7 @@ vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
return NULL;
/* Grab least-significant set bit */
- i = ffs(*opts_need_arg) - 1;
+ i = ffsl(*opts_need_arg) - 1;
opt = &cmd->opts[i];
if (opt->type != VSH_OT_ARGV)
*opts_need_arg &= ~(1 << i);
@@ -486,8 +485,8 @@ vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
* Checks for required options
*/
static int
-vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint32_t opts_required,
- uint32_t opts_seen)
+vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint64_t opts_required,
+ uint64_t opts_seen)
{
const vshCmdDef *def = cmd->def;
size_t i;
@@ -598,8 +597,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
const char *desc = vshCmddefGetInfo(def, "desc");
const char *help = _(vshCmddefGetInfo(def, "help"));
char buf[256];
- uint32_t opts_need_arg;
- uint32_t opts_required;
+ uint64_t opts_need_arg;
+ uint64_t opts_required;
bool shortopt = false; /* true if 'arg' works instead of '--opt arg' */
if (vshCmddefOptParse(def, &opts_need_arg, &opts_required)) {
@@ -1350,9 +1349,9 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
const vshCmdDef *cmd = NULL;
vshCommandToken tk;
bool data_only = false;
- uint32_t opts_need_arg = 0;
- uint32_t opts_required = 0;
- uint32_t opts_seen = 0;
+ uint64_t opts_need_arg = 0;
+ uint64_t opts_required = 0;
+ uint64_t opts_seen = 0;
first = NULL;
--
1.8.3.1
8 years, 12 months
[libvirt] [PATCH 0/3] qemu: Fix hotplug of guest agent
by Martin Kletzander
Martin Kletzander (3):
qemuhotplugtest: Allow testing of live data
qemu: Move channel path generation out of command creation
qemu: Generate channel target paths on hotplug as well
src/qemu/qemu_command.c | 25 ++--------
src/qemu/qemu_command.h | 5 +-
src/qemu/qemu_domain.c | 19 +++++++
src/qemu/qemu_domain.h | 4 ++
src/qemu/qemu_hotplug.c | 3 ++
src/qemu/qemu_process.c | 12 +++--
tests/qemuhotplugtest.c | 42 ++++++++++++----
.../qemuhotplug-hotplug-base+qemu-agent-detach.xml | 58 ++++++++++++++++++++++
.../qemuhotplug-hotplug-base+qemu-agent.xml | 58 ++++++++++++++++++++++
.../qemuhotplug-qemu-agent-detach.xml | 5 ++
.../qemuhotplugtestdata/qemuhotplug-qemu-agent.xml | 5 ++
11 files changed, 197 insertions(+), 39 deletions(-)
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+qemu-agent-detach.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+qemu-agent.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-qemu-agent-detach.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-qemu-agent.xml
--
2.8.0
8 years, 12 months
[libvirt] [libxl] shutdown a domain before it finishes starting
by Zhangbo (Oscar)
Hi all:
Suppose we have a guest domain which is pvops, for example, rhel6.4.
Steps to produce the problem:
1 start the guest by virDomainCreate()
2 the API returns before the guest domain fully available, which means, the disks, network interfaces and some import services are not available inside the guest.
3 we call virDomainShutdown() to shutdown the guest.
Expected result:
The guest got shutdown.
The result in fact:
Because the guest is not available when we call virDomainShutdown(), it couldn't respond to our 'shutdown' xenstore request, the guest turns on later, rather than shutting down.
So , the question is:
In libxl_driver( xen-hypervisor environment), how can we tell that the guest is available or not, and is it suitable to shutdown the guest at that moment?
Thanks in advance.
Oscar.
8 years, 12 months
[libvirt] [PATCH] qemuxml2argvtest: Adapt to ethernet automatic tap creation
by Michal Privoznik
After 9c17d665fdc5 the tap device for ethernet network type is
automatically precreated before spawning qemu. Problem is, the
qemuxml2argvtest wasn't updated and thus is failing. Because of
all the APIs that new code is calling, I had to mock a lot. Also,
since the tap FDs are labeled separately from the rest of the
devices/files I had to enable NOP security driver for the test
too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
There are only 2 problems with this patch. All of them are in
virNetDevTapCreate mock implementation:
1) new tap device has constant name. Even within one domain
2) new tap FDs are constant. Even within one domain
I'm unable to come with better approach though. Having a static variable that
is incremented each time the mock is called would not fly as it will give
different results when combined with VIR_TEST_RANGE.
Therefore I assume we are good so far with these two limitations.
cfg.mk | 2 +-
tests/qemuhotplugtest.c | 7 ----
.../qemuxml2argv-graphics-spice-timeout.args | 2 +-
.../qemuxml2argv-net-eth-ifname.args | 2 +-
.../qemuxml2argv-net-eth-names.args | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-net-eth.args | 2 +-
tests/qemuxml2argvmock.c | 49 ++++++++++++++++++++--
tests/testutilsqemu.c | 9 ++++
8 files changed, 61 insertions(+), 16 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 6f28eef..f5573db 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1139,7 +1139,7 @@ exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
exclude_file_name_regexp--sc_flags_usage = \
- ^(docs/|src/util/virnetdevtap\.c$$|tests/(vir(cgroup|pci|usb)|nss)mock\.c$$)
+ ^(docs/|src/util/virnetdevtap\.c$$|tests/(vir(cgroup|pci|usb)|nss|qemuxml2argv)mock\.c$$)
exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
^(src/rpc/gendispatch\.pl$$|tests/)
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 2298a68..1eb2b6a 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -341,7 +341,6 @@ mymain(void)
{
int ret = 0;
struct qemuHotplugTestData data = {0};
- virSecurityManagerPtr mgr;
#if !WITH_YAJL
fputs("libvirt not compiled with yajl, skipping this test\n", stderr);
@@ -369,12 +368,6 @@ mymain(void)
if (!driver.lockManager)
return EXIT_FAILURE;
- if (!(mgr = virSecurityManagerNew("none", "qemu",
- VIR_SECURITY_MANAGER_PRIVILEGED)))
- return EXIT_FAILURE;
- if (!(driver.securityManager = virSecurityManagerNewStack(mgr)))
- return EXIT_FAILURE;
-
/* wait only 100ms for DEVICE_DELETED event */
qemuDomainRemoveDeviceWaitTime = 100;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
index 7ca17ae..8a29a7e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
@@ -26,7 +26,7 @@ id=virtio-disk0 \
media=cdrom,id=drive-ide0-1-0 \
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
-device rtl8139,vlan=0,id=net0,mac=52:54:00:71:70:89,bus=pci.0,addr=0x7 \
--net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0 \
+-net tap,fd=3,vlan=0,name=hostnet0 \
-serial pty \
-device usb-tablet,id=input0 \
-spice port=5900 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.args b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.args
index 22d6dd0..b96c933 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.args
@@ -20,4 +20,4 @@ QEMU_AUDIO_DRV=none \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device rtl8139,vlan=0,id=net0,mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \
--net tap,ifname=nic02,script=/etc/qemu-ifup,vlan=0,name=hostnet0
+-net tap,fd=3,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args
index 0704178..a2c3f87 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args
@@ -20,7 +20,7 @@ QEMU_AUDIO_DRV=none \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device rtl8139,vlan=0,id=net0,mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \
--net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0 \
+-net tap,fd=3,vlan=0,name=hostnet0 \
-device e1000,vlan=1,id=net1,mac=00:11:22:33:44:56,bus=pci.0,addr=0x4 \
--net tap,script=/etc/qemu-ifup,vlan=1,name=hostnet1 \
+-net tap,fd=3,vlan=1,name=hostnet1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth.args b/tests/qemuxml2argvdata/qemuxml2argv-net-eth.args
index b69cf52..b96c933 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-eth.args
@@ -20,4 +20,4 @@ QEMU_AUDIO_DRV=none \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device rtl8139,vlan=0,id=net0,mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \
--net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0
+-net tap,fd=3,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index b7dfebb..e2c19a6 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -21,12 +21,15 @@
#include <config.h>
#include "internal.h"
-#include "virnuma.h"
+#include "vircommand.h"
#include "virmock.h"
-#include "virutil.h"
+#include "virnetdev.h"
+#include "virnetdevtap.h"
+#include "virnuma.h"
+#include "virscsi.h"
#include "virstring.h"
#include "virtpm.h"
-#include "virscsi.h"
+#include "virutil.h"
#include <time.h>
#include <unistd.h>
@@ -98,3 +101,43 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix ATTRIBUTE_UNUSED,
ignore_value(VIR_STRDUP(ret, "sg0"));
return ret;
}
+
+int
+virNetDevTapCreate(char **ifname,
+ const char *tunpath ATTRIBUTE_UNUSED,
+ int *tapfd,
+ size_t tapfdSize,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ size_t i;
+
+ for (i = 0; i < tapfdSize; i++)
+ tapfd[i] = STDERR_FILENO + 1 + i;
+
+ return VIR_STRDUP(*ifname, "vnet0");
+}
+
+int
+virNetDevSetMAC(const char *ifname ATTRIBUTE_UNUSED,
+ const virMacAddr *macaddr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+virCommandRun(virCommandPtr cmd ATTRIBUTE_UNUSED,
+ int *exitstatus)
+{
+ if (exitstatus)
+ *exitstatus = 0;
+
+ return 0;
+}
+
+void
+virCommandPassFD(virCommandPtr cmd ATTRIBUTE_UNUSED,
+ int fd ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
+{
+ /* nada */
+}
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 1f854f5..eb4c6c8 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -555,6 +555,8 @@ int qemuTestCapsCacheInsert(virQEMUCapsCachePtr cache, const char *binary,
int qemuTestDriverInit(virQEMUDriver *driver)
{
+ virSecurityManagerPtr mgr = NULL;
+
memset(driver, 0, sizeof(*driver));
if (virMutexInit(&driver->lock) < 0)
@@ -588,9 +590,16 @@ int qemuTestDriverInit(virQEMUDriver *driver)
if (qemuTestCapsCacheInsert(driver->qemuCapsCache, "empty", NULL) < 0)
goto error;
+ if (!(mgr = virSecurityManagerNew("none", "qemu",
+ VIR_SECURITY_MANAGER_PRIVILEGED)))
+ goto error;
+ if (!(driver->securityManager = virSecurityManagerNewStack(mgr)))
+ goto error;
+
return 0;
error:
+ virObjectUnref(mgr);
qemuTestDriverFree(driver);
return -1;
}
--
2.7.3
8 years, 12 months
[libvirt] [PATCH 00/15] support for pxb and pxb-pcie controllers
by Laine Stump
These two controllers are used to create a new root bus on a 440fx
(pxb) or q35 (pxb-pie) virtual machine. There may be other use cases,
but the main reason for me taking the time to support a separate root
bus is to have assigned devices be visible in the guest on a different
NUMA node, so that the guest can be aware of the locality of the
device wrt CPU and memory that are on different NUMA nodes - although
you aren't required to, you can add a <node>N</node> subelement to the
bus' <target> element to indicate which NUMA node it is on (it's up to
the management application to place devices on that bus that really
are on the given NUMA node in the host).
There are several differences between pxb and pxb-pcie, which are
detailed in the individual commit log messages, but in short:
1) pxb is for 440fx, pxb-pcie for q35 (they *might* work on other
arches/machinetypes that have a PCI or PCIe bus, but I haven't enabled
that)
2) pxb has an integrate d pci-bridge with 32 slots that are (should
be) hotplug-capable, while pxb-pcie supplies only a single slot, and
it will only accept a pcie-root-port (which will then accept a single
device, hotplug-capable) or a pcie-switch-upstream-port.
Along the way I encountered a few minor problems/ugliness that I took
care of in patches 01/15 - 09/15. pxb support is in 10-12, and
pxb-pcie is in 13-15
There is a bugzilla record associated with this:
https://bugzilla.redhat.com/show_bug.cgi?id=1103314
Laine Stump (15):
schema: make pci slot and function optional
schema: rename uint8range/uint24range to uint8/uint24
schema: new basic type - uint16
schema: allow pci address attributes to be in decimal
conf: use #define instead of literal for highest slot in upstream port
conf: allow use of slot 0 in a dmi-to-pci-bridge
conf/qemu: change the way VIR_PCI_CONNECT_TYPE_* flags work
conf: utility function to convert PCI controller model into connect
type
qemu: set PCI controller default modelName in a separate function
qemu: add capabilities bit for device "pxb"
conf: new pci controller model pci-expander-bus
qemu: support new pci controller model "pci-expander-bus"
qemu: add capabilities bit for device "pxb-pcie"
conf: new pci controller model pcie-expander-bus
qemu: support new pci controller model "pcie-expander-bus"
docs/formatdomain.html.in | 74 +++-
docs/schemas/basictypes.rng | 63 ++--
docs/schemas/domaincommon.rng | 23 +-
docs/schemas/networkcommon.rng | 12 +-
docs/schemas/nwfilter.rng | 16 +-
src/bhyve/bhyve_device.c | 10 +-
src/conf/domain_addr.c | 119 +++++--
src/conf/domain_addr.h | 68 ++--
src/conf/domain_conf.c | 61 +++-
src/conf/domain_conf.h | 11 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 74 ++++
src/qemu/qemu_domain.c | 42 +++
src/qemu/qemu_domain_address.c | 305 +++++++++-------
tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 2 +
tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 3 +
.../qemuxml2argv-aarch64-virtio-pci-default.args | 2 +-
...l2argv-aarch64-virtio-pci-manual-addresses.args | 2 +-
.../qemuxml2argv-pci-expander-bus-bad-machine.xml | 167 +++++++++
.../qemuxml2argv-pci-expander-bus-bad-node.xml | 160 +++++++++
.../qemuxml2argv-pci-expander-bus.args | 87 +++++
.../qemuxml2argv-pci-expander-bus.xml | 167 +++++++++
.../qemuxml2argv-pcie-expander-bus-bad-machine.xml | 36 ++
.../qemuxml2argv-pcie-expander-bus.args | 123 +++++++
.../qemuxml2argv-pcie-expander-bus.xml | 247 +++++++++++++
.../qemuxml2argv-pcie-root-port.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args | 2 +-
.../qemuxml2argv-pcie-switch-downstream-port.args | 2 +-
.../qemuxml2argv-pcie-switch-upstream-port.args | 2 +-
.../qemuxml2argv-pcihole64-q35.args | 2 +-
.../qemuxml2argv-q35-pm-disable-fallback.args | 2 +-
.../qemuxml2argv-q35-pm-disable.args | 2 +-
.../qemuxml2argv-q35-usb2-multi.args | 2 +-
.../qemuxml2argv-q35-usb2-reorder.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 +-
.../qemuxml2argv-usb-controller-default-q35.args | 2 +-
.../qemuxml2argv-usb-controller-explicit-q35.args | 2 +-
tests/qemuxml2argvtest.c | 25 ++
.../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 2 +-
...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 2 +-
.../qemuxml2xmlout-pci-expander-bus.xml | 207 +++++++++++
.../qemuxml2xmlout-pcie-expander-bus.xml | 384 +++++++++++++++++++++
.../qemuxml2xmlout-pcie-root-port.xml | 2 +-
.../qemuxml2xmlout-pcie-root.xml | 2 +-
.../qemuxml2xmlout-pcie-switch-downstream-port.xml | 2 +-
.../qemuxml2xmlout-pcie-switch-upstream-port.xml | 2 +-
.../qemuxml2xmlout-pcihole64-q35.xml | 2 +-
.../qemuxml2xmlout-q35-usb2-multi.xml | 2 +-
.../qemuxml2xmlout-q35-usb2-reorder.xml | 2 +-
.../qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml | 2 +-
tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +-
tests/qemuxml2xmltest.c | 10 +
57 files changed, 2296 insertions(+), 261 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus-bad-machine.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus-bad-node.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-expander-bus-bad-machine.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-expander-bus.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-expander-bus.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-expander-bus.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-expander-bus.xml
--
2.5.5
8 years, 12 months