[libvirt] [PATCH v8] bhyve: add a basic driver
by Roman Bogorodskiy
Changes from v7:
- Squashed in ACL support
- Check for disk and bus type for bhyve and disk type for bhyveload
- Handle case when URI == NULL in ConnectOpen
- Call bhyveload only after we've built bhyve command to avoid
unneeded load/reload for wrong domain configuration
- Cleanup unload calls on errors
- Minor style fixes
Changes from v6:
- Fix typo: s/LIBIVRT_DRIVER_RESULT_BHYVE/LIBVIRT_DRIVER_RESULT_BHYVE/
- Report domain state in 'dominfo'
- Add a patch which implements ACL support
Now both 'make check' and 'make syntax-check' pass.
Changes from v5:
- Obtain version using uname(3)
- Cleanup driver global objects in StateCleanup instead
of ConnectClose
Changes from v4:
- Set acpi and apic flags based on domain definition
- Add more detailed description about -H and -P flags
of bhyve to justify theirs usage
Roman Bogorodskiy (1):
bhyve: add a basic driver
configure.ac | 7 +
daemon/libvirtd.c | 9 +
include/libvirt/virterror.h | 1 +
m4/virt-driver-bhyve.m4 | 57 ++++
po/POTFILES.in | 3 +
src/Makefile.am | 31 +++
src/bhyve/bhyve_command.c | 314 ++++++++++++++++++++++
src/bhyve/bhyve_command.h | 41 +++
src/bhyve/bhyve_driver.c | 625 ++++++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_driver.h | 28 ++
src/bhyve/bhyve_process.c | 227 ++++++++++++++++
src/bhyve/bhyve_process.h | 36 +++
src/bhyve/bhyve_utils.h | 48 ++++
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/driver.h | 1 +
src/libvirt.c | 3 +
src/util/virerror.c | 1 +
18 files changed, 1435 insertions(+), 1 deletion(-)
create mode 100644 m4/virt-driver-bhyve.m4
create mode 100644 src/bhyve/bhyve_command.c
create mode 100644 src/bhyve/bhyve_command.h
create mode 100644 src/bhyve/bhyve_driver.c
create mode 100644 src/bhyve/bhyve_driver.h
create mode 100644 src/bhyve/bhyve_process.c
create mode 100644 src/bhyve/bhyve_process.h
create mode 100644 src/bhyve/bhyve_utils.h
--
1.8.4.3
10 years, 9 months
[libvirt] [PATCH] RFC: Add blockdev-delete QMP command
by Ian Main
This is the sister command to blockdev-add. In Fam's example he uses
the drive_del HMP command to clean up but when trying to do this via
libvirt it doesn't work. This command seems to be needed in order to
perform proper cleanup.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
blockdev.c | 52 ++++++++++++++++++++++++++++++++++++++--------------
qapi-schema.json | 11 +++++++++++
qmp-commands.hx | 30 ++++++++++++++++++++++++++++++
3 files changed, 79 insertions(+), 14 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 7372721..d6a139a 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1733,21 +1733,9 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
}
}
-int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
+/* This is called by both do_drive_del() and qmp_blockdev_delete */
+static int drive_del_core(BlockDriverState *bs)
{
- const char *id = qdict_get_str(qdict, "id");
- BlockDriverState *bs;
-
- bs = bdrv_find(id);
- if (!bs) {
- qerror_report(QERR_DEVICE_NOT_FOUND, id);
- return -1;
- }
- if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, NULL)) {
- qerror_report(QERR_DEVICE_IN_USE, id);
- return -1;
- }
-
/* quiesce block driver; prevent further io */
bdrv_drain_all();
bdrv_flush(bs);
@@ -1771,6 +1759,25 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
return 0;
}
+int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ const char *id = qdict_get_str(qdict, "id");
+ BlockDriverState *bs;
+
+ bs = bdrv_find(id);
+ if (!bs) {
+ qerror_report(QERR_DEVICE_NOT_FOUND, id);
+ return -1;
+ }
+
+ if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, NULL)) {
+ qerror_report(QERR_DEVICE_IN_USE, id);
+ return -1;
+ }
+
+ return drive_del_core(bs);
+}
+
void qmp_block_resize(bool has_device, const char *device,
bool has_node_name, const char *node_name,
int64_t size, Error **errp)
@@ -2386,6 +2393,23 @@ fail:
qmp_output_visitor_cleanup(ov);
}
+void qmp_blockdev_delete(const char *device, Error **errp)
+{
+ BlockDriverState *bs;
+
+ bs = bdrv_find(device);
+ if (!bs) {
+ error_setg(errp, "Block device not found");
+ return;
+ }
+
+ if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, NULL)) {
+ return;
+ }
+
+ drive_del_core(bs);
+}
+
static void do_qmp_query_block_jobs_one(void *opaque, BlockDriverState *bs)
{
BlockJobInfoList **prev = opaque;
diff --git a/qapi-schema.json b/qapi-schema.json
index d22651c..ff97987 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4469,3 +4469,14 @@
# Since: 1.7
##
{ 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
+
+##
+# @blockdev-delete:
+#
+# Delete a block device.
+#
+# @device: Identifier for the block device to be deleted.
+#
+# Since: 2.0
+##
+{ 'command': 'blockdev-delete', 'data': { 'device': 'str' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index c3ee46a..be3552a 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3442,6 +3442,36 @@ Example (2):
EQMP
{
+ .name = "blockdev-delete",
+ .args_type = "device:s",
+ .mhandler.cmd_new = qmp_marshal_input_blockdev_delete,
+ },
+
+SQMP
+blockdev-delete
+------------
+
+Remove host block device. The result is that guest generated IO is no
+longer submitted against the host device underlying the disk. Once a
+drive has been deleted, the QEMU Block layer returns -EIO which results
+in IO errors in the guest for applications that are reading/writing to
+the device. These errors are always reported to the guest, regardless
+of the drive's error actions (drive options rerror, werror).
+
+Arguments:
+
+- "device": Identifier of the block device (json-string)
+
+Example (1):
+
+-> { "execute": "blockdev-snapshot-delete-internal-sync",
+ "arguments": { "device": "target0" }
+ }
+<- { "return": {} }
+
+EQMP
+
+ {
.name = "query-named-block-nodes",
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_named_block_nodes,
--
1.8.3.1
10 years, 9 months
[libvirt] [PATCH 0/3] libxl: misc trivial cleanups
by Jim Fehlig
A few trivial patches for things I noticed while working on my
upcoming patches that add job support in the libxl driver.
Jim Fehlig (3):
libxl: rename libxlCreateDomEvents to libxlDomEventsRegister
libxl: register for domain events immediately after creation
libxl: fix libxlDoDomainSave documentation
src/libxl/libxl_driver.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
--
1.8.1.4
10 years, 9 months
[libvirt] [PATCH v3 0/2] Network hooks
by Michal Privoznik
Version three.
The 1/3 from the previous round is already pushed (as it just reworks two
functions - no interesting work really).
The 1/2 from this patchset - I've moved the calling of the hook in
networkStartNetwork() a bit forward, so now it's called before writing the
network status file. This way it makes more sense.
The 2/2 has been conditionally ACKed, but I'm sending it anyway just to make
sure I got it right.
Michal Privoznik (2):
network: Introduce network hooks
network: Taint networks that are using hook script
docs/hooks.html.in | 70 +++++++++++----
src/conf/network_conf.c | 52 ++++++++++-
src/conf/network_conf.h | 17 ++++
src/libvirt_private.syms | 3 +
src/lxc/lxc_driver.c | 4 +-
src/lxc/lxc_process.c | 6 +-
src/network/bridge_driver.c | 212 +++++++++++++++++++++++++++++++++++++++++++-
src/network/bridge_driver.h | 19 ++--
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_hotplug.c | 14 +--
src/qemu/qemu_process.c | 4 +-
src/util/virhook.c | 13 ++-
src/util/virhook.h | 11 +++
13 files changed, 384 insertions(+), 43 deletions(-)
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH 0/6] arbitrary qemu event detection
by Eric Blake
Originally proposed as an RFC:
https://www.redhat.com/archives/libvir-list/2013-December/msg01100.html
Requires these patches to be reviewed first:
https://www.redhat.com/archives/libvir-list/2014-January/msg01406.html
https://www.redhat.com/archives/libvir-list/2014-January/msg01457.html
Eric Blake (6):
qemu: new API for tracking arbitrary monitor events
qemu: virsh wrapper for qemu events
qemu: create object for qemu monitor events
qemu: wire up RPC for qemu monitor events
qemu: enable monitor event reporting
qemu: enable monitor event filtering by name
daemon/libvirtd.h | 2 +
daemon/remote.c | 209 +++++++++++++++++++++++++++++++++++++++++
include/libvirt/libvirt-qemu.h | 36 ++++++-
src/conf/domain_event.c | 195 ++++++++++++++++++++++++++++++++++++++
src/conf/domain_event.h | 22 +++++
src/conf/object_event.c | 40 +++++---
src/driver.h | 17 +++-
src/libvirt-qemu.c | 121 ++++++++++++++++++++++++
src/libvirt_private.syms | 2 +
src/libvirt_qemu.syms | 6 ++
src/qemu/qemu_driver.c | 52 ++++++++++
src/qemu/qemu_monitor.c | 16 +++-
src/qemu/qemu_monitor.h | 13 ++-
src/qemu/qemu_monitor_json.c | 23 ++++-
src/qemu/qemu_process.c | 29 ++++++
src/qemu_protocol-structs | 22 +++++
src/remote/qemu_protocol.x | 50 +++++++++-
src/remote/remote_driver.c | 149 ++++++++++++++++++++++++++++-
src/rpc/gendispatch.pl | 13 +--
tools/virsh-domain.c | 193 +++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 27 +++++-
21 files changed, 1202 insertions(+), 35 deletions(-)
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCHv4 0/7] gluster snapshots and storage file operations via storage driver
by Peter Krempa
This series is a new approach to using storage driver as file operations
backend and uses the implemented functions to make snapshots on gluster work.
Most of the patches are different to the previous version due to the refactor.
Peter Krempa (7):
storage: gluster: Set volume metadata in a separate function
storage: Add APIs for internal handling of files via the storage
driver
storage: Implement file storage APIs in the default storage driver
storage: add file functions for local and block files
storage: Add storage file backends for gluster
qemu: Switch snapshot deletion to the new API functions
qemu: snapshot: Add support for external active snapshots on gluster
docs/formatsnapshot.html.in | 5 +-
docs/hvsupport.pl | 4 +-
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/check-aclrules.pl | 1 +
src/check-drivername.pl | 1 +
src/driver.h | 30 ++++-
src/libvirt_private.c | 176 ++++++++++++++++++++++++++++
src/libvirt_private.h | 61 ++++++++++
src/libvirt_private.syms | 9 ++
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_command.h | 9 ++
src/qemu/qemu_driver.c | 145 ++++++++++++++++++++---
src/storage/storage_backend.c | 42 +++++++
src/storage/storage_backend.h | 43 +++++++
src/storage/storage_backend_fs.c | 38 +++++++
src/storage/storage_backend_fs.h | 2 +
src/storage/storage_backend_gluster.c | 209 ++++++++++++++++++++++++++++++----
src/storage/storage_backend_gluster.h | 1 +
src/storage/storage_driver.c | 89 +++++++++++++++
20 files changed, 828 insertions(+), 41 deletions(-)
create mode 100644 src/libvirt_private.c
create mode 100644 src/libvirt_private.h
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH V5] Sheepdog: Adding volume and on pool and refresh.
by joel SIMOES
From: Joel SIMOES <joel.simoes(a)laposte.net>
Libvirt lose sheepdogs volumes on pool refresh or restart.
When restarting sheepdog pool, all volumes are missing.
This patch add automatically all volume from the added pool.
Adding last Daniel P. Berrange's syntaxes correction.
Adding vol on separeted function 'inspired' from parallels_storage :
parallelsAddDiskVolume
---
src/storage/storage_backend_sheepdog.c | 86 ++++++++++++++++++++++++++++++++--
1 file changed, 82 insertions(+), 4 deletions(-)
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index a6981ce..08e5473 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -109,22 +109,100 @@ virStorageBackendSheepdogAddHostArg(virCommandPtr cmd,
virCommandAddArgFormat(cmd, "%d", port);
}
+static int
+virStorageBackendSheepdogAddVolume(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolObjPtr pool, const char *diskInfo)
+{
+ virStorageVolDefPtr vol = NULL;
+
+ if (diskInfo == NULL)
+ goto error;
+
+ if (VIR_ALLOC(vol) < 0 || VIR_STRDUP(vol->name, diskInfo) < 0)
+ goto error;
+
+ vol->type = VIR_STORAGE_VOL_NETWORK;
+
+ if (VIR_EXPAND_N(pool->volumes.objs, pool->volumes.count, 1) < 0)
+ goto error;
+
+ pool->volumes.objs[pool->volumes.count - 1] = vol;
+
+ if (virStorageBackendSheepdogRefreshVol(conn, pool, vol) < 0)
+ goto error;
+
+ return 0;
+
+error:
+ virStorageVolDefFree(vol);
+ return -1;
+}
+
+static int
+virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolObjPtr pool)
+{
+ int ret = -1;
+ char *output = NULL;
+ char **lines = NULL;
+ char **cells = NULL;
+ size_t i;
+
+ virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "list", "-r", NULL);
+ virStorageBackendSheepdogAddHostArg(cmd, pool);
+ virCommandSetOutputBuffer(cmd, &output);
+ if (virCommandRun(cmd, NULL) < 0)
+ goto cleanup;
+
+ lines = virStringSplit(output, "\n", 0);
+ if (lines == NULL)
+ goto cleanup;
+
+ for (i = 0; lines[i]; i++) {
+ char *line = lines[i];
+ if (line == NULL)
+ break;
+
+ cells = virStringSplit(line, " ", 0);
+
+ if (cells != NULL && virStringListLength(cells) > 2) {
+ if (virStorageBackendSheepdogAddVolume(conn, pool, cells[1]) < 0)
+ goto cleanup;
+ }
+
+ virStringFreeList(cells);
+ cells = NULL;
+ }
+
+ ret = 0;
+
+cleanup:
+ virCommandFree(cmd);
+ virStringFreeList(lines);
+ virStringFreeList(cells);
+ return ret;
+}
+
static int
virStorageBackendSheepdogRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool)
{
- int ret;
+ int ret = -1;
char *output = NULL;
virCommandPtr cmd;
cmd = virCommandNewArgList(COLLIE, "node", "info", "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
- ret = virCommandRun(cmd, NULL);
- if (ret == 0)
- ret = virStorageBackendSheepdogParseNodeInfo(pool->def, output);
+ if (virCommandRun(cmd, NULL) < 0)
+ goto cleanup;
+ if (virStorageBackendSheepdogParseNodeInfo(pool->def, output) < 0)
+ goto cleanup;
+
+ ret = virStorageBackendSheepdogRefreshAllVol(conn, pool);
+cleanup:
virCommandFree(cmd);
VIR_FREE(output);
return ret;
--
1.8.3.2
10 years, 9 months
[libvirt] [PATCH] tests: Fix the build failure on s390
by Osier Yang
The build works fine on other architectures with commit 0b4f76fc5, but
for s390:
TEST: virscsitest
1) test1 ... OK
2) test2 ... libvirt: error : SCSI device '1:0:0:0': could not access
/builddir/build/BUILD/libvirt-1.1.1/tests/virscsidata/sg8: No such file
or directory
FAILED
It's caused by the "patch" on the s390 system either doesn't create
the "empty files", or removed them after the patch was applied. Anyway,
this patch is to fix it by simply adding useless numbers to the 2
test input files.
---
tests/virscsidata/sg0 | 1 +
tests/virscsidata/sg8 | 1 +
2 files changed, 2 insertions(+)
diff --git a/tests/virscsidata/sg0 b/tests/virscsidata/sg0
index e69de29..573541a 100644
--- a/tests/virscsidata/sg0
+++ b/tests/virscsidata/sg0
@@ -0,0 +1 @@
+0
diff --git a/tests/virscsidata/sg8 b/tests/virscsidata/sg8
index e69de29..45a4fb7 100644
--- a/tests/virscsidata/sg8
+++ b/tests/virscsidata/sg8
@@ -0,0 +1 @@
+8
--
1.8.1.4
10 years, 9 months
[libvirt] [PATCH v3 0/4] Introduce spiceport chardev backend
by Martin Kletzander
<BLURB/>
Martin Kletzander (4):
conf: introduce spiceport chardev backend
qemu: rework '-serial none'
qemu: remove pointless condition
qemu: introduce spiceport chardev backend
docs/formatdomain.html.in | 18 ++++
docs/schemas/domaincommon.rng | 4 +
src/conf/domain_audit.c | 3 +-
src/conf/domain_conf.c | 39 ++++++++-
src/conf/domain_conf.h | 6 +-
src/qemu/qemu_capabilities.c | 13 ++-
src/qemu/qemu_capabilities.h | 3 +-
src/qemu/qemu_command.c | 97 +++++++++++++---------
src/qemu/qemu_monitor_json.c | 3 +-
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
.../qemuxml2argv-serial-spiceport-nospice.args | 6 ++
.../qemuxml2argv-serial-spiceport-nospice.xml | 40 +++++++++
.../qemuxml2argv-serial-spiceport.args | 13 +++
.../qemuxml2argv-serial-spiceport.xml | 43 ++++++++++
tests/qemuxml2argvtest.c | 7 ++
tests/qemuxml2xmltest.c | 2 +
18 files changed, 253 insertions(+), 47 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport-nospice.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport-nospice.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml
--
1.8.5.4
10 years, 9 months
[libvirt] [PATCH] rbd: Use rbd_create3 to create RBD format 2 images by default
by Wido den Hollander
This new RBD format supports snapshotting and cloning. By having
libvirt create images in format 2 end-users of the created images
can benefit of the new RBD format.
Older versions of libvirt can work with this new RBD format as long
as librbd supports format 2, something that all recent versions of
librbd do.
Signed-off-by: Wido den Hollander <wido(a)widodh.nl>
---
src/storage/storage_backend_rbd.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 4b6f18c..f3dd7a0 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -435,6 +435,26 @@ cleanup:
return ret;
}
+static int virStorageBackendRBDCreateImage(rados_ioctx_t io,
+ char *name, long capacity)
+{
+ int order = 0;
+ #if LIBRBD_VERSION_CODE > 260
+ uint64_t features = 3;
+ uint64_t stripe_count = 1;
+ uint64_t stripe_unit = 4194304;
+
+ if (rbd_create3(io, name, capacity, features, &order,
+ stripe_count, stripe_unit) < 0) {
+ #else
+ if (rbd_create(io, name, capacity, &order) < 0) {
+ #endif
+ return -1;
+ }
+
+ return 0;
+}
+
static int virStorageBackendRBDCreateVol(virConnectPtr conn,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol)
@@ -442,7 +462,6 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn,
virStorageBackendRBDState ptr;
ptr.cluster = NULL;
ptr.ioctx = NULL;
- int order = 0;
int ret = -1;
VIR_DEBUG("Creating RBD image %s/%s with size %llu",
@@ -467,7 +486,7 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn,
goto cleanup;
}
- if (rbd_create(ptr.ioctx, vol->name, vol->capacity, &order) < 0) {
+ if (virStorageBackendRBDCreateImage(ptr.ioctx, vol->name, vol->capacity) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to create volume '%s/%s'"),
pool->def->source.name,
--
1.7.9.5
10 years, 9 months