1. 07 10月, 2011 3 次提交
    • L
      qemu: add separate rerror_policy for disk errors · 4bb4109f
      Laine Stump 提交于
      Previously libvirt's disk device XML only had a single attribute,
      error_policy, to control both read and write error policy, but qemu
      has separate options for controlling read and write. In one case
      (enospc) a policy is allowed for write errors but not read errors.
      
      This patch adds a separate attribute that sets only the read error
      policy. If just error_policy is set, it will apply to both read and
      write error policy (previous behavior), but if the new rerror_policy
      attribute is set, it will override error_policy for read errors only.
      Possible values for rerror_policy are "stop", "report", and "ignore"
      ("report" is the qemu-controlled default for rerror_policy when
      error_policy isn't specified).
      
      For consistency, the value "report" has been added to the possible
      values for error_policy as well.
      4bb4109f
    • L
      qemu: leave rerror policy at default when enospace is requested · 91195b43
      Laine Stump 提交于
      commit 12062abb set rerror=ignore when error_policy="enospace" was
      selected (since the rerror option in qemu doesn't accept "enospc", as
      the werror option does).
      
      After that patch was already pushed, Paolo Bonzini noticed it and
      commented that leaving rerror at the default ("report") would be a
      better choice. This patch corrects the problem - if error_policy =
      "enospace" is given, rerror is left off the qemu commandline,
      effectively setting it to "report". For other values, rerror is still
      set to match werror.
      
      Additionally, the parsing of error_policy was changed to no longer
      erroneously allow "default" as a choice - as with most other
      attributes, if you want the default setting, just don't specify an
      error_policy.
      
      Finally, two ommissions in the first patch were corrected - a
      long-dormant qemuxml2argv test for enospace was enabled, and fixed to
      pass, and the argv2xml parser in qemu_command.c was updated to
      recognize the different spelling on the qemu commandline.
      91195b43
    • E
      qemu: enable multifunction for older qemu · 8644a379
      Eric Blake 提交于
      Now that RHEL 6.2 Beta is out, it would be nice to test multifunction
      devices on that platform.  This changes things so that the multifunction
      cap bit can be set in two different ways: by version comparison (needed
      for qemu 0.13 which lacked a -device query), and by -device query
      (provided by qemu.git and backported to the RHEL beta build of
      qemu-kvm which still claims to be a modified 0.12, and therefore needed
      for RHEL).
      
      * src/qemu/qemu_capabilities.c (qemuCapsParseDeviceStr): Allow
      second method of setting multifunction cap bit.
      * tests/qemuhelptest.c (mymain): Test it.
      * tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel62-beta: New file.
      * tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel62-beta-device: Likewise.
      8644a379
  2. 06 10月, 2011 7 次提交
    • G
      Document STREQ_NULLABLE and STRNEQ_NULLABLE · 3addd151
      Guido Günther 提交于
      3addd151
    • D
      Make LXC work with new network configuration types · b59bb931
      Daniel P. Berrange 提交于
      If using one of the new non-NAT/routed virtual network
      configurations, the LXC driver would not know how to
      setup the VETH devices. Adding in calls to setup the
      "actual" network configuration at VM startup and cleanup
      when shutting down fixes this.
      
      * src/lxc/lxc_driver.c: Setup/cleanup actual net devs
      b59bb931
    • E
      init: raise default system aio limits · 5298551e
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=740899 documents that
      if qemu uses aio=native for its disks, then it consumes 128 aio
      requests per disk.  On a host with multiple guests, this can quickly
      run out of kernel aio requests with the default aio-max-nr of
      65536.  Kernel developers have confirmed that there is no up-front
      cost to raising this limit (a larger limit merely implies that more
      aio requests can be issued in parallel, which in turn will result
      in more kernel memory allocation, only if the system really does use
      that many requests).  Since the system default limit prevents 256
      disks, which is well within libvirt's current scalability, this
      patch installs a file to raise the limit and document it in case a
      system administrator has further cause to tune the limit.  The
      install only works on platforms new enough to source /etc/sysctl.d/*
      alongside /etc/sysctl.conf (F14 and RHEL 6).
      
      * daemon/libvirtd.sysctl: New file.
      * daemon/Makefile.am (EXTRA_DIST): Ship it.
      (install-init, uninstall-init): Install it.
      * libvirt.spec.in (%files): Include it in rpm.
      5298551e
    • E
      maint: fix minor issues in virterror public header · 892719f6
      Eric Blake 提交于
      Consistent use of tabs, fewer long lines, and a typo fix.
      
      * include/libvirt/virterror.h: Fix typos, layout.
      892719f6
    • E
      snapshot: enforce REVERT_FORCE on qemu · 29879b55
      Eric Blake 提交于
      Implements the documentation for snapshot revert vs. force.
      
      Part of the patch tightens existing behavior (previously, reverting
      to an old snapshot without <domain> was blindly attempted, now it
      requires force), while part of it relaxes behavior (previously, it
      was not possible to revert an active domain to an ABI-incompatible
      active snapshot, now force allows this transition).
      
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Check for
      risky situations, and allow force to get past them.
      29879b55
    • E
      snapshot: use qemu-img on disks in use at time of snapshot · 70e015e1
      Eric Blake 提交于
      Once we know which set of disks belong to a snapshot, reverting or
      deleting that snapshot should visit just those disks, rather than
      also visiting disks that were hot-plugged in the meantime or
      skipping disks that were hot-unplugged in the meantime.
      
      * src/qemu/qemu_domain.c (qemuDomainSnapshotForEachQcow2): Use
      snapshot domain details when available.  Avoid NULL deref.
      70e015e1
    • E
      snapshot: add REVERT_FORCE to API · 3c797404
      Eric Blake 提交于
      Although reverting to a snapshot is a form of data loss, this is
      normally expected.  However, there are two cases where additional
      surprises (failure to run the reverted state, or a break in
      connectivity to the domain) can come into play.  Requiring extra
      acknowledgment in these cases will make it less likely that
      someone can get into an unrecoverable state due to a default revert.
      
      Also create a new error code, so users can distinguish when forcing
      would make a difference, rather than having to blindly request force.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_REVERT_FORCE):
      New flag.
      * src/libvirt.c (virDomainRevertToSnapshot): Document it.
      * include/libvirt/virterror.h (VIR_ERR_SNAPSHOT_REVERT_RISKY): New
      error value.
      * src/util/virterror.c (virErrorMsg): Implement it.
      * tools/virsh.c (cmdDomainSnapshotRevert): Add --force to virsh.
      * tools/virsh.pod (snapshot-revert): Document it.
      3c797404
  3. 05 10月, 2011 7 次提交
    • E
      snapshot: implement snapshot roots listing in vbox · 869b69ea
      Eric Blake 提交于
      Commit 9f5e53e2 introduced the ability to filter snapshots to
      just roots, but it was never implemented for VBox until now.
      
      The VBox implementation prohibits deletion of a snapshot with
      multiple children.  Hence, there can only be at most one root,
      which is found by searching for the snapshot with a NULL uuid.
      
      Prior to 4.0, snapshotGet looked up by UUID, and snapshotFind
      looked up by name; after that point, snapshotGet disappeared
      and snapshotFind handles uuid or name.
      
      * src/vbox/vbox_tmpl.c (vboxDomainSnapshotNum)
      (vboxDomainSnapshotListNames): Implement limiting list to root.
      869b69ea
    • J
      qemu: Don't fail virDomainGetInfo if we can't update balloon info · fcd2bd55
      Jiri Denemark 提交于
      Qemu driver tries to update balloon data in virDomainGetInfo and if it
      can't do so because there is another monitor job running, it just
      reports what's known in domain def. However, if there was no job running
      but getting the data from qemu fails, we would fail the whole API. This
      doesn't make sense. Let's make the failure nonfatal.
      fcd2bd55
    • E
      snapshot: simplify esx snapshot name lookup · f0455833
      Eric Blake 提交于
      No need to request the parent of a snapshot if we aren't going to use it.
      
      * src/esx/esx_vi.c (esxVI_GetSnapshotTreeByName): Make parent
      optional.
      * src/esx/esx_driver.c (esxDomainSnapshotCreateXML)
      (esxDomainSnapshotLookupByName, esxDomainRevertToSnapshot)
      (esxDomainSnapshotDelete): Simplify accordingly.
      f0455833
    • E
      snapshot: implement snapshot roots listing in esx · 827a992a
      Eric Blake 提交于
      Commit 9f5e53e2 introduced the ability to filter snapshots to
      just roots, but it was never implemented for ESX until now.
      
      * src/esx/esx_vi.h (esxVI_GetNumberOfSnapshotTrees)
      (esxVI_GetSnapshotTreeNames): Add parameter.
      * src/esx/esx_vi.c (esxVI_GetNumberOfSnapshotTrees)
      (esxVI_GetSnapshotTreeNames): Allow choice of recursion or not.
      * src/esx/esx_driver.c (esxDomainSnapshotNum)
      (esxDomainSnapshotListNames): Use it to limit to roots.
      827a992a
    • L
      qemu: correct misspelled 'enospc' option, and only use for werror · 12062abb
      Laine Stump 提交于
      This resolves:
      
           https://bugzilla.redhat.com/show_bug.cgi?id=730909
      
      When support for setting the qemu disk error policy to "enospc" was
      added, it was inadvertently spelled "enospace". This patch corrects
      that on the qemu commandline (while retaining the "enospace" spelling
      for libvirt's XML).
      
      Also, while examining the qemu source, I found that "enospc" is not
      allowed for the read error policy, only for write error policy (makes
      sense). Since libvirt currently only has a single error policy
      setting, when "enospace" is selected, the read error policy is set to
      "ignore".
      12062abb
    • E
      snapshot: better virsh handling of missing current, parent · 64703c03
      Eric Blake 提交于
      Previously, virsh 'snapshot-parent' and 'snapshot-current' were
      completely silent in the case where the code conclusively proved
      there was no parent or current snapshot, but differed in exit
      status; this silence caused some confusion on whether the commands
      worked.  Furthermore, commit d1be48f9 introduced a regression where
      snapshot-parent would leak output about an unknown function, but
      only on the first attempt, when talking to an older server that
      lacks virDomainSnapshotGetParent.  This changes things to consistenly
      report an error message and exit with status 1 when no snapshot
      exists, and to avoid leaking unknown function warnings when using
      fallbacks.
      
      * tools/virsh.c (vshGetSnapshotParent): Alter signature, to
      distinguish between real error and missing parent.  Don't pollute
      last_error on success.
      (cmdSnapshotParent): Adjust caller.  Always output message on
      failure.
      (cmdSnapshotList): Adjust caller.
      (cmdSnapshotCurrent): Always output message on failure.
      64703c03
    • G
      Document that ff callbacks need to be invoked from a clean stack. · ae37001d
      Guido Günther 提交于
      Also fix a typo.
      ae37001d
  4. 04 10月, 2011 6 次提交
    • J
      qemu: Fix migration with dname · cdd5ef7b
      Jiri Denemark 提交于
      Destination libvirtd remembers the original name in the prepare phase
      and clears it in the finish phase. The original name is used when
      comparing domain name in migration cookie.
      cdd5ef7b
    • D
      Allow passing of command line args to LXC container · 652f8871
      Daniel P. Berrange 提交于
      When booting a virtual machine with a kernel/initrd it is possible
      to pass command line arguments using the <cmdline>...args...</cmdline>
      element in the guest XML. These appear to the kernel / init process
      in /proc/cmdline.
      
      When booting a container we do not have a custom /proc/cmdline,
      but we can easily set an environment variable for it. Ideally
      we could pass individual arguments to the init process as a
      regular set of 'char *argv[]' parameters, but that would involve
      libvirt parsing the <cmdline> XML text. This can easily be added
      later, even if we add the env variable now
      
      * docs/drvlxc.html.in: Document env variables passed to LXC
      * src/conf/domain_conf.c: Add <cmdline> to be parsed for
        guests of type='exe'
      * src/lxc/lxc_container.c: Set LIBVIRT_LXC_CMDLINE env var
      652f8871
    • D
      Add support for bandwidth filtering on LXC guests · 6cc9ee9b
      Daniel P. Berrange 提交于
      Call virBandwidthEnable after creating the LXC veth, so that any
      bandwidth controls get applied
      
      * src/lxc/lxc_driver.c: Enable bandwidth limiting
      6cc9ee9b
    • L
      network: fill in bandwidth from portgroup for all forward modes · 6c9e2eb2
      Laine Stump 提交于
      This patch is a fix for:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=743176
      
      which was discovered by Dan Berrange while making bandwidth
      configuration work for LXC guests.
      
      Background: Although virtportprofile data from a network portgroup is
      only applicable for direct mode interfaces, the code that copies
      bandwidth data from the portgroup was also only being executed in the
      case of direct mode interfaces. The result was that interfaces using
      traditional virtual networks (forward mode='nat|route|none'), and
      those using a host bridge for forwarding, would not pick up bandwidth
      data from a portgroup defined in the network.
      
      This patch moves that code outside the conditional, so that bandwidth
      information is *alway* copied from the appropriate portgroup (unless
      the <interface> definition itself already has bandwidth information,
      which would take precedence over what's in the portgroup anyway).
      6c9e2eb2
    • N
      bridge_driver.c: Fix autoconf setting · 92888c80
      Neil Wilson 提交于
      Code altered so that it is consistent with the associated comment. The
      'autoconf' variable is forced to zero.
      Signed-off-by: NNeil Wilson <neil@brightbox.co.uk>
      92888c80
    • M
      Set to NULL members that have been freed to prevent crashes · be5ec766
      Marc-André Lureau 提交于
      Do not crash if virStreamFinish is called after error.
      
      ==11000== Invalid read of size 4
      ==11000==    at 0x373A8099A0: pthread_mutex_lock (pthread_mutex_lock.c:51)
      ==11000==    by 0x4C7CADE: virMutexLock (threads-pthread.c:85)
      ==11000==    by 0x4D57C31: virNetClientStreamRaiseError (virnetclientstream.c:203)
      ==11000==    by 0x4D385E4: remoteStreamFinish (remote_driver.c:3541)
      ==11000==    by 0x4D182F9: virStreamFinish (libvirt.c:14157)
      ==11000==    by 0x40FDC4: cmdScreenshot (virsh.c:3075)
      ==11000==    by 0x42BA40: vshCommandRun (virsh.c:14922)
      ==11000==    by 0x42ECCA: main (virsh.c:16381)
      ==11000==  Address 0x59b86c0 is 16 bytes inside a block of size 216 free'd
      ==11000==    at 0x4A06928: free (vg_replace_malloc.c:427)
      ==11000==    by 0x4C69E2B: virFree (memory.c:310)
      ==11000==    by 0x4D57B56: virNetClientStreamFree (virnetclientstream.c:184)
      ==11000==    by 0x4D3DB7A: remoteDomainScreenshot (remote_client_bodies.h:1812)
      ==11000==    by 0x4CFD245: virDomainScreenshot (libvirt.c:2903)
      ==11000==    by 0x40FB73: cmdScreenshot (virsh.c:3029)
      ==11000==    by 0x42BA40: vshCommandRun (virsh.c:14922)
      ==11000==    by 0x42ECCA: main (virsh.c:16381)
      be5ec766
  5. 03 10月, 2011 2 次提交
  6. 01 10月, 2011 4 次提交
    • L
      qemu: make PCI multifunction support more manual · c329db71
      Laine Stump 提交于
      When support for was added for PCI multifunction cards (in commit
      9f8baf, first included in libvirt 0.9.3), it was done by always
      turning on the multifunction bit for all PCI devices. Since that time
      it has been realized that this is not an ideal solution, and that the
      multifunction bit must be selectively turned on. For example, see
      
        https://bugzilla.redhat.com/show_bug.cgi?id=728174
      
      and the discussion before and after
      
        https://www.redhat.com/archives/libvir-list/2011-September/msg01036.html
      
      This patch modifies multifunction support so that the multifunction=on
      option is only added to the qemu commandline for a device if its PCI
      <address> definition has the attribute "multifunction='on'", e.g.:
      
        <address type='pci' domain='0x0000' bus='0x00'
                 slot='0x04' function='0x0' multifunction='on'/>
      
      In practice, the multifunction bit should only be turned on if
      function='0' AND other functions will be used in the same slot - it
      usually isn't needed for functions 1-7 (although there are apparently
      some exceptions, e.g. the Intel X53 according to the QEMU source
      code), and should never be set if only function 0 will be used in the
      slot. The test cases have been changed accordingly to illustrate.
      
      With this patch in place, if a user attempts to assign multiple
      functions in a slot without setting the multifunction bit for function
      0, libvirt will issue an error when the domain is defined, and the
      define operation will fail. In the future, we may decide to detect
      this situation and automatically add multifunction=on to avoid the
      error; even then it will still be useful to have a manual method of
      turning on multifunction since, as stated above, there are some
      devices that excpect it to be turned on for all functions in a slot.
      
      A side effect of this patch is that attempts to use the same PCI
      address for two different devices will now log an error (previously
      this would cause the domain define operation to fail, but there would
      be no log message generated). Because the function doing this log was
      almost completely rewritten, I didn't think it worthwhile to make a
      separate patch for that fix (the entire patch would immediately be
      obsoleted).
      c329db71
    • L
      conf: remove unused VIR_ENUM_DECL · be7bc4d5
      Laine Stump 提交于
      While adding a new enum, I noticed a VIR_ENUM_DECL for a type that
      doesn't exist. There is also of course no matching VIR_ENUM_IMPL for
      it.
      be7bc4d5
    • M
      virsh: do not unlink NULL file · 41bf4e72
      Marc-André Lureau 提交于
      error:could not take a screenshot of xp
      ==6216== Syscall param unlink(pathname) points to unaddressable byte(s)
      ==6216==    at 0x373A0D4937: unlink (syscall-template.S:82)
      ==6216==    by 0x40FD73: cmdScreenshot (virsh.c:3070)
      ==6216==    by 0x42BA0D: vshCommandRun (virsh.c:14920)
      ==6216==    by 0x42EC97: main (virsh.c:16379)
      ==6216==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
      ==6216==
      error:Requested operation is not valid: domain is not running
      41bf4e72
    • S
      lvm storage backend: handle command_names=1 in lvm.conf · 30f555c6
      Serge E. Hallyn 提交于
      If the regexes supported (?:pvs)?, then we could handle this by
      optionally matching but not returning the initial command name.  But it
      doesn't.  So add a new char* argument to
      virStorageBackendRunProgRegex().  If that argument is NULL then we act
      as usual.  Otherwise, if the string at that argument is found at the
      start of a returned line, we drop that before running the regex.
      
      With this patch, virt-manager shows me lvs with command_names 1 or 0.
      
      The definitions of PVS_BASE etc may want to be moved into the configure
      scripts (though given how PVS is found, IIUC that could only happen if
      pvs was a link to pvs_real), but in any case no sense dealing with that
      until we're sure this is an ok way to handle it.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      30f555c6
  7. 30 9月, 2011 1 次提交
    • M
      qemu: Check for outstanding async job too · a111b9e2
      Michal Privoznik 提交于
      Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
      outstanding synchronous job before (eventual) monitor entering.
      However, there can be already async job set, e.g. migration.
      a111b9e2
  8. 29 9月, 2011 10 次提交