[PATCH v7 00/11] Configurable policy for handling deprecated interfaces
by Markus Armbruster
New option -compat lets you configure what to do when deprecated
interfaces get used. This is intended for testing users of the
management interfaces. It is experimental.
-compat deprecated-input=<in-policy> configures what to do when
deprecated input is received. Available policies:
* accept: Accept deprecated commands and arguments (default)
* reject: Reject them
* crash: Crash
-compat deprecated-output=<out-policy> configures what to do when
deprecated output is sent. Available output policies:
* accept: Emit deprecated command results and events (default)
* hide: Suppress them
For now, -compat covers only deprecated syntactic aspects of QMP. We
may want to extend it to cover semantic aspects, CLI, and experimental
features.
v7:
* Trivially rebased
* PATCH 01: New, bug fix from Paolo
* PATCH 02+11: Since: comments fixed, for real this time [Eric]
* PATCH 03+10: qobject_output_visitor_new_qmp() and
qobject_input_visitor_new_qmp() moved to qmp-dispatch.c to not break
--disable-system --disable-tools builds
* PATCH 05: Minor fallout from changed PATCH 03
* PATCH 06: Commit message typo fixed [Eric]
v6:
* Rebased, with straightforward conflicts
* PATCH 1: More verbose commit message, explaining intent, and the
lack of introspection [Peter], comments updated for 6.0, Eric's R-by
kept anyway
* PATCH 5+6: Split old PATCH 5 [Eric], Eric's R-by lept anyway
* PATCH 7: New, correcting a latent issue so it doesn't break PATCH 8
* PATCH 10: Doc fix [Eric]
v5:
* Old PATCH 01-26 merged in commit f57587c7d47.
* Rebased, non-trivial conflicts in PATCH 1 due to Meson, and in PATCH
7 due to visitor changes
* PATCH 1: Comments updated for 5.2 [Eric]
* PATCH 2: Harmless missing initialization fixed [Eric]
* PATCH 3+4: Harmless missing has_FOO = true fixed [Eric]
* PATCH 6+7: Commit message tweaked
v4:
* PATCH 05+07: Temporary memory leak plugged [Marc-André]
* PATCH 23: Rewritten [Marc-André]
* PATCH 24: Comment typo [Marc-André]
* PATCH 30: Memory leaks plugged
v3:
* Rebased, non-trivial conflicts in PATCH 01+26+27+34 due to RST
conversion and code motion
* PATCH 28-29: Old PATCH 28 split up to ease review
* PATCH 30-31: New
* PATCH 32-33: Old PATCH 29 split up to ease review
Comparison to RFC (24 Oct 2019):
* Cover arguments and results in addition to commands and events
* Half-baked "[RFC PATCH 18/19] qapi: Include a warning in the
response to a deprecated command" dropped
See also last item of
Subject: Minutes of KVM Forum BoF on deprecating stuff
Date: Fri, 26 Oct 2018 16:03:51 +0200
Message-ID: <87mur0ls8o.fsf(a)dusky.pond.sub.org>
https://lists.nongnu.org/archive/html/qemu-devel/2018-10/msg05828.html
Cc: Lukáš Doktor <ldoktor(a)redhat.com>
Cc: libguestfs(a)redhat.com
Cc: libvir-list(a)redhat.com
Cc: Daniel P. Berrange <berrange(a)redhat.com>
Cc: Peter Krempa <pkrempa(a)redhat.com>
Cc: Kevin Wolf <kwolf(a)redhat.com>
Markus Armbruster (10):
qemu-options: New -compat to set policy for deprecated interfaces
qapi: Implement deprecated-output=hide for QMP command results
qapi: Implement deprecated-output=hide for QMP events
qapi: Implement deprecated-output=hide for QMP event data
monitor: Drop query-qmp-schema 'gen': false hack
qapi: Implement deprecated-output=hide for QMP introspection
test-util-sockets: Add stub for monitor_set_cur()
qapi: Implement deprecated-input=reject for QMP commands
qapi: Implement deprecated-input=reject for QMP command arguments
qapi: New -compat deprecated-input=crash
Paolo Bonzini (1):
qemuutil: remove qemu_set_fd_handler duplicate symbol
qapi/compat.json | 52 ++++++++++++
qapi/introspect.json | 2 +-
qapi/qapi-schema.json | 1 +
include/qapi/compat-policy.h | 38 +++++++++
include/qapi/qmp/dispatch.h | 1 +
include/qapi/qobject-input-visitor.h | 4 +
include/qapi/qobject-output-visitor.h | 4 +
include/qapi/visitor-impl.h | 6 ++
include/qapi/visitor.h | 18 +++++
monitor/monitor-internal.h | 3 -
monitor/misc.c | 2 -
monitor/qmp-cmds-control.c | 100 +++++++++++++++++++++---
qapi/qapi-visit-core.c | 18 +++++
qapi/qmp-dispatch.c | 35 +++++++++
qapi/qobject-input-visitor.c | 29 +++++++
qapi/qobject-output-visitor.c | 19 +++++
softmmu/vl.c | 17 ++++
storage-daemon/qemu-storage-daemon.c | 2 -
stubs/set-fd-handler.c | 10 ---
tests/unit/test-qmp-cmds.c | 91 +++++++++++++++++++--
tests/unit/test-qmp-event.c | 41 ++++++++++
tests/unit/test-util-sockets.c | 1 +
qapi/meson.build | 1 +
qapi/trace-events | 2 +
qemu-options.hx | 22 ++++++
scripts/qapi/commands.py | 17 ++--
scripts/qapi/events.py | 21 ++++-
scripts/qapi/visit.py | 15 ++++
stubs/meson.build | 1 -
tests/qapi-schema/qapi-schema-test.json | 20 +++--
tests/qapi-schema/qapi-schema-test.out | 20 ++---
31 files changed, 549 insertions(+), 64 deletions(-)
create mode 100644 qapi/compat.json
create mode 100644 include/qapi/compat-policy.h
delete mode 100644 stubs/set-fd-handler.c
--
2.26.3
3 years, 9 months
[PATCH v6 00/10] Configurable policy for handling deprecated interfaces
by Markus Armbruster
New option -compat lets you configure what to do when deprecated
interfaces get used. This is intended for testing users of the
management interfaces. It is experimental.
-compat deprecated-input=<in-policy> configures what to do when
deprecated input is received. Available policies:
* accept: Accept deprecated commands and arguments (default)
* reject: Reject them
* crash: Crash
-compat deprecated-output=<out-policy> configures what to do when
deprecated output is sent. Available output policies:
* accept: Emit deprecated command results and events (default)
* hide: Suppress them
For now, -compat covers only deprecated syntactic aspects of QMP. We
may want to extend it to cover semantic aspects, CLI, and experimental
features.
v6:
* Rebased, with straightforward conflicts
* PATCH 1: More verbose commit message, explaining intent, and the
lack of introspection [Peter], comments updated for 6.0, Eric's R-by
kept anyway
* PATCH 5+6: Split old PATCH 5 [Eric], Eric's R-by lept anyway
* PATCH 7: New, correcting a latent issue so it doesn't break PATCH 8
* PATCH 10: Doc fix [Eric]
v5:
* Old PATCH 01-26 merged in commit f57587c7d47.
* Rebased, non-trivial conflicts in PATCH 1 due to Meson, and in PATCH
7 due to visitor changes
* PATCH 1: Comments updated for 5.2 [Eric]
* PATCH 2: Harmless missing initialization fixed [Eric]
* PATCH 3+4: Harmless missing has_FOO = true fixed [Eric]
* PATCH 6+7: Commit message tweaked
v4:
* PATCH 05+07: Temporary memory leak plugged [Marc-André]
* PATCH 23: Rewritten [Marc-André]
* PATCH 24: Comment typo [Marc-André]
* PATCH 30: Memory leaks plugged
v3:
* Rebased, non-trivial conflicts in PATCH 01+26+27+34 due to RST
conversion and code motion
* PATCH 28-29: Old PATCH 28 split up to ease review
* PATCH 30-31: New
* PATCH 32-33: Old PATCH 29 split up to ease review
Comparison to RFC (24 Oct 2019):
* Cover arguments and results in addition to commands and events
* Half-baked "[RFC PATCH 18/19] qapi: Include a warning in the
response to a deprecated command" dropped
See also last item of
Subject: Minutes of KVM Forum BoF on deprecating stuff
Date: Fri, 26 Oct 2018 16:03:51 +0200
Message-ID: <87mur0ls8o.fsf(a)dusky.pond.sub.org>
https://lists.nongnu.org/archive/html/qemu-devel/2018-10/msg05828.html
Cc: Lukáš Doktor <ldoktor(a)redhat.com>
Cc: libguestfs(a)redhat.com
Cc: libvir-list(a)redhat.com
Cc: Daniel P. Berrange <berrange(a)redhat.com>
Cc: Peter Krempa <pkrempa(a)redhat.com>
Cc: Kevin Wolf <kwolf(a)redhat.com>
Markus Armbruster (10):
qemu-options: New -compat to set policy for deprecated interfaces
qapi: Implement deprecated-output=hide for QMP command results
qapi: Implement deprecated-output=hide for QMP events
qapi: Implement deprecated-output=hide for QMP event data
monitor: Drop query-qmp-schema 'gen': false hack
qapi: Implement deprecated-output=hide for QMP introspection
test-util-sockets: Add stub for monitor_set_cur()
qapi: Implement deprecated-input=reject for QMP commands
qapi: Implement deprecated-input=reject for QMP command arguments
qapi: New -compat deprecated-input=crash
qapi/compat.json | 52 ++++++++++++
qapi/introspect.json | 2 +-
qapi/qapi-schema.json | 1 +
include/qapi/compat-policy.h | 20 +++++
include/qapi/qmp/dispatch.h | 1 +
include/qapi/qobject-input-visitor.h | 9 +++
include/qapi/qobject-output-visitor.h | 9 +++
include/qapi/visitor-impl.h | 6 ++
include/qapi/visitor.h | 18 +++++
monitor/monitor-internal.h | 3 -
monitor/misc.c | 2 -
monitor/qmp-cmds-control.c | 100 +++++++++++++++++++++---
qapi/qapi-visit-core.c | 18 +++++
qapi/qmp-dispatch.c | 17 ++++
qapi/qobject-input-visitor.c | 29 +++++++
qapi/qobject-output-visitor.c | 19 +++++
softmmu/vl.c | 17 ++++
storage-daemon/qemu-storage-daemon.c | 2 -
tests/test-qmp-cmds.c | 91 +++++++++++++++++++--
tests/test-qmp-event.c | 41 ++++++++++
tests/test-util-sockets.c | 1 +
qapi/meson.build | 1 +
qapi/trace-events | 2 +
qemu-options.hx | 22 ++++++
scripts/qapi/commands.py | 14 ++--
scripts/qapi/events.py | 20 ++++-
scripts/qapi/visit.py | 15 ++++
tests/qapi-schema/qapi-schema-test.json | 20 +++--
tests/qapi-schema/qapi-schema-test.out | 20 ++---
29 files changed, 522 insertions(+), 50 deletions(-)
create mode 100644 qapi/compat.json
create mode 100644 include/qapi/compat-policy.h
--
2.26.2
3 years, 9 months
[nbdkit PATCH v3 00/16] Add multi-conn filter, make filter context more flexible
by Eric Blake
In v2, I had made the multi-conn filter possible by reverting several
patches to make the handle of filters.c a local struct instead of
reusing 'struct backend *' from internal.h, and Rich (rightly)
complained that it felt like a step backwards. That forced me to
rethink about what filters really want, and ultimately (mostly)
implement one of our TODO items about letting a filter be able to
probe the backend separately from waiting for a connection from the
client. I still have more work to do to get the ext2 filter where I
want (while .after_fork is a great place to start a thread, we also
need a place to end that thread gracefully before .unload, since right
now .unload iterates inner-to-outer but cleanup must be done
outer-to-inner). But this series has taken me all week to get to this
point, so I'll post the progress I've made so far.
Eric Blake (16):
filters: Slightly reduce promise of nxdata lifetime
filters: Temporarily make next_ops->reopen a public function
server: Move default_exportname from handle to connection
server: Rename struct handle to struct context
server: Update signature of backend_open
backend: Inline reset_context
server: Manage contexts by backend, not int
backend: Plumb context through internal callbacks
filters: Use struct context for next_ops
server: Store nbdkit_next_ops in struct context
filters: Use context rather than connection to track c_next
filters: New API for plugin context management
ext2: Simplify use of next_ops
filters: Adjust API for type-safety and merged next_ops/nxdata
multi-conn: New filter
multi-conn: Knob to limit consistency emulation by export name
docs/nbdkit-filter.pod | 349 +++++++-----
filters/cache/nbdkit-cache-filter.pod | 5 +-
filters/fua/nbdkit-fua-filter.pod | 7 +
.../multi-conn/nbdkit-multi-conn-filter.pod | 201 +++++++
filters/nocache/nbdkit-nocache-filter.pod | 1 +
filters/noextents/nbdkit-noextents-filter.pod | 1 +
.../noparallel/nbdkit-noparallel-filter.pod | 1 +
filters/nozero/nbdkit-nozero-filter.pod | 1 +
include/nbdkit-filter.h | 125 +++--
configure.ac | 4 +-
filters/multi-conn/Makefile.am | 68 +++
tests/Makefile.am | 11 +
server/internal.h | 147 ++---
server/backend.c | 458 ++++++++--------
server/connections.c | 25 +-
server/extents.c | 21 +-
server/filters.c | 251 +++++----
server/nbdkit.syms | 12 +-
server/plugins.c | 141 +++--
server/protocol-handshake-newstyle.c | 23 +-
server/protocol-handshake.c | 29 +-
server/protocol.c | 23 +-
filters/cache/blk.h | 16 +-
filters/cow/blk.h | 8 +-
filters/ext2/io.h | 11 +-
filters/partition/partition.h | 4 +-
filters/xz/xzfile.h | 6 +-
filters/blocksize/blocksize.c | 76 ++-
filters/cache/blk.c | 16 +-
filters/cache/cache.c | 94 ++--
filters/cacheextents/cacheextents.c | 16 +-
filters/checkwrite/checkwrite.c | 32 +-
filters/cow/blk.c | 10 +-
filters/cow/cow.c | 80 +--
filters/ddrescue/ddrescue.c | 10 +-
filters/delay/delay.c | 30 +-
filters/error/error.c | 26 +-
filters/exitlast/exitlast.c | 2 +-
filters/exitwhen/exitwhen.c | 11 +-
filters/exportname/exportname.c | 14 +-
filters/ext2/ext2.c | 56 +-
filters/ext2/io.c | 73 ++-
filters/extentlist/extentlist.c | 11 +-
filters/fua/fua.c | 38 +-
filters/gzip/gzip.c | 32 +-
filters/ip/ip.c | 7 +-
filters/limit/limit.c | 2 +-
filters/log/log.c | 63 +--
filters/multi-conn/multi-conn.c | 515 ++++++++++++++++++
filters/nocache/nocache.c | 6 +-
filters/noextents/noextents.c | 2 +-
filters/noparallel/noparallel.c | 2 +-
filters/nozero/nozero.c | 22 +-
filters/offset/offset.c | 33 +-
filters/partition/partition-gpt.c | 7 +-
filters/partition/partition-mbr.c | 5 +-
filters/partition/partition.c | 52 +-
filters/pause/pause.c | 31 +-
filters/rate/rate.c | 15 +-
filters/readahead/readahead.c | 39 +-
filters/retry/retry.c | 130 +++--
filters/stats/stats.c | 36 +-
filters/swab/swab.c | 32 +-
filters/tar/tar.c | 51 +-
filters/tls-fallback/tls-fallback.c | 50 +-
filters/truncate/truncate.c | 50 +-
filters/xz/xz.c | 28 +-
filters/xz/xzfile.c | 45 +-
tests/test-multi-conn-name.sh | 88 +++
tests/test-multi-conn-plugin.sh | 141 +++++
tests/test-multi-conn.sh | 293 ++++++++++
tests/test-truncate4.sh | 2 +-
tests/test-layers-filter.c | 153 +++---
TODO | 43 +-
74 files changed, 3015 insertions(+), 1504 deletions(-)
create mode 100644 filters/multi-conn/nbdkit-multi-conn-filter.pod
create mode 100644 filters/multi-conn/Makefile.am
create mode 100644 filters/multi-conn/multi-conn.c
create mode 100755 tests/test-multi-conn-name.sh
create mode 100755 tests/test-multi-conn-plugin.sh
create mode 100755 tests/test-multi-conn.sh
--
2.30.1
3 years, 9 months
Splitting up virt-v2v
by Richard W.M. Jones
For a long time I've wanted to split up virt-v2v into smaller
components to make it easier to consume. It's never been clear how to
do this, but I think I have a workable plan now, described in this email.
----------------------------------------------------------------------
First, the AIMS, which are:
(a) Preserve current functionality, including copying conversion,
in-place conversion, and the virt-v2v command line.
(b) Allow warm migration to use virt-v2v without requiring the
"--debug-overlays hack".
(c) Allow threads, multi-conn, and parallel copying of guest disks, all
for better copying performance.
(d) Allow an alternate supervisor to convert and copy many guests in
parallel, given that the supervisor has a global view of the
system/network (I'm not intending to implement this, only to make
it possible).
(e) Better progress bars.
(f) Better logging.
(g) Reuse as much existing code as possible. This is NOT a rewrite!
----------------------------------------------------------------------
Here's my PLAN:
/usr/bin/virt-v2v still exists, but it's now a supervisor program
(possibly even a shell script) that runs the steps below:
(1) Set up the input side by running "helper-v2v-input-<type>". For
all input types this creates a temporary directory containing:
/tmp/XXXXXX/in1 NBD endpoints overlaying the source disk(s)
/tmp/XXXXXX/in2 (these are actually Unix domain sockets)
/tmp/XXXXXX/in3
/tmp/XXXXXX/metadata.in Metadata parsed from the source.
Currently for most inputs we have a running nbdkit process for
each source disk, and we'd do the same here, except we add
nbdkit-cow-filter on top so that the source disk is protected from
being modified. Another small difference is that for -i disk
(local input) we would need an active nbdkit process on top of the
disk, whereas currently we set the disk as a qcow2 backing file.
(2) Perform the conversion by running "helper-v2v-convert". This does
the conversion and sparsification. It writes directly to the NBD
endpoints (in*) above. The writes are stored in the COW overlay
so the source disk is not modified.
Conversion will also create an output metadata file:
/tmp/XXXXXX/metadata.out Target metadata
Exact format of the metadata files is to be decided, but some kind
of not-quite-libvirt-XML may be suitable. It's also not clear if
the metadata format is an internal detail of virt-v2v, or if we
document it as a stable API.
(3) Set up the output side by running "helper-v2v-output-<type>
setup". This will read the output metadata and do whatever is
needed to set up the empty output disks (perhaps by creating a
guest on the target, but also this could be done in step (5)
below).
This will create:
/tmp/XXXXXX/out1 NBD endpoints overlaying the target disk(s)
/tmp/XXXXXX/out2 (these are actually Unix domain sockets)
/tmp/XXXXXX/out3
(4) Do the copy. By default this will run either nbdcopy or qemu-img
convert from in* -> out*.
Copying could be done in parallel, currently it is done serially.
(5) Finalize the output by running "helper-v2v-output-<type> final".
This might create the target guest and whatever else is needed.
(6) Kill the NBD servers and clean up the temporary directory.
----------------------------------------------------------------------
Let's see how this plan matches the aims.
Aim (a):
Copying conversion works as outlined above. In-place conversion
works by placing an NBD server on top of the files you want to
convert and running helper-v2v-convert (virt-v2v --in-place would
also still work for backwards compat).
Aim (b):
Warm migration: Should be fairly clear this can work in the same way
as in-place conversion, but I'll discuss this further with Martin K
and Tomas to make sure I'm not missing anything.
Aims (c), (d):
Threads etc for performance: Although I don't plan to implement
this, it's clear that an alternate supervisor program could improve
performance here by either doing copies of a single guest / multiple
disks in parallel, but even better by having a global view of the
system and doing copies of multiple guests' disks in parallel.
This is outside the scope of the virt-v2v project, but in scope for
something like MTV.
Aim (e):
Better progress bars: nbdcopy should have support for
machine-readable progress bars, once I push the changes. It will
mean no more need to parse debug logs.
Aim (f):
Better logging: I hope we can log each step separately.
A custom supervisor program would also be able to tell which
particular step failed (eg. did it fail in conversion? did it fail
copying a disk and which one?)
Aim (g):
This works by splitting up the existing v2v code base into separate
binaries. It is already broadly structured (internally) like this.
So it's not a rewrite, it's a big refactoring.
However I'd probably write a new virt-v2v supervisor binary, because
the existing command line parsing code is extremely complex.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
3 years, 9 months
libguestfs now depends on PCRE2 (instead of PCRE)
by Richard W.M. Jones
PCRE ("Perl Compatible Regular Expressions") is a required dependency
for libguestfs, guestfs-tools and virt-v2v. We use it extensively
throughout the code for regular expression stuff, and even maintain
our own OCaml bindings.
The original PCRE (v1) was deprecated upstream a few years ago. It's
now only maintained for critical bugs.
Therefore I have migrated everything over to PCRE2 -- quite a
significant change actually. So you'll need to adjust your
dependencies accordingly. PCRE2 seems to be as widely available as
PCRE (v1) so this shouldn't be a problem, although let me know if it
causes any issues.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
3 years, 9 months
[PATCH v2 libguestfs] launch: libvirt, direct: Add force_kvm backend setting.
by Sam Eiderman
By using:
export LIBGUESTFS_BACKEND_SETTINGS=force_kvm
you can force the backend to use KVM and never fall back to
TCG (software emulation).
---
lib/guestfs.pod | 9 +++++++++
lib/launch-direct.c | 26 +++++++++++++++++++++++---
lib/launch-libvirt.c | 15 ++++++++++++++-
3 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index d746a41b1..a17e2e689 100644
--- a/lib/guestfs.pod
+++ b/lib/guestfs.pod
@@ -1529,6 +1529,15 @@ Using:
will force the direct and libvirt backends to use TCG (software
emulation) instead of KVM (hardware accelerated virtualization).
+=head3 force_kvm
+
+Using:
+
+ export LIBGUESTFS_BACKEND_SETTINGS=force_kvm
+
+will force the direct and libvirt backends to use KVM (hardware
+accelerated virtualization) instead of TCG (software emulation).
+
=head3 gdb
The direct backend supports:
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index b6ed9766f..aae5b8f4b 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -385,6 +385,8 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
struct hv_param *hp;
bool has_kvm;
int force_tcg;
+ int force_kvm;
+ const char *accel_val = "kvm:tcg";
const char *cpu_model;
CLEANUP_FREE char *append = NULL;
CLEANUP_FREE_STRING_LIST char **argv = NULL;
@@ -433,9 +435,27 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
force_tcg = guestfs_int_get_backend_setting_bool (g, "force_tcg");
if (force_tcg == -1)
return -1;
+ else if (force_tcg)
+ accel_val = "tcg";
- if (!has_kvm && !force_tcg)
- debian_kvm_warning (g);
+ force_kvm = guestfs_int_get_backend_setting_bool (g, "force_kvm");
+ if (force_kvm == -1)
+ return -1;
+ else if (force_kvm)
+ accel_val = "kvm";
+
+ if (force_kvm && force_tcg) {
+ error (g, "Both force_kvm and force_tcg backend settings supplied.");
+ return -1;
+ }
+ if (!has_kvm) {
+ if (!force_tcg)
+ debian_kvm_warning (g);
+ if (force_kvm) {
+ error (g, "force_kvm supplied but kvm not available.");
+ return -1;
+ }
+ }
/* Using virtio-serial, we need to create a local Unix domain socket
* for qemu to connect to.
@@ -530,7 +550,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
if (has_kvm && !force_tcg)
append_list ("gic-version=host");
#endif
- append_list_format ("accel=%s", !force_tcg ? "kvm:tcg" : "tcg");
+ append_list_format ("accel=%s", accel_val);
} end_list ();
cpu_model = guestfs_int_get_cpu_model (has_kvm && !force_tcg);
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index 6c0cfe937..a52f6ec4f 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -773,6 +773,7 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
xmlAttrPtr attr;
size_t seen_qemu, seen_kvm;
int force_tcg;
+ int force_kvm;
doc = xmlReadMemory (capabilities_xml, strlen (capabilities_xml),
NULL, NULL, XML_PARSE_NONET);
@@ -820,11 +821,15 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
}
}
+ force_kvm = guestfs_int_get_backend_setting_bool (g, "force_kvm");
+ if (force_kvm == -1)
+ return -1;
+
/* This was RHBZ#886915: in that case the default libvirt URI
* pointed to a Xen hypervisor, and so could not create the
* appliance VM.
*/
- if (!seen_qemu && !seen_kvm) {
+ if ((!seen_qemu || force_kvm) && !seen_kvm) {
CLEANUP_FREE char *backend = guestfs_get_backend (g);
error (g,
@@ -846,6 +851,14 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
if (force_tcg == -1)
return -1;
+ if (force_kvm && force_tcg) {
+ error (g, "Both force_kvm and force_tcg backend settings supplied.");
+ return -1;
+ }
+
+ /* if force_kvm then seen_kvm */
+ assert (!force_kvm || seen_kvm);
+
if (!force_tcg)
data->is_kvm = seen_kvm;
else
--
2.31.0.rc2.261.g7f71774620-goog
3 years, 9 months
[PATCH] v2v: support configuration of viosock driver
by Valeriy Vdovin
Check that install_drivers function has copied viosock driver files to
the windows guest file system. If positive, this means the drivers have
passed minor/major version check and the guest is able to use them.
After we know that that the drivers are on the guest, we can enable
virtio sock option in configuration and starting script files.
Signed-off-by: Valeriy Vdovin <valeriy.vdovin(a)virtuozzo.com>
---
v2v/convert_linux.ml | 1 +
v2v/convert_windows.ml | 4 +++-
v2v/create_json.ml | 1 +
v2v/create_libvirt_xml.ml | 6 ++++++
v2v/linux_kernels.ml | 4 ++++
v2v/linux_kernels.mli | 1 +
v2v/output_qemu.ml | 4 ++++
v2v/types.ml | 1 +
v2v/types.mli | 2 +-
v2v/windows_virtio.ml | 5 +++--
v2v/windows_virtio.mli | 2 +-
11 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 86d387f1..9f22fe3c 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -154,6 +154,7 @@ let convert (g : G.guestfs) inspect source_disks output rcaps _ =
gcaps_virtio_rng = kernel.ki_supports_virtio_rng;
gcaps_virtio_balloon = kernel.ki_supports_virtio_balloon;
gcaps_isa_pvpanic = kernel.ki_supports_isa_pvpanic;
+ gcaps_virtio_socket = kernel.ki_supports_virtio_socket;
gcaps_machine = machine;
gcaps_arch = Utils.kvm_arch inspect.i_arch;
gcaps_acpi = acpi;
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index b452c09b..7842f443 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -214,7 +214,8 @@ let convert (g : G.guestfs) inspect _ output rcaps static_ips =
video_driver,
virtio_rng_supported,
virtio_ballon_supported,
- isa_pvpanic_supported =
+ isa_pvpanic_supported,
+ virtio_socket_supported =
Registry.with_hive_write g inspect.i_windows_system_hive
update_system_hive in
@@ -256,6 +257,7 @@ let convert (g : G.guestfs) inspect _ output rcaps static_ips =
gcaps_virtio_rng = virtio_rng_supported;
gcaps_virtio_balloon = virtio_ballon_supported;
gcaps_isa_pvpanic = isa_pvpanic_supported;
+ gcaps_virtio_socket = virtio_socket_supported;
gcaps_machine = machine;
gcaps_arch = Utils.kvm_arch inspect.i_arch;
gcaps_acpi = true;
diff --git a/v2v/create_json.ml b/v2v/create_json.ml
index fdf7b12f..316a5536 100644
--- a/v2v/create_json.ml
+++ b/v2v/create_json.ml
@@ -229,6 +229,7 @@ let create_json_metadata source targets target_buses
"virtio-rng", JSON.Bool guestcaps.gcaps_virtio_rng;
"virtio-balloon", JSON.Bool guestcaps.gcaps_virtio_balloon;
"isa-pvpanic", JSON.Bool guestcaps.gcaps_isa_pvpanic;
+ "virtio-socket", JSON.Bool guestcaps.gcaps_virtio_socket;
"acpi", JSON.Bool guestcaps.gcaps_acpi;
] in
List.push_back doc ("guestcaps", JSON.Dict guestcaps_dict);
diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
index 212ace2d..6a764cb2 100644
--- a/v2v/create_libvirt_xml.ml
+++ b/v2v/create_libvirt_xml.ml
@@ -521,6 +521,12 @@ let create_libvirt_xml ?pool source targets target_buses guestcaps
e "address" ["type", "isa"; "iobase", "0x505"] []
]
);
+ List.push_back devices (
+ e "viosock"
+ ["model",
+ if guestcaps.gcaps_virtio_socket then "virtio" else "none"]
+ []
+ );
(* Standard devices added to every guest. *)
List.push_back_list devices [
diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml
index 7e171eae..6dead217 100644
--- a/v2v/linux_kernels.ml
+++ b/v2v/linux_kernels.ml
@@ -44,6 +44,7 @@ type kernel_info = {
ki_supports_virtio_rng : bool;
ki_supports_virtio_balloon : bool;
ki_supports_isa_pvpanic : bool;
+ ki_supports_virtio_socket : bool;
ki_is_xen_pv_only_kernel : bool;
ki_is_debug : bool;
ki_config_file : string option;
@@ -246,6 +247,8 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
kernel_supports "virtio_balloon" "VIRTIO_BALLOON" in
let supports_isa_pvpanic =
kernel_supports "pvpanic" "PVPANIC" in
+ let supports_virtio_socket =
+ kernel_supports "virtio_socket" "VIRTIO_SOCKET" in
let is_xen_pv_only_kernel =
check_config "X86_XEN" config_file ||
check_config "X86_64_XEN" config_file in
@@ -272,6 +275,7 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
ki_supports_virtio_rng = supports_virtio_rng;
ki_supports_virtio_balloon = supports_virtio_balloon;
ki_supports_isa_pvpanic = supports_isa_pvpanic;
+ ki_supports_virtio_socket = supports_virtio_socket;
ki_is_xen_pv_only_kernel = is_xen_pv_only_kernel;
ki_is_debug = is_debug;
ki_config_file = config_file;
diff --git a/v2v/linux_kernels.mli b/v2v/linux_kernels.mli
index 028eba81..fe81a036 100644
--- a/v2v/linux_kernels.mli
+++ b/v2v/linux_kernels.mli
@@ -33,6 +33,7 @@ type kernel_info = {
ki_supports_virtio_rng : bool; (** Kernel supports virtio-rng? *)
ki_supports_virtio_balloon : bool; (** Kernel supports memory balloon? *)
ki_supports_isa_pvpanic : bool; (** Kernel supports ISA pvpanic device? *)
+ ki_supports_virtio_socket : bool; (** Kernel supports virtio-socket? *)
ki_is_xen_pv_only_kernel : bool; (** Is a Xen paravirt-only kernel? *)
ki_is_debug : bool; (** Is debug kernel? *)
ki_config_file : string option; (** Path of config file, if found. *)
diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
index be3a3c5e..d6d70c23 100644
--- a/v2v/output_qemu.ml
+++ b/v2v/output_qemu.ml
@@ -247,6 +247,10 @@ object
arg "-balloon" "none";
if guestcaps.gcaps_isa_pvpanic then
arg_list "-device" ["pvpanic"; "ioport=0x505"];
+ if guestcaps.gcaps_virtio_socket then
+ arg "-viosock" "virtio"
+ else
+ arg "-viosock" "none";
(* Add a serial console to Linux guests. *)
if inspect.i_type = "linux" then
diff --git a/v2v/types.ml b/v2v/types.ml
index a8949e4b..4c7ee864 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -411,6 +411,7 @@ type guestcaps = {
gcaps_virtio_rng : bool;
gcaps_virtio_balloon : bool;
gcaps_isa_pvpanic : bool;
+ gcaps_virtio_socket : bool;
gcaps_machine : guestcaps_machine;
gcaps_arch : string;
gcaps_acpi : bool;
diff --git a/v2v/types.mli b/v2v/types.mli
index f474dcaa..42a80d9d 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -252,7 +252,7 @@ type guestcaps = {
gcaps_virtio_rng : bool; (** Guest supports virtio-rng. *)
gcaps_virtio_balloon : bool; (** Guest supports virtio balloon. *)
gcaps_isa_pvpanic : bool; (** Guest supports ISA pvpanic device. *)
-
+ gcaps_virtio_socket : bool; (** Guest supports virtio socket. *)
gcaps_machine : guestcaps_machine; (** Machine model. *)
gcaps_arch : string; (** Architecture that KVM must emulate. *)
gcaps_acpi : bool; (** True if guest supports acpi. *)
diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
index 74a43cc7..cf417a45 100644
--- a/v2v/windows_virtio.ml
+++ b/v2v/windows_virtio.ml
@@ -68,7 +68,7 @@ let rec install_drivers ((g, _) as reg) inspect rcaps =
match net_type with
| Some model -> model
| None -> RTL8139 in
- (IDE, net_type, Cirrus, false, false, false)
+ (IDE, net_type, Cirrus, false, false, false, false)
)
else (
(* Can we install the block driver? *)
@@ -178,9 +178,10 @@ let rec install_drivers ((g, _) as reg) inspect rcaps =
let virtio_rng_supported = g#exists (driverdir // "viorng.inf") in
let virtio_ballon_supported = g#exists (driverdir // "balloon.inf") in
let isa_pvpanic_supported = g#exists (driverdir // "pvpanic.inf") in
+ let virtio_socket_supported = g#exists (driverdir // "viosock.inf") in
(block, net, video,
- virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported)
+ virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported, virtio_socket_supported)
)
and install_linux_tools g inspect =
diff --git a/v2v/windows_virtio.mli b/v2v/windows_virtio.mli
index c063af3f..642317b1 100644
--- a/v2v/windows_virtio.mli
+++ b/v2v/windows_virtio.mli
@@ -20,7 +20,7 @@
val install_drivers
: Registry.t -> Types.inspect -> Types.requested_guestcaps ->
- Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type * bool * bool * bool
+ Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type * bool * bool * bool * bool
(** [install_drivers reg inspect rcaps]
installs virtio drivers from the driver directory or driver
ISO into the guest driver directory and updates the registry
--
2.27.0
3 years, 9 months
[PATCH v3 libguestfs] launch: libvirt, direct: Add force_kvm backend setting.
by Sam Eiderman
By using:
export LIBGUESTFS_BACKEND_SETTINGS=force_kvm
you can force the backend to use KVM and never fall back to
TCG (software emulation).
---
lib/guestfs-internal.h | 3 +++
lib/guestfs.pod | 9 +++++++++
lib/launch-direct.c | 42 ++++++++++++++++++++++++++++++++++++------
lib/launch-libvirt.c | 29 ++++++++++++++++++++++++-----
4 files changed, 72 insertions(+), 11 deletions(-)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 43509c6db..97dacc2b8 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -157,6 +157,9 @@ guestfs_int_cleanup_gl_recursive_lock_unlock (void *ptr)
#define VIRTIO_DEVICE_NAME(type) type "-pci"
#endif
+/* Guestfs accel options. */
+enum accel { BEST_ACCEL, FORCE_TCG, FORCE_KVM };
+
/* Guestfs handle and associated structures. */
/* State. */
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index bce9eb79f..ff58aa0bb 100644
--- a/lib/guestfs.pod
+++ b/lib/guestfs.pod
@@ -1530,6 +1530,15 @@ Using:
will force the direct and libvirt backends to use TCG (software
emulation) instead of KVM (hardware accelerated virtualization).
+=head3 force_kvm
+
+Using:
+
+ export LIBGUESTFS_BACKEND_SETTINGS=force_kvm
+
+will force the direct and libvirt backends to use KVM (hardware
+accelerated virtualization) instead of TCG (software emulation).
+
=head3 gdb
The direct backend supports:
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index b6ed9766f..416a87fa0 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -385,6 +385,9 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
struct hv_param *hp;
bool has_kvm;
int force_tcg;
+ int force_kvm;
+ enum accel accel;
+ const char *accel_val;
const char *cpu_model;
CLEANUP_FREE char *append = NULL;
CLEANUP_FREE_STRING_LIST char **argv = NULL;
@@ -434,8 +437,35 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
if (force_tcg == -1)
return -1;
- if (!has_kvm && !force_tcg)
- debian_kvm_warning (g);
+ force_kvm = guestfs_int_get_backend_setting_bool (g, "force_kvm");
+ if (force_kvm == -1)
+ return -1;
+
+ if (force_kvm && force_tcg) {
+ error (g, "Both force_kvm and force_tcg backend settings supplied.");
+ return -1;
+ }
+ else if (force_tcg) {
+ accel = FORCE_TCG;
+ accel_val = "tcg";
+ }
+ else if (force_kvm) {
+ accel = FORCE_KVM;
+ accel_val = "kvm"
+ }
+ else {
+ accel = BEST_ACCEL;
+ accel_val = "kvm:tcg";
+ }
+
+ if (!has_kvm) {
+ if (accel != FORCE_TCG)
+ debian_kvm_warning (g);
+ if (accel == FORCE_KVM) {
+ error (g, "force_kvm supplied but kvm not available.");
+ return -1;
+ }
+ }
/* Using virtio-serial, we need to create a local Unix domain socket
* for qemu to connect to.
@@ -527,13 +557,13 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
append_list (MACHINE_TYPE);
#endif
#ifdef __aarch64__
- if (has_kvm && !force_tcg)
+ if (has_kvm && accel != FORCE_TCG)
append_list ("gic-version=host");
#endif
- append_list_format ("accel=%s", !force_tcg ? "kvm:tcg" : "tcg");
+ append_list_format ("accel=%s", accel_val);
} end_list ();
- cpu_model = guestfs_int_get_cpu_model (has_kvm && !force_tcg);
+ cpu_model = guestfs_int_get_cpu_model (has_kvm && accel != FORCE_TCG);
if (cpu_model)
arg ("-cpu", cpu_model);
@@ -690,7 +720,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
}
flags = 0;
- if (!has_kvm || force_tcg)
+ if (!has_kvm || accel == FORCE_TCG)
flags |= APPLIANCE_COMMAND_LINE_IS_TCG;
append = guestfs_int_appliance_command_line (g, appliance, flags);
arg ("-append", append);
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index eff1c8f7e..b8ad8d265 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -772,6 +772,8 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
xmlAttrPtr attr;
size_t seen_qemu, seen_kvm;
int force_tcg;
+ int force_kvm;
+ enum accel accel;
doc = xmlReadMemory (capabilities_xml, strlen (capabilities_xml),
NULL, NULL, XML_PARSE_NONET);
@@ -819,11 +821,30 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
}
}
+ force_tcg = guestfs_int_get_backend_setting_bool (g, "force_tcg");
+ if (force_tcg == -1)
+ return -1;
+
+ force_kvm = guestfs_int_get_backend_setting_bool (g, "force_kvm");
+ if (force_kvm == -1)
+ return -1;
+
+ if (force_kvm && force_tcg) {
+ error (g, "Both force_kvm and force_tcg backend settings supplied.");
+ return -1;
+ }
+ else if (force_tcg)
+ accel = FORCE_TCG;
+ else if (force_kvm)
+ accel = FORCE_KVM;
+ else
+ accel = BEST_ACCEL;
+
/* This was RHBZ#886915: in that case the default libvirt URI
* pointed to a Xen hypervisor, and so could not create the
* appliance VM.
*/
- if (!seen_qemu && !seen_kvm) {
+ if ((!seen_qemu || accel == FORCE_KVM) && !seen_kvm) {
CLEANUP_FREE char *backend = guestfs_get_backend (g);
error (g,
@@ -841,11 +862,9 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
return -1;
}
- force_tcg = guestfs_int_get_backend_setting_bool (g, "force_tcg");
- if (force_tcg == -1)
- return -1;
+ assert((accel != FORCE_KVM) || seen_kvm);
- if (!force_tcg)
+ if (accel != FORCE_TCG)
data->is_kvm = seen_kvm;
else
data->is_kvm = 0;
--
2.31.0.rc2.261.g7f71774620-goog
3 years, 9 months
Re: [Libguestfs] [PATCH libguestfs 1/1] launch: libvirt, direct: Add force_tcg backend setting.
by Sam Eiderman
Just noticed I replied off-list.
I will rework this commit to use the suggested enum, both in libvirt
and direct then.
Not sure if we need a single place to define it (since it's only
relevant for two of these backends).
Might just define it as:
enum { BEST_ACCEL, FORCE_TCG, FORCE_KVM } accel;
in both places as you suggested.
Do I need to worry about documentation in this commit? force_tcg is
pretty well documented.
Sam
On Mon, Mar 15, 2021 at 5:51 PM Richard W.M. Jones <rjones(a)redhat.com> wrote:
>
> On Mon, Mar 15, 2021 at 05:49:08PM +0200, Sam Eiderman wrote:
> > On Mon, Mar 15, 2021 at 12:38 PM Richard W.M. Jones <rjones(a)redhat.com> wrote:
> > >
> > > On Sun, Mar 14, 2021 at 05:33:42PM +0200, Sam Eiderman wrote:
> > > > By using:
> > > >
> > > > export LIBGUESTFS_BACKEND_SETTINGS=force_kvm
> > > >
> > > > you can force the backend to use KVM and never fall back to
> > > > TCG (software emulation).
> > > > ---
> > > > lib/launch-direct.c | 22 +++++++++++++++++++---
> > > > lib/launch-libvirt.c | 12 +++++++++++-
> > > > 2 files changed, 30 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/lib/launch-direct.c b/lib/launch-direct.c
> > > > index b6ed9766f..79e6ef2fd 100644
> > > > --- a/lib/launch-direct.c
> > > > +++ b/lib/launch-direct.c
> > > > @@ -385,6 +385,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
> > > > struct hv_param *hp;
> > > > bool has_kvm;
> > > > int force_tcg;
> > > > + int force_kvm;
> > >
> > > Wouldn't this be better as a tri-state setting? eg:
> > >
> > > enum { BEST_ACCEL, FORCE_TCG, FORCE_KVM } accel;
> > >
> > > It seems it would make the checks below simpler.
> > >
> >
> > Indeed this is the mindset, but not sure it will change much in code.
> > Parsing will have to populate that enum anyway so we will have to
> > check that both values do not collide.
>
> I don't necessarily have strong opinions one way or the other,
> but I guess one variable is better than two?
>
> Rich.
>
> >
> > > > const char *cpu_model;
> > > > CLEANUP_FREE char *append = NULL;
> > > > CLEANUP_FREE_STRING_LIST char **argv = NULL;
> > > > @@ -434,8 +435,22 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
> > > > if (force_tcg == -1)
> > > > return -1;
> > > >
> > > > - if (!has_kvm && !force_tcg)
> > > > - debian_kvm_warning (g);
> > > > + force_kvm = guestfs_int_get_backend_setting_bool (g, "force_kvm");
> > > > + if (force_kvm == -1)
> > > > + return -1;
> > > > +
> > > > + if (force_kvm && force_tcg) {
> > > > + error (g, "Both force_kvm and force_tcg backend settings supplied.");
> > > > + return -1;
> > > > + }
> >
> > The following if statement will stay the same probably (just use the
> > enum values) - notice that we fallthrough in printing the warning.
> >
> > > > + if (!has_kvm) {
> > > > + if (!force_tcg)
> > > > + debian_kvm_warning (g);
> > > > + if (force_kvm) {
> > > > + error (g, "force_kvm supplied but kvm not available.");
> > > > + return -1;
> > > > + }
> > > > + }
> > > >
> > > > /* Using virtio-serial, we need to create a local Unix domain socket
> > > > * for qemu to connect to.
> > > > @@ -530,7 +545,8 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
> > > > if (has_kvm && !force_tcg)
> > > > append_list ("gic-version=host");
> > > > #endif
> >
> > This might be slightly simplified - but not sure I would add an enum
> > for that, no strong opinions though.
> >
> > > > - append_list_format ("accel=%s", !force_tcg ? "kvm:tcg" : "tcg");
> > > > + append_list_format ("accel=%s", force_kvm ? "kvm" :
> > > > + (!force_tcg ? "kvm:tcg" : "tcg"));
> > > > } end_list ();
> > > >
> > > > cpu_model = guestfs_int_get_cpu_model (has_kvm && !force_tcg);
> > > > diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
> > > > index 6c0cfe937..a56afbdd4 100644
> > > > --- a/lib/launch-libvirt.c
> > > > +++ b/lib/launch-libvirt.c
> > > > @@ -773,6 +773,7 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
> > > > xmlAttrPtr attr;
> > > > size_t seen_qemu, seen_kvm;
> > > > int force_tcg;
> > > > + int force_kvm;
> > > >
> > > > doc = xmlReadMemory (capabilities_xml, strlen (capabilities_xml),
> > > > NULL, NULL, XML_PARSE_NONET);
> > > > @@ -820,11 +821,15 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
> > > > }
> > > > }
> > > >
> > > > + force_kvm = guestfs_int_get_backend_setting_bool (g, "force_kvm");
> > > > + if (force_kvm == -1)
> > > > + return -1;
> > > > +
> > > > /* This was RHBZ#886915: in that case the default libvirt URI
> > > > * pointed to a Xen hypervisor, and so could not create the
> > > > * appliance VM.
> > > > */
> > > > - if (!seen_qemu && !seen_kvm) {
> > > > + if ((!seen_qemu || force_kvm) && !seen_kvm) {
> >
> > If force_kvm is set to true, we enter this if "!seen_kvm" - and fail
> >
> > > > CLEANUP_FREE char *backend = guestfs_get_backend (g);
> > > >
> > > > error (g,
> > > > @@ -846,6 +851,11 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
> > > > if (force_tcg == -1)
> > > > return -1;
> > > >
> > > > + if (force_kvm && force_tcg) {
> > > > + error (g, "Both force_kvm and force_tcg backend settings supplied.");
> > > > + return -1;
> > > > + }
> > > > +
> > > > if (!force_tcg)
> >
> > That means that seen_kvm = TRUE here
> > That means that data->is_kvm = TRUE here
> >
> > > > data->is_kvm = seen_kvm;
> > > > else
> > >
> > > Where does this actually set KVM only in the libvirt backend?
> >
> > Commented above
> >
> > >From what I understand this is later translated to "kvm" under
> > domain->type in libvirt xml.
> >
> > I actually needed this only for direct, but thought that I should add
> > it to libvirt too since that what was done for force_tcg
> >
> > >
> > > Rich.
> > >
> > > --
> > > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> > > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > > virt-df lists disk usage of guests without needing to install any
> > > software inside the virtual machine. Supports Linux and Windows.
> > > http://people.redhat.com/~rjones/virt-df/
> > >
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-p2v converts physical machines to virtual machines. Boot with a
> live CD or over the network (PXE) and turn machines into KVM guests.
> http://libguestfs.org/virt-v2v
>
3 years, 9 months
[PATCH libguestfs 0/1] Introduce force_kvm backend
by Sam Eiderman
When we want to make sure that libguestfs runs in a performant
environemnt, it is useful to have such flag - otherwise we can't rely on
libguestfs not to fall back to use tcg.
Sam Eiderman (1):
launch: libvirt,direct: Add force_tcg backend setting.
lib/launch-direct.c | 22 +++++++++++++++++++---
lib/launch-libvirt.c | 12 +++++++++++-
2 files changed, 30 insertions(+), 4 deletions(-)
--
2.31.0.rc2.261.g7f71774620-goog
3 years, 9 months