1. 30 10月, 2011 1 次提交
    • M
      xenapi: Improve error reporting in xenapiOpen once again · 484460ec
      Matthias Bolte 提交于
      privP->session->error_description is a list and in order to get the
      complete error message all parts of the list should be concatenated.
      xenapiSessionErrorHandler does this when its third parameter is NULL.
      The current code discards all but the first part of the error message
      resulting in a potentially incomplete error message.
      
      This partly reverts 006be75e, that tried to avoid reporting
      a (null) in the error message. The actual problem is more general in
      returnErrorFromSession that might return NULL if there is no error.
      
      Make sure that returnErrorFromSession return non-NULL always. Also
      don't skip the last error message part.
      484460ec
  2. 29 10月, 2011 6 次提交
    • R
      macvtap: Fix error return value convention/inconsistencies · 228a9ec3
      Roopa Prabhu 提交于
      - changed some return 1's to return -1
      - changed if (rc) error checks to if (rc < 0)
      - fixed some other minor convention violations
      
      I might have missed some. Can fix in another patch or can respin
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      Reported-by: NEric Blake <eblake@redhat.com>
      Reported-by: NLaine Stump <laine@laine.org>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      228a9ec3
    • X
      pci address conflict when virtio disk with drive type · 5fb0de2e
      Xu He Jie 提交于
      When using the xml as below:
      ------------------------------------------------------
      <devices>
        <emulator>/home/soulxu/data/work-code/qemu-kvm/x86_64-softmmu/qemu-system-x86_64</emulator>
          <disk type='file' device='disk'>
          <driver name='qemu' type='qcow2'/>
          <source file='/home/soulxu/data/VM/images/linux.img'/>
          <target dev='vda' bus='virtio'/>
          <address type='drive' controller='0' bus='0' unit='0'/>
        </disk>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='-1' autoport='yes'/>
        <video>
          <model type='cirrus' vram='9216' heads='1'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
        </video>
        <memballoon model='virtio'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </memballoon>
      </devices>
      ------------------------------------------------------
      
      Then can't startup qemu, the error message as below:
      virsh # start test-vm
      error: Failed to start domain test-vm
      error: internal error process exited while connecting to monitor: qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by virtio-blk-pci
      qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: Device 'virtio-balloon-pci' could not be initialized
      
      So adding check for bus type and address type. Only the address of pci type support by virtio bus.
      Signed-off-by: NXu He Jie <xuhj@linux.vnet.ibm.com>
      5fb0de2e
    • E
      secret: fix bad patch application · 44477c57
      Eric Blake 提交于
      In hand-applying Josh and Sage's patch, I missed out on a break.
      
      * src/conf/secret_conf.c (virSecretDefFree): Fix my botch.
      44477c57
    • J
      storage: add auth to virDomainDiskDef · 5bd6271f
      Josh Durgin 提交于
      Add additional fields to let you specify the how to authenticate with a disk.
      The secret to use may be referenced by a usage string or a UUID, i.e.:
      
      <auth username='myuser'>
       <secret type='ceph' usage='secretname'/>
      </auth>
      
      or
      
      <auth username='myuser'>
       <secret type='ceph' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
      </auth>
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.com>
      5bd6271f
    • S
      secret: add Ceph secret type · 536d1f87
      Sage Weil 提交于
      Add a new secret type to store a Ceph authentication key. The name
      is simply an identifier for easy human reference.
      
      The xml looks like this:
      
      <secret ephemeral='no' private='no'>
       <uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
       <usage type='ceph'>
         <name>mycluster_admin</name>
       </usage>
      </secret>
      Signed-off-by: NSage Weil <sage@newdream.net>
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.net>
      536d1f87
    • A
      qemu: plug memory leak · 87b7e148
      Alex Jia 提交于
      Leak introduced in commit c1bc3d89.
      Detected by valgrind:
      
      ==18462== 1,100 bytes in 1 blocks are definitely lost in loss record 183 of 184
      ==18462==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==18462==    by 0x4A06167: realloc (vg_replace_malloc.c:525)
      ==18462==    by 0x4AADBB: virReallocN (memory.c:161)
      ==18462==    by 0x4A975E: virBufferGrow (buf.c:117)
      ==18462==    by 0x4A9D92: virBufferVasprintf (buf.c:290)
      ==18462==    by 0x4A9EF7: virBufferAsprintf (buf.c:263)
      ==18462==    by 0x429488: qemuBuildControllerDevStr (qemu_command.c:1993)
      ==18462==    by 0x42C4B6: qemuBuildCommandLine (qemu_command.c:3803)
      ==18462==    by 0x41A604: testCompareXMLToArgvHelper (qemuxml2argvtest.c:124)
      ==18462==    by 0x41BB81: virtTestRun (testutils.c:141)
      ==18462==    by 0x416DFF: mymain (qemuxml2argvtest.c:369)
      ==18462==    by 0x41B277: virtTestMain (testutils.c:696)
      ==18462==
      ==18462== LEAK SUMMARY:
      ==18462==    definitely lost: 1,100 bytes in 1 blocks
      ==18462==    indirectly lost: 0 bytes in 0 blocks
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Clean up on success.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      87b7e148
  3. 28 10月, 2011 14 次提交
    • E
      qemu: avoid leaking uninit data from hotplug to dumpxml · a4ca6e5d
      Eric Blake 提交于
      Detected by Coverity.  The fix in 2c27dfae didn't catch all bad
      instances of memcpy().  Thankfully, on further analysis, all of
      the problematic uses are only triggered by old qemu that lacks
      -device.
      
      * src/qemu/qemu_hotplug.c (qemuDomainAttachPciDiskDevice)
      (qemuDomainAttachNetDevice, qemuDomainAttachHostPciDevice): Init
      all fields since monitor only populates some of them.
      a4ca6e5d
    • R
      util: Fix virUUIDGeneratePseudoRandomBytes · 884b98ad
      Ryota Ozaki 提交于
      It forgets to move a pointer to a buffer for UUID and as a result
      fills only the first byte of the buffer.
      884b98ad
    • D
      Implement RPC driver support for virDomainOpenGraphics · d442599a
      Daniel P. Berrange 提交于
      Since it needs to access file descriptors passed in the msg,
      the RPC driver for virDomainOpenGraphics needs to be manually
      implemented.
      
      * daemon/remote.c: RPC server dispatcher
      * src/remote/remote_driver.c: RPC client dispatcher
      * src/remote/remote_protocol.x: Define protocol
      d442599a
    • D
      Extend RPC server to allow FD passing · 3ae0ab67
      Daniel P. Berrange 提交于
      The RPC server classes are extended to allow FDs to be received
      from clients with calls. There is not currently any way for a
      procedure to pass FDs back to the client with replies
      
      * daemon/remote.c, src/rpc/gendispatch.pl: Change virNetMessageHeaderPtr
        param to virNetMessagePtr in dispatcher impls
      * src/rpc/virnetserver.c, src/rpc/virnetserverclient.c,
        src/rpc/virnetserverprogram.c, src/rpc/virnetserverprogram.h:
        Extend to support FD passing
      3ae0ab67
    • D
      Add client side support for FD passing · 36a9c83d
      Daniel P. Berrange 提交于
      Extend the RPC client code to allow file descriptors to be sent
      to the server with calls, and received back with replies.
      
      * src/remote/remote_driver.c: Stub extra args
      * src/libvirt_private.syms, src/rpc/virnetclient.c,
        src/rpc/virnetclient.h, src/rpc/virnetclientprogram.c,
        src/rpc/virnetclientprogram.h: Extend APIs to allow
        FD passing
      36a9c83d
    • D
      Extend RPC protocol to allow FD passing · b0f996a6
      Daniel P. Berrange 提交于
      Define two new RPC message types VIR_NET_CALL_WITH_FDS and
      VIR_NET_REPLY_WITH_FDS. These message types are equivalent
      to VIR_NET_CALL and VIR_NET_REPLY, except that between the
      message header, and payload there is a 32-bit integer field
      specifying how many file descriptors have been passed.
      
      The actual file descriptors are sent/recv'd out of band.
      
      * src/rpc/virnetmessage.c, src/rpc/virnetmessage.h,
        src/libvirt_private.syms: Add support for handling
        passed file descriptors
      * src/rpc/virnetprotocol.x: Extend protocol for FD
        passing
      b0f996a6
    • D
      Add APIs for virNetSocket for sending/receiving file descriptors · 018044c8
      Daniel P. Berrange 提交于
      Add APIs to the virNetSocket object, to allow file descriptors
      to be sent/received over UNIX domain socket connections
      
      * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h,
        src/libvirt_private.syms: Add APIs for FD send/recv
      018044c8
    • D
      Wire up QEMU implementation for virDomainOpenGraphics · f877fed3
      Daniel P. Berrange 提交于
      The QEMU monitor command 'add_client' can be used to connect to
      a VNC or SPICE graphics display. This allows for implementation
      of the virDomainOpenGraphics API
      
      * src/qemu/qemu_driver.c: Implement virDomainOpenGraphics
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Add binding for 'add_client' command
      f877fed3
    • D
      Extend graphics event to include UNIX socket · 6aa27da2
      Daniel P. Berrange 提交于
      Not all VNC/SPICE servers use a TCP socket for their connections.
      It is possible to configure a UNIX socket server. The graphics
      event must thus include a UNIX socket address type.
      
      * include/libvirt/libvirt.h.in: Add UNIX socket address type
        for graphics event
      * src/qemu/qemu_monitor_json.c: Add 'unix' string to address
        type enum
      6aa27da2
    • D
      Introduce the virDomainOpenGraphics API · 9d96f1ce
      Daniel P. Berrange 提交于
      The virDomainOpenGraphics API allows a libvirt client to pass in
      a file descriptor for an open socket pair, and get it connected
      to the graphics display of the guest. This is limited to working
      with local libvirt hypervisors connected over a UNIX domain
      socket, since it will use UNIX FD passing
      
      * include/libvirt/libvirt.h.in: Define virDomainOpenGraphics
      * src/driver.h: Define driver for virDomainOpenGraphics
      * src/libvirt_public.syms, src/libvirt.c: Entry point for
        virDomainOpenGraphics
      * src/libvirt_internal.h: VIR_DRV_FEATURE_FD_PASSING
      9d96f1ce
    • T
      bridge: modify for use when sVirt is enabled with qemu · 27908453
      Tyler Coumbes 提交于
      This refactors the TAP creation code out of brAddTap into a new
      function brCreateTap to allow it to be used on its own. I have also
      changed ifSetInterfaceMac to brSetInterfaceMac and exported it since
      it is will be needed by code outside of util/bridge.c in the next
      patch.
      
       AUTHORS                 |    1 +
       src/libvirt_bridge.syms |    2 +
       src/util/bridge.c       |  116 +++++++++++++++++++++++++++++++----------------
       src/util/bridge.h       |    9 ++++
       4 files changed, 89 insertions(+), 39 deletions(-)
      27908453
    • J
      Use virXMLSaveFile when writing XML config · c0d9dfe2
      Jiri Denemark 提交于
      c0d9dfe2
    • J
      Introduce virXMLSaveFile as a wrapper for virFileRewrite · fef8127c
      Jiri Denemark 提交于
      Every time we write XML into a file we call virEmitXMLWarning to write a
      warning that the file is automatically generated. virXMLSaveFile
      simplifies this into a single step and makes rewriting existing XML file
      safe by using virFileRewrite internally.
      fef8127c
    • J
      Introduce virFileRewrite for safe file rewrite · 559644dd
      Jiri Denemark 提交于
      When saving config files we just overwrite old content of the file. In
      case something fails during that process (e.g. disk gets full) we lose
      both old and new content. This patch makes the process more robust by
      writing the new content into a separate file and only if that succeeds
      the original file is atomically replaced with the new one.
      559644dd
  4. 27 10月, 2011 10 次提交
    • D
      Add a systemtap script for watching QEMU monitor interactions · 9b76b08a
      Daniel P. Berrange 提交于
      This change adds some systemtap/dtrace probes to the QEMU monitor
      client code. In particular it allows watching of all operations
      for a VM
      
      * examples/systemtap/qemu-monitor.stp: Watch all monitor commands
      * src/Makefile.am: Passing libdir/bindir/sbindir to dtrace2systemtap.pl
      * src/dtrace2systemtap.pl: Accept libdir/bindir/sbindir as args
        and look for '# binary:' comment to mark probes against libvirtd
        vs libvirt.so
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c,
        src/qemu/qemu_monitor_text.c: Add probes for key functions
      9b76b08a
    • P
      lxc: Revert zeroing count of allocated items if VIR_REALLOC_N fails · 95d3b4de
      Peter Krempa 提交于
      Previous commit clears number of items alocated in lxcSetupLoopDevices
      if VIR_REALLOC_N fails. In that case, the pointer is not NULL, and
      causes leaking FDs that have been allocated.
      
       *  src/lxc/lxc_controller.c: revert zeroing array size
      95d3b4de
    • D
      Fix typo in virFileAccessibleAs · 838d8c1b
      Daniel P. Berrange 提交于
      * src/util/util.c: s/git_t/gid_t/ in parameter list of virFileAccessibleAs
      838d8c1b
    • A
      lxc: avoid null deref on lxcSetupLoopDevices failure · 3fd2b1e9
      Alex Jia 提交于
      If the function lxcSetupLoopDevices(def, &nloopDevs, &loopDevs) failed,
      the variable loopDevs will keep a initial NULL value, however, the
      function VIR_FORCE_CLOSE(loopDevs[i]) will directly deref it.
      
      This patch also fixes returning a bogous number of devices from
      lxcSetupLoopDevices on an error path.
      
      * rc/lxc/lxc_controller.c: fixed a null pointer dereference.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      3fd2b1e9
    • A
      lxc: avoid missing '{' in the function · d2dff425
      Alex Jia 提交于
      Cppcheck detected a syntaxError on lxcDomainInterfaceStats.
      
      * src/lxc/lxc_driver.c: fixed missing '{' in the function lxcDomainInterfaceStats.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      d2dff425
    • E
      qemu: simplify use of HAVE_YAJL · 6889f33e
      Eric Blake 提交于
      Rather than making all clients of monitor commands that are JSON-only
      check whether yajl support was compiled in, it is simpler to just
      avoid setting the capability bit up front if we can't use the capability.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Only set
      capability bit if we also have yajl library to use it.
      * src/qemu/qemu_driver.c (qemuDomainReboot): Drop #ifdefs.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * tests/qemuhelptest.c (testHelpStrParsing): Pass test even
      without yajl.
      * tests/qemuxml2argvtest.c (mymain): Simplify use of json flag.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-*.args:
      Update expected results to match.
      6889f33e
    • E
      snapshot: minor cleanups from reviewing indentation · cfa61a95
      Eric Blake 提交于
      Break some long lines, and use more efficient functions when possible,
      such as relying on virBufferEscapeString to skip output on a NULL arg.
      Ensure that output does not embed newlines, since auto-indent won't
      work in those situations.
      
      * src/conf/domain_conf.c (virDomainTimerDefFormat): Break output lines.
      (virDomainDefFormatInternal, virDomainDiskDefFormat)
      (virDomainActualNetDefFormat, virDomainNetDefFormat)
      (virDomainHostdevDefFormat): Minor cleanups.
      cfa61a95
    • E
      snapshot: simplify indentation of disk encryption xml · 4d8e20f6
      Eric Blake 提交于
      Use auto-indent in more places.
      
      * src/conf/storage_encryption_conf.h (virStorageEncryptionFormat):
      Drop parameter.
      * src/conf/storage_encryption_conf.c (virStorageEncryptionFormat)
      (virStorageEncryptionSecretFormat): Simplify with auto-indent.
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Adjust caller.
      * src/conf/storage_conf.c (virStorageVolTargetDefFormat): Likewise.
      4d8e20f6
    • E
      snapshot: simplify indentation of nwfilter · 46e1a426
      Eric Blake 提交于
      Fixing this involved some refactoring of common code out of
      domain_conf and nwfilter_conf into nwfilter_params.
      
      * src/conf/nwfilter_params.h (virNWFilterFormatParamAttributes):
      Adjust signature.
      * src/conf/nwfilter_params.c (_formatParameterAttrs)
      (virNWFilterFormatParamAttributes): Adjust indentation handling,
      and handle filterref here.
      (formatterParam): Delete unused struct.
      * src/conf/domain_conf.c (virDomainNetDefFormat): Adjust caller.
      * src/conf/nwfilter_conf.c (virNWFilterIncludeDefFormat): Likewise.
      46e1a426
    • E
      storage: avoid null deref on qemu-img failure · c04beb5d
      Eric Blake 提交于
      Detected by Coverity.  Only possible if qemu-img gives bogus output,
      but we might as well be robust.
      
      * src/storage/storage_backend.c
      (virStorageBackendQEMUImgBackingFormat): Check for strstr failure.
      c04beb5d
  5. 25 10月, 2011 9 次提交
    • D
      Add REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE to remote_protocol-structs · 806d4d81
      Daniel P. Berrange 提交于
      * src/remote_protocol-structs: Add new event
      806d4d81
    • M
      util: Add virFileAccessibleAs to private symbols · a877575a
      Michal Privoznik 提交于
      Commit 458b7099 introduced this
      function. However it was not added into libvirt_private.syms so
      the compilation may not succeed on some hosts.
      a877575a
    • M
      startupPolicy: Emit event on disk source dropping · baf2ff7e
      Michal Privoznik 提交于
      If a disk source gets dropped because it is not accessible,
      mgmt application might want to be informed about this. Therefore
      we need to emit an event. The event presented in this patch
      is however a bit superset of what written above. The reason is simple:
      an intention to be easily expanded, e.g. on 'user ejected disk
      in guest' events. Therefore, callback gets source string and disk alias
      (which should be unique among a domain) and reason (an integer);
      baf2ff7e
    • M
      qemu: implement startupPolicy · 12ba4322
      Michal Privoznik 提交于
      This patch implements on_missing feature in qemu driver.
      Upon qemu startup process an accessibility of CDROMs
      and floppy disks is checked. The source might get dropped
      if unavailable and on_missing is set accordingly.
      No event is emit thought. Look for follow up patch.
      12ba4322
    • M
      qemu: Move device alias assigning before command line construction · b8fbe5d5
      Michal Privoznik 提交于
      This patch is rather cosmetic as it only moves device alias
      assignation from command line construction just before that.
      However, it is needed in connotation of previous and next patch.
      b8fbe5d5
    • M
      util: Create virFileAccessibleAs function · 458b7099
      Michal Privoznik 提交于
      This function checks if a given path is accessible under
      given uid and gid.
      458b7099
    • M
      conf: Introduce optional startupPolicy attribute for cdrom and floppy · e5a84d74
      Michal Privoznik 提交于
      This attribute says what to do with cdrom (or floppy) if
      the source is missing. It accepts:
      - mandatory - fail if missing for any reason (the default)
      - requisite - fail if missing on boot up, drop if missing on
                    migrate/restore/revert
      - optional  - drop if missing at any start attempt.
      
      However, this patch introduces only XML part of this new
      functionality.
      e5a84d74
    • E
      storage: make previous leak less likely to regress · b1836a25
      Eric Blake 提交于
      Splitting into two functions allows the user to call the right
      function, rather than having to remember that a *Free function is
      an exception to the rule.
      
      * src/conf/storage_conf.h (virStoragePoolSourceClear): New function.
      * src/libvirt_private.syms (storage_conf.h): Export it.
      * src/conf/storage_conf.c (virStoragePoolSourceFree): Split...
      (virStoragePoolSourceClear): ...into new function.
      (virStoragePoolDefFree, virStoragePoolDefParseSourceString):
      Update callers.
      * src/test/test_driver.c (testStorageFindPoolSources): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemNetFindPoolSourcesFunc)
      (virStorageBackendFileSystemNetFindPoolSources): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalFindPoolSources): Likewise.
      b1836a25
    • E
      storage: plug iscsi memory leak · 79052a76
      Eric Blake 提交于
      Detected by Coverity.  virStoragePoolSourceFree does not free the
      actual passed-in pointer.  A bigger patch would be to rename it
      virStoragePoolSourceClear to match behavior, or even split it into
      two functions depending on needed behavior; but this is the minimal
      fix to the one location out of eight that leaked memory.
      
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Free memory.
      79052a76