1. 07 8月, 2012 7 次提交
    • D
      Turn virKeepAlive into a virObject · 2303e920
      Daniel P. Berrange 提交于
      Make virKeepAlive use the virObject APIs for reference counting
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2303e920
    • D
      Turn virNetSASLContext and virNetSASLSession into virObject instances · 0b4d3fe5
      Daniel P. Berrange 提交于
      Make virNetSASLContext and virNetSASLSession use virObject APIs
      for reference counting
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0b4d3fe5
    • D
      Turn virNetTLSContext and virNetTLSSession into virObject instances · e10e1969
      Daniel P. Berrange 提交于
      Make virNetTLSContext and virNetTLSSession use the virObject
      APIs for reference counting
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e10e1969
    • D
      Turn qemuAgentPtr and qemuMonitorPtr into virObjectPtr instances · b57ee092
      Daniel P. Berrange 提交于
      Make qemuAgentPtr and qemuMonitorPtr types use the virObject APIs
      for reference counting
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b57ee092
    • D
      Turn virDomainObjPtr into a virObjectPtr · 31cb030a
      Daniel P. Berrange 提交于
      Switch virDomainObjPtr to use the virObject APIs for reference
      counting. The main change is that virObjectUnref does not return
      the reference count, merely a bool indicating whether the object
      still has any refs left. Checking the return value is also not
      mandatory.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      31cb030a
    • D
      Convert public datatypes to inherit from virObject · 46ec5f85
      Daniel P. Berrange 提交于
      This converts the following public API datatypes to use the
      virObject infrastructure:
      
        virConnectPtr
        virDomainPtr
        virDomainSnapshotPtr
        virInterfacePtr
        virNetworkPtr
        virNodeDevicePtr
        virNWFilterPtr
        virSecretPtr
        virStreamPtr
        virStorageVolPtr
        virStoragePoolPtr
      
      The code is significantly simplified, since the mutex in the
      virConnectPtr object now only needs to be held when accessing
      the per-connection virError object instance. All other operations
      are completely lock free.
      
      * src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
        public datatypes to use virObject
      * src/conf/domain_event.c, src/phyp/phyp_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c, src/storage/storage_driver.c,
        src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
        tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
        tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
        to use virObjectUnref/virObjectRef
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      46ec5f85
    • D
      Add a generic reference counted virObject type · 784a99f7
      Daniel P. Berrange 提交于
      This introduces a fairly basic reference counted virObject type
      and an associated virClass type, that use atomic operations for
      ref counting.
      
      In a global initializer (recommended to be invoked using the
      virOnceInit API), a virClass type must be allocated for each
      object type. This requires a class name, a "dispose" callback
      which will be invoked to free memory associated with the object's
      fields, and the size in bytes of the object struct.
      
      eg,
      
         virClassPtr  connclass = virClassNew("virConnect",
                                              sizeof(virConnect),
                                              virConnectDispose);
      
      The struct for the object, must include 'virObject' as its
      first member
      
      eg
      
        struct _virConnect {
          virObject object;
      
          virURIPtr uri;
        };
      
      The 'dispose' callback is only responsible for freeing
      fields in the object, not the object itself. eg a suitable
      impl for the above struct would be
      
        void virConnectDispose(void *obj) {
           virConnectPtr conn = obj;
           virURIFree(conn->uri);
        }
      
      There is no need to reset fields to 'NULL' or '0' in the
      dispose callback, since the entire object will be memset
      to 0, and the klass pointer & magic integer fields will
      be poisoned with 0xDEADBEEF before being free()d
      
      When creating an instance of an object, one needs simply
      pass the virClassPtr eg
      
         virConnectPtr conn = virObjectNew(connclass);
         if (!conn)
            return NULL;
         conn->uri = virURIParse("foo:///bar")
      
      Object references can be manipulated with
      
         virObjectRef(conn)
         virObjectUnref(conn)
      
      The latter returns a true value, if the object has been
      freed (ie its ref count hit zero)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      784a99f7
  2. 06 8月, 2012 7 次提交
    • R
      apparmor: QEMU bridge helper policy updates · b0e47898
      Richa Marwaha 提交于
      This patch provides AppArmor policy updates for the QEMU bridge helper.
      The QEMU bridge helper is a SUID executable exec'd by QEMU that drops
      capabilities to CAP_NET_ADMIN and adds a tap device to a network bridge.
      Signed-off-by: NRicha Marwaha <rmarwah@linux.vnet.ibm.com>
      Signed-off-by: Corey Bryant<coreyb@linux.vnet.ibm.com>
      b0e47898
    • R
      Add -netdev bridge support · e060f864
      Richa Marwaha 提交于
      This patch adds the support to run the QEMU network helper
      under unprivileged user. It also adds the support for
      attach-interface option in virsh to run under unprivileged
      user.
      Signed-off-by: NRicha Marwaha <rmarwah@linux.vnet.ibm.com>
      Signed-off-by: Corey Bryant<coreyb@linux.vnet.ibm.com>
      e060f864
    • R
      Add -netdev bridge capabilities · 756fe786
      Richa Marwaha 提交于
      This patch adds the capability in libvirt to check if
      -netdev bridge option is supported or not.
      Signed-off-by: NRicha Marwaha <rmarwah@linux.vnet.ibm.com>
      Signed-off-by: Corey Bryant<coreyb@linux.vnet.ibm.com>
      756fe786
    • E
      virrandom: make virRandomInitialize an automatic one-shot · 87de27b7
      Eric Blake 提交于
      All callers used the same initialization seed (well, the new
      viratomictest forgot to look at getpid()); so we might as well
      make this value automatic.  And while it may feel like we are
      giving up functionality, I documented how to get it back in the
      unlikely case that you actually need to debug with a fixed
      pseudo-random sequence.  I left that crippled by default, so
      that a stray environment variable doesn't cause a lack of
      randomness to become a security issue.
      
      * src/util/virrandom.c (virRandomInitialize): Rename...
      (virRandomOnceInit): ...and make static, with one-shot call.
      Document how to do fixed-seed debugging.
      * src/util/virrandom.h (virRandomInitialize): Drop prototype.
      * src/libvirt_private.syms (virrandom.h): Don't export it.
      * src/libvirt.c (virInitialize): Adjust caller.
      * src/lxc/lxc_controller.c (main): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/util/iohelper.c (main): Likewise.
      * tests/seclabeltest.c (main): Likewise.
      * tests/testutils.c (virtTestMain): Likewise.
      * tests/viratomictest.c (mymain): Likewise.
      87de27b7
    • E
      build: drop conditional use of mdns code · 1d5bc382
      Eric Blake 提交于
      Commit 1f6f723c missed a step.  At first I was worried that scrubbing
      the conditionals would lead to a runtime failure when compiled without
      avahi, but my testing makes it appear that the runtime error will only
      occur if the .conf files in /etc request mdns advertisement; and the
      old behavior was to silently ignore the request, so this is actually
      a better behavior of only failing when the config requests the
      impossible.
      
      * src/rpc/virnetserver.c: Drop HAVE_AVAHI conditionals; all
      callers already passed NULL if mdns_adv was not configured.
      1d5bc382
    • M
      qemu: Set reasonable RSS limit on domain startup · addeb7cd
      Michal Privoznik 提交于
      If there's a memory leak in qemu or qemu is exploited the host's
      system will sooner or later start trashing instead of killing
      the bad process. This however has impact on performance and other
      guests as well. Therefore we should set a reasonable RSS limit
      even when user hasn't set any. It's better to be secure by default.
      addeb7cd
    • O
      virsh: Use vshPrint instead of printf · e534ec66
      Osier Yang 提交于
      e534ec66
  3. 04 8月, 2012 5 次提交
    • J
      xen-xm: Generate UUID if not specified · 1fbdfc53
      Jim Fehlig 提交于
      Parsing xen-xm format configuration will fail if UUID is not
      specified, e.g.
      
      virsh domxml-from-native xen-xm some-config-without-uuid
      error: internal error parsing xm config failed
      
      Initially I thought to skip parsing the UUID in xenParseXM() when
      not present in the configuration, but this results in a UUID of
      all zeros since it is never set
      
      virsh domxml-from-native xen-xm /tmp/jim/bug-773621_pierre-test
      <domain type='xen'>
        <name>test</name>
        <uuid>00000000-0000-0000-0000-000000000000</uuid>
        ...
      
      which certainly can't be correct since this is the UUID the xen
      tools use for dom0.
      
      This patch takes the approach of generating a UUID when it is not
      specified in the configuration.
      1fbdfc53
    • P
      conf: Remove console stream callback only when freeing console helper · 45edefc7
      Peter Krempa 提交于
      Commit ba226d33 tried to fix crash of
      the daemon when a domain with an open console was destroyed. The fix was
      wrong as it tried to remove the callback also when the stream was
      aborted, where at that point the fd stream driver was already freed and
      removed.
      
      This patch clears the callbacks with a helper right before the hash is
      freed, so that it doesn't interfere with other codepaths where the
      stream object is freed.
      45edefc7
    • P
      client: Free message when freeing client · f8ef393e
      Peter Krempa 提交于
      The last message of the client was not freed leaking 4 bytes of memory
      in the client when the remote daemon crashed while processing a message.
      f8ef393e
    • A
      ESX: Add "Byte" datatype · 54f9cf80
      Ata E Husain Bohra 提交于
      Append "Byte" to set of predefined datatype objects.
      Signed-off-by: NAta E Husain Bohra <ata.husain@hotmail.com>
      54f9cf80
    • E
      parallels: translate error message · 41cb8048
      Eric Blake 提交于
      Without this patch, the English phrase 'no name' would appear
      literally within the remaining translated message.
      
      * src/parallels/parallels_driver.c (parallelsCreateVm)
      (parallelsDomainDefineXML): Tweak error message.
      41cb8048
  4. 03 8月, 2012 10 次提交
    • L
      build: fix "make rpm" · 86d56e31
      Laine Stump 提交于
      make rpm was failing with the following error:
      
      Entering directory `/home/laine/devel/libvirt/tests'
      make[2]: *** No rule to make target `viratomicdata.h',
                   needed by `distdir'.  Stop.
      
      viratomicdata.h is listed in tests/Makefile.am as a dependency of
      viratomictest, but doesn't exist, is never referenced, and removing
      that dependency permits make rpm to complete successfully.
      86d56e31
    • D
      Export virUUIDIsValid to libvirt internal code · 554612c1
      Daniel P. Berrange 提交于
      554612c1
    • D
      7de158cf
    • P
      virsh: console: Avoid using stream after being freed. · e3b8808b
      Peter Krempa 提交于
      The stream object wasn't set to NULL after freeing causing a double free
      attempt on the cleanup path.
      e3b8808b
    • P
      remote: Fill snapshot argument in remoteDomainSnapshotListAllChildren · 2b01761d
      Peter Krempa 提交于
      The remote driver did not fill the required snapshot parent argument in
      the RPC call structure that caused a client crash when trying to use
      this new API.
      2b01761d
    • O
      qemu: Allow to attach/detach controller device persistently · ed1e711b
      Osier Yang 提交于
      * src/conf/domain_conf.c:
        - Add virDomainControllerFind to find controller device by type
          and index.
        - Add virDomainControllerRemove to remove the controller device
          from maintained controler list.
      
      * src/conf/domain_conf.h:
        - Declare the two new helpers.
      
      * src/libvirt_private.syms:
        - Expose private symbols for the two new helpers.
      
      * src/qemu/qemu_driver.c:
        - Support attach/detach controller device persistently
      
      * src/qemu/qemu_hotplug.c:
        - Use the two helpers to simplify the codes.
      ed1e711b
    • H
      Added timestamps to storage volumes · 7383c1d7
      Hendrik Schwartke 提交于
      The access, birth, modification and change times are added to
      storage volumes and corresponding xml representations.  This
      shows up in the XML in this format:
      
      <timestamps>
        <atime>1341933637.027319099</atime>
        <mtime>1341933637.027319099</mtime>
      </timestamps>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7383c1d7
    • J
      Update xml schemas according to libvirt source · 37a10129
      Ján Tomko 提交于
      capability.rng: Guest features can be in any order.
      nodedev.rng: Added <driver> element, <capability> phys_function and
      virt_functions for PCI devices.
      storagepool.rng: Owner or group ID can be -1.
      
      schema tests: New capabilities and nodedev files; changed owner and
      group to -1 in pool-dir.xml.
      storage_conf: Print uid_t and gid_t as signed to storage pool XML.
      37a10129
    • E
      build: add stubs so mdns code can be unconditionally compiled · 1f6f723c
      Eric Blake 提交于
      The recent changes to the testsuite to validate exported symbols
      flushed out a case of unconditionally exporting symbols that
      were only conditionally compiled under HAVE_AVAHI.
      
      * src/Makefile.am (libvirt_net_rpc_server_la_SOURCES): Compile
      virnetservermdns unconditionally.
      * configure.ac (HAVE_AVAHI): Drop unused automake conditional.
      * src/rpc/virnetservermdns.c: Add fallbacks when Avahi is not
      present.
      1f6f723c
    • M
      virsh: Switch to close callback · 54b63347
      Michal Privoznik 提交于
      Since we've introduced close callbacks we can drop this SIGINT magic
      (which doesn't work now neither) and fully utilize the new feature.
      54b63347
  5. 02 8月, 2012 11 次提交
    • M
      qemu: Fix typo in qemuDomainModifyDeviceFlags · e94c0a09
      Michal Privoznik 提交于
      One of our latest commits fbe87126 introduced this nasty typo:
      func(vmdef, ...); where func() dereference vmdef->ncontrollers,
      and vmdef was initialized to NULL. This leaves us with unconditional
      immediate segfault. It should be vm->def instead.
      e94c0a09
    • J
      daemon: Portable auto-detection of driver module directory · b5c5ad36
      Jiri Denemark 提交于
      When running libvirtd from a build directory on a system with unmodified
      libtool, libvirtd's binary is not renamed as "lt-libvirtd". Check for
      "/daemon/.libs/libvirtd" in addition to "lt-libvirtd".
      b5c5ad36
    • J
      build: Rename security manager library · d3084c2a
      Jiri Denemark 提交于
      Security manager is not a dynamically loadable driver. Let's avoid the
      confusion by renaming libvirt_driver_security library as
      libvirt_security_manager.
      d3084c2a
    • J
      build: Link security manager into libvirt.so · 2f2ca021
      Jiri Denemark 提交于
      Security manager is not a dynamically loadable driver, it's a common
      infrastructure similar to util, conf, cpu, etc. used by individual
      drivers. Such code is allowed to be linked into libvirt.so.
      
      This reverts commit ec5b7bd2 and most of
      aae5cfb6.
      
      This patch is supposed to fix virdrivermoduletest failures for qemu and
      lxc drivers as well as libvirtd's ability to load qemu and lxc drivers.
      2f2ca021
    • D
      Avoid clash of base64 symbols · 7a054e99
      Daniel P. Berrange 提交于
      On Debian/Ubuntu, one of the libraries libvirt (indirectly) links
      with exports a symbol named 'base64_encode'. This takes precedence
      over GNULIB's base64_encode function during linking. Unfortunately
      they of course have different API semantics. To avoid this problem
      use a few #defines in config.h to rename the GNULIB provided
      function to have a 'libvirt_gl_' prefix
      7a054e99
    • E
      build: commit to 0.10.0 release naming · 1d170d3f
      Eric Blake 提交于
      With 0.10.0-rc0 out the door, we are committed to the next version
      number.
      
      * src/libvirt_public.syms (LIBVIRT_0.9.14): Rename...
      (LIBVIRT_0.10.0): ...to this.
      * docs/formatdomain.html.in: Fix fallout.
      * src/openvz/openvz_driver.c (openvzDriver): Likewise.
      * src/remote/remote_driver.c (remote_driver): Likewise.
      1d170d3f
    • D
      Remove unused uuidstr variable from datatypes.c · 03be7ab5
      Daniel P. Berrange 提交于
      Several APIs in src/datatypes.c were formatting an UUID to a
      uuidstr variable and then not using it.
      03be7ab5
    • D
      Rewrite virAtomic APIs using GLib's atomic ops code · 0c9fd4cf
      Daniel P. Berrange 提交于
      There are a few issues with the current virAtomic APIs
      
       - They require use of a virAtomicInt struct instead of a plain
         int type
       - Several of the methods do not implement memory barriers
       - The methods do not implement compiler re-ordering barriers
       - There is no Win32 native impl
      
      The GLib library has a nice LGPLv2+ licensed impl of atomic
      ops that works with GCC, Win32, or pthreads.h that addresses
      all these problems. The main downside to their code is that
      the pthreads impl uses a single global mutex, instead of
      a per-variable mutex. Given that it does have a Win32 impl
      though, we don't expect anyone to seriously use the pthread.h
      impl, so this downside is not significant.
      
      * .gitignore: Ignore test case
      * configure.ac: Check for which atomic ops impl to use
      * src/Makefile.am: Add viratomic.c
      * src/nwfilter/nwfilter_dhcpsnoop.c: Switch to new atomic
        ops APIs and plain int datatype
      * src/util/viratomic.h: inline impls of all atomic ops
        for GCC, Win32 and pthreads
      * src/util/viratomic.c: Global pthreads mutex for atomic
        ops
      * tests/viratomictest.c: Test validate to validate safety
        of atomic ops.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0c9fd4cf
    • D
      Remove manual one-shot global initializers · b49890de
      Daniel P. Berrange 提交于
      Remove the use of a manually run virLogStartup and
      virNodeSuspendInitialize methods. Instead make sure they
      are automatically run using VIR_ONCE_GLOBAL_INIT
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b49890de
    • P
      qemu: Add support for "none" USB controller · fbe87126
      Peter Krempa 提交于
      This patch enables the "none" USB controller for qemu guests and adds
      valdiation on hot-plugged devices if the guest has USB disabled.
      
      This patch also adds a set of tests to check parsing of domain XMLs that
      use the "none" controller and some forbidden situations concerning it.
      fbe87126
    • P
      domain_conf: Add helpers to verify if device configuration is valid · 317badb2
      Peter Krempa 提交于
      This patch adds helpers that validate domain's device configuration.
      This will be needed later on to verify devices being hot-plugged to
      guests. If the guest has no USB bus, then it's not valid to plug a USB
      device to that guest.
      317badb2