1. 27 8月, 2014 1 次提交
    • D
      Don't include @libs@ in libvirt.pc.in file · 76ad3133
      Daniel P. Berrange 提交于
      The libvirt.pc file we install is ending up polluted with a
      load of compiler flags that should be private to the libvirt
      build. eg
      
      Libs: -L${libdir} -lvirt -ldl -O2 -g -pipe -Wall \
            -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
            -fstack-protector-strong --param=ssp-buffer-size=4 \
            -grecord-gcc-switches  -m64 -mtune=generic
      
      this is caused by including @libs@ in the Libs: line of the
      pkgconfig.pc.in file.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 1167751f)
      76ad3133
  2. 03 7月, 2014 2 次提交
    • P
      qemu: copy: Accept 'format' parameter when copying to a non-existing img · e7ee7542
      Peter Krempa 提交于
      We have the following matrix of possible arguments handled by the logic
      statement touched by this patch:
             | flags & _REUSE_EXT | !(flags & _REUSE_EXT)
      -------+--------------------+----------------------
       format| (1)                | (2)
      -------+--------------------+----------------------
      !format| (3)                | (4)
      -------+--------------------+----------------------
      
      In cases 1 and 2 the user provided a format, in cases 3 and 4 not. The
      user requests to use a pre-existing image in 1 and 3 and libvirt will
      create a new image in 2 and 4.
      
      The difference between cases 3 and 4 is that for 3 the format is probed
      from the user-provided image, whereas in 4 we just use the existing disk
      format.
      
      The current code would treat cases 1,3 and 4 correctly but in case 2 the
      format provided by the user would be ignored.
      
      The particular piece of code was broken in commit 35c7701c
      but since it was introduced a few commits before that it was never
      released as working.
      
      (cherry picked from commit 42619ed0)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      
      Conflicts:
      	src/qemu/qemu_driver.c - no refactoring of commits 7b7bf001, 4f202266
      e7ee7542
    • E
      build: fix 'make check' with newer git · 1fae811a
      Eric Blake 提交于
      Newer git doesn't like the maint.mk rule 'public-submodule-commit'
      run during 'make check', as inherited from our checkout of gnulib.
      I tracked down that libvirt commit 8531301d picked up a gnulib fix
      that makes git happy.  Rather than try and do a full .gnulib
      submodule update to gnulib.git d18d1b802 (as used in that libvirt
      commit), it was easier to just backport the fixed maint.mk from
      gnulib on top of our existing submodule level.  I did it as follows,
      where these steps will have to be repeated when cherry-picking this
      commit to any other maintenance branch:
      
      mkdir -p gnulib/local/top
      cd .gnulib
      git checkout d18d1b802 top/maint.mk
      git diff HEAD > ../gnulib/local/top/maint.mk.diff
      git reset --hard
      cd ..
      git add gnulib/local/top
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1fae811a
  3. 27 6月, 2014 2 次提交
    • E
      docs: publish correct enum values · 4f634078
      Eric Blake 提交于
      We publish libvirt-api.xml for others to use, and in fact, the
      libvirt-python bindings use it to generate python constants that
      correspond to our enum values.  However, we had an off-by-one bug
      that any enum that relied on C's rules for implicit initialization
      of the first enum member to 0 got listed in the xml as having a
      value of 1 (and all later members of the enum were equally
      botched).
      
      The fix is simple - since we add one to the previous value when
      encountering an enum without an initializer, the previous value
      must start at -1 so that the first enum member is assigned 0.
      
      The python generator code has had the off-by-one ever since DV
      first wrote it years ago, but most of our public enums were immune
      because they had an explicit = 0 initializer.  The only affected
      enums are:
      - virDomainEventGraphicsAddressType (such as
      VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4), since commit 987e31ed
      (libvirt v0.8.0)
      - virDomainCoreDumpFormat (such as VIR_DOMAIN_CORE_DUMP_FORMAT_RAW),
      since commit 9fbaff00 (libvirt v1.2.3)
      - virIPAddrType (such as VIR_IP_ADDR_TYPE_IPV4), since commit
      03e0e79e (not yet released)
      
      Thanks to Nehal J Wani for reporting the problem on IRC, and
      for helping me zero in on the culprit function.
      
      * docs/apibuild.py (CParser.parseEnumBlock): Fix implicit enum
      values.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 9b291bbe)
      4f634078
    • P
      qemu: blockcopy: Don't remove existing disk mirror info · ea1d4666
      Peter Krempa 提交于
      When creating a new disk mirror the new struct is stored in a separate
      variable until everything went well. The removed hunk would actually
      remove existing mirror information for example when the api would be run
      if a mirror still exists.
      
      (cherry picked from commit 02b364e1)
      
      This fixes a regression introduced in commit ff5f30b6.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      
      Conflicts:
      	src/qemu/qemu_driver.c - no refactoring of commits 7b7bf001, 4f202266
      ea1d4666
  4. 06 5月, 2014 1 次提交
  5. 05 5月, 2014 1 次提交
    • J
      libxl: fix framebuffer port setting for HVM domains · 81173859
      Jim Fehlig 提交于
      libxl uses the libxl_vnc_info and libxl_sdl_info fields from the
      hvm union in libxl_domain_build_info struct when generating QEMU
      args for VNC or SDL.  These fields were left unset by the libxl
      driver, causing libxl to ignore any user settings.  E.g. with
      
        <graphics type='vnc' port='5950'/>
      
      port would be ignored and QEMU would instead be invoked with
      
        -vnc 127.0.0.1:0,to=99
      
      Unlike the libxl_domain_config struct, the libxl_domain_build_info
      contains only a single libxl_vnc_info and libxl_sdl_info, so
      populate these fields from the first vfb in
      libxl_domain_config->vfbs.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Signed-off-by: NDavid Kiarie <davidkiarie4@gmail.com>
      (cherry picked from commit b55cc5f4)
      81173859
  6. 04 5月, 2014 4 次提交
    • C
      Prep for release 1.1.3.5 · 107fbc94
      Cole Robinson 提交于
      107fbc94
    • M
      qemu: Introduce qemuDomainDefCheckABIStability · 802b47a0
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=994364
      
      Whenever we check for ABI stability, we have new xml (e.g. provided by
      user, or obtained from snapshot, whatever) which we compare to old xml
      and see if ABI won't break. However, if the new xml was produced via
      virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
      devices, e.g. 'pci-root' controller. Hence, the ABI stability check
      fails even though it is stable. Moreover, we can't simply fix
      virDomainDefCheckABIStability because removing the correct devices is
      task for the driver. For instance, qemu driver wants to remove the usb
      controller too, while LXC driver doesn't. That's why we need special
      qemu wrapper over virDomainDefCheckABIStability which removes the
      correct devices from domain XML, produces MIGRATABLE xml and calls the
      check ABI stability function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 7d704812)
      802b47a0
    • L
      interface: dump inactive xml when interface isn't active · 34c592fa
      Laine Stump 提交于
      Other drivers in libvirt (e.g. network, qemu) will automatically
      return the "inactive" (persistent configuration) XML of an object when
      that object is inactive. The netcf backend of the interface driver
      would always try to return the live status XML of the interface, even
      when it was down. Although netcf does return valid XML in that case,
      for bond interfaces it is missing almost all of its content, including
      the <bond> subelement itself, leading to this error message from
      "virsh iface-dumpxml" of a bond interface that is inactive:
      
        error: XML error: bond interface misses the bond element
      
      (this is because libvirt's validation of the XML returned by netcf
      always requires a <bond> element be present).
      
      This patch modifies the interface driver netcf backend to check if the
      interface is inactive, and in that case always return the inactive XML
      (which will always have a <bond> element, thus eliminating the error
      message, as well as making operation more in line with other drivers.
      
      This fixes the following bug:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=878394
      
      (cherry picked from commit 7284c499)
      34c592fa
    • M
      interface: Introduce netcfInterfaceObjIsActive · 04503706
      Michal Privoznik 提交于
      This function barely wraps ncf_if_status() and error handling code.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 50f5468c)
      04503706
  7. 03 5月, 2014 1 次提交
  8. 01 5月, 2014 1 次提交
  9. 18 4月, 2014 1 次提交
  10. 16 4月, 2014 1 次提交
  11. 11 4月, 2014 3 次提交
  12. 10 4月, 2014 4 次提交
    • J
      Ignore char devices in storage pools by default · 595ada19
      Ján Tomko 提交于
      Without this, using /dev/mapper as a directory pool
      fails in virStorageBackendUpdateVolTargetInfoFD:
      cannot seek to end of file '/dev/mapper/control': Illegal seek
      
      Skip over character devices by default.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=710866
      (cherry picked from commit 0edfc9ef)
      595ada19
    • J
      Ignore missing files on pool refresh · ba7cc215
      Ján Tomko 提交于
      If we cannot stat/open a file on pool refresh, returning -1 aborts
      the refresh and the pool is undefined.
      
      Only treat missing files as fatal unless VolOpenCheckMode is called
      with the VIR_STORAGE_VOL_OPEN_ERROR flag. If this flag is missing
      (when it's called from virStorageBackendProbeTarget in
      virStorageBackendFileSystemRefresh), only emit a warning and return
      -2 to let the caller skip over the file.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=977706
      (cherry picked from commit ee640f44)
      ba7cc215
    • E
      storage: reduce number of stat calls · 1710925a
      Eric Blake 提交于
      We are calling fstat() at least twice per storage volume in
      a directory storage pool; this is rather wasteful.  Refactoring
      this is also a step towards making code reusable for gluster,
      where gluster can provide struct stat but cannot use fstat().
      
      * src/storage/storage_backend.h
      (virStorageBackendVolOpenCheckMode)
      (virStorageBackendUpdateVolTargetInfoFD): Update signature.
      * src/storage/storage_backend.c
      (virStorageBackendVolOpenCheckMode): Pass stat results back.
      (virStorageBackendUpdateVolTargetInfoFD): Use existing stats.
      (virStorageBackendVolOpen, virStorageBackendUpdateVolTargetInfo):
      Update callers.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      * src/storage/storage_backend_scsi.c
      (virStorageBackendSCSIUpdateVolTargetInfo): Likewise.
      * src/storage/storage_backend_mpath.c
      (virStorageBackendMpathUpdateVolTargetInfo): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 9cac8639)
      1710925a
    • J
      Fix explicit usage of default video PCI slots · be7636c3
      Ján Tomko 提交于
      Do not leave the PCI address of the primary video card set
      to the legacy default (0000:00:02.0) if we're doing two-pass
      allocation.
      
      Since QEMU 1.6 (QEMU_CAPS_VIDEO_PRIMARY) we allow the primary
      video card to be on other slots than 0000:00:02.0 (as we use
      -device instead of -vga).
      
      However we fail to assign it an address if:
      * another device explicitly uses 0000:00:02.0 and
      * the primary video device has no address specified
      
      On the first pass, we have set the address to default, then checked
      if it's available, leaving it set even if it wasn't. This address
      got picked up by the second pass, resulting in a conflict:
      
      XML error: Attempted double use of PCI slot 0000:00:02.0
      (may need "multifunction='on'" for device on function 0)
      
      Also fix the test that was supposed to catch this.
      
      (cherry picked from commit ec128e69)
      be7636c3
  13. 20 3月, 2014 1 次提交
    • M
      virNetClientSetTLSSession: Restore original signal mask · f1725e60
      Michal Privoznik 提交于
      Currently, we use pthread_sigmask(SIG_BLOCK, ...) prior to calling
      poll(). This is okay, as we don't want poll() to be interrupted.
      However, then - immediately as we fall out from the poll() - we try to
      restore the original sigmask - again using SIG_BLOCK. But as the man
      page says, SIG_BLOCK adds signals to the signal mask:
      
      SIG_BLOCK
            The set of blocked signals is the union of the current set and the set argument.
      
      Therefore, when restoring the original mask, we need to completely
      overwrite the one we set earlier and hence we should be using:
      
      SIG_SETMASK
            The set of blocked signals is set to the argument set.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 3d4b4f5a)
      f1725e60
  14. 10 3月, 2014 7 次提交
    • E
      storage: use valid XML for awkward volume names · 45d40bcf
      Eric Blake 提交于
      $ touch /var/lib/libvirt/images/'a<b>c'
      $ virsh pool-refresh default
      $ virsh vol-dumpxml 'a<b>c' default | head -n2
      <volume>
        <name>a<b>c</name>
      
      Oops.  That's not valid XML.  And when we fix the XML
      generation, it fails RelaxNG validation.
      
      I'm also tired of seeing <key>(null)</key> in the example
      output for volume xml; while we used NULLSTR() to avoid
      a NULL deref rather than relying on glibc's printf
      extension behavior, it's even better if we avoid the issue
      in the first place.  But this requires being careful that
      we don't invalidate any storage backends that were relying
      on key being unassigned during virStoragVolCreateXML[From].
      
      I would have split this into two patches (one for escaping,
      one for avoiding <key>(null)</key>), but since they both
      end up touching a lot of the same test files, I ended up
      merging it into one.
      
      Note that this patch allows pretty much any volume name
      that can appear in a directory (excluding . and .. because
      those are special), but does nothing to change the current
      (unenforced) RelaxNG claim that pool names will consist
      only of letters, numbers, _, -, and +.  Tightening the C
      code to match RelaxNG patterns and/or relaxing the grammar
      to match the C code for pool names is a task for another
      day (but remember, we DID recently tighten C code for
      domain names to exclude a leading '.').
      
      * src/conf/storage_conf.c (virStoragePoolSourceFormat)
      (virStoragePoolDefFormat, virStorageVolTargetDefFormat)
      (virStorageVolDefFormat): Escape user-controlled strings.
      (virStorageVolDefParseXML): Parse key, for use in unit tests.
      * src/storage/storage_driver.c (storageVolCreateXML)
      (storageVolCreateXMLFrom): Ensure parsed key doesn't confuse
      volume creation.
      * docs/schemas/basictypes.rng (volName): Relax definition.
      * tests/storagepoolxml2xmltest.c (mymain): Test it.
      * tests/storagevolxml2xmltest.c (mymain): Likewise.
      * tests/storagepoolxml2xmlin/pool-dir-naming.xml: New file.
      * tests/storagepoolxml2xmlout/pool-dir-naming.xml: Likewise.
      * tests/storagevolxml2xmlin/vol-file-naming.xml: Likewise.
      * tests/storagevolxml2xmlout/vol-file-naming.xml: Likewise.
      * tests/storagevolxml2xmlout/vol-*.xml: Fix fallout.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 6cc4d6a3)
      45d40bcf
    • E
      maint: fix comma style issues: conf · 5fdc3e6e
      Eric Blake 提交于
      Most of our code base uses space after comma but not before;
      fix the remaining uses before adding a syntax check.
      
      * src/conf/capabilities.c: Consistently use commas.
      * src/conf/domain_conf.c: Likewise.
      * src/conf/network_conf.c: Likewise.
      * src/conf/storage_conf.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 6f4901e1)
      5fdc3e6e
    • M
      virNetServerRun: Notify systemd that we're accepting clients · b7288926
      Michal Privoznik 提交于
      Systemd does not forget about the cases, where client service needs to
      wait for daemon service to initialize and start accepting new clients.
      Setting a dependency in client is not enough as systemd doesn't know
      when the daemon has initialized itself and started accepting new
      clients. However, it offers a mechanism to solve this. The daemon needs
      to call a special systemd function by which the daemon tells "I'm ready
      to accept new clients". This is exactly what we need with
      libvirtd-guests (client) and libvirtd (daemon). So now, with this
      change, libvirt-guests.service is invoked not any sooner than
      libvirtd.service calls the systemd notify function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 68954fb2)
      b7288926
    • M
      libvirt-guests: Wait for libvirtd to initialize · 73307499
      Michal Privoznik 提交于
      I've noticed that in some cases systemd was quick enough and even
      if libvirt-guests.service is marked to be started after the
      libvirtd.service my guests were not resumed as
      libvirt-guests.sh failed to connect. This is because of a
      simple fact: systemd correctly starts libvirt-guests after it
      execs libvirtd. However, the daemon is not able to accept
      connections right from the start. It's doing some
      initialization which may take ages. This problem is not limited
      to systemd only, indeed. Any init system that is able to startup
      services in parallel (e.g. OpenRC) may run into this situation.
      The fix is to try connecting not only once, but continuously a few
      times with a small sleep in between tries.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit 4e7fc830)
      73307499
    • M
      virSystemdCreateMachine: Set dependencies for slices · 484cec0b
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1031696
      
      When creating a new domain, we let systemd know about it by calling
      CreateMachine() function via dbus. Systemd then creates a scope and
      places domain into it. However, later when the host is shutting
      down, systemd computes the shutdown order to see what processes can
      be shut down in parallel. And since we were not setting
      dependencies at all, the slices (and thus domains) were most likely
      killed before libvirt-guests.service. So user domains that had to
      be saved, shut off, whatever were in fact killed.  This problem can
      be solved by letting systemd know that scopes we're creating must
      not be killed before libvirt-guests.service.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit ba79e387)
      484cec0b
    • G
      Add Documentation fields to systemd service files · 901aa960
      Guido Günther 提交于
      We point to the manpages where available and redirect to libvirt's
      homepage as a last resort.
      
      (cherry picked from commit 1b9f5aa7)
      901aa960
    • D
      Add a mutex to serialize updates to firewall · 034a4d7a
      Daniel P. Berrange 提交于
      The nwfilter conf update mutex previously serialized
      updates to the internal data structures for firewall
      rules, and updates to the firewall itself. The latter
      was recently turned into a read/write lock, and filter
      instantiation allowed to proceed in parallel. It was
      believed that this was ok, since each filter is created
      on a separate iptables/ebtables chain.
      
      It turns out that there is a subtle lock ordering problem
      on virNWFilterObjPtr instances. __virNWFilterInstantiateFilter
      will hold a lock on the virNWFilterObjPtr it is instantiating.
      This in turn invokes virNWFilterInstantiate which then invokes
      virNWFilterDetermineMissingVarsRec which then invokes
      virNWFilterObjFindByName. This iterates over every single
      virNWFilterObjPtr in the list, locking them and checking their
      name. So if 2 or more threads try to instantiate a filter in
      parallel, they'll all hold 1 lock at the top level in the
      __virNWFilterInstantiateFilter method which will cause the
      other thread to deadlock in virNWFilterObjFindByName.
      
      The fix is to add an exclusive mutex to serialize the
      execution of __virNWFilterInstantiateFilter.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 925de19e)
      034a4d7a
  15. 19 2月, 2014 10 次提交