1. 14 8月, 2012 6 次提交
    • M
      util: typos in fallback code fo virDoubleToStr · 0a6504d4
      Martin Kletzander 提交于
      Fixes for some typos that somehow didn't get to the final push of the
      commit 43bfa23e.
      0a6504d4
    • O
      Destroy virdomainlist.[ch] · bb705e25
      Osier Yang 提交于
      As the consensus in:
      https://www.redhat.com/archives/libvir-list/2012-July/msg01692.html,
      this patch is to destroy conf/virdomainlist.[ch], folding the
      helpers into conf/domain_conf.[ch].
      
      * src/Makefile.am:
        - Various indention fixes incidentally
        - Add macro DATATYPES_SOURCES (datatypes.[ch])
        - Link datatypes.[ch] for libvirt_lxc
      
      * src/conf/domain_conf.c:
        - Move all the stuffs from virdomainlist.c into it
        - Use virUnrefDomain and virUnrefDomainSnapshot instead of
          virDomainFree and virDomainSnapshotFree, which are defined
          in libvirt.c, and we don't want to link to it.
        - Remove "if" before "free" the object, as virObjectUnref
          is in the list "useless_free_options".
      
      * src/conf/domain_conf.h:
        - Move all the stuffs from virdomainlist.h into it
        - s/LIST_FILTER/LIST_DOMAINS_FILTER/
      
      * src/libxl/libxl_driver.c:
        - s/LIST_FILTER/LIST_DOMAINS_FILTER/
        - no (include "virdomainlist.h")
      
      * src/libxl/libxl_driver.c: Likewise
      
      * src/lxc/lxc_driver.c: Likewise
      
      * src/openvz/openvz_driver.c: Likewise
      
      * src/parallels/parallels_driver.c: Likewise
      
      * src/qemu/qemu_driver.c: Likewise
      
      * src/test/test_driver.c: Likewise
      
      * src/uml/uml_driver.c: Likewise
      
      * src/vbox/vbox_tmpl.c: Likewise
      
      * src/vmware/vmware_driver.c: Likewise
      
      * tools/virsh-domain-monitor.c: Likewise
      
      * tools/virsh.c: Likewise
      bb705e25
    • M
      json: fix interface locale dependency · 43bfa23e
      Martin Kletzander 提交于
      libvirt creates invalid commands if wrong locale is selected. For
      example with locale that uses comma as a decimal point, JSON commands
      created with decimal numbers are invalid because comma separates the
      entries in JSON. Fortunately even when decimal point is affected,
      thousands grouping is not, because for grouping to be enabled with
      *printf, there has to be an apostrophe flag specified (and supported).
      
      This patch adds specific internal function for converting doubles to
      strings with C locale.
      43bfa23e
    • A
      sanlock: don't unlink lockspace if registration fails · ff73c6d3
      Asad Saeed 提交于
      This is a patch for bug 847848
      If registering an existing lockspace with the sanlock daemon
      returns an error, libvirt should not proceed to unlink the lockspace.
      Signed-off-by: NAsad Saeed <asad.saeed@acidseed.com>
      ff73c6d3
    • C
      build: Distribute check-symfile.pl · 7e6f8010
      Cole Robinson 提交于
      Otherwise distcheck can fail with:
      
        GEN      check-symfile
        Can't open perl script "../../src/check-symfile.pl": No such file or directory
        make[4]: *** [check-symfile] Error 2
      7e6f8010
    • F
      Release only specific sanlock resource · a58cb1ac
      Frido Roose 提交于
      This is a patch for bug 826704
      All sanlock resources get released when hot-dettaching a disk from the domain
      because virLockManagerSanlockRelease uses the wrong function parameters/flags.
      With the patch only the resources that should be released are cleaned up.
      Signed-off-by: NFrido Roose <frido.roose@gmail.com>
      a58cb1ac
  2. 11 8月, 2012 2 次提交
    • P
      virterror: Add error message for unsupported operations. · e9a24e3e
      Peter Krempa 提交于
      This patch introduces a new error code VIR_ERR_OPERATION_UNSUPPORTED to
      mark error messages regarding operations that failed due to lack of
      support on the hypervisor or other than libvirt issues.
      
      The code is first used in reporting error if qemu does not support block
      IO tuning variables yielding error message:
      error: Unable to get block I/O throttle parameters
      error: Operation not supported: block_io_throttle field
      'total_bytes_sec' missing in qemu's output
      
      instead of:
      error: Unable to get block I/O throttle parameters
      error: internal error cannot read total_bytes_sec
      e9a24e3e
    • L
      build: fix binary location in stap files --with-driver-modules · 54264111
      Laine Stump 提交于
      libvirt_qemu_probes.stp stopped working after switching to a build
      that used --with-driver-modules. This was because the symbols listed
      int libvirt_qemu_probes.stp are no longer in $(bindir)/libvirtd, but
      are now in $(libdir)/connection-driver/libvirt_driver_qemu.so.
      
      This patch enhances dtrace2systemtap.pl (which generates the .stp
      files from .d files) to look for a new "module" setting in the
      comments of the .d file (similar to the existing "binary" setting),
      and to look for a --with-modules option. If the --with-modules option
      is set *and* a "module" setting is present in the .d file, the process
      name for the stap line is set to
      
         $libdir/$module
      
      If either of these isn't true, it reverts to the old behavior.
      
      src/Makefile.am was also modified to add the --with-modules option
      when the build calls for it, and src/libvirt_qemu_probes.d has added a
      "module" line pointing to the correct .so file for the qemu driver.
      54264111
  3. 10 8月, 2012 7 次提交
    • L
      nwfilter: fix crash during filter define when lxc driver failed startup · b8a56f12
      Laine Stump 提交于
      The meat of this patch is just moving the calls to
      virNWFilterRegisterCallbackDriver from each hypervisor's "register"
      function into its "initialize" function. The rest is just code
      movement to allow that, and a new virNWFilterUnRegisterCallbackDriver
      function to undo what the register function does.
      
      The long explanation:
      
      There is an array in nwfilter called callbackDrvArray that has
      pointers to a table of functions for each hypervisor driver that are
      called by nwfilter. One of those function pointers is to a function
      that will lock the hypervisor driver. Entries are added to the table
      by calling each driver's "register" function, which happens quite
      early in libvirtd's startup.
      
      Sometime later, each driver's "initialize" function is called. This
      function allocates a driver object and stores a pointer to it in a
      static variable that was previously initialized to NULL. (and here's
      the important part...) If the "initialize" function fails, the driver
      object is freed, and that pointer set back to NULL (but the entry in
      nwfilter's callbackDrvArray is still there).
      
      When the "lock the driver" function mentioned above is called, it
      assumes that the driver was successfully loaded, so it blindly tries
      to call virMutexLock on "driver->lock".
      
      BUT, if the initialize never happened, or if it failed, "driver" is
      NULL. And it just happens that "lock" is always the first field in
      driver so it is also NULL.
      
      Boom.
      
      To fix this, the call to virNWFilterRegisterCallbackDriver for each
      driver shouldn't be called until the end of its (*already guaranteed
      successful*) "initialize" function, not during its "register" function
      (which is currently the case). This implies that there should also be
      a virNWFilterUnregisterCallbackDriver() function that is called in a
      driver's "shutdown" function (although in practice, that function is
      currently never called).
      b8a56f12
    • E
      build: fix PROBE() usage of intptr_t · 51ee43aa
      Eric Blake 提交于
      Otherwise, in locations like virobject.c where PROBE is used,
      for certain configure options, the compiler warns:
      
      util/virobject.c:110:1: error: 'intptr_t' undeclared (first use in this function)
      
      As long as we are making this header always available, we can
      clean up several other files.
      
      * src/internal.h (includes): Pull in <stdint.h>.
      * src/conf/nwfilter_conf.h: Rely on internal.h.
      * src/storage/storage_backend.c: Likewise.
      * src/storage/storage_backend.h: Likewise.
      * src/util/cgroup.c: Likewise.
      * src/util/sexpr.h: Likewise.
      * src/util/virhashcode.h: Likewise.
      * src/util/virnetdevvportprofile.h: Likewise.
      * src/util/virnetlink.h: Likewise.
      * src/util/virrandom.h: Likewise.
      * src/vbox/vbox_driver.c: Likewise.
      * src/xenapi/xenapi_driver.c: Likewise.
      * src/xenapi/xenapi_utils.c: Likewise.
      * src/xenapi/xenapi_utils.h: Likewise.
      * src/xenxs/xenxs_private.h: Likewise.
      * tests/storagebackendsheepdogtest.c: Likewise.
      51ee43aa
    • M
      esx: Implement network driver · b8fa5fd0
      Matthias Bolte 提交于
      An ESX server has one or more PhysicalNics that represent the actual
      hardware NICs. Those can be listed via the interface driver.
      
      A libvirt virtual network is mapped to a HostVirtualSwitch. On the
      physical side a HostVirtualSwitch can be connected to PhysicalNics.
      On the virtual side a HostVirtualSwitch has HostPortGroups that are
      mapped to libvirt virtual network's portgroups. Typically there is
      HostPortGroups named 'VM Network' that is used to connect virtual
      machines to a HostVirtualSwitch. A second HostPortGroup typically
      named 'Management Network' is used to connect the hypervisor itself
      to the HostVirtualSwitch. This one is not mapped to a libvirt virtual
      network's portgroup. There can be more HostPortGroups than those
      typical two on a HostVirtualSwitch.
      
               +---------------+-------------------+
         ...---|               |                   |   +-------------+
               | HostPortGroup |                   |---| PhysicalNic |
               |   VM Network  |                   |   |    vmnic0   |
         ...---|               |                   |   +-------------+
               +---------------+ HostVirtualSwitch |
                               |     vSwitch0      |
               +---------------+                   |
               | HostPortGroup |                   |
         ...---|   Management  |                   |
               |    Network    |                   |
               +---------------+-------------------+
      
      The virtual counterparts of the PhysicalNic is the HostVirtualNic for
      the hypervisor and the VirtualEthernetCard for the virtual machines
      that are grouped into HostPortGroups.
      
         +---------------------+   +---------------+---...
         | VirtualEthernetCard |---|               |
         +---------------------+   | HostPortGroup |
         +---------------------+   |   VM Network  |
         | VirtualEthernetCard |---|               |
         +---------------------+   +---------------+
                                                   |
                                   +---------------+
         +---------------------+   | HostPortGroup |
         |    HostVirtualNic   |---|   Management  |
         +---------------------+   |    Network    |
                                   +---------------+---...
      
      The currently implemented network driver can list, define and undefine
      HostVirtualSwitches including HostPortGroups for virtual machines.
      Existing HostVirtualSwitches cannot be edited yet. This will be added
      in a followup patch.
      b8fa5fd0
    • M
      esx: Remove redundant checks for esxVI_LookupHostSystemProperties result · ba86e5cd
      Matthias Bolte 提交于
      esxVI_LookupHostSystemProperties guarantees that hostSystem is non-NULL.
      Remove redundant NULL checks from callers.
      
      Also prefer esxVI_GetStringValue over open-coding the logic.
      ba86e5cd
    • M
      esx: Fix dynamic deep copy · c10cc254
      Matthias Bolte 提交于
      The static deep copy allocates storage for the copy. The dynamic
      version injected the dynamic dispatch after the allocation. This
      triggered the invalid argument check in the dynamically dispatched
      deep copy call. The deep copy function expects its dest parameter
      to be a pointer to a NULL-pointer. This expectation wasn't met due
      to the dispatching deep copy doing the allocation before the call.
      
      Fix this by dynamically dispatching to the correct type before the
      allocation.
      c10cc254
    • M
      esx: Implement interface driver · b9dfbf57
      Matthias Bolte 提交于
      Lists available PhysicalNic devices. A PhysicalNic is always active
      and can neither be defined nor undefined.
      
      A PhysicalNic is used to bridge a HostVirtualSwitch to the physical
      network.
      b9dfbf57
    • S
      nwfilter: remove target table before renaming it · 98c7d8b2
      Stefan Berger 提交于
      Remove the target table before renaming a table to it, i.e.,
      remove table B before renaming A to B. This makes the
      renaming more robust against unconnected left-over tables.
      98c7d8b2
  4. 09 8月, 2012 7 次提交
    • D
      Add APIs for obtaining the unique ID of LVM & SCSI volumes · efd6824c
      Daniel P. Berrange 提交于
      Both LVM volumes and SCSI LUNs have a globally unique
      identifier associated with them. It is useful to be able
      to query this identifier to then perform disk locking,
      rather than try to figure out a stable pathname.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      efd6824c
    • J
      qemu: Fix debug message in p2p migration · e18396f3
      Jiri Denemark 提交于
      When entering "confirm" phase, we are interested in the value of
      cancelled rather then ret variable which was interesting before "finish"
      phase and didn't change since then.
      e18396f3
    • J
      qemu: Migrate at unlimited speed by default · 6cfdeaac
      Jiri Denemark 提交于
      Previously, qemu did not respond to monitor commands during migration if
      the limit was too high. This prevented us from raising the limit
      earlier. The qemu issue seems to be fixed (according to my testing) and
      we may remove the 32Mb/s limit.
      6cfdeaac
    • P
      qemu: Refactor parsing of block device IO tuning parameters. · aba9abc5
      Peter Krempa 提交于
      This patch refactors the JSON parsing function that extracts the block
      IO tuning parameters from qemu's output. The most impacting change
      concerns the error message that is returned if the reply from qemu does
      not contain the needed data. The data for IO parameter tuning were added
      in qemu 1.1 and the previous error message was confusing.
      
      This patch also breaks long lines and extracts a multiple time used code
      pattern to a macro.
      aba9abc5
    • P
      remote: Clean up coding style and refactor remote connection opening · 6758ad4f
      Peter Krempa 提交于
      Remove spaces before function calls and some other coding nits in some
      parts of the remote driver and refactor getting of URI argument
      components into variables used by libvirt later on.
      6758ad4f
    • P
      Allow rbd backing stores · 16d3ab86
      Peter Feiner 提交于
      Prevents libvirt from treating RBD backing stores as files. Without this
      patch, creating a domain with a qcow2 overlay on an RBD would fail.
      
      This patch essentially extends 9c7c4a4f,
      which allows nbd backing stores, to allow rbd backing stores.
      16d3ab86
    • P
      Fix errno check, prevent spurious errors under heavy load · bfa74ebe
      Peter Feiner 提交于
      From man poll(2), poll does not set errno=EAGAIN on interrupt, however
      it does set errno=EINTR. Have libvirt retry on the appropriate errno.
      
      Under heavy load, a program of mine kept getting libvirt errors 'poll on
      socket failed: Interrupted system call'. The signals were SIGCHLD from
      processes forked by threads unrelated to those using libvirt.
      bfa74ebe
  5. 08 8月, 2012 5 次提交
    • G
      qemu:rename qemuCheckScsiControllerModel function · d7d468f0
      Guannan Ren 提交于
      d7d468f0
    • G
      rpc: fix a virObject typo error in struct _virNetServer · 41185927
      Guannan Ren 提交于
      This typo will crash libvirtd when it recevies signal SIGINT
      41185927
    • G
      qemu: add two qemu caps for lsi and virtio-scsi SCSI controllers · 015c603b
      Guannan Ren 提交于
      Rename qemuDefaultScsiControllerModel to qemuCheckScsiControllerModel.
      When scsi model is given explicitly in XML(model > 0) checking if the
      underlying QEMU supports it or not first, raise an error on checking
      failure.
      When the model is not given(mode <= 0), return LSI by default, if
      the QEMU doesn't support it, raise an error.
      015c603b
    • G
      qemu: add capabilities flags related to scsi controller · 8694c716
      Guannan Ren 提交于
        QEMU_CAPS_SCSI_LSI
          set the flag when "lsi53c895a", bus PCI, alias "lsi" in
          the output of "qemu -device ?"
          -device lsi in qemu command line
      
        QEMU_CAPS_VIRTIO_SCSI_PCI
          set the flag when "name "virtio-scsi-pci", bus PCI" in
          the output of qemu devices query.
          -device virtio-scsi-pci in qemu command line
      8694c716
    • L
      util: include stderr in log message when an external command fails · b8c298d3
      Laine Stump 提交于
      This patch is in response to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=818467
      
      If a caller to virCommandRun doesn't ask for the exitstatus of the
      program it's running, the virCommand functions assume that they should
      log an error message and return failure if the exit code isn't
      0. However, only the commandline and exit status are logged, while
      potentially useful information sent by the program to stderr is
      discarded.
      
      Fortunately, virCommandRun is already checking if the caller had asked
      for stderr to be saved and, if not, sets things up to save it in
      *cmd->errbuf. This makes it fairly simple for virCommandWait to
      include *cmd->errbuf in the error log (there are still other callers
      that don't setup errbuf, and even virCommandRun won't set it up if the
      command is being daemonized, so we have to check that it's non-zero).
      b8c298d3
  6. 07 8月, 2012 10 次提交
  7. 06 8月, 2012 3 次提交
    • 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