1. 02 9月, 2011 1 次提交
    • O
      Add directsync cache mode support for disk driver · 6ee52c1b
      Osier Yang 提交于
      Newer QEMU introduced cache=directsync for -drive, this patchset
      is to expose it in libvirt layer.
      
        * Introduced a new QEMU capability flag ($prefix_CACHE_DIRECTSYNC),
          As even $prefix_CACHE_V2 is set, we can't known if directsync
          is supported.
      6ee52c1b
  2. 25 8月, 2011 1 次提交
    • D
      Fix command test wrt gnutls initialize & fix debugging · 2d533a46
      Daniel P. Berrange 提交于
      The VIR_TEST_DEBUG and VIR_TEST_VERBOSE env vars did not work
      because we replaced 'environ' with 'newenv'. Simply calling
      virTestGetDebug/Verbose() before replacing the 'environ' ensures
      we have processed the env variables.
      
      The gnutls initialization code opens /dev/urandom and keeps that
      FD around for later use. We have code which kills off FDs 3-5
      to avoid interfereing with our test case. Move the virInitialize
      call before this point, so it kills off the gnutls /dev/urandom
      FD which is irrelevant for testing purposes
      
      * tests/commandtest.c: Fix test debugging & make it robust against
        opened FDs
      2d533a46
  3. 19 8月, 2011 3 次提交
    • E
      virsh: properly interleave shared stdout and stderr · baac9c37
      Eric Blake 提交于
      Without this patch, invoking 'virsh >file 2>&1' results in
      error messages appearing before normal output, even if they
      occurred later in time than the normal output (since stderr
      is unbuffered, but stdout waits until a full buffer).
      
      * tools/virsh.c (print_job_progress, vshError): Flush between
      stream transitions.
      * tests/undefine: Test it.
      baac9c37
    • E
      maint: simplify lots of libxml2 clients · d89dd42d
      Eric Blake 提交于
      Repetitive patterns should be factored.  The sign of a good
      factorization is a change that kills 5x more lines than it adds :)
      
      * src/conf/domain_conf.c (virDomainDeviceDefParse)
      (virDomainSnapshotDefParseString): Use new convenience macros.
      * src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
      Likewise.
      * src/cpu/cpu.c (cpuCompareXML, cpuBaselineXML): Likewise.
      * src/esx/esx_vi.c (esxVI_Context_Execute): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLParseStr):
      Likewise.
      * src/security/virt-aa-helper.c (caps_mockup): Likewise.
      * src/test/test_driver.c (testOpenFromFile): Likewise.
      * tests/cputest.c (cpuTestLoadXML, cpuTestLoadMultiXML):
      Likewise.
      * tools/virsh.c (cmdFreecell, makeCloneXML, cmdVNCDisplay)
      (cmdTTYConsole, cmdDetachInterface, cmdDetachDisk)
      (cmdSnapshotCreate, cmdSnapshotCreateAs, cmdSnapshotCurrent)
      (cmdSnapshotList, cmdSnapshotParent): Likewise.
      d89dd42d
    • E
      test: rewrite test to match change in behavior · 5f98c437
      Eric Blake 提交于
      Test failure exposed in commit 7d3390f8.
      
      * tests/undefine: Fix to match updated test driver semantics.
      5f98c437
  4. 15 8月, 2011 3 次提交
    • L
      qemu: support event_idx parameter for virtio disk and net devices · 73c0a148
      Laine Stump 提交于
      In some versions of qemu, both virtio-blk-pci and virtio-net-pci
      devices can have an event_idx setting that determines some details of
      event processing. When it is enabled, it "reduces the number of
      interrupts and exits for the guest". qemu will automatically enable
      this feature when it is available, but there may be cases where this
      new feature could actually make performance worse (NB: no such case
      has been found so far).
      
      As a safety switch in case such a situation is encountered in the
      field, this patch adds a new attribute "event_idx" to the <driver>
      element of both disk and interface devices. event_idx can be set to
      "on" (to force event_idx on in case qemu has it disabled by default)
      or "off" (for force event_idx off). In the case that event_idx support
      isn't present in qemu, the attribute is ignored (this on the advice of
      the qemu developer).
      
      docs/formatdomain.html.in: document the new flag (marking it as
         "don't mess with this!"
      docs/schemas/domain.rng: add event_idx in appropriate places
      src/conf/domain_conf.[ch]: add event_idx to parser and formatter
      src/libvirt_private.syms: export
         virDomainVirtioEventIdx(From|To)String
      src/qemu/qemu_capabilities.[ch]: detect and report event_idx in
         disk/net
      src/qemu/qemu_command.c: add event_idx parameter to qemu commandline
          when appropriate.
      tests/qemuxml2argvdata/qemuxml2argv-event_idx.args,
      tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml,
      tests/qemuxml2argvtest.c,
      tests/qemuxml2xmltest.c: test cases for event_idx.
      73c0a148
    • J
      Support changing UNIX socket owner in virNetSocketNewListenUNIX · 5d30db09
      Jiri Denemark 提交于
      This patch allows owner's UID to be changed as well.
      5d30db09
    • J
      Add backlog parameter to virNetSocketListen · 70e4295b
      Jiri Denemark 提交于
      So that callers can change the default value.
      70e4295b
  5. 13 8月, 2011 1 次提交
    • E
      build: fix recent build failures · be427e8b
      Eric Blake 提交于
      With gcc 4.5.1:
      
      util/virpidfile.c: In function 'virPidFileAcquirePath':
      util/virpidfile.c:308:66: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs]
      
      Then in tests/commandtest.c, the new virPidFile APIs need to be used.
      
      * src/util/virpidfile.c (virPidFileAcquirePath): Move verify to
      top level.
      * tests/commandtest.c: Use new pid APIs.
      be427e8b
  6. 12 8月, 2011 1 次提交
    • E
      virsh: don't reject undefine on active domain · 9a0ec363
      Eric Blake 提交于
      The public API documents that undefine may be used to transition a
      running persistent domain into a transient one.  Many drivers still
      do not support this usage, but virsh shouldn't be getting in the
      way of those that do support it.
      
      This also drops a redundant conditional; vshCommandOptString
      guaranteed that name was non-NULL.
      
      * tools/virsh.c (cmdUndefine): Allow undefine on active domains;
      the drivers may still reject it, but it is a valid API usage.
      * tests/undefine (error): Fix the test to match.
      9a0ec363
  7. 11 8月, 2011 1 次提交
    • C
      qemu: Fix -chardev udp if parameters are omitted · d30d5726
      Cole Robinson 提交于
      The following XML:
      
          <serial type='udp'>
            <source mode='connect' service='9999'/>
          </serial>
      
      is accepted by domain_conf.c but maps to the qemu command line:
      
      -chardev udp,host=127.0.0.1,port=2222,localaddr=(null),localport=(null)
      
      qemu can cope with everything omitting except the connection port, which
      seems to also be the intent of domain_conf validation, so let's not
      generate bogus command lines for that case.
      The defaults are empty strings for addresses and 0 for the localport
      
      Additionally, tweak the qemu cli parsing to handle omitted host
      parameters
      for -serial udp
      d30d5726
  8. 04 8月, 2011 1 次提交
    • M
      Fix detection of GnuTLS 1.x.y · 099d30a8
      Matthias Bolte 提交于
      Detection based on gnutls_session doesn't work because GnuTLS 2.x.y
      comes with a compat.h that defines gnutls_session to gnutls_session_t.
      
      Instead detect this based on LIBGNUTLS_VERSION_MAJOR. Move this from
      configure/config.h to gnutls_1_0_compat.h and make sure that all users
      include gnutls_1_0_compat.h properly.
      
      Also fix header guard in gnutls_1_0_compat.h.
      099d30a8
  9. 30 7月, 2011 2 次提交
    • L
      network: don't forward DNS requests from isolated networks · 513122ae
      Laine Stump 提交于
      This is in response to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=723862
      
      which points out that a guest on an "isolated" network could
      potentially exploit the DNS forwarding provided by dnsmasq to create a
      communication channel to the outside.
      
      This patch eliminates that possibility by adding the "--no-resolv"
      argument to the dnsmasq commandline, which tells dnsmasq to not
      forward on any requests that it can't resolve itself (by looking at
      its own static hosts files and runtime list of dhcp clients), but to
      instead return a failure for those requests.
      
      This shouldn't cause any undesirable change from current
      behavior, even in the case where a guest is currently configured with
      multiple interfaces, one of them being connected to an isolated
      network, and another to a network that does have connectivity to the
      outside. If the isolated network's DNS server is queried for a name
      it doesn't know, it will return "Refused" rather than "Unknown", which
      indicates to the guest that it should query other servers, so it then
      queries the connected DNS server, and gets the desired response.
      513122ae
    • E
      build: avoid non-portable shell in test setup · 343ab982
      Eric Blake 提交于
      POSIX states that 'a=1; a=2 b=$a command' has unspecified results
      for the value of $b visible within command.  In particular, on
      BSD, this resulted in PATH not picking up the in-test ssh.
      
      * tests/Makefile.am (lv_abs_top_builddir): New macro.
      (path_add, TESTS_ENVIRONMENT): Use it to avoid referring to an
      environment variable set previously within the same command line.
      Reported by Matthias Bolte.
      343ab982
  10. 29 7月, 2011 6 次提交
    • M
      tests: Don't use bash if we don't have to · f2ac5807
      Matthias Bolte 提交于
      This tested failed on FreeBSD because it was using bash, that might
      not be installed.
      f2ac5807
    • M
      freebsd: Fix build problem due to picking up the wrong libvirt.h · b590866b
      Matthias Bolte 提交于
      Gettext annoyingly modifies CPPFLAGS in-place, putting
      -I/usr/local/include into the search patch if libintl headers
      must be used from that location.  But since we must support
      automake 1.9.6 which lacks AM_CPPFLAGS, and since CPPFLAGS is used
      prior to INCLUDES, this means that the build picks up the _old_
      installed libvirt.h in priority to the in-tree version, leading
      to all sorts of weird build failures on FreeBSD.
      
      Fix this by teaching configure to undo gettext's actions, but
      to keep any changes required by gettext at the end of INCLUDES
      after all in-tree locations are used first.  Also requires
      adding a wrapper Makefile.am and making gnulib-tool create
      just gnulib.mk files during the bootstrap process.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b590866b
    • M
      freebsd: Avoid /bin/true in commandtest · c0e5994a
      Matthias Bolte 提交于
      Rely on PATH and use just true, because on FreeBSD it's /usr/bin/true.
      c0e5994a
    • M
      tests: Unify style of test skipping code · cffba7ea
      Matthias Bolte 提交于
      Prefer 'return EXIT_AM_SKIP' over 'exit(EXIT_AM_SKIP)'.
      
      Prefer 'int main(void)' over 'int main(int argc, char **argv)'.
      
      Fix mymain signature in commandtest and nodeinfotest.
      cffba7ea
    • E
      maint: add missing copyright notices · ff81956a
      Eric Blake 提交于
      I went with the shorter license notice used by src/libvirt.c,
      rather than spelling out the full LGPLv2+ clause into each of
      these files.
      
      * configure.ac: Declare copyright.
      * all Makefile.am: Likewise.
      ff81956a
    • L
      conf: add <listen> subelement to domain <graphics> element · ef79fb5b
      Laine Stump 提交于
      Once it's plugged in, the <listen> element will be an optional
      replacement for the "listen" attribute that graphics elements already
      have. If the <listen> element is type='address', it will have an
      attribute called 'address' which will contain an IP address or dns
      name that the guest's display server should listen on. If, however,
      type='network', the <listen> element should have an attribute called
      'network' that will be set to the name of a network configuration to
      get the IP address from.
      
      * docs/schemas/domain.rng: updated to allow the <listen> element
      
      * docs/formatdomain.html.in: document the <listen> element and its
        attributes.
      
      * src/conf/domain_conf.[hc]:
      
        1) The domain parser, formatter, and data structure are modified to
           support 0 or more <listen> subelements to each <graphics>
           element. The old style "legacy" listen attribute is also still
           accepted, and will be stored internally just as if it were a
           separate <listen> element. On output (i.e. format), the address
           attribute of the first <listen> element of type 'address' will be
           duplicated in the legacy "listen" attribute of the <graphic>
           element.
      
        2) The "listenAddr" attribute has been removed from the unions in
           virDomainGRaphicsDef for graphics types vnc, rdp, and spice.
           This attribute is now in the <listen> subelement (aka
           virDomainGraphicsListenDef)
      
        3) Helper functions were written to provide simple access
           (both Get and Set) to the listen elements and their attributes.
      
      * src/libvirt_private.syms: export the listen helper functions
      
      * src/qemu/qemu_command.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/vbox/vbox_tmpl.c,
        src/vmx/vmx.c, src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c
      
        Modify all these files to use the listen helper functions rather
        than directly referencing the (now missing) listenAddr
        attribute. There can be multiple <listen> elements to a single
        <graphics>, but the drivers all currently only support one, so all
        replacements of direct access with a helper function indicate index
        "0".
      
      * tests/* - only 3 of these are new files added explicitly to test the
        new <listen> element. All the others have been modified to reflect
        the fact that any legacy "listen" attributes passed in to the domain
        parse will be saved in a <listen> element (i.e. one of the
        virDomainGraphicsListenDefs), and during the domain format function,
        both the <listen> element as well as the legacy attributes will be
        output.
      ef79fb5b
  11. 26 7月, 2011 3 次提交
    • D
      Fix build with gnutls 1.0.x branch · 4d349ef7
      Daniel P. Berrange 提交于
      4d349ef7
    • L
      util: change virFile*Pid functions to return < 0 on failure · d6354c16
      Laine Stump 提交于
      Although most functions in libvirt return 0 on success and < 0 on
      failure, there are a few functions lingering around that return errno
      (a positive value) on failure, and sometimes code calling those
      functions incorrectly assumes the <0 standard. I noticed one of these
      the other day when auditing networkStartDhcpDaemon after Guido Gunther
      found a place where success was improperly returned on failure (that
      patch has been acked and is pending a push). The problem was that it
      expected the return value from virFileReadPid to be < 0 on failure,
      but it was actually positive (it was also neglected to set the return
      code in this case, similar to the bug found by Guido).
      
      This all led to the fact that *all* of the virFile*Pid functions in
      util.c are returning errno on failure. This patch remedies that
      problem by changing them all to return -errno on failure, and makes
      any necessary changes to callers of the functions. (In the meantime, I
      also properly set the return code on failure of virFileReadPid in
      networkStartDhcpDaemon).
      d6354c16
    • D
      Fix import of private key with older gnutls · 677258ab
      Daniel P. Berrange 提交于
      With older GNUTLS the gnutls_x509_privkey_import function is
      unable to import our private key. Instead we must use the
      alternative gnutls_x509_privkey_import_pkcs8() (as certtool
      does).
      
      * virnettlscontexttest.c: Fix import of private key with
        older gnutls. Also add missing newlines to key
      677258ab
  12. 25 7月, 2011 5 次提交
    • D
      Fix TLS context tests with expired certs · 567b8d69
      Daniel P. Berrange 提交于
      commit 5283ea9b changed the
      semantics of the 'expire_offset' field in the test case struct
      so that instead of being an absolute timestamp, it was a delta
      relative to the current time. This broke the test cases which
      were testing expiry of certificates, by putting the expiry
      time into the future, instead of in the past.
      
      Fix this by changing the expiry values to be negative, so that
      the delta goes into the past again.
      
      * virnettlscontexttest.c: Fix expiry tests
      567b8d69
    • E
      tests: detect gnutls errors · d1f144d6
      Eric Blake 提交于
      * tests/virnettlscontexttest.c (testTLSLoadKey): Report errors.
      d1f144d6
    • M
      bandwidth: Add domain schema and xml2xml tests · 2b9efcb3
      Michal Privoznik 提交于
      2b9efcb3
    • M
      bandwidth: Add test cases for network · e5f1f9de
      Michal Privoznik 提交于
      e5f1f9de
    • E
      tests: fix compilation failures · 5283ea9b
      Eric Blake 提交于
      Even though gnutls is a hard-req for libvirt, and gnutls depends
      on libtasn1, that does not mean that you have to have the libtasn1
      development files installed.  Skip the test rather than failing
      compilation in that case.
      
      With newer gcc, the test consumed too much stack space.  Move
      things to static storage to fix that.
      
      * configure.ac (AC_CHECK_HEADERS): Check for libtasn1.h.
      (HAVE_LIBTASN1): New automake conditional.
      * tests/Makefile.am (virnettlsconvirnettlscontexttest_SOURCES)
      (virnettlscontexttest_LDADD): Allow compilation without libtasn1.
      * tests/virnettlscontexttest.c: Skip test if headers not present.
      (struct testTLSCertReq): Alter time members.
      (testTLSGenerateCert): Reflect the change.
      (mymain): Reduce stack usage.
      5283ea9b
  13. 22 7月, 2011 6 次提交
    • D
      Add a test case for certificate validation · bd789dff
      Daniel P. Berrange 提交于
      This test case checks certification validation rules for
      
       - Basic constraints
       - Key purpose
       - Key usage
       - Start/expiry times
      
      It checks initial context creation sanity checks, and live
      session validation
      bd789dff
    • O
      remote/ssh: optional "keyfile" parameter. · 6b01c83a
      Oskari Saarenmaa 提交于
      New optional parameter "keyfile" for ssh transport allows the user to select
      the private key to be used to authenticate to the remote host.
      6b01c83a
    • L
      network: internal API functions to manage assignment of physdev to guest · 04711a0f
      Laine Stump 提交于
      The network driver needs to assign physical devices for use by modes
      that use macvtap, keeping track of which physical devices are in use
      (and how many instances, when the devices can be shared). Three calls
      are added:
      
      networkAllocateActualDevice - finds a physical device for use by the
      domain, and sets up the virDomainActualNetDef accordingly.
      
      networkNotifyActualDevice - assumes that the domain was already
      running, but libvirtd was restarted, and needs to be notified by each
      already-running domain about what interfaces they are using.
      
      networkReleaseActualDevice - decrements the usage count of the
      allocated physical device, and frees the virDomainActualNetDef to
      avoid later accidentally using the device.
      
      bridge_driver.[hc] - the new APIs. When WITH_NETWORK is false, these
      functions are all #defined to be "0" in the .h file (effectively
      becoming a NOP) to prevent link errors.
      
      qemu_(command|driver|hotplug|process).c - add calls to the above APIs
          in the appropriate places.
      
      tests/Makefile.am - we need to include libvirt_driver_network.la
          whenever libvirt_driver_qemu.la is linked, to avoid unreferenced
          symbols (in functions that are never called by the test
          programs...)
      04711a0f
    • L
      conf: support abstracted interface info in network XML · 40fd7073
      Laine Stump 提交于
      The network XML is updated in the following ways:
      
      1) The <forward> element can now contain a list of forward interfaces:
      
           <forward .... >
             <interface dev='eth10'/>
             <interface dev='eth11'/>
             <interface dev='eth12'/>
             <interface dev='eth13'/>
           </forward>
      
         The first of these takes the place of the dev attribute that is
         normally in <forward> - when defining a network you can specify
         either one, and on output both will be present. If you specify
         both on input, they must match.
      
      2) In addition to forward modes of 'nat' and 'route', these new modes
         are supported:
      
           private, passthrough, vepa - when this network is referenced by a
           domain's interface, it will have the same effect as if the
           interface had been defined as type='direct', e.g.:
      
              <interface type='direct'>
                <source mode='${mode}' dev='${dev}>
                ...
              </interface>
      
           where ${mode} is one of the three new modes, and ${dev} is an interface
           selected from the list given in <forward>.
      
           bridge - if a <forward> dev (or multiple devs) is defined, and
           forward mode is 'bridge' this is just like the modes 'private',
           'passthrough', and 'vepa' above. If there is no forward dev
           specified but a bridge name is given (e.g. "<bridge
           name='br0'/>"), then guest interfaces using this network will use
           libvirt's "host bridge" mode, equivalent to this:
      
             <interface type='bridge'>
                <source bridge='${bridge-name}'/>
                ...
             </interface>
      
      3) A network can have multiple <portgroup> elements, which may be
         selected by the guest interface definition (by adding
         "portgroup='${name}'" in the <source> element along with the
         network name). Currently a portgroup can only contain a
         virtportprofile, but the intent is that other configuration items
         may be put there int the future (e.g. bandwidth config). When
         building a guest's interface, if the <interface> XML itself has no
         virtportprofile, and if the requested network has a portgroup with
         a name matching the name given in the <interface> (or if one of the
         network's portgroups is marked with the "default='yes'" attribute),
         the virtportprofile from that portgroup will be used by the
         interface.
      
      4) A network can have a virtportprofile defined at the top level,
         which will be used by a guest interface when connecting in one of
         the 'direct' modes if the guest interface XML itself hasn't
         specified any virtportprofile, and if there are also no matching
         portgroups on the network.
      40fd7073
    • L
      conf: support abstracted interface info in domain interface XML · 07f41369
      Laine Stump 提交于
      the domain XML <interface> element is updated in the following ways:
      
      1) <virtualportprofile> can be specified when source type='network'
      (previously it was only valid for source type='direct')
      
      2) A new attribute "portgroup" has been added to the <source>
      element. When source type='network' (the only time portgroup is
      recognized), extra configuration information will be taken from the
      <portgroup> element of the given name in the network definition.
      
      3) Each virDomainNetDef now also potentially has a
      virDomainActualNetDef which is a private object (never
      exported/imported via the public API, and not defined in the RNG) that
      is used to maintain information about the physical device that was
      actually used for a NetDef of type VIR_DOMAIN_NET_TYPE_NETWORK.
      
      The virDomainActualNetDef will only be parsed/formatted if the
      parse/format function is called with the
      VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET flag set (which is only needed when
      saving/loading a running domain's state info to the stateDir).
      07f41369
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  14. 21 7月, 2011 1 次提交
  15. 19 7月, 2011 1 次提交
  16. 14 7月, 2011 1 次提交
    • J
      virsh: fix previous patch · f580a33f
      Jiri Denemark 提交于
      The last patch breaks make check for two reasons. First, it reverses the
      condition but leaves default level unchanged, so instead of not printing
      anything but errors before the patch it now prints all debug messages by
      default. Second, you forgot to change -d5 option passed to virsh in
      tests/virsh-optparse to -d0; the script wants to see all debug messages.
      f580a33f
  17. 12 7月, 2011 3 次提交
    • D
      Change extract pidfile & monitor config from QEMU command line · ebbae359
      Daniel P. Berrange 提交于
      When converting QEMU argv into a virDomainDefPtr, also extract
      the pidfile, monitor character device config and the monitor
      mode.
      
      * src/qemu/qemu_command.c, src/qemu/qemu_command.h: Extract
        pidfile & monitor config from QEMU argv
      * src/qemu/qemu_driver.c, tests/qemuargv2xmltest.c: Add extra
        params when calling qemuParseCommandLineString
      ebbae359
    • O
      remote/ssh: support for no_verify. · 9a0e6a8f
      Oskari Saarenmaa 提交于
      Set StrictHostKeyChecking=no to auto-accept new ssh host keys if the
      no_verify extra parameter was specified.  This won't disable host key
      checking for already known hosts.  Includes a test and documentation.
      9a0e6a8f
    • M
      Add domain type checking · aa14709a
      Matthias Bolte 提交于
      The drivers were accepting domain configs without checking if those
      were actually meant for them. For example the LXC driver happily
      accepts configs with type QEMU.
      
      Add a check for the expected domain types to the virDomainDefParse*
      functions.
      aa14709a