1. 24 4月, 2015 3 次提交
  2. 21 4月, 2015 1 次提交
    • C
      domain: conf: Drop expectedVirtTypes · 835cf84b
      Cole Robinson 提交于
      This needs to specified in way too many places for a simple validation
      check. The ostype/arch/virttype validation checks later in
      DomainDefParseXML should catch most of the cases that this was covering.
      835cf84b
  3. 14 4月, 2015 1 次提交
  4. 09 4月, 2015 3 次提交
  5. 08 4月, 2015 2 次提交
    • M
      qemu: fix crash in qemuProcessAutoDestroy · 7578cc17
      Michael Chapman 提交于
      The destination libvirt daemon in a migration may segfault if the client
      disconnects immediately after the migration has begun:
      
        # virsh -c qemu+tls://remote/system list --all
         Id    Name                           State
        ----------------------------------------------------
        ...
      
        # timeout --signal KILL 1 \
            virsh migrate example qemu+tls://remote/system \
              --verbose --compressed --live --auto-converge \
              --abort-on-error --unsafe --persistent \
              --undefinesource --copy-storage-all --xml example.xml
        Killed
      
        # virsh -c qemu+tls://remote/system list --all
        error: failed to connect to the hypervisor
        error: unable to connect to server at 'remote:16514': Connection refused
      
      The crash is in:
      
         1531 void
         1532 qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
         1533 {
         1534     qemuDomainObjPrivatePtr priv = obj->privateData;
         1535     qemuDomainJob job = priv->job.active;
         1536
         1537     priv->jobs_queued--;
      
      Backtrace:
      
        #0  at qemuDomainObjEndJob at qemu/qemu_domain.c:1537
        #1  in qemuDomainRemoveInactive at qemu/qemu_domain.c:2497
        #2  in qemuProcessAutoDestroy at qemu/qemu_process.c:5646
        #3  in virCloseCallbacksRun at util/virclosecallbacks.c:350
        #4  in qemuConnectClose at qemu/qemu_driver.c:1154
        ...
      
      qemuDomainRemoveInactive calls virDomainObjListRemove, which in this
      case is holding the last remaining reference to the domain.
      qemuDomainRemoveInactive then calls qemuDomainObjEndJob, but the domain
      object has been freed and poisoned by then.
      
      This patch bumps the domain's refcount until qemuDomainRemoveInactive
      has completed. We also ensure qemuProcessAutoDestroy does not return the
      domain to virCloseCallbacksRun to be unlocked in this case. There is
      similar logic in bhyveProcessAutoDestroy and lxcProcessAutoDestroy
      (which call virDomainObjListRemove directly).
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      7578cc17
    • M
      virQEMUDriverGetConfig: Fix memleak · 225aa802
      Michal Privoznik 提交于
      ==19015== 968 (416 direct, 552 indirect) bytes in 1 blocks are definitely lost in loss record 999 of 1,049
      ==19015==    at 0x4C2C070: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==19015==    by 0x52ADF14: virAllocVar (viralloc.c:560)
      ==19015==    by 0x5302FD1: virObjectNew (virobject.c:193)
      ==19015==    by 0x1DD9401E: virQEMUDriverConfigNew (qemu_conf.c:164)
      ==19015==    by 0x1DDDF65D: qemuStateInitialize (qemu_driver.c:666)
      ==19015==    by 0x53E0823: virStateInitialize (libvirt.c:777)
      ==19015==    by 0x11E067: daemonRunStateInit (libvirtd.c:905)
      ==19015==    by 0x53201AD: virThreadHelper (virthread.c:206)
      ==19015==    by 0xA1EE1F2: start_thread (in /lib64/libpthread-2.19.so)
      ==19015==    by 0xA4EFC8C: clone (in /lib64/libc-2.19.so)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      225aa802
  6. 02 4月, 2015 2 次提交
  7. 25 3月, 2015 4 次提交
  8. 23 3月, 2015 6 次提交
  9. 19 3月, 2015 1 次提交
  10. 16 3月, 2015 2 次提交
  11. 02 3月, 2015 3 次提交
  12. 24 2月, 2015 2 次提交
  13. 19 1月, 2015 1 次提交
  14. 15 1月, 2015 1 次提交
    • J
      Check for domain liveness in qemuDomainObjExitMonitor · dc2fd51f
      Ján Tomko 提交于
      The domain might disappear during the time in monitor when
      the virDomainObjPtr is unlocked, so the caller needs to check
      if it's still alive.
      
      Since most of the callers are going to need it, put the
      check inside qemuDomainObjExitMonitor and return -1 if
      the domain died in the meantime.
      dc2fd51f
  15. 14 1月, 2015 1 次提交
    • D
      Give virDomainDef parser & formatter their own flags · 0ecd6851
      Daniel P. Berrange 提交于
      The virDomainDefParse* and virDomainDefFormat* methods both
      accept the VIR_DOMAIN_XML_* flags defined in the public API,
      along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags
      defined in domain_conf.c.
      
      This is seriously confusing & error prone for a number of
      reasons:
      
       - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and
         VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the
         formatting operation
       - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply
         to parse or to format, but not both.
      
      This patch cleanly separates out the flags. There are two
      distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_*
      flags that are used by the corresponding methods. The
      VIR_DOMAIN_XML_* flags received via public API calls must
      be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where
      needed.
      
      The various calls to virDomainDefParse which hardcoded the
      use of the VIR_DOMAIN_XML_INACTIVE flag change to use the
      VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
      0ecd6851
  16. 12 1月, 2015 1 次提交
    • P
      qxl: change the default value for vgamem_mb to 16 MiB · 0e502466
      Pavel Hrdina 提交于
      The default value should be 16 MiB instead of 8 MiB. Only really old
      version of upstream QEMU used the 8 MiB as default for vga framebuffer.
      
      Without this change if you update your libvirt where we introduced the
      "vgamem" attribute for QXL video device the value will be set to 8 MiB,
      but previously your guest had 16 MiB because we didn't pass any value to
      QEMU command line which means QEMU used its own 16 MiB as default.
      
      This will affect all users with guest's display resolution higher than
      1920x1080.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      0e502466
  17. 07 1月, 2015 1 次提交
    • P
      qemu: Don't unref domain after exit from nested async job · 79bb49a8
      Peter Krempa 提交于
      In commit 540c339a the whole domain
      reference counting was refactored in the qemu driver. Domain jobs now
      don't need to reference the domain object as they now expect the
      reference from the calling function.
      
      However, the patch forgot to remove the unref call in case we exit the
      monitor when we were acquiring a nested job. This caused the daemon to
      crash on a subsequent access to the domain object once we've done an
      operation requiring a nested job for a monitor access.
      
      An easy reproducer case:
      
      1) Start a vm with qcow disks
      2) virsh snapshot-create-as DOMNAME
      3) virsh dumpxml DOMNAME
      4) daemon crashes in a semi-random spot while accessing a now-removed VM
      object.
      
      Fortunately, the commit wasn't released yet, so there are no security
      implications.
      Reported-by: NShanzi Yu <shyu@redhat.com>
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      79bb49a8
  18. 21 12月, 2014 1 次提交
    • M
      qemu: completely rework reference counting · 540c339a
      Martin Kletzander 提交于
      There is one problem that causes various errors in the daemon.  When
      domain is waiting for a job, it is unlocked while waiting on the
      condition.  However, if that domain is for example transient and being
      removed in another API (e.g. cancelling incoming migration), it get's
      unref'd.  If the first call, that was waiting, fails to get the job, it
      unref's the domain object, and because it was the last reference, it
      causes clearing of the whole domain object.  However, when finishing the
      call, the domain must be unlocked, but there is no way for the API to
      know whether it was cleaned or not (unless there is some ugly temporary
      variable, but let's scratch that).
      
      The root cause is that our APIs don't ref the objects they are using and
      all use the implicit reference that the object has when it is in the
      domain list.  That reference can be removed when the API is waiting for
      a job.  And because each domain doesn't do its ref'ing, it results in
      the ugly checking of the return value of virObjectUnref() that we have
      everywhere.
      
      This patch changes qemuDomObjFromDomain() to ref the domain (using
      virDomainObjListFindByUUIDRef()) and adds qemuDomObjEndAPI() which
      should be the only function in which the return value of
      virObjectUnref() is checked.  This makes all reference counting
      deterministic and makes the code a bit clearer.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      540c339a
  19. 17 12月, 2014 1 次提交
    • E
      getstats: perform recursion in monitor collection · b1802714
      Eric Blake 提交于
      When requested in a later patch, the QMP command results are now
      examined recursively.  As qemu_driver will eventually have to
      read items out of the hash table as stored by this patch, the
      computation of backing alias string is done in a shared location.
      
      * src/qemu/qemu_domain.h (qemuDomainStorageAlias): New prototype.
      * src/qemu/qemu_domain.c (qemuDomainStorageAlias): Implement it.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONGetOneBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacityOne): Perform recursion.
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacity): Update callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b1802714
  20. 16 12月, 2014 1 次提交
  21. 04 12月, 2014 1 次提交
    • P
      qemu: process: Refactor reconnecting to qemu processes · 3ecebf07
      Peter Krempa 提交于
      Move entering the job into the thread to simplify the program flow. Also
      as the code holds a separate reference to the domain object some
      conditions can be simplified.
      
      After this patch qemuDomainObjTransferJob is no longer needed so this
      patch removes it.
      3ecebf07
  22. 28 11月, 2014 1 次提交
    • M
      qemu: Don't track quiesced state of FSs · 6085d917
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1160084
      
      As of b6d4dad1 (1.2.5) we are trying to keep the status of FSFreeze
      in the guest. Even though I've tried to fixed couple of corner cases
      (6ea54769), it occurred to me just recently, that the approach is
      broken by design. Firstly, there are many other ways to talk to
      qemu-ga (even through libvirt) that filesystems can be thawed (e.g.
      qemu-agent-command) without libvirt noticing. Moreover, there are
      plenty of ways to thaw filesystems without even qemu-ga noticing (yes,
      qemu-ga keeps internal track of FSFreeze status). So, instead of
      keeping the track ourselves, or asking qemu-ga for stale state, it's
      the best to let qemu-ga deal with that (and possibly let guest kernel
      propagate an error).
      
      Moreover, there's one bug with the following approach, if fsfreeze
      command failed, we've executed fsthaw subsequently. So issuing
      domfsfreeze in virsh gave the following result:
      
      virsh # domfsfreeze gentoo
      Froze 1 filesystem(s)
      
      virsh # domfsfreeze gentoo
      error: Unable to freeze filesystems
      error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
      
      virsh # domfsfreeze gentoo
      Froze 1 filesystem(s)
      
      virsh # domfsfreeze gentoo
      error: Unable to freeze filesystems
      error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6085d917