1. 29 7月, 2011 1 次提交
    • 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
  2. 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
  3. 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
  4. 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
  5. 21 7月, 2011 1 次提交
  6. 19 7月, 2011 1 次提交
  7. 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
  8. 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
  9. 11 7月, 2011 3 次提交
    • E
      tests: simplify formatting · 9693e293
      Eric Blake 提交于
      The shell version would output 40 extra spaces for a test with
      a multiple of 40 sub-tests, and the C version can use the same
      printf optimization for avoiding a loop over single space output
      as the shell version.
      
      * tests/testutils.c (virtTestMain): Avoid loop for alignment.
      * tests/test-lib.sh: Fix formatting when counter is multiple of 40.
      9693e293
    • J
      Do not drop kernel cmdline for xen pv domains · eb314315
      Jim Fehlig 提交于
      Kernel cmdline args can be passed to xen pv domains even when a
      bootloader is specified.  The current config-to-sxpr mapping
      ignores cmdline when bootloader is present.
      
      Since the xend sub-driver is used with many xen toolstack versions,
      this patch takes conservative approach of adding an else block to
      existing !def->os.bootloader, and only appends sxpr if def->os.cmdline
      is non-NULL.
      
      V2: Fix existing testcase broken by this patch and add new testcases
      eb314315
    • M
      bios: Add support for SGA · 874e65aa
      Michal Privoznik 提交于
      This patch creates new <bios> element which, at this time has only the
      attribute useserial='yes|no'. This attribute allow users to use
      Serial Graphics Adapter and see BIOS messages from the very first moment
      domain boots up. Therefore, users can choose boot medium, set PXE, etc.
      874e65aa
  10. 09 7月, 2011 3 次提交
    • M
      tests: Improve output of tests that decide to skip at runtime · c3ab6b2b
      Matthias Bolte 提交于
      Don't print OK/FAIL for tests that decide to be skipped after
      calling virtTestMain. Delay printing of the indentation before
      the first test until we know that the test didn't decide to be
      skipped.
      
      Also make the reconnect test use VIRT_TEST_MAIN.
      c3ab6b2b
    • M
      tests: Fix compressed test output padding logic · b1c9bf27
      Matthias Bolte 提交于
      The current logic tries to count from 1 to 40 and ignores paddings
      of 0 and 1 to 40. This doesn't work for counter + 1 mod 40 == 0
      like here for counter value 159
      
      TEST: virsh-all
            ........................................ 40
            ........................................ 80
            ........................................ 120
            ....................................... 159 OK
      PASS: virsh-all
      
      Also seq isn't portable. Therefore, calculate the correct padding
      length directly and use printf to output it at once.
      b1c9bf27
    • M
      tests: Use EXIT_AM_SKIP instead of 77 directly · 4540f8d2
      Matthias Bolte 提交于
      4540f8d2
  11. 08 7月, 2011 4 次提交
  12. 05 7月, 2011 1 次提交
  13. 02 7月, 2011 3 次提交
    • E
      build: avoid 'make syntax-check' failure · 5d382c57
      Eric Blake 提交于
      * tests/utiltest.c (DO_TEST): Fix indentation for cppi.
      5d382c57
    • M
      tests: Add a general util test · ab0b2c19
      Matthias Bolte 提交于
      Move non-esx specific tests from esxutilstest there and add a
      test for virParseVersionString.
      ab0b2c19
    • E
      build: consistently use CFLAGS · 6ae3052c
      Eric Blake 提交于
      According to the automake manual, CPPFLAGS (aka INCLUDES, as spelled
      in automake 1.9.6) should only include -I, -D, and -U directives; more
      generic directives like -Wall belong in CFLAGS since they affect more
      phases of the build process.  Therefore, we should be sticking CFLAGS
      additions into a CFLAGS container, not a CPPFLAGS container.
      
      * src/Makefile.am (libvirt_driver_vmware_la_CFLAGS): Use AM_CFLAGS.
      (INCLUDES): Move CFLAGS items...
      (AM_CFLAGS): ...to their proper location.
      * python/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
      * tests/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
      (commandtest_CFLAGS, commandhelper_CFLAGS)
      (virnetmessagetest_CFLAGS, virnetsockettest_CFLAGS): Use AM_CFLAGS.
      6ae3052c
  14. 01 7月, 2011 2 次提交
  15. 30 6月, 2011 1 次提交
  16. 29 6月, 2011 2 次提交
    • O
      tests: Fix memory leak in virnetmessagetest · a2753079
      Osier Yang 提交于
      Detected when playing with "make -C tests valgrind".
      a2753079
    • M
      network: Fix dnsmasq hostsfile creation logic and related tests · 9523b3c3
      Matthias Bolte 提交于
      networkSaveDnsmasqHostsfile was added in 8fa9c221 (Apr 2010).
      It has a force flag. If the dnsmasq hostsfile already exists force
      needs to be true to overwrite it. networkBuildDnsmasqArgv sets force
      to false, networkDefine sets it to true. This results in the
      hostsfile being written only in networkDefine in the common case.
      If no error occurred networkSaveDnsmasqHostsfile returns true and
      networkBuildDnsmasqArgv adds the --dhcp-hostsfile to the dnsmasq
      command line.
      
      networkSaveDnsmasqHostsfile was changed in 89ae9849 (24 Jun 2011)
      to return a new dnsmasqContext instead of reusing one. This change broke
      the logic of the force flag as now networkSaveDnsmasqHostsfile returns
      NULL on error, but the early return -- if force was not set and the
      hostsfile exists -- returns 0. This turned the early return in an error
      case and networkBuildDnsmasqArgv didn't add the --dhcp-hostsfile option
      anymore if the hostsfile already exists. It did because networkDefine
      created the hostsfile already.
      
      Then 9d4e2845 fixed the return 0 case in networkSaveDnsmasqHostsfile
      but didn't apply the force option correctly to the new addnhosts file.
      Now force doesn't control an early return anymore, but influences the
      handling of the hostsfile context creation and dnsmasqSave is always
      called now. This commit also added test cases that reveal several
      problems. First, the tests now calls functions that try to write the
      dnsmasq config files to disk. If someone runs this tests as root this
      might overwrite actively used dnsmasq config files, this is a no-go. Also
      the tests depend on configure --localstatedir, this needs to be fixed as
      well, because it makes the tests fail when localstatedir is different
      from /var.
      
      This patch does several things to fix this:
      
      1) Move dnsmasqContext creation and saving out of networkBuildDnsmasqArgv
      to the caller to separate the command line generation from the config
      file writing. This makes the command line generation testable without the
      risk of interfering with system files, because the tests just don't call
      dnsmasqSave.
      
      2) This refactoring of networkSaveDnsmasqHostsfile makes the force flag
      useless as the saving happens somewhere else now. This fixes the wrong
      usage of the force flag in combination with then newly added addnhosts
      file by removing the force flag.
      
      3) Adapt the wrong test cases to the correct behavior, by adding the
      missing --dhcp-hostsfile option. Both affected tests contain DHCP host
      elements but missed the necessary --dhcp-hostsfile option.
      
      4) Rename networkSaveDnsmasqHostsfile to networkBuildDnsmasqHostsfile,
      because it doesn't save the dnsmasqContext anymore.
      
      5) Move all directory creations in dnsmasq context handling code from
      the *New functions to dnsmasqSave to avoid directory creations in system
      paths in the test cases.
      
      6) Now that networkBuildDnsmasqArgv doesn't create the dnsmasqContext
      anymore the test case can create one with the localstatedir that is
      expected by the tests instead of the configure --localstatedir given one.
      9523b3c3