1. 03 6月, 2014 4 次提交
    • J
      conf: more enum cleanups in "src/conf/domain_conf.h" · 5a2bd4c9
      Julio Faracco 提交于
      In "src/conf/domain_conf.h" there are many enum declarations. The
      cleanup in this header filer was started, but it wasn't enough and
      there are many other files that has enum variables declared. So, the
      commit was starting to be big. This commit finish the cleanup in this
      header file and in other files that has enum variables, parameters,
      or functions declared.
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5a2bd4c9
    • J
      conf: enum cleanups in "src/conf/domain_conf.h" · d4dad162
      Julio Faracco 提交于
      In "src/conf/domain_conf.h" there are many enumerations (enum)
      declarations to be converted as a typedef too. As mentioned before,
      it's better to use a typedef for variable types, function types and
      other usages. I think this file has most of those enum declarations
      at "src/conf/". So, me and Eric Blake plan to keep the cleanups all
      over the source code. This time, most of the files changed in this
      commit are related to part of one file: "src/conf/domain_conf.h".
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      d4dad162
    • J
      cpu: use typedefs for enums in "src/cpu/cpu_map.h" · 5443b158
      Julio Faracco 提交于
      In "src/cpu/" there are some enumerations (enum) declarations.
      Similar to the recent cleanup to "src/util", "src/conf" and other
      directories, it's better to use a typedef for variable types,
      function types and other usages. Other enumeration and folders will
      be changed to typedef's in the future. Specially, in files that are
      in different places of "src/util" and "src/conf". Most of the files
      changed in this commit are related to CPU (cpu_map.h) enums.
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      5443b158
    • M
      virsh-nodedev: Avoid spurious errors · 289a3163
      Michal Privoznik 提交于
      Our public free functions explicitly don't accept NULL pointers
      (sigh). Therefore, callers must do something like this:
      
          if (dev)
              virNodeDeviceFree(dev);
      
      And we are not doing that on two places I've found. This leads to
      dummy error message thrown by virsh:
      
          virsh # nodedev-dumpxml nonexistent-device
          error: Could not find matching device 'nonexistent-device'
          error: invalid node device pointer in virNodeDeviceFree
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      289a3163
  2. 02 6月, 2014 11 次提交
    • J
      Don't use AI_ADDRCONFIG when binding to wildcard addresses · 819ca36e
      Ján Tomko 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1098659
      
      With parallel boot, network addresses might not yet be assigned [1],
      but binding to wildcard addresses should work.
      
      For non-wildcard addresses, ADDRCONFIG is still used. Document this
      in libvirtd.conf.
      
      [1] http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
      819ca36e
    • J
      25a5df16
    • J
      qemu: Process DEVICE_DELETED event in a separate thread · 47f424c2
      Jiri Denemark 提交于
      Currently, we don not acquire any job when removing a device after
      DEVICE_DELETED event was received from QEMU. This means that if there is
      another API running at the time DEVICE_DELETED is delivered and the API
      acquired a job, we may happily change the definition of the domain the
      API is working with whenever it unlocks the domain object (e.g., to talk
      with its monitor). That said, we have to acquire a job before finishing
      device removal to make things safe. However, doing so in the main event
      loop would cause a deadlock so we need to move most of the event handler
      into a separate thread.
      
      Another good reason for both acquiring a job and handling the event in a
      separate thread is that we currently remove a device backend immediately
      after removing its frontend while we should only remove the backend once
      we already received DEVICE_DELETED event. That is, we will have to talk
      to QEMU monitor from the event handler.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      47f424c2
    • J
      qemu: Finish device removal in the original thread · 4670f1dd
      Jiri Denemark 提交于
      If QEMU supports DEVICE_DELETED event, we always call
      qemuDomainRemoveDevice from the event handler. However, we will need to
      push this call away from the main event loop and begin a job for it (see
      the following commit), we need to make sure the device is fully removed
      by the original thread (and within its existing job) in case the
      DEVICE_DELETED event arrives before qemuDomainWaitForDeviceRemoval times
      out.
      
      Without this patch, device removals would be guaranteed to never finish
      before the timeout because the could would be blocked by the original
      job being still active.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      4670f1dd
    • P
      Fix build on freebsd · f8a0c9ed
      Pavel Hrdina 提交于
      On freebsd there isn't known "setlocale" so we have to include locale.h
      f8a0c9ed
    • N
      Add helper program to create custom leases · baafe668
      Nehal J Wani 提交于
      Introduce helper program to catch events from dnsmasq and maintain a custom
      lease file per network. It supports dhcpv4 and dhcpv6. The file is saved as
      "<interface-name>.status".
      
      Each lease contains the following info:
      <expiry-time (epoch time)> <mac> <iaid> <ip-address> <hostname> <clientid>
      
      Example of custom leases file content:
      [
          {
              "iaid": "1221229",
              "ip-address": "2001:db8:ca2:2:1::95",
              "mac-address": "52:54:00:12:a2:6d",
              "hostname": "Fedora20",
              "client-id": "00:04:1a:c1:d9:6b:5a:0a:e2:bc:f8:4b:1e:37:2e:38:22:55",
              "expiry-time": 1393244216
          },
          {
              "ip-address": "192.168.150.208",
              "mac-address": "52:54:00:11:56:b3",
              "hostname": "Wani-PC",
              "client-id": "01:52:54:00:11:56:b3",
              "expiry-time": 1393244248
          }
      ]
      
      src/Makefile.am:
         * Add options to compile the helper program
      
      src/network/bridge_driver.c:
         * Introduce networkDnsmasqLeaseFileNameCustom()
         * Invoke helper program along with dnsmasq
         * Delete the .status file when corresponding n/w is destroyed.
      
      src/network/leaseshelper.c
         * Helper program to create the custom lease file
      baafe668
    • P
      virsh: Check whether found volume is member of the specified storage pool · 6ef0b034
      Peter Krempa 提交于
      When looking up storage volumes virsh uses multiple lookup steps. Some
      of the steps don't require a pool name specified. This resulted into a
      possibility that a volume would be part of a different pool than the
      user specified:
      
      Let's have a /var/lib/libvirt/images/test.qcow image in the 'default'
      pool and a second pool 'emptypool':
      
      Currently we'd return:
        $ virsh vol-info --pool emptypool /var/lib/libvirt/images/test.qcow
        Name:           test.qcow
        Type:           file
        Capacity:       100.00 MiB
        Allocation:     212.00 KiB
      
      After the fix:
       $ tools/virsh vol-info --pool emptypool /var/lib/libvirt/images/test.qcow
       error: Requested volume '/var/lib/libvirt/images/test.qcow' is not in pool 'emptypool'
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1088667
      6ef0b034
    • D
      Bump version to 1.2.6 for new dev cycle · 359d9941
      Daniel Veillard 提交于
      359d9941
    • D
      Forgot spec changelog in 1.2.5 commit · 7455be8e
      Daniel Veillard 提交于
      7455be8e
    • D
      Release of libvirt-1.2.5 · e604b59d
      Daniel Veillard 提交于
      * docs/news.html.in: update for release
      * po/*.po*: updated ukrainian localization and regenerated
      e604b59d
    • R
      docs: bhyve driver documentation improvements · ca50df8e
      Roman Bogorodskiy 提交于
      - Document 'domxml-to-native' command
      - Mention that the nmdm console support needs an appropriate
        kernel module loaded
      ca50df8e
  3. 01 6月, 2014 1 次提交
    • L
      util: fix DST end date in virtimetest timezones · 83c41ceb
      Laine Stump 提交于
      Reported by: Roman Bogorodskiy <bogorodskiy@gmail.com>
      
      Some of the tests for virTimeLocalOffsetFromUTC set an imaginary
      timezone that attempts to force dyalight savings time active all the
      time by setting a start date of 0/00:00:00 and end date of
      366/23:59:59. Since the day is 0-based, 366 really means "day 367"
      which will never occur - this was an attempt to eliminate problems
      with DST not being active in some cases right around midnight on
      January 1. Even though it didn't completely solve the problem, it
      didn't seem to cause harm so it was left in the test timezones.
      
      Although Linux glibc doesn't mind having a DST end date of 366,
      FreeBSD refuses to use such timezones, so the tests fail. This patch
      changes the 366 to 365.
      
      This may or may not cause failure of the remaining DST tests around
      midnight Jan 1. If so, we will need to disable those tests at year's
      end too.
      83c41ceb
  4. 31 5月, 2014 1 次提交
    • E
      build: avoid compiler warning on 32-bit platform · c7ca02e6
      Eric Blake 提交于
      On a 32-bit platform:
      
      virstringtest.c: In function 'mymain':
      virstringtest.c:673: warning: this decimal constant is unsigned only in ISO C90
      
      I already had a comment in the file about the 64-bit counterpart;
      the easiest fix was to make both sites use the standardized macro
      that is guaranteed to work.
      
      * tests/virstringtest.c (mymain): Minimum signed integers are a pain.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c7ca02e6
  5. 29 5月, 2014 13 次提交
    • P
      qemu: snapshot: Improve detection of mixed snapshots · 23f38f88
      Peter Krempa 提交于
      Currently we don't support mixed (external + internal) snapshots. The
      code detecting the snapshot type didn't make sure that the memory image
      was consistent with the snapshot type leading into strange error
      message:
      
       $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=external,file=/tmp/blah
       error: internal error: unexpected code path
      
      Fix the mixed detection code to detect this kind of mistake:
      
       $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=external,file=/tmp/blah
       error: unsupported configuration: mixing internal and external targets for a snapshot is not yet supported
      23f38f88
    • P
      qemu: snapshot: Reject internal active snapshot without memory state · d2e668e5
      Peter Krempa 提交于
      A internal snapshot of a active VM with the memory snapshot disabled
      explicitly would actually still take the memory snapshot. Reject it
      explicitly.
      
      Before:
       $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no
       Domain snapshot 1401353155 created
      
      After:
       $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no
       error: Operation not supported: internal snapshot of a running VM must include the memory state
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1083345
      d2e668e5
    • P
      util: storage: Fix crash of libvirtd on network backed guest block-pull · 4a051b80
      Peter Krempa 提交于
      For guests backed by gluster volumes (or other network storage) we don't
      fill the backing chain (see qemuDomainDetermineDiskChain). This leaves
      the "relPath" field of the top image NULL. This causes a crash in
      virStorageFileChainLookup() when looking up a backing element for such a
      disk.
      
      Since I'm working on adding support for network storage and one of the
      steps will make the "relPath" field optional let's use STREQ_NULLABLE
      instead of STREQ in virStorageFileChainLookup() to avoid the problem.
      4a051b80
    • L
      util: fix virTimeLocalOffsetFromUTC DST processing · 26d43113
      Laine Stump 提交于
      The original version of virTimeLocalOffsetFromUTC() would fail for
      certain times of the day if daylight savings time was active. This
      could most easily be seen by uncommenting the TEST_LOCALOFFSET() cases
      that include a DST setting.
      
      After a lot of experimenting, I found that the way to solve it in
      almost all test cases is to set tm_isdst = -1 in the struct tm prior
      to calling mktime(). Once this is done, the correct offset is returned
      for all test cases at all times except the two hours just after
      00:00:00 Jan 1 UTC - during that time, any timezone that is *behind*
      UTC, and that is supposed to always be in DST will not have DST
      accounted for in its offset.
      
      I believe that the code of virTimeLocalOffsetFromUTC() actually is
      correct for all cases, but the problem still encountered is due to our
      inability to come up with a TZ string that properly forces DST to
      *always* be active. Since a modfication of the (currently fixed)
      expected result data to account for this would necessarily use the
      same functions that we're trying to test, I've instead just made the
      test program conditionally bypass the problematic cases if the current
      date is either December 31 or January 1. This way we get maximum
      testing during 363 days of the year, but don't get false failures on
      Dec 31 and Jan 1.
      26d43113
    • E
      virsh: fix typos in virsh man page · be673413
      Eric Blake 提交于
      * tools/virsh.pod (attach-disk): Drop duplicate --config, fix typo
      in --sourcetype.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      be673413
    • E
      maint: fix typo in previous patch · 5fa10f32
      Eric Blake 提交于
      Use correct variable name.
      
      * m4/virt-selinux.m4: Fix one last variable name.
      5fa10f32
    • J
      maint: cleanup detection of const'ness of selinux ctx · b109c097
      Jim Fehlig 提交于
      Commit 292d3f2d fixed the build with libselinux 2.3, but missed
      some suggestions by eblake
      
      https://www.redhat.com/archives/libvir-list/2014-May/msg00977.html
      
      This patch changes the macro introduced in 292d3f2d to either be
      empty in the case of newer libselinux, or contain 'const' in the
      case of older libselinux.  The macro is then used directly in
      tests/securityselinuxhelper.c.
      b109c097
    • C
      build: fix build with libselinux 2.3 · 292d3f2d
      Cédric Bosdonnat 提交于
      Several function signatures changed in libselinux 2.3, now taking
      a 'const char *' instead of 'security_context_t'.  The latter is
      defined in selinux/selinux.h as
      
        typedef char *security_context_t;
      Signed-off-by: NEric Blake <eblake@redhat.com>
      292d3f2d
    • P
      qemu: managedsave: Don't spam logs with warnings about corrupted image · 0b317d61
      Peter Krempa 提交于
      Even successful start of a VM from a managed save image would spam the
      logs with the following message:
      
      Unable to restore from managed state [path]. Maybe the file is
      corrupted?
      
      Re-arrange the logic to output the warning only when the image is
      corrupted.
      
      The flaw was introduced in commit cfc28c66.
      0b317d61
    • P
      utils: storage: Canonicalize paths only for local filesystems · 92dc2dab
      Peter Krempa 提交于
      Now that virStorageFileGetMetadataFromBuf is used only for remote
      filesystems, don't canonicalize the path in it.
      92dc2dab
    • P
      storage: fs: Drop-in replace use of virStorageFileGetMetadataFromBuf · 34d86185
      Peter Krempa 提交于
      Use virStorageFileGetMetadataFromFD instead in
      virStorageBackendProbeTarget as it now returns all required data and the
      storage file is already open in a filedescriptor.
      
      Also fix improper error code being returned when virFileReadHeaderFD
      would fail as virStorageBackendUpdateVolTargetInfoFD would set the
      return code to 0.
      34d86185
    • P
      storage: Return backing format from virStorageFileGetMetadataFromFD · 5a1cf6bd
      Peter Krempa 提交于
      Add argument to return backing file format of a file probed by
      virStorageFileGetMetadataFromFD so that it can be used in place of
      virStorageFileGetMetadataFromBuf.
      5a1cf6bd
    • E
      qemu: reject rather than hang on blockcommit of active layer · e6bcbcd3
      Eric Blake 提交于
      qemu 2.0 added the ability to commit the active layer, but slightly
      differently than what libvirt had been anticipating in its
      implementation of the virDomainBlockCommit call.  As a result, if
      you attempt to do a 'virsh blockcommit $dom vda', qemu gets into a
      state where it is waiting on libvirt to end the job, while libvirt
      is waiting on qemu to end the job, and the guest is effectively
      hung with regards to further commands for that block device.
      
      I have patches coming down the pipeline that will add full support
      for blockcommit of the active layer when coupled with qemu 2.0 or
      later; but they depend on Peter's improvements to block job handling
      and form enough of a new feature that they are not ready for
      inclusion in the 1.2.5 release.  So for now, just reject the
      attempt, rather than letting the user get stuck.  This is no worse
      than the behavior of qemu 1.7 rejecting the job.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Reject active
      commit.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e6bcbcd3
  6. 28 5月, 2014 1 次提交
  7. 27 5月, 2014 2 次提交
  8. 26 5月, 2014 6 次提交
    • D
      Fix an extra ' in a translated string · f07d24a6
      Daniel Veillard 提交于
      Raised by ukrainian translator Yuri Chornoivan
      https://fedora.transifex.com/projects/p/libvirt/translate/#uk/strings/25483059
      f07d24a6
    • J
      Clean up chardev sockets on QEMU shutdown · 205010c4
      Ján Tomko 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1088787
      
      Clean up unix socket files for chardevs using mode='bind',
      like we clean up the monitor socket.
      They are created by QEMU on startup and not really useful
      after shutting it down.
      205010c4
    • L
      qemu: fix <clock offset='variable' basis='localtime'/> · cde8ca2d
      Laine Stump 提交于
      For a clock element as above, libvirt simply converts current system
      time with localtime_r(), then starts qemu with a time string that
      doesn't contain any timezone information. So, from qemu's point of
      view, the -rtc string it gets for:
      
         <clock offset='variable' basis='utc' adjustment='10800'/>
      
      is identical to the -rtc string it gets for:
      
         <clock offset='variable' basis='localtime' adjustment='0'/>
      
      (assuming the host is in a timezone that is 10800 seconds ahead of
      UTC, as is the case on the machine where this message is being
      written).
      
      Since the commandlines are identical, qemu will behave identically
      after this point in either case.
      
      There are two problems in the case of basis='localtime' though:
      
      Problem 1) If the guest modifies its RTC, for example to add 20
      seconds, the RTC_CHANGE event from qemu will then contain offset:20 in
      both cases. But libvirt will have saved the original adjustment into
      adjustment0, and will add that value onto the offset in the
      event. This means that in the case of basis=;utc', it will properly
      emit an event with offset:10820, but in the case of basis='localtime'
      the event will contain offset:20, which is *not* the new offset of the
      RTC from UTC (as the event it documented to provide).
      
      Problem 2) If the guest is migrated to another host that is in a
      different timezone, or if it is migrated or saved/restored after the
      DST status has changed from what it was when the guest was originally
      started, the newly restarted guest will have a different RTC (since it
      will be based on the new localtime, which could have shifted by
      several hours).
      
      The solution to both of these problems is simple - rather than
      maintaining the original adjustment value along with
      "basis='localtime'" in the domain status, when the domain is started
      we convert the adjustment offset to one relative to UTC, and set the
      status to "basis='utc'". Thus, whatever the RTC offset was from UTC
      when it was initially started, that offset will be maintained when
      migrating across timezones and DST settings, and the RTC_CHANGE events
      will automatically contain the proper offset (which should by
      definition always be relative to UTC).
      
      This fixes a problem that was implied but not openly stated in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=964177
      cde8ca2d
    • L
      qemu: fix RTC_CHANGE event for <clock offset='variable' basis='utc'/> · b62d67da
      Laine Stump 提交于
      commit e31b5cf3 attempted to fix libvirt's
      VIR_DOMAIN_EVENT_ID_RTC_CHANGE, which is documentated to always
      provide the new offset of the domain's real time clock from UTC. The
      problem was that, in the case that qemu is provided with an "-rtc
      base=x" where x is an absolute time (rather than "utc" or
      "localtime"), the offset sent by qemu's RTC_CHANGE event is *not* the
      new offset from UTC, but rather is the sum of all changes to the
      domain's RTC since it was started with base=x.
      
      So, despite what was said in commit e31b5cf3, if we assume that
      the original value stored in "adjustment" was the offset from UTC at
      the time the domain was started, we can always determine the current
      offset from UTC by simply adding the most recent (i.e. current) offset
      from qemu to that original adjustment.
      
      This patch accomplishes that by storing the initial adjustment in the
      domain's status as "adjustment0". Each time a new RTC_CHANGE event is
      received from qemu, we simply add adjustment0 to the value sent by
      qemu, store that as the new adjustment, and forward that value on to
      any event handler.
      
      This patch (*not* e31b5cf3, which should be reverted prior to
      applying this patch) fixes:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=964177
      
      (for the case where basis='utc'. It does not fix basis='localtime')
      b62d67da
    • L
      Revert "qemu: Report the offset from host UTC for RTC_CHANGE event" · b8efa6f2
      Laine Stump 提交于
      This reverts commit e31b5cf3.
      
      This commit attempted to work around a bug in the offset value
      reported by qemu's RTC_CHANGE event in the case that a variable base
      date was given on the qemu commandline. The patch mixed up the math
      involved in arriving at the corrected offset to report, and in the
      process added an unnecessary private attribute to the clock
      element. Since that element is private/internal and not used by anyone
      else, it makes sense to simplify things by removing it.
      b8efa6f2
    • L
      util: new function virTimeLocalOffsetFromUTC · 1cddaea7
      Laine Stump 提交于
      Since there isn't a single libc API to get this value, this patch
      supplies one which gets the value by grabbing current time, then
      converting that into a struct tm with gmtime_r(), then back to a
      time_t using mktime.
      
      The returned value is the difference between UTC and localtime in
      seconds. If localtime is ahead of UTC (east) the offset will be a
      positive number, and if localtime is behind UTC (west) the offset will
      be negative.
      
      This function should be POSIX-compliant, and is threadsafe, but not
      async signal safe. If it was ever necessary to know this value in a
      child process, we could cache it with a one-time init function when
      libvirtd starts, then just supply the cached value, but that
      complexity isn't needed for current usage; that would also have the
      problem that it might not be accurate after a local daylight savings
      boundary.
      
      (If it weren't for DST, we could simply replace this entire function
      with "-timezone"; timezone contains the offset of the current timezone
      (negated from what we want) but doesn't account for DST. And in spite
      of being guaranteed by POSIX, it isn't available on older versions of
      mingw.)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1cddaea7
  9. 23 5月, 2014 1 次提交
    • P
      storage: Add storage file API to read file headers · 81271a92
      Peter Krempa 提交于
      Add storage driver based functions to access headers of storage files
      for metadata extraction. Along with this patch a local filesystem and
      gluster via libgfapi implementation is provided. The gluster
      implementation is based on code of the saferead_lim function.
      81271a92