1. 02 2月, 2020 2 次提交
  2. 27 1月, 2020 1 次提交
    • D
      qemu: add support for running QEMU driver in embedded mode · 068efae5
      Daniel P. Berrangé 提交于
      This enables support for running QEMU embedded to the calling
      application process using a URI:
      
         qemu:///embed?root=/some/path
      
      Note that it is important to keep the path reasonably short to
      avoid risk of hitting the limit on UNIX socket path names
      which is 108 characters.
      
      When using the embedded mode with a root=/var/tmp/embed, the
      driver will use the following paths:
      
                      logDir: /var/tmp/embed/log/qemu
                 swtpmLogDir: /var/tmp/embed/log/swtpm
               configBaseDir: /var/tmp/embed/etc/qemu
                    stateDir: /var/tmp/embed/run/qemu
               swtpmStateDir: /var/tmp/embed/run/swtpm
                    cacheDir: /var/tmp/embed/cache/qemu
                      libDir: /var/tmp/embed/lib/qemu
             swtpmStorageDir: /var/tmp/embed/lib/swtpm
       defaultTLSx509certdir: /var/tmp/embed/etc/pki/qemu
      
      These are identical whether the embedded driver is privileged
      or unprivileged.
      
      This compares with the system instance which uses
      
                      logDir: /var/log/libvirt/qemu
                 swtpmLogDir: /var/log/swtpm/libvirt/qemu
               configBaseDir: /etc/libvirt/qemu
                    stateDir: /run/libvirt/qemu
               swtpmStateDir: /run/libvirt/qemu/swtpm
                    cacheDir: /var/cache/libvirt/qemu
                      libDir: /var/lib/libvirt/qemu
             swtpmStorageDir: /var/lib/libvirt/swtpm
       defaultTLSx509certdir: /etc/pki/qemu
      
      At this time all features present in the QEMU driver are available when
      running in embedded mode, availability matching whether the embedded
      driver is privileged or unprivileged.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      068efae5
  3. 17 1月, 2020 2 次提交
  4. 16 1月, 2020 1 次提交
    • J
      qemu: Don't emit SUSPENDED_POSTCOPY event on destination · bd04d63a
      Jiri Denemark 提交于
      When pause-before-switchover QEMU capability is enabled, we get STOP
      event before MIGRATION event with postcopy-active state. To properly
      handle post-copy migration and emit correct events commit
      v4.10.0-rc1-4-geca9d21e added a hack to
      qemuProcessHandleMigrationStatus which translates the paused state
      reason to VIR_DOMAIN_PAUSED_POSTCOPY and emits
      VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY event when migration state changes
      to post-copy.
      
      However, the code was effective on both sides of migration resulting in
      a confusing VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY event on the destination
      host, where entering post-copy mode is already properly advertised by
      VIR_DOMAIN_EVENT_RESUMED_POSTCOPY event.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1791458Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      bd04d63a
  5. 07 1月, 2020 1 次提交
  6. 06 1月, 2020 2 次提交
  7. 24 12月, 2019 1 次提交
    • N
      qemu: hide details of fake reboot · 6c6d93bc
      Nikolay Shirokovskiy 提交于
      If we use fake reboot then domain goes thru running->shutdown->running
      state changes with shutdown state only for short period of time.  At
      least this is implementation details leaking into API. And also there is
      one real case when this is not convinient. I'm doing a backup with the
      help of temporary block snapshot (with the help of qemu's API which is
      used in the newly created libvirt's backup API). If guest is shutdowned
      I want to continue to backup so I don't kill the process and domain is
      in shutdown state. Later when backup is finished I want to destroy qemu
      process. So I check if it is in shutdowned state and destroy it if it
      is. Now if instead of shutdown domain got fake reboot then I can destroy
      process in the middle of fake reboot process.
      
      After shutdown event we also get stop event and now as domain state is
      running it will be transitioned to paused state and back to running
      later. Though this is not critical for the described case I guess it is
      better not to leak these details to user too. So let's leave domain in
      running state on stop event if fake reboot is in process.
      
      Reconnection code handles this patch without modification. It detects
      that qemu is not running due to shutdown and then calls qemuProcessShutdownOrReboot
      which reboots as fake reboot flag is set.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      6c6d93bc
  8. 21 12月, 2019 4 次提交
  9. 17 12月, 2019 1 次提交
  10. 12 12月, 2019 2 次提交
    • D
      Revert "qemu: directly create virResctrlInfo ignoring capabilities" · 766c8ae9
      Daniel P. Berrangé 提交于
      This reverts commit 7be5fe66.
      
      This commit broke resctrl, because it missed the fact that the
      virResctrlInfoGetCache() has side-effects causing it to actually
      change the virResctrlInfo parameter, not merely get data from
      it.
      
      This code will need some refactoring before we can try separating
      it from virCapabilities again.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      766c8ae9
    • D
      qemu: keep capabilities when running QEMU as root · 19023562
      Daniel P. Berrangé 提交于
      When QEMU uid/gid is set to non-root this is pointless as if we just
      used a regular setuid/setgid call, the process will have all its
      capabilities cleared anyway by the kernel.
      
      When QEMU uid/gid is set to root, this is almost (always?) never
      what people actually want. People make QEMU run as root in order
      to access some privileged resource that libvirt doesn't support
      yet and this often requires capabilities. As a result they have
      to go find the qemu.conf param to turn this off. This is not
      viable for libguestfs - they want to control everything via the
      XML security label to request running as root regardless of the
      qemu.conf settings for user/group.
      
      Clearing capabilities was implemented originally because there
      was a proposal in Fedora to change permissions such that root,
      with no capabilities would not be able to compromise the system.
      ie a locked down root account. This never went anywhere though,
      and as a result clearing capabilities when running as root does
      not really get us any security benefit AFAICT. The root user
      can easily do something like create a cronjob, which will then
      faithfully be run with full capabilities, trivially bypassing
      the restriction we place.
      
      IOW, our clearing of capabilities is both useless from a security
      POV, and breaks valid use cases when people need to run as root.
      
      This removes the clear_emulator_capabilities configuration
      option from qemu.conf, and always runs QEMU with capabilities
      when root.  The behaviour when non-root is unchanged.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      19023562
  11. 10 12月, 2019 1 次提交
  12. 09 12月, 2019 10 次提交
  13. 05 12月, 2019 1 次提交
  14. 03 12月, 2019 7 次提交
  15. 27 11月, 2019 1 次提交
  16. 26 11月, 2019 1 次提交
  17. 22 11月, 2019 2 次提交
    • M
      qemuProcessStop: Remove image metadata for running mirror jobs · 8fa0374c
      Michal Privoznik 提交于
      If user starts a blockcommit or a blockcopy then we modify access
      for qemu on both images and leave it like that until the job
      terminates.  So far so good. Problem is, if user instead of
      terminating the job (where we would modify the access again so
      that the state before the job is restored) calls destroy on the
      domain or if qemu dies whilst executing the block job.  In this
      case we don't ever clear the access we granted at the beginning.
      To fix this, maybe a bit harsh approach is used, but it works:
      after all labels were restored (that is after
      qemuSecurityRestoreAllLabel() was called), we iterate over each
      disk in the domain and remove XATTRs from the whole backing chain
      and also from any file the disk is being mirrored to.
      
      This would have been done at the time of pivot, but it isn't
      because user decided to kill the domain instead. If we don't do
      this and leave some XATTRs behind the domain might be unable to
      start.
      
      Also, secdriver can't do this because it doesn't know if there is
      any job running. It's outside of its scope - the hypervisor
      driver is responsible for calling secdriver's APIs.
      
      Moreover, this is safe to call because we don't remember labels
      for any member of a backing chain except of the top layer. But
      that one was restored in qemuSecurityRestoreAllLabel() call done
      earlier. Therefore, not only we don't remember labels (and thus
      this is basically a NOP for other images in the backing chain) it
      is also safe to call this when no blockjob was started in the
      first place, or if some parts of the backing chain are shared
      with some other domains - this is NOP, unless a block job is
      active at the time of domain destroy.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1741456#c19Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
      8fa0374c
    • P
      qemu: Instantiate pflash via -machine when using blockdev · 86085c9a
      Peter Krempa 提交于
      Install the convertor function which enables the internals that will use
      -blockdev to make qemu open the firmware image and stop using -drive.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      86085c9a