1. 01 9月, 2011 14 次提交
    • 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
      Avoid use-after-free on streams, due to message callbacks · 1b72ad2e
      Daniel P. Berrange 提交于
      When sending outbound stream RPC messages, a callback is
      used to re-enable stream data transmission. If the stream
      aborts while one of these messages is outstanding, the
      stream may have been free'd by the time it is invoked. This
      results in a use-after-free error
      
      * daemon/stream.c: Ref-count streams to avoid use-after-free
      1b72ad2e
    • 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
      Fix memory leak dispatching domain events · a91d3115
      Daniel P. Berrange 提交于
      When dispatching domain events we will create an XDR struct
      containing the event info. Some of this data may be allocated
      on the heap and so must be freed. The graphics event dispatcher
      had a broken attempt to free one field, but missed others. All
      the events have a dom->name string that needs freeing. The code
      should have used the xdr_free() procedure for doing all this
      
      * daemon/remote.c: Use xdr_free after dispatching events
      a91d3115
    • 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
  2. 31 8月, 2011 7 次提交
    • 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
    • G
      stream: remove redundant reference to client while sending stream data · 0e5c4ab7
      Guannan Ren 提交于
          *daemon/stream.c: remove virNetServerClientRef()
      0e5c4ab7
    • 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
  3. 30 8月, 2011 4 次提交
    • 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
    • G
      rpc: fix a typo in debugging log in virNetServerProgramSendStreamData · bae460fc
      Guannan Ren 提交于
      The bufferOffset has been initialized to zero in virNetMessageEncodePayloadRaw(),
      so, we use bufferLength to represent the length of message which is going to be
      sent to client side.
      bae460fc
  4. 27 8月, 2011 2 次提交
  5. 26 8月, 2011 13 次提交
    • M
      hyperv: Add basic documentation · 2137cb19
      Matthias Bolte 提交于
      2137cb19
    • M
      hyperv: Add basic driver for Microsoft Hyper-V · 5e3b0f8b
      Matthias Bolte 提交于
      Domain listing, basic information retrieval and domain life cycle
      management is implemented. But currently the domain XML output
      lacks the complete devices section.
      
      The driver uses OpenWSMAN to directly communicate with a Hyper-V
      server over its WS-Management interface exposed via Microsoft WinRM.
      
      The driver is based on the work of Michael Sievers. This started in
      the same master program project group at the University of Paderborn
      as the ESX driver.
      
      See Michael's blog for details: http://hyperv4libvirt.wordpress.com/
      5e3b0f8b
    • M
      hyperv: Add OpenWSMAN based client for the Hyper-V WMI API · e224b6f8
      Matthias Bolte 提交于
      Add a generator script to generate the structs and serialization
      information for OpenWSMAN.
      
      openwsman.h collects workarounds for problems in OpenWSMAN <= 2.2.6.
      There are also disabled sections that would use ws_serializer_free_mem
      but can't because it's broken in OpenWSMAN <= 2.2.6. Patches to fix
      this have been posted upstream.
      e224b6f8
    • M
      hyperv: Add driver skeleton · 4d6e6f4a
      Matthias Bolte 提交于
      4d6e6f4a
    • M
      hyperv: Add configure check for OpenWSMAN · f2e70643
      Matthias Bolte 提交于
      f2e70643
    • T
      schedinfo: update man page about virsh schedinfo command · 5f57c485
      Taku Izumi 提交于
      This patch updates the man page about virsh schedinfo command.
      
       - fix typo: 1844674407370955 -> 18446744073709551
       - describe the value 0 of vcpu_period and vcpu_quota parameters
      Signed-off-by: NTaku Izumi <izumi.taku@jp.fujitsu.com>
      5f57c485
    • K
      Fix persistent migration config save · 709b4c50
      KAMEZAWA Hiroyuki 提交于
      When a user migrates a domain by command as
      
      libvirt saves vm's domain XML config in destination host after migration.
      But it saves vm->def. Then, the saved XML contains some garbage.
      
        <domain type='kvm' id='50'>
                           ^^^^^^^^
        ...
         <console type='pty' tty='/dev/pts/5'>
                             ^^^^^^^^^^^^^^^^^
      
      Avoid saving unnecessary things by saving persistent vm definition.
      709b4c50
    • J
      rpc: Don't close connection if program is unknown · 22d744d0
      Jiri Denemark 提交于
      In case we add a new program in the future (we did that in the past and
      we are going to do it again soon) current daemon will behave badly with
      new client that wants to use the new program. Before the RPC rewrite we
      used to just send an error reply to any request with unknown program.
      With the RPC rewrite in 0.9.3 the daemon just closes the connection
      through which such request was sent. This patch fixes this regression.
      22d744d0
    • M
      remote: Refuse connecting to remote socket · c4f91b14
      Michal Privoznik 提交于
      If users wants to connect to remote unix socket, e.g.
      'qemu+unix://<remote>/system' currently the <remote> part is ignored,
      ending up connecting to localhost. Connecting to remote socket is not
      supported and user should have used TLS/TCP/SSH instead.
      c4f91b14
    • M
      virterror: Fix error message for VIR_ERR_INVALID_ARG · 6c7299d4
      Michal Privoznik 提交于
      When a detail message is presented, nobody expects prefix 'invalid
      argument in' but something more general, like 'invalid argument:'.
      6c7299d4
    • D
      Detect errors from the 'sendkey' command · 6b434da6
      Daniel P. Berrange 提交于
      On success, the 'sendkey' command does not return any data, so
      any data in the reply should be considered to be an error
      message
      
      * src/qemu/qemu_monitor_text.c: Treat non-"" reply data as an
        error message for 'sendkey' command
      6b434da6
    • D
      Fix keymap used to talk with QEMU · ce93f64b
      Daniel P. Berrange 提交于
      The QEMU 'sendkey' command expects keys to be encoded in the same
      way as the RFB extended keycode set. Specifically it wants extended
      keys to have the high bit of the first byte set, while the Linux
      XT KBD driver codeset uses the low bit of the second byte. To deal
      with this we introduce a new keymap 'RFB' and use that in the QEMU
      driver
      
      * include/libvirt/libvirt.h.in: Add VIR_KEYCODE_SET_RFB
      * src/qemu/qemu_driver.c: Use RFB keycode set instead of XT KBD
      * src/util/virkeycode-mapgen.py: Auto-generate the RFB keycode
        set from the XT KBD set
      * src/util/virkeycode.c: Add RFB keycode entry to table. Add a
        verify check on cardinality of the codeOffset table
      ce93f64b
    • J
      virsh: Clarify documentation of -d option · 7ac78e32
      Jiri Denemark 提交于
      The default is 4, not 0.
      7ac78e32