[PATCH] RFC: char: deprecate usage of bidirectional pipe
From: Marc-André Lureau As Ed Swierk explained back in 2006: https://lists.nongnu.org/archive/html/qemu-devel/2006-12/msg00160.html "When qemu writes into the pipe, it immediately reads back what it just wrote and treats it as a monitor command, endlessly breathing its own exhaust." This is similarly confusing when using the chardev with a serial device, as reported in https://bugzilla.redhat.com/show_bug.cgi?id=2106975. It seems we have kept the support for bidirectional pipes for historical reasons and odd systems, however it's not documented in qemu -chardev options. I suggest to stop supporting it, for portability reasons. Signed-off-by: Marc-André Lureau --- docs/about/deprecated.rst | 6 ++ chardev/char-pipe.c | 4 2 files changed, 10 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 7ee26626d5cf..dd5ca30d527b 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -45,6 +45,12 @@ transmit audio through the VNC protocol. ``tty`` and ``parport`` are aliases that will be removed. Instead, the actual backend names ``serial`` and ``parallel`` should be used. +``-chardev pipe`` support for bidirectional pipes (since 7.1) + + +For portability reasons, the support for bidirectional ``pipe`` will +be removed. Instead, use ``file.in`` & ``file.out`` unidirectional pipes. + Short-form boolean options (since 6.0) '' diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c index 66d3b8509183..7db963035e7d 100644 --- a/chardev/char-pipe.c +++ b/chardev/char-pipe.c @@ -27,6 +27,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/error-report.h" #include "chardev/char.h" #ifdef _WIN32 @@ -142,6 +143,9 @@ static void qemu_chr_open_pipe(Chardev *chr, if (fd_out >= 0) { close(fd_out); } +warn_report("Support for bidirectional pipe is deprecated,"); +warn_report("please use portable one-way pipes instead (%s.in & %s.out).", +filename, filename); TFR(fd_in = fd_out = qemu_open_old(filename, O_RDWR | O_BINARY)); if (fd_in < 0) { error_setg_file_open(errp, errno, filename); -- 2.37.0.rc0
Re: [PATCH] RFC: char: deprecate usage of bidirectional pipe
On Tue, Jul 26, 2022 at 12:32:32PM +0400, marcandre.lur...@redhat.com wrote: > From: Marc-André Lureau > > As Ed Swierk explained back in 2006: > https://lists.nongnu.org/archive/html/qemu-devel/2006-12/msg00160.html > > "When qemu writes into the pipe, it immediately reads back what it just > wrote and treats it as a monitor command, endlessly breathing its own > exhaust." > > This is similarly confusing when using the chardev with a serial device, > as reported in https://bugzilla.redhat.com/show_bug.cgi?id=2106975. > > It seems we have kept the support for bidirectional pipes for historical > reasons and odd systems, however it's not documented in qemu -chardev > options. I suggest to stop supporting it, for portability reasons. Hmm, I always assumed that in this scenario the pipe was operating in output-only mode. Obviously not the case with the code as it exists, but perhaps this would be useful ? eg its good as a serial console logging mechanism at least. > > Signed-off-by: Marc-André Lureau > --- > docs/about/deprecated.rst | 6 ++ > chardev/char-pipe.c | 4 > 2 files changed, 10 insertions(+) > > diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst > index 7ee26626d5cf..dd5ca30d527b 100644 > --- a/docs/about/deprecated.rst > +++ b/docs/about/deprecated.rst > @@ -45,6 +45,12 @@ transmit audio through the VNC protocol. > ``tty`` and ``parport`` are aliases that will be removed. Instead, the > actual backend names ``serial`` and ``parallel`` should be used. > > +``-chardev pipe`` support for bidirectional pipes (since 7.1) > + > + > +For portability reasons, the support for bidirectional ``pipe`` will > +be removed. Instead, use ``file.in`` & ``file.out`` unidirectional pipes. > + > Short-form boolean options (since 6.0) > '' > > diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c > index 66d3b8509183..7db963035e7d 100644 > --- a/chardev/char-pipe.c > +++ b/chardev/char-pipe.c > @@ -27,6 +27,7 @@ > #include "qemu/main-loop.h" > #include "qemu/module.h" > #include "qemu/option.h" > +#include "qemu/error-report.h" > #include "chardev/char.h" > > #ifdef _WIN32 > @@ -142,6 +143,9 @@ static void qemu_chr_open_pipe(Chardev *chr, > if (fd_out >= 0) { > close(fd_out); > } > +warn_report("Support for bidirectional pipe is deprecated,"); > +warn_report("please use portable one-way pipes instead (%s.in & > %s.out).", > +filename, filename); > TFR(fd_in = fd_out = qemu_open_old(filename, O_RDWR | O_BINARY)); > if (fd_in < 0) { > error_setg_file_open(errp, errno, filename); > -- > 2.37.0.rc0 > With regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
[PATCH v2 1/2] docs: patches: Add a note about reviews and contacting developers
Add a note outling best practices around review and responding to it. Signed-off-by: Peter Krempa --- docs/submitting-patches.rst | 22 ++ 1 file changed, 22 insertions(+) diff --git a/docs/submitting-patches.rst b/docs/submitting-patches.rst index 7bc22323ee..965e381cc1 100644 --- a/docs/submitting-patches.rst +++ b/docs/submitting-patches.rst @@ -89,3 +89,25 @@ Moreover, such patch needs to be prefixed correctly with ``--subject-prefix=PATCHv2`` appended to ``git send-email`` (substitute ``v2`` with the correct version if needed though). + +Reviews +--- + +Reviewing patches may take a lot of effort and review bandwidth is a limited +resource for open source projects. Here are a few rules to follow to streamline +the process: + + - **don't** contact individual maintainers/developers directly with your + patches; reviewers are subscribed to the mailing list + - **do** be patient; reviewers may be busy + - **do** respond to reviewer's questions + - **don't** ignore a suggestion from a reviewer; if you disagree discuss it on + the list before sending a new version + - **do** remind us of your patches on the list if they haven't gotten any + attention for a prolonged period (> week) by replying to your patches with a + "ping" + - **do** test your pathches before sending + +You can also help out by reviewing other patches on the list if you feel +comfortable. Don't hesitate to point out apparent problems in idividual patches, +you are not obliged to review the whole series. -- 2.36.1
[PATCH v2 2/2] docs: Add article about handling upstream issues
Outline how upstream issues are triaged and explain what the states of the issue means. Signed-off-by: Peter Krempa --- docs/docs.rst | 3 + docs/issue-handling.rst | 174 docs/meson.build| 1 + 3 files changed, 178 insertions(+) create mode 100644 docs/issue-handling.rst diff --git a/docs/docs.rst b/docs/docs.rst index 8ca0afdc1a..daba35ca15 100644 --- a/docs/docs.rst +++ b/docs/docs.rst @@ -139,6 +139,9 @@ Project development `CI `__ Details on our Continuous Integration +`Upstream issue handling `__ + Outlines the handling of issues and describes the states the issue can be in. + `Bug reports `__ How and where to report bugs and request features diff --git a/docs/issue-handling.rst b/docs/issue-handling.rst new file mode 100644 index 00..26f3ff4e40 --- /dev/null +++ b/docs/issue-handling.rst @@ -0,0 +1,174 @@ += +Handling of gitlab issues += + +.. contents:: + +This document describes the life cycle and handling of upstream gitlab issues. +Issues aggregate bug reports, feature requests, user questions and discussions. + +For members of the project this is a guideline how to handle issues and how to +transition them between states based on the interaction with the reporter. + +It is important that we try to keep the issues organized and labeled. Otherwise +it's not pleasant to go through everything and try to weed out and fix once + +For others it's an outline what to expect when filing an issue. + +Types of issues +--- + +Generally we use the following issue types based on the individual request. A +gitlab *scoped label* of the ``kind::`` set is used to label the type of an +issue. Each issue should have one of these once it's triaged. + +Issues can be freely moved between various kinds if needed. + +Bugs - ``kind::bug`` + + +The issue describes a flaw in the functionality. Generally the user should +describe how to reproduce the issue and add `debug logs`_ or a backtrace of all +threads in case when any of the components crashed. + +Feature requests - ``kind::enhancement`` + + +Issue describes non-existing functionality the user would like to add to +libvirt. Generally the issue should first focus on what the user wants to +achieve rather than any form of technical detail so that it's obvious what +the end goal is. + +Technicalities can be described later but should not be the main focus of the +initial report. With a clear end-goal it's sometimes possible to recommend +another solution with the same impact. + +User support queries - ``kind::support`` + + +This label is used for issues which don't directly correspond to a flaw or +missing feature in the project but rather outline a users query about usage. + +Discussions - ``kind::discussion`` +~~ + +Any form of discussion which doesn't directly concern any bug or feature request. + +States of issues + + +The state of issue helps the maintainers to filter out issues which need +attention, thus please update the state as appropriate. + +Confirmed issues - ``state::confirmed`` +~~~ + +In case of ``kind::bug`` issues the **confirmed** state means that there is +a real problem with the functionality and there is (seemingly) enough +information to figure out where the problem is and fix it. + +``kind::enhancement`` issues should be marked as **confirmed** as long as the +general idea of the required functionality makes sense and would be in line +of the general project strategy. + +**Note:** Unless the issue is assigned to a specific person, the **confirmed** +state does not necessarily mean that anybody is actively looking to implement +the functionality or fix the problem. See the `disclaimer`_. + +Unconfirmed issues - ``state::unconfirmed`` +~~~ + +``kind::bug`` issues are considered **unconfirmed** when there is seemingly +enough information describing the problem, but the triager is not sure whether +the problem would be considered a bug. + +In case of ``kind::enhancement`` issues the **unconfirmed** state is similarly +used for feature requests which might not make sense. + +In general use of the **unconfirmed** state should be avoided if possible, +although if an initial triager requests all necessary information from the +reporter, but is not sure about the issue itself it's okay to defer it to +somebody else by setting the ``state::unconfirmed`` label and thus deferring it +to somebody with more knowledge about the code. + +Issues needing additional information from reporter - ``state::needinfo`` +~ + +If additional information is requested from the reporter of the Issue the +``state:needinfo`` label should b
[PATCH v2 0/2] docs: Document reviewing and issue handling
Following changes to the respective v1 versions of these patches: Peter Krempa (2): docs: patches: Add a note about reviews and contacting developers - followed Erik's suggestion to add bulletpoint instead of a blob of text docs: Add article about handling upstream issues (previously not reviewed) - fixed spelling and re-formulated some sentences docs/docs.rst | 3 + docs/issue-handling.rst | 174 docs/meson.build| 1 + docs/submitting-patches.rst | 22 + 4 files changed, 200 insertions(+) create mode 100644 docs/issue-handling.rst -- 2.36.1
Entering freeze for libvirt-8.6.0
I have just tagged v8.6.0-rc1 in the repository and pushed signed tarballs and source RPMs to https://libvirt.org/sources/ Please give the release candidate some testing and in case you find a serious issue which should have a fix in the upcoming release, feel free to reply to this thread to make sure the issue is more visible. If you have not done so yet, please update NEWS.rst to document any significant change you made since the last release. Thanks, Jirka
Re: [PATCH 3/3] qemu_driver: use qemuMonitorQueryStats to extract halt poll time
On Sun, Jul 24, 2022 at 10:50:36AM +0530, Amneesh Singh wrote: On Fri, Jul 22, 2022 at 07:09:57PM +0200, Paolo Bonzini wrote: On 7/22/22 17:43, Martin Kletzander wrote: > As mentioned before, all these failures do not have to exit the > function, but rather fallback to the old way. You can even create > two new functions for the new and old implementations and then call > them from here to make the fallback easier to spot (and code). More precisely, they should just "continue;" to the next iteration of the for loop, like if (!success_obj || !fail_obj) continue; found = true; and then go fall back if found is false at the end of the loop. On the other hand, here: if (virJSONValueGetNumberUlong(success_obj, &curHaltPollSuccess) < 0) return 0; if (virJSONValueGetNumberUlong(fail_obj, &curHaltPollFail) < 0) return 0; I am not sure about falling back, because it is really an unexpected situation where the statistic exist but somehow the value cannot be parsed. The main thing I was worried about was libvirtd crashing on possibly expoited qemu process. Whether we fall back or report nothing in this case is not that big of a deal, since there's something wrong already anyway. Then can we just "continue;" in case the value fails to parse as well? That's another option as well. Paolo > I wanted to change this before pushing as well, but I feel like I'm > changing too much of your code. And I also had to rebase this > (although trivially). Would you mind just changing these few last > things so that we can get it in before the rc0 freeze? Alright, as soon as there is a viable check decided for the virJSONValueGet* statements above, I will push a v4 with the changes you mentioned in your reviews. Thank you both for taking the time to review. signature.asc Description: PGP signature
Re: [PATCH v2 1/2] docs: patches: Add a note about reviews and contacting developers
On Tue, Jul 26, 2022 at 10:52:50AM +0200, Peter Krempa wrote: > Add a note outling best practices around review and responding to it. > > Signed-off-by: Peter Krempa > --- > docs/submitting-patches.rst | 22 ++ > 1 file changed, 22 insertions(+) > > diff --git a/docs/submitting-patches.rst b/docs/submitting-patches.rst > index 7bc22323ee..965e381cc1 100644 > --- a/docs/submitting-patches.rst > +++ b/docs/submitting-patches.rst > @@ -89,3 +89,25 @@ Moreover, such patch needs to be prefixed correctly with > ``--subject-prefix=PATCHv2`` appended to > ``git send-email`` (substitute ``v2`` with the > correct version if needed though). > + > +Reviews I think 'Review process' sounds better > +--- > + > +Reviewing patches may take a lot of effort and review bandwidth is a limited I'd reword this a bit: 'Reviewing patches...lot of effort with review bandwidth being limited in open source projects' and the reason for this being that if not read carefully until the end of the sentence, what you'll see is '(a lot of effort AND review bandwidth)' as a direct connection to the first part of the sentence with the rest of the sentence then making no sense. I apologize if I suggested that wording in the previous revision of this patch. > +resource for open source projects. Here are a few rules to follow to > streamline > +the process: > + > + - **don't** contact individual maintainers/developers directly with your > + patches; reviewers are subscribed to the mailing list > + - **do** be patient; reviewers may be busy > + - **do** respond to reviewer's questions > + - **don't** ignore a suggestion from a reviewer; if you disagree discuss it > on > + the list before sending a new version > + - **do** remind us of your patches on the list if they haven't gotten any > + attention for a prolonged period (> week) by replying to your patches > with a s/week/1 week/ > + "ping" > + - **do** test your pathches before sending s/pathches/patches > + > +You can also help out by reviewing other patches on the list if you feel > +comfortable. Don't hesitate to point out apparent problems in idividual > patches, > +you are not obliged to review the whole series. It would be probably better to invert the last sentence to: "Don't feel obliged to review whole patch series if you see any major problems in any of the comprising patches - just point them out and let the author to respin the series." Reviewed-by: Erik Skultety
Re: [PATCH v2 2/2] docs: Add article about handling upstream issues
On Tue, Jul 26, 2022 at 10:52:51AM +0200, Peter Krempa wrote: > Outline how upstream issues are triaged and explain what the states of > the issue means. > > Signed-off-by: Peter Krempa > --- > docs/docs.rst | 3 + > docs/issue-handling.rst | 174 > docs/meson.build| 1 + > 3 files changed, 178 insertions(+) > create mode 100644 docs/issue-handling.rst > > diff --git a/docs/docs.rst b/docs/docs.rst > index 8ca0afdc1a..daba35ca15 100644 > --- a/docs/docs.rst > +++ b/docs/docs.rst > @@ -139,6 +139,9 @@ Project development > `CI `__ > Details on our Continuous Integration > > +`Upstream issue handling `__ > + Outlines the handling of issues and describes the states the issue can be > in. Outlines the process of handling issues as well as describes the supported issue types along with their life cycle. > + > `Bug reports `__ > How and where to report bugs and request features > > diff --git a/docs/issue-handling.rst b/docs/issue-handling.rst > new file mode 100644 > index 00..26f3ff4e40 > --- /dev/null > +++ b/docs/issue-handling.rst > @@ -0,0 +1,174 @@ > += > +Handling of gitlab issues > += > + > +.. contents:: > + > +This document describes the life cycle and handling of upstream gitlab > issues. > +Issues aggregate bug reports, feature requests, user questions and > discussions. s/Issues/Issue (in GitLab's sense) s/aggregate/is an aggregate term for > + > +For members of the project this is a guideline how to handle issues and how > to > +transition them between states based on the interaction with the reporter. > + > +It is important that we try to keep the issues organized and labeled. > Otherwise > +it's not pleasant to go through everything and try to weed out and fix once I don't think a sentence should start with 'Otherwise', how about: It is imperative we collaboratively keep the issues organized and labeled, otherwise we'll end up creating an unnecessary maintenance burden for us. > + > +For others it's an outline what to expect when filing an issue. s/For others/For others,/ s/it's an outline/this article should only server as an outline > + > +Types of issues > +--- > + > +Generally we use the following issue types based on the individual request. A > +gitlab *scoped label* of the ``kind::`` set is used to label the type of an > +issue. Each issue should have one of these once it's triaged. > + > +Issues can be freely moved between various kinds if needed. 'Every issue in our GitLab tracker bears the ``kind::`` namespace prefix. Once triaged, each issue will have one of the following types assigned to it. Note that issues can be moved freely between the different issue kinds if needed. > + > +Bugs - ``kind::bug`` > + > + > +The issue describes a flaw in the functionality. Generally the user should s/The/This s/Generally// 'The user is expected to' > +describe how to reproduce the issue and add `debug logs`_ or a backtrace of > all > +threads in case when any of the components crashed. s/threads/daemon worker threads s/when any/any > + > +Feature requests - ``kind::enhancement`` > + > + > +Issue describes non-existing functionality the user would like to add to s/^Issue/This issue type/ > +libvirt. Generally the issue should first focus on what the user wants to s/Generally/Generally, > +achieve rather than any form of technical detail so that it's obvious what > +the end goal is. > + > +Technicalities can be described later but should not be the main focus of the s/Technicalities/Detailed technical aspects > +initial report. With a clear end-goal it's sometimes possible to recommend > +another solution with the same impact. > + > +User support queries - ``kind::support`` > + > + > +This label is used for issues which don't directly correspond to a flaw or > +missing feature in the project but rather outline a users query about usage. s/for/with s/missing/a missing s/but rather .*$/like usage-related queries > + > +Discussions - ``kind::discussion`` > +~~ > + > +Any form of discussion which doesn't directly concern any bug or feature > request. s/doesn't directly concern any/isn't related to any existing/ > + > +States of issues > + > + > +The state of issue helps the maintainers to filter out issues which need 'States allow project maintainers filtering out issues which need attention, so please keep the issue state updated at all times.' > +attention, thus please update the state as appropriate. > + > +Confirmed issues - ``state::confirmed`` > +~~~ > + > +In case of ``kind::bug`` issues the **confirmed** state means that there is > +a real problem with the functionality and there is (seemingly) enough > +information to figure out wher
Re: [libvirt PATCH 0/2] qemu: support stateless UEFI firmware
On Mon, Jul 25, 2022 at 03:40:41PM +0200, Michal Prívozník wrote: > On 7/22/22 18:23, Daniel P. Berrangé wrote: > > This is to enable SEV builds of UEFI which provide only a single CODE.fd > > file, with not VARS.fd. > > > > Daniel P. Berrangé (2): > > conf: support stateless UEFI firmware > > qemu: support use of stateless EFI firmware > > > > docs/formatdomain.rst | 9 +++- > > src/conf/domain_conf.c| 9 > > src/conf/domain_conf.h| 1 + > > src/conf/domain_validate.c| 26 ++ > > src/conf/schemas/domaincommon.rng | 5 ++ > > src/qemu/qemu_domain.c| 3 +- > > src/qemu/qemu_firmware.c | 48 +++ > > ...-auto-bios-not-stateless.x86_64-latest.err | 1 + > > .../firmware-auto-bios-not-stateless.xml | 18 +++ > > ...are-auto-bios-stateless.x86_64-latest.args | 32 + > > .../firmware-auto-bios-stateless.xml | 18 +++ > > ...ware-auto-efi-stateless.x86_64-latest.args | 33 + > > .../firmware-auto-efi-stateless.xml | 18 +++ > > .../firmware-manual-bios-not-stateless.err| 1 + > > .../firmware-manual-bios-not-stateless.xml| 15 ++ > > .../firmware-manual-bios-stateless.args | 30 > > .../firmware-manual-bios-stateless.xml| 15 ++ > > ...nual-efi-nvram-stateless.x86_64-latest.err | 1 + > > .../firmware-manual-efi-nvram-stateless.xml | 21 > > ...nvram-template-stateless.x86_64-latest.err | 1 + > > ...re-manual-efi-nvram-template-stateless.xml | 19 > > ...re-manual-efi-stateless.x86_64-latest.args | 33 + > > .../firmware-manual-efi-stateless.xml | 18 +++ > > tests/qemuxml2argvtest.c | 10 > > ...ware-auto-bios-stateless.x86_64-latest.xml | 34 + > > .../firmware-manual-bios-stateless.xml| 25 ++ > > .../firmware-manual-bios.xml | 25 ++ > > tests/qemuxml2xmltest.c | 3 ++ > > 28 files changed, 451 insertions(+), 21 deletions(-) > > create mode 100644 > > tests/qemuxml2argvdata/firmware-auto-bios-not-stateless.x86_64-latest.err > > create mode 100644 > > tests/qemuxml2argvdata/firmware-auto-bios-not-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-auto-bios-stateless.x86_64-latest.args > > create mode 100644 tests/qemuxml2argvdata/firmware-auto-bios-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-auto-efi-stateless.x86_64-latest.args > > create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-bios-not-stateless.err > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-bios-not-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-bios-stateless.args > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-bios-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-efi-nvram-stateless.x86_64-latest.err > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-efi-nvram-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-stateless.x86_64-latest.err > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-stateless.xml > > create mode 100644 > > tests/qemuxml2argvdata/firmware-manual-efi-stateless.x86_64-latest.args > > create mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-stateless.xml > > create mode 100644 > > tests/qemuxml2xmloutdata/firmware-auto-bios-stateless.x86_64-latest.xml > > create mode 100644 > > tests/qemuxml2xmloutdata/firmware-manual-bios-stateless.xml > > create mode 100644 tests/qemuxml2xmloutdata/firmware-manual-bios.xml > > > > Reviewed-by: Michal Privoznik ANy objection to me pushing this now, or wait until after freeze is over ? With regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
Re: [libvirt PATCH 0/2] qemu: support stateless UEFI firmware
On 7/26/22 16:16, Daniel P. Berrangé wrote: > On Mon, Jul 25, 2022 at 03:40:41PM +0200, Michal Prívozník wrote: >> On 7/22/22 18:23, Daniel P. Berrangé wrote: >>> This is to enable SEV builds of UEFI which provide only a single CODE.fd >>> file, with not VARS.fd. >>> >>> Daniel P. Berrangé (2): >>> conf: support stateless UEFI firmware >>> qemu: support use of stateless EFI firmware >>> >>> docs/formatdomain.rst | 9 +++- >>> src/conf/domain_conf.c| 9 >>> src/conf/domain_conf.h| 1 + >>> src/conf/domain_validate.c| 26 ++ >>> src/conf/schemas/domaincommon.rng | 5 ++ >>> src/qemu/qemu_domain.c| 3 +- >>> src/qemu/qemu_firmware.c | 48 +++ >>> ...-auto-bios-not-stateless.x86_64-latest.err | 1 + >>> .../firmware-auto-bios-not-stateless.xml | 18 +++ >>> ...are-auto-bios-stateless.x86_64-latest.args | 32 + >>> .../firmware-auto-bios-stateless.xml | 18 +++ >>> ...ware-auto-efi-stateless.x86_64-latest.args | 33 + >>> .../firmware-auto-efi-stateless.xml | 18 +++ >>> .../firmware-manual-bios-not-stateless.err| 1 + >>> .../firmware-manual-bios-not-stateless.xml| 15 ++ >>> .../firmware-manual-bios-stateless.args | 30 >>> .../firmware-manual-bios-stateless.xml| 15 ++ >>> ...nual-efi-nvram-stateless.x86_64-latest.err | 1 + >>> .../firmware-manual-efi-nvram-stateless.xml | 21 >>> ...nvram-template-stateless.x86_64-latest.err | 1 + >>> ...re-manual-efi-nvram-template-stateless.xml | 19 >>> ...re-manual-efi-stateless.x86_64-latest.args | 33 + >>> .../firmware-manual-efi-stateless.xml | 18 +++ >>> tests/qemuxml2argvtest.c | 10 >>> ...ware-auto-bios-stateless.x86_64-latest.xml | 34 + >>> .../firmware-manual-bios-stateless.xml| 25 ++ >>> .../firmware-manual-bios.xml | 25 ++ >>> tests/qemuxml2xmltest.c | 3 ++ >>> 28 files changed, 451 insertions(+), 21 deletions(-) >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-auto-bios-not-stateless.x86_64-latest.err >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-auto-bios-not-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-auto-bios-stateless.x86_64-latest.args >>> create mode 100644 tests/qemuxml2argvdata/firmware-auto-bios-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-auto-efi-stateless.x86_64-latest.args >>> create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-bios-not-stateless.err >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-bios-not-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-bios-stateless.args >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-bios-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-efi-nvram-stateless.x86_64-latest.err >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-efi-nvram-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-stateless.x86_64-latest.err >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-efi-nvram-template-stateless.xml >>> create mode 100644 >>> tests/qemuxml2argvdata/firmware-manual-efi-stateless.x86_64-latest.args >>> create mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-stateless.xml >>> create mode 100644 >>> tests/qemuxml2xmloutdata/firmware-auto-bios-stateless.x86_64-latest.xml >>> create mode 100644 >>> tests/qemuxml2xmloutdata/firmware-manual-bios-stateless.xml >>> create mode 100644 tests/qemuxml2xmloutdata/firmware-manual-bios.xml >>> >> >> Reviewed-by: Michal Privoznik > > ANy objection to me pushing this now, or wait until after freeze is > over ? Yeah, this is safe for freeze. Michal
[PATCH 05/80] qemu: Always assume support for QEMU_CAPS_GLUSTER_DEBUG_LEVEL
The 'debug' level for the gluster driver was added in qemu-2.8 unconditionally so libvirt can always assume it. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7df8041adf..534de9e0ae 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7667,22 +7667,19 @@ qemuDomainStorageSourceValidateDepth(virStorageSource *src, * qemuDomainPrepareStorageSourceConfig: * @src: storage source to configure * @cfg: qemu driver config object - * @qemuCaps: capabilities of qemu * * Set properties of @src based on the qemu driver config @cfg. * */ static void qemuDomainPrepareStorageSourceConfig(virStorageSource *src, - virQEMUDriverConfig *cfg, - virQEMUCaps *qemuCaps) + virQEMUDriverConfig *cfg) { if (!cfg) return; if (src->type == VIR_STORAGE_TYPE_NETWORK && -src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER && -virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) { +src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) { src->debug = true; src->debugLevel = cfg->glusterDebugLevel; } @@ -7802,7 +7799,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, if (qemuDomainValidateStorageSource(n, priv->qemuCaps, isSD) < 0) return -1; -qemuDomainPrepareStorageSourceConfig(n, cfg, priv->qemuCaps); +qemuDomainPrepareStorageSourceConfig(n, cfg); qemuDomainPrepareDiskSourceData(disk, n); if (blockdev && !isSD && @@ -10864,7 +10861,7 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDef *disk, if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps, true) < 0) return -1; -qemuDomainPrepareStorageSourceConfig(disk->src, cfg, priv->qemuCaps); +qemuDomainPrepareStorageSourceConfig(disk->src, cfg); qemuDomainPrepareDiskSourceData(disk, disk->src); if (qemuDomainSecretStorageSourcePrepare(priv, disk->src, @@ -10902,7 +10899,7 @@ qemuDomainPrepareStorageSourceBlockdevNodename(virDomainDiskDef *disk, if (qemuDomainValidateStorageSource(src, priv->qemuCaps, false) < 0) return -1; -qemuDomainPrepareStorageSourceConfig(src, cfg, priv->qemuCaps); +qemuDomainPrepareStorageSourceConfig(src, cfg); qemuDomainPrepareDiskSourceData(disk, src); if (qemuDomainSecretStorageSourcePrepare(priv, src, -- 2.36.1
[PATCH for 8.7.0 00/80] Remove pre-blockdev disk setup code
Starting with libvirt-8.7.0 we'll support qemu-4.2 as minimum and thus we'll only use -blockdev now. Remove the old cruft. This series applies on top of the patches bumping minimum qemu version to qemu-4.2 I've posted earlier. The whole branch can be fetched at: git fetch https://gitlab.com/pipo.sk/libvirt.git blockdev-remove-2 Peter Krempa (80): qemu: Allways assume QEMU_CAPS_CHANGE_BACKING_FILE qemu: capabilities: Retire QEMU_CAPS_CHANGE_BACKING_FILE qemu: Always assume support for QEMU_CAPS_ACTIVE_COMMIT qemu: capabilities: Retire QEMU_CAPS_ACTIVE_COMMIT qemu: Always assume support for QEMU_CAPS_GLUSTER_DEBUG_LEVEL qemu: capabilities: Retire QEMU_CAPS_GLUSTER_DEBUG_LEVEL qemu: Always assume support for QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES qemu: capabilities: Retire QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES qemuxml2argvtest: Use DO_TEST_CAPS_LATEST for all 'user-aliases' tests qemuxml2xmltest: Modernize all test cases using QEMU_CAPS_QCOW2_LUKS qemu: Always assume support for QEMU_CAPS_QCOW2_LUKS qemu: capabilities: Retire QEMU_CAPS_QCOW2_LUKS qemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI tests: Force QEMU_CAPS_BLOCKDEV(_HOSTDEV_SCSI) in fake caps tests qemu: Refactor access to 'qomName' field of the qemu disk private data qemu: command: Always assume support for QEMU_CAPS_SCSI_DISK_DEVICE_ID qemu: capabilities: Retire capabilities used for -blockdev detection qemu: Remove code conditional on QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI qemu: block: Remove legacy spellings for InetSocketAddress qemu: migration: Remove pre-blockdev code paths qemuMigrationSrcNBDStorageCopyBlockdev: Remove some arguments qemu: migration: Assume support for QEMU_CAPS_BLOCKDEV_DEL qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_DEL qemu: snapshot: Remove pre-blockdev code paths qemu: Remove unused code for pre-blockdev disk snapshot monitor interaction qemu: block: Remove pre-blockdev code paths qemu: migration_cookie: Remove pre-blockdev code paths qemu: validate: Remove impossible validation checks qemu: process: Remove pre-blockdev code paths qemu: blockjob: Remove legacy block job completion code qemu: Remove legacy block job event processing handler qemu: monitor: Remove infrastructure for BLOCK_JOB_* events qemuDomainSetBlockThreshold: Remove pre-blockdev node name detection qemu: block: Remove 'qemuBlockNodeNamesDetect' and related infrastructure qemu: blockjob: Remove pre-blockdev blockjob setup qemu: alias: Remove check for QEMU_CAPS_BLOCKDEV qemuDomainGetStatsBlock: Remove pre-blockdev code paths qemu: block: Remove unused qemuBlockGetNodeData qemu: monitor: Remove unused qemuMonitorQueryNamedBlockNodes and clean up qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockCopyCommon qemu: monitor: Remove unused qemuMonitorDriveMirror qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockCommit qemu: monitor: Remove unused arguments of qemuMonitorBlockCommit qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockPullCommon qemu: monitor: Remove unused arguments of qemuMonitorBlockStream qemu: monitor: Remove unused qemuMonitorDiskNameLookup qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockPivot qemu: monitor: Remove unused qemuMonitorDrivePivot qemu: command: Remove pre-blockdev floppy setup qemu: Remove pre-blockdev PFLASH setup qemuDomainBlockResize: Always refuse resize of empty/readonly disks qemuDomainBlocksStatsGather: Remove pre-blockdev code paths qemu: monitor: Remove unused qemuMonitorBlockStatsUpdateCapacity qemu: driver: Remove remaining QEMU_CAPS_BLOCKDEV capability checks qemu: hotplug: Remove pre-blockdev code path from qemuDomainChangeEjectableMedia qemu: monitor: Remove unused qemuMonitor(Eject|Change)Media qemuhotplugtest: Switch to -blockdev mode qemuDomainRemoveDiskDevice: Remove special casing for disks on 'sd' bus qemu: hotplug: Remove pre-blockdev code paths qemu: block: Remove unused qemuBlockStorageSourceChainDetachPrepareLegacy qemu: Remove 'driveAlias' argument of qemuBlockStorageSourceDetachPrepare qemu: block: Remove support for legacy disk hotplug/unplug qemu: monitor: Remove unused qemuMonitorAddDrive/qemuMonitorDriveDel qemu: command: Delegate qemuBuildDriveStr to SD cards only qemu: command: Generate -drive for SD cards via JSON props qemu: command: Remove unused qemuGetDriveSourceString qemu: domain: Assume QEMU_CAPS_BLOCKDEV for the domain private code qemuDomainSecretStorageSourcePrepare: Remove cabapbility check when preparing cookies qemuDomainDiskBlockJobIsSupported: Assume QEMU_CAPS_BLOCKDEV is supported qemuDomainDiskGetBackendAlias: Assume QEMU_CAPS_BLOCKDEV is supported qemuDomainValidateStorageSourc
[PATCH 02/80] qemu: capabilities: Retire QEMU_CAPS_CHANGE_BACKING_FILE
The 'change-backing-file' command is unconditionally supported since qemu-2.1. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 28 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7440bff111..2e1740 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -299,7 +299,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 165 */ "msg-timestamp", /* X_QEMU_CAPS_MSG_TIMESTAMP */ "active-commit", /* QEMU_CAPS_ACTIVE_COMMIT */ - "change-backing-file", /* QEMU_CAPS_CHANGE_BACKING_FILE */ + "change-backing-file", /* X_QEMU_CAPS_CHANGE_BACKING_FILE */ "memory-backend-ram", /* QEMU_CAPS_OBJECT_MEMORY_RAM */ "numa", /* QEMU_CAPS_NUMA */ @@ -1206,7 +1206,6 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = { { "query-spice", QEMU_CAPS_SPICE }, { "query-vnc", QEMU_CAPS_VNC }, { "nbd-server-start", QEMU_CAPS_NBD_SERVER }, -{ "change-backing-file", QEMU_CAPS_CHANGE_BACKING_FILE }, { "rtc-reset-reinjection", QEMU_CAPS_RTC_RESET_REINJECTION }, { "query-hotpluggable-cpus", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS }, { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index b49aa0dea6..7b4e85421c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -277,7 +277,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 165 */ X_QEMU_CAPS_MSG_TIMESTAMP, /* -msg timestamp */ QEMU_CAPS_ACTIVE_COMMIT, /* block-commit works without 'top' */ -QEMU_CAPS_CHANGE_BACKING_FILE, /* change name of backing file in metadata */ +X_QEMU_CAPS_CHANGE_BACKING_FILE, /* change name of backing file in metadata */ QEMU_CAPS_OBJECT_MEMORY_RAM, /* -object memory-backend-ram */ QEMU_CAPS_NUMA, /* newer -numa handling with disjoint cpu ranges */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index d2821bb67f..3ec3b21ef5 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -49,7 +49,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index e7316547e2..f32701da9b 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -48,7 +48,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 8ed3d05316..e093ff8139 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -28,7 +28,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 5f44c61b4c..ae30737018 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -64,7 +64,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index c7a897c8ba..fcfbadb0db 100644 --- a/tests/qemucap
[PATCH 07/80] qemu: Always assume support for QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES
Discard and zero-detection for disk sources is supported since qemu-2.1 so we can always assume it's support. Signed-off-by: Peter Krempa --- src/qemu/qemu_validate.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1b23f1a2ca..b949e1aa42 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3069,20 +3069,6 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk, return -1; } -if (disk->discard && -!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DISCARD)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("discard is not supported by this QEMU binary")); -return -1; -} - -if (disk->detect_zeroes && -!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DETECT_ZEROES)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("detect_zeroes is not supported by this QEMU binary")); -return -1; -} - if (disk->serial && qemuValidateDomainDeviceDefDiskSerial(disk->serial) < 0) return -1; -- 2.36.1
[PATCH 01/80] qemu: Allways assume QEMU_CAPS_CHANGE_BACKING_FILE
The 'change-backing-file' command was added in qemu-2.1 and doesn't have any dependancies. We use it as witness for using blockjobs with relative backing paths. Always assume it's support. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 13 - 1 file changed, 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9013e6fb8d..15742706fc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14557,13 +14557,6 @@ qemuDomainBlockPullCommon(virDomainObj *vm, if (baseSource) { if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE) { -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHANGE_BACKING_FILE)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary doesn't support relative " - "block pull/rebase")); -goto endjob; -} - if (blockdev && qemuBlockUpdateRelativeBacking(vm, disk->src, disk->src) < 0) goto endjob; @@ -15697,12 +15690,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (flags & VIR_DOMAIN_BLOCK_COMMIT_RELATIVE && topSource != disk->src) { -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHANGE_BACKING_FILE)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this qemu doesn't support relative block commit")); -goto endjob; -} - if (blockdev && top_parent && qemuBlockUpdateRelativeBacking(vm, top_parent, disk->src) < 0) goto endjob; -- 2.36.1
[PATCH 04/80] qemu: capabilities: Retire QEMU_CAPS_ACTIVE_COMMIT
Active block commit is supported since qemu-2.0 Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 28 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2e1740..97c2268f57 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -298,7 +298,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 165 */ "msg-timestamp", /* X_QEMU_CAPS_MSG_TIMESTAMP */ - "active-commit", /* QEMU_CAPS_ACTIVE_COMMIT */ + "active-commit", /* X_QEMU_CAPS_ACTIVE_COMMIT */ "change-backing-file", /* X_QEMU_CAPS_CHANGE_BACKING_FILE */ "memory-backend-ram", /* QEMU_CAPS_OBJECT_MEMORY_RAM */ "numa", /* QEMU_CAPS_NUMA */ @@ -1584,7 +1584,6 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMMU[] = /* see documentation for virQEMUQAPISchemaPathGet for the query format */ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { -{ "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT }, { "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUSTER_DEBUG_LEVEL}, { "blockdev-add/arg-type/+gluster/debug", QEMU_CAPS_GLUSTER_DEBUG_LEVEL}, { "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS}, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7b4e85421c..fcb6277538 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -276,7 +276,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 165 */ X_QEMU_CAPS_MSG_TIMESTAMP, /* -msg timestamp */ -QEMU_CAPS_ACTIVE_COMMIT, /* block-commit works without 'top' */ +X_QEMU_CAPS_ACTIVE_COMMIT, /* block-commit works without 'top' */ X_QEMU_CAPS_CHANGE_BACKING_FILE, /* change name of backing file in metadata */ QEMU_CAPS_OBJECT_MEMORY_RAM, /* -object memory-backend-ram */ QEMU_CAPS_NUMA, /* newer -numa handling with disjoint cpu ranges */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 3ec3b21ef5..79bf3d3363 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -48,7 +48,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index f32701da9b..895c8b2491 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -47,7 +47,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index e093ff8139..2b8bf907c5 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -27,7 +27,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index ae30737018..4c91ed53a6 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -63,7 +63,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index fcfbadb0db..25a3c05fb4 100644 --- a/tests
[PATCH 03/80] qemu: Always assume support for QEMU_CAPS_ACTIVE_COMMIT
Active layer block commit is unconditionally supported since qemu-2.0. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 5 - 1 file changed, 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 15742706fc..cfb02f7b0f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15637,11 +15637,6 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; if (topSource == disk->src) { -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ACTIVE_COMMIT)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("active commit not supported with this QEMU binary")); -goto endjob; -} /* XXX Should we auto-pivot when COMMIT_ACTIVE is not specified? */ if (!(flags & VIR_DOMAIN_BLOCK_COMMIT_ACTIVE)) { virReportError(VIR_ERR_INVALID_ARG, -- 2.36.1
[PATCH 13/80] qemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
The cleanup of the code to always assume support for QEMU_CAPS_BLOCKDEV will not be simple, so for now we hardcode the support and the code will be cleaned up gradually. We also disallow users to clear the flags via the namespace property or qemu.conf configuration. The change to the PPC64 test data originatest from the fact that the capability dump is not from the release version but is lacking one of the necessary flags to enable -blockdev. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 18 +- src/qemu/qemu_process.c| 12 tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 3 +++ 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e8b7d91062..9cffb07b9d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5228,6 +5228,11 @@ virQEMUCapsInitQMPBasicArch(virQEMUCaps *qemuCaps) static void virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps) { +/* While the removal of pre-blockdev code is in progress we always hard-code + * the support for QEMU_CAPS_BLOCKDEV */ +virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV); +virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI); + /* -enable-fips is deprecated in QEMU 5.2.0, and QEMU * should be built with gcrypt to achieve FIPS compliance * automatically / implicitly @@ -5247,17 +5252,11 @@ virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps) void virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qemuCaps) { -if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) -virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP); -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) -virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI); - /* The -compat qemu command line argument is implemented using a newer * method which doesn't show up in query-command-line-options. As we'll use * it only for development and testing purposes we can base the capability @@ -5302,13 +5301,6 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES); -/* To avoid guest ABI regression, blockdev shall be enabled only when - * we are able to pass the custom 'device_id' for SCSI disks and cdroms. */ -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC) && -virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID) && -virQEMUCapsGet(qemuCaps, QEMU_CAPS_SAVEVM_MONITOR_NODES)) -virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV); - /* We can't probe "esp" as a type via virQEMUCapsObjectTypes * array as it is only usable when builtin to the machine type */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d42333195a..438c903578 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5644,6 +5644,12 @@ qemuProcessStartUpdateCustomCaps(virDomainObj *vm) return -1; } +/* The code is being cleaned up to always assume the support for + * -blockdev thus we must no longer allow users to clear it */ +if (tmp == QEMU_CAPS_BLOCKDEV || +tmp == QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI) +continue; + virQEMUCapsClear(priv->qemuCaps, tmp); } } @@ -5668,6 +5674,12 @@ qemuProcessStartUpdateCustomCaps(virDomainObj *vm) return -1; } +/* The code is being cleaned up to always assume the support for + * -blockdev thus we must no longer allow users to clear it */ +if (tmp == QEMU_CAPS_BLOCKDEV || +tmp == QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI) +continue; + virQEMUCapsClear(priv->qemuCaps, tmp); } } diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml index 4c3a2c6d98..7d3dd3c917 100644 --- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml @@ -138,7 +138,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index cbdc1dd09a..702f6551a4 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -112,6 +112,7 @@ + @@ -140,11 +141,13 @@ + + -- 2.36.
[PATCH 11/80] qemu: Always assume support for QEMU_CAPS_QCOW2_LUKS
luks-encrypted QCOW2 files were introduced in qemu-2.6 unconditionally. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 8 1 file changed, 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 534de9e0ae..245cae9c60 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5079,14 +5079,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, src->encryption->engine); return -1; } - -if (src->format == VIR_STORAGE_FILE_QCOW2 && -src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS && -!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QCOW2_LUKS)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("LUKS encrypted QCOW2 images are not supported by this QEMU")); -return -1; -} } if (src->tlsHostname) { -- 2.36.1
[PATCH 12/80] qemu: capabilities: Retire QEMU_CAPS_QCOW2_LUKS
Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 28 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a01de90c29..e8b7d91062 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -465,7 +465,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio-tablet-ccw", /* QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW */ /* 285 */ - "qcow2-luks", /* QEMU_CAPS_QCOW2_LUKS */ + "qcow2-luks", /* X_QEMU_CAPS_QCOW2_LUKS */ "pcie-pci-bridge", /* QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE */ "seccomp-blacklist", /* X_QEMU_CAPS_SECCOMP_BLACKLIST */ "query-cpus-fast", /* QEMU_CAPS_QUERY_CPUS_FAST */ @@ -1585,7 +1585,6 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMMU[] = /* see documentation for virQEMUQAPISchemaPathGet for the query format */ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS}, -{ "blockdev-add/arg-type/+qcow2/encrypt/+luks/key-secret", QEMU_CAPS_QCOW2_LUKS }, { "blockdev-add/arg-type/+file/drop-cache", QEMU_CAPS_MIGRATION_FILE_DROP_CACHE }, { "blockdev-add/arg-type/+file/$dynamic-auto-read-only", QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC }, { "blockdev-add/arg-type/+nvme", QEMU_CAPS_DRIVE_NVME }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cfa916c846..7c5df0554b 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -444,7 +444,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW, /* -device virtio-tablet-ccw */ /* 285 */ -QEMU_CAPS_QCOW2_LUKS, /* qcow2 format support LUKS encryption */ +X_QEMU_CAPS_QCOW2_LUKS, /* qcow2 format support LUKS encryption */ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, /* -device pcie-pci-bridge */ X_QEMU_CAPS_SECCOMP_BLACKLIST, /* -sandbox.elevateprivileges */ QEMU_CAPS_QUERY_CPUS_FAST, /* query-cpus-fast command */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 9dfe93ef45..c801c11391 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -99,7 +99,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 120e7221a3..cbdc1dd09a 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -97,7 +97,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 9bafdc08ff..290a663904 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -66,7 +66,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 2cb38642e7..a2e36da5bf 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -130,7 +130,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabi
[PATCH 10/80] qemuxml2xmltest: Modernize all test cases using QEMU_CAPS_QCOW2_LUKS
Modernize 'disk-nvme', 'encrypted-disk-usage', 'encrypted-disk', and 'user-aliases' cases to use DO_TEST_CAPS_LATEST. This will remove all uses of QEMU_CAPS_QCOW2_LUKS from the test suite. Since the output files are done via symlinks to input files, the input files need to be modernized with few auto-added XML bits. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/disk-nvme.xml | 5 - tests/qemuxml2argvdata/encrypted-disk-usage.xml | 5 - tests/qemuxml2argvdata/user-aliases.xml | 5 +++-- ...{disk-nvme.xml => disk-nvme.x86_64-latest.xml} | 0 ...xml => encrypted-disk-usage.x86_64-latest.xml} | 0 ...-disk.xml => encrypted-disk.x86_64-latest.xml} | 5 - ...aliases.xml => user-aliases.x86_64-latest.xml} | 0 tests/qemuxml2xmltest.c | 15 --- 8 files changed, 19 insertions(+), 16 deletions(-) rename tests/qemuxml2xmloutdata/{disk-nvme.xml => disk-nvme.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{encrypted-disk-usage.xml => encrypted-disk-usage.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{encrypted-disk.xml => encrypted-disk.x86_64-latest.xml} (89%) rename tests/qemuxml2xmloutdata/{user-aliases.xml => user-aliases.x86_64-latest.xml} (100%) diff --git a/tests/qemuxml2argvdata/disk-nvme.xml b/tests/qemuxml2argvdata/disk-nvme.xml index 226ea3d686..5e521ad6d3 100644 --- a/tests/qemuxml2argvdata/disk-nvme.xml +++ b/tests/qemuxml2argvdata/disk-nvme.xml @@ -8,6 +8,9 @@ hvm + +qemu64 + destroy restart @@ -49,7 +52,7 @@ - + diff --git a/tests/qemuxml2argvdata/encrypted-disk-usage.xml b/tests/qemuxml2argvdata/encrypted-disk-usage.xml index 43afacf220..7c5781b96f 100644 --- a/tests/qemuxml2argvdata/encrypted-disk-usage.xml +++ b/tests/qemuxml2argvdata/encrypted-disk-usage.xml @@ -8,6 +8,9 @@ hvm + +qemu64 + destroy restart @@ -23,7 +26,7 @@ - + diff --git a/tests/qemuxml2argvdata/user-aliases.xml b/tests/qemuxml2argvdata/user-aliases.xml index b688b84b56..9998c1e08f 100644 --- a/tests/qemuxml2argvdata/user-aliases.xml +++ b/tests/qemuxml2argvdata/user-aliases.xml @@ -19,7 +19,8 @@ - + +qemu64 @@ -70,7 +71,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/disk-nvme.xml b/tests/qemuxml2xmloutdata/disk-nvme.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/disk-nvme.xml rename to tests/qemuxml2xmloutdata/disk-nvme.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/encrypted-disk-usage.xml b/tests/qemuxml2xmloutdata/encrypted-disk-usage.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/encrypted-disk-usage.xml rename to tests/qemuxml2xmloutdata/encrypted-disk-usage.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/encrypted-disk.xml b/tests/qemuxml2xmloutdata/encrypted-disk.x86_64-latest.xml similarity index 89% rename from tests/qemuxml2xmloutdata/encrypted-disk.xml rename to tests/qemuxml2xmloutdata/encrypted-disk.x86_64-latest.xml index b840f35fa7..abf0bf59fe 100644 --- a/tests/qemuxml2xmloutdata/encrypted-disk.xml +++ b/tests/qemuxml2xmloutdata/encrypted-disk.x86_64-latest.xml @@ -8,6 +8,9 @@ hvm + +qemu64 + destroy restart @@ -23,7 +26,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/user-aliases.xml b/tests/qemuxml2xmloutdata/user-aliases.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/user-aliases.xml rename to tests/qemuxml2xmloutdata/user-aliases.x86_64-latest.xml diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index da0f6eabb7..6bf2ed8d30 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -349,7 +349,7 @@ mymain(void) DO_TEST_NOCAPS("disk-network-tlsx509-nbd"); DO_TEST_CAPS_LATEST("disk-network-tlsx509-nbd-hostname"); DO_TEST_NOCAPS("disk-network-tlsx509-vxhs"); -DO_TEST("disk-nvme", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_QCOW2_LUKS); +DO_TEST_CAPS_LATEST("disk-nvme"); DO_TEST_CAPS_LATEST("disk-vhostuser"); DO_TEST_CAPS_LATEST("disk-scsi"); DO_TEST("disk-virtio-scsi-reservations", @@ -570,8 +570,8 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-slices"); DO_TEST_CAPS_LATEST("disk-rotation"); -DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS); -DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS); +DO_TEST_CAPS_LATEST("encrypted-disk"); +DO_TEST_CAPS_LATEST("encrypted-disk-usage"); DO_TEST_CAPS_LATEST("luks-disks"); DO_TEST_CAPS_LATEST("luks-disks-source"); DO_TEST_CAPS_LATEST("luks-disks-source-qcow2"); @@ -1293,14 +1293,7 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-exact", "ppc
[PATCH 08/80] qemu: capabilities: Retire QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES
Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 6 ++ src/qemu/qemu_capabilities.h | 4 ++-- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 2 -- tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 2 -- tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 2 -- tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 2 -- tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 2 -- tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 2 -- tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 2 -- tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 2 -- tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 2 -- tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 2 -- tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 2 -- tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 2 -- tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 2 -- tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 2 -- 28 files changed, 4 insertions(+), 58 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index cb47da9b1a..a01de90c29 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -270,7 +270,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 145 */ "vnc-websocket", /* X_QEMU_CAPS_VNC_WEBSOCKET */ - "drive-discard", /* QEMU_CAPS_DRIVE_DISCARD */ + "drive-discard", /* X_QEMU_CAPS_DRIVE_DISCARD */ "mlock", /* X_QEMU_CAPS_REALTIME_MLOCK */ "vnc-share-policy", /* X_QEMU_CAPS_VNC_SHARE_POLICY */ "device-del-event", /* X_QEMU_CAPS_DEVICE_DEL_EVENT */ @@ -382,7 +382,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 225 */ "spice-unix", /* X_QEMU_CAPS_SPICE_UNIX */ - "drive-detect-zeroes", /* QEMU_CAPS_DRIVE_DETECT_ZEROES */ + "drive-detect-zeroes", /* X_QEMU_CAPS_DRIVE_DETECT_ZEROES */ "tls-creds-x509", /* X_QEMU_CAPS_OBJECT_TLS_CREDS_X509 */ "display", /* X_QEMU_CAPS_DISPLAY */ "intel-iommu", /* QEMU_CAPS_DEVICE_INTEL_IOMMU */ @@ -1591,8 +1591,6 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "blockdev-add/arg-type/+nvme", QEMU_CAPS_DRIVE_NVME }, { "blockdev-add/arg-type/+file/aio/^io_uring", QEMU_CAPS_AIO_IO_URING }, { "blockdev-add/arg-type/+rbd/encrypt", QEMU_CAPS_RBD_ENCRYPTION }, -{ "blockdev-add/arg-type/discard", QEMU_CAPS_DRIVE_DISCARD }, -{ "blockdev-add/arg-type/detect-zeroes", QEMU_CAPS_DRIVE_DETECT_ZEROES }, { "blockdev-add/arg-type/+nbd/tls-hostname", QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME }, { "blockdev-backup", QEMU_CAPS_BLOCKDEV_BACKUP }, { "blockdev-snapshot/$allow-write-only-overlay", QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 5a258d9bf4..cfa916c846 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -248,7 +248,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 145 */ X_QEMU_CAPS_VNC_WEBSOCKET, /* -vnc x:y,websocket */ -QEMU_CAPS_DRIVE_DISCARD, /* -drive discard=off(ignore)|on(unmap) */ +X_QEMU_CAPS_DRIVE_DISCARD, /* -drive discard=off(ignore)|on(unmap) */ X_QEMU_CAPS_REALTIME_MLOCK, /* -realtime mlock=on|off */ X_QEMU_CAPS_VNC_SHARE_POLICY, /* set display sharing policy */ X_QEMU_CAPS_DEVICE_DEL_EVENT, /* DEVICE_DELETED event */ @@ -361,7 +361,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 225 */ X_QEMU_CAPS_SPICE_UNIX, /* -spice unix */ -QEMU_CAPS_DRIVE_DETECT_ZEROES, /* -drive detect-zeroes= */ +X_QEMU_CAPS_DRIVE_DETECT_ZEROES, /* -drive detect-zeroes= */ X_QEMU_CAPS_OBJECT_TLS_CREDS_X509, /* -object tls-creds-x509 */ X_QEMU_CAPS_DISPLAY, /* -display */ QEMU_CAPS_DEVICE_INTEL_IOMMU, /* -device intel-iommu */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 3184b54dfb..9dfe93ef45 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -40,7 +40,6 @@ - @@ -79,7 +78,6 @@
[PATCH 15/80] qemu: Refactor access to 'qomName' field of the qemu disk private data
The code which fills 'qomName' does so only when the blockdev capability is enabled so we don't have to check it separately as it can be only non-NULL when blockdev is used. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 29 - src/qemu/qemu_process.c | 3 +-- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cfb02f7b0f..d5a3181c0d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10119,16 +10119,15 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, return -1; } -if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { +if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) entryname = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; -} else { -if (!disk->info.alias) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing disk device alias name for %s"), disk->dst); -return -1; -} - +else entryname = disk->info.alias; + +if (!entryname) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing disk device alias name for %s"), disk->dst); +return -1; } } @@ -10180,7 +10179,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) continue; -if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) +if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) entryname = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; if (!entryname) @@ -16312,8 +16311,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src)) goto endjob; -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { +if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) @@ -16497,8 +16495,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src)) goto endjob; -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { +if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) @@ -16597,7 +16594,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom, virDomainObj *vm = NULL; qemuDomainObjPrivate *priv; g_autoptr(GHashTable) table = NULL; -bool blockdev = false; int ret = -1; size_t i; int n = 0; @@ -16608,7 +16604,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom, goto cleanup; priv = vm->privateData; -blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); if (virDomainGetDiskErrorsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; @@ -16636,7 +16631,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); const char *entryname = disk->info.alias; -if (blockdev && diskPriv->qomName) +if (diskPriv->qomName) entryname = diskPriv->qomName; if ((info = virHashLookup(table, entryname)) && @@ -18505,7 +18500,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk, /* for 'sd' disks we won't be displaying stats for the backing chain * as we don't update the stats correctly */ -if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { +if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { frontendalias = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; backendalias = n->nodeformat; backendstoragealias = n->nodestorage; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 438c903578..260116dc67 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8593,7 +8593,6 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); g_autoptr(GHashTable) table = NULL; size_t i; @@ -8611,7 +8610,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, struct qemuDomainDiskInfo *info; const char *entryname = disk->info.alias; -if (blockdev && diskpriv->qomName) +if (diskpriv->qomName) entryname = diskpriv->qomName; if (!(info = virHashLookup(table, entryname))) -- 2.36.1
[PATCH 06/80] qemu: capabilities: Retire QEMU_CAPS_GLUSTER_DEBUG_LEVEL
The debug level of gluster backend became configurable in qemu-2.8. This also removes the only old-style syntax for the 'blockdev-add' command prior to stabilization. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 4 +--- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 28 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 97c2268f57..cb47da9b1a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -402,7 +402,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "query-qmp-schema", /* X_QEMU_CAPS_QUERY_QMP_SCHEMA */ /* 240 */ - "gluster.debug_level", /* QEMU_CAPS_GLUSTER_DEBUG_LEVEL */ + "gluster.debug_level", /* X_QEMU_CAPS_GLUSTER_DEBUG_LEVEL */ "vhost-scsi", /* QEMU_CAPS_DEVICE_VHOST_SCSI */ "drive-iotune-group", /* X_QEMU_CAPS_DRIVE_IOTUNE_GROUP */ "query-cpu-model-expansion", /* QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION */ @@ -1584,8 +1584,6 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMMU[] = /* see documentation for virQEMUQAPISchemaPathGet for the query format */ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { -{ "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUSTER_DEBUG_LEVEL}, -{ "blockdev-add/arg-type/+gluster/debug", QEMU_CAPS_GLUSTER_DEBUG_LEVEL}, { "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS}, { "blockdev-add/arg-type/+qcow2/encrypt/+luks/key-secret", QEMU_CAPS_QCOW2_LUKS }, { "blockdev-add/arg-type/+file/drop-cache", QEMU_CAPS_MIGRATION_FILE_DROP_CACHE }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index fcb6277538..5a258d9bf4 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -381,7 +381,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ X_QEMU_CAPS_QUERY_QMP_SCHEMA, /* query-qmp-schema command */ /* 240 */ -QEMU_CAPS_GLUSTER_DEBUG_LEVEL, /* -drive gluster.debug_level={0..9} */ +X_QEMU_CAPS_GLUSTER_DEBUG_LEVEL, /* -drive gluster.debug_level={0..9} */ QEMU_CAPS_DEVICE_VHOST_SCSI, /* -device vhost-scsi-{ccw,pci} */ X_QEMU_CAPS_DRIVE_IOTUNE_GROUP, /* -drive throttling.group= */ QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 79bf3d3363..3184b54dfb 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -85,7 +85,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 895c8b2491..0d1d7d709f 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -82,7 +82,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 2b8bf907c5..0d0878f911 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -50,7 +50,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 4c91ed53a6..fd68a0a068 100644 --- a
[PATCH 16/80] qemu: command: Always assume support for QEMU_CAPS_SCSI_DISK_DEVICE_ID
The 'device_id' property of 'scsi_disk' was added in qemu-4.0 and it's unconditionally present, thus we can now always assume it's presence. Update some fake-caps test which didn't yet assert the capability. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 12 +--- .../aarch64-virtio-pci-manual-addresses.args | 2 +- tests/qemuxml2argvdata/multifunction-pci-device.args | 2 +- .../qemuxml2argvdata/pseries-vio-user-assigned.args | 2 +- tests/qemuxml2argvdata/pseries-vio.args | 2 +- tests/qemuxml2argvdata/sparc-minimal.args| 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 17aac57b03..cb54190780 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2141,13 +2141,11 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, * disk serial was not set and the disk serial otherwise. * To avoid a guest-visible regression we need to provide it * ourselves especially for cases when -blockdev will be used */ -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID)) { -if (disk->serial) { -scsiVPDDeviceId = g_strdup(disk->serial); -} else { -if (!(scsiVPDDeviceId = qemuAliasDiskDriveFromDisk(disk))) -return NULL; -} +if (disk->serial) { +scsiVPDDeviceId = g_strdup(disk->serial); +} else { +if (!(scsiVPDDeviceId = qemuAliasDiskDriveFromDisk(disk))) +return NULL; } } diff --git a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args index 3000fea1a6..5242f680d2 100644 --- a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args +++ b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args @@ -36,7 +36,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-aarch64test/.config \ -device virtio-scsi-pci,id=scsi0,bus=pci.3,addr=0x1 \ -blockdev '{"driver":"file","filename":"/aarch64.raw","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ --device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=libvirt-1-format,id=scsi0-0-0-0,bootindex=1 \ +-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi0-0-0-0,drive=libvirt-1-format,id=scsi0-0-0-0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37,bus=pci.3,addr=0x2 \ -netdev user,id=hostnet1 \ diff --git a/tests/qemuxml2argvdata/multifunction-pci-device.args b/tests/qemuxml2argvdata/multifunction-pci-device.args index accb08bd33..2569c3ec71 100644 --- a/tests/qemuxml2argvdata/multifunction-pci-device.args +++ b/tests/qemuxml2argvdata/multifunction-pci-device.args @@ -37,7 +37,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/tmp/scsidisk.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ --device scsi-hd,bus=scsi0.0,scsi-id=0,drive=libvirt-1-format,id=scsi0-0-0,bootindex=1 \ +-device scsi-hd,bus=scsi0.0,scsi-id=0,device_id=drive-scsi0-0-0,drive=libvirt-1-format,id=scsi0-0-0,bootindex=1 \ -audiodev '{"id":"audio1","driver":"none"}' \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/pseries-vio-user-assigned.args b/tests/qemuxml2argvdata/pseries-vio-user-assigned.args index 5989b38a25..88ff276a4b 100644 --- a/tests/qemuxml2argvdata/pseries-vio-user-assigned.args +++ b/tests/qemuxml2argvdata/pseries-vio-user-assigned.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/tmp/scsidisk.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ --device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=libvirt-1-format,id=scsi1-0-0-0,bootindex=1 \ +-device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi1-0-0-0,drive=libvirt-1-format,id=scsi1-0-0-0,bootindex=1 \ -chardev pty,id=charserial0 \ -device spapr-vty,chardev=charserial0,id=serial0,reg=536870912 \ -chardev pty,id=charserial1 \ diff --git a/tests/qemuxml2argvdata/pseries-vio.args b/tests/qemuxml2argvdata/pseries-vio.args index 53277f2287..f83d891682 100644 --- a/tests/qemuxml2argvdata/pseries-vio.args +++ b/tests/qemuxml2argvdata/pseries-vio.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tm
[PATCH 17/80] qemu: capabilities: Retire capabilities used for -blockdev detection
Retire: QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC QEMU_CAPS_SCSI_DISK_DEVICE_ID QEMU_CAPS_SAVEVM_MONITOR_NODES Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 9 +++-- src/qemu/qemu_capabilities.h | 6 +++--- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 3 --- tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 2 -- tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 3 --- tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 3 --- tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 3 --- tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 3 --- tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 3 --- tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 3 --- tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 3 --- tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 3 --- tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 3 --- tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 3 --- tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 3 --- tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 3 --- 28 files changed, 6 insertions(+), 86 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9cffb07b9d..d660b3b9f0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -521,7 +521,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "nvdimm.unarmed", /* QEMU_CAPS_DEVICE_NVDIMM_UNARMED */ /* 325 */ - "scsi-disk.device_id", /* QEMU_CAPS_SCSI_DISK_DEVICE_ID */ + "scsi-disk.device_id", /* X_QEMU_CAPS_SCSI_DISK_DEVICE_ID */ "virtio-pci-non-transitional", /* QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL */ "overcommit", /* X_QEMU_CAPS_OVERCOMMIT */ "query-current-machine", /* QEMU_CAPS_QUERY_CURRENT_MACHINE */ @@ -550,8 +550,8 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 345 */ "arm-max-cpu", /* QEMU_CAPS_ARM_MAX_CPU */ - "blockdev-file-dynamic-auto-read-only", /* QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC */ - "savevm-monitor-nodes", /* QEMU_CAPS_SAVEVM_MONITOR_NODES */ + "blockdev-file-dynamic-auto-read-only", /* X_QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC */ + "savevm-monitor-nodes", /* X_QEMU_CAPS_SAVEVM_MONITOR_NODES */ "drive-nvme", /* QEMU_CAPS_DRIVE_NVME */ "smp-dies", /* QEMU_CAPS_SMP_DIES */ @@ -1483,7 +1483,6 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsSCSIDisk[] = { { "wwn", QEMU_CAPS_SCSI_DISK_WWN, NULL }, { "share-rw", QEMU_CAPS_DISK_SHARE_RW, NULL }, { "write-cache", QEMU_CAPS_DISK_WRITE_CACHE, NULL }, -{ "device_id", QEMU_CAPS_SCSI_DISK_DEVICE_ID, NULL }, { "rotation_rate", QEMU_CAPS_ROTATION_RATE, NULL }, }; @@ -1586,7 +1585,6 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMMU[] = static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS}, { "blockdev-add/arg-type/+file/drop-cache", QEMU_CAPS_MIGRATION_FILE_DROP_CACHE }, -{ "blockdev-add/arg-type/+file/$dynamic-auto-read-only", QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC }, { "blockdev-add/arg-type/+nvme", QEMU_CAPS_DRIVE_NVME }, { "blockdev-add/arg-type/+file/aio/^io_uring", QEMU_CAPS_AIO_IO_URING }, { "blockdev-add/arg-type/+rbd/encrypt", QEMU_CAPS_RBD_ENCRYPTION }, @@ -1597,7 +1595,6 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "chardev-add/arg-type/backend/+file/data/logfile", QEMU_CAPS_CHARDEV_LOGFILE }, { "chardev-add/arg-type/backend/+file/data/logappend", QEMU_CAPS_CHARDEV_FILE_APPEND }, { "device_add/$json-cli-hotplug", QEMU_CAPS_DEVICE_JSON }, -{ "human-monitor-command/$savevm-monitor-nodes", QEMU_CAPS_SAVEVM_MONITOR_NODES }, { "migrate-set-parameters/arg-type/block-bitmap-mapping/bitmaps/transform", QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING }, { "nbd-server-start/arg-type/tls-creds", QEMU_CAPS_NBD_TLS }, { "nbd-server-add/arg-type/bitmap", QEMU_CAPS_NBD_BITMAP }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7c5df0554b..5ca177b599 100644 --
[PATCH 20/80] qemu: block: Remove legacy spellings for InetSocketAddress
In one of early iterations of the gluster driver 'tcp' was used instead of 'inet' and 'socket' instead of 'path' for unix sockets. All of this can be now removed. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 44 ++- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 9fe22f18f2..870d44ecd5 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -432,36 +432,24 @@ qemuBlockStorageSourceGetURI(virStorageSource *src) /** * qemuBlockStorageSourceBuildJSONSocketAddress * @host: the virStorageNetHostDef * definition to build - * @legacy: use old field names/values * * Formats @hosts into a json object conforming to the 'SocketAddress' type * in qemu. * - * For compatibility with old approach used in the gluster driver of old qemus - * use the old spelling for TCP transport and, the path field of the unix socket. - * * Returns a virJSONValue * for a single server. */ static virJSONValue * -qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host, - bool legacy) +qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host) { g_autoptr(virJSONValue) server = NULL; -const char *transport; -const char *field; g_autofree char *port = NULL; switch ((virStorageNetHostTransport) host->transport) { case VIR_STORAGE_NET_HOST_TRANS_TCP: -if (legacy) -transport = "tcp"; -else -transport = "inet"; - port = g_strdup_printf("%u", host->port); if (virJSONValueObjectAdd(&server, - "s:type", transport, + "s:type", "inet", "s:host", host->name, "s:port", port, NULL) < 0) @@ -469,14 +457,9 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host, break; case VIR_STORAGE_NET_HOST_TRANS_UNIX: -if (legacy) -field = "s:socket"; -else -field = "s:path"; - if (virJSONValueObjectAdd(&server, "s:type", "unix", - field, host->socket, + "s:path", host->socket, NULL) < 0) return NULL; break; @@ -496,14 +479,12 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host, /** * qemuBlockStorageSourceBuildHostsJSONSocketAddress: * @src: disk storage source - * @legacy: use 'tcp' instead of 'inet' for compatibility reasons * * Formats src->hosts into a json object conforming to the 'SocketAddress' type * in qemu. */ static virJSONValue * -qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSource *src, - bool legacy) +qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSource *src) { g_autoptr(virJSONValue) servers = NULL; g_autoptr(virJSONValue) server = NULL; @@ -515,7 +496,7 @@ qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSource *src, for (i = 0; i < src->nhosts; i++) { host = src->hosts + i; -if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(host, legacy))) +if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(host))) return NULL; if (virJSONValueArrayAppend(servers, &server) < 0) @@ -614,13 +595,12 @@ qemuBlockStorageSourceBuildHostsJSONInetSocketAddress(virStorageSource *src) static virJSONValue * qemuBlockStorageSourceGetGlusterProps(virStorageSource *src, - bool legacy, bool onlytarget) { g_autoptr(virJSONValue) servers = NULL; g_autoptr(virJSONValue) props = NULL; -if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, legacy))) +if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src))) return NULL; /* { driver:"gluster", @@ -851,9 +831,7 @@ qemuBlockStorageSourceGetNBDProps(virStorageSource *src, return NULL; } -serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0], - false); -if (!serverprops) +if (!(serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0]))) return NULL; if (onlytarget) { @@ -952,9 +930,7 @@ qemuBlockStorageSourceGetSheepdogProps(virStorageSource *src) return NULL; } -serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0], - false); -if (!serverprops) +if (!(serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0
[PATCH 22/80] qemuMigrationSrcNBDStorageCopyBlockdev: Remove some arguments
We no longer need the arguments which were conditionally filled based on presence of the QEMU_CAPS_BLOCKDEV feature. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ef24a1dedf..042e8bb10a 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1025,9 +1025,6 @@ static int qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, virDomainObj *vm, virDomainDiskDef *disk, - const char *jobname, - const char *sourcename, - bool persistjob, const char *host, int port, const char *socket, @@ -1041,6 +1038,10 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); int mon_ret = 0; g_autoptr(virStorageSource) copysrc = NULL; +g_autofree char *diskAlias = qemuAliasDiskDriveFromDisk(disk); + +if (!diskAlias) +return -1; VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", disk->dst, host); @@ -1062,8 +1063,9 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, mon_ret = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm), data); if (mon_ret == 0) -mon_ret = qemuMonitorBlockdevMirror(qemuDomainGetMonitor(vm), jobname, persistjob, -sourcename, copysrc->nodeformat, +mon_ret = qemuMonitorBlockdevMirror(qemuDomainGetMonitor(vm), diskAlias, true, +qemuDomainDiskGetTopNodename(disk), +copysrc->nodeformat, mirror_speed, 0, 0, mirror_shallow, syncWrites); @@ -1109,9 +,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, qemuBlockJobSyncBegin(job); rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, -disk, diskAlias, - qemuDomainDiskGetTopNodename(disk), -true, +disk, host, port, socket, mirror_speed, mirror_shallow, -- 2.36.1
[PATCH 18/80] qemu: Remove code conditional on QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Now that QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI is always set we can remove the code which handled cases when the capability was not set. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 142 +++- src/qemu/qemu_domain.c | 18 ++--- 2 files changed, 43 insertions(+), 117 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cb54190780..e0c5e15a63 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5091,27 +5091,6 @@ qemuBuildHubCommandLine(virCommand *cmd, } -static char * -qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDef *dev) -{ -g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; -g_autoptr(virJSONValue) srcprops = NULL; -virDomainHostdevSubsysSCSI *scsisrc = &dev->source.subsys.u.scsi; -virDomainHostdevSubsysSCSIiSCSI *iscsisrc = &scsisrc->u.iscsi; - -if (!(srcprops = qemuDiskSourceGetProps(iscsisrc->src))) -return NULL; - -if (virQEMUBuildCommandLineJSON(srcprops, &buf, NULL, -virQEMUBuildCommandLineJSONArrayNumbered) < 0) -return NULL; - -virBufferAddLit(&buf, ",if=none,format=raw"); - -return virBufferContentAndReset(&buf); -} - - virJSONValue * qemuBuildSCSIVHostHostdevDevProps(const virDomainDef *def, virDomainHostdevDef *dev, @@ -5138,32 +5117,6 @@ qemuBuildSCSIVHostHostdevDevProps(const virDomainDef *def, } -static char * -qemuBuildSCSIHostdevDrvStr(virDomainHostdevDef *dev) -{ -g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; -g_autofree char *source = NULL; -g_autofree char *drivealias = NULL; -virDomainHostdevSubsysSCSI *scsisrc = &dev->source.subsys.u.scsi; - -if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) { -if (!(source = qemuBuildSCSIiSCSIHostdevDrvStr(dev))) -return NULL; -virBufferAdd(&buf, source, -1); -} else { -virBufferAsprintf(&buf, "file=%s,if=none,format=raw", scsisrc->u.host.src->path); -} - -if (!(drivealias = qemuAliasFromHostdev(dev))) -return NULL; -virBufferAsprintf(&buf, ",id=%s", drivealias); - -if (dev->readonly) -virBufferAddLit(&buf, ",readonly=on"); - -return virBufferContentAndReset(&buf); -} - virJSONValue * qemuBuildSCSIHostdevDevProps(const virDomainDef *def, virDomainHostdevDef *dev, @@ -5286,41 +5239,34 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def, qemuBlockStorageSourceAttachData * qemuBuildHostdevSCSIDetachPrepare(virDomainHostdevDef *hostdev, - virQEMUCaps *qemuCaps) + virQEMUCaps *qemuCaps G_GNUC_UNUSED) { virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi; g_autoptr(qemuBlockStorageSourceAttachData) ret = g_new0(qemuBlockStorageSourceAttachData, 1); +virStorageSource *src; +qemuDomainStorageSourcePrivate *srcpriv; -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) { -virStorageSource *src; -qemuDomainStorageSourcePrivate *srcpriv; - -switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { -case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: -src = scsisrc->u.host.src; -break; - -case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: -src = scsisrc->u.iscsi.src; -break; +switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { +case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: +src = scsisrc->u.host.src; +break; -case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: -default: -virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc->protocol); -return NULL; -} +case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: +src = scsisrc->u.iscsi.src; +break; -srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); -ret->storageNodeName = src->nodestorage; -ret->storageAttached = true; +case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: +default: +virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc->protocol); +return NULL; +} -if (srcpriv && srcpriv->secinfo) -ret->authsecretAlias = g_strdup(srcpriv->secinfo->alias); +srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); +ret->storageNodeName = src->nodestorage; +ret->storageAttached = true; -} else { -ret->driveAlias = qemuAliasFromHostdev(hostdev); -ret->driveAdded = true; -} +if (srcpriv && srcpriv->secinfo) +ret->authsecretAlias = g_strdup(srcpriv->secinfo->alias); return g_steal_pointer(&ret); } @@ -5329,45 +5275,35 @@ qemuBuildHostdevSCSIDetachPrepare(virDomainHostdevDef *hostdev, qemuBlockStorageSourceAttachData * qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDef *hostdev,
[PATCH 31/80] qemu: blockjob: Remove legacy block job completion code
Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 136 +-- 1 file changed, 1 insertion(+), 135 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index ed82ac5dc2..304008a31a 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -703,137 +703,6 @@ qemuBlockJobRewriteConfigDiskSource(virDomainObj *vm, } -static void -qemuBlockJobEventProcessLegacyCompleted(virQEMUDriver *driver, -virDomainObj *vm, -qemuBlockJobData *job, -int asyncJob) -{ -virDomainDiskDef *disk = job->disk; - -if (!disk) -return; - -if (disk->mirrorState == VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT) { -qemuBlockJobRewriteConfigDiskSource(vm, disk, disk->mirror); -/* XXX We want to revoke security labels as well as audit that - * revocation, before dropping the original source. But it gets - * tricky if both source and mirror share common backing files (we - * want to only revoke the non-shared portion of the chain); so for - * now, we leak the access to the original. */ -virDomainLockImageDetach(driver->lockManager, vm, disk->src); - -/* Move secret driver metadata */ -if (qemuSecurityMoveImageMetadata(driver, vm, disk->src, disk->mirror) < 0) { -VIR_WARN("Unable to move disk metadata on " - "vm %s from %s to %s (disk target %s)", - vm->def->name, - NULLSTR(disk->src->path), - NULLSTR(disk->mirror->path), - disk->dst); -} - -virObjectUnref(disk->src); -disk->src = disk->mirror; -} else { -if (disk->mirror) { -virDomainLockImageDetach(driver->lockManager, vm, disk->mirror); - -/* Ideally, we would restore seclabels on the backing chain here - * but we don't know if somebody else is not using parts of it. - * Remove security driver metadata so that they are not leaked. */ -qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror); - -virObjectUnref(disk->mirror); -} - -qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src); -} - -/* Recompute the cached backing chain to match our - * updates. Better would be storing the chain ourselves - * rather than reprobing, but we haven't quite completed - * that conversion to use our XML tracking. */ -disk->mirror = NULL; -disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE; -disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN; -disk->src->id = 0; -virStorageSourceBackingStoreClear(disk->src); -ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk, NULL, true)); -ignore_value(qemuBlockNodeNamesDetect(driver, vm, asyncJob)); -qemuBlockJobUnregister(job, vm); -qemuDomainSaveConfig(vm); -} - - -/** - * qemuBlockJobEventProcessLegacy: - * @driver: qemu driver - * @vm: domain - * @job: job to process events for - * - * Update disk's mirror state in response to a block job event - * from QEMU. For mirror state's that must survive libvirt - * restart, also update the domain's status XML. - */ -static void -qemuBlockJobEventProcessLegacy(virQEMUDriver *driver, - virDomainObj *vm, - qemuBlockJobData *job, - int asyncJob) -{ -virDomainDiskDef *disk = job->disk; - -VIR_DEBUG("disk=%s, mirrorState=%s, type=%d, state=%d, newstate=%d", - disk->dst, - NULLSTR(virDomainDiskMirrorStateTypeToString(disk->mirrorState)), - job->type, - job->state, - job->newstate); - -if (job->newstate == -1) -return; - -qemuBlockJobEmitEvents(driver, vm, disk, job->type, job->newstate); - -job->state = job->newstate; -job->newstate = -1; - -/* If we completed a block pull or commit, then update the XML - * to match. */ -switch ((virConnectDomainEventBlockJobStatus) job->state) { -case VIR_DOMAIN_BLOCK_JOB_COMPLETED: -qemuBlockJobEventProcessLegacyCompleted(driver, vm, job, asyncJob); -break; - -case VIR_DOMAIN_BLOCK_JOB_READY: -disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY; -qemuDomainSaveStatus(vm); -break; - -case VIR_DOMAIN_BLOCK_JOB_FAILED: -case VIR_DOMAIN_BLOCK_JOB_CANCELED: -if (disk->mirror) { -virDomainLockImageDetach(driver->lockManager, vm, disk->mirror); - -/* Ideally, we would restore seclabels on the backing chain here - * but we don't know if somebody else is not using parts of it. - * Remove security driver metadata so that they are not leaked. */ -qemuBlockRemoveImageMetadata(driver, vm
[PATCH 33/80] qemu: monitor: Remove infrastructure for BLOCK_JOB_* events
We no longer need it as we use the more modern job events. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 14 -- src/qemu/qemu_monitor.h | 12 - src/qemu/qemu_monitor_json.c | 90 3 files changed, 116 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b575eaae06..a58aa5622f 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1255,20 +1255,6 @@ qemuMonitorEmitPMSuspendDisk(qemuMonitor *mon) } -void -qemuMonitorEmitBlockJob(qemuMonitor *mon, -const char *diskAlias, -int type, -int status, -const char *error) -{ -VIR_DEBUG("mon=%p", mon); - -QEMU_MONITOR_CALLBACK(mon, domainBlockJob, mon->vm, - diskAlias, type, status, error); -} - - void qemuMonitorEmitJobStatusChange(qemuMonitor *mon, const char *jobname, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 916a86f423..0e3640c1da 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -222,12 +222,6 @@ typedef void (*qemuMonitorDomainGraphicsCallback)(qemuMonitor *mon, const char *authScheme, const char *x509dname, const char *saslUsername); -typedef void (*qemuMonitorDomainBlockJobCallback)(qemuMonitor *mon, - virDomainObj *vm, - const char *diskAlias, - int type, - int status, - const char *error); typedef void (*qemuMonitorDomainJobStatusChangeCallback)(qemuMonitor *mon, virDomainObj *vm, const char *jobname, @@ -381,7 +375,6 @@ struct _qemuMonitorCallbacks { qemuMonitorDomainWatchdogCallback domainWatchdog; qemuMonitorDomainIOErrorCallback domainIOError; qemuMonitorDomainGraphicsCallback domainGraphics; -qemuMonitorDomainBlockJobCallback domainBlockJob; qemuMonitorDomainJobStatusChangeCallback jobStatusChange; qemuMonitorDomainTrayChangeCallback domainTrayChange; qemuMonitorDomainPMWakeupCallback domainPMWakeup; @@ -476,11 +469,6 @@ void qemuMonitorEmitTrayChange(qemuMonitor *mon, int reason); void qemuMonitorEmitPMWakeup(qemuMonitor *mon); void qemuMonitorEmitPMSuspend(qemuMonitor *mon); -void qemuMonitorEmitBlockJob(qemuMonitor *mon, - const char *diskAlias, - int type, - int status, - const char *error); void qemuMonitorEmitJobStatusChange(qemuMonitor *mon, const char *jobname, qemuMonitorJobStatus status); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8cda6f36b7..4584786872 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -65,9 +65,6 @@ static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitor *mon, virJSONValue static void qemuMonitorJSONHandleTrayChange(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandlePMWakeup(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandlePMSuspend(qemuMonitor *mon, virJSONValue *data); -static void qemuMonitorJSONHandleBlockJobCompleted(qemuMonitor *mon, virJSONValue *data); -static void qemuMonitorJSONHandleBlockJobCanceled(qemuMonitor *mon, virJSONValue *data); -static void qemuMonitorJSONHandleBlockJobReady(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandleJobStatusChange(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandleBalloonChange(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandlePMSuspendDisk(qemuMonitor *mon, virJSONValue *data); @@ -97,9 +94,6 @@ static qemuEventHandler eventHandlers[] = { { "ACPI_DEVICE_OST", qemuMonitorJSONHandleAcpiOstInfo, }, { "BALLOON_CHANGE", qemuMonitorJSONHandleBalloonChange, }, { "BLOCK_IO_ERROR", qemuMonitorJSONHandleIOError, }, -{ "BLOCK_JOB_CANCELLED", qemuMonitorJSONHandleBlockJobCanceled, }, -{ "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJobCompleted, }, -{ "BLOCK_JOB_READY", qemuMonitorJSONHandleBlockJobReady, }, { "BLOCK_WRITE_THRESHOLD", qemuMonitorJSONHandleBlockThreshold, }, { "DEVICE_DELETED", qemuMonitorJSONHandleDeviceDeleted, }, { "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, }, @@ -895,67 +889,6 @@ static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitor *mon,
[PATCH 34/80] qemuDomainSetBlockThreshold: Remove pre-blockdev node name detection
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 12 1 file changed, 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1e7f17b750..e7b0acd46f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19809,18 +19809,6 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, goto endjob; } -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -!src->nodestorage && -qemuBlockNodeNamesDetect(driver, vm, VIR_ASYNC_JOB_NONE) < 0) -goto endjob; - -if (!src->nodestorage) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("threshold currently can't be set for block device '%s'"), - dev); -goto endjob; -} - nodename = g_strdup(src->nodestorage); qemuDomainObjEnterMonitor(driver, vm); -- 2.36.1
[PATCH 27/80] qemu: block: Remove pre-blockdev code paths
Signed-off-by: Peter Krempa --- src/qemu/qemu_backup.c| 2 +- src/qemu/qemu_block.c | 10 +- src/qemu/qemu_block.h | 1 - src/qemu/qemu_migration.c | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index d2a5d2db5f..b90185a375 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -536,7 +536,7 @@ qemuBackupBeginPullExportDisks(virDomainObj *vm, if (!dd->backupdisk->exportname) dd->backupdisk->exportname = g_strdup(dd->domdisk->dst); -if (qemuBlockExportAddNBD(vm, NULL, +if (qemuBlockExportAddNBD(vm, dd->store, dd->backupdisk->exportname, false, diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 81c807660f..141bf1b3e7 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3534,21 +3534,18 @@ qemuBlockExportGetNBDProps(const char *nodename, /** * qemuBlockExportAddNBD: * @vm: domain object - * @drivealias: (optional) alias of -drive to export in pre-blockdev configurations * @src: disk source to export * @exportname: name for the export * @writable: whether the NBD export allows writes * @bitmap: (optional) block dirty bitmap to export along * * This function automatically selects the proper invocation of exporting a - * block backend via NBD in qemu. This includes use of nodename for blockdev - * and proper configuration for the exportname for older qemus. + * block backend via NBD in qemu. * * This function must be called while in the monitor context. */ int qemuBlockExportAddNBD(virDomainObj *vm, - const char *drivealias, virStorageSource *src, const char *exportname, bool writable, @@ -3558,11 +3555,6 @@ qemuBlockExportAddNBD(virDomainObj *vm, g_autoptr(virJSONValue) nbdprops = NULL; const char *bitmaps[2] = { bitmap, NULL }; -/* older qemu versions didn't support configuring the exportname and - * took the 'drivealias' as the export name */ -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -return qemuMonitorNBDServerAdd(priv->mon, drivealias, NULL, writable, NULL); - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_EXPORT_ADD)) return qemuMonitorNBDServerAdd(priv->mon, src->nodeformat, exportname, writable, bitmap); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index bcd3f5960b..b22a541797 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -291,7 +291,6 @@ qemuBlockExportGetNBDProps(const char *nodename, int qemuBlockExportAddNBD(virDomainObj *vm, - const char *drivealias, virStorageSource *src, const char *exportname, bool writable, diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 16d65ff22e..a6d097c304 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -614,7 +614,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver, server_started = true; } -if (qemuBlockExportAddNBD(vm, diskAlias, disk->src, diskAlias, true, NULL) < 0) +if (qemuBlockExportAddNBD(vm, disk->src, diskAlias, true, NULL) < 0) goto exit_monitor; qemuDomainObjExitMonitor(vm); } -- 2.36.1
[PATCH 26/80] qemu: Remove unused code for pre-blockdev disk snapshot monitor interaction
Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c| 20 src/qemu/qemu_block.h| 6 -- src/qemu/qemu_monitor.c | 12 src/qemu/qemu_monitor.h | 6 -- src/qemu/qemu_monitor_json.c | 22 -- src/qemu/qemu_monitor_json.h | 6 -- tests/qemumonitorjsontest.c | 1 - 7 files changed, 73 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 870d44ecd5..81c807660f 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2108,26 +2108,6 @@ qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriver *driver, } -int -qemuBlockSnapshotAddLegacy(virJSONValue *actions, - virDomainDiskDef *disk, - virStorageSource *newsrc, - bool reuse) -{ -const char *format = virStorageFileFormatTypeToString(newsrc->format); -g_autofree char *device = NULL; -g_autofree char *source = NULL; - -if (!(device = qemuAliasDiskDriveFromDisk(disk))) -return -1; - -if (qemuGetDriveSourceString(newsrc, NULL, &source) < 0) -return -1; - -return qemuMonitorTransactionSnapshotLegacy(actions, device, source, format, reuse); -} - - int qemuBlockSnapshotAddBlockdev(virJSONValue *actions, virDomainDiskDef *disk, diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 8641c8a2d2..bcd3f5960b 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -179,12 +179,6 @@ qemuBlockStorageSourceChainDetach(qemuMonitor *mon, G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuBlockStorageSourceChainData, qemuBlockStorageSourceChainDataFree); -int -qemuBlockSnapshotAddLegacy(virJSONValue *actions, - virDomainDiskDef *disk, - virStorageSource *newsrc, - bool reuse); - int qemuBlockSnapshotAddBlockdev(virJSONValue *actions, virDomainDiskDef *disk, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 6ebdeb46f3..b575eaae06 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4397,18 +4397,6 @@ qemuMonitorTransactionBitmapMergeSourceAddBitmap(virJSONValue *sources, } -int -qemuMonitorTransactionSnapshotLegacy(virJSONValue *actions, - const char *device, - const char *path, - const char *format, - bool existing) -{ -return qemuMonitorJSONTransactionSnapshotLegacy(actions, device, path, -format, existing); -} - - int qemuMonitorTransactionSnapshotBlockdev(virJSONValue *actions, const char *node, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index b82f198285..916a86f423 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1461,12 +1461,6 @@ qemuMonitorTransactionBitmapMergeSourceAddBitmap(virJSONValue *sources, const char *sourcebitmap); int -qemuMonitorTransactionSnapshotLegacy(virJSONValue *actions, - const char *device, - const char *path, - const char *format, - bool existing); -int qemuMonitorTransactionSnapshotBlockdev(virJSONValue *actions, const char *node, const char *overlay); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 941596563a..8cda6f36b7 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8548,28 +8548,6 @@ qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(virJSONValue *sources, } -int -qemuMonitorJSONTransactionSnapshotLegacy(virJSONValue *actions, - const char *device, - const char *path, - const char *format, - bool existing) -{ -const char *mode = NULL; - -if (existing) -mode = "existing"; - -return qemuMonitorJSONTransactionAdd(actions, - "blockdev-snapshot-sync", - "s:device", device, - "s:snapshot-file", path, - "s:format", format, - "S:mode", mode, - NULL); -} - - int qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValue *actions, const char *node, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index e4
[PATCH 32/80] qemu: Remove legacy block job event processing handler
Previous patches removed the job submission for the handler so now even the handler itself can be removed. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 1 - src/qemu/qemu_domain.h | 1 - src/qemu/qemu_driver.c | 45 -- 3 files changed, 47 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d45c5d30a9..7403b2584b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11126,7 +11126,6 @@ qemuProcessEventFree(struct qemuProcessEvent *event) case QEMU_PROCESS_EVENT_DEVICE_DELETED: case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED: case QEMU_PROCESS_EVENT_SERIAL_CHANGED: -case QEMU_PROCESS_EVENT_BLOCK_JOB: case QEMU_PROCESS_EVENT_MONITOR_EOF: case QEMU_PROCESS_EVENT_GUEST_CRASHLOADED: g_free(event->data); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 4680df1098..66188ed003 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -418,7 +418,6 @@ typedef enum { QEMU_PROCESS_EVENT_DEVICE_DELETED, QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED, QEMU_PROCESS_EVENT_SERIAL_CHANGED, -QEMU_PROCESS_EVENT_BLOCK_JOB, QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE, QEMU_PROCESS_EVENT_MONITOR_EOF, QEMU_PROCESS_EVENT_PR_DISCONNECT, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d5a3181c0d..1e7f17b750 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4031,45 +4031,6 @@ processSerialChangedEvent(virQEMUDriver *driver, } -static void -processBlockJobEvent(virQEMUDriver *driver, - virDomainObj *vm, - const char *diskAlias, - int type, - int status) -{ -virDomainDiskDef *disk; -g_autoptr(qemuBlockJobData) job = NULL; - -if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) -return; - -if (!virDomainObjIsActive(vm)) { -VIR_DEBUG("Domain is not running"); -goto endjob; -} - -if (!(disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL))) { -VIR_DEBUG("disk %s not found", diskAlias); -goto endjob; -} - -if (!(job = qemuBlockJobDiskGetJob(disk))) { -VIR_DEBUG("creating new block job object for '%s'", diskAlias); -if (!(job = qemuBlockJobDiskNew(vm, disk, type, diskAlias))) -goto endjob; -job->state = QEMU_BLOCKJOB_STATE_RUNNING; -} - -job->newstate = status; - -qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_NONE); - - endjob: -qemuDomainObjEndJob(vm); -} - - static void processJobStatusChangeEvent(virQEMUDriver *driver, virDomainObj *vm, @@ -4279,12 +4240,6 @@ static void qemuProcessEventHandler(void *data, void *opaque) processSerialChangedEvent(driver, vm, processEvent->data, processEvent->action); break; -case QEMU_PROCESS_EVENT_BLOCK_JOB: -processBlockJobEvent(driver, vm, - processEvent->data, - processEvent->action, - processEvent->status); -break; case QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE: processJobStatusChangeEvent(driver, vm, processEvent->data); break; -- 2.36.1
[PATCH 25/80] qemu: snapshot: Remove pre-blockdev code paths
Assume that QEMU_CAPS_BLOCKDEV is present and remove all code executed when it's not. Signed-off-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 116 +-- 1 file changed, 15 insertions(+), 101 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 0733d44faa..b96ef7a50b 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -449,8 +449,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDef *snapdisk, static int qemuSnapshotPrepareDiskExternalActive(virDomainObj *vm, virDomainSnapshotDiskDef *snapdisk, - virDomainDiskDef *domdisk, - bool blockdev) + virDomainDiskDef *domdisk) { virStorageType actualType = virStorageSourceGetActualType(snapdisk->src); @@ -470,38 +469,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainObj *vm, switch (actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: -break; - case VIR_STORAGE_TYPE_NETWORK: -/* defer all of the checking to either qemu or libvirt's blockdev code */ -if (blockdev) -break; - -switch ((virStorageNetProtocol) snapdisk->src->protocol) { -case VIR_STORAGE_NET_PROTOCOL_GLUSTER: -break; - -case VIR_STORAGE_NET_PROTOCOL_NONE: -case VIR_STORAGE_NET_PROTOCOL_NBD: -case VIR_STORAGE_NET_PROTOCOL_RBD: -case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: -case VIR_STORAGE_NET_PROTOCOL_ISCSI: -case VIR_STORAGE_NET_PROTOCOL_HTTP: -case VIR_STORAGE_NET_PROTOCOL_HTTPS: -case VIR_STORAGE_NET_PROTOCOL_FTP: -case VIR_STORAGE_NET_PROTOCOL_FTPS: -case VIR_STORAGE_NET_PROTOCOL_TFTP: -case VIR_STORAGE_NET_PROTOCOL_SSH: -case VIR_STORAGE_NET_PROTOCOL_VXHS: -case VIR_STORAGE_NET_PROTOCOL_NFS: -case VIR_STORAGE_NET_PROTOCOL_LAST: -virReportError(VIR_ERR_INTERNAL_ERROR, - _("external active snapshots are not supported on " - "'network' disks using '%s' protocol"), - virStorageNetProtocolTypeToString(snapdisk->src->protocol)); -return -1; - -} break; case VIR_STORAGE_TYPE_DIR: @@ -528,17 +496,8 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm, virDomainDiskDef *disk, virDomainSnapshotDiskDef *snapdisk, bool active, -bool reuse, -bool blockdev) +bool reuse) { - -if (disk->src->readonly && !(reuse || blockdev)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("external snapshot for readonly disk %s " - "is not supported"), disk->dst); -return -1; -} - if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0) return -1; @@ -549,7 +508,7 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm, if (qemuSnapshotPrepareDiskExternalInactive(snapdisk, disk) < 0) return -1; } else { -if (qemuSnapshotPrepareDiskExternalActive(vm, snapdisk, disk, blockdev) < 0) +if (qemuSnapshotPrepareDiskExternalActive(vm, snapdisk, disk) < 0) return -1; } @@ -679,8 +638,6 @@ qemuSnapshotPrepare(virDomainObj *vm, bool *has_manual, unsigned int *flags) { -qemuDomainObjPrivate *priv = vm->privateData; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); size_t i; bool active = virDomainObjIsActive(vm); bool reuse = (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0; @@ -742,16 +699,10 @@ qemuSnapshotPrepare(virDomainObj *vm, _("metadata cache max size control is supported only with qcow2 images")); return -1; } - -if (!blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("metadata cache max size control is not supported with this QEMU binary")); -return -1; -} } if (qemuSnapshotPrepareDiskExternal(vm, dom_disk, disk, -active, reuse, blockdev) < 0) +active, reuse) < 0) return -1; external++; @@ -1059,10 +1010,7 @@ qemuSnapshotDiskPrepareOne(qemuSnapshotDiskContext *snapctxt, virDomainObj *vm = snapctxt->vm; qemuDomainObjPrivate *priv = vm->privateData; virQEMUDriver *driver = priv->driver; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
[PATCH 30/80] qemu: process: Remove pre-blockdev code paths
Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 182 +--- 1 file changed, 2 insertions(+), 180 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 980e06ce79..6083ee10d8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -873,50 +873,6 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED, virObjectEventStateQueue(driver->domainEventState, lifecycleEvent); } -static void -qemuProcessHandleBlockJob(qemuMonitor *mon G_GNUC_UNUSED, - virDomainObj *vm, - const char *diskAlias, - int type, - int status, - const char *error) -{ -qemuDomainObjPrivate *priv; -virDomainDiskDef *disk; -g_autoptr(qemuBlockJobData) job = NULL; - -virObjectLock(vm); - -priv = vm->privateData; - -/* with QEMU_CAPS_BLOCKDEV we handle block job events via JOB_STATUS_CHANGE */ -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -goto cleanup; - -VIR_DEBUG("Block job for device %s (domain: %p,%s) type %d status %d", - diskAlias, vm, vm->def->name, type, status); - -if (!(disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL))) -goto cleanup; - -job = qemuBlockJobDiskGetJob(disk); - -if (job && job->synchronous) { -/* We have a SYNC API waiting for this event, dispatch it back */ -job->newstate = status; -VIR_FREE(job->errmsg); -job->errmsg = g_strdup(error); -virDomainObjBroadcast(vm); -} else { -/* there is no waiting SYNC API, dispatch the update to a thread */ -qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_BLOCK_JOB, - type, status, g_strdup(diskAlias)); -} - - cleanup: -virObjectUnlock(vm); -} - static void qemuProcessHandleJobStatusChange(qemuMonitor *mon G_GNUC_UNUSED, @@ -935,11 +891,6 @@ qemuProcessHandleJobStatusChange(qemuMonitor *mon G_GNUC_UNUSED, jobname, vm, vm->def->name, qemuMonitorJobStatusTypeToString(status), status); -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -VIR_DEBUG("job '%s' handled by old blockjob handler", jobname); -goto cleanup; -} - if ((jobnewstate = qemuBlockjobConvertMonitorStatus(status)) == QEMU_BLOCKJOB_STATE_LAST) goto cleanup; @@ -1822,7 +1773,6 @@ static qemuMonitorCallbacks monitorCallbacks = { .domainWatchdog = qemuProcessHandleWatchdog, .domainIOError = qemuProcessHandleIOError, .domainGraphics = qemuProcessHandleGraphics, -.domainBlockJob = qemuProcessHandleBlockJob, .jobStatusChange = qemuProcessHandleJobStatusChange, .domainTrayChange = qemuProcessHandleTrayChange, .domainPMWakeup = qemuProcessHandlePMWakeup, @@ -6834,10 +6784,8 @@ qemuProcessPrepareHostStorage(virQEMUDriver *driver, virDomainObj *vm, unsigned int flags) { -qemuDomainObjPrivate *priv = vm->privateData; size_t i; bool cold_boot = flags & VIR_QEMU_PROCESS_START_COLD; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); for (i = vm->def->ndisks; i > 0; i--) { size_t idx = i - 1; @@ -6847,7 +6795,7 @@ qemuProcessPrepareHostStorage(virQEMUDriver *driver, continue; /* backing chain needs to be redetected if we aren't using blockdev */ -if (!blockdev || qemuDiskBusIsSD(disk->bus)) +if (qemuDiskBusIsSD(disk->bus)) virStorageSourceBackingStoreClear(disk->src); /* @@ -7294,13 +7242,9 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, virDomainObj *vm, virDomainAsyncJob asyncJob) { -qemuDomainObjPrivate *priv = vm->privateData; size_t i; int ret = -1; -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -return 0; - VIR_DEBUG("Setting up disk throttling for -blockdev via block_set_io_throttle"); if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) @@ -7462,11 +7406,6 @@ static int qemuProcessSetupDisksTransient(virDomainObj *vm, virDomainAsyncJob asyncJob) { -qemuDomainObjPrivate *priv = vm->privateData; - -if (!(virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))) -return 0; - if (qemuProcessSetupDisksTransientSnapshot(vm, asyncJob) < 0) return -1; @@ -7886,8 +7825,6 @@ qemuProcessRefreshState(virQEMUDriver *driver, virDomainObj *vm, virDomainAsyncJob asyncJob) { -qemuDomainObjPrivate *priv = vm->privateData; - VIR_DEBUG("Fetching list of active devices"); if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0) return -1; @@ -7903,9 +7840,6 @@ qe
[PATCH 28/80] qemu: migration_cookie: Remove pre-blockdev code paths
Signed-off-by: Peter Krempa --- src/qemu/qemu_migration_cookie.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index 0738ad430f..88c147e9fa 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -479,7 +479,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, { qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(GHashTable) stats = virHashNew(g_free); -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); size_t i; int rc; @@ -499,11 +498,11 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0) return -1; -if (blockdev) -rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); -else -rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats); + +rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); + qemuDomainObjExitMonitor(vm); + if (rc < 0) return -1; @@ -511,14 +510,8 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, virDomainDiskDef *disk = vm->def->disks[i]; qemuBlockStats *entry; -if (blockdev) { -if (!(entry = virHashLookup(stats, disk->src->nodeformat))) -continue; -} else { -if (!disk->info.alias || -!(entry = virHashLookup(stats, disk->info.alias))) -continue; -} +if (!(entry = virHashLookup(stats, disk->src->nodeformat))) +continue; mig->nbd->disks[mig->nbd->ndisks].target = g_strdup(disk->dst); mig->nbd->disks[mig->nbd->ndisks].capacity = entry->capacity; -- 2.36.1
[PATCH 21/80] qemu: migration: Remove pre-blockdev code paths
Assume that QEMU_CAPS_BLOCKDEV is present and remove all code executed when it's not. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 127 -- 1 file changed, 25 insertions(+), 102 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8e9428a5bb..ef24a1dedf 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1080,46 +1080,6 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, } -static int -qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriver *driver, - virDomainObj *vm, - const char *diskAlias, - const char *host, - int port, - const char *socket, - unsigned long long mirror_speed, - bool mirror_shallow) -{ -g_autofree char *nbd_dest = NULL; -int mon_ret; - -if (socket) { -nbd_dest = g_strdup_printf("nbd+unix:///%s?socket=%s", - diskAlias, socket); -} else if (strchr(host, ':')) { -nbd_dest = g_strdup_printf("nbd:[%s]:%d:exportname=%s", host, port, - diskAlias); -} else { -nbd_dest = g_strdup_printf("nbd:%s:%d:exportname=%s", host, port, - diskAlias); -} - -if (qemuDomainObjEnterMonitorAsync(driver, vm, - VIR_ASYNC_JOB_MIGRATION_OUT) < 0) -return -1; - -mon_ret = qemuMonitorDriveMirror(qemuDomainGetMonitor(vm), - diskAlias, nbd_dest, "raw", - mirror_speed, 0, 0, mirror_shallow, true); - -qemuDomainObjExitMonitor(vm); -if (mon_ret < 0) -return -1; - -return 0; -} - - static int qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, virDomainObj *vm, @@ -1133,13 +1093,9 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, const char *tlsHostname, unsigned int flags) { -qemuDomainObjPrivate *priv = vm->privateData; qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuBlockJobData *job = NULL; g_autofree char *diskAlias = NULL; -const char *jobname = NULL; -const char *sourcename = NULL; -bool persistjob = false; bool syncWrites = !!(flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES); int rc; int ret = -1; @@ -1150,35 +1106,18 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, if (!(job = qemuBlockJobDiskNew(vm, disk, QEMU_BLOCKJOB_TYPE_COPY, diskAlias))) return -1; -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -jobname = diskAlias; -sourcename = qemuDomainDiskGetTopNodename(disk); -persistjob = true; -} else { -jobname = NULL; -sourcename = diskAlias; -persistjob = false; -} - qemuBlockJobSyncBegin(job); -if (flags & VIR_MIGRATE_TLS || -virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, -disk, jobname, -sourcename, persistjob, -host, port, socket, -mirror_speed, -mirror_shallow, -tlsAlias, -tlsHostname, -syncWrites); -} else { -rc = qemuMigrationSrcNBDStorageCopyDriveMirror(driver, vm, diskAlias, - host, port, socket, - mirror_speed, - mirror_shallow); -} +rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, +disk, diskAlias, + qemuDomainDiskGetTopNodename(disk), +true, +host, port, socket, +mirror_speed, +mirror_shallow, +tlsAlias, +tlsHostname, +syncWrites); if (rc == 0) { diskPriv->migrating = true; @@ -2687,41 +2626,25 @@ qem
[PATCH 23/80] qemu: migration: Assume support for QEMU_CAPS_BLOCKDEV_DEL
The migration code was using few blockdev bits before blockdev was fully integrated to allow TLS with NBD. Since we now always use blockdev we can remove the check. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 8 1 file changed, 8 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 042e8bb10a..16d65ff22e 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4803,14 +4803,6 @@ qemuMigrationSrcRun(virQEMUDriver *driver, host = spec->dest.host.name; } -/* Allow migration with TLS only when we also support TLS for the NBD connection */ -if (flags & VIR_MIGRATE_TLS && -!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_DEL)) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("NBD migration with TLS is not supported")); -goto error; -} - if (qemuMigrationSrcNBDStorageCopy(driver, vm, mig, host, priv->migMaxBandwidth, -- 2.36.1
[PATCH 40/80] qemu: monitor: Remove unused qemuMonitorQueryNamedBlockNodes and clean up
The top level API is unused so it can be removed but internally the JSON version is called by other monitor commands which extract information from the reply. Thus qemuMonitorJSONQueryNamedBlockNodes is unexported and moved appropriately. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 9 --- src/qemu/qemu_monitor.h | 2 -- src/qemu/qemu_monitor_json.c | 52 +--- src/qemu/qemu_monitor_json.h | 5 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a58aa5622f..a4b1b90c7c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3995,15 +3995,6 @@ qemuMonitorSetBlockThreshold(qemuMonitor *mon, } -virJSONValue * -qemuMonitorQueryNamedBlockNodes(qemuMonitor *mon) -{ -QEMU_CHECK_MONITOR_NULL(mon); - -return qemuMonitorJSONQueryNamedBlockNodes(mon, false); -} - - char * qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfo *info) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 0e3640c1da..352cf0ada5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1335,8 +1335,6 @@ int qemuMonitorSetBlockThreshold(qemuMonitor *mon, const char *nodename, unsigned long long threshold); -virJSONValue *qemuMonitorQueryNamedBlockNodes(qemuMonitor *mon); - int qemuMonitorSetWatchdogAction(qemuMonitor *mon, const char *action); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 4584786872..9363f86a55 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2056,6 +2056,36 @@ qemuMonitorJSONSetDBusVMStateIdList(qemuMonitor *mon, } +/* qemuMonitorJSONQueryNamedBlockNodes: + * @mon: Monitor pointer + * + * This helper will attempt to make a "query-named-block-nodes" call and check for + * errors before returning with the reply. + * + * Returns: NULL on error, reply on success + */ +static virJSONValue * +qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon, +bool flat) +{ +g_autoptr(virJSONValue) cmd = NULL; +g_autoptr(virJSONValue) reply = NULL; + +if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", + "B:flat", flat, + NULL))) +return NULL; + +if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) +return NULL; + +if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) +return NULL; + +return virJSONValueObjectStealArray(reply, "return"); +} + + /* qemuMonitorJSONQueryBlock: * @mon: Monitor pointer * @@ -7882,28 +7912,6 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitor *mon, } -virJSONValue * -qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon, -bool flat) -{ -g_autoptr(virJSONValue) cmd = NULL; -g_autoptr(virJSONValue) reply = NULL; - -if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", - "B:flat", flat, - NULL))) -return NULL; - -if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) -return NULL; - -if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) -return NULL; - -return virJSONValueObjectStealArray(reply, "return"); -} - - int qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon, const char *action) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 613b251908..31f6214ec4 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -713,11 +713,6 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitor *mon, unsigned long long threshold) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -virJSONValue * -qemuMonitorJSONQueryNamedBlockNodes(qemuMonitor *mon, -bool flat) -ATTRIBUTE_NONNULL(1); - int qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon, const char *action) -- 2.36.1
[PATCH 49/80] qemu: monitor: Remove unused qemuMonitorDrivePivot
Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 13 - src/qemu/qemu_monitor.h | 3 --- src/qemu/qemu_monitor_json.c | 23 --- src/qemu/qemu_monitor_json.h | 5 - tests/qemumonitorjsontest.c | 2 -- 5 files changed, 46 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f7dade5d79..5e71945831 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2929,19 +2929,6 @@ qemuMonitorBlockCommit(qemuMonitor *mon, } -/* Use the block-job-complete monitor command to pivot a block copy job. */ -int -qemuMonitorDrivePivot(qemuMonitor *mon, - const char *jobname) -{ -VIR_DEBUG("jobname=%s", jobname); - -QEMU_CHECK_MONITOR(mon); - -return qemuMonitorJSONDrivePivot(mon, jobname); -} - - int qemuMonitorArbitraryCommand(qemuMonitor *mon, const char *cmd, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 7374192da2..24a33b9b29 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -990,9 +990,6 @@ int qemuMonitorBlockdevMirror(qemuMonitor *mon, bool shallow, bool syncWrite) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); -int qemuMonitorDrivePivot(qemuMonitor *mon, - const char *jobname) -ATTRIBUTE_NONNULL(2); int qemuMonitorBlockCommit(qemuMonitor *mon, const char *device, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 7b6be69aa7..85a36ff68b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4532,29 +4532,6 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitor *mon, } -int -qemuMonitorJSONDrivePivot(qemuMonitor *mon, - const char *jobname) -{ -g_autoptr(virJSONValue) cmd = NULL; -g_autoptr(virJSONValue) reply = NULL; - -cmd = qemuMonitorJSONMakeCommand("block-job-complete", - "s:device", jobname, - NULL); -if (!cmd) -return -1; - -if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) -return -1; - -if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0) -return -1; - -return 0; -} - - int qemuMonitorJSONJobDismiss(qemuMonitor *mon, const char *jobname) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 9a0bed0355..c5716dfe3e 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -319,11 +319,6 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, bool syncWrite) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); -int -qemuMonitorJSONDrivePivot(qemuMonitor *mon, - const char *jobname) -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); - int qemuMonitorJSONBlockCommit(qemuMonitor *mon, const char *device, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index f1c403d5b3..ced288cf5a 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1216,7 +1216,6 @@ GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0") GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targetnode", 1024, 1234, 31234, true, true) GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "jobname", "backingnode", "backingfilename", 1024) GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "basenode", "backingfilename", 1024) -GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb") GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, "/foo/bar") GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false) GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", "export", true, "bitmap") @@ -3003,7 +3002,6 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONBlockdevMirror); DO_TEST_GEN(qemuMonitorJSONBlockStream); DO_TEST_GEN(qemuMonitorJSONBlockCommit); -DO_TEST_GEN(qemuMonitorJSONDrivePivot); DO_TEST_GEN(qemuMonitorJSONScreendump); DO_TEST_GEN(qemuMonitorJSONOpenGraphics); DO_TEST_GEN_DEPRECATED(qemuMonitorJSONNBDServerAdd, true); -- 2.36.1
[PATCH 43/80] qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockCommit
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 60 +- 1 file changed, 13 insertions(+), 47 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bae9558cfd..e8dc524186 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15469,24 +15469,16 @@ qemuDomainBlockCommit(virDomainPtr dom, virQEMUDriver *driver = dom->conn->privateData; qemuDomainObjPrivate *priv; virDomainObj *vm = NULL; -const char *device = NULL; -const char *jobname = NULL; int ret = -1; virDomainDiskDef *disk = NULL; virStorageSource *topSource; virStorageSource *baseSource = NULL; virStorageSource *top_parent = NULL; bool clean_access = false; -g_autofree char *topPath = NULL; -g_autofree char *basePath = NULL; g_autofree char *backingPath = NULL; unsigned long long speed = bandwidth; qemuBlockJobData *job = NULL; g_autoptr(virStorageSource) mirror = NULL; -const char *nodetop = NULL; -const char *nodebase = NULL; -bool persistjob = false; -bool blockdev = false; virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | @@ -15507,8 +15499,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainObjCheckActive(vm) < 0) goto endjob; -blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); - /* Convert bandwidth MiB to bytes, if necessary */ if (!(flags & VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES)) { if (speed > LLONG_MAX >> 20) { @@ -15539,12 +15529,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) goto endjob; -if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("deleting committed images is not supported by this VM")); -goto endjob; -} - if (!top || STREQ(top, disk->dst)) topSource = disk->src; else if (!(topSource = virStorageSourceChainLookup(disk->src, NULL, top, @@ -15600,7 +15584,7 @@ qemuDomainBlockCommit(virDomainPtr dom, if (flags & VIR_DOMAIN_BLOCK_COMMIT_RELATIVE && topSource != disk->src) { -if (blockdev && top_parent && +if (top_parent && qemuBlockUpdateRelativeBacking(vm, top_parent, disk->src) < 0) goto endjob; @@ -15644,39 +15628,21 @@ qemuDomainBlockCommit(virDomainPtr dom, disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE; -/* Start the commit operation. Pass the user's original spelling, - * if any, through to qemu, since qemu may behave differently - * depending on whether the input was specified as relative or - * absolute (that is, our absolute top_canon may do the wrong - * thing if the user specified a relative name). */ - -if (blockdev) { -persistjob = true; -jobname = job->name; -nodetop = topSource->nodeformat; -nodebase = baseSource->nodeformat; -device = qemuDomainDiskGetTopNodename(disk); -if (!backingPath && top_parent && -!(backingPath = qemuBlockGetBackingStoreString(baseSource, false))) -goto endjob; - -} else { -device = job->name; -} +if (!backingPath && top_parent && +!(backingPath = qemuBlockGetBackingStoreString(baseSource, false))) +goto endjob; qemuDomainObjEnterMonitor(driver, vm); -if (!blockdev) { -basePath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, - baseSource); -topPath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, -topSource); -} - -if (blockdev || (basePath && topPath)) -ret = qemuMonitorBlockCommit(priv->mon, device, jobname, persistjob, - topPath, nodetop, basePath, nodebase, - backingPath, speed); +ret = qemuMonitorBlockCommit(priv->mon, + qemuDomainDiskGetTopNodename(disk), + job->name, + true, + NULL, + topSource->nodeformat, + NULL, + baseSource->nodeformat, + backingPath, speed); qemuDomainObjExitMonitor(vm); -- 2.36.1
[PATCH 41/80] qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockCopyCommon
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 171 - 1 file changed, 66 insertions(+), 105 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 811b4a610c..bae9558cfd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14943,8 +14943,7 @@ qemuDomainBlockCopyValidateMirror(virStorageSource *mirror, */ static int qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(virStorageSource *mirror, -bool shallow, -bool blockdev) +bool shallow) { if (!virStorageSourceHasBacking(mirror)) { /* for deep copy there won't be backing chain so we can terminate it */ @@ -14960,12 +14959,6 @@ qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(virStorageSource *mirror * For a copy when we are not reusing external image requesting shallow * is okay and will inherit the original backing chain */ } else { -if (!blockdev) { -virReportError(VIR_ERR_INVALID_ARG, "%s", - _("backingStore of mirror target is not supported by this qemu")); -return -1; -} - if (!shallow) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("backingStore of mirror without VIR_DOMAIN_BLOCK_COPY_SHALLOW doesn't make sense")); @@ -15000,13 +14993,11 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, bool need_unlink = false; bool need_revoke = false; g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); -const char *format = NULL; bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); bool mirror_shallow = !!(flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW); bool existing = mirror_reuse; qemuBlockJobData *job = NULL; g_autoptr(virStorageSource) mirror = mirrorsrc; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); bool supports_create = false; bool supports_access = false; bool supports_detect = false; @@ -15060,12 +15051,6 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, virDomainDiskDefSourceLUNValidate(mirror) < 0) goto endjob; -if (syncWrites && !blockdev) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES is not supported by this VM")); -goto endjob; -} - if (!(flags & VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB) && vm->persistent) { /* XXX if qemu ever lets us start a new domain with mirroring @@ -15084,8 +15069,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, } if (qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(mirror, -mirror_shallow, -blockdev) < 0) + mirror_shallow) < 0) goto endjob; /* unless the user provides a pre-created file, shallow copy into a raw @@ -15098,14 +15082,6 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, goto endjob; } -/* Prepare the destination file. */ -if (!blockdev && -!virStorageSourceIsLocalStorage(mirror)) { -virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("non-file destination not supported yet")); -goto endjob; -} - supports_access = virStorageSourceSupportsAccess(mirror) == 1; supports_create = virStorageSourceSupportsCreate(mirror) == 1; supports_detect = virStorageSourceSupportsBackingChainTraversal(mirror) == 1; @@ -15148,8 +15124,8 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, goto endjob; } -/* pre-create the image file. In case when 'blockdev' is used this is - * required so that libvirt can properly label the image for access by qemu */ +/* pre-create the image file. This is required so that libvirt can properly + * label the image for access by qemu */ if (!existing) { if (supports_create) { if (virStorageSourceCreate(mirror) < 0) { @@ -15161,9 +15137,6 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, } } -if (mirror->format > 0) -format = virStorageFileFormatTypeToString(mirror->format); - if (virStorageSourceInitChainElement(mirror, disk->src, keepParentLabel) < 0) goto endjob; @@ -15179,21 +15152,19 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, /* we must initialize XML-provided chain prior to detecting to keep semantics * with VM startup */ -if (blockdev) { -for (n = mirror; virStorageSourceIsBacking(n); n = n->backingStore) { -if (qemuDomainPrepareStorageSourceBlockdev(disk
[PATCH 36/80] qemu: blockjob: Remove pre-blockdev blockjob setup
Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 30 +++--- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 304008a31a..03c46923b3 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -250,16 +250,8 @@ qemuBlockJobDiskNewPull(virDomainObj *vm, virStorageSource *base, unsigned int jobflags) { -qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(qemuBlockJobData) job = NULL; -g_autofree char *jobname = NULL; - -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -jobname = g_strdup_printf("pull-%s-%s", disk->dst, disk->src->nodeformat); -} else { -if (!(jobname = qemuAliasDiskDriveFromDisk(disk))) -return NULL; -} +g_autofree char *jobname = g_strdup_printf("pull-%s-%s", disk->dst, disk->src->nodeformat); if (!(job = qemuBlockJobDataNew(QEMU_BLOCKJOB_TYPE_PULL, jobname))) return NULL; @@ -283,21 +275,13 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm, bool delete_imgs, unsigned int jobflags) { -qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(qemuBlockJobData) job = NULL; -g_autofree char *jobname = NULL; +g_autofree char *jobname = g_strdup_printf("commit-%s-%s", disk->dst, top->nodeformat); qemuBlockJobType jobtype = QEMU_BLOCKJOB_TYPE_COMMIT; if (topparent == NULL) jobtype = QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT; -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -jobname = g_strdup_printf("commit-%s-%s", disk->dst, top->nodeformat); -} else { -if (!(jobname = qemuAliasDiskDriveFromDisk(disk))) -return NULL; -} - if (!(job = qemuBlockJobDataNew(jobtype, jobname))) return NULL; @@ -352,16 +336,8 @@ qemuBlockJobDiskNewCopy(virDomainObj *vm, bool reuse, unsigned int jobflags) { -qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(qemuBlockJobData) job = NULL; -g_autofree char *jobname = NULL; - -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -jobname = g_strdup_printf("copy-%s-%s", disk->dst, disk->src->nodeformat); -} else { -if (!(jobname = qemuAliasDiskDriveFromDisk(disk))) -return NULL; -} +g_autofree char *jobname = g_strdup_printf("copy-%s-%s", disk->dst, disk->src->nodeformat); if (!(job = qemuBlockJobDataNew(QEMU_BLOCKJOB_TYPE_COPY, jobname))) return NULL; -- 2.36.1
[PATCH 35/80] qemu: block: Remove 'qemuBlockNodeNamesDetect' and related infrastructure
With blockdev we are generating the nodenames ourselves so all of this infrastructrure became obsolete. Remove it. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 274 --- src/qemu/qemu_block.h | 9 - ...monitorjson-nodename-basic-blockstats.json | 166 - ...onitorjson-nodename-basic-named-nodes.json | 268 --- .../qemumonitorjson-nodename-basic.result | 16 - ...itorjson-nodename-blockjob-blockstats.json | 301 ...torjson-nodename-blockjob-named-nodes.json | 682 -- .../qemumonitorjson-nodename-blockjob.result | 26 - ...monitorjson-nodename-empty-blockstats.json | 2 - ...onitorjson-nodename-empty-named-nodes.json | 2 - .../qemumonitorjson-nodename-empty.result | 0 ...nitorjson-nodename-gluster-blockstats.json | 111 --- ...itorjson-nodename-gluster-named-nodes.json | 135 .../qemumonitorjson-nodename-gluster.result | 11 - ...monitorjson-nodename-iscsi-blockstats.json | 113 --- ...onitorjson-nodename-iscsi-named-nodes.json | 114 --- .../qemumonitorjson-nodename-iscsi.result | 13 - ...umonitorjson-nodename-luks-blockstats.json | 58 -- ...monitorjson-nodename-luks-named-nodes.json | 109 --- .../qemumonitorjson-nodename-luks.result | 6 - ...mumonitorjson-nodename-old-blockstats.json | 160 ...umonitorjson-nodename-old-named-nodes.json | 2 - .../qemumonitorjson-nodename-old.result | 0 ...itorjson-nodename-relative-blockstats.json | 329 - ...torjson-nodename-relative-named-nodes.json | 554 -- .../qemumonitorjson-nodename-relative.result | 33 - ...json-nodename-same-backing-blockstats.json | 221 -- ...son-nodename-same-backing-named-nodes.json | 316 ...mumonitorjson-nodename-same-backing.result | 23 - tests/qemumonitorjsontest.c | 92 --- 30 files changed, 4146 deletions(-) delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-blockstats.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 141bf1b3e7..ea0b783bbb 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -70,280 +70,6 @@ qemuBlockNamedNodesArrayToHash(size_t pos G_GNUC_UNUSED, } -static void -qemuBlockNodeNameBackingChainDataFree(qemuBlockNodeNameBackingChainData *data) -{ -if (!data) -return; - -g_free(data->nodeformat); -g_free(data->nodestorage); - -g_free(data->qemufilename); - -g_free(data->drvformat); -g_free(data->drvstorage); - -qemuBlockNodeNameBackingChainDataFree(data
[PATCH 46/80] qemu: monitor: Remove unused arguments of qemuMonitorBlockStream
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 2 -- src/qemu/qemu_monitor.c | 15 +++ src/qemu/qemu_monitor.h | 2 -- src/qemu/qemu_monitor_json.c | 12 ++-- src/qemu/qemu_monitor_json.h | 2 -- tests/qemumonitorjsontest.c | 2 +- 6 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7a2d8dde5e..e4caccfbd9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14547,8 +14547,6 @@ qemuDomainBlockPullCommon(virDomainObj *vm, ret = qemuMonitorBlockStream(priv->mon, disk->src->nodeformat, job->name, - true, - NULL, nodebase, backingPath, speed); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 1453181f94..15fe6690e9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3016,26 +3016,17 @@ int qemuMonitorBlockStream(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *base, const char *baseNode, const char *backingName, unsigned long long bandwidth) { -VIR_DEBUG("device=%s, jobname=%s, persistjob=%d, base=%s, baseNode=%s, " - "backingName=%s, bandwidth=%lluB", - device, NULLSTR(jobname), persistjob, NULLSTR(base), +VIR_DEBUG("device=%s, jobname=%s, baseNode=%s, backingName=%s, bandwidth=%lluB", + device, NULLSTR(jobname), NULLSTR(baseNode), NULLSTR(backingName), bandwidth); QEMU_CHECK_MONITOR(mon); -if (base && baseNode) { -virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("'base' and 'baseNode' can't be used together")); -return -1; -} - -return qemuMonitorJSONBlockStream(mon, device, jobname, persistjob, base, +return qemuMonitorJSONBlockStream(mon, device, jobname, baseNode, backingName, bandwidth); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 7aed4ffd4f..89b2348775 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1029,8 +1029,6 @@ int qemuMonitorSendKey(qemuMonitor *mon, int qemuMonitorBlockStream(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *base, const char *baseNode, const char *backingName, unsigned long long bandwidth) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e6eb41d85b..e569cf27be 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4531,27 +4531,19 @@ int qemuMonitorJSONBlockStream(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *base, const char *baseNode, const char *backingName, unsigned long long speed) { g_autoptr(virJSONValue) cmd = NULL; g_autoptr(virJSONValue) reply = NULL; -virTristateBool autofinalize = VIR_TRISTATE_BOOL_ABSENT; -virTristateBool autodismiss = VIR_TRISTATE_BOOL_ABSENT; - -if (persistjob) { -autofinalize = VIR_TRISTATE_BOOL_YES; -autodismiss = VIR_TRISTATE_BOOL_NO; -} +virTristateBool autofinalize = VIR_TRISTATE_BOOL_YES; +virTristateBool autodismiss = VIR_TRISTATE_BOOL_NO; if (!(cmd = qemuMonitorJSONMakeCommand("block-stream", "s:device", device, "S:job-id", jobname, "Y:speed", speed, - "S:base", base, "S:base-node", baseNode, "S:backing-file", backingName, "T:auto-finalize", autofinalize, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 9da26ca646..4f780e02aa 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -367,8 +367,6 @@ int qemuMonitorJSONBlockStream(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *base, const char *baseNode,
[PATCH 48/80] qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockPivot
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 50 +++--- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e4caccfbd9..f1fc954f8c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14339,9 +14339,9 @@ qemuDomainBlockPivot(virQEMUDriver *driver, g_autoptr(qemuBlockStorageSourceChainData) chainattachdata = NULL; int ret = -1; qemuDomainObjPrivate *priv = vm->privateData; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); g_autoptr(virJSONValue) bitmapactions = NULL; g_autoptr(virJSONValue) reopenactions = NULL; +int rc = 0; if (job->state != QEMU_BLOCKJOB_STATE_READY) { virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, @@ -14369,7 +14369,7 @@ qemuDomainBlockPivot(virQEMUDriver *driver, return -1; case QEMU_BLOCKJOB_TYPE_COPY: -if (blockdev && !job->jobflagsmissing) { +if (!job->jobflagsmissing) { bool shallow = job->jobflags & VIR_DOMAIN_BLOCK_COPY_SHALLOW; bool reuse = job->jobflags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT; @@ -14406,41 +14406,35 @@ qemuDomainBlockPivot(virQEMUDriver *driver, break; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: -if (blockdev) { -bitmapactions = virJSONValueNewArray(); - -if (qemuMonitorTransactionBitmapAdd(bitmapactions, - job->data.commit.base->nodeformat, -"libvirt-tmp-activewrite", -false, -false, -0) < 0) -return -1; -} +bitmapactions = virJSONValueNewArray(); + +if (qemuMonitorTransactionBitmapAdd(bitmapactions, +job->data.commit.base->nodeformat, +"libvirt-tmp-activewrite", +false, +false, +0) < 0) +return -1; break; } qemuDomainObjEnterMonitor(driver, vm); -if (blockdev) { -int rc = 0; -if (chainattachdata) { -if ((rc = qemuBlockStorageSourceChainAttach(priv->mon, chainattachdata)) == 0) { -/* install backing images on success, or unplug them on failure */ -if ((rc = qemuMonitorTransaction(priv->mon, &reopenactions)) != 0) -qemuBlockStorageSourceChainDetach(priv->mon, chainattachdata); -} +if (chainattachdata) { +if ((rc = qemuBlockStorageSourceChainAttach(priv->mon, chainattachdata)) == 0) { +/* install backing images on success, or unplug them on failure */ +if ((rc = qemuMonitorTransaction(priv->mon, &reopenactions)) != 0) +qemuBlockStorageSourceChainDetach(priv->mon, chainattachdata); } +} -if (bitmapactions && rc == 0) -ignore_value(qemuMonitorTransaction(priv->mon, &bitmapactions)); +if (bitmapactions && rc == 0) +ignore_value(qemuMonitorTransaction(priv->mon, &bitmapactions)); + +if (rc == 0) +ret = qemuMonitorJobComplete(priv->mon, job->name); -if (rc == 0) -ret = qemuMonitorJobComplete(priv->mon, job->name); -} else { -ret = qemuMonitorDrivePivot(priv->mon, job->name); -} qemuDomainObjExitMonitor(vm); /* The pivot failed. The block job in QEMU remains in the synchronised state */ -- 2.36.1
[PATCH 47/80] qemu: monitor: Remove unused qemuMonitorDiskNameLookup
Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 14 --- src/qemu/qemu_monitor.h | 5 --- src/qemu/qemu_monitor_json.c | 77 src/qemu/qemu_monitor_json.h | 8 4 files changed, 104 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 15fe6690e9..f7dade5d79 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2929,20 +2929,6 @@ qemuMonitorBlockCommit(qemuMonitor *mon, } -/* Determine the name that qemu is using for tracking the backing - * element TARGET within the chain starting at TOP. */ -char * -qemuMonitorDiskNameLookup(qemuMonitor *mon, - const char *device, - virStorageSource *top, - virStorageSource *target) -{ -QEMU_CHECK_MONITOR_NULL(mon); - -return qemuMonitorJSONDiskNameLookup(mon, device, top, target); -} - - /* Use the block-job-complete monitor command to pivot a block copy job. */ int qemuMonitorDrivePivot(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 89b2348775..7374192da2 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1002,11 +1002,6 @@ int qemuMonitorBlockCommit(qemuMonitor *mon, const char *backingName, unsigned long long bandwidth) ATTRIBUTE_NONNULL(2); -char *qemuMonitorDiskNameLookup(qemuMonitor *mon, -const char *device, -virStorageSource *top, -virStorageSource *target) -ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); int qemuMonitorArbitraryCommand(qemuMonitor *mon, const char *cmd, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e569cf27be..7b6be69aa7 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4208,83 +4208,6 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon, return 0; } - -static char * -qemuMonitorJSONDiskNameLookupOne(virJSONValue *image, - virStorageSource *top, - virStorageSource *target) -{ -virJSONValue *backing; -char *ret; - -/* The caller will report a generic message if we return NULL - * without an error; but in some cases we can improve by reporting - * a more specific message. */ -if (!top || !image) -return NULL; -if (top != target) { -backing = virJSONValueObjectGetObject(image, "backing-image"); -return qemuMonitorJSONDiskNameLookupOne(backing, top->backingStore, -target); -} -ret = g_strdup(virJSONValueObjectGetString(image, "filename")); -/* Sanity check - the name qemu gave us should resolve to the same - file tracked by our target description. */ -if (virStorageSourceIsLocalStorage(target) && -STRNEQ(ret, target->path) && -!virFileLinkPointsTo(ret, target->path)) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("qemu block name '%s' doesn't match expected '%s'"), - ret, target->path); -VIR_FREE(ret); -} -return ret; -} - - -char * -qemuMonitorJSONDiskNameLookup(qemuMonitor *mon, - const char *device, - virStorageSource *top, - virStorageSource *target) -{ -g_autoptr(virJSONValue) devices = NULL; -size_t i; - -if (!(devices = qemuMonitorJSONQueryBlock(mon))) -return NULL; - -for (i = 0; i < virJSONValueArraySize(devices); i++) { -virJSONValue *dev; -virJSONValue *inserted; -virJSONValue *image; -const char *thisdev; - -if (!(dev = qemuMonitorJSONGetBlockDev(devices, i))) -return NULL; - -if (!(thisdev = qemuMonitorJSONGetBlockDevDevice(dev))) -return NULL; - -if (STREQ(thisdev, device)) { -if ((inserted = virJSONValueObjectGetObject(dev, "inserted")) && -(image = virJSONValueObjectGetObject(inserted, "image"))) { -return qemuMonitorJSONDiskNameLookupOne(image, top, target); -} -} -} -/* Guarantee an error when returning NULL, but don't override a - * more specific error if one was already generated. */ -if (virGetLastErrorCode() == VIR_ERR_OK) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to find backing name for device %s"), - device); -} - -return NULL; -} - - int qemuMonitorJSONArbitraryCommand(qemuMonitor *mon, const char *cmd_str, int fd, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 4f780e02aa..9a0bed0355 1
[PATCH 19/80] qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- src/qemu/qemu_process.c | 6 ++ tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - tests/testutilsqemu.c | 1 - 30 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d660b3b9f0..5ef2997ed4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -595,7 +595,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "intel-iommu.aw-bits", /* QEMU_CAPS_INTEL_IOMMU_AW_BITS */ "spapr-tpm-proxy", /* QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY */ "numa.hmat", /* QEMU_CAPS_NUMA_HMAT */ - "blockdev-hostdev-scsi", /* QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI */ + "blockdev-hostdev-scsi", /* X_QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI */ /* 380 */ "usb-host.hostdevice", /* QEMU_CAPS_USB_HOST_HOSTDEVICE */ @@ -5228,7 +5228,6 @@ virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps) /* While the removal of pre-blockdev code is in progress we always hard-code * the support for QEMU_CAPS_BLOCKDEV */ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV); -virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI); /* -enable-fips is deprecated in QEMU 5.2.0, and QEMU * should be built with gcrypt to achieve FIPS compliance diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 5ca177b599..89aa63cffe 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -574,7 +574,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_INTEL_IOMMU_AW_BITS, /* intel-iommu.aw-bits */ QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY, /* -device spapr-tpm-proxy */ QEMU_CAPS_NUMA_HMAT, /* -numa hmat */ -QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI, /* -blockdev used for (i)SCSI hostdevs */ +X_QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI, /* -blockdev used for (i)SCSI hostdevs */ /* 380 */ QEMU_CAPS_USB_HOST_HOSTDEVICE, /* -device usb-host.hostdevice */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 260116dc67..980e06ce79 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5646,8 +5646,7 @@ qemuProcessStartUpdateCustomCaps(virDomainObj *vm) /* The code is being cleaned up to always assume the support for * -blockdev thus we must no longer allow users to clear it */ -if (tmp == QEMU_CAPS_BLOCKDEV || -tmp == QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI) +if (tmp == QEMU_CAPS_BLOCKDEV) continue; virQEMUCapsClear(priv->qemuCaps, tmp); @@ -5676,8 +5675,7 @@ qemuProcessStartUpdateCustomCaps(virDomainObj *vm) /* The code is being cleaned up to always assume the support for * -blockdev thus we must no longer allow users to clear it */ -if (tmp == QEMU_CAPS_BLOCKDEV || -tmp == QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI) +if (tmp == QEMU_CAPS_BLOCKDEV) continue; virQEMUCapsClear(priv->qemuCaps, tmp); diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index e1f69fbcde..1d16f61a72 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -138,7 +138,6 @@ -
[PATCH 45/80] qemu: driver: Remove pre-blockdev code paths from qemuDomainBlockPullCommon
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 41 ++--- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ac20d04353..7a2d8dde5e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14466,17 +14466,12 @@ qemuDomainBlockPullCommon(virDomainObj *vm, { qemuDomainObjPrivate *priv = vm->privateData; virQEMUDriver *driver = priv->driver; -const char *device = NULL; -const char *jobname = NULL; virDomainDiskDef *disk; virStorageSource *baseSource = NULL; -g_autofree char *basePath = NULL; g_autofree char *backingPath = NULL; unsigned long long speed = bandwidth; qemuBlockJobData *job = NULL; -bool persistjob = false; const char *nodebase = NULL; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); int ret = -1; if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE && !base) { @@ -14511,8 +14506,7 @@ qemuDomainBlockPullCommon(virDomainObj *vm, if (baseSource) { if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE) { -if (blockdev && -qemuBlockUpdateRelativeBacking(vm, disk->src, disk->src) < 0) +if (qemuBlockUpdateRelativeBacking(vm, disk->src, disk->src) < 0) goto endjob; if (virStorageSourceGetRelativeBackingPath(disk->src->backingStore, @@ -14542,29 +14536,22 @@ qemuDomainBlockPullCommon(virDomainObj *vm, if (!(job = qemuBlockJobDiskNewPull(vm, disk, baseSource, flags))) goto endjob; -if (blockdev) { -jobname = job->name; -persistjob = true; -if (baseSource) { -nodebase = baseSource->nodeformat; -if (!backingPath && -!(backingPath = qemuBlockGetBackingStoreString(baseSource, false))) -goto endjob; -} -device = disk->src->nodeformat; -} else { -device = job->name; +if (baseSource) { +nodebase = baseSource->nodeformat; +if (!backingPath && +!(backingPath = qemuBlockGetBackingStoreString(baseSource, false))) +goto endjob; } qemuDomainObjEnterMonitor(driver, vm); -if (!blockdev && baseSource) -basePath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, - baseSource); - -if (blockdev || -(!baseSource || basePath)) -ret = qemuMonitorBlockStream(priv->mon, device, jobname, persistjob, basePath, - nodebase, backingPath, speed); +ret = qemuMonitorBlockStream(priv->mon, + disk->src->nodeformat, + job->name, + true, + NULL, + nodebase, + backingPath, + speed); qemuDomainObjExitMonitor(vm); if (ret < 0) -- 2.36.1
[PATCH 39/80] qemu: block: Remove unused qemuBlockGetNodeData
Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 40 src/qemu/qemu_block.h | 3 --- 2 files changed, 43 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index ea0b783bbb..6e643598bc 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -52,46 +52,6 @@ qemuBlockNodeNameValidate(const char *nn) } -static int -qemuBlockNamedNodesArrayToHash(size_t pos G_GNUC_UNUSED, - virJSONValue *item, - void *opaque) -{ -GHashTable *table = opaque; -const char *name; - -if (!(name = virJSONValueObjectGetString(item, "node-name"))) -return 1; - -if (virHashAddEntry(table, name, item) < 0) -return -1; - -return 0; -} - - -/** - * qemuBlockGetNodeData: - * @data: JSON object returned from query-named-block-nodes - * - * Returns a hash table organized by the node name of the JSON value objects of - * data for given qemu block nodes. - * - * Returns a filled GHashTable *on success NULL on error. - */ -GHashTable * -qemuBlockGetNodeData(virJSONValue *data) -{ -g_autoptr(GHashTable) nodedata = virHashNew(virJSONValueHashFree); - -if (virJSONValueArrayForeachSteal(data, - qemuBlockNamedNodesArrayToHash, nodedata) < 0) -return NULL; - -return g_steal_pointer(&nodedata); -} - - /** * qemuBlockStorageSourceSupportsConcurrentAccess: * @src: disk storage source diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 134ce41dd5..422c1a0deb 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -39,9 +39,6 @@ struct qemuBlockNodeNameBackingChainData { char *drvstorage; }; -GHashTable * -qemuBlockGetNodeData(virJSONValue *data); - bool qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSource *src); -- 2.36.1
[PATCH 24/80] qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_DEL
Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 28 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5ef2997ed4..b91f46bb12 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -487,7 +487,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 300 */ "hda-output", /* QEMU_CAPS_HDA_OUTPUT */ - "blockdev-del", /* QEMU_CAPS_BLOCKDEV_DEL */ + "blockdev-del", /* X_QEMU_CAPS_BLOCKDEV_DEL */ "vmgenid", /* QEMU_CAPS_DEVICE_VMGENID */ "vhost-vsock", /* QEMU_CAPS_DEVICE_VHOST_VSOCK */ "chardev-fd-pass", /* X_QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE */ @@ -1213,7 +1213,6 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = { { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES }, { "query-cpus-fast", QEMU_CAPS_QUERY_CPUS_FAST }, { "qom-list-properties", QEMU_CAPS_QOM_LIST_PROPERTIES }, -{ "blockdev-del", QEMU_CAPS_BLOCKDEV_DEL }, { "query-current-machine", QEMU_CAPS_QUERY_CURRENT_MACHINE }, { "block-dirty-bitmap-merge", QEMU_CAPS_BITMAP_MERGE }, { "query-cpu-model-baseline", QEMU_CAPS_QUERY_CPU_MODEL_BASELINE }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 89aa63cffe..5f982b11d5 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -466,7 +466,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 300 */ QEMU_CAPS_HDA_OUTPUT, /* -device hda-output */ -QEMU_CAPS_BLOCKDEV_DEL, /* blockdev-del is supported */ +X_QEMU_CAPS_BLOCKDEV_DEL, /* blockdev-del is supported */ QEMU_CAPS_DEVICE_VMGENID, /* -device vmgenid */ QEMU_CAPS_DEVICE_VHOST_VSOCK, /* -device vhost-vsock-* */ X_QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE, /* Passing pre-opened FDs for chardevs on commandline */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 1d16f61a72..419a987068 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -108,7 +108,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 8a64694a8d..ceaedd3863 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -106,7 +106,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 9b80f2b915..d1ed2a781c 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -76,7 +76,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index b8ac4b3799..784a837e91 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -140,7 +140,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index 10a3a1024d..b67c55b192 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarc
[PATCH 50/80] qemu: command: Remove pre-blockdev floppy setup
With new qemu versions we setup floppies via -device. Some legacy output tests were not modernized yet so the expected output needs to be adjusted. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 50 +++-- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e0c5e15a63..5c90138c73 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2361,25 +2361,13 @@ qemuCommandAddExtDevice(virCommand *cmd, static void qemuBuildFloppyCommandLineControllerOptionsImplicit(virCommand *cmd, unsigned int bootindexA, -unsigned int bootindexB, -const char *backendA, -const char *backendB) +unsigned int bootindexB) { -if (backendA) { -virCommandAddArg(cmd, "-global"); -virCommandAddArgFormat(cmd, "isa-fdc.driveA=%s", backendA); -} - if (bootindexA > 0) { virCommandAddArg(cmd, "-global"); virCommandAddArgFormat(cmd, "isa-fdc.bootindexA=%u", bootindexA); } -if (backendB) { -virCommandAddArg(cmd, "-global"); -virCommandAddArgFormat(cmd, "isa-fdc.driveB=%s", backendB); -} - if (bootindexB > 0) { virCommandAddArg(cmd, "-global"); virCommandAddArgFormat(cmd, "isa-fdc.bootindexB=%u", bootindexB); @@ -2391,8 +2379,6 @@ static int qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd, unsigned int bootindexA, unsigned int bootindexB, -const char *backendA, -const char *backendB, const virDomainDef *def, virQEMUCaps *qemuCaps) { @@ -2400,9 +2386,7 @@ qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd, if (virJSONValueObjectAdd(&props, "s:driver", "isa-fdc", - "S:driveA", backendA, "p:bootindexA", bootindexA, - "S:driveB", backendB, "p:bootindexB", bootindexB, NULL) < 0) return -1; @@ -2421,13 +2405,10 @@ qemuBuildFloppyCommandLineControllerOptions(virCommand *cmd, { unsigned int bootindexA = 0; unsigned int bootindexB = 0; -g_autofree char *backendA = NULL; -g_autofree char *backendB = NULL; bool hasfloppy = false; size_t i; for (i = 0; i < def->ndisks; i++) { -g_autofree char *backendAlias = NULL; virDomainDiskDef *disk = def->disks[i]; if (disk->bus != VIR_DOMAIN_DISK_BUS_FDC) @@ -2435,17 +2416,10 @@ qemuBuildFloppyCommandLineControllerOptions(virCommand *cmd, hasfloppy = true; -/* with -blockdev we setup the floppy device and it's backend with -device */ -if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) && -qemuDomainDiskGetBackendAlias(disk, qemuCaps, &backendAlias) < 0) -return -1; - if (disk->info.addr.drive.unit) { bootindexB = disk->info.effectiveBootIndex; -backendB = g_steal_pointer(&backendAlias); } else { bootindexA = disk->info.effectiveBootIndex; -backendA = g_steal_pointer(&backendAlias); } } @@ -2456,17 +2430,13 @@ qemuBuildFloppyCommandLineControllerOptions(virCommand *cmd, if (qemuBuildFloppyCommandLineControllerOptionsExplicit(cmd, bootindexA, bootindexB, -backendA, -backendB, def, qemuCaps) < 0) return -1; } else { qemuBuildFloppyCommandLineControllerOptionsImplicit(cmd, bootindexA, -bootindexB, -backendA, -backendB); +bootindexB); } return 0; @@ -2602,12 +2572,6 @@ qemuBuildDiskCommandLine(virCommand *cmd, if (qemuDiskBusIsSD(disk->bus)) return 0; -/* flop
[PATCH 09/80] qemuxml2argvtest: Use DO_TEST_CAPS_LATEST for all 'user-aliases' tests
Modernize the tests as they mostly care that the aliases are properly propagated to qemu. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/user-aliases-usb.args | 41 -- .../user-aliases-usb.x86_64-latest.args | 44 +++ tests/qemuxml2argvdata/user-aliases.args | 68 - .../user-aliases.x86_64-latest.args | 74 +++ tests/qemuxml2argvdata/user-aliases2.args | 1 - .../user-aliases2.x86_64-latest.args | 39 ++ tests/qemuxml2argvtest.c | 14 +--- 7 files changed, 160 insertions(+), 121 deletions(-) delete mode 100644 tests/qemuxml2argvdata/user-aliases-usb.args create mode 100644 tests/qemuxml2argvdata/user-aliases-usb.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/user-aliases.args create mode 100644 tests/qemuxml2argvdata/user-aliases.x86_64-latest.args delete mode 12 tests/qemuxml2argvdata/user-aliases2.args create mode 100644 tests/qemuxml2argvdata/user-aliases2.x86_64-latest.args diff --git a/tests/qemuxml2argvdata/user-aliases-usb.args b/tests/qemuxml2argvdata/user-aliases-usb.args deleted file mode 100644 index 932c3ea296..00 --- a/tests/qemuxml2argvdata/user-aliases-usb.args +++ /dev/null @@ -1,41 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-gentoo \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-gentoo/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-gentoo/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-gentoo/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=gentoo,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-gentoo/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ --accel kvm \ --m 4096 \ --overcommit mem-lock=off \ --smp 4,sockets=4,cores=1,threads=1 \ --uuid a75aca4b-a02f-2bcb-4a91-c93cd848c34b \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --global PIIX4_PM.disable_s3=0 \ --global PIIX4_PM.disable_s4=0 \ --boot strict=on \ --device ich9-usb-ehci1,id=ua-myUSB1,bus=pci.0,addr=0x4.0x7 \ --device ich9-usb-uhci1,masterbus=ua-myUSB1.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 \ --device ich9-usb-uhci2,masterbus=ua-myUSB1.0,firstport=2,bus=pci.0,addr=0x4.0x1 \ --device ich9-usb-uhci3,masterbus=ua-myUSB1.0,firstport=4,bus=pci.0,addr=0x4.0x2 \ --device ich9-usb-ehci1,id=ua-myUSB5,bus=pci.0,addr=0x5.0x7 \ --device ich9-usb-uhci1,masterbus=ua-myUSB5.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 \ --device ich9-usb-uhci2,masterbus=ua-myUSB5.0,firstport=2,bus=pci.0,addr=0x5.0x1 \ --device ich9-usb-uhci3,masterbus=ua-myUSB5.0,firstport=4,bus=pci.0,addr=0x5.0x2 \ --audiodev '{"id":"audio1","driver":"none"}' \ --device usb-host,hostbus=14,hostaddr=6,id=hostdev0,bus=ua-myUSB1.0,port=3 \ --device usb-host,hostbus=15,hostaddr=6,id=hostdev1,bus=ua-myUSB5.0,port=3 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/user-aliases-usb.x86_64-latest.args b/tests/qemuxml2argvdata/user-aliases-usb.x86_64-latest.args new file mode 100644 index 00..fd5c161f19 --- /dev/null +++ b/tests/qemuxml2argvdata/user-aliases-usb.x86_64-latest.args @@ -0,0 +1,44 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-gentoo \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-gentoo/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-gentoo/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-gentoo/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=gentoo,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-gentoo/master-key.aes"}' \ +-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-accel kvm \ +-cpu qemu64 \ +-m 4096 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid a75aca4b-a02f-2bcb-4a91-c93cd848c34b \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-global PIIX4_PM.disable_s3=0 \ +-global PIIX4_PM.disable_s4=0 \ +-boot strict=on \ +-device '{"driver":"ich9-usb-ehci1","id":"ua-myUSB1","bus":"pci.0","addr":"0x4.0x7"}' \ +-device '{"driver":"ich9-usb-uhci1","masterbus":"ua-myUSB1.0","firstport":0,"bus":"pci.0","multifunction":true,"addr":"0x4"}' \ +-device '{"driver":"ich9-usb-uhci2","masterbus":"ua-myUSB1.0","firstport":2,"bus":"pci.0","addr":"0x4.0x1"}' \ +-device '{"driver":"ich9-usb-uhci3","masterbus":"ua-myUSB1.0","firstport":4,"bus":"pci.0","addr":"0x4.0x2"}' \ +-device '{"driver":"ich9-usb-ehci1","id":"ua-myUSB5","bus":"pci.0","addr":"0x5.0x7"}' \ +-device '{"driver":"ich9-usb-uhci1","masterbus":"ua-myUSB5.0"
[PATCH 44/80] qemu: monitor: Remove unused arguments of qemuMonitorBlockCommit
The 'persistjob' is always true and 'top' and 'base' are always NULL. Adjust the functions to drop the arguments. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 3 --- src/qemu/qemu_monitor.c | 15 +-- src/qemu/qemu_monitor.h | 3 --- src/qemu/qemu_monitor_json.c | 14 ++ src/qemu/qemu_monitor_json.h | 3 --- tests/qemumonitorjsontest.c | 2 +- 6 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e8dc524186..ac20d04353 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15637,10 +15637,7 @@ qemuDomainBlockCommit(virDomainPtr dom, ret = qemuMonitorBlockCommit(priv->mon, qemuDomainDiskGetTopNodename(disk), job->name, - true, - NULL, topSource->nodeformat, - NULL, baseSource->nodeformat, backingPath, speed); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 9c24b842bd..1453181f94 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2913,24 +2913,19 @@ int qemuMonitorBlockCommit(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *top, const char *topNode, - const char *base, const char *baseNode, const char *backingName, unsigned long long bandwidth) { -VIR_DEBUG("device=%s, jobname=%s, persistjob=%d, top=%s, topNode=%s, " - "base=%s, baseNode=%s, backingName=%s, bandwidth=%llu", - device, NULLSTR(jobname), persistjob, NULLSTR(top), NULLSTR(topNode), - NULLSTR(base), NULLSTR(baseNode), NULLSTR(backingName), bandwidth); +VIR_DEBUG("device=%s, jobname=%s, topNode=%s, baseNode=%s, backingName=%s, bandwidth=%llu", + device, NULLSTR(jobname), NULLSTR(topNode), + NULLSTR(baseNode), NULLSTR(backingName), bandwidth); QEMU_CHECK_MONITOR(mon); -return qemuMonitorJSONBlockCommit(mon, device, jobname, persistjob, top, - topNode, base, baseNode, backingName, - bandwidth); +return qemuMonitorJSONBlockCommit(mon, device, jobname, topNode, baseNode, + backingName, bandwidth); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index aee9ca0e6a..7aed4ffd4f 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -997,10 +997,7 @@ int qemuMonitorDrivePivot(qemuMonitor *mon, int qemuMonitorBlockCommit(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *top, const char *topNode, - const char *base, const char *baseNode, const char *backingName, unsigned long long bandwidth) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index bd3130075b..e6eb41d85b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4176,31 +4176,21 @@ int qemuMonitorJSONBlockCommit(qemuMonitor *mon, const char *device, const char *jobname, - bool persistjob, - const char *top, const char *topNode, - const char *base, const char *baseNode, const char *backingName, unsigned long long speed) { g_autoptr(virJSONValue) cmd = NULL; g_autoptr(virJSONValue) reply = NULL; -virTristateBool autofinalize = VIR_TRISTATE_BOOL_ABSENT; -virTristateBool autodismiss = VIR_TRISTATE_BOOL_ABSENT; - -if (persistjob) { -autofinalize = VIR_TRISTATE_BOOL_YES; -autodismiss = VIR_TRISTATE_BOOL_NO; -} +virTristateBool autofinalize = VIR_TRISTATE_BOOL_YES; +virTristateBool autodismiss = VIR_TRISTATE_BOOL_NO; cmd = qemuMonitorJSONMakeCommand("block-commit", "s:device", device, "S:job-id", jobname, "Y:speed", speed, - "S:top", top, "S:top-node", topNode, - "S:base", base, "S:base-node", b
[PATCH 52/80] qemuDomainBlockResize: Always refuse resize of empty/readonly disks
The operation makes no sense regardless of the way how we specify disks. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f1fc954f8c..c2722c39da 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9985,14 +9985,15 @@ qemuDomainBlockResize(virDomainPtr dom, disk->src->format == VIR_STORAGE_FILE_QED) size = VIR_ROUND_UP(size, 512); +if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) { +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("can't resize empty or readonly disk '%s'"), + disk->dst); +goto endjob; +} + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && !qemuDiskBusIsSD(disk->bus)) { -if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("can't resize empty or readonly disk '%s'"), - disk->dst); -goto endjob; -} nodename = disk->src->nodeformat; } else { -- 2.36.1
[PATCH 57/80] qemu: monitor: Remove unused qemuMonitor(Eject|Change)Media
Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 27 - src/qemu/qemu_monitor.h | 9 -- src/qemu/qemu_monitor_json.c | 57 src/qemu/qemu_monitor_json.h | 10 --- tests/qemumonitorjsontest.c | 4 --- 5 files changed, 107 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f1a9524f28..456c54aed3 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2155,33 +2155,6 @@ qemuMonitorSetBalloon(qemuMonitor *mon, } -int -qemuMonitorEjectMedia(qemuMonitor *mon, - const char *dev_name, - bool force) -{ -VIR_DEBUG("dev_name=%s force=%d", dev_name, force); - -QEMU_CHECK_MONITOR(mon); - -return qemuMonitorJSONEjectMedia(mon, dev_name, force); -} - - -int -qemuMonitorChangeMedia(qemuMonitor *mon, - const char *dev_name, - const char *newmedia, - const char *format) -{ -VIR_DEBUG("dev_name=%s newmedia=%s format=%s", dev_name, newmedia, format); - -QEMU_CHECK_MONITOR(mon); - -return qemuMonitorJSONChangeMedia(mon, dev_name, newmedia, format); -} - - int qemuMonitorSaveVirtualMemory(qemuMonitor *mon, unsigned long long offset, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6e657576ae..163e12c0f6 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -733,15 +733,6 @@ int qemuMonitorExpirePassword(qemuMonitor *mon, int qemuMonitorSetBalloon(qemuMonitor *mon, unsigned long long newmem); -int qemuMonitorEjectMedia(qemuMonitor *mon, - const char *dev_name, - bool force); -int qemuMonitorChangeMedia(qemuMonitor *mon, - const char *dev_name, - const char *newmedia, - const char *format); - - int qemuMonitorSaveVirtualMemory(qemuMonitor *mon, unsigned long long offset, unsigned long long length, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b4a33184bd..9c54d7cfa4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2812,63 +2812,6 @@ qemuMonitorJSONSetBalloon(qemuMonitor *mon, } -/** - * Run QMP command to eject a media from ejectable device. - * - * Returns: - * -1 on error - * 0 on success - */ -int qemuMonitorJSONEjectMedia(qemuMonitor *mon, - const char *dev_name, - bool force) -{ -g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("eject", - "s:device", dev_name, - "b:force", force, - NULL); -g_autoptr(virJSONValue) reply = NULL; - -if (!cmd) -return -1; - -if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) -return -1; - -if (qemuMonitorJSONCheckError(cmd, reply) < 0) -return -1; - -return 0; -} - - -int qemuMonitorJSONChangeMedia(qemuMonitor *mon, - const char *dev_name, - const char *newmedia, - const char *format) -{ -g_autoptr(virJSONValue) cmd = NULL; -g_autoptr(virJSONValue) reply = NULL; - -cmd = qemuMonitorJSONMakeCommand("change", - "s:device", dev_name, - "s:target", newmedia, - "S:arg", format, - NULL); - -if (!cmd) -return -1; - -if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) -return -1; - -if (qemuMonitorJSONCheckError(cmd, reply) < 0) -return -1; - -return 0; -} - - static int qemuMonitorJSONSaveMemory(qemuMonitor *mon, const char *cmdtype, unsigned long long offset, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 9314baa5ba..44458f703d 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -128,16 +128,6 @@ int qemuMonitorJSONSetBalloon(qemuMonitor *mon, unsigned long long newmem); -int -qemuMonitorJSONEjectMedia(qemuMonitor *mon, - const char *dev_name, - bool force); -int -qemuMonitorJSONChangeMedia(qemuMonitor *mon, - const char *dev_name, - const char *newmedia, - const char *format); - int qemuMonitorJSONSaveVirtualMemory(qemuMonitor *mon, unsigned long long offset, diff --git a/tests/qemumoni
[PATCH 62/80] qemu: Remove 'driveAlias' argument of qemuBlockStorageSourceDetachPrepare
Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c| 33 + src/qemu/qemu_block.h| 3 +-- src/qemu/qemu_blockjob.c | 4 ++-- src/qemu/qemu_hotplug.c | 2 +- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a5d9f47ec4..afdcca2813 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1555,36 +1555,29 @@ qemuBlockStorageSourceAttachRollback(qemuMonitor *mon, /** * qemuBlockStorageSourceDetachPrepare: * @src: disk source structure - * @driveAlias: Alias of the -drive backend, the pointer is always consumed * * Prepare qemuBlockStorageSourceAttachData *for detaching a single source - * from a VM. If @driveAlias is NULL -blockdev is assumed. + * from a VM. */ qemuBlockStorageSourceAttachData * -qemuBlockStorageSourceDetachPrepare(virStorageSource *src, -char *driveAlias) +qemuBlockStorageSourceDetachPrepare(virStorageSource *src) { qemuDomainStorageSourcePrivate *srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; data = g_new0(qemuBlockStorageSourceAttachData, 1); -if (driveAlias) { -data->driveAlias = g_steal_pointer(&driveAlias); -data->driveAdded = true; -} else { -data->formatNodeName = src->nodeformat; -data->formatAttached = true; -data->storageNodeName = src->nodestorage; -data->storageAttached = true; +data->formatNodeName = src->nodeformat; +data->formatAttached = true; +data->storageNodeName = src->nodestorage; +data->storageAttached = true; -/* 'raw' format doesn't need the extra 'raw' layer when slicing, thus - * the nodename is NULL */ -if (src->sliceStorage && -src->sliceStorage->nodename) { -data->storageSliceNodeName = src->sliceStorage->nodename; -data->storageSliceAttached = true; -} +/* 'raw' format doesn't need the extra 'raw' layer when slicing, thus + * the nodename is NULL */ +if (src->sliceStorage && +src->sliceStorage->nodename) { +data->storageSliceNodeName = src->sliceStorage->nodename; +data->storageSliceAttached = true; } if (src->pr && @@ -1647,7 +1640,7 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSource *src) data = g_new0(qemuBlockStorageSourceChainData, 1); for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) { -if (!(backend = qemuBlockStorageSourceDetachPrepare(n, NULL))) +if (!(backend = qemuBlockStorageSourceDetachPrepare(n))) return NULL; VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index a20a5e8a61..d29d444a5a 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -116,8 +116,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSource *src, bool autoreadonly); qemuBlockStorageSourceAttachData * -qemuBlockStorageSourceDetachPrepare(virStorageSource *src, -char *driveAlias); +qemuBlockStorageSourceDetachPrepare(virStorageSource *src); int qemuBlockStorageSourceAttachApply(qemuMonitor *mon, diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 03c46923b3..62ed71f5a8 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1328,7 +1328,7 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDriver *driver, if (!job->data.create.src) return; -if (!(backend = qemuBlockStorageSourceDetachPrepare(job->data.create.src, NULL))) +if (!(backend = qemuBlockStorageSourceDetachPrepare(job->data.create.src))) return; /* the format node part was not attached yet, so we don't need to detach it */ @@ -1365,7 +1365,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver *driver, progressCurrent, progressTotal, asyncJob); if (job->data.backup.store && -!(backend = qemuBlockStorageSourceDetachPrepare(job->data.backup.store, NULL))) +!(backend = qemuBlockStorageSourceDetachPrepare(job->data.backup.store))) return; if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d7f10d8277..a752702fc4 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -706,7 +706,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, goto rollback; QEMU_DOMAIN_DISK_PRIVATE(disk)->transientOverlayCreated = true; -backend = qemuBlockStorageSourceDetachPrepare(disk->src, NULL); +backend = qemuBlockStorageSourceDetachPrepare(disk->src); ignore_value(VIR_INSERT_ELEMENT(data->srcdata, 0, data->nsrcdata, backend)); } -- 2.36.1
[PATCH 65/80] qemu: command: Delegate qemuBuildDriveStr to SD cards only
Remove the generic frontend-less -drive code from qemuBuildDriveStr by assuming that we support only blockdev-enabled qemus. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 15 ++- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 865464a772..aec9e7415f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2039,17 +2039,7 @@ qemuBuildDriveStr(virDomainDiskDef *disk) if (qemuBuildDriveSourceStr(disk, &opt) < 0) return NULL; -if (!qemuDiskBusIsSD(disk->bus)) { -g_autofree char *drivealias = qemuAliasDiskDriveFromDisk(disk); -if (!drivealias) -return NULL; - -virBufferAddLit(&opt, "if=none"); -virBufferAsprintf(&opt, ",id=%s", drivealias); -} else { -virBufferAsprintf(&opt, "if=sd,index=%d", - virDiskNameToIndex(disk->dst)); -} +virBufferAsprintf(&opt, "if=sd,index=%d", virDiskNameToIndex(disk->dst)); if (disk->src->readonly) virBufferAddLit(&opt, ",readonly=on"); @@ -2522,8 +2512,7 @@ qemuBuildDiskSourceCommandLine(virCommand *cmd, if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) { if (!(data = qemuBuildStorageSourceChainAttachPrepareChardev(disk))) return -1; -} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) && -!qemuDiskBusIsSD(disk->bus)) { +} else if (!qemuDiskBusIsSD(disk->bus)) { if (virStorageSourceIsEmpty(disk->src)) return 0; -- 2.36.1
[PATCH 68/80] qemu: domain: Assume QEMU_CAPS_BLOCKDEV for the domain private code
Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c| 20 --- .../blockjob-mirror-in.xml| 1 + .../migration-in-params-in.xml| 1 + .../migration-out-nbd-out.xml | 1 + .../migration-out-nbd-tls-out.xml | 1 + .../migration-out-params-in.xml | 1 + tests/qemustatusxml2xmldata/upgrade-out.xml | 1 + .../qemustatusxml2xmldata/vcpus-multi-in.xml | 1 + 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8b55dd0361..32319c1503 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2167,8 +2167,7 @@ qemuDomainObjPrivateXMLFormatBlockjobs(virBuffer *buf, virBufferAsprintf(&attrBuf, " active='%s'", virTristateBoolTypeToString(virTristateBoolFromBool(bj))); -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -virHashForEachSorted(priv->blockjobs, +if (virHashForEachSorted(priv->blockjobs, qemuDomainObjPrivateXMLFormatBlockjobIterator, &iterdata) < 0) return -1; @@ -2388,8 +2387,7 @@ qemuDomainObjPrivateXMLFormat(virBuffer *buf, qemuDomainObjPrivateXMLFormatPR(buf, priv); -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -virBufferAsprintf(buf, "\n", priv->nodenameindex); +virBufferAsprintf(buf, "\n", priv->nodenameindex); virBufferAsprintf(buf, "\n", priv->fdsetindex); @@ -2817,15 +2815,13 @@ qemuDomainObjPrivateXMLParseBlockjobs(virDomainObj *vm, (tmp = virTristateBoolTypeFromString(active)) > 0) priv->reconnectBlockjobs = tmp; -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { -if ((nnodes = virXPathNodeSet("./blockjobs/blockjob", ctxt, &nodes)) < 0) -return -1; +if ((nnodes = virXPathNodeSet("./blockjobs/blockjob", ctxt, &nodes)) < 0) +return -1; -for (i = 0; i < nnodes; i++) { -if (qemuDomainObjPrivateXMLParseBlockjobData(vm, nodes[i], ctxt, - priv->driver->xmlopt) < 0) -return -1; -} +for (i = 0; i < nnodes; i++) { +if (qemuDomainObjPrivateXMLParseBlockjobData(vm, nodes[i], ctxt, + priv->driver->xmlopt) < 0) +return -1; } return 0; diff --git a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml index 73fe437f87..e9f1d77856 100644 --- a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml @@ -22,6 +22,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-in-params-in.xml b/tests/qemustatusxml2xmldata/migration-in-params-in.xml index 1086f5230d..03773a089b 100644 --- a/tests/qemustatusxml2xmldata/migration-in-params-in.xml +++ b/tests/qemustatusxml2xmldata/migration-in-params-in.xml @@ -256,6 +256,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml index 540e385de3..de92146eaa 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml @@ -259,6 +259,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml index d0e997913f..6bdd128259 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml @@ -288,6 +288,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-out-params-in.xml b/tests/qemustatusxml2xmldata/migration-out-params-in.xml index 758a6f03b7..24ee86e4c0 100644 --- a/tests/qemustatusxml2xmldata/migration-out-params-in.xml +++ b/tests/qemustatusxml2xmldata/migration-out-params-in.xml @@ -270,6 +270,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/upgrade-out.xml b/tests/qemustatusxml2xmldata/upgrade-out.xml index ac2ffeddc2..e663b3dbb5 100644 --- a/tests/qemustatusxml2xmldata/upgrade-out.xml +++ b/tests/qemustatusxml2xmldata/upgrade-out.xml @@ -258,6 +258,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml index 0b8bc37c15..e71d6a83c7 100644 --- a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml +++ b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml @@ -308,6 +308,7 @@ + -2 -- 2.36.1
[PATCH 72/80] qemuDomainValidateStorageSource: Remove QEMU_CAPS_BLOCKDEV validation
While we assume that -blockdev is supported the validator had also some corner cases for -drive. Since we use '-drive' exclusively for the extremely rarely used SD cards it makes no sense to have the validation. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 60 +++--- 1 file changed, 3 insertions(+), 57 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8997041b34..0839744660 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4811,13 +4811,9 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, int qemuDomainValidateStorageSource(virStorageSource *src, virQEMUCaps *qemuCaps, -bool maskBlockdev) +bool maskBlockdev G_GNUC_UNUSED) { virStorageType actualType = virStorageSourceGetActualType(src); -bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV); - -if (maskBlockdev) -blockdev = false; if (src->format == VIR_STORAGE_FILE_COW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -4870,17 +4866,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, return -1; } -if (src->sliceStorage) { -/* In pre-blockdev era we can't configure the slice so we can allow them - * only for detected backing store entries as they are populated - * from a place that qemu would be able to read */ -if (!src->detected && !blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("storage slice is not supported by this QEMU binary")); -return -1; -} -} - if (src->sslverify != VIR_TRISTATE_BOOL_ABSENT) { if (actualType != VIR_STORAGE_TYPE_NETWORK || (src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS && @@ -4889,12 +4874,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, _("ssl verification is supported only with HTTPS/FTPS protocol")); return -1; } - -if (!src->detected && !blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("ssl verification setting is not supported by this QEMU binary")); -return -1; -} } if (src->ncookies > 0) { @@ -4906,12 +4885,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, return -1; } -if (!src->detected && !blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("http cookies are not supported by this QEMU binary")); -return -1; -} - if (virStorageSourceNetCookiesValidate(src) < 0) return -1; } @@ -4926,12 +4899,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, _("readahead is supported only with HTTP(S)/FTP(s) protocols")); return -1; } - -if (!src->detected && !blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("readahead setting is not supported with this QEMU binary")); -return -1; -} } if (src->timeout > 0) { @@ -4944,12 +4911,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, _("timeout is supported only with HTTP(S)/FTP(s) protocols")); return -1; } - -if (!src->detected && !blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("timeout setting is not supported with this QEMU binary")); -return -1; -} } if (src->query && @@ -4961,11 +4922,9 @@ qemuDomainValidateStorageSource(virStorageSource *src, return -1; } -/* TFTP protocol was not supported for some time, lock it out at least with - * -blockdev */ +/* TFTP protocol was not supported */ if (actualType == VIR_STORAGE_TYPE_NETWORK && -src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP && -blockdev) { +src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'tftp' protocol is not supported with this QEMU binary")); return -1; @@ -4973,13 +4932,6 @@ qemuDomainValidateStorageSource(virStorageSource *src, if (actualType == VIR_STORAGE_TYPE_NETWORK && src->protocol == VIR_STORAGE_NET_PROTOCOL_NFS) { -/* NFS protocol may only be used if current QEMU supports blockdev */ -if (!blockdev) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("'nfs' protocol is not supported with this QEMU binary")); -return -1; -} - /* NFS protocol must have exactly one host */ if (src->nhosts != 1) { virReportError(VIR_ERR_CONFIG_UNSU
[PATCH 63/80] qemu: block: Remove support for legacy disk hotplug/unplug
Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 14 -- src/qemu/qemu_block.h | 2 -- src/qemu/qemu_command.c | 3 +-- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index afdcca2813..f504d8bc4c 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1304,7 +1304,6 @@ qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachData *data) g_free(data->encryptsecretAlias); g_free(data->httpcookiesecretAlias); g_free(data->driveCmd); -g_free(data->driveAlias); g_free(data->chardevAlias); g_free(data); } @@ -1472,13 +1471,6 @@ qemuBlockStorageSourceAttachApply(qemuMonitor *mon, qemuBlockStorageSourceAttachApplyFormat(mon, data) < 0) return -1; -if (data->driveCmd) { -if (qemuMonitorAddDrive(mon, data->driveCmd) < 0) -return -1; - -data->driveAdded = true; -} - if (data->chardevDef) { if (qemuMonitorAttachCharDev(mon, data->chardevAlias, data->chardevDef) < 0) return -1; @@ -1515,12 +1507,6 @@ qemuBlockStorageSourceAttachRollback(qemuMonitor *mon, } } -if (data->driveAdded) { -if (qemuMonitorDriveDel(mon, data->driveAlias) < 0) -VIR_WARN("Unable to remove drive %s (%s) after failed 'device_add'", - data->driveAlias, data->driveCmd); -} - if (data->formatAttached) ignore_value(qemuMonitorBlockdevDel(mon, data->formatNodeName)); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index d29d444a5a..b083b7565e 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -81,8 +81,6 @@ struct qemuBlockStorageSourceAttachData { bool formatAttached; char *driveCmd; -char *driveAlias; -bool driveAdded; virDomainChrSourceDef *chardevDef; char *chardevAlias; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ed718eb81b..865464a772 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10624,8 +10624,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDef *disk) data = g_new0(qemuBlockStorageSourceAttachData, 1); -if (!(data->driveCmd = qemuBuildDriveStr(disk)) || -!(data->driveAlias = qemuAliasDiskDriveFromDisk(disk))) +if (!(data->driveCmd = qemuBuildDriveStr(disk))) return NULL; return g_steal_pointer(&data); -- 2.36.1
[PATCH 67/80] qemu: command: Remove unused qemuGetDriveSourceString
Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 208 src/qemu/qemu_command.h | 4 - 2 files changed, 212 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9fc3d91a42..a8c954edf6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1558,214 +1558,6 @@ qemuBuildChardevCommand(virCommand *cmd, } -static char * -qemuBuildNetworkDriveURI(virStorageSource *src) -{ -g_autoptr(virURI) uri = NULL; - -if (!(uri = qemuBlockStorageSourceGetURI(src))) -return NULL; - -if (src->hosts->socket) -uri->query = g_strdup_printf("socket=%s", src->hosts->socket); - -return virURIFormat(uri); -} - - -static char * -qemuBuildNetworkDriveStr(virStorageSource *src, - qemuDomainSecretInfo *secinfo) -{ -g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; -size_t i; -char *ret = NULL; - -switch ((virStorageNetProtocol) src->protocol) { -case VIR_STORAGE_NET_PROTOCOL_NBD: -if (src->nhosts != 1) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("protocol '%s' accepts only one host"), - virStorageNetProtocolTypeToString(src->protocol)); -return NULL; -} - -if (!((src->hosts->name && strchr(src->hosts->name, ':')) || - (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP && - !src->hosts->name) || - (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_UNIX && - src->hosts->socket && - !g_path_is_absolute(src->hosts->socket { - -virBufferAddLit(&buf, "nbd:"); - -switch (src->hosts->transport) { -case VIR_STORAGE_NET_HOST_TRANS_TCP: -virBufferAsprintf(&buf, "%s:%u", - src->hosts->name, src->hosts->port); -break; - -case VIR_STORAGE_NET_HOST_TRANS_UNIX: -if (!src->hosts->socket) { -virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("socket attribute required for " - "unix transport")); -return NULL; -} - -virBufferAsprintf(&buf, "unix:%s", src->hosts->socket); -break; - -default: -virReportError(VIR_ERR_INTERNAL_ERROR, - _("nbd does not support transport '%s'"), - virStorageNetHostTransportTypeToString(src->hosts->transport)); -return NULL; -} - -if (src->path) -virBufferAsprintf(&buf, ":exportname=%s", src->path); - -return virBufferContentAndReset(&buf); -} -/* NBD code uses URI formatting scheme as others in some cases */ -ret = qemuBuildNetworkDriveURI(src); -break; - -case VIR_STORAGE_NET_PROTOCOL_HTTP: -case VIR_STORAGE_NET_PROTOCOL_HTTPS: -case VIR_STORAGE_NET_PROTOCOL_FTP: -case VIR_STORAGE_NET_PROTOCOL_FTPS: -case VIR_STORAGE_NET_PROTOCOL_TFTP: -case VIR_STORAGE_NET_PROTOCOL_ISCSI: -case VIR_STORAGE_NET_PROTOCOL_GLUSTER: -ret = qemuBuildNetworkDriveURI(src); -break; - -case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: -if (!src->path) { -virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing disk source for 'sheepdog' protocol")); -return NULL; -} - -if (src->nhosts == 0) { -ret = g_strdup_printf("sheepdog:%s", src->path); -} else if (src->nhosts == 1) { -ret = g_strdup_printf("sheepdog:%s:%u:%s", src->hosts->name, - src->hosts->port, src->path); -} else { -virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("protocol 'sheepdog' accepts up to one host")); -return NULL; -} - -break; - -case VIR_STORAGE_NET_PROTOCOL_RBD: -if (strchr(src->path, ':')) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("':' not allowed in RBD source volume name '%s'"), - src->path); -return NULL; -} - -virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL); - -if (src->snapshot) -virBufferEscape(&buf, '\\', ":", "@%s", src->snapshot); - -if (!secinfo) -virBufferAddLit(&buf, ":auth_supported=none"); -else -
[PATCH 73/80] qemuDomainValidateStorageSource: Remove 'maskBlockdev' argument
Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 10 -- src/qemu/qemu_domain.h | 3 +-- src/qemu/qemu_validate.c | 6 ++ tests/qemublocktest.c| 4 ++-- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0839744660..8ac99a8cf7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4810,8 +4810,7 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, int qemuDomainValidateStorageSource(virStorageSource *src, -virQEMUCaps *qemuCaps, -bool maskBlockdev G_GNUC_UNUSED) +virQEMUCaps *qemuCaps) { virStorageType actualType = virStorageSourceGetActualType(src); @@ -7721,8 +7720,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, if (n->format == VIR_STORAGE_FILE_ISO) n->format = VIR_STORAGE_FILE_RAW; -/* mask-out blockdev for 'sd' disks */ -if (qemuDomainValidateStorageSource(n, priv->qemuCaps, isSD) < 0) +if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0) return -1; qemuDomainPrepareStorageSourceConfig(n, cfg); @@ -10782,7 +10780,7 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDef *disk, qemuDomainObjPrivate *priv, virQEMUDriverConfig *cfg) { -if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps, true) < 0) +if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0) return -1; qemuDomainPrepareStorageSourceConfig(disk->src, cfg); @@ -10820,7 +10818,7 @@ qemuDomainPrepareStorageSourceBlockdevNodename(virDomainDiskDef *disk, if (src->encryption && src->encryption->engine == VIR_STORAGE_ENCRYPTION_ENGINE_DEFAULT) src->encryption->engine = VIR_STORAGE_ENCRYPTION_ENGINE_QEMU; -if (qemuDomainValidateStorageSource(src, priv->qemuCaps, false) < 0) +if (qemuDomainValidateStorageSource(src, priv->qemuCaps) < 0) return -1; qemuDomainPrepareStorageSourceConfig(src, cfg); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 7dc720dcb8..abf245ec2a 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -997,8 +997,7 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDef *disk, int qemuDomainValidateStorageSource(virStorageSource *src, -virQEMUCaps *qemuCaps, -bool maskBlockdev); +virQEMUCaps *qemuCaps); int diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 4ce920152f..af93588e49 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -648,7 +648,7 @@ qemuValidateDomainDefNvram(const virDomainDef *def, return -1; } -if (qemuDomainValidateStorageSource(src, qemuCaps, false) < 0) +if (qemuDomainValidateStorageSource(src, qemuCaps) < 0) return -1; return 0; @@ -3216,7 +3216,6 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, virQEMUCaps *qemuCaps) { const char *driverName = virDomainDiskGetDriver(disk); -bool isSD = qemuDiskBusIsSD(disk->bus); virStorageSource *n; int idx; int partition; @@ -3259,8 +3258,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, } for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { -/* blockdev support is masked out for 'sd' disks */ -if (qemuDomainValidateStorageSource(n, qemuCaps, isSD) < 0) +if (qemuDomainValidateStorageSource(n, qemuCaps) < 0) return -1; } diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 57116c930b..1c1013d4d9 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -294,7 +294,7 @@ testQemuDiskXMLToProps(const void *opaque) if (testQemuDiskXMLToJSONFakeSecrets(n) < 0) return -1; -if (qemuDomainValidateStorageSource(n, data->qemuCaps, false) < 0) +if (qemuDomainValidateStorageSource(n, data->qemuCaps) < 0) return -1; qemuDomainPrepareDiskSourceData(disk, n); @@ -519,7 +519,7 @@ testQemuImageCreate(const void *opaque) src->capacity = UINT_MAX * 2ULL; src->physical = UINT_MAX + 1ULL; -if (qemuDomainValidateStorageSource(src, data->qemuCaps, false) < 0) +if (qemuDomainValidateStorageSource(src, data->qemuCaps) < 0) return -1; if (qemuBlockStorageSourceCreateGetStorageProps(src, &protocolprops) < 0) -- 2.36.1
[PATCH 75/80] qemu: Retire QEMU_CAPS_BLOCKDEV
Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 13 + src/qemu/qemu_capabilities.h | 2 +- src/qemu/qemu_process.c | 10 -- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - tests/qemuhotplugtest.c | 1 - tests/testutilsqemu.c | 3 --- 31 files changed, 6 insertions(+), 49 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b91f46bb12..7342eb3596 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -504,7 +504,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "usb-storage.werror", /* X_QEMU_CAPS_USB_STORAGE_WERROR */ "egl-headless", /* QEMU_CAPS_EGL_HEADLESS */ "vfio-pci.display", /* QEMU_CAPS_VFIO_PCI_DISPLAY */ - "blockdev", /* QEMU_CAPS_BLOCKDEV */ + "blockdev", /* X_QEMU_CAPS_BLOCKDEV */ /* 315 */ "vfio-ap", /* QEMU_CAPS_DEVICE_VFIO_AP */ @@ -5224,10 +5224,6 @@ virQEMUCapsInitQMPBasicArch(virQEMUCaps *qemuCaps) static void virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps) { -/* While the removal of pre-blockdev code is in progress we always hard-code - * the support for QEMU_CAPS_BLOCKDEV */ -virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV); - /* -enable-fips is deprecated in QEMU 5.2.0, and QEMU * should be built with gcrypt to achieve FIPS compliance * automatically / implicitly @@ -6093,13 +6089,13 @@ struct virQEMUCapsDomainFeatureCapabilityTuple { /** * This maps the qemu features to the entries in of the domain - * capability XML. + * capability XML. Use QEMU_CAPS_LAST to always enable a domain feature. * */ static const struct virQEMUCapsDomainFeatureCapabilityTuple domCapsTuples[] = { { VIR_DOMAIN_CAPS_FEATURE_IOTHREADS, QEMU_CAPS_OBJECT_IOTHREAD }, { VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO, QEMU_CAPS_DEVICE_VMCOREINFO }, { VIR_DOMAIN_CAPS_FEATURE_GENID, QEMU_CAPS_DEVICE_VMGENID }, -{ VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT, QEMU_CAPS_BLOCKDEV }, +{ VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT, QEMU_CAPS_LAST }, { VIR_DOMAIN_CAPS_FEATURE_BACKUP, QEMU_CAPS_INCREMENTAL_BACKUP }, }; @@ -6111,7 +6107,8 @@ virQEMUCapsFillDomainFeaturesFromQEMUCaps(virQEMUCaps *qemuCaps, size_t i; for (i = 0; i < G_N_ELEMENTS(domCapsTuples); i++) { -if (virQEMUCapsGet(qemuCaps, domCapsTuples[i].qemucap)) +if (virQEMUCapsGet(qemuCaps, domCapsTuples[i].qemucap) || +domCapsTuples[i].qemucap == QEMU_CAPS_LAST) domCaps->features[domCapsTuples[i].domcap] = VIR_TRISTATE_BOOL_YES; else domCaps->features[domCapsTuples[i].domcap] = VIR_TRISTATE_BOOL_NO; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 5f982b11d5..f8d4d3df05 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -483,7 +483,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ X_QEMU_CAPS_USB_STORAGE_WERROR, /* -device usb-storage,werror=..,rerror=.. */ QEMU_CAPS_EGL_HEADLESS, /* -display egl-headless */ QEMU_CAPS_VFIO_PCI_DISPLAY, /* -device vfio-pci.display */ -QEMU_CAPS_BLOCKDEV, /* -blockdev and blockdev-add are supported */ +X_QEMU_CAPS_BLOCKDEV, /* -blockdev and blockdev-add are supported */ /* 315 */ QEMU_CAPS_DEVICE_VFIO_AP, /* -device vfio-ap */ diff --git a/src/q
[PATCH 74/80] qemuDomainDetermineDiskChain: Assume QEMU_CAPS_BLOCKDEV
Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8ac99a8cf7..d372381c74 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7635,8 +7635,6 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, virStorageSource *src; /* iterator for the backing chain declared in XML */ virStorageSource *n; /* iterator for the backing chain detected from disk */ qemuDomainObjPrivate *priv = vm->privateData; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); -bool isSD = qemuDiskBusIsSD(disk->bus); uid_t uid; gid_t gid; @@ -7726,7 +7724,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, qemuDomainPrepareStorageSourceConfig(n, cfg); qemuDomainPrepareDiskSourceData(disk, n); -if (blockdev && !isSD && +if (!qemuDiskBusIsSD(disk->bus) && qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0) return -1; } -- 2.36.1
[PATCH 69/80] qemuDomainSecretStorageSourcePrepare: Remove cabapbility check when preparing cookies
The capability is checked when we validate the source in the first place. Also it won't make sense any more. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 32319c1503..fb29135179 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1322,7 +1322,6 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv, } if (src->ncookies && -virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && !(srcPriv->httpcookie = qemuDomainSecretStorageSourcePrepareCookies(priv, src, aliasprotocol))) -- 2.36.1
[PATCH 79/80] qemu: Assume and retire QEMU_CAPS_BLOCKDEV_BACKUP
The blockdev-backup QMP command was introduced in qemu-2.3. Signed-off-by: Peter Krempa --- src/qemu/qemu_backup.c| 6 -- src/qemu/qemu_capabilities.c | 6 ++ src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 29 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 60cb79d70d..1012e3aee7 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -802,12 +802,6 @@ qemuBackupBegin(virDomainObj *vm, goto endjob; } -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP)) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("backup is not supported with this QEMU")); -goto endjob; -} - if (virDomainBackupAlignDisks(def, vm->def, suffix) < 0) goto endjob; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1caae40d0f..9ab57dd9f3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -621,7 +621,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 395 */ "vnc-power-control", /* QEMU_CAPS_VNC_POWER_CONTROL */ "audiodev", /* X_QEMU_CAPS_AUDIODEV */ - "blockdev-backup", /* QEMU_CAPS_BLOCKDEV_BACKUP */ + "blockdev-backup", /* X_QEMU_CAPS_BLOCKDEV_BACKUP */ "object.qapified", /* QEMU_CAPS_OBJECT_JSON */ "rotation-rate", /* QEMU_CAPS_ROTATION_RATE */ @@ -1586,7 +1586,6 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { { "blockdev-add/arg-type/+file/aio/^io_uring", QEMU_CAPS_AIO_IO_URING }, { "blockdev-add/arg-type/+rbd/encrypt", QEMU_CAPS_RBD_ENCRYPTION }, { "blockdev-add/arg-type/+nbd/tls-hostname", QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME }, -{ "blockdev-backup", QEMU_CAPS_BLOCKDEV_BACKUP }, { "blockdev-snapshot/$allow-write-only-overlay", QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY }, { "chardev-add/arg-type/backend/+socket/data/reconnect", QEMU_CAPS_CHARDEV_RECONNECT }, { "chardev-add/arg-type/backend/+file/data/logfile", QEMU_CAPS_CHARDEV_LOGFILE }, @@ -5241,8 +5240,7 @@ virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps) void virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qemuCaps) { -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP) && -virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) && +if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATION_PARAM_BLOCK_BITMAP_MAPPING)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 097ecdca32..78147ee75f 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -600,7 +600,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 395 */ QEMU_CAPS_VNC_POWER_CONTROL, /* -vnc power-control option */ X_QEMU_CAPS_AUDIODEV, /* -audiodev instead of QEMU_AUDIO_DRV */ -QEMU_CAPS_BLOCKDEV_BACKUP, /* qemu supports the blockdev-backup job */ +X_QEMU_CAPS_BLOCKDEV_BACKUP, /* qemu supports the blockdev-backup job */ QEMU_CAPS_OBJECT_JSON, /* parameters for object-add are formally described */ QEMU_CAPS_ROTATION_RATE, /* scsi-disk / ide-drive rotation-rate prop */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_
[PATCH 78/80] qemu: Assume support and retire QEMU_CAPS_BLOCK_WRITE_THRESHOLD
The event was introduced in qemu-2.3 Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- src/qemu/qemu_driver.c| 6 -- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 29 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d0fbe8d7f8..1caae40d0f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -413,7 +413,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "nvdimm", /* QEMU_CAPS_DEVICE_NVDIMM */ "pcie-root-port", /* QEMU_CAPS_DEVICE_PCIE_ROOT_PORT */ "query-cpu-definitions", /* QEMU_CAPS_QUERY_CPU_DEFINITIONS */ - "block-write-threshold", /* QEMU_CAPS_BLOCK_WRITE_THRESHOLD */ + "block-write-threshold", /* X_QEMU_CAPS_BLOCK_WRITE_THRESHOLD */ /* 250 */ "query-named-block-nodes", /* X_QEMU_CAPS_QUERY_NAMED_BLOCK_NODES */ @@ -1233,7 +1233,6 @@ struct virQEMUCapsStringFlags virQEMUCapsMigration[] = { /* Use virQEMUCapsQMPSchemaQueries for querying parameters of events */ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = { { "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE }, -{ "BLOCK_WRITE_THRESHOLD", QEMU_CAPS_BLOCK_WRITE_THRESHOLD }, { "DUMP_COMPLETED", QEMU_CAPS_DUMP_COMPLETED }, }; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index d06a7e6751..097ecdca32 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -392,7 +392,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_DEVICE_NVDIMM, /* -device nvdimm */ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, /* -device pcie-root-port */ QEMU_CAPS_QUERY_CPU_DEFINITIONS, /* qmp query-cpu-definitions */ -QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ +X_QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ /* 250 */ X_QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4c3e12966a..8c7cb64f98 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19632,12 +19632,6 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (virDomainObjCheckActive(vm) < 0) goto endjob; -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_WRITE_THRESHOLD)) { -virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("this qemu does not support setting device threshold")); -goto endjob; -} - if (!(src = qemuDomainGetStorageSourceByDevstr(dev, vm->def, priv->backup))) goto endjob; diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index e285dd4899..ed59536bd7 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -88,7 +88,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 22a441e9c6..8adc5e8335 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -84,7 +84,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 19c38fe572..41abf5474a 100644 --- a/tests/qemucapab
[PATCH 61/80] qemu: block: Remove unused qemuBlockStorageSourceChainDetachPrepareLegacy
Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 26 -- src/qemu/qemu_block.h | 3 --- 2 files changed, 29 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 6e643598bc..a5d9f47ec4 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1657,32 +1657,6 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSource *src) } -/** - * qemuBlockStorageSourceChainDetachPrepareLegacy - * @src: storage source chain to remove - * @driveAlias: Alias of the 'drive' backend (always consumed) - * - * Prepares qemuBlockStorageSourceChainData *for detaching @src and its - * backingStore if -drive was used. - */ -qemuBlockStorageSourceChainData * -qemuBlockStorageSourceChainDetachPrepareDrive(virStorageSource *src, - char *driveAlias) -{ -g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL; -g_autoptr(qemuBlockStorageSourceChainData) data = NULL; - -data = g_new0(qemuBlockStorageSourceChainData, 1); - -if (!(backend = qemuBlockStorageSourceDetachPrepare(src, driveAlias))) -return NULL; - -VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); - -return g_steal_pointer(&data); -} - - /** * qemuBlockStorageSourceChainDetachPrepareChardev * @src: storage source chain to remove diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 422c1a0deb..a20a5e8a61 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -150,9 +150,6 @@ qemuBlockStorageSourceChainDataFree(qemuBlockStorageSourceChainData *data); qemuBlockStorageSourceChainData * qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSource *src); qemuBlockStorageSourceChainData * -qemuBlockStorageSourceChainDetachPrepareDrive(virStorageSource *src, - char *driveAlias); -qemuBlockStorageSourceChainData * qemuBlockStorageSourceChainDetachPrepareChardev(char *chardevAlias); int -- 2.36.1
[PATCH 42/80] qemu: monitor: Remove unused qemuMonitorDriveMirror
Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 21 -- src/qemu/qemu_monitor.h | 10 - src/qemu/qemu_monitor_json.c | 41 src/qemu/qemu_monitor_json.h | 11 -- tests/qemumonitorjsontest.c | 2 -- 5 files changed, 85 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a4b1b90c7c..9c24b842bd 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2871,27 +2871,6 @@ qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name) } -/* Start a drive-mirror block job. bandwidth is in bytes/sec. */ -int -qemuMonitorDriveMirror(qemuMonitor *mon, - const char *device, const char *file, - const char *format, unsigned long long bandwidth, - unsigned int granularity, unsigned long long buf_size, - bool shallow, - bool reuse) -{ -VIR_DEBUG("device=%s, file=%s, format=%s, bandwidth=%lld, " - "granularity=%#x, buf_size=%lld, shallow=%d, reuse=%d", - device, file, NULLSTR(format), bandwidth, granularity, - buf_size, shallow, reuse); - -QEMU_CHECK_MONITOR(mon); - -return qemuMonitorJSONDriveMirror(mon, device, file, format, bandwidth, - granularity, buf_size, shallow, reuse); -} - - int qemuMonitorBlockdevMirror(qemuMonitor *mon, const char *jobname, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 352cf0ada5..aee9ca0e6a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -979,16 +979,6 @@ int qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name); int qemuMonitorTransaction(qemuMonitor *mon, virJSONValue **actions) ATTRIBUTE_NONNULL(2); -int qemuMonitorDriveMirror(qemuMonitor *mon, - const char *device, - const char *file, - const char *format, - unsigned long long bandwidth, - unsigned int granularity, - unsigned long long buf_size, - bool shallow, - bool reuse) -ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int qemuMonitorBlockdevMirror(qemuMonitor *mon, const char *jobname, bool persistjob, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9363f86a55..bd3130075b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4096,47 +4096,6 @@ qemuMonitorJSONDelObject(qemuMonitor *mon, } -/* speed is in bytes/sec */ -int -qemuMonitorJSONDriveMirror(qemuMonitor *mon, - const char *device, const char *file, - const char *format, unsigned long long speed, - unsigned int granularity, - unsigned long long buf_size, - bool shallow, - bool reuse) -{ -g_autoptr(virJSONValue) cmd = NULL; -g_autoptr(virJSONValue) reply = NULL; -const char *syncmode = "full"; -const char *mode = "absolute-paths"; - -if (shallow) -syncmode = "top"; - -if (reuse) -mode = "existing"; - -cmd = qemuMonitorJSONMakeCommand("drive-mirror", - "s:device", device, - "s:target", file, - "Y:speed", speed, - "z:granularity", granularity, - "P:buf-size", buf_size, - "s:sync", syncmode, - "s:mode", mode, - "S:format", format, - NULL); -if (!cmd) -return -1; - -if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) -return -1; - -return qemuMonitorJSONCheckError(cmd, reply); -} - - int qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, const char *jobname, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 31f6214ec4..f409480c0b 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -305,17 +305,6 @@ int qemuMonitorJSONTransaction(qemuMonitor *mon, virJSONValue **actions) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -int -qemuMonitorJSONDriveMirror(qemuMonitor *mon, - const char *device, - const char *file, - const char *format, - unsigned long long speed, - unsigned int granularity, - unsigned long long buf_size, -
[PATCH 59/80] qemuDomainRemoveDiskDevice: Remove special casing for disks on 'sd' bus
SD card disks can't be detached, so it makes no sense to special case them in the unplug code. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a57db12144..3c35a115e3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4299,7 +4299,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, if (!(diskBackend = qemuBlockStorageSourceChainDetachPrepareChardev(chardevAlias))) goto cleanup; -} else if (blockdev && !qemuDiskBusIsSD(disk->bus)) { +} else if (blockdev) { if (diskPriv->blockjob) { /* the block job keeps reference to the disk chain */ diskPriv->blockjob->disk = NULL; -- 2.36.1
[PATCH 56/80] qemu: hotplug: Remove pre-blockdev code path from qemuDomainChangeEjectableMedia
All media are changed in blockdev-instantiated cdroms now, remove the old code. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 88 + 1 file changed, 1 insertion(+), 87 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 28e4284e62..a57db12144 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -269,89 +269,6 @@ qemuHotplugWaitForTrayEject(virDomainObj *vm, } -/** - * qemuDomainChangeMediaLegacy: - * @driver: qemu driver structure - * @vm: domain definition - * @disk: disk definition to change the source of - * @newsrc: new disk source to change to - * @force: force the change of media - * - * Change the media in an ejectable device to the one described by - * @newsrc. This function also removes the old source from the - * shared device table if appropriate. Note that newsrc is consumed - * on success and the old source is freed on success. - * - * Returns 0 on success, -1 on error and reports libvirt error - */ -static int -qemuDomainChangeMediaLegacy(virQEMUDriver *driver, -virDomainObj *vm, -virDomainDiskDef *disk, -virStorageSource *newsrc, -bool force) -{ -int rc; -g_autofree char *driveAlias = NULL; -qemuDomainObjPrivate *priv = vm->privateData; -qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); -const char *format = NULL; -g_autofree char *sourcestr = NULL; - -if (!disk->info.alias) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing disk device alias name for %s"), disk->dst); -return -1; -} - -if (!(driveAlias = qemuAliasDiskDriveFromDisk(disk))) -return -1; - -qemuDomainObjEnterMonitor(driver, vm); -rc = qemuMonitorEjectMedia(priv->mon, driveAlias, force); -qemuDomainObjExitMonitor(vm); - -/* If the tray is present wait for it to open. */ -if (!force && diskPriv->tray) { -rc = qemuHotplugWaitForTrayEject(vm, disk); -if (rc < 0) -return -1; - -/* re-issue ejection command to pop out the media */ -qemuDomainObjEnterMonitor(driver, vm); -rc = qemuMonitorEjectMedia(priv->mon, driveAlias, false); -qemuDomainObjExitMonitor(vm); -if (rc < 0) -return -1; - -} else { -/* otherwise report possible errors from the attempt to eject the media */ -if (rc < 0) -return -1; -} - -if (!virStorageSourceIsEmpty(newsrc)) { -if (qemuGetDriveSourceString(newsrc, NULL, &sourcestr) < 0) -return -1; - -if (virStorageSourceGetActualType(newsrc) != VIR_STORAGE_TYPE_DIR) -format = virStorageFileFormatTypeToString(newsrc->format); - -qemuDomainObjEnterMonitor(driver, vm); -rc = qemuMonitorChangeMedia(priv->mon, -driveAlias, -sourcestr, -format); -qemuDomainObjExitMonitor(vm); -} - -if (rc < 0) -return -1; - -return 0; -} - - /** * qemuHotplugAttachDBusVMState: * @driver: QEMU driver object @@ -671,10 +588,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriver *driver, if (qemuHotplugAttachManagedPR(driver, vm, newsrc, VIR_ASYNC_JOB_NONE) < 0) goto cleanup; -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -rc = qemuDomainChangeMediaBlockdev(driver, vm, disk, oldsrc, newsrc, force); -else -rc = qemuDomainChangeMediaLegacy(driver, vm, disk, newsrc, force); +rc = qemuDomainChangeMediaBlockdev(driver, vm, disk, oldsrc, newsrc, force); virDomainAuditDisk(vm, oldsrc, newsrc, "update", rc >= 0); -- 2.36.1
[PATCH 55/80] qemu: driver: Remove remaining QEMU_CAPS_BLOCKDEV capability checks
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 59d1caa053..1ecc9a71b3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9992,9 +9992,7 @@ qemuDomainBlockResize(virDomainPtr dom, goto endjob; } -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -!qemuDiskBusIsSD(disk->bus)) { - +if (!qemuDiskBusIsSD(disk->bus)) { nodename = disk->src->nodeformat; } else { if (!(device = qemuAliasDiskDriveFromDisk(disk))) @@ -16218,8 +16216,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, /* blockdev-based qemu doesn't want to set the throttling when a cdrom * is empty. Skip the monitor call here since we will set the throttling * once new media is inserted */ -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) || -!virStorageSourceIsEmpty(disk->src)) { +if (!virStorageSourceIsEmpty(disk->src)) { int rc = 0; qemuDomainObjEnterMonitor(driver, vm); -- 2.36.1
[PATCH 80/80] qemuDomainDetermineDiskChain: Remove 'report_broken' argument
All callers pass 'true'. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 36 +++- src/qemu/qemu_domain.h | 3 +-- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_process.c | 2 +- 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d372381c74..e227a8b7d4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7617,19 +7617,16 @@ qemuDomainPrepareStorageSourceConfig(virStorageSource *src, * @vm: domain object * @disk: disk definition * @disksrc: source to determine the chain for, may be NULL - * @report_broken: report broken chain verbosely * * Prepares and initializes the backing chain of disk @disk. In cases where * a new source is to be associated with @disk the @disksrc parameter can be - * used to override the source. If @report_broken is true missing images - * in the backing chain are reported. + * used to override the source. */ int qemuDomainDetermineDiskChain(virQEMUDriver *driver, virDomainObj *vm, virDomainDiskDef *disk, - virStorageSource *disksrc, - bool report_broken) + virStorageSource *disksrc) { g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virStorageSource *src; /* iterator for the backing chain declared in XML */ @@ -7651,8 +7648,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, disksrc->format < VIR_STORAGE_FILE_BACKING) { if (!virFileExists(disksrc->path)) { -if (report_broken) -virStorageSourceReportBrokenChain(errno, disksrc, disksrc); +virStorageSourceReportBrokenChain(errno, disksrc, disksrc); return -1; } @@ -7675,24 +7671,22 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, src = disksrc; /* skip to the end of the chain if there is any */ while (virStorageSourceHasBacking(src)) { -if (report_broken) { -int rv = virStorageSourceSupportsAccess(src); +int rv = virStorageSourceSupportsAccess(src); -if (rv < 0) -return -1; - -if (rv > 0) { -if (qemuDomainStorageFileInit(driver, vm, src, disksrc) < 0) -return -1; +if (rv < 0) +return -1; -if (virStorageSourceAccess(src, F_OK) < 0) { -virStorageSourceReportBrokenChain(errno, src, disksrc); -virStorageSourceDeinit(src); -return -1; -} +if (rv > 0) { +if (qemuDomainStorageFileInit(driver, vm, src, disksrc) < 0) +return -1; +if (virStorageSourceAccess(src, F_OK) < 0) { +virStorageSourceReportBrokenChain(errno, src, disksrc); virStorageSourceDeinit(src); +return -1; } + +virStorageSourceDeinit(src); } src = src->backingStore; } @@ -7710,7 +7704,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, if (virStorageSourceGetMetadata(src, uid, gid, QEMU_DOMAIN_STORAGE_SOURCE_CHAIN_MAX_DEPTH, -report_broken) < 0) +true) < 0) return -1; for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index abf245ec2a..dcae0f9601 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -710,8 +710,7 @@ int qemuDomainStorageSourceValidateDepth(virStorageSource *src, int qemuDomainDetermineDiskChain(virQEMUDriver *driver, virDomainObj *vm, virDomainDiskDef *disk, - virStorageSource *disksrc, - bool report_broken); + virStorageSource *disksrc); bool qemuDomainDiskChangeSupported(virDomainDiskDef *disk, virDomainDiskDef *orig_disk); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8c7cb64f98..49f694e0a7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15141,7 +15141,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, if (mirror_reuse && mirror->format >= VIR_STORAGE_FILE_BACKING && mirror->backingStore == NULL && -qemuDomainDetermineDiskChain(driver, vm, disk, mirror, true) < 0) +qemuDomainDetermineDiskChain(driver, vm, disk, mirror) < 0) goto endjob; if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index afc9d299f5..72e5b106e9 100644 --- a/src/qemu/qe
[PATCH 58/80] qemuhotplugtest: Switch to -blockdev mode
Enable blockdev mode and convert the expected commands to the modern equivalents in preparation for removing the old-style hotplug code paths. Signed-off-by: Peter Krempa --- tests/qemuhotplugtest.c | 75 --- .../qemuhotplug-base-ccw-live+ccw-virtio.xml | 2 +- ...with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 4 +- ...otplug-base-ccw-live-with-2-ccw-virtio.xml | 2 +- ...-with-ccw-virtio+ccw-virtio-2-explicit.xml | 2 +- ...-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 2 +- .../qemuhotplug-base-live+cdrom-scsi.xml | 2 +- .../qemuhotplug-base-live+cdrom-usb.xml | 2 +- ...uhotplug-base-live+disk-scsi-multipath.xml | 2 +- ...+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 2 +- .../qemuhotplug-base-live+disk-scsi.xml | 2 +- .../qemuhotplug-base-live+disk-usb.xml| 2 +- .../qemuhotplug-base-live+disk-virtio.xml | 2 +- ...thout-scsi-controller-live+disk-scsi-2.xml | 2 +- 14 files changed, 62 insertions(+), 41 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index c938c8dc4c..5edcf3d989 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -73,6 +73,7 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, virQEMUCapsInitQMPBasicArch(priv->qemuCaps); +virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_CCW); @@ -670,7 +671,6 @@ mymain(void) #define QMP_OK "{\"return\": {}}" -#define HMP(msg)"{\"return\": \"" msg "\"}" #define QMP_DEVICE_DELETED(dev) \ "{" \ @@ -707,31 +707,37 @@ mymain(void) "chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}"); DO_TEST_ATTACH("base-live", "disk-virtio", false, true, - "human-monitor-command", HMP("OK\\r\\n"), + "blockdev-add", QMP_OK, + "blockdev-add", QMP_OK, "device_add", QMP_OK); DO_TEST_DETACH("base-live", "disk-virtio", true, true, "device_del", QMP_OK); DO_TEST_DETACH("base-live", "disk-virtio", false, false, "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK, - "human-monitor-command", HMP("")); + "blockdev-del", QMP_OK, + "blockdev-del", QMP_OK); DO_TEST_ATTACH("base-live", "disk-usb", false, true, - "human-monitor-command", HMP("OK\\r\\n"), + "blockdev-add", QMP_OK, + "blockdev-add", QMP_OK, "device_add", QMP_OK); DO_TEST_DETACH("base-live", "disk-usb", true, true, "device_del", QMP_OK); DO_TEST_DETACH("base-live", "disk-usb", false, false, "device_del", QMP_DEVICE_DELETED("usb-disk16") QMP_OK, - "human-monitor-command", HMP("")); + "blockdev-del", QMP_OK, + "blockdev-del", QMP_OK); DO_TEST_ATTACH("base-live", "disk-scsi", false, true, - "human-monitor-command", HMP("OK\\r\\n"), + "blockdev-add", QMP_OK, + "blockdev-add", QMP_OK, "device_add", QMP_OK); DO_TEST_DETACH("base-live", "disk-scsi", true, true, "device_del", QMP_OK); DO_TEST_DETACH("base-live", "disk-scsi", false, false, "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK, - "human-monitor-command", HMP("")); + "blockdev-del", QMP_OK, + "blockdev-del", QMP_OK); DO_TEST_ATTACH("base-without-scsi-controller-live", "disk-scsi-2", false, true, /* Four controllers added */ @@ -739,24 +745,27 @@ mymain(void) "device_add", QMP_OK, "device_add", QMP_OK, "device_add", QMP_OK, - "human-monitor-command", HMP("OK\\r\\n"), - /* Disk added */ + "blockdev-add", QMP_OK, + "blockdev-add", QMP_OK, "device_add", QMP_OK); DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", true, true, "device_del", QMP_OK); DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false, "device_del", QMP_DEVICE_DELETED("scsi3-0-5-6") QMP_OK, - "human-monitor-command", HMP("")); + "blockdev-del", QMP_OK, + "blockdev-del", QMP_OK); DO_TEST_ATTACH("base-live", "disk-scsi-multipath", false, true, "object-add", QMP_OK, - "human-monitor-command", HMP("OK\\r\\n"), + "blockdev-add", QMP_OK, + "blockdev-add", QMP_OK, "device_add", QMP_OK); DO_
[PATCH 76/80] qemu: Setup disk throttling for SD cards via monitor
Set it same way we set throttling for other disks in qemuProcessSetupDiskThrottling. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 42 - src/qemu/qemu_process.c | 20 +++- 2 files changed, 11 insertions(+), 51 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index afdf79ff55..6b93c5f579 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1676,46 +1676,6 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, } -static void -qemuBuildDiskThrottling(virDomainDiskDef *disk, -virBuffer *buf) -{ -#define IOTUNE_ADD(_field, _label) \ -if (disk->blkdeviotune._field) { \ -virBufferAsprintf(buf, ",throttling." _label "=%llu", \ - disk->blkdeviotune._field); \ -} - -IOTUNE_ADD(total_bytes_sec, "bps-total"); -IOTUNE_ADD(read_bytes_sec, "bps-read"); -IOTUNE_ADD(write_bytes_sec, "bps-write"); -IOTUNE_ADD(total_iops_sec, "iops-total"); -IOTUNE_ADD(read_iops_sec, "iops-read"); -IOTUNE_ADD(write_iops_sec, "iops-write"); - -IOTUNE_ADD(total_bytes_sec_max, "bps-total-max"); -IOTUNE_ADD(read_bytes_sec_max, "bps-read-max"); -IOTUNE_ADD(write_bytes_sec_max, "bps-write-max"); -IOTUNE_ADD(total_iops_sec_max, "iops-total-max"); -IOTUNE_ADD(read_iops_sec_max, "iops-read-max"); -IOTUNE_ADD(write_iops_sec_max, "iops-write-max"); - -IOTUNE_ADD(size_iops_sec, "iops-size"); -if (disk->blkdeviotune.group_name) { -virBufferAddLit(buf, ",throttling.group="); -virQEMUBuildBufferEscapeComma(buf, disk->blkdeviotune.group_name); -} - -IOTUNE_ADD(total_bytes_sec_max_length, "bps-total-max-length"); -IOTUNE_ADD(read_bytes_sec_max_length, "bps-read-max-length"); -IOTUNE_ADD(write_bytes_sec_max_length, "bps-write-max-length"); -IOTUNE_ADD(total_iops_sec_max_length, "iops-total-max-length"); -IOTUNE_ADD(read_iops_sec_max_length, "iops-read-max-length"); -IOTUNE_ADD(write_iops_sec_max_length, "iops-write-max-length"); -#undef IOTUNE_ADD -} - - static void qemuBuildDiskGetErrorPolicy(virDomainDiskDef *disk, const char **wpolicy, @@ -1790,8 +1750,6 @@ qemuBuildDriveStr(virDomainDiskDef *disk) } } -qemuBuildDiskThrottling(disk, &opt); - return virBufferContentAndReset(&opt); } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ac463571bb..f15222e932 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7220,7 +7220,7 @@ qemuProcessGenID(virDomainObj *vm, /** - * qemuProcessSetupDiskThrottlingBlockdev: + * qemuProcessSetupDiskThrottling: * * Sets up disk trottling for -blockdev via block_set_io_throttle monitor * command. This hack should be replaced by proper use of the 'throttle' @@ -7228,9 +7228,9 @@ qemuProcessGenID(virDomainObj *vm, * Same hack is done in qemuDomainAttachDiskGeneric. */ static int -qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, - virDomainObj *vm, - virDomainAsyncJob asyncJob) +qemuProcessSetupDiskThrottling(virQEMUDriver *driver, + virDomainObj *vm, + virDomainAsyncJob asyncJob) { size_t i; int ret = -1; @@ -7243,10 +7243,12 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, for (i = 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk = vm->def->disks[i]; qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); +g_autofree char *drivealias = NULL; -/* sd-cards are instantiated via -drive */ -if (qemuDiskBusIsSD(disk->bus)) -continue; +if (!QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { +if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) +goto cleanup; +} /* Setting throttling for empty drives fails */ if (virStorageSourceIsEmpty(disk->src)) @@ -7255,7 +7257,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) continue; -if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), NULL, +if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), drivealias, diskPriv->qomName, &disk->blkdeviotune) < 0) goto cleanup; } @@ -7768,7 +7770,7 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessSetupBalloon(driver, vm, asyncJob) < 0) goto cleanup; -if (qemuProcessSetupDiskThrottlingBlockdev(driver, vm, asyncJob) < 0) +if (qemuProcessSetupDiskThrottling(driver, vm, asyncJob) < 0) goto cleanup; /* Since CPUs were not started yet, the balloon could not return the memory -- 2.36.1
[PATCH 64/80] qemu: monitor: Remove unused qemuMonitorAddDrive/qemuMonitorDriveDel
Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 33 --- src/qemu/qemu_monitor.h | 6 --- src/qemu/qemu_monitor_text.c | 82 src/qemu/qemu_monitor_text.h | 6 --- 4 files changed, 127 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 456c54aed3..93890c43be 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2605,26 +2605,6 @@ qemuMonitorGetChardevInfo(qemuMonitor *mon, } -/** - * qemuMonitorDriveDel: - * @mon: monitor object - * @drivestr: identifier of drive to delete. - * - * Attempts to remove a host drive. - * Returns 1 if unsupported, 0 if ok, and -1 on other failure */ -int -qemuMonitorDriveDel(qemuMonitor *mon, -const char *drivestr) -{ -VIR_DEBUG("drivestr=%s", drivestr); - -QEMU_CHECK_MONITOR(mon); - -/* there won't be a direct replacement for drive_del in QMP */ -return qemuMonitorTextDriveDel(mon, drivestr); -} - - /** * @mon: monitor object * @devalias: alias of the device to detach @@ -2796,19 +2776,6 @@ qemuMonitorDelObject(qemuMonitor *mon, } -int -qemuMonitorAddDrive(qemuMonitor *mon, -const char *drivestr) -{ -VIR_DEBUG("drive=%s", drivestr); - -QEMU_CHECK_MONITOR(mon); - -/* there won't ever be a direct QMP replacement for this function */ -return qemuMonitorTextAddDrive(mon, drivestr); -} - - int qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 163e12c0f6..830be5418c 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -955,12 +955,6 @@ int qemuMonitorDelObject(qemuMonitor *mon, const char *objalias, bool report_error); -int qemuMonitorAddDrive(qemuMonitor *mon, -const char *drivestr); - -int qemuMonitorDriveDel(qemuMonitor *mon, -const char *drivestr); - int qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name); int qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name); diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 65785f1dae..8e70b8f78d 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -31,88 +31,6 @@ VIR_LOG_INIT("qemu.qemu_monitor_text"); -int qemuMonitorTextAddDrive(qemuMonitor *mon, -const char *drivestr) -{ -g_autofree char *cmd = NULL; -g_autofree char *reply = NULL; - -/* 'dummy' here is just a placeholder since there is no PCI - * address required when attaching drives to a controller */ -cmd = g_strdup_printf("drive_add dummy %s", drivestr); - -if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply) < 0) -return -1; - -if (strstr(reply, "unknown command:")) { -virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("drive hotplug is not supported")); -return -1; -} - -if (strstr(reply, "could not open disk image")) { -virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("open disk image file failed")); -return -1; -} - -if (strstr(reply, "Could not open")) { -size_t len = strlen(reply); -if (reply[len - 1] == '\n') -reply[len - 1] = '\0'; - -virReportError(VIR_ERR_OPERATION_FAILED, "%s", - reply); -return -1; -} - -if (strstr(reply, "Image is not in")) { -virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("Incorrect disk format")); -return -1; -} - -if (strstr(reply, "IOMMU") || -strstr(reply, "VFIO")) { -virReportError(VIR_ERR_OPERATION_FAILED, "%s", - reply); -return -1; -} - -return 0; -} - - -int qemuMonitorTextDriveDel(qemuMonitor *mon, -const char *drivestr) -{ -g_autofree char *cmd = NULL; -g_autofree char *reply = NULL; - -cmd = g_strdup_printf("drive_del %s", drivestr); - -if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply) < 0) -return -1; - -if (strstr(reply, "unknown command:")) { -VIR_ERROR(_("deleting drive is not supported. " -"This may leak data if disk is reassigned")); -return 1; - -/* (qemu) drive_del wark - * Device 'wark' not found */ -} else if (strstr(reply, "Device '") && strstr(reply, "not found")) { -/* NB: device not found errors mean the drive was auto-deleted and we - * ignore the error */ -} else if (STRNEQ(reply, "")) { -virReportError(VIR_ERR_OPERATION_FAILED, - _("deleting %s drive failed: %s"), drivestr, reply); -return -1; -} - -return 0; -} - int qemuMonitorTextCreateSnapshot(qemuMonitor *mon, const char *name) diff --git a/src/qemu/qemu
[PATCH 53/80] qemuDomainBlocksStatsGather: Remove pre-blockdev code paths
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 31 --- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c2722c39da..59d1caa053 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10054,7 +10054,6 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, qemuBlockStats **retstats) { qemuDomainObjPrivate *priv = vm->privateData; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); virDomainDiskDef *disk = NULL; g_autoptr(GHashTable) blockstats = NULL; qemuBlockStats *stats; @@ -10090,12 +10089,8 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); nstats = qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats); -if (capacity && nstats >= 0) { -if (blockdev) -rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, blockstats); -else -rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, blockstats); -} +if (capacity && nstats >= 0) +rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, blockstats); qemuDomainObjExitMonitor(vm); @@ -10105,6 +10100,8 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, *retstats = g_new0(qemuBlockStats, 1); if (entryname) { +qemuBlockStats *capstats; + if (!(stats = virHashLookup(blockstats, entryname))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find statistics for device '%s'"), entryname); @@ -10113,18 +10110,14 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, **retstats = *stats; -if (blockdev) { -/* capacity are reported only per node-name so we need to transfer them */ -qemuBlockStats *capstats; - -if (disk && disk->src && -(capstats = virHashLookup(blockstats, disk->src->nodeformat))) { -(*retstats)->capacity = capstats->capacity; -(*retstats)->physical = capstats->physical; -(*retstats)->wr_highest_offset = capstats->wr_highest_offset; -(*retstats)->wr_highest_offset_valid = capstats->wr_highest_offset_valid; -(*retstats)->write_threshold = capstats->write_threshold; -} +/* capacity are reported only per node-name so we need to transfer them */ +if (disk && disk->src && +(capstats = virHashLookup(blockstats, disk->src->nodeformat))) { +(*retstats)->capacity = capstats->capacity; +(*retstats)->physical = capstats->physical; +(*retstats)->wr_highest_offset = capstats->wr_highest_offset; +(*retstats)->wr_highest_offset_valid = capstats->wr_highest_offset_valid; +(*retstats)->write_threshold = capstats->write_threshold; } } else { for (i = 0; i < vm->def->ndisks; i++) { -- 2.36.1
[PATCH 77/80] qemu: capabilities: Retire QEMU_CAPS_QUERY_NAMED_BLOCK_NODES
Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 - tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 - tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 - tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 - tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 - 28 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7342eb3596..d0fbe8d7f8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -416,7 +416,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "block-write-threshold", /* QEMU_CAPS_BLOCK_WRITE_THRESHOLD */ /* 250 */ - "query-named-block-nodes", /* QEMU_CAPS_QUERY_NAMED_BLOCK_NODES */ + "query-named-block-nodes", /* X_QEMU_CAPS_QUERY_NAMED_BLOCK_NODES */ "cpu-cache", /* QEMU_CAPS_CPU_CACHE */ "qemu-xhci", /* QEMU_CAPS_DEVICE_QEMU_XHCI */ "kernel-irqchip", /* X_QEMU_CAPS_MACHINE_KERNEL_IRQCHIP */ @@ -1210,7 +1210,6 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = { { "query-hotpluggable-cpus", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS }, { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION }, { "query-cpu-definitions", QEMU_CAPS_QUERY_CPU_DEFINITIONS }, -{ "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES }, { "query-cpus-fast", QEMU_CAPS_QUERY_CPUS_FAST }, { "qom-list-properties", QEMU_CAPS_QOM_LIST_PROPERTIES }, { "query-current-machine", QEMU_CAPS_QUERY_CURRENT_MACHINE }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f8d4d3df05..d06a7e6751 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -395,7 +395,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ /* 250 */ -QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */ +X_QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */ QEMU_CAPS_CPU_CACHE, /* -cpu supports host-cache-info and l3-cache properties */ QEMU_CAPS_DEVICE_QEMU_XHCI, /* -device qemu-xhci */ X_QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, /* -machine kernel_irqchip */ diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 2928f00c67..e285dd4899 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -89,7 +89,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 7dc9b425ae..22a441e9c6 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -85,7 +85,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 2ff0e9f8df..19c38fe572 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -53,7 +53,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 744356169f..338ab4f925 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -115,7 +115,6 @@ - diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index f4e9e68dd0..
[PATCH 54/80] qemu: monitor: Remove unused qemuMonitorBlockStatsUpdateCapacity
Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 11 --- src/qemu/qemu_monitor.h | 4 --- src/qemu/qemu_monitor_json.c | 59 src/qemu/qemu_monitor_json.h | 3 -- 4 files changed, 77 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5e71945831..f1a9524f28 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2022,17 +2022,6 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, } -/* Updates "stats" to fill virtual and physical size of the image */ -int -qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, -GHashTable *stats) -{ -QEMU_CHECK_MONITOR(mon); - -return qemuMonitorJSONBlockStatsUpdateCapacity(mon, stats); -} - - int qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, GHashTable *stats) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 24a33b9b29..6e657576ae 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -681,10 +681,6 @@ int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, GHashTable **ret_stats) ATTRIBUTE_NONNULL(2); -int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, -GHashTable *stats) -ATTRIBUTE_NONNULL(2); - int qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, GHashTable *stats) ATTRIBUTE_NONNULL(2); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 85a36ff68b..b4a33184bd 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2497,65 +2497,6 @@ qemuMonitorJSONBlockStatsUpdateCapacityData(virJSONValue *image, } -static int -qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONValue *image, - const char *dev_name, - int depth, - GHashTable *stats) -{ -g_autofree char *entry_name = qemuDomainStorageAlias(dev_name, depth); -virJSONValue *backing; - -if (qemuMonitorJSONBlockStatsUpdateCapacityData(image, entry_name, -stats, NULL) < 0) -return -1; - -if ((backing = virJSONValueObjectGetObject(image, "backing-image")) && -qemuMonitorJSONBlockStatsUpdateCapacityOne(backing, - dev_name, - depth + 1, - stats) < 0) -return -1; - -return 0; -} - - -int -qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, -GHashTable *stats) -{ -size_t i; -g_autoptr(virJSONValue) devices = NULL; - -if (!(devices = qemuMonitorJSONQueryBlock(mon))) -return -1; - -for (i = 0; i < virJSONValueArraySize(devices); i++) { -virJSONValue *dev; -virJSONValue *inserted; -virJSONValue *image; -const char *dev_name; - -if (!(dev = qemuMonitorJSONGetBlockDev(devices, i))) -return -1; - -if (!(dev_name = qemuMonitorJSONGetBlockDevDevice(dev))) -return -1; - -/* drive may be empty */ -if (!(inserted = virJSONValueObjectGetObject(dev, "inserted")) || -!(image = virJSONValueObjectGetObject(inserted, "image"))) -continue; - -if (qemuMonitorJSONBlockStatsUpdateCapacityOne(image, dev_name, 0, stats) < 0) -return -1; -} - -return 0; -} - - static int qemuMonitorJSONBlockStatsUpdateCapacityBlockdevWorker(size_t pos G_GNUC_UNUSED, virJSONValue *val, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index c5716dfe3e..9314baa5ba 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -99,9 +99,6 @@ int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, GHashTable *hash); int -qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, -GHashTable *stats); -int qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, GHashTable *stats); -- 2.36.1
[PATCH 29/80] qemu: validate: Remove impossible validation checks
All supported qemu versions now work with blockdev. Signed-off-by: Peter Krempa --- src/qemu/qemu_validate.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index b949e1aa42..4ce920152f 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -609,13 +609,6 @@ qemuValidateDomainDefNvram(const virDomainDef *def, if (!src) return 0; -if (def->os.loader->newStyleNVRAM && -!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("modern nvram specification is not supported by this qemu")); -return -1; -} - switch (src->type) { case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_BLOCK: @@ -3182,13 +3175,6 @@ qemuValidateDomainDeviceDefDiskTransient(const virDomainDiskDef *disk, return -1; } -if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("transient disk not supported by this QEMU binary (%s)"), - disk->dst); -return -1; -} - if (disk->transientShareBacking == VIR_TRISTATE_BOOL_YES) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SET_ACTION) && !qemuProcessRebootAllowed(def)) { -- 2.36.1
[PATCH 66/80] qemu: command: Generate -drive for SD cards via JSON props
Since we know we have a modern qemu at hand which can interpret the dotted syntax, we can format the -drive needed for SD cards via the common infrastructure we have for all blockdev stuff. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 121 +++- 1 file changed, 20 insertions(+), 101 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index aec9e7415f..9fc3d91a42 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1789,44 +1789,6 @@ qemuDiskBusIsSD(int bus) } -/** - * qemuDiskSourceNeedsProps: - * @src: disk source - * - * Returns true, if the disk source needs to be generated from the JSON - * representation. Otherwise, the disk source should be represented using - * the legacy representation. - */ -static bool -qemuDiskSourceNeedsProps(virStorageSource *src) -{ -virStorageType actualType = virStorageSourceGetActualType(src); - -if (actualType == VIR_STORAGE_TYPE_NETWORK && -src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER && -src->nhosts > 1) -return true; - -if (actualType == VIR_STORAGE_TYPE_NETWORK && -src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS) -return true; - -if (actualType == VIR_STORAGE_TYPE_NETWORK && -src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI) -return true; - -if (actualType == VIR_STORAGE_TYPE_NETWORK && -src->protocol == VIR_STORAGE_NET_PROTOCOL_NBD && -src->haveTLS == VIR_TRISTATE_BOOL_YES) -return true; - -if (actualType == VIR_STORAGE_TYPE_NVME) -return true; - -return false; -} - - /** * qemuDiskSourceGetProps: * @src: disk source struct @@ -1851,73 +1813,24 @@ qemuDiskSourceGetProps(virStorageSource *src) } -static int -qemuBuildDriveSourcePR(virBuffer *buf, - virDomainDiskDef *disk) -{ -g_autofree char *alias = NULL; -const char *defaultAlias = NULL; - -if (!disk->src->pr) -return 0; - -if (virStoragePRDefIsManaged(disk->src->pr)) -defaultAlias = qemuDomainGetManagedPRAlias(); -else if (!(alias = qemuDomainGetUnmanagedPRAlias(disk->info.alias))) -return -1; - - -virBufferAsprintf(buf, ",file.pr-manager=%s", alias ? alias : defaultAlias); -return 0; -} - - static int qemuBuildDriveSourceStr(virDomainDiskDef *disk, virBuffer *buf) { virStorageType actualType = virStorageSourceGetActualType(disk->src); qemuDomainStorageSourcePrivate *srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src); -qemuDomainSecretInfo *secinfo = NULL; qemuDomainSecretInfo *encinfo = NULL; g_autoptr(virJSONValue) srcprops = NULL; -g_autofree char *source = NULL; bool rawluks = false; -if (srcpriv) { -secinfo = srcpriv->secinfo; +if (srcpriv) encinfo = srcpriv->encinfo; -} - -if (qemuDiskSourceNeedsProps(disk->src) && -!(srcprops = qemuDiskSourceGetProps(disk->src))) -return -1; - -if (!srcprops && -qemuGetDriveSourceString(disk->src, secinfo, &source) < 0) -return -1; - -/* nothing to format if the drive is empty */ -if (!(source || srcprops) || -((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY || - disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) && - disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) { -return 0; -} -if (actualType == VIR_STORAGE_TYPE_BLOCK && -disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - disk->src->type == VIR_STORAGE_TYPE_VOLUME ? - _("tray status 'open' is invalid for block type volume") : - _("tray status 'open' is invalid for block type disk")); -return -1; -} - -if (source) { +switch (actualType) { +case VIR_STORAGE_TYPE_BLOCK: +case VIR_STORAGE_TYPE_FILE: +case VIR_STORAGE_TYPE_DIR: virBufferAddLit(buf, "file="); - -/* for now the DIR based storage is handled by the magic FAT format */ if (actualType == VIR_STORAGE_TYPE_DIR) { virBufferAddLit(buf, "fat:"); @@ -1925,21 +1838,27 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, virBufferAddLit(buf, "floppy:"); } -virQEMUBuildBufferEscapeComma(buf, source); - -if (secinfo) -virBufferAsprintf(buf, ",file.password-secret=%s", secinfo->alias); - -if (disk->src->debug) -virBufferAsprintf(buf, ",file.debug=%d", disk->src->debugLevel); +virQEMUBuildBufferEscapeComma(buf, disk->src->path); +break; -if (qemuBuildDriveSourcePR(buf, disk) < 0) +case VIR_STORAGE_TYPE_NETWORK: +if (!(srcprops = qemuDiskSourceGetProps(disk->src))) return -1; -} else { + if (virQEMUBuildCommandLineJSON(srcprops, buf, NULL,
[PATCH 51/80] qemu: Remove pre-blockdev PFLASH setup
Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 60 +++-- src/qemu/qemu_domain.c | 5 +--- 2 files changed, 10 insertions(+), 55 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5c90138c73..ed718eb81b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7045,8 +7045,7 @@ qemuBuildMachineCommandLine(virCommand *cmd, } } -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) && -virDomainDefHasOldStyleUEFI(def)) { +if (virDomainDefHasOldStyleUEFI(def)) { if (priv->pflash0) virBufferAsprintf(&buf, ",pflash0=%s", priv->pflash0->nodeformat); if (def->os.loader->nvram) @@ -9364,53 +9363,10 @@ qemuBuildRedirdevCommandLine(virCommand *cmd, } -static void -qemuBuildDomainLoaderPflashCommandLine(virCommand *cmd, - virDomainLoaderDef *loader, - virQEMUCaps *qemuCaps) -{ -g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; -int unit = 0; - -if (loader->secure == VIR_TRISTATE_BOOL_YES) { -virCommandAddArgList(cmd, - "-global", - "driver=cfi.pflash01,property=secure,value=on", - NULL); -} - -/* with blockdev we instantiate the pflash when formatting -machine */ -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) -return; - -virBufferAddLit(&buf, "file="); -virQEMUBuildBufferEscapeComma(&buf, loader->path); -virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit); -unit++; - -if (loader->readonly) { -virBufferAsprintf(&buf, ",readonly=%s", - virTristateSwitchTypeToString(loader->readonly)); -} - -virCommandAddArg(cmd, "-drive"); -virCommandAddArgBuffer(cmd, &buf); - -if (loader->nvram) { -virBufferAddLit(&buf, "file="); -virQEMUBuildBufferEscapeComma(&buf, loader->nvram->path); -virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit); - -virCommandAddArg(cmd, "-drive"); -virCommandAddArgBuffer(cmd, &buf); -} -} - static void qemuBuildDomainLoaderCommandLine(virCommand *cmd, - virDomainDef *def, - virQEMUCaps *qemuCaps) + virDomainDef *def) { virDomainLoaderDef *loader = def->os.loader; @@ -9424,7 +9380,12 @@ qemuBuildDomainLoaderCommandLine(virCommand *cmd, break; case VIR_DOMAIN_LOADER_TYPE_PFLASH: -qemuBuildDomainLoaderPflashCommandLine(cmd, loader, qemuCaps); +if (loader->secure == VIR_TRISTATE_BOOL_YES) { +virCommandAddArgList(cmd, + "-global", + "driver=cfi.pflash01,property=secure,value=on", + NULL); +} break; case VIR_DOMAIN_LOADER_TYPE_NONE: @@ -9859,9 +9820,6 @@ qemuBuildPflashBlockdevCommandLine(virCommand *cmd, if (!virDomainDefHasOldStyleUEFI(vm->def)) return 0; -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -return 0; - if (priv->pflash0 && qemuBuildPflashBlockdevOne(cmd, priv->pflash0, priv->qemuCaps) < 0) return -1; @@ -10267,7 +10225,7 @@ qemuBuildCommandLine(virDomainObj *vm, if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0) return NULL; -qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps); +qemuBuildDomainLoaderCommandLine(cmd, def); if (qemuBuildMemCommandLine(cmd, def, qemuCaps, priv) < 0) return NULL; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7403b2584b..8b55dd0361 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11305,7 +11305,7 @@ qemuDomainSupportsCheckpointsBlockjobs(virDomainObj *vm) * qemuDomainInitializePflashStorageSource: * * This helper converts the specification of the source of the 'loader' in case - * PFLASH is required to virStorageSources in case QEMU_CAPS_BLOCKDEV is present. + * PFLASH is required to virStorageSources. * * This helper is used in the intermediate state when we don't support full * backing chains for pflash drives in the XML. @@ -11323,9 +11323,6 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm, virDomainDef *def = vm->def; g_autoptr(virStorageSource) pflash0 = NULL; -if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) -return 0; - if (!virDomainDefHasOldStyleUEFI(def)) return 0; -- 2.36.1
[PATCH 37/80] qemu: alias: Remove check for QEMU_CAPS_BLOCKDEV
The only instance in this file can be simplified to avoid checking the capability. Signed-off-by: Peter Krempa --- src/qemu/qemu_alias.c | 10 -- src/qemu/qemu_alias.h | 5 ++--- src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_process.c | 2 +- tests/qemuhotplugtest.c | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 7b91fe3141..835401dc07 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -192,8 +192,7 @@ qemuAssignDeviceControllerAlias(virDomainDef *domainDef, int qemuAssignDeviceDiskAlias(virDomainDef *def, - virDomainDiskDef *disk, - virQEMUCaps *qemuCaps) + virDomainDiskDef *disk) { qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); const char *prefix = virDomainDiskBusTypeToString(disk->bus); @@ -231,8 +230,7 @@ qemuAssignDeviceDiskAlias(virDomainDef *def, * on the alias in qemu. While certain disk types use just the alias, some * need the full path into /machine/peripheral as a historical artifact. */ -if (!diskPriv->qomName && -virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { +if (!diskPriv->qomName) { switch ((virDomainDiskBus) disk->bus) { case VIR_DOMAIN_DISK_BUS_FDC: case VIR_DOMAIN_DISK_BUS_IDE: @@ -606,12 +604,12 @@ qemuAssignDeviceIOMMUAlias(virDomainIOMMUDef *iommu) int -qemuAssignDeviceAliases(virDomainDef *def, virQEMUCaps *qemuCaps) +qemuAssignDeviceAliases(virDomainDef *def) { size_t i; for (i = 0; i < def->ndisks; i++) { -if (qemuAssignDeviceDiskAlias(def, def->disks[i], qemuCaps) < 0) +if (qemuAssignDeviceDiskAlias(def, def->disks[i]) < 0) return -1; } for (i = 0; i < def->nnets; i++) { diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h index 1a583b8207..6433ae4cec 100644 --- a/src/qemu/qemu_alias.h +++ b/src/qemu/qemu_alias.h @@ -33,8 +33,7 @@ void qemuAssignDeviceControllerAlias(virDomainDef *domainDef, virDomainControllerDef *controller); int qemuAssignDeviceDiskAlias(virDomainDef *def, - virDomainDiskDef *disk, - virQEMUCaps *qemuCaps); + virDomainDiskDef *disk); void qemuAssignDeviceHostdevAlias(virDomainDef *def, char **alias, @@ -71,7 +70,7 @@ void qemuAssignDeviceInputAlias(virDomainDef *def, void qemuAssignDeviceVsockAlias(virDomainVsockDef *vsock); -int qemuAssignDeviceAliases(virDomainDef *def, virQEMUCaps *qemuCaps); +int qemuAssignDeviceAliases(virDomainDef *def); int qemuDomainDeviceAliasIndex(const virDomainDeviceInfo *info, const char *prefix); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 5eb370c3df..28e4284e62 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1081,7 +1081,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver, releaseSeclabel = true; -if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) +if (qemuAssignDeviceDiskAlias(vm->def, disk) < 0) goto cleanup; if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6083ee10d8..f13664c7f2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6629,7 +6629,7 @@ qemuProcessPrepareDomain(virQEMUDriver *driver, return -1; } -if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0) +if (qemuAssignDeviceAliases(vm->def) < 0) return -1; qemuProcessPrepareDeviceBootorder(vm->def); diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 3c9dac241a..c938c8dc4c 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -107,7 +107,7 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, return -1; } -if (qemuAssignDeviceAliases((*vm)->def, priv->qemuCaps) < 0) +if (qemuAssignDeviceAliases((*vm)->def) < 0) return -1; (*vm)->def->id = QEMU_HOTPLUG_TEST_DOMAIN_ID; -- 2.36.1
[PATCH 70/80] qemuDomainDiskBlockJobIsSupported: Assume QEMU_CAPS_BLOCKDEV is supported
Signed-off-by: Peter Krempa --- src/qemu/qemu_backup.c | 2 +- src/qemu/qemu_checkpoint.c | 2 +- src/qemu/qemu_domain.c | 10 +++--- src/qemu/qemu_domain.h | 3 +-- src/qemu/qemu_driver.c | 6 +++--- src/qemu/qemu_snapshot.c | 13 + 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index b90185a375..60cb79d70d 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -260,7 +260,7 @@ qemuBackupDiskPrepareDataOne(virDomainObj *vm, return -1; } -if (!qemuDomainDiskBlockJobIsSupported(vm, dd->domdisk)) +if (!qemuDomainDiskBlockJobIsSupported(dd->domdisk)) return -1; if (dd->store->format == VIR_STORAGE_FILE_NONE) { diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 933ea41023..98e1a94def 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -372,7 +372,7 @@ qemuCheckpointPrepare(virQEMUDriver *driver, return -1; } -if (!qemuDomainDiskBlockJobIsSupported(vm, vm->def->disks[i])) +if (!qemuDomainDiskBlockJobIsSupported(vm->def->disks[i])) return -1; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fb29135179..8999f58d20 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11349,19 +11349,15 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm, /** * qemuDomainDiskBlockJobIsSupported: * - * Returns true if block jobs are supported on @disk by @vm or false and reports + * Returns true if block jobs are supported on @disk orfalse and reports * an error otherwise. * * Note that this does not verify whether other block jobs are running etc. */ bool -qemuDomainDiskBlockJobIsSupported(virDomainObj *vm, - virDomainDiskDef *disk) +qemuDomainDiskBlockJobIsSupported(virDomainDiskDef *disk) { -qemuDomainObjPrivate *priv = vm->privateData; - -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -qemuDiskBusIsSD(disk->bus)) { +if (qemuDiskBusIsSD(disk->bus)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("block jobs are not supported on disk '%s' using bus 'sd'"), disk->dst); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 66188ed003..b674d49207 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1054,8 +1054,7 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm, virQEMUDriverConfig *cfg); bool -qemuDomainDiskBlockJobIsSupported(virDomainObj *vm, - virDomainDiskDef *disk); +qemuDomainDiskBlockJobIsSupported(virDomainDiskDef *disk); int qemuDomainDefNumaCPUsRectify(virDomainDef *def, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1ecc9a71b3..4c3e12966a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14482,7 +14482,7 @@ qemuDomainBlockPullCommon(virDomainObj *vm, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; -if (!qemuDomainDiskBlockJobIsSupported(vm, disk)) +if (!qemuDomainDiskBlockJobIsSupported(disk)) goto endjob; if (base && @@ -15015,7 +15015,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; -if (!qemuDomainDiskBlockJobIsSupported(vm, disk)) +if (!qemuDomainDiskBlockJobIsSupported(disk)) goto endjob; if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN && @@ -15484,7 +15484,7 @@ qemuDomainBlockCommit(virDomainPtr dom, if (!(disk = qemuDomainDiskByName(vm->def, path))) goto endjob; -if (!qemuDomainDiskBlockJobIsSupported(vm, disk)) +if (!qemuDomainDiskBlockJobIsSupported(disk)) goto endjob; if (virStorageSourceIsEmpty(disk->src)) { diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index b96ef7a50b..f52f705cb1 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -447,8 +447,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDef *snapdisk, static int -qemuSnapshotPrepareDiskExternalActive(virDomainObj *vm, - virDomainSnapshotDiskDef *snapdisk, +qemuSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDef *snapdisk, virDomainDiskDef *domdisk) { virStorageType actualType = virStorageSourceGetActualType(snapdisk->src); @@ -463,7 +462,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainObj *vm, return -1; } -if (!qemuDomainDiskBlockJobIsSupported(vm, domdisk)) +if (!qemuDomainDiskBlockJobIsSupported(domdisk)) return -1; switch (actualType) { @@ -492,8 +491,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainObj *vm, static int -qemuSnapshotPrepareDiskExternal(virDomainObj *vm, -
[PATCH 71/80] qemuDomainDiskGetBackendAlias: Assume QEMU_CAPS_BLOCKDEV is supported
Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_domain.c | 11 --- src/qemu/qemu_domain.h | 4 +--- src/qemu/qemu_hotplug.c | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a8c954edf6..afdf79ff55 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1935,7 +1935,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) { chardev = qemuDomainGetVhostUserChrAlias(disk->info.alias); } else { -if (qemuDomainDiskGetBackendAlias(disk, qemuCaps, &drive) < 0) +if (qemuDomainDiskGetBackendAlias(disk, &drive) < 0) return NULL; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8999f58d20..8997041b34 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7802,7 +7802,8 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, * Returns the pointer to the node-name of the topmost layer used by @disk as * backend. Currently returns the nodename of the copy-on-read filter if enabled * or the nodename of the top image's format driver. Empty disks return NULL. - * This must be used only when VIR_QEMU_CAPS_BLOCKDEV is enabled. + * This must be used only with disks instantiated via -blockdev (thus not + * for SD cards). */ const char * qemuDomainDiskGetTopNodename(virDomainDiskDef *disk) @@ -7822,7 +7823,6 @@ qemuDomainDiskGetTopNodename(virDomainDiskDef *disk) /** * qemuDomainDiskGetBackendAlias: * @disk: disk definition - * @qemuCaps: emulator capabilities * @backendAlias: filled with the alias of the disk storage backend * * Returns the correct alias for the disk backend. This may be the alias of @@ -7835,13 +7835,11 @@ qemuDomainDiskGetTopNodename(virDomainDiskDef *disk) */ int qemuDomainDiskGetBackendAlias(virDomainDiskDef *disk, - virQEMUCaps *qemuCaps, char **backendAlias) { *backendAlias = NULL; -if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) || -qemuDiskBusIsSD(disk->bus)) { +if (qemuDiskBusIsSD(disk->bus)) { if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk))) return -1; @@ -10961,8 +10959,7 @@ qemuDomainPrepareDiskSource(virDomainDiskDef *disk, disk->src->format = VIR_STORAGE_FILE_RAW; } -if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && -!qemuDiskBusIsSD(disk->bus)) { +if (!qemuDiskBusIsSD(disk->bus)) { if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0) return -1; } else { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index b674d49207..7dc720dcb8 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -734,10 +734,8 @@ qemuDomainDiskGetTopNodename(virDomainDiskDef *disk) ATTRIBUTE_NONNULL(1); int qemuDomainDiskGetBackendAlias(virDomainDiskDef *disk, - virQEMUCaps *qemuCaps, char **backendAlias) -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) -ATTRIBUTE_NONNULL(3) G_GNUC_WARN_UNUSED_RESULT; +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; int qemuDomainStorageSourceChainAccessAllow(virQEMUDriver *driver, virDomainObj *vm, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a752702fc4..afc9d299f5 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -480,7 +480,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver, if (!(newbackend = qemuBuildStorageSourceChainAttachPrepareBlockdev(newsrc))) return -1; -if (qemuDomainDiskGetBackendAlias(disk, priv->qemuCaps, &nodename) < 0) +if (qemuDomainDiskGetBackendAlias(disk, &nodename) < 0) return -1; } -- 2.36.1
[PATCH 60/80] qemu: hotplug: Remove pre-blockdev code paths
Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 20 +++- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3c35a115e3..d7f10d8277 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -656,7 +656,6 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, g_autoptr(qemuBlockStorageSourceChainData) data = NULL; qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(virJSONValue) devprops = NULL; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); bool extensionDeviceAttached = false; int rc; g_autoptr(qemuSnapshotDiskContext) transientDiskSnapshotCtxt = NULL; @@ -668,7 +667,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) { if (!(data = qemuBuildStorageSourceChainAttachPrepareChardev(disk))) return -1; -} else if (blockdev) { +} else { if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(disk->src))) return -1; @@ -678,10 +677,6 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, data->copyOnReadNodename = g_strdup(QEMU_DOMAIN_DISK_PRIVATE(disk)->nodeCopyOnRead); } - -} else { -if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk))) -return -1; } disk->src->readonly = origReadonly; @@ -733,7 +728,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, * As there isn't anything sane to do if this fails, let's just return * success. */ -if (blockdev && rc == 0 && +if (rc == 0 && qemuDiskConfigBlkdeviotuneEnabled(disk)) { qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->qomName, @@ -4287,7 +4282,6 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, g_autoptr(qemuBlockStorageSourceChainData) diskBackend = NULL; size_t i; qemuDomainObjPrivate *priv = vm->privateData; -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); int ret = -1; VIR_DEBUG("Removing disk %s from domain %p %s", @@ -4299,7 +4293,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, if (!(diskBackend = qemuBlockStorageSourceChainDetachPrepareChardev(chardevAlias))) goto cleanup; -} else if (blockdev) { +} else { if (diskPriv->blockjob) { /* the block job keeps reference to the disk chain */ diskPriv->blockjob->disk = NULL; @@ -4315,14 +4309,6 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, diskBackend->copyOnReadNodename = g_strdup(diskPriv->nodeCopyOnRead); diskBackend->copyOnReadAttached = true; } -} else { -char *driveAlias; - -if (!(driveAlias = qemuAliasDiskDriveFromDisk(disk))) -goto cleanup; - -if (!(diskBackend = qemuBlockStorageSourceChainDetachPrepareDrive(disk->src, driveAlias))) -goto cleanup; } for (i = 0; i < vm->def->ndisks; i++) { -- 2.36.1
[PATCH 38/80] qemuDomainGetStatsBlock: Remove pre-blockdev code paths
This function and it's callees were a bit more entangled so remove the pre-blockdev code separately. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 80 +++--- 1 file changed, 12 insertions(+), 68 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e7b0acd46f..811b4a610c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18245,42 +18245,6 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriver *driver, } -/** - * qemuDomainGetStatsOneBlockRefreshNamed: - * @src: disk source structure - * @alias: disk alias - * @stats: hash table containing stats for all disks - * @nodedata: reply containing 'query-named-block-nodes' data - * - * Refresh disk block stats data (qemuBlockStats *) which are present only - * in the reply of 'query-named-block-nodes' in cases when the data was gathered - * by using query-block originally. - */ -static void -qemuDomainGetStatsOneBlockRefreshNamed(virStorageSource *src, - const char *alias, - GHashTable *stats, - GHashTable *nodedata) -{ -qemuBlockStats *entry; - -virJSONValue *data; -unsigned long long tmp; - -if (!nodedata || !src->nodestorage) -return; - -if (!(entry = virHashLookup(stats, alias))) -return; - -if (!(data = virHashLookup(nodedata, src->nodestorage))) -return; - -if (virJSONValueObjectGetNumberUlong(data, "write_threshold", &tmp) == 0) -entry->write_threshold = tmp; -} - - static int qemuDomainGetStatsOneBlock(virQEMUDriver *driver, virQEMUDriverConfig *cfg, @@ -18403,20 +18367,15 @@ qemuDomainGetStatsBlockExportHeader(virDomainDiskDef *disk, static int qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk, GHashTable *stats, - GHashTable *nodestats, virTypedParamList *params, size_t *recordnr, bool visitBacking, virQEMUDriver *driver, virQEMUDriverConfig *cfg, - virDomainObj *dom, - bool blockdev) + virDomainObj *dom) { virStorageSource *n; -const char *frontendalias; -const char *backendalias; -const char *backendstoragealias; /* * This helps to keep logs clean from error messages on getting stats @@ -18452,9 +18411,10 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk, for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { g_autofree char *alias = NULL; +const char *frontendalias; +const char *backendalias; +const char *backendstoragealias; -/* for 'sd' disks we won't be displaying stats for the backing chain - * as we don't update the stats correctly */ if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { frontendalias = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; backendalias = n->nodeformat; @@ -18465,7 +18425,8 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk, !(alias = qemuDomainStorageAlias(disk->info.alias, n->id))) return -1; -qemuDomainGetStatsOneBlockRefreshNamed(n, alias, stats, nodestats); +/* for 'sd' disks we won't be displaying stats for the backing chain + * as we don't update the stats correctly */ frontendalias = alias; backendalias = alias; @@ -18501,7 +18462,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk, /* in blockdev mode where we can properly and uniquely identify images we * can also report stats for the mirror target or the scratch image or target * of a backup operation */ -if (visitBacking && blockdev) { +if (visitBacking) { qemuDomainObjPrivate *priv = dom->privateData; if (disk->mirror && @@ -18571,13 +18532,8 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, size_t i; int rc; g_autoptr(GHashTable) stats = NULL; -g_autoptr(GHashTable) nodestats = NULL; -g_autoptr(virJSONValue) nodedata = NULL; qemuDomainObjPrivate *priv = dom->privateData; g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); -bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); -bool fetchnodedata = virQEMUCapsGet(priv->qemuCaps, -QEMU_CAPS_QUERY_NAMED_BLOCK_NODES) && !blockdev; int count_index = -1; size_t visited = 0; bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING); @@ -18587,27 +18543,16 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, rc = qemuMonitorGetAllBlockStatsI