1. 02 7月, 2011 2 次提交
    • 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
  2. 01 7月, 2011 2 次提交
  3. 30 6月, 2011 1 次提交
  4. 29 6月, 2011 3 次提交
    • 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
    • L
      network: add domain to unqualified names defined with <host> · 25171f60
      Laine Stump 提交于
      If a domain name is defined for a network, add the --expand-hosts
      option to the dnsmasq commandline. This results in the domain being
      added to any hostname that is defined in a dns <host> element and
      contains no '.' characters (i.e. it is an "unqualified"
      hostname). Since PTR records are automatically created for any name
      defined in <host>, the result of a PTR request will change from the
      unqualified name to the qualified name.
      
      This also has the same effect on any hostnames that dnsmasq reads
      from the host's /etc/hosts file.
      
      (In the case of guest hostnames that were learned by dnsmasq via DHCP
      requests, they were already getting the domain name added on, even
      without --expand-hosts).
      25171f60
  5. 27 6月, 2011 1 次提交
  6. 25 6月, 2011 5 次提交
  7. 24 6月, 2011 4 次提交
    • E
      maint: typo fixes · acb31cf5
      Eric Blake 提交于
      * src/xenxs/xen_sxpr.c (xenParseSxprPCI): Comment fix.
      * tests/object-locking.ml (driverTables): Likewise.
      * tests/testutils.c (virtTestDifferenceBin): Likewise.
      acb31cf5
    • D
      Support reboots with the QEMU driver · 42f43592
      Daniel P. Berrange 提交于
      For controlled shutdown we issue a 'system_powerdown' command
      to the QEMU monitor. This triggers an ACPI event which (most)
      guest OS wire up to a controlled shutdown. There is no equiv
      ACPI event to trigger a controlled reboot. This patch attempts
      to fake a reboot.
      
       - In qemuDomainObjPrivatePtr we have a bool fakeReboot
         flag.
       - The virDomainReboot method sets this flag and then
         triggers a normal 'system_powerdown'.
       - The QEMU process is started with '-no-shutdown'
         so that the guest CPUs pause when it powers off the
         guest
       - When we receive the 'POWEROFF' event from QEMU JSON
         monitor if fakeReboot is not set we invoke the
         qemuProcessKill command and shutdown continues
         normally
       - If fakeReboot was set, we spawn a background thread
         which issues 'system_reset' to perform a warm reboot
         of the guest hardware. Then it issues 'cont' to
         start the CPUs again
      
      * src/qemu/qemu_command.c: Add -no-shutdown flag if
        we have JSON support
      * src/qemu/qemu_domain.h: Add 'fakeReboot' flag to
        qemuDomainObjPrivate struct
      * src/qemu/qemu_driver.c: Fake reboot using the
        system_powerdown command if JSON support is available
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        binding for system_reset command
      * src/qemu/qemu_process.c: Reset the guest & start CPUs if
        fakeReboot is set
      42f43592
    • D
      Introduce a generic object for using network sockets · 58b5b14e
      Daniel P. Berrange 提交于
      Introduces a simple wrapper around the raw POSIX sockets APIs
      and name resolution APIs. Allows for easy creation of client
      and server sockets with correct usage of name resolution APIs
      for protocol agnostic socket setup.
      
      It can listen for UNIX and TCP stream sockets.
      
      It can connect to UNIX, TCP streams directly, or indirectly
      to UNIX sockets via an SSH tunnel or external command
      
      * src/Makefile.am: Add to libvirt-net-rpc.la
      * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Generic
        sockets APIs
      * tests/Makefile.am: Add socket test
      * tests/virnetsockettest.c: New test case
      * tests/testutils.c: Avoid overriding LIBVIRT_DEBUG settings
      * tests/ssh.c: Dumb helper program for SSH tunnelling tests
      58b5b14e
    • D
      Provide a simple object for encoding/decoding RPC messages · ceacc1dd
      Daniel P. Berrange 提交于
      This provides a new struct that contains a buffer for the RPC
      message header+payload, as well as a decoded copy of the message
      header. There is an API for applying a XDR encoding & decoding
      of the message headers and payloads. There are also APIs for
      maintaining a simple FIFO queue of message instances.
      
      Expected usage scenarios are:
      
      To send a message
      
         msg = virNetMessageNew()
      
         ...fill in msg->header fields..
         virNetMessageEncodeHeader(msg)
         ...loook at msg->header fields to determine payload filter
         virNetMessageEncodePayload(msg, xdrfilter, data)
         ...send msg->bufferLength worth of data from buffer
      
      To receive a message
      
         msg = virNetMessageNew()
         ...read VIR_NET_MESSAGE_LEN_MAX of data into buffer
         virNetMessageDecodeLength(msg)
         ...read msg->bufferLength-msg->bufferOffset of data into buffer
         virNetMessageDecodeHeader(msg)
         ...look at msg->header fields to determine payload filter
         virNetMessageDecodePayload(msg, xdrfilter, data)
         ...run payload processor
      
      * src/Makefile.am: Add to libvirt-net-rpc.la
      * src/rpc/virnetmessage.c, src/rpc/virnetmessage.h: Internal
        message handling API.
      * testutils.c, testutils.h: Helper for printing binary differences
      * virnetmessagetest.c: Validate all XDR encoding/decoding
      ceacc1dd
  8. 22 6月, 2011 1 次提交
    • M
      qemu: domain I/O asynchronous handling · 017abcbb
      Michal Privoznik 提交于
      For virtio disks and interfaces, qemu allows users to enable or disable
      ioeventfd feature. This means, qemu can execute domain code, while
      another thread waits for I/O event. Basically, in some cases it is win,
      in some loss. This feature is available via 'ioeventfd' attribute in disk
      and interface <driver> element. It accepts 'on' and 'off'. Leaving this
      attribute out defaults to hypervisor decision.
      017abcbb
  9. 20 6月, 2011 1 次提交
    • O
      numatune: Add tests for numatune XML · b369114d
      Osier Yang 提交于
      Only add tests for qemuxmlargvtest.c, as there is no qemu command line
      for numatune XML, just want to make sure the XML could be validated
      well.
      b369114d
  10. 15 6月, 2011 3 次提交
    • J
      qemu: Translate boot config into bootindex if possible · c3068d4d
      Jiri Denemark 提交于
      Prefer bootindex=N option for -device over the old way -boot ORDER
      possibly accompanied with boot=on option for -drive. This gives us full
      control over which device will actually be used for booting guest OS.
      Moreover, if qemu doesn't support boot=on, this is the only way to boot
      of certain disks in some configurations (such as virtio disks when used
      together IDE disks) without transforming domain XML to use per device
      boot elements.
      c3068d4d
    • M
      spice: add <clipboard copypaste='yes|no'> option · 98bfdff1
      Marc-André Lureau 提交于
      From a security pov copy and paste between the guest and the client is not
      always desirable. So we need to be able to enable/disable this. The best place
      to do this from an administration pov is on the hypervisor, so the qemu cmdline
      is getting a spice disable-copy-paste option, see bug 693645. Example qemu
      invocation:
      qemu -spice port=5932,disable-ticketing,disable-copy-paste
      
      https://bugzilla.redhat.com/show_bug.cgi?id=693661
      98bfdff1
    • G
      Skip nodeinfo test on non intel architectures · acc7080a
      Guido Günther 提交于
      since the testfiles assume a /proc/cpuinfo specific to this
      architecture. We e.g. can't parse the number of cores on other
      architectures.
      acc7080a
  11. 13 6月, 2011 2 次提交
  12. 02 6月, 2011 5 次提交
    • D
      Support leases in guest XML and lock manager · 1ea83207
      Daniel P. Berrange 提交于
      A lock manager may operate in various modes. The direct mode of
      operation is to obtain locks based on the resources associated
      with devices in the XML. The indirect mode is where the app
      creating the domain provides explicit leases for each resource
      that needs to be locked. This XML extension allows for listing
      resources in the XML
      
        <devices>
           ...
           <lease>
             <lockspace>somearea</lockspace>
             <key>thequickbrownfoxjumpsoverthelazydog</key>
             <target path='/some/lease/path' offset='23432'/>
           </lease>
           ...
        </devices>
      
      The 'lockspace' is a unique identifier for the lockspace which
      the lease is associated
      
      The 'key' is a unique identifier for the resource associated
      with the lease.
      
      The 'target' is the file on disk where the leases are held.
      
      * docs/schemas/domain.rng: Add lease schema
      * src/conf/domain_conf.c, src/conf/domain_conf.h: parsing and
        formatting for leases
      * tests/qemuxml2argvdata/qemuxml2argv-lease.args,
        tests/qemuxml2argvdata/qemuxml2argv-lease.xml,
        tests/qemuxml2xmltest.c: Test XML handling for leases
      1ea83207
    • E
      tests: really fix QEMU XML-2-ARGV graphics-spice-timeout test · b43e78f7
      Eric Blake 提交于
      Alas, /usr/bin/kvm is also not directly supported by testutilsqemu.c.
      
      In fact, _any_ test that uses <cpu match=...> has to use our faked
      qemu.sh in order to properly answer the 'qemu -cpu ?' probe done
      during qemu command line building.
      
      * tests/qemuxml2argvdata/*graphics-spice-timeout*: Switch emulator, again.
      b43e78f7
    • J
      tests: Add a test for correct disk device ordering · f5534a13
      Jiri Denemark 提交于
      f5534a13
    • J
      Fix order of disks and controllers · c1a98d88
      Jiri Denemark 提交于
      Commit 2d6adabd replaced qsorting disk
      and controller devices with inserting them at the right position. That
      was to fix unnecessary reordering of devices. However, when parsing
      domain XML devices are just taken in the order in which they appear in
      the XML since. Use the correct insertion algorithm to honor device
      target.
      c1a98d88
    • M
      Fix QEMU XML-2-ARGV graphics-spice-timeout test · 3bb35a52
      Matthias Bolte 提交于
      The test used an emulator that is not supported in testutilsqemu.c.
      Switch from qemu-kvm to kvm to fix this.
      3bb35a52
  13. 01 6月, 2011 1 次提交
  14. 31 5月, 2011 2 次提交
  15. 27 5月, 2011 2 次提交
    • M
      esx: Fix regression in absolute file name handling · 8357d91b
      Matthias Bolte 提交于
      Before commit 145d6cb0 (in August 2010) absolute file names
      in VMX and domain XML configs were handled correctly. But this got
      lost during the refactoring. The test cases didn't highlight this
      problem because they have their own set of file name handling
      functions. The actual ones require a real connection to an ESX
      server. Also the test case functions always worked correctly.
      
      Fix the regression and add a new in-the-wild VMX file that contains
      such a problematic absolute path. Even though this test case won't
      protect against new regressions.
      
      Reported by lofic (IRC nick)
      8357d91b
    • M
      openvz: Add simple testcase for config file parsing function · 4a3a0290
      Matthias Bolte 提交于
      This testcase passes before the regression is added in f0443765, fails
      after that commit and passes again after the regression was fixed.
      4a3a0290
  16. 26 5月, 2011 1 次提交
  17. 24 5月, 2011 4 次提交
    • L
      qemu: fix typo in name - should be VHOST_NET, not VNET_HOST · 51781b82
      Laine Stump 提交于
      NB: the enum that uses the string vnet-host (now changed to vhost-net)
      is used in XML, but fortunately that hasn't been in an official
      release yet, so it can still be fixed.
      51781b82
    • D
      Fix QEMU -vnc arg generation with raw IPv6 addresses · 58765b58
      Daniel P. Berrange 提交于
      Since -vnc uses ':' to separate the address from the port, raw
      IPv6 addresses need to be escaped like [addr]:port
      
      * src/qemu/qemu_command.c: Escape raw IPv6 addresses with []
      * tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.args,
        tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml: Tweak
        to test Ipv6 escaping
      * docs/schemas/domain.rng: Allow Ipv6 addresses, or hostnames
        in <graphics> listen attributes
      58765b58
    • A
      spice: support streaming-video parameter · bb1c5423
      Alon Levy 提交于
      This adds a streaming-video=filter|all|off attribute. It is used to change
      the behavior of video stream detection in spice, the default is filter (the
      default for libvirt is not to specify it - the actual default is defined in
      libspice-server.so).
      
      Usage:
      
          <graphics type='spice' autoport='yes'>
            <streaming mode='off'/>
          </graphics>
      
      Tested with the above and with tests/qemuxml2argvtest.
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      bb1c5423
    • S
      nwfilter: enable filtering of gratuitous ARP packets · fcb0e8c2
      Stefan Berger 提交于
      This patch enables filtering of gratuitous ARP packets using the following XML:
      
      <rule action='accept' direction='in' priority='425'>
      <arp gratuitous='true'/>
      </rule>
      fcb0e8c2