1. 15 8月, 2012 6 次提交
    • L
      util: utility functions for virNetDevVPortProfile · 1c02ed14
      Laine Stump 提交于
      This patch adds three utility functions that operate on
      virNetDevVPortProfile objects.
      
      * virNetDevVPortProfileCheckComplete() - verifies that all attributes
          required for the type of the given virtport are specified.
      
      * virNetDevVPortProfileCheckNoExtras() - verifies that there are no
          attributes specified which are inappropriate for the type of the
          given virtport.
      
      * virNetDevVPortProfileMerge3() - merges 3 virtports into a single,
          newly allocated virtport. If any attributes are specified in
          more than one of the three sources, and do not exactly match,
          an error is logged and the function fails.
      
      These new functions depend on new fields in the virNetDevVPortProfile
      object that keep track of whether or not each attribute was
      specified. Since the higher level parse function doesn't yet set those
      fields, these functions are not actually usable yet (but that's okay,
      because they also aren't yet used - all of that functionality comes in
      a later patch.)
      
      Note that these three functions return 0 on success and -1 on
      failure. This may seem odd for the first two Check functions, since
      they could also easily return true/false, but since they actually log
      an error when the requested condition isn't met (and should result in
      a failure of the calling function), I thought 0/-1 was more
      appropriate.
      1c02ed14
    • L
      util: add openvswitch case to virNetDevVPortProfileEqual · 8450d7b2
      Laine Stump 提交于
      This function was overlooked when openvswitch support was
      added. Fortunately it's only use for update-device, which is
      relatively new and seldom-used.
      8450d7b2
    • L
      util: eliminate union in virNetDevVPortProfile · 21ea73e8
      Laine Stump 提交于
      virNetDevVPortProfile has (had) a type field that can be set to one of
      several values, and a union of several structs, one for each
      type. When a domain's interface object is of type "network", the
      domain config may not know beforehand which type of virtualport is
      going to be provided in the actual device handed down from the network
      driver at runtime, but may want to set some values in the virtualport
      that may or may not be used, depending on the type. To support this
      usage, this patch replaces the union of structs with toplevel fields
      in the struct, making it possible for all of the fields to be set at
      the same time.
      21ea73e8
    • L
      util: make return value of virUUIDFormat and virMacAddrFormat useful · 85d9c17d
      Laine Stump 提交于
      Both of these functions returned void, but it's convenient for them to
      return a const char* of the char* that is passed in. This was you can
      call the function and use the result in the same expression/arg.
      85d9c17d
    • E
      build: fix link error with appArmor · 37f3cd41
      Eric Blake 提交于
      Commit bb705e25 missed that the appArmor helper file also needs to
      resolve the new symbols dragged in by domain_conf.c.
      
      * src/Makefile.am (SECURITY_DRIVER_APPARMOR_HELPER_SOURCES): Pull
      in datatypes.c.
      37f3cd41
    • E
      maint: drop a leftover comment line · a40f9e9a
      Eric Blake 提交于
      * tests/viratomictest.c: Fix copy-and-paste bug.
      a40f9e9a
  2. 14 8月, 2012 19 次提交
    • D
      openvz: unlock virDomainObj objects in openvzOpen · cf24bed0
      Dmitry Guryanov 提交于
      openvzOpen fucntion must leave unlocked virDomainObj objects in
      driver->domains.
      
      Now even simple commands like list or domain lookup hang,
      for example virsh -c openvz:///system list --all.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      cf24bed0
    • D
      Pull code which finds a free MCS label out into its own method · b6e66cb6
      Daniel P. Berrange 提交于
      The code for picking a MCS label is about to get significantly
      more complicated, so it deserves to be in a standlone method,
      instead of a switch/case body.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b6e66cb6
    • D
      Honour current user and role in SELinux label generation · b77e9814
      Daniel P. Berrange 提交于
      When generating an SELinux context for a VM from the template
      "system_u:system_r:svirt_t:s0", copy the role + user from the
      current process instead of the template context. So if the
      current process is
      
         unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
      
      then the VM context ends up as
      
        unconfined_u:unconfined_r:svirt_t:s0:c386,c703
      
      instead of
      
         system_u:system_r:svirt_t:s0:c177,c424
      
      Ideally the /etc/selinux/targeted/contexts/virtual_domain_context
      file would have just shown the 'svirt_t' type, and not the full
      context, but that can't be changed now for compatibility reasons.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b77e9814
    • D
      Fix error reporting in virSecuritySELinuxGenNewContext · cbe67ff9
      Daniel P. Berrange 提交于
      The virSecuritySELinuxGenNewContext method was not reporting any
      errors, leaving it up to the caller to report a generic error.
      In addition it could potentially trigger a strdup(NULL) in an
      OOM scenario. Move all error reporting into the
      virSecuritySELinuxGenNewContext method where accurate info
      can be provided
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      cbe67ff9
    • D
      Use VIR_ERR_CONFIG_UNSUPPORTED if requested security driver is disabled · 51b23ed3
      Daniel P. Berrange 提交于
      There is currently no way to distinguish the case that a requested
      security driver was disabled, from the case where no security driver
      was available. Use VIR_ERR_CONFIG_UNSUPPORTED as the error when an
      explicitly requested security driver was disabled
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      51b23ed3
    • D
      Add missing domain_conf.h include in security_manager.h · fd016806
      Daniel P. Berrange 提交于
      The security_manager.h header is not self-contained because it
      uses the virDomainDefPtr without first including domain_conf.h
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      fd016806
    • D
      Add virRandom() API to generate numbers with non-power-of-2 limit · aa5bd8b9
      Daniel P. Berrange 提交于
      The current virRandomBits() API is only usable if the caller wants
      a random number in the range [0, n-1) where n is a power of two.
      This adds a virRandom() API which generates a double in the
      range [0.0,1.0) with 48 bits of entropy. It then also adds a
      virRandomInt(uint32_t max) API which generates an unsigned
      in the range [0,@max)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      aa5bd8b9
    • 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
    • D
      Fix timebomb in LIBVIRT_VERSION_INFO calculation · 3b0cd660
      Daniel P. Berrange 提交于
      The way LIBVIRT_VERSION_INFO is calculated has a timebomb that
      will cause us to accidentally break soname when we change the
      major version number to a non-zero value !
      
      Given CURRENT:REVISION:AGE, libtool will generate
      
         libvirt.so.($CURRENT-$AGE).$AGE.$REVISION
      
      We set CURRENT to be MAJOR+MINOR and AGE to $MINOR, so as
      soon as MAJOR changes to non-zero, we get libvirt.so.1
      as the soname, eg  1.3.9 would create libvirt.so.1.3.9
      Looks natural but is not ABI compatible with libvirt.so.0.x.y
      
      The fix is to set CURRENT to always be exactly the same
      as AGE. We want to have the major version reflected in
      the so symlinks though. So then we set AGE to MAJOR*1000+MINOR
      eg, so 1.3.9 would create libvirt.so.0.1003.9 and libvirt
      2.51.3 would create libvirt.so.0.2051.3
      3b0cd660
    • 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
    • J
      virsh: say save-image-edit failed only when it does · 863399f0
      Ján Tomko 提交于
      The common code for editing files in virsh-edit.c expects EDIT_DEFINE to
      return 0 on failure. virDomainSaveImageDefineXML returns 0 on success.
      863399f0
    • 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
      virsh: make 'help' command ignore spurious options · 86157b59
      Cole Robinson 提交于
      Similar to the previous patch, prepending 'help' to a partial
      command string doesn't cut us any slack.
      
      $ virsh help pool-define-as --name foo --type dir
      error: command 'help' doesn't support option --name
      
      This patch adds a few hacks to make 'help' ignore everything after the
      first data bit, so the above command shows help output for pool-define-as.
      86157b59
    • C
      virsh: Convert '<cmd> --help' to 'help <cmd>' · d2f97139
      Cole Robinson 提交于
      Often times I find myself halfway through typing a long command when
      I want to see 'help' output. I instinctively append '--help' to the
      command I'm typing, only to get an error:
      
          $ virsh vol-create-as foo --help
          error: command 'vol-create-as' doesn't support option --help
      
      This patch makes --help work in a pretty hacky way. One missing piece
      here is that --help isn't listed as an option in the actual 'help <cmd>'
      output, but maybe this can be a starting point for someone.
      d2f97139
    • C
      virsh.c: Fix compiler warning · e7d1bdfb
      Cole Robinson 提交于
      For some reason I only get this after applying subsequent upcoming
      patches that touch virsh, but don't seem to actually cause the warning.
      
      virsh.c: In function ‘vshCommandParse’:
      virsh.c:2014:46: error: ‘opt_index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      cc1: all warnings being treated as errors
      e7d1bdfb
    • 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
    • E
      maint: add attribution for last patch · 4c8cf294
      Eric Blake 提交于
      * AUTHORS: Add Frido Roose.
      4c8cf294
    • 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
  3. 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
  4. 10 8月, 2012 11 次提交
    • M
      docs/virsh: various minor fixes · 4d448b11
      Martin Kletzander 提交于
      List:
       - some old libvir/libvirt rename leftovers (the only problem can be
         if somebody parses 'virsh version' output really badly)
       - remove pointless tags specified in some pages that are not used
      4d448b11
    • M
      docs: autogenerate search.php · 28183590
      Martin Kletzander 提交于
      This patch makes search.php autogenerated from search.php.in, thus
      removing hardcoded menus, footer etc. and the search.php is added to
      .gitignore.
      
      There is new rule added for *.php files (to make it bit less
      hardcoded) that takes *.php.code.in and injects it inside the
      generated *.php (xslt was not happy about php code in the source xml).
      28183590
    • M
      docs: fix 404 page when fetched from different location · 3924072e
      Martin Kletzander 提交于
      Error 404 page had relative paths specified for both the image and
      stylesheets which caused a problem when requested URL included a
      subfolder (e.g. http://libvirt.org/asdf/asdf ). This patch corrects
      this behaviour by modifying href_base to '/' (for style-sheets) and
      changing the src of the image (to be '/' always).
      3924072e
    • 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
    • E
      build: fix author of previous commit · 7d7ee14b
      Eric Blake 提交于
      Stefan's attribution came through with an extra 'n' in the email address.
      7d7ee14b
    • 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
  5. 09 8月, 2012 2 次提交