1. 02 6月, 2017 2 次提交
  2. 29 5月, 2017 2 次提交
  3. 23 5月, 2017 5 次提交
    • E
      shutdown: Expose bool cause in SHUTDOWN and RESET events · 08fba7ac
      Eric Blake 提交于
      Libvirt would like to be able to distinguish between a SHUTDOWN
      event triggered solely by guest request and one triggered by a
      SIGTERM or other action on the host.  While qemu_kill_report() was
      already able to give different output to stderr based on whether a
      shutdown was triggered by a host signal (but NOT by a host UI event,
      such as clicking the X on the window), that information was then
      lost to management.  The previous patches improved things to use an
      enum throughout all callsites, so now we have something ready to
      expose through QMP.
      
      Note that for now, the decision was to expose ONLY a boolean,
      rather than promoting ShutdownCause to a QAPI enum; this is because
      libvirt has not expressed an interest in anything finer-grained.
      We can still add additional details, in a backwards-compatible
      manner, if a need later arises (if the addition happens before 2.10,
      we can replace the bool with an enum; otherwise, the enum will have
      to be in addition to the bool); this patch merely adds a helper
      shutdown_caused_by_guest() to map the internal enum into the
      external boolean.
      
      Update expected iotest outputs to match the new data (complete
      coverage of the affected tests is obtained by -raw, -qcow2, and -nbd).
      
      Here is output from 'virsh qemu-monitor-event --loop' with the
      patch installed:
      
      event SHUTDOWN at 1492639680.731251 for domain fedora_13: {"guest":true}
      event STOP at 1492639680.732116 for domain fedora_13: <null>
      event SHUTDOWN at 1492639680.732830 for domain fedora_13: {"guest":false}
      
      Note that libvirt runs qemu with -no-shutdown: the first SHUTDOWN event
      was triggered by an action I took directly in the guest (shutdown -h),
      at which point qemu stops the vcpus and waits for libvirt to do any
      final cleanups; the second SHUTDOWN event is the result of libvirt
      sending SIGTERM now that it has completed cleanup.  Libvirt is already
      smart enough to only feed the first qemu SHUTDOWN event to the end user
      (remember, virsh qemu-monitor-event is a low-level debugging interface
      that is explicitly unsupported by libvirt, so it sees things that normal
      end users do not); changing qemu to emit SHUTDOWN only once is outside
      the scope of this series.
      
      See also https://bugzilla.redhat.com/1384007Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20170515214114.15442-6-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      08fba7ac
    • E
      shutdown: Add source information to SHUTDOWN and RESET · cf83f140
      Eric Blake 提交于
      Time to wire up all the call sites that request a shutdown or
      reset to use the enum added in the previous patch.
      
      It would have been less churn to keep the common case with no
      arguments as meaning guest-triggered, and only modified the
      host-triggered code paths, via a wrapper function, but then we'd
      still have to audit that I didn't miss any host-triggered spots;
      changing the signature forces us to double-check that I correctly
      categorized all callers.
      
      Since command line options can change whether a guest reset request
      causes an actual reset vs. a shutdown, it's easy to also add the
      information to reset requests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts]
      Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part]
      Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts]
      Message-Id: <20170515214114.15442-5-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cf83f140
    • E
      shutdown: Preserve shutdown cause through replay · 802f045a
      Eric Blake 提交于
      With the recent addition of ShutdownCause, we want to be able to pass
      a cause through any shutdown request, and then faithfully replay that
      cause when later replaying the same sequence.  The easiest way is to
      expand the reply event mechanism to track a series of values for
      EVENT_SHUTDOWN, one corresponding to each value of ShutdownCause.
      
      We are free to change the replay stream as needed, since there are
      already no guarantees about being able to use a replay stream by
      any other version of qemu than the one that generated it.
      
      The cause is not actually fed back until the next patch changes the
      signature for requesting a shutdown; a TODO marks that upcoming change.
      
      Yes, this uses the gcc/clang extension of a ranged case label,
      but this is not the first time we've used non-C99 constructs.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20170515214114.15442-4-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      802f045a
    • E
      shutdown: Prepare for use of an enum in reset/shutdown_request · aedbe192
      Eric Blake 提交于
      We want to track why a guest was shutdown; in particular, being able
      to tell the difference between a guest request (such as ACPI request)
      and host request (such as SIGINT) will prove useful to libvirt.
      Since all requests eventually end up changing shutdown_requested in
      vl.c, the logical change is to make that value track the reason,
      rather than its current 0/1 contents.
      
      Since command-line options control whether a reset request is turned
      into a shutdown request instead, the same treatment is given to
      reset_requested.
      
      This patch adds an internal enum ShutdownCause that describes reasons
      that a shutdown can be requested, and changes qemu_system_reset() to
      pass the reason through, although for now nothing is actually changed
      with regards to what gets reported.  The enum could be exported via
      QAPI at a later date, if deemed necessary, but for now, there has not
      been a request to expose that much detail to end clients.
      
      For the most part, we turn 0 into SHUTDOWN_CAUSE_NONE, and 1 into
      SHUTDOWN_CAUSE_HOST_ERROR; the only specific case where we have enough
      information right now to use a different value is when we are reacting
      to a host signal.  It will take a further patch to edit all call-sites
      that can trigger a reset or shutdown request to properly pass in any
      other reasons; this patch includes TODOs to point such places out.
      
      qemu_system_reset() trades its 'bool report' parameter for a
      'ShutdownCause reason', with all non-zero values having the same
      effect; this lets us get rid of the weird #defines for VMRESET_*
      as synonyms for bools.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20170515214114.15442-3-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      aedbe192
    • E
      shutdown: Simplify shutdown_signal · 7af88279
      Eric Blake 提交于
      There is no signal 0 (kill(pid, 0) has special semantics to probe whether
      a process is alive), rather than actually sending a signal 0).  So we
      can use the simpler 0, instead of -1, for our sentinel of whether a
      shutdown request due to a signal has happened.
      Suggested-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NAlistair Francis <alistair.francis@xilinx.com>
      Message-Id: <20170515214114.15442-2-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7af88279
  4. 19 5月, 2017 4 次提交
  5. 17 5月, 2017 1 次提交
  6. 12 5月, 2017 4 次提交
  7. 10 5月, 2017 1 次提交
    • C
      virtfs: allow a device id to be specified in the -virtfs option · 3baa0a6a
      Chris Webb 提交于
      When using a virtfs root filesystem, the mount_tag needs to be set to
      /dev/root. This can be done long-hand as
      
        -fsdev local,id=root,path=/path/to/rootfs,...
        -device virtio-9p-pci,fsdev=root,mount_tag=/dev/root
      
      but the -virtfs shortcut cannot be used as it hard-codes the device identifier
      to match the mount_tag, and device identifiers may not contain '/':
      
        $ qemu-system-x86_64 -virtfs local,path=/foo,mount_tag=/dev/root,security_model=passthrough
        qemu-system-x86_64: -virtfs local,path=/foo,mount_tag=/dev/root,security_model=passthrough: duplicate fsdev id: /dev/root
      
      To support this case using -virtfs, we allow the device identifier to be
      specified explicitly when the mount_tag is not suitable:
      
        -virtfs local,id=root,path=/path/to/rootfs,mount_tag=/dev/root,...
      Signed-off-by: NChris Webb <chris@arachsys.com>
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      3baa0a6a
  8. 05 5月, 2017 2 次提交
  9. 04 5月, 2017 1 次提交
  10. 27 4月, 2017 1 次提交
  11. 22 4月, 2017 1 次提交
    • P
      xen: use libxendevice model to restrict operations · 1c599472
      Paul Durrant 提交于
      This patch adds a command-line option (-xen-domid-restrict) which will
      use the new libxendevicemodel API to restrict devicemodel [1] operations
      to the specified domid. (Such operations are not applicable to the xenpv
      machine type).
      
      This patch also adds a tracepoint to allow successful enabling of the
      restriction to be monitored.
      
      [1] I.e. operations issued by libxendevicemodel. Operation issued by other
          xen libraries (e.g. libxenforeignmemory) are currently still unrestricted
          but this will be rectified by subsequent patches.
      Signed-off-by: NPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: NStefano Stabellini <sstabellini@kernel.org>
      1c599472
  12. 14 3月, 2017 1 次提交
  13. 09 3月, 2017 1 次提交
  14. 07 3月, 2017 1 次提交
    • M
      block: Initial implementation of -blockdev · 42e5f393
      Markus Armbruster 提交于
      The new command line option -blockdev works like QMP command
      blockdev-add.
      
      The option argument may be given in JSON syntax, exactly as in QMP.
      Example usage:
      
          -blockdev '{"node-name": "foo", "driver": "raw", "file": {"driver": "file", "filename": "foo.img"} }'
      
      The JSON argument doesn't exactly blend into the existing option
      syntax, so the traditional KEY=VALUE,... syntax is also supported,
      using dotted keys to do the nesting:
      
          -blockdev node-name=foo,driver=raw,file.driver=file,file.filename=foo.img
      
      This does not yet support lists, but that will be addressed shortly.
      
      Note that calling qmp_blockdev_add() (say via qmp_marshal_block_add())
      right away would crash.  We need to stash the configuration for later
      instead.  This is crudely done, and bypasses QemuOpts, even though
      storing configuration is what QemuOpts is for.  Need to revamp option
      infrastructure to support QAPI types like BlockdevOptions.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488317230-26248-22-git-send-email-armbru@redhat.com>
      42e5f393
  15. 05 3月, 2017 1 次提交
    • M
      qmp: Dumb down how we run QMP command registration · 05875687
      Markus Armbruster 提交于
      The way we get QMP commands registered is high tech:
      
      * qapi-commands.py generates qmp_init_marshal() that does the actual work
      
      * it also generates the magic to register it as a MODULE_INIT_QAPI
        function, so it runs when someone calls
        module_call_init(MODULE_INIT_QAPI)
      
      * main() calls module_call_init()
      
      QEMU needs to register a few non-qapified commands.  Same high tech
      works: monitor.c has its own qmp_init_marshal() along with the magic
      to make it run in module_call_init(MODULE_INIT_QAPI).
      
      QEMU also needs to unregister commands that are not wanted in this
      build's configuration (commit 5032a16d).  Simple enough:
      qmp_unregister_commands_hack().  The difficulty is to make it run
      after the generated qmp_init_marshal().  We can't simply run it in
      monitor.c's qmp_init_marshal(), because the order in which the
      registered functions run is indeterminate.  So qmp_init_marshal()
      registers qmp_unregister_commands_hack() separately.  Since
      registering *appends* to the list of registered functions, this will
      make it run after all the functions that have been registered already.
      
      I suspect it takes a long and expensive computer science education to
      not find this silly.
      
      Dumb it down as follows:
      
      * Drop MODULE_INIT_QAPI entirely
      
      * Give the generated qmp_init_marshal() external linkage.
      
      * Call it instead of module_call_init(MODULE_INIT_QAPI)
      
      * Except in QEMU proper, call new monitor_init_qmp_commands() that in
        turn calls the generated qmp_init_marshal(), registers the
        additional commands and unregisters the unwanted ones.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-5-git-send-email-armbru@redhat.com>
      05875687
  16. 03 3月, 2017 2 次提交
  17. 24 2月, 2017 1 次提交
  18. 22 2月, 2017 1 次提交
  19. 21 2月, 2017 2 次提交
    • M
      hw: Deprecate -drive if=scsi with non-onboard HBAs · a64aa578
      Markus Armbruster 提交于
      Block backends defined with "-drive if=T" with T other than "none" are
      meant to be picked up by machine initialization code: a suitable
      frontend gets created and wired up automatically.
      
      Drives defined with if=scsi are also picked up by SCSI HBAs added with
      -device, unlike other interface types.  Deprecate this usage, as follows.
      
      Create the frontends for onboard HBAs in machine initialization code,
      exactly like we do for if=ide and other interface types.  Change
      scsi_legacy_handle_cmdline() to create a frontend only when it's still
      missing, and warn that this usage is deprecated.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1487161136-9018-3-git-send-email-armbru@redhat.com>
      a64aa578
    • M
      hw/scsi: Concentrate -drive if=scsi auto-create in one place · fb8b660e
      Markus Armbruster 提交于
      The logic to create frontends for -drive if=scsi is in SCSI HBAs.  For
      all other interface types, it's in machine initialization code.
      
      A few machine types create the SCSI HBAs necessary for that.  That's
      also not done for other interface types.
      
      I'm going to deprecate these SCSI eccentricities.  In preparation for
      that, create the frontends in main() instead of the SCSI HBAs, by
      calling new function scsi_legacy_handle_cmdline() there.
      
      Note that not all SCSI HBAs create frontends.  Take care not to change
      that.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1487161136-9018-2-git-send-email-armbru@redhat.com>
      Acked-By: NPaolo Bonzini <pbonzini@redhat.com>
      fb8b660e
  20. 16 2月, 2017 4 次提交
  21. 01 2月, 2017 1 次提交
  22. 28 1月, 2017 1 次提交
    • M
      chardev: qom-ify · 777357d7
      Marc-André Lureau 提交于
      Turn Chardev into Object.
      
      qemu_chr_alloc() is replaced by the qemu_chardev_new() constructor. It
      will call qemu_char_open() to open/intialize the chardev with the
      ChardevCommon *backend settings.
      
      The CharDriver::create() callback is turned into a ChardevClass::open()
      which is called from the newly introduced qemu_chardev_open().
      
      "chardev-gdb" and "chardev-hci" are internal chardev and aren't
      creatable directly with -chardev. Use a new internal flag to disable
      them. We may want to use TYPE_USER_CREATABLE interface instead, or
      perhaps allow -chardev usage.
      
      Although in general we keep typename and macros private, unless the type
      is being used by some other file, in this patch, all types and common
      helper macros for qemu-char.c are in char.h. This is to help transition
      now (some types must be declared early, while some aren't shared) and
      when splitting in several units. This is to be improved later.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      777357d7