1. 29 5月, 2010 4 次提交
    • C
      storage: Check for invalid storage mode before opening · 4a1abb3f
      Cole Robinson 提交于
      If a directory pool contains pipes or sockets, a pool start can fail or hang:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=589577
      
      We already try to avoid these special files, but only attempt after
      opening the path, which is where the problems lie. Unify volume opening
      into helper functions, which use the proper open() flags to avoid error,
      followed by fstat to validate storage mode.
      
      Previously, virStorageBackendUpdateVolTargetInfoFD attempted to enforce the
      storage mode check, but allowed callers to detect this case and silently
      continue. In practice, only the FS backend was using this feature, the rest
      were treating unknown mode as an error condition. Unfortunately the InfoFD
      function wasn't raising an error message here, so error reporting was
      busted.
      
      This patch adds 2 functions: virStorageBackendVolOpen, and
      virStorageBackendVolOpenModeSkip. The latter retains the original opt out
      semantics, the former now throws an explicit error.
      
      This patch maintains the previous volume mode checks: allowing specific
      modes for specific pool types requires a bit of surgery, since VolOpen
      is called through several different helper functions.
      
      v2: Use ATTRIBUTE_NONNULL. Drop stat check, just open with
          O_NONBLOCK|O_NOCTTY.
      
      v3: Move mode check logic back to VolOpen. Use 2 VolOpen functions with
          different error semantics.
      
      v4: Make second VolOpen function more extensible. Didn't opt to change
          FS backend defaults, this can just be to fix the original bug.
      
      v5: Prefix default flags with VIR_, use ATTRIBUTE_RETURN_CHECK
      4a1abb3f
    • S
      macvtap: cannot support target device name · ca1b7cc8
      Stefan Berger 提交于
      Since the macvtap device needs active tear-down and the teardown logic
      is based on the interface name, it can happen that if for example 1 out
      of 3 interfaces was successfully created, that during the failure path
      the macvtap's target device name is used to tear down an interface that
      is doesn't own (owned by another VM).
      
      So, in this patch, the target interface name is reset so that there is
      no target interface name and the interface name is always cleared after
      a tear down.
      ca1b7cc8
    • D
      Improve nodedev parent/child relationships · 8b46a7bb
      David Allan 提交于
      * If a nodedev has a parent that we don't want to display, we should
        continue walking up the udev device tree to see if any of its
        earlier ancestors are devices that we display.  It makes the tree
        much nicer looking than having a whole lot of devices hanging off
        the root node.
      8b46a7bb
    • J
      Fix libvirt-guests init script · 1a5c465e
      Jiri Denemark 提交于
      Firstly, the init script has to touch its file under /var/lock/subsys
      when started, otherwise the system would think it's not running and
      won't stop it during shutdown.
      
      Secondly, for some reason there is a policy to automatically enable
      init scripts when they are installed, so let the specfile do this. We
      also need to start the init script to ensure it will be stopped during
      the first shutdown after installing the package.
      
      Also $LISTFILE should be enclosed by quotes everywhere as suggested by
      Eric.
      1a5c465e
  2. 28 5月, 2010 8 次提交
    • J
      maint: new syntax-check rule to ensure that AUTHORS stays in sync · 208b2ad8
      Jim Meyering 提交于
      * cfg.mk (sc_check_AUTHOR_list): New rule.
      * .mailmap: New file, to tell git log how to map email addresses.
      208b2ad8
    • P
      hooks: fix typo · 55945841
      Paolo Smiraglia 提交于
      * src/util/hooks.c (virHookLxcOp): Use correct bound.
      55945841
    • E
      build: silence cppi warning, clarify vbox headers · 6456eef8
      Eric Blake 提交于
      These files are borrowed from upstream release versions, and should
      not need further edits in the context of libvirt (instead, a new
      upstream vbox release would entail adding a new header file).  We do
      not re-generate these files as part of libvirt, nor do we want to lose
      our minor edits (such as cppi cleanups).
      
      * src/vbox/vbox_CAPI_v2_2.h: Clarify file origins.
      * src/vbox/vbox_CAPI_v3_0.h: Likewise.
      * src/vbox/vbox_CAPI_v3_1.h: Likewise.
      * src/vbox/vbox_CAPI_v3_2.h: Likewise.  Reindent with cppi.
      6456eef8
    • C
      network: bridge: Don't start network if it collides with host routing · a83fe2c2
      Cole Robinson 提交于
      Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=235961
      
      If using the default virtual network, an easy way to lose guest network
      connectivity is to install libvirt inside the VM. The autostarted
      default network inside the guest collides with host virtual network
      routing. This is a long standing issue that has caused users quite a
      bit of pain and confusion.
      
      On network startup, parse /proc/net/route and compare the requested
      IP+netmask against host routing destinations: if any matches are found,
      refuse to start the network.
      
      v2: Drop sscanf, fix a comment typo, comment that function could use
          libnl instead of /proc
      
      v3: Consider route netmask. Compare binary data rather than convert to
          string.
      
      v4: Return to using sscanf, drop inet functions in favor of virSocket,
          parsing safety checks. Don't make parse failures fatal, in case
          expected format changes.
      
      v5: Try and continue if we receive unexpected. Delimit parsed lines to
          prevent scanning past newline
      a83fe2c2
    • E
      maint: update AUTHORS with recent contributors · 1be3f095
      Eric Blake 提交于
      git shortlog $(git log -1 --format=%H AUTHORS).. | grep -v "^ "
      
      then add missing entries to AUTHORS.
      
      * AUTHORS: Update.
      1be3f095
    • C
      xen: Fix chardev listen sexpr formatting · 953809db
      Cole Robinson 提交于
      'listen' isn't a valid qemu-dm option, as reported a long time ago here:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=492958
      
      Matches the near identical logic in qemu_conf.c
      
      v2: When parsing sexpr, only match on ",server", rather than
          full ',server,nowait'.
      953809db
    • C
      xen: Remove unused function · 7842e544
      Cole Robinson 提交于
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      7842e544
    • D
      v2 of Cole's wlan support · 07f6c3a9
      David Allan 提交于
      * Incorporated Jim's feedback (v1 & v2)
      
      * Moved case of DEVTYPE == "wlan" up as it's definitive that we have a network interface.
      
      * Made comment more detailed about the wired case to explain better
        how it differentiates between wired network interfaces and USB
        devices.
      07f6c3a9
  3. 27 5月, 2010 9 次提交
    • М
      Add docs on drive <serial> element · dafd354d
      Марк Коренберг 提交于
      * docs/formatdomain.html.in: Document <serial> element within
        <disk> and fix typo on <driver/> element
      dafd354d
    • M
      esx: Simplify goto usage · 041aac86
      Matthias Bolte 提交于
      Eliminate almost all backward jumps by replacing this common pattern:
      
      int
      some_random_function(void)
      {
          int result = 0;
          ...
      
        cleanup:
          <unconditional cleanup code>
          return result;
      
        failure:
          <cleanup code in case of an error>
          result = -1;
          goto cleanup
      }
      
      with this simpler pattern:
      
      int
      some_random_function(void)
      {
          int result = -1;
          ...
          result = 0;
      
        cleanup:
          if (result < 0) {
              <cleanup code in case of an error>
          }
      
          <unconditional cleanup code>
          return result;
      }
      
      Add a bool success variable in functions that don't have a int result
      that can be used for the new pattern.
      
      Also remove some unnecessary memsets in error paths.
      041aac86
    • J
      Support for VirtualBox version 3.2 · 8b0cd876
      Jean-Baptiste Rouault 提交于
      8b0cd876
    • M
      Use printf instead of echo -e in libvirt.spec.in · fa0bb9f6
      Matthias Bolte 提交于
      make rpm created dummy tests containing '-e #!/bin/sh' for me.
      fa0bb9f6
    • M
      Install, distribute and package domainsnapshot.rng · 5ac02723
      Matthias Bolte 提交于
      5ac02723
    • E
      build: support 'make check' in pristine tree · 047b024f
      Eric Blake 提交于
      Otherwise, 'make check' in the python dir tries to reference a file in
      docs that is built by 'make' but not by 'make check'.
      
      * docs/Makefile.am (check-local): New rule.
      Reported by Matthias Bolte.
      047b024f
    • M
      esx: Expose host UUID in the capabilities XML · b4cead59
      Matthias Bolte 提交于
      Parse the BIOS UUID. This information may not be available, in that
      case no host UUID is exposed in the capabilities XML.
      b4cead59
    • D
      Fix integer overflow in hotplug methods · bbe29be9
      Daniel P. Berrange 提交于
      The hotplug methods still had the qemuCmdFlags variable declared
      as an int, instead of unsigned long long. This caused flag checks
      to be incorrect for flags > 31
      
      * src/qemu/qemu_driver.c: Fix integer overflow in hotplug
      bbe29be9
    • A
      Pass pre-opened PCI device sysfs config file to QEMU · c444af1a
      Alex Williamson 提交于
      This allows libvirt to open the PCI device sysfs config file prior
      to dropping privileges so qemu can access the full config space.
      Without this, a de-privileged qemu can only access the first 64
      bytes of config space.
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Detect support
        for pci-assign.configfd option. Use this option when formatting
        PCI device string if possible
      * src/qemu/qemu_driver.c: Pre-open PCI sysfs config file and pass
        to QEMU
      c444af1a
  4. 26 5月, 2010 12 次提交
    • C
      daemon: sysconf: Update comment about VNC audio · 7f44743c
      Cole Robinson 提交于
      7f44743c
    • C
      Fix failing virGetHostname. · 0117b7da
      Chris Lalancette 提交于
      We've been running into a lot of situations where
      virGetHostname() is returning "localhost", where a plain
      gethostname() would have returned the correct thing.  This
      is because virGetHostname() is *always* trying to canonicalize
      the name returned from gethostname(), even when it doesn't
      have to.
      
      This patch changes virGetHostname so that if the value returned
      from gethostname() is already FQDN or localhost, it returns
      that string directly.  If the value returned from gethostname()
      is a shortened hostname, then we try to canonicalize it.  If
      that succeeds, we returned the canonicalized hostname.  If
      that fails, and/or returns "localhost", then we just return
      the original string we got from gethostname() and hope for
      the best.
      
      Note that after this patch it is up to clients to check whether
      "localhost" is an allowed return value.  The only place
      where it's currently not is in qemu migration.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      0117b7da
    • M
      xen-proxy build broken · 33737db1
      Matthias Bolte 提交于
      The virVirtualPortProfileFormat just went below the
      virVirtualPortProfileParamsParseXML function and got inside the
      
      The attached patch moves virVirtualPortProfileFormat below the #ifndef
      PROXY block.
      33737db1
    • M
      esx: Add read-only storage pool access · ddb4ae0c
      Matthias Bolte 提交于
      Allows listing existing pools and requesting information about them.
      
      Alter the esxVI_ProductVersion enum in a way that allows to check for
      product type by masking.
      ddb4ae0c
    • E
      build: fix HTML errors in nwfilter docs · 6e6acb77
      Eric Blake 提交于
      A build on Ubuntu reported:
      
      || Generating formatnwfilter.html.tmp
      /dados/develop/libvirt/docs/formatnwfilter.html.in|390| HTML parser error : Unexpected end tag : p
      ||     </p>
      ||         ^
      /dados/develop/libvirt/docs/formatnwfilter.html.in|705| HTML parser error : Unexpected end tag : code
      ||          <td>End of range of valid source ports</code></td>
      ||                                                       ^
      /dados/develop/libvirt/docs/formatnwfilter.html.in|710| HTML parser error : Unexpected end tag : code
      ||          <td>Start of range of valid destination ports</code></td>
      ||                                                              ^
      
      * docs/formatnwfilter.html.in: Fix invalid HTML constructs.
      Reported by Eduardo Otubo.
      6e6acb77
    • E
      build: fix compilation without macvtap · 8d9c7a93
      Eric Blake 提交于
      * src/util/macvtap.c: (associatePortProfileId)
      (disassociatePortProfileId): Move inside HAVE_MACVTAP
      conditional.
      Reported by Eduardo Otubo.
      8d9c7a93
    • J
      tests: avoid new failure of the daemon-conf test · 572c6cc1
      Jim Meyering 提交于
      * tests/daemon-conf: Accommodate the fact that out template,
      daemon/libvirtd.conf now contains an invalid host_uuid.
      Convert it to a valid one before the final libvirtd-running
      test that must terminate normally.
      572c6cc1
    • J
      libvirtd: diagnose invalid host UUID · 3db8607f
      Jim Meyering 提交于
      * daemon/libvirtd.c (remoteReadConfigFile): Diagnose an invalid
      host UUID rather than silently exiting with status 7.
      3db8607f
    • S
      vepa: parsing for 802.1Qb{g|h} XML · a8f75d2c
      Stefan Berger 提交于
      This patch parses the following two XML descriptions, one for
      802.1Qbg and one for 802.1Qbh, and stores the data internally.
      The actual triggering of the switch setup protocol has not been
      implemented here but the relevant code to do that should go into
      the functions associatePortProfileId() and disassociatePortProfileId().
      
         <interface type='direct'>
            <source dev='eth0.100' mode='vepa'/>
            <model type='virtio'/>
            <virtualport type='802.1Qbg'>
              <parameters managerid='12' typeid='0x123456' typeidversion='1'
               instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
            </virtualport>
            <filterref filter='clean-traffic'/>
          </interface>
      
          <interface type='direct'>
            <source dev='eth0.100' mode='vepa'/>
            <model type='virtio'/>
            <virtualport type='802.1Qbh'>
              <parameters profileid='my_profile'/>
            </virtualport>
          </interface>
      
      I'd suggest to use this patch as a base for triggering the setup
      protocol with the 802.1Qb{g|h} switch.
      
      Several rounds of changes were made to this patch. The
      following is a list of these changes.
      - Renamed structure virVirtualPortProfileDef to virVirtualPortProfileParams
        as per Daniel Berrange's request
      - Addressing Daniel Berrange's comments:
       - removing macvtap.h's dependency on domain_conf.h by
         moving the virVirtualPortProfileDef structure into macvtap.h
         and not passing virtDomainNetDefPtr to any functions in
         macvtap.c
      - Addressed most of Chris Wright's comments:
        - indicating error in case virtualport XML node cannot be parsed
          properly
        - parsing hex and decimal numbers using virStrToLong_ui() with
          parameter '0' for base
        - tgifname (target interface name) variable wasn't necessary
          to pass to openMacvtapTap function anymore
      - assigning the virtual port data structure to the virDomainNetDef
        only if it was previously parsed
      - make sure that the error code returned by openMacvtapTap() is a negative n
        in case the associatePortProfileId() function failed.
      - renaming vsi in the XML to virtualport
      - replace all occurrences of vsi in the source as well
      - removing mode and MAC address parameters from the functions that
        will communicate with the hareware diretctly or indirectly
      - moving the associate and disassociate functions to the end of the
        file for subsequent patches to easier make them generally available
        for export
      - passing the macvtap interface name rather than the link device since
        this otherwise gives funny side effects when using netlink messages
        where IFLA_IFNAME and IFLA_ADDRESS are specified and the link dev
        all of a sudden gets the MAC address of the macvtap interface.
      - Removing rc = -1 error indications in the case of 802.1Qbg|h setup in case
        we wanted to use hook scripts for the setup and so the setup doesn't fail
        here.
      - if instance ID UUID is not supplied it will automatically be generated
        - adapted schema to make instance ID UUID optional
        - added test case
      - parser and XML generator have been separated into their own
        functions so they can be re-used elsewhere (passthrough case
        for example)
      - Adapted XML parser and generator support the above shown type
        (802.1Qbg, 802.1Qbh).
      - Adapted schema to above XML
      - Adapted test XML to above XML
      - Passing through the VM's UUID which seems to be necessary for
        802.1Qbh -- sorry no host UUID
      - adding virtual function ID to association function, in case it's
        necessary to use (for SR-IOV)
      a8f75d2c
    • S
      vepa+vsi: Introduce dependency on libnl · a34871d9
      Stefan Berger 提交于
      This patch introduces a dependency on libnl, which subsequent patches
      will then use.
      
      Changes from V1 to V2:
      - added diffstats
      - following changes in tree
      a34871d9
    • C
      storage: Sanitize pool target paths · a7fb2258
      Cole Robinson 提交于
      Spurious / in a pool target path makes life difficult for apps using the
      GetVolByPath, and doing other path based comparisons with pools. This
      has caused a few issues for virt-manager users:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=494005
      https://bugzilla.redhat.com/show_bug.cgi?id=593565
      
      Add a new util API which removes spurious /, virFileSanitizePath. Sanitize
      target paths when parsing pool XML, and for paths passed to GetVolByPath.
      
      v2: Leading // must be preserved, properly sanitize path=/, sanitize
          away /./ -> /
      
      v3: Properly handle starting ./ and ending /.
      
      v4: Drop all '.' handling, just sanitize / for now.
      a7fb2258
    • D
      Expose a host UUID in the capabilities XML · 60881161
      Daniel P. Berrange 提交于
      Allow for a host UUID in the capabilities XML. Local drivers
      will initialize this from the SMBIOS data. If a sanity check
      shows SMBIOS uuid is invalid, allow an override from the
      libvirtd.conf configuration file
      
      * daemon/libvirtd.c, daemon/libvirtd.conf: Support a host_uuid
        configuration option
      * docs/schemas/capability.rng: Add optional host uuid field
      * src/conf/capabilities.c, src/conf/capabilities.h: Include
        host UUID in XML
      * src/libvirt_private.syms: Export new uuid.h functions
      * src/lxc/lxc_conf.c, src/qemu/qemu_driver.c,
        src/uml/uml_conf.c: Set host UUID in capabilities
      * src/util/uuid.c, src/util/uuid.h: Support for host UUIDs
      * src/node_device/node_device_udev.c: Use the host UUID functions
      * tests/confdata/libvirtd.conf, tests/confdata/libvirtd.out: Add
        new host_uuid config option to test
      60881161
  5. 25 5月, 2010 7 次提交
    • D
      Fix handling of disk backing stores with cgroups · e596dbb3
      Daniel P. Berrange 提交于
      The cgroups ACL code was only allowing the primary disk image.
      It is possible to chain images together, so we need to search
      for backing stores and add them to the ACL too. Since the ACL
      only handles block devices, we ignore the EINVAL we get from
      plain files. In addition it was missing code to teardown the
      cgroup when hot-unplugging a disk
      
      * src/qemu/qemu_driver.c: Allow backing stores in cgroup ACLs
        and add missing teardown code in unplug path
      e596dbb3
    • C
      Fix up basic migration. · 93500040
      Chris Lalancette 提交于
      Basic live migration was broken by the commit that added
      non-shared block support in two ways:
      
      1)  It added a virCheckFlags() to doNativeMigrate().  Besides
      the fact that typical usage of virCheckFlags() is in driver
      entry points, and doNativeMigrate() is not an entry point,
      it was missing important flags like VIR_MIGRATE_LIVE.  Move
      the virCheckFlags to the top-level qemuDomainMigratePrepare2
      and friends.
      
      2)  It also added a memory leak in qemuMonitorTextMigrate()
      by not freeing the memory used by virBufferContentAndReset().
      This is fixed by storing the pointer in a temporary variable
      and freeing it at the end.
      
      With this patch in place, normal live migration works again.
      
      v3: Instead of the churn for virCheckFlagsUI and UL, instead
      always promote flags to an unsigned long and always use %lx
      for the fprintf.
      v2: Add back flags check, which required adding virCheckFlagsUI
      and virCheckFlagsUL
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      93500040
    • C
      qemu: Allow using regular audio backends with VNC · fb3ebd03
      Cole Robinson 提交于
      Currently all host audio backends are disabled if a VM is using VNC, in
      favor of the QEMU VNC audio extension. Unfortunately no released VNC
      client supports this extension, so users have no way of getting audio
      to work if using VNC.
      
      Add a new config option in qemu.conf which allows changing libvirt's
      behavior, but keep the default intact.
      
      v2: Fix doc typos, change name to vnc_allow_host_audio
      fb3ebd03
    • C
      storage: mpath: Fix incorrect VIR_ERROR use · c82d106e
      Cole Robinson 提交于
      c82d106e
    • C
      Allow nwfilter functions to be compiled with C++ · 60d05f73
      Chris Lalancette 提交于
      Unfortunately the NWFilter functions were outside of the
      "extern C { ... }" declaration in include/libvirt/libvirt.h.in,
      which means that they couldn't be properly used with C++.  Move
      them inside of the braces, which should fix the problem.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      60d05f73
    • S
      nwfilter: documentation · f36eb693
      Stefan Berger 提交于
      This patch adds documentation of the nwfilter subsystem of libvirt to
      the existing (web) docs.
      f36eb693
    • E
      maint: update AUTHORS with recent contributors · 7488107f
      Eric Blake 提交于
      git shortlog $(git log -1 --format=%H AUTHORS).. | grep -v "^ "
      
      then add missing entries to AUTHORS.
      
      * AUTHORS: Update.
      7488107f