1. 02 9月, 2011 19 次提交
    • M
      Add a new controller type 'usb' with optionnal 'model' · d6d54cd1
      Marc-André Lureau 提交于
      The model by default is piix3-uchi.
      
      Example:
      <controller type='usb' index='0' model='ich9-ehci'/>
      d6d54cd1
    • M
      Add USB controller models · 2e4b5243
      Marc-André Lureau 提交于
      List is: piix3-uhci piix4-uhci ehci ich9-ehci1 ich9-uhci1 ich9-uhci2
      ich9-uhci3 vt82c686b-uhci pci-ohci
      2e4b5243
    • M
      Rename virDomainControllerModel to virDomainControllerModelSCSI · 8631bdc0
      Marc-André Lureau 提交于
      Since we are about to add USB controller support let's remove the
      ambiguity
      8631bdc0
    • M
      Add various USB devices QEMU_CAPS · 329f907b
      Marc-André Lureau 提交于
      329f907b
    • E
      snapshot: fix corner case on OOM during creation · c554f6e1
      Eric Blake 提交于
      Commit 6766ff10 introduced a corner case bug with snapshot creation:
      if a snapshot is created, but then we hit OOM while trying to
      create the return value of the function, then we have polluted the
      internal directory with the snapshot metadata with no way to clean
      it up from the running libvirtd.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Don't
      write metadata file on OOM condition.
      c554f6e1
    • O
      Add directsync cache mode support for disk driver · 6ee52c1b
      Osier Yang 提交于
      Newer QEMU introduced cache=directsync for -drive, this patchset
      is to expose it in libvirt layer.
      
        * Introduced a new QEMU capability flag ($prefix_CACHE_DIRECTSYNC),
          As even $prefix_CACHE_V2 is set, we can't known if directsync
          is supported.
      6ee52c1b
    • O
      storage: Add fs pool formatting · 27758859
      Osier Yang 提交于
      This patch adds the ability to make the filesystem for a filesystem
      pool during a pool build.
      
      The patch adds two new flags, no overwrite and overwrite, to control
      when mkfs gets executed.  By default, the patch preserves the
      current behavior, i.e., if no flags are specified, pool build on a
      filesystem pool only makes the directory on which the filesystem
      will be mounted.
      
      If the no overwrite flag is specified, the target device is checked
      to determine if a filesystem of the type specified in the pool is
      present.  If a filesystem of that type is already present, mkfs is
      not executed and the build call returns an error.  Otherwise, mkfs
      is executed and any data present on the device is overwritten.
      
      If the overwrite flag is specified, mkfs is always executed, and any
      existing data on the target device is overwritten unconditionally.
      27758859
    • O
      API: Init conn in case of it might be used uninitialized · 50c82157
      Osier Yang 提交于
      There is a goto before "conn" is initialized.
      50c82157
    • E
      qemu: detect incomplete save files · 55d88def
      Eric Blake 提交于
      Several users have reported problems with 'virsh start' failing because
      it was encountering a managed save situation where the managed save file
      was incomplete.  Be more robust to this by using two different magic
      numbers, so that newer libvirt can gracefully handle an incomplete file
      differently than a complete one, while older libvirt will at least fail
      up front rather than trying to load only to have qemu fail at the end.
      
      Managed save is a convenience - it exists to preserve as much state
      as possible; if the state was not preserved, it is reasonable to just
      log that fact, then proceed with a fresh boot.  On the other hand,
      user saves are under user control, so we must fail, but by making
      the failure message distinct, the user can better decide how to handle
      the situation of an incomplete save file.
      
      * src/qemu/qemu_driver.c (QEMUD_SAVE_PARTIAL): New define.
      (qemuDomainSaveInternal): Use it to mark incomplete images.
      (qemuDomainSaveImageOpen, qemuDomainObjRestore): Add parameter
      that controls what to do with partial images.
      (qemuDomainRestoreFlags, qemuDomainSaveImageGetXMLDesc)
      (qemuDomainSaveImageDefineXML, qemuDomainObjStart): Update callers.
      Based on an initial idea by Osier Yang.
      55d88def
    • E
      qemu: refactor file opening · 449ae9c2
      Eric Blake 提交于
      In a SELinux or root-squashing NFS environment, libvirt has to go
      through some hoops to create a new file that qemu can then open()
      by name.  Snapshots are a case where we want to guarantee an empty
      file that qemu can open; also, reopening a save file to convert it
      from being marked partial to complete requires a reopen to avoid
      O_DIRECT headaches.  Refactor some existing code to make it easier
      to reuse in later patches.
      
      * src/qemu/qemu_migration.h (qemuMigrationToFile): Drop parameter.
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Let cgroup do
      the stat, rather than asking caller to do it and pass info down.
      * src/qemu/qemu_driver.c (qemuOpenFile): New function, pulled from...
      (qemuDomainSaveInternal): ...here.
      (doCoreDump, qemuDomainSaveImageOpen): Use it here as well.
      449ae9c2
    • W
      reserve slot 1 on pci bus0 · deff02a3
      Wen Congyang 提交于
      After supporting multi function pci device, we only reserve function 1 on slot 1.
      The user can use the other function on slot 1 in the xml config file. We should
      detect this wrong usage.
      deff02a3
    • S
      lxc: do not require 'ifconfig' or 'ipconfig' in container · f0fe28cb
      Scott Moser 提交于
      Currently, the lxc implementation invokes 'ip' and 'ifconfig' commands
      inside a container using 'virRun'.  That has the side effect of requiring
      those commands to be present and to function in a manner consistent with
      the usage.  Some small roots (such as ttylinux) may not have 'ip' or
      'ifconfig'.
      
      This patch replaces the use of these commands with usage of
      netdevice.  The result is that lxc containers do not have to implement
      those commands, and lxc in libvirt is only dependent on the netdevice
      interface.
      
      I've tested this patch locally against the ubuntu libvirt version enough
      to verify its generally sane.  I attempted to build upstream today, but
      failed with:
        /usr/bin/ld:
          ../src/.libs/libvirt_driver_qemu.a(libvirt_driver_qemu_la-qemu_domain.o):
         undefined reference to symbol 'xmlXPathRegisterNs@@LIBXML2_2.4.30
      
      Thats probably a local issue only, but I wanted to get this patch up and
      see what others thought of it.  This is ubuntu bug
      https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/828211 .
      f0fe28cb
    • S
      Create ptmx as a device · c1665ba8
      Serge Hallyn 提交于
      Hi,
      
      I'm seeing an issue with udev and libvirt-lxc.  Libvirt-lxc creates
      /dev/ptmx as a symlink to /dev/pts/ptmx.  When udev starts up, it
      checks the device type, sees ptmx is 'not right', and replaces it
      with a 'proper' ptmx.
      
      In lxc, /dev/ptmx is bind-mounted from /dev/pts/ptmx instead of being
      symlinked, so udev sees the right device type and leaves it alone.
      
      A patch like the following seems to work for me.  Would there be
      any objections to this?
      
      >From 4c5035de52de7e06a0de9c5d0bab8c87a806cba7 Mon Sep 17 00:00:00 2001
      From: Ubuntu <ubuntu@domU-12-31-39-14-F0-B3.compute-1.internal>
      Date: Wed, 31 Aug 2011 18:15:54 +0000
      Subject: [PATCH 1/1] make ptmx a bind mount rather than symlink
      
      udev on some systems checks the device type of /dev/ptmx, and replaces it if
      not as expected.  The symlink created by libvirt-lxc therefore gets replaced.
      By creating it as a bind mount, the device type is correct and udev leaves it
      alone.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      c1665ba8
    • A
      BlockPull: Set initial bandwidth limit if specified · d4b9e062
      Adam Litke 提交于
      The libvirt BlockPull API supports the use of an initial bandwidth limit but the
      qemu block_stream API does not.  To get the desired behavior we use the two APIs
      strung together: first BlockPull, then BlockJobSetSpeed.  We can do this at the
      driver level to avoid duplicated code in each monitor path.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      d4b9e062
    • A
      BlockJob: Bandwidth parameter is in MB when using text monitor · 78d9325d
      Adam Litke 提交于
      Due to an unfortunate precedent in qemu, the units for the bandwidth parameter
      to block_job_set_speed are different between the text monitor and the qmp
      monitor.  While the qmp monitor uses bytes/s, the text monitor expects MB/s.
      
      Correct the units for the text interface.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      78d9325d
    • J
      Increase size of buffer for xend response · 57c95175
      Jim Fehlig 提交于
      On systems with many pcpus, the sexpr returned by xend can be quite
      large for dom0 when it is configured to have #vcpus = #pcpus (default).
      E.g. on a 80 pcpu system, where dom0 had 80 vcpus, the sexpr details
      for dom0 was 73817 bytes!  Increase maximum buffer size to 256k.
      57c95175
    • J
      Don't overwrite errors from xend_{get,req} · 32620dab
      Jim Fehlig 提交于
      xenDaemonDomainFetch() was overwriting errors reported by
      xend_get() and xend_req().  E.g. without patch
      
      error: failed Xen syscall xenDaemonDomainFetch failed to find this domain
      
      with patch
      
      error: internal error Xend returned HTTP Content-Length of 73817, which exceeds
      maximum of 65536
      32620dab
    • E
      build: fix 'make check' with pdwtags · 7bc1c5ce
      Eric Blake 提交于
      Problem introduced by commit b12354be.
      
      * src/remote_protocol-structs: Remove spurious blank line.
      7bc1c5ce
    • J
      Add public API for getting migration speed · b12354be
      Jim Fehlig 提交于
      Includes impl of python binding since the generator was not
      able to cope.
      
      Note: Requires gendispatch.pl patch from Matthias Bolte
      
      https://www.redhat.com/archives/libvir-list/2011-August/msg01367.html
      b12354be
  2. 01 9月, 2011 12 次提交
    • D
      Fix tracking of RPC messages wrt streams · b3fb288e
      Daniel P. Berrange 提交于
      Commit 2c85644b attempted to
      fix a problem with tracking RPC messages from streams by doing
      
      -            if (msg->header.type == VIR_NET_REPLY) {
      +            if (msg->header.type == VIR_NET_REPLY ||
      +                (msg->header.type == VIR_NET_STREAM &&
      +                 msg->header.status != VIR_NET_CONTINUE)) {
                       client->nrequests--;
      
      In other words any stream packet, with status NET_OK or NET_ERROR
      would cause nrequests to be decremented. This is great if the
      packet from from a synchronous virStreamFinish or virStreamAbort
      API call, but wildly wrong if from a server initiated abort.
      The latter resulted in 'nrequests' being decremented below zero.
      This then causes all I/O for that client to be stopped.
      
      Instead of trying to infer whether we need to decrement the
      nrequests field, from the message type/status, introduce an
      explicit 'bool tracked' field to mark whether the virNetMessagePtr
      object is subject to tracking.
      
      Also add a virNetMessageClear function to allow a message
      contents to be cleared out, without adversely impacting the
      'tracked' field as a naive memset() would do
      
      * src/rpc/virnetmessage.c, src/rpc/virnetmessage.h: Add
        a 'bool tracked' field and virNetMessageClear() API
      * daemon/remote.c, daemon/stream.c, src/rpc/virnetclientprogram.c,
        src/rpc/virnetclientstream.c, src/rpc/virnetserverclient.c,
        src/rpc/virnetserverprogram.c: Switch over to use
        virNetMessageClear() and pass in the 'bool tracked' value
        when creating messages.
      b3fb288e
    • D
      Fix parted sector size assumption · b6263c18
      Daniel P. Berrange 提交于
      Parted does not report disk size in 512 byte units, but
      rather the disks' logical sector size, which with modern
      drives might be 4k.
      
      * src/storage/parthelper.c: Remove hardcoded 512 byte sector
        size
      b6263c18
    • O
      qemu: Fix a regression of domain save · 6f2581ed
      Osier Yang 提交于
      * src/qemu/qemu_driver.c - qemuDomainSaveInternal: Return directly
      will keep the domain object locked, introduced by 173015be.
      6f2581ed
    • O
      Revert "test: Cleanup improper VIR_ERR_NO_SUPPORT use" · 9f3e7243
      Osier Yang 提交于
      This reverts commit 172214bd.
      9f3e7243
    • O
      storage: Fix incorrect error codes · ffafede1
      Osier Yang 提交于
      Commit 0376f4a6 intended to fix incorrect use of VIR_ERR_NO_SUPPORT,
      but replacing it with VIR_ERR_OPERATION_INVALID is not proper either.
      ffafede1
    • O
      remote: Fix incorrect error codes · fd038a33
      Osier Yang 提交于
      Introduced by d4b53ef6. For "no internalFlags support", the
      error code is changed into INTERNAL_ERROR.
      fd038a33
    • O
      nodeinfo: Fix incorrect error codes · 03388b64
      Osier Yang 提交于
      Introduced by 5e495c8b, except the ones for checking if numa
      is supported by host, all the NO_SUPPORT are changed back. For
      the ones about numa checking, change them into INTERNAL_ERROR.
      03388b64
    • O
      lxc: Fix incorrect changes on error codes. · 6af0c3e8
      Osier Yang 提交于
      Fix incorrect changes introduced by commit 6ac47762.
      6af0c3e8
    • O
      conf: Substitute OPERATION_INVALID with INTERNAL_ERROR · c2c713dd
      Osier Yang 提交于
      c2c713dd
    • D
      Stop libxl driver polluting logs on non-Xen hosts · 6ff9fc26
      Daniel P. Berrange 提交于
      If the libxl driver is compiled in, then everytime libvirtd
      starts up on a non-Xen Dom0 host, it logs a error message.
      Since this is an expected condition, we should not log at
      'error' level, only 'info'.
      
      * src/libxl/libxl_driver.c: Lower log level for certain
        expected errors during driver init
      6ff9fc26
    • D
      Fix memory leak parsing 'relabel' attribute in domain security XML · d07aa6a9
      Daniel P. Berrange 提交于
      * src/conf/domain_conf.c: Free the 'relabel' attribute
      d07aa6a9
    • D
      Don't leak memory if a cgroup is mounted multiple times · c32536e7
      Daniel P. Berrange 提交于
      It is possible (expected/likely in Fedora 15) for a cgroup controller
      to be mounted in multiple locations at the same time, due to bind
      mounts. Currently we leak memory if this happens, because we overwrite
      the previous 'mountPoint' string. Instead just accept the first match
      we find.
      
      * src/util/cgroup.c: Only accept first match for a cgroup
        controller mount
      c32536e7
  3. 31 8月, 2011 6 次提交
    • E
      security: fix build · cab55fa0
      Eric Blake 提交于
      Regression introduced in commit 18338388.
      
      * src/libvirt_private.syms (security_manager.h): Drop deleted
      symbol. Detected by build-bot.
      cab55fa0
    • D
      Remove bogus virSecurityManagerSetProcessFDLabel method · 18338388
      Daniel P. Berrange 提交于
      The virSecurityManagerSetProcessFDLabel method was introduced
      after a mis-understanding from a conversation about SELinux
      socket labelling. The virSecurityManagerSetSocketLabel method
      should have been used for all such scenarios.
      
      * src/security/security_apparmor.c, src/security/security_apparmor.c,
        src/security/security_driver.h, src/security/security_manager.c,
        src/security/security_manager.h, src/security/security_selinux.c,
        src/security/security_stack.c: Remove SetProcessFDLabel driver
      18338388
    • D
      Fix sanlock socket security labelling · 64bdec38
      Daniel P. Berrange 提交于
      It is not possible to change the label of a TCP socket once it
      has been opened. When creating a TCP socket care must be taken
      to ensure the socket creation label is set & then cleared.
      Remove the bogus call to virSecurityManagerSetProcessFDLabel
      from the lock driver guest setup code and instead make use of
      virSecurityManagerSetSocketLabel
      64bdec38
    • D
      Fix incorrect path length check in sanlock lockspace setup · 2223b1f7
      Daniel P. Berrange 提交于
      The code for creating a sanlock lockspace accidentally used
      SANLK_NAME_LEN instead of SANLK_PATH_LEN for a size check.
      This meant disk paths were limited to 48 bytes !
      
      * src/locking/lock_driver_sanlock.c: Fix disk path length
        check
      2223b1f7
    • E
      snapshot: forbid snapshot on autodestroy domain · 173015be
      Eric Blake 提交于
      There is no reason to forbid pausing an autodestroy domain
      (not to mention that 'virsh start --paused --autodestroy'
      succeeds in creating a paused autodestroy domain).
      
      Meanwhile, qemu was failing to enforce the API documentation that
      autodestroy domains cannot be saved.  And while the original
      documentation only mentioned save/restore, snapshots are another
      form of saving that are close enough in semantics as to make no
      sense on one-shot domains.
      
      * src/qemu/qemu_driver.c (qemudDomainSuspend): Drop bogus check.
      (qemuDomainSaveInternal, qemuDomainSnapshotCreateXML): Forbid
      saves of autodestroy domains.
      * src/libvirt.c (virDomainCreateWithFlags, virDomainCreateXML):
      Document snapshot interaction.
      173015be
    • P
      Fix error detection in device change · 4521ffab
      Philipp Hahn 提交于
      According to qemu-kvm/qerror.c all messages start with a capital
      "Device ", but the current code only scans for the lower case "device ".
      This results in "virDomainUpdateDeviceFlags()" to not detect locked
      CD-ROMs and reporting success even in the case of a failure:
      	# virsh qemu-monitor-command "$VM" change\ drive-ide0-0-0\ \"/var/lib/libvirt/images/ucs_2.4-0-sec4-20110714145916-dvd-amd64.iso\"
      	Device 'drive-ide0-0-0' is locked
      	# virsh update-device "$VM" /dev/stdin <<<"<disk type='file' device='cdrom'><driver name='qemu' type='raw'/><source file='/var/lib/libvirt/images/ucs_2.4-0-sec4-20110714145916-dvd-amd64.iso'/><target dev='hda' bus='ide'/><readonly/><alias name='ide0-0-0'/><address type='drive' controller='0' bus='0' unit='0'/></disk>"
      	Device updated successfully
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      4521ffab
  4. 30 8月, 2011 3 次提交
    • E
      start: allow discarding managed save · 27c85260
      Eric Blake 提交于
      There have been several instances of people having problems with
      a broken managed save file, and not aware that they could use
      'virsh managedsave-remove dom' to fix things.  Making it possible
      to do this as part of starting a domain makes the same functionality
      easier to find, and one less API call.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_START_FORCE_BOOT): New
      flag.
      * src/libvirt.c (virDomainCreateWithFlags): Document it.
      * src/qemu/qemu_driver.c (qemuDomainObjStart): Alter signature.
      (qemuAutostartDomain, qemuDomainStartWithFlags): Update callers.
      * tools/virsh.c (cmdStart): Expose it in virsh.
      * tools/virsh.pod (start): Document it.
      27c85260
    • E
      build: simplify use of verify · 71a0beaf
      Eric Blake 提交于
      Back in 2008 when this line of util.h was written, gnulib's verify
      module didn't allow the use of multiple verify() in one file
      in combination with our choice of gcc -W options.  But that has
      since been fixed in gnulib, and newer gnulib even maps verify()
      to the C1x feature of _Static_assert, which gives even nicer
      diagnostics with a new enough compiler, so we might as well go
      with the simpler verify().
      
      * src/util/util.h (VIR_ENUM_IMPL): Use simpler verify, now that
      gnulib module is smarter.
      71a0beaf
    • E
      qemu: properly label outgoing pipe for tunneled migration · e6b8bc81
      Eric Blake 提交于
      Commit 32617617 made it possible to use pipes instead of sockets
      for outgoing tunneled migration; however, it caused a regression
      because the pipe was never given a SELinux label.
      
      * src/qemu/qemu_migration.c (doTunnelMigrate): Label outgoing pipe.
      e6b8bc81