1. 19 7月, 2011 2 次提交
    • D
      Add an explicit virNetClientClose method · e06c8ede
      Daniel P. Berrange 提交于
      Since the I/O callback registered against virNetSocket will
      hold a reference on the virNetClient, we can't rely on the
      virNetClientFree to be able to close the network connection.
      The last reference will only go away when the event callback
      fires (likely due to EOF from the server).
      
      This is sub-optimal and can potentially cause a leak of the
      virNetClient object if the server were to not explicitly
      close the socket itself
      
      * src/remote/remote_driver.c: Explicitly close the client
        object when disconnecting
      * src/rpc/virnetclient.c, src/rpc/virnetclient.h: Add a
        virNetClientClose method
      e06c8ede
    • E
      libvirt: do not mix internal flags into public API · 33ba6e68
      Eric Blake 提交于
      There were two API in driver.c that were silently masking flags
      bits prior to calling out to the drivers, and several others
      that were explicitly masking flags bits.  This is not
      forward-compatible - if we ever have that many flags in the
      future, then talking to an old server that masks out the
      flags would be indistinguishable from talking to a new server
      that can honor the flag.  In general, libvirt.c should forward
      _all_ flags on to drivers, and only the drivers should reject
      unknown flags.
      
      In the case of virDrvSecretGetValue, the solution is to separate
      the internal driver callback function to have two parameters
      instead of one, with only one parameter affected by the public
      API.  In the case of virDomainGetXMLDesc, it turns out that
      no one was ever mixing VIR_DOMAIN_XML_INTERNAL_STATUS with
      the dumpxml path in the first place; that internal flag was
      only used in saving and restoring state files, which happened
      to be in functions internal to a single file, so there is no
      mixing of the internal flag with a public flags argument.
      Additionally, virDomainMemoryStats passed a flags argument
      over RPC, but not to the driver.
      
      * src/driver.h (VIR_DOMAIN_XML_FLAGS_MASK)
      (VIR_SECRET_GET_VALUE_FLAGS_MASK): Delete.
      (virDrvSecretGetValue): Separate out internal flags.
      (virDrvDomainMemoryStats): Provide missing flags argument.
      * src/driver.c (verify): Drop unused check.
      * src/conf/domain_conf.h (virDomainObjParseFile): Delete
      declaration.
      (virDomainXMLInternalFlags): Move...
      * src/conf/domain_conf.c: ...here.  Delete redundant include.
      (virDomainObjParseFile): Make static.
      * src/libvirt.c (virDomainGetXMLDesc, virSecretGetValue): Update
      clients.
      (virDomainMemoryPeek, virInterfaceGetXMLDesc)
      (virDomainMemoryStats, virDomainBlockPeek, virNetworkGetXMLDesc)
      (virStoragePoolGetXMLDesc, virStorageVolGetXMLDesc)
      (virNodeNumOfDevices, virNodeListDevices, virNWFilterGetXMLDesc):
      Don't mask unknown flags.
      * src/interface/netcf_driver.c (interfaceGetXMLDesc): Reject
      unknown flags.
      * src/secret/secret_driver.c (secretGetValue): Update clients.
      * src/remote/remote_driver.c (remoteSecretGetValue)
      (remoteDomainMemoryStats): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainMemoryStats): Likewise.
      * daemon/remote.c (remoteDispatchDomainMemoryStats): Likewise.
      33ba6e68
  2. 14 7月, 2011 1 次提交
  3. 12 7月, 2011 2 次提交
    • D
      Define remote wire protocol & impls for virDomainQemuAttach · 44036460
      Daniel P. Berrange 提交于
      This tweaks the RPC generator to cope with some naming
      conventions used for the QEMU specific APIs
      
      * daemon/remote.c: Server side dispatcher
      * src/remote/remote_driver.c: Client side dispatcher
      * src/remote/qemu_protocol.x: Wire protocol definition
      * src/rpc/gendispatch.pl: Use '$structprefix' in method
        names, fix QEMU flags and fix dispatcher method names
      44036460
    • O
      remote/ssh: support for no_verify. · 9a0e6a8f
      Oskari Saarenmaa 提交于
      Set StrictHostKeyChecking=no to auto-accept new ssh host keys if the
      no_verify extra parameter was specified.  This won't disable host key
      checking for already known hosts.  Includes a test and documentation.
      9a0e6a8f
  4. 11 7月, 2011 1 次提交
    • A
      remote: Fix memory leak · 7518ad75
      Alex Jia 提交于
      Detected in valgrind run:
      
      ==9184== 1 bytes in 1 blocks are definitely lost in loss record 1 of 19
      ==9184==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==9184==    by 0x3073715F78: xdr_array (xdr_array.c:97)
      ==9184==    by 0x4CF97C9: xdr_remote_domain_get_security_label_ret (remote_protocol.c:1696)
      ==9184==    by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
      ==9184==    by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
      ==9184==    by 0x4CE3887: call (remote_driver.c:3933)
      ==9184==    by 0x4CF71C6: remoteDomainGetSecurityLabel (remote_driver.c:1580)
      ==9184==    by 0x4CCA480: virDomainGetSecurityLabel (libvirt.c:7340)
      ==9184==    by 0x41993A: cmdDominfo (virsh.c:2414)
      ==9184==    by 0x411E92: vshCommandRun (virsh.c:12730)
      ==9184==    by 0x4211ED: main (virsh.c:14076)
      ==9184==
      ==9184== 2 bytes in 1 blocks are definitely lost in loss record 2 of 19
      ==9184==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==9184==    by 0x3073715F78: xdr_array (xdr_array.c:97)
      ==9184==    by 0x4CF974F: xdr_remote_node_get_security_model_ret (remote_protocol.c:1713)
      ==9184==    by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
      ==9184==    by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
      ==9184==    by 0x4CE3887: call (remote_driver.c:3933)
      ==9184==    by 0x4CF6F96: remoteNodeGetSecurityModel (remote_driver.c:1648)
      ==9184==    by 0x4CBF799: virNodeGetSecurityModel (libvirt.c:7382)
      ==9184==    by 0x4197D7: cmdDominfo (virsh.c:2394)
      ==9184==    by 0x411E92: vshCommandRun (virsh.c:12730)
      ==9184==    by 0x4211ED: main (virsh.c:14076)
      ==9184==
      ==9184== 8 bytes in 1 blocks are definitely lost in loss record 3 of 19
      ==9184==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==9184==    by 0x3073715F78: xdr_array (xdr_array.c:97)
      ==9184==    by 0x4CF9729: xdr_remote_node_get_security_model_ret (remote_protocol.c:1710)
      ==9184==    by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
      ==9184==    by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
      ==9184==    by 0x4CE3887: call (remote_driver.c:3933)
      ==9184==    by 0x4CF6F96: remoteNodeGetSecurityModel (remote_driver.c:1648)
      ==9184==    by 0x4CBF799: virNodeGetSecurityModel (libvirt.c:7382)
      ==9184==    by 0x4197D7: cmdDominfo (virsh.c:2394)
      ==9184==    by 0x411E92: vshCommandRun (virsh.c:12730)
      ==9184==    by 0x4211ED: main (virsh.c:14076)
      ==9184==
      ==9184== LEAK SUMMARY:
      ==9184==    definitely lost: 11 bytes in 3 blocks
      
      * src/remote/remote_driver.c: Avoid leak on remoteDomainGetSecurityLabel
        and remoteNodeGetSecurityModel.
      7518ad75
  5. 08 7月, 2011 2 次提交
    • D
      Fix leak of remote driver if final 'CLOSE' RPC call fails · afe8839f
      Daniel P. Berrange 提交于
      When closing a remote connection we issue a (fairly pointless)
      'CLOSE' RPC call to the daemon. If this fails we skip all the
      cleanup of private data, but the virConnectPtr object still
      gets released as normal. This causes a memory leak. Since the
      CLOSE RPC call is pretty pointless, just carry on freeing the
      remote driver if it fails.
      
      * src/remote/remote_driver.c: Ignore failure to issue CLOSE
        RPC call
      afe8839f
    • E
      drivers: prefer unsigned int for flags · 1740c381
      Eric Blake 提交于
      Now that the public APIs always use unsigned flags, the internal
      driver callbacks might as well do likewise.
      
      * src/driver.h (vrDrvOpen, virDrvDomainCoreDump)
      (virDrvDomainGetXMLDesc, virDrvNetworkGetXMLDesc)
      (virDrvNWFilterGetXMLDesc): Update type.
      * src/remote/remote_protocol.x (remote_open_args)
      (remote_domain_core_dump_args, remote_domain_get_xml_desc_args)
      (remote_network_get_xml_desc_args)
      (remote_nwfilter_get_xml_desc_args): Likewise.
      * src/test/test_driver.c: Update clients.
      * src/remote/remote_driver.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * src/xen/xen_hypervisor.h: Likewise.
      * src/xen/xen_driver.c: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xm_internal.c: Likewise.
      * src/xen/xm_internal.h: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * src/xen/xs_internal.h: Likewise.
      * src/xen/xen_inotify.c: Likewise.
      * src/xen/xen_inotify.h: Likewise.
      * src/phyp/phyp_driver.c: Likewise.
      * src/openvz/openvz_driver.c: Likewise.
      * src/vmware/vmware_driver.c: Likewise.
      * src/vbox/vbox_driver.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xenapi/xenapi_driver.c: Likewise.
      * src/esx/esx_driver.c: Likewise.
      * src/esx/esx_interface_driver.c: Likewise.
      * src/esx/esx_network_driver.c: Likewise.
      * src/esx/esx_storage_driver.c: Likewise.
      * src/esx/esx_device_monitor.c: Likewise.
      * src/esx/esx_secret_driver.c: Likewise.
      * src/esx/esx_nwfilter_driver.c: Likewise.
      * src/interface/netcf_driver.c: Likewise.
      * src/nwfilter/nwfilter_driver.c: Likewise.
      * src/libxl/libxl_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/network/bridge_driver.c: Likewise.
      * src/secret/secret_driver.c: Likewise.
      * src/storage/storage_driver.c: Likewise.
      * src/node_device/node_device_hal.c: Likewise.
      * src/node_device/node_device_udev.c: Likewise.
      * src/remote_protocol-structs: Likewise.
      1740c381
  6. 01 7月, 2011 1 次提交
    • D
      Fix stream procedure number for virDomainMigratePrepareTunnel3 · 1414cc5f
      Daniel P. Berrange 提交于
      The virDomainMigratePrepareTunnel3 impl in the remote driver
      was using the procedure number for the virDomainMigratePrepareTunnel
      method. This doesn't work out so well, because it makes the server
      ignore & drop all stream packets
      
      * src/remote/remote_driver.c: Fix procedure for PrepareTunnel3
      1414cc5f
  7. 29 6月, 2011 3 次提交
    • D
      Fix locking wrt virNetClientStreamPtr object · 8a4e2874
      Daniel P. Berrange 提交于
      The client stream object can be used independently of the
      virNetClientPtr object, so must have full locking of its
      own and not rely on any caller.
      
      * src/remote/remote_driver.c: Remove locking around stream
        callback
      * src/rpc/virnetclientstream.c: Add locking to all APIs
        and callbacks
      8a4e2874
    • E
      remote: fix uninitialized variable · cf2affff
      Eric Blake 提交于
      Detected by gcc -O2:
      
      remote/remote_driver.c: In function 'doRemoteOpen':
      remote/remote_driver.c:2753:26: error: 'sasl' may be used uninitialized in this function [-Werror=uninitialized]
      
      * src/remote/remote_driver.c (remoteAuthSASL): Initialize sasl.
      cf2affff
    • D
      Convert the remote driver to new RPC client APIs · c1b22644
      Daniel P. Berrange 提交于
      This guts the current remote driver, removing all its networking
      handling code. Instead it calls out to the new virClientPtr and
      virClientProgramPtr APIs for all RPC & networking work.
      
      * src/Makefile.am: Link remote driver with generic RPC code
      * src/remote/remote_driver.c: Gut code, replacing with RPC
        API calls
      * src/rpc/gendispatch.pl: Update for changes in the way
        streams are handled
      c1b22644
  8. 28 6月, 2011 1 次提交
  9. 27 6月, 2011 1 次提交
    • E
      build: rename Vcpupin to VcpuPin · 28e45afc
      Eric Blake 提交于
      We already have a public virDomainPinVcpu, which implies that
      Pin and Vcpu are treated as separate words.  Unreleased commit
      e261987c introduced virDomainGetVcpupinInfo as the first public
      API that used Vcpupin, although we had prior internal uses of
      that spelling.  For consistency, change the spelling to be two
      words everywhere, regardless of whether pin comes first or last.
      
      * daemon/remote.c: Treat vcpu and pin as separate words.
      * include/libvirt/libvirt.h.in: Likewise.
      * src/conf/domain_conf.c: Likewise.
      * src/conf/domain_conf.h: Likewise.
      * src/driver.h: Likewise.
      * src/libvirt.c: Likewise.
      * src/libvirt_private.syms: Likewise.
      * src/libvirt_public.syms: Likewise.
      * src/libxl/libxl_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * tools/virsh.c: Likewise.
      * src/remote/remote_protocol.x: Likewise.
      * src/remote_protocol-structs: Likewise.
      Suggested by Matthias Bolte.
      28e45afc
  10. 25 6月, 2011 2 次提交
  11. 24 6月, 2011 2 次提交
  12. 21 6月, 2011 1 次提交
    • C
      Promote virEvent*Handle/Timeout to public API · 6094ad7b
      Cole Robinson 提交于
      Since we virEventRegisterDefaultImpl is now a public API, callers need
      a way to invoke the default registered Handle and Timeout functions. We
      already have general functions for these internally, so promote
      them to the public API.
      
      v2:
          Actually add APIs to libvirt.h
      6094ad7b
  13. 20 6月, 2011 1 次提交
  14. 17 6月, 2011 1 次提交
  15. 15 6月, 2011 5 次提交
  16. 13 6月, 2011 1 次提交
  17. 03 6月, 2011 1 次提交
    • E
      build: silence coverity false positive · 32ce66f5
      Eric Blake 提交于
      Coverity couldn't see that priv is NULL on failure.  But on failure,
      we might as well guarantee that callers don't try to free uninitialized
      memory.
      
      * src/remote/remote_driver.c (remoteGenericOpen): Even on failure,
      pass priv back to caller.
      32ce66f5
  18. 01 6月, 2011 4 次提交
  19. 29 5月, 2011 4 次提交
    • D
      Introduce a new event emitted when a virtualization failure occurs · a6135ec1
      Daniel P. Berrange 提交于
      This introduces a new domain
      
        VIR_DOMAIN_EVENT_ID_CONTROL_ERROR
      
      Which uses the existing generic callback
      
      typedef void (*virConnectDomainEventGenericCallback)(virConnectPtr conn,
                                                           virDomainPtr dom,
                                                           void *opaque);
      
      This event is intended to be emitted when there is a failure in
      some part of the domain virtualization system. Whether the domain
      continues to run/exist after the failure is an implementation
      detail specific to the hypervisor.
      
      The idea is that with some types of failure, hypervisors may
      prefer to leave the domain running in a "degraded" mode of
      operation. For example, if something goes wrong with the QEMU
      monitor, it is possible to leave the guest OS running quite
      happily. The mgmt app will simply loose the ability todo various
      tasks. The mgmt app can then choose how/when to deal with the
      failure that occured.
      * daemon/remote.c: Dispatch of new event
      * examples/domain-events/events-c/event-test.c: Demo catch
        of event
      * include/libvirt/libvirt.h.in: Define event ID and callback
      * src/conf/domain_event.c, src/conf/domain_event.h: Internal
        event handling
      * src/remote/remote_driver.c: Receipt of new event from daemon
      * src/remote/remote_protocol.x: Wire protocol for new event
      * src/remote_protocol-structs: add new event for checks
      a6135ec1
    • E
      remote: introduce remoteGetSchedulerParametersFlags · baa371ec
      Eric Blake 提交于
      * daemon/remote.c (remoteDispatchDomainGetSchedulerParameters):
      New function.
      * src/remote/remote_driver.c (remoteDomainGetSchedulerParameters):
      Likewise.
      * src/remote/remote_protocol.x
      (remote_domain_get_scheduler_parameters_flags_args)
      (remote_domain_get_scheduler_parameters_flags_ret): New types.
      (remote_procedure): New RPC.
      * src/remote_protocol-structs: Likewise.
      baa371ec
    • E
      remote: consolidate typed parameter handling · 8a47ed29
      Eric Blake 提交于
      * src/remote/remote_protocol.x (remote_typed_param_value)
      (remote_typed_param):  New types.
      (remote_sched_param_value, remote_sched_param)
      (remote_blkio_param_value, remote_blkio_param)
      (remote_memory_param_value, remote_memory_param): Delete.
      (remote_domain_get_scheduler_parameters_ret)
      (remote_domain_set_scheduler_parameters_args)
      (remote_domain_set_scheduler_parameters_flags_args)
      (remote_domain_set_blkio_parameters_args)
      (remote_domain_get_blkio_parameters_ret)
      (remote_domain_set_memory_parameters_args)
      (remote_domain_get_memory_parameters_ret): Update clients.
      * src/remote_protocol-structs: Likewise.
      * src/remote/remote_driver.c (remoteSerializeTypedParameters)
      (remoteDeserializeTypedParameters): New functions.
      (remoteDomainSetMemoryParameters)
      (remoteDomainGetMemoryParameters, remoteDomainSetBlkioParameters)
      (remoteDomainGetBlkioParameters)
      (remoteDomainGetSchedulerParameters)
      (remoteDomainSetSchedulerParameters)
      (remoteDomainSetSchedulerParametersFlags): Update clients.
      * daemon/remote.c (remoteSerializeTypedParameters)
      (remoteDeserializeTypedParameters): New functions.
      (remoteDispatchDomainGetSchedulerParameters)
      (remoteDispatchDomainSetSchedulerParameters)
      (remoteDispatchDomainSetSchedulerParametersFlags)
      (remoteDispatchDomainSetMemoryParameters)
      (remoteDispatchDomainGetMemoryParameters)
      (remoteDispatchDomainSetBlkioParameters)
      (remoteDispatchDomainGetBlkioParameters): Update clients.
      8a47ed29
    • E
      maint: prefer newer API names internally · 163e5f04
      Eric Blake 提交于
      Rather mechanical in nature.
      
      * src/driver.h: Use newer virTypedParameter API names.
      * src/libvirt.c: Likewise.
      * daemon/remote.c: Likewise.
      * src/esx/esx_driver.c: Likewise.
      * src/libxl/libxl_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/test/test_driver.c: Likewise.
      * src/xen/xen_driver.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * src/xen/xen_hypervisor.h: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * tools/virsh.c: Likewise.
      163e5f04
  20. 28 5月, 2011 1 次提交
  21. 26 5月, 2011 3 次提交