1. 27 10月, 2012 8 次提交
    • E
      blockjob: add qemu capabilities related to block jobs · 6d264c91
      Eric Blake 提交于
      Upstream qemu 1.3 is adding two new monitor commands, 'drive-mirror'
      and 'block-job-complete'[1], which can drive live block copy and
      storage migration.  [Additionally, RHEL 6.3 had backported an earlier
      version of most of the same functionality, but under the names
      '__com.redhat_drive-mirror' and '__com.redhat_drive-reopen' and with
      slightly different JSON arguments, and has been using patches similar
      to these upstream patches for several months now.]
      
      The libvirt API virDomainBlockRebase as already committed for 0.9.12
      is flexible enough to expose the basics of block copy, but some
      additional features in the 'drive-mirror' qemu command, such as
      setting error policy, setting granularity, or using a persistent
      bitmap, may later require a new libvirt API virDomainBlockCopy.  I
      will wait to add that API until we know more about what qemu 1.3
      will finally provide.
      
      This patch caters only to the upstream qemu 1.3 interface, although
      I have proven that the changes for RHEL 6.3 can be isolated to
      just qemu_monitor_json.c, and the rest of this series will
      gracefully handle either interface once the JSON differences are
      papered over in a downstream patch.
      
      For consistency with other block job commands, libvirt must handle
      the bandwidth argument as MiB/sec from the user, even though qemu
      exposes the speed argument as bytes/sec; then again, qemu rounds
      up to cluster size internally, so using MiB hides the worst effects
      of that rounding if you pass small numbers.
      
      [1]https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg04123.html
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_DRIVE_MIRROR)
      (QEMU_CAPS_DRIVE_REOPEN): New bits.
      * src/qemu/qemu_capabilities.c (qemuCaps): Name them.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONCheckCommands): Set
      them.
      (qemuMonitorJSONDriveMirror, qemuMonitorDrivePivot): New functions.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDriveMirror)
      (qemuMonitorDrivePivot): Declare them.
      * src/qemu/qemu_monitor.c (qemuMonitorDriveMirror)
      (qemuMonitorDrivePivot): New passthroughs.
      * src/qemu/qemu_monitor.h (qemuMonitorDriveMirror)
      (qemuMonitorDrivePivot): Declare them.
      6d264c91
    • L
      qemu: fix attach/detach of netdevs with matching mac addrs · def31e4c
      Laine Stump 提交于
      This resolves:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=862515
      
      which describes inconsistencies in dealing with duplicate mac
      addresses on network devices in a domain.
      
      (at any rate, it resolves *almost* everything, and prints out an
      informative error message for the one problem that isn't solved, but
      has a workaround.)
      
      A synopsis of the problems:
      
      1) you can't do a persistent attach-interface of a device with a mac
      address that matches an existing device.
      
      2) you *can* do a live attach-interface of such a device.
      
      3) you *can* directly edit a domain and put in two devices with
      matching mac addresses.
      
      4) When running virsh detach-device (live or config), only MAC address
      is checked when matching the device to remove, so the first device
      with the desired mac address will be removed. This isn't always the
      one that's wanted.
      
      5) when running virsh detach-interface (live or config), the only two
      items that can be specified to match against are mac address and model
      type (virtio, etc) - if multiple netdevs match both of those
      attributes, it again just finds the first one added and assumes that
      is the only match.
      
      Since it is completely valid to have multiple network devices with the
      same MAC address (although it can cause problems in many cases, there
      *are* valid use cases), what is needed is:
      
      1) remove the restriction that prohibits doing a persistent add of a
      netdev with a duplicate mac address.
      
      2) enhance the backend of virDomainDetachDeviceFlags to check for
      something that *is* guaranteed unique (but still work with just mac
      address, as long as it yields only a single results.
      
      This patch does three things:
      
      1) removes the check for duplicate mac address during a persistent
      netdev attach.
      
      2) unifies the searching for both live and config detach of netdevices
      in the subordinate functions of qemuDomainModifyDeviceFlags() to use the
      new function virDomainNetFindIdx (which matches mac address and PCI
      address if available, checking for duplicates if only mac address was
      specified). This function returns -2 if multiple matches are found,
      allowing the callers to print out an appropriate message.
      
      Steps 1 & 2 are enough to fully fix the problem when using virsh
      attach-device and detach-device (which require an XML description of
      the device rather than a bunch of commandline args)
      
      3) modifies the virsh detach-interface command to check for multiple
      matches of mac address and show an error message suggesting use of the
      detach-device command in cases where there are multiple matching mac
      addresses.
      
      Later we should decide how we want to input a PCI address on the virsh
      commandline, and enhance detach-interface to take a --address option,
      eliminating the need to use detach-device
      
      * src/conf/domain_conf.c
      * src/conf/domain_conf.h
      * src/libvirt_private.syms
        * added new virDomainNetFindIdx function
        * removed now unused virDomainNetIndexByMac and
          virDomainNetRemoveByMac
      
      * src/qemu/qemu_driver.c
        * remove check for duplicate max from qemuDomainAttachDeviceConfig
        * use virDomainNetFindIdx/virDomainNetRemove instead
          of virDomainNetRemoveByMac in qemuDomainDetachDeviceConfig
        * use virDomainNetFindIdx instead of virDomainIndexByMac
          in qemuDomainUpdateDeviceConfig
      
      * src/qemu/qemu_hotplug.c
        * use virDomainNetFindIdx instead of a homespun loop in
          qemuDomainDetachNetDevice.
      
      * tools/virsh-domain.c: modified detach-interface command as described
          above
      def31e4c
    • E
      cpustat: fix regression when cpus are offline · 4fbf322f
      Eric Blake 提交于
      It turns out that the cpuacct results properly account for offline
      cpus, and always returns results for every possible cpu, not just
      the online ones.  So there is no need to check the map of online
      cpus in the first place, merely only a need to know the maximum
      possible cpu.  Meanwhile, virNodeGetCPUBitmap had a subtle change
      from returning the maximum id to instead returning the width of
      the bitmap (one larger than the maximum id) in commit 2f4c5338,
      which made this code encounter some off-by-one logic leading to
      bad error messages when a cpu was offline:
      
      $ virsh cpu-stats dom
      error: Failed to virDomainGetCPUStats()
      
      error: An error occurred, but the cause is unknown
      
      Cleaning this up unraveled a chain of other unused variables.
      
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Drop
      pointless check for cpumap changes, and use correct number of
      cpus.  Simplify signature.
      (qemuDomainGetCPUStats): Adjust caller.
      * src/nodeinfo.h (nodeGetCPUCount): New prototype.
      (nodeGetCPUBitmap): Drop unused parameter.
      * src/nodeinfo.c (nodeGetCPUBitmap): Likewise.
      (nodeGetCPUMap): Adjust caller.
      (nodeGetCPUCount): New function.
      * src/libvirt_private.syms (nodeinfo.h): Export it.
      4fbf322f
    • E
      build: fix syntax-check tab violation · 07049e4c
      Eric Blake 提交于
      * tools/Makefile.am: Fix tab damage in previous patch.
      07049e4c
    • E
      build: check for pod errors · 2639949a
      Eric Blake 提交于
      Patch 61299a1c fixed a long-standing pod error in the man page.
      But we should be preventing these up front.
      See also https://bugzilla.redhat.com/show_bug.cgi?id=870273
      
      * tools/Makefile.am (virt-xml-validate.1, virt-pki-validate.1)
      (virt-host-validate.1, virt-sanlock-cleanup.8, virsh.1): Reject
      pod conversion errors.
      * daemon/Makefile.am ($(srcdir)/libvirtd.8.in): Likewise.
      2639949a
    • E
      build: silence compiler warning about signedness · 60f54f61
      Eric Blake 提交于
      Commit 246143b6 fixed a warning on older gcc, but caused a warning
      on newer gcc.
      
      ../../src/rpc/virnetserverservice.c: In function 'virNetServerServiceNewPostExecRestart':
      ../../src/rpc/virnetserverservice.c:277:41: error: pointer targets in passing argument 3 of 'virJSONValueObjectGetNumberUint' differ in signedness [-Werror=pointer-sign]
      
      * src/rpc/virnetserverservice.c: Use correct types.
      60f54f61
    • E
      build: fix type-punning bug · 246143b6
      Eric Blake 提交于
      With older gcc and 64-bit size_t, the compiler issues a real warning:
      rpc/virnetserverservice.c:277: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      
      Introduced in commit 0cc79255.  Depending on machine endianness,
      this warning represents a real bug that could mis-interpret the
      value by a factor of 2^32.  I don't know why I couldn't get newer
      gcc to report the same warning message.
      
      * src/rpc/virnetserverservice.c
      (virNetServerServiceNewPostExecRestart): Use temporary instead.
      246143b6
    • L
      parallels: fix build for some older compilers · 73ebd86d
      Laine Stump 提交于
      Found this when building on RHEL5:
      
      parallels/parallels_storage.c: In function 'parallelsStorageOpen':
      parallels/parallels_storage.c:180: error: 'for' loop initial declaration used outside C99 mode
      
      (and similar error in parallels_driver.c). This was in spite of
      configuring with "-Wno-error".
      73ebd86d
  2. 26 10月, 2012 14 次提交
    • P
      documentation: HTML tag fix · 7083cdc7
      Philipp Hahn 提交于
      Replace '%' by '&' for correct escaping of '>' in Domain specification.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      7083cdc7
    • P
      maint: Sort .gitignore · 41bf06e9
      Peter Krempa 提交于
      Sorting of the .gitignore file was broken after the last addition. After
      a clean build the scripts re-sort it making the working tree dirty.
      41bf06e9
    • J
      virsh: Fix POD syntax · 61299a1c
      Jiri Denemark 提交于
      The first two hunks fix "Unterminated I<...> sequence" error and the
      last one fixes "’=item’ outside of any ’=over’" error.
      61299a1c
    • J
      virsh: Remove --flags from nodesuspend · ab545815
      Jiri Denemark 提交于
      We always expose individual bits from flags as separate options rather
      than exposing a raw flags options. Since virNodeSuspendForDuration does
      not currently support any flags, the only way of using this --flags
      options that would not fail is "--flags 0", which is equivalent to
      omitting the option. Thus it is highly unlikely anyone would actually be
      using it and removing it should be safe.
      ab545815
    • E
      snapshot: improve snapshot-list error message · 3cdf4dd4
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=869100 mentioned some
      confusion about 'virsh snapshot-list' errors.  Clean up a
      misleading error message, and add some documentation.
      
      * tools/virsh-snapshot.c (cmdSnapshotList): Mention --current
      rather than --from when appropriate.
      * tools/virsh.pod (snapshot-list): Mention that the named starting
      point is NOT part of the list except under --tree.
      3cdf4dd4
    • E
      maint: ignore unsaved emacs files · caea10bf
      Eric Blake 提交于
      I did a 'git add .', then realized that it ended up trying to
      add the emacs lock file for a corresponding file that I had not
      yet saved all my edits; thankfully I noticed it in time.  Since
      we already exclude other temporary files, this makes the most
      sense for preventing such a mistake from actually hitting upstream.
      
      * .gitignore: Add .#* to the exclude list.
      caea10bf
    • C
      daemon: Fix LIBVIRT_DEBUG=1 default output · eba36a38
      Cole Robinson 提交于
      This commit changes the behavior of LIBVIRT_DEBUG=1 libvirtd:
      
      $ git show 7022b091
      commit 7022b091
      Author: Daniel P. Berrange <berrange@redhat.com>
      Date:   Thu Sep 27 13:13:09 2012 +0100
      
          Automatically enable systemd journal logging
      
          Probe to see if the systemd journal is accessible, and if
          so enable logging to the journal by default, rather than
          stderr (current default under systemd).
      
      Previously  'LIBVIRT_DEBUG=1 /usr/sbin/libvirtd' would show all debug
      output to stderr, now it send debug output to the journal.
      
      Only use the journal by default if running in daemon mode, or
      if stdin is _not_ a tty. This should make libvirtd launched from
      systemd use the journal, but preserve the old behavior in most
      situations.
      eba36a38
    • L
      network: fix networkValidate check for default portgroup and vlan · d8aae15a
      Laine Stump 提交于
      This was found during testing of the fix for:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=868483
      
      networkValidate was supposed to check for the existence of multiple
      portgroups and report an error if this was encountered. It did, but
      there were two problems:
      
      1) even though it logged an error, it still returned success, allowing
      the operation to continue.
      
      2) It could exit the portgroup checking loop early (or possibly not
      even do it once) if a vlan tag was supplied in the base network config
      or one of the portgroups.
      
      This patch fixes networkValidate to return failure in addition to
      logging the error, and also changes it to not exit the portgroup
      checking loop early. The logic was a bit off in the checking for vlan
      anyway, and it's intertwined with fixing the early loop exit, so I
      fixed that as well. Now it correctly checks for combinations where a
      <virtualport> is specified in the base network def and <vlan> is given
      in a portgroup, as well as the opposite (<vlan> in base network def
      and <virtualport> in portgroup), and ignores the case of a disallowed
      vlan when using *no* portgroup if there is a default portgroup (since
      in that case there is no way to not use any portgroup).
      d8aae15a
    • E
      maint: consistent whitespace after 'if' · 42bbd93e
      Eric Blake 提交于
      Noticed during the review of the previous patch.
      
      * python/libvirt-override.c: Use space between 'if ('.
      42bbd93e
    • V
      virNodeGetCPUMap: Add python binding · 857f1168
      Viktor Mihajlovski 提交于
      Added a method getCPUMap to virConnect.
      It can be used as follows:
      
      import libvirt
      import sys
      import os
      
      conn = libvirt.openReadOnly(None)
      if conn == None:
          print 'Failed to open connection to the hypervisor'
          sys.exit(1)
      
      try:
          (cpus, cpumap, online) = conn.getCPUMap(0)
      except:
          print 'Failed to extract the node cpu map information'
          sys.exit(1)
      
      print 'CPUs total %d, online %d' % (cpus, online)
      print 'CPU map %s' % str(cpumap)
      
      del conn
      print "OK"
      
      sys.exit(0)
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      857f1168
    • V
      virNodeGetCPUMap: Implement driver support · e3ba6703
      Viktor Mihajlovski 提交于
      Driver support added for:
      - test: pretending 8 host CPUS, 3 being online
      - qemu, lxc, openvz, uml: using nodeGetCPUMap
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      e3ba6703
    • V
      virNodeGetCPUMap: Implement support function in nodeinfo · d34439c9
      Viktor Mihajlovski 提交于
      Added an implemention of virNodeGetCPUMap to nodeinfo.c,
      (nodeGetCPUMap) which can be used by all drivers for a Linux
      hypervisor host.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      d34439c9
    • E
      nodeinfo: improve probing node cpu bitmap · 2f4c5338
      Eric Blake 提交于
      Callers should not need to know what the name of the file to
      be read in the Linux-specific version of nodeGetCPUmap;
      furthermore, qemu cares about online cpus, not present cpus,
      when determining which cpus to skip.
      
      While at it, I fixed the fact that we were computing the maximum
      online cpu id by doing a slow iteration, when what we really want
      to know is the max available cpu.
      
      * src/nodeinfo.h (nodeGetCPUmap): Rename...
      (nodeGetCPUBitmap): ...and simplify signature.
      * src/nodeinfo.c (linuxParseCPUmax): New function.
      (linuxParseCPUmap): Simplify and alter signature.
      (nodeGetCPUBitmap): Change implementation.
      * src/libvirt_private.syms (nodeinfo.h): Reflect rename.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Update
      caller.
      2f4c5338
    • E
      bitmap: add virBitmapCountBits · 0711c4b7
      Eric Blake 提交于
      Sometimes it's handy to know how many bits are set.
      
      * src/util/bitmap.h (virBitmapCountBits): New prototype.
      (virBitmapNextSetBit): Use correct type.
      * src/util/bitmap.c (virBitmapNextSetBit): Likewise.
      (virBitmapSetAll): Maintain invariant of clear tail bits.
      (virBitmapCountBits): New function.
      * src/libvirt_private.syms (bitmap.h): Export it.
      * tests/virbitmaptest.c (test2): Test it.
      0711c4b7
  3. 25 10月, 2012 2 次提交
    • J
      Fix build with apparmor · 0111b409
      Jiri Denemark 提交于
      Recent storage patches changed signature of virStorageFileGetMetadata
      and replaced chain with backingChain in virDomainDiskDef.
      0111b409
    • M
      esx: Update version checks for vSphere 5.1 · 1e7cd395
      Matthias Bolte 提交于
      Also remove warnings for upcoming versions. There hadn't been any
      compatibility problems with new ESX version over the whole lifetime
      of the ESX driver, so I don't expect any in the future.
      
      Update documentation to mention vSphere 5.x support.
      1e7cd395
  4. 24 10月, 2012 15 次提交
  5. 23 10月, 2012 1 次提交
    • C
      selinux: Don't fail RestoreAll if file doesn't have a default label · 767be8be
      Cole Robinson 提交于
      When restoring selinux labels after a VM is stopped, any non-standard
      path that doesn't have a default selinux label causes the process
      to stop and exit early. This isn't really an error condition IMO.
      
      Of course the selinux API could be erroring for some other reason
      but hopefully that's rare enough to not need explicit handling.
      
      Common example here is storing disk images in a non-standard location
      like under /mnt.
      767be8be