1. 04 11月, 2009 9 次提交
    • C
      Improve error reporting for virConnectGetHostname calls · 517761fd
      Cole Robinson 提交于
      All drivers have copy + pasted inadequate error reporting which wraps
      util.c:virGetHostname. Move all error reporting to this function, and improve
      what we report.
      
      Changes from v1:
        Drop the driver wrappers around virGetHostname. This means we still need
        to keep the new conn argument to virGetHostname, but I think it's worth
        it.
      517761fd
    • L
      Fix improper error return in virInterfaceDefParseProtoIPvX · af1e2ede
      Laine Stump 提交于
      * src/conf/interface_conf.c: the code was erronously returning -1
        in the two functions if <dhcp> is not provided
      af1e2ede
    • L
      Make monitor type (miimon/arpmon) optional in bond xml · 46843985
      Laine Stump 提交于
      * src/conf/interface_conf.c: lack of one of these in the live xml output
        was causing the parse in virInterfaceDefParseBond() to fail
      46843985
    • L
      Fix virInterfaceIpDefPtr leak during virInterfaceIpDefFree · 23eaae9a
      Laine Stump 提交于
      * src/conf/interface_conf.c: forgot to free the structure itself
      23eaae9a
    • L
      Support for IPv6 / multiple addresses per interfaces · 3d4c1d94
      Laine Stump 提交于
      This patch updates the xml parsing and formatting, and the associated
      virInterfaceDef data structure to support IPv6, along the way adding
      support for multiple protocols per interface, and multiple IP
      addresses per protocol.
      * src/conf/interface_conf.[ch]: update the structures, code for parsing
        and serialization
      3d4c1d94
    • L
      Support reporting live interface IP/netmask · 753c6c9c
      Laine Stump 提交于
      This patch adds the flag VIR_INTERFACE_XML_INACTIVE to
      virInterfaceGetXMLDesc's flags. When it is*not* set (the default), the
      live interface info will be returned in the XML (in particular, the IP
      address(es) and netmask(s) will be retrieved by querying the interface
      directly, rather than  reporting what's in the config file). The
      backend of this is in netcf's ncf_if_xml_state() function.
      
      * configure.in libvirt.spec.in: requires netcf >= 0.1.3
      * include/libvirt/libvirt.h.in: adds flag VIR_INTERFACE_XML_INACTIVE
      * src/conf/interface_conf.c src/interface/netcf_driver.c src/libvirt.c:
        update the parsing and backend routines accordingly
      * tools/virsh.c: change interface edit to inactive definition and
        adds the inactive flag for interface dump
      753c6c9c
    • L
      Make startmode optional in toplevel interface definition · ef591ef7
      Laine Stump 提交于
      The minimal XML returned from ncf_if_xml_state() doesn't contain this
      attribute (which makes no sense in the case of reporting current
      status of the interface), and it was preventing it from passing
      through the parse/format step.
      
      * src/conf/interface_conf.[ch]: add a new virInterfaceStartMode value
        and modify loading/saving accordingly
      ef591ef7
    • D
      Move libvirtd event loop into background thread · 075bb5f1
      Daniel P. Berrange 提交于
      The virStateInitialize() call for starting up stateful drivers
      may require that the event loop is running already. This it is
      neccessary to start the event loop before this call. At the
      same time, network clients must not be processed until afte
      virStateInitialize has completed.
      
      The qemudListenUnix() and remoteListenTCP() methods must
      therefore not register file handle watches, merely open the
      network sockets & listen() on them. This means clients can
      connected and are queued, pending completion of initialization
      
      The qemudRunLoop() method is moved into a background thread
      that is started early to allow access to the event loop during
      driver initialization. The main process thread leader pretty
      much does nothing once the daemon is running, merely waits
      for the event loop thread to quit
      
      * daemon/libvirtd.c, daemon/libvirtd.h: Move event loop into
        a background thread
      * daemon/THREADING.txt: Rewrite docs to better reflect reality
      075bb5f1
    • D
      give up python interpreter lock before calling cb · 9ae8fa58
      Dan Kenigsberg 提交于
      suggested by danpb on irc, patch by danken fixed for proper C syntax
      
      * python/libvirt-override.c: on event callback release the python
        interpreter lock and take it again when coming back so that the
        callback can reinvoke libvirt.
      9ae8fa58
  2. 03 11月, 2009 20 次提交
    • L
      Allow NULL mac address in virGetInterface · 4728bad4
      Laine Stump 提交于
      There are places where an interface will not have a mac address, and netcf
      returns this as a NULL pointer rather than a pointer to an empty string.
      Rather than checking for this all over the place in libvirt, just save it
      in the virInterface object as an empty string.
      
      * src/datatypes.c: allow NULL mac in virGetInterface()
      4728bad4
    • D
      Fix compilation problems · 112ed8f5
      Daniel Veillard 提交于
      introduced on commit 9231aa7d
      * src/qemu/qemu_driver.c: in qemudRemoveDomainStatus fix a reference
        to an undefined variable buf and free up an allocated string
      112ed8f5
    • C
      Fix up NLS warnings. · 991be604
      Chris Lalancette 提交于
      When building with --disable-nls, I got a few messages like this:
      
      storage/storage_backend.c: In function 'virStorageBackendCreateQemuImg':
      storage/storage_backend.c:571: warning: format not a string literal and no format arguments
      
      Fix these up.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      991be604
    • C
      Remove redundant virFileDeletePID() call · 9231aa7d
      Chris Lalancette 提交于
      qemudShutdownVMDaemon() calls qemudRemoveDomainStatus(), which
      then calls virFileDeletePID().  qemudShutdownVMDaemon() then
      unnecessarily calls virFileDeletePID() again.  Remove this second
      usage of it, and also slightly refactor qemudRemoveDomainStatus()
      to VIR_WARN appropriate error messages.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      9231aa7d
    • D
      Fix return value in virStateInitialize impl for LXC · 979218cd
      Daniel P. Berrange 提交于
      The LXC driver was mistakenly returning -1 for lxcStartup()
      in scenarios that are not an error. This caused the libvirtd
      to quit for unprivileged users. This fixes the return code
      of LXC driver, and also adds a "name" field to the virStateDriver
      struct and logging to make it easier to find these problems
      in the future
      
      * src/driver.h: Add a 'name' field to state driver to allow
        easy identification during failures
      * src/libvirt.c: Log name of failed driver for virStateInit
        failures
      * src/lxc/lxc_driver.c: Don't return a failure code for
        lxcStartup() if LXC is not available on this host, simply
        disable the driver.
      * src/network/bridge_driver.c, src/node_device/node_device_devkit.c,
        src/node_device/node_device_hal.c, src/opennebula/one_driver.c,
        src/qemu/qemu_driver.c, src/remote/remote_driver.c,
        src/secret/secret_driver.c, src/storage/storage_driver.c,
        src/uml/uml_driver.c, src/xen/xen_driver.c: Fill in name
        field in virStateDriver struct
      979218cd
    • M
      ESX: Fix memory leak in list handling functions. · 680c92ae
      Matthias Bolte 提交于
      If an error occurs between the allocation of an item and appending it
      to the list, the item leaks. Free such orphaned items in error cases.
      
      * src/esx/esx_vi.c: free orphaned items in error cases
      680c92ae
    • M
      ESX: Don't automatically follow redirects. · b79aaf91
      Matthias Bolte 提交于
      The default transport for the VI API is HTTPS. If the server redirects
      from HTTPS to HTTP the driver would silently follow that redirection.
      The user assumes to communicate with the server over a secure transport
      but isn't.
      
      This patch disables automatical redirection following. The driver reports
      an error if the server tries to redirect.
      
      * src/esx/esx_vi.c: refactor the call to curl_easy_perform() into a
        function and do error handling there, disable automatical redirection
        following for curl
      * src/esx/esx_vi.h: change the type of responseCode to int
      b79aaf91
    • M
      ESX: Unify naming of VI API utility and convenience functions. · 447ef886
      Matthias Bolte 提交于
      Unified function naming scheme:
      - 'lookup' functions query the ESX or vCenter for information
      - 'get' functions return information from a local object
      
      * src/esx/esx_driver.c, src/esx/esx_vi.[ch]: unify function naming
      447ef886
    • M
      ESX: Change disk selection for datastore detection. · 7c7681dd
      Matthias Bolte 提交于
      In order to register a new virtual machine the ESX driver needs to upload
      a VMX file to a datastore. Try to put this file beside the main VMDK file
      of the virtual machine. Change the disk selection for datastore detection
      to choose the first file-based harddisk instead of just the first disk.
      The first disk may be a CDROM disk and ISO images are normaly not located
      in the virtual machine's directory.
      
      * src/esx/esx_driver.c: change disk selection for datastore detection
      7c7681dd
    • M
      ESX: Fallback to the preliminary name if the datastore cannot be found. · b7abcf9d
      Matthias Bolte 提交于
      This allows to use domain-xml-from-native with VMX files that reference
      unavailable datastores.
      
      * src/esx/esx_vmx.c: fallback to the preliminary name if the datastore
        cannot be found
      b7abcf9d
    • D
      Rename internal APis · fc8d1991
      Daniel P. Berrange 提交于
      Rename virDomainIsActive to virDomainObjIsActive, and
      virInterfaceIsActive to virInterfaceObjIsActive and finally
      virNetworkIsActive to virNetworkObjIsActive.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/interface_conf.h, src/conf/network_conf.c,
        src/conf/network_conf.h, src/lxc/lxc_driver.c,
        src/network/bridge_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
        src/test/test_driver.c, src/uml/uml_driver.c: Update for
        renamed APIs.
      fc8d1991
    • M
      Fix --with-init-script configure option · 958c366b
      Matthew Booth 提交于
      * configure.in daemon/Makefile.am: the --with-init-script configure
        option was broken, and always defaulted based on the existence of
        /etc/redhat-release. This was a systematic typo based on
        mixed use of init-script and init-scripts.
      958c366b
    • D
      Don't let parent of daemon exit until basic initialization is done · 4296cea2
      Daniel P. Berrange 提交于
      The daemonizing code lets the parent exit almost immediately. This
      means that it may think it has successfully started even when
      important failures occur like not being able to acquire the PID
      file. It also means network sockets are not yet open.
      
      To address this when daemonizing the parent passes an open pipe
      file descriptor to the child. The child does its basic initialization
      and then writes a status code to the pipe indicating either success,
      or failure. This ensures that when daemonizing, the parent does not
      exit until the pidfile is acquired & basic network sockets are open.
      
      Initialization of the libvirt drivers is still done asynchronously
      since this may take a very long time.
      
      * daemon/libvirtd.c: Force parent to stay around until basic config
        file, pidfile & network socket init is completed
      4296cea2
    • D
      Pull signal setup code out into separate method · a71f79c3
      Daniel P. Berrange 提交于
      * daemon/libvirtd.c: Introduce a daemonSetupSignals() method
        and put all signal handling code there
      * daemon/libvirtd.h: Add sigread/sigwrite to qemud_server type
      a71f79c3
    • Y
      Set KMEMSIZE for OpenVZ domains being defined · 8001eef5
      Yuji NISHIDA 提交于
      * src/openvz/openvz_driver.c: add a new openvzDomainSetMemoryInternal()
        function, used to initialize the KMEMSIZE parameter of a container.
      8001eef5
    • D
      Fix duplicating logging of errors in libvirtd · 4ab79958
      Daniel P. Berrange 提交于
      The libvirt default error handling callback will print all errors
      to stderr. The libvirtd default logging callback will do the same.
      Set a no-op error handling callback in libvirtd to prevent this
      duplication
      
      * daemon/libvirtd.c: Register a no-op error handling function
      4ab79958
    • D
      Fix initialization order bugs · 5f672538
      Daniel P. Berrange 提交于
      virInitialize must be the first libvirt function called to ensure
      threads, error handling & random number generator are all setup.
      
      Move UNIX socket directory permissions change to place of use
      5f672538
    • D
      Misc cleanup to network socket init · 0264e167
      Daniel P. Berrange 提交于
      * daemon/libvirtd.c: Change qemudNetworkInit() so that it doesn't try
      to free its argument, leaving the caller todo cleanup as is normal
      practice. Add missing policykit cleanup to qemudCleanup, and remove
      server watch if set. Remove duplicated call to listen() on TCP sockets
      0264e167
    • D
      Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems · 46992453
      Daniel P. Berrange 提交于
      Nearly all of the methods in src/util/util.h have error codes that
      must be checked by the caller to correct detect & report failure.
      Add ATTRIBUTE_RETURN_CHECK to ensure compile time validation of
      this
      
      * daemon/libvirtd.c: Add explicit check on return value of virAsprintf
      * src/conf/domain_conf.c: Add missing check on virParseMacAddr return
        value status & report error
      * src/network/bridge_driver.c: Add missing OOM check on virAsprintf
        and report error
      * src/qemu/qemu_conf.c: Add missing check on virParseMacAddr return
        value status & report error
      * src/security/security_selinux.c: Remove call to virRandomInitialize
        that's done in libvirt.c already
      * src/storage/storage_backend_logical.c: Add check & log on virRun
        return status
      * src/util/util.c: Add missing checks on virAsprintf/Run status
      * src/util/util.h: Annotate all methods with ATTRIBUTE_RETURN_CHECK
        if they return an error status code
      * src/vbox/vbox_tmpl.c: Add missing check on virParseMacAddr
      * src/xen/xm_internal.c: Add missing checks on virAsprintf
      * tests/qemuargv2xmltest.c: Remove bogus call to virRandomInitialize()
      46992453
    • D
      Allow for a driver specific private data blob in virDomainObjPtr · 3505790b
      Daniel P. Berrange 提交于
      The virDomainObjPtr object stores state about a running domain.
      This object is shared across all drivers so it is not appropriate
      to include driver specific state here. This patch adds the ability
      to request a blob of private data per domain object instance. The
      driver must provide a allocator & deallocator for this purpose
      
      THis patch abuses the virCapabilitiesPtr structure for storing the
      allocator/deallocator callbacks, since it is already being abused
      for other internal things relating to parsing. This should be moved
      out into a separate object at some point.
      
      * src/conf/capabilities.h: Add privateDataAllocFunc and
        privateDataFreeFunc fields
      * src/conf/domain_conf.c: Invoke the driver allocators / deallocators
        when creating/freeing virDomainObjPtr instances.
      * src/conf/domain_conf.h: Pass virCapsPtr into virDomainAssignDef
        to allow access to the driver specific allocator function
      * src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
        src/test/test_driver.c, src/uml/uml_driver.c: Update for
        change in virDomainAssignDef contract
      3505790b
  3. 02 11月, 2009 2 次提交
  4. 30 10月, 2009 5 次提交
  5. 29 10月, 2009 2 次提交
    • D
      Convert virDomainObjListPtr to use a hash of domain objects · a3adcce7
      Daniel P. Berrange 提交于
      The current virDomainObjListPtr object stores domain objects in
      an array. This means that to find a particular objects requires
      O(n) time, and more critically acquiring O(n) mutex locks.
      
      The new impl replaces the array with a virHashTable, keyed off
      UUID. Finding a object based on UUID is now O(1) time, and only
      requires a single mutex lock. Finding by name/id is unchanged
      in complexity.
      
      In changing this, all code which iterates over the array had
      to be updated to use a hash table iterator function callback.
      Several of the functions which were identically duplicating
      across all drivers were pulled into domain_conf.c
      
      * src/conf/domain_conf.h, src/conf/domain_conf.c: Change
        virDomainObjListPtr to use virHashTable. Add a initializer
        method virDomainObjListInit, and rename virDomainObjListFree
        to virDomainObjListDeinit, since its not actually freeing
        the container, only its contents. Also add some convenient
        methods virDomainObjListGetInactiveNames,
        virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
        which can be used to implement the correspondingly named
        public API entry points in drivers
      * src/libvirt_private.syms: Export new methods from domain_conf.h
      * src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
        src/qemu/qemu_driver.c, src/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
        to deal with hash tables instead of arrays for domains
      a3adcce7
    • M
      libvirt-devel should only require libvirt-client · 1acef95a
      Mark McLoughlin 提交于
      There's a long known issue where if you install libvirt in a guest,
      the default virtual network will conflict with the default virtual
      network in the host.
      
      That's one of the reasons we have the libvirt-client RPM - it allows
      you to install the client library without having the host side
      installed.
      
      Rich Jones points out that if you install libvirt-devel in a guest,
      then you get libvirtd installed and the network conflict:
      
        https://bugzilla.redhat.com/531200
      
      libvirt-devel should only require libvirt-client - e.g. nothing in
      the devel package pertains to anything in the libvirt RPM. The Fedora
      packaging guidelines say:
      
        https://fedoraproject.org/wiki/Packaging/Guidelines#Devel_Packages
      
        Devel packages must require the base package using a fully versioned
        dependency ...
      
      But for all intents and purposes, libvirt-client is our base RPM.
      
      * libvirt.spec.in: make libvirt-devel require libvirt-client
      1acef95a
  6. 28 10月, 2009 2 次提交