1. 14 7月, 2015 2 次提交
    • A
      tests: Add nodeinfo test for non-present CPUs · f8b784a8
      Andrea Bolognani 提交于
      Some of the possible CPUs in a system might not be present, eg. they
      might be defective or might have been deconfigured from the ASM console
      in a Power system. Due to this fact, Linux keeps track of what CPUs are
      possible and what are present separately.
      
      This test uses the data from a system where not all the possible CPUs
      are present to make sure libvirt handles this situation correctly.
      f8b784a8
    • J
      nodeinfo: Add sysfs_prefix to nodeGetCPUCount · f1a43a0f
      John Ferlan 提交于
      Add the sysfs_prefix argument to the call to allow for setting the
      path for tests to something other than SYSFS_SYSTEM_PATH.
      f1a43a0f
  2. 10 7月, 2015 1 次提交
  3. 09 7月, 2015 1 次提交
  4. 08 7月, 2015 4 次提交
  5. 01 7月, 2015 1 次提交
  6. 30 6月, 2015 2 次提交
  7. 29 6月, 2015 1 次提交
  8. 26 6月, 2015 6 次提交
    • P
      test: qemu: Make sure that wr_highest_offset_valid gets set properly · 1c5e782c
      Peter Krempa 提交于
      Remove one instance of the field being present so that the code that
      sets that flag can be tested.
      1c5e782c
    • P
      qemu: monitor: Remove qemuMonitorGetBlockExtent · 78aefb52
      Peter Krempa 提交于
      Now that qemuMonitorGetAllBlockStatsInfo collects also wr_highest_offset
      the whole function can be killed.
      78aefb52
    • P
      qemu: monitor: Open-code retrieval of wr_highest_offset · 0d130a01
      Peter Krempa 提交于
      Instead of using qemuMonitorJSONDevGetBlockExtent (which I plan to
      remove later) extract the data in place.
      
      Additionally add a flag that will be set when the wr_highest_offset was
      extracted correctly so that callers can act according to that.
      
      The test case addition should help make sure that everything works.
      0d130a01
    • M
      qemuBuildMemoryBackendStr: Honour passed @pagesize · 70d75ffc
      Michal Privoznik 提交于
      So far the argument has not much meaning and was practically ignored.
      This is not good since when doing memory hotplug, the size of desired
      hugepage backing is passed in that argument. Taking closer look at the
      tests I'm fixing reveals the bug. For instance, while the following is
      in the test:
      
          <memory model='dimm'>
            <source>
              <nodemask>1-3</nodemask>
              <pagesize unit='KiB'>4096</pagesize>
            </source>
            <target>
              <size unit='KiB'>524287</size>
              <node>0</node>
            </target>
            <address type='dimm' slot='0' base='0x100000000'/>
          </memory>
      
      the generated commandline corresponding to this XML was:
      
          -object memory-backend-ram,id=memdimm0,size=536870912,\
          host-nodes=1-3,policy=bind
      
      Have you noticed? Yes, memory-backend-ram! Nothing can be further away
      from the right answer. The hugepage backing is requested in the XML
      and we happily ignore it. This is just not right. It's
      memory-backend-file which should have been used:
      
          -object memory-backend-file,id=memdimm0,prealloc=yes,\
          mem-path=/dev/hugepages4M/libvirt/qemu,size=536870912,\
          host-nodes=1-3,policy=bind
      
      The problem is, that @pagesize passed to qemuBuildMemoryBackendStr
      (where this part of commandline is built) was ignored. The hugepage to
      back memory was searched only and only by NUMA nodes pinning. This
      works only for regular guest NUMA nodes.
      
      Then, I'm changing the hugepages size in the test XMLs too. This is
      simply because in the test suite we create dummy mount points just for
      2M and 1G hugepages. And in the test 4M was requested. I'm sticking to
      2M, but 1G should just work too.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      70d75ffc
    • M
      qemuBuildMemoryBackendStr: Fix hugepages lookup process · f8e9deb1
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1196644
      
      This function constructs the backend (host facing) part of the
      memory device.  At the beginning, the configured hugepages are
      searched to find the best match for given guest NUMA node.
      Configured hugepages can have a @nodeset attribute to specify on
      which guest NUMA nodes should be the hugepages backing used.
      There is, however, one 'corner case'. Users may just tell 'use
      hugepages to back all the nodes'. In other words:
      
        <memoryBacking>
          <hugepages/>
        </memoryBacking>
      
        <cpu>
          <numa>
            <cell id='0' cpus='0-1' memory='1024000' unit='KiB'/>
          </numa>
        </cpu>
      
      Our code fails in this case. Well, since there's no @nodeset (nor
      any <page/> child element to <hugepages/>) we fail to lookup the
      default hugepage size to use.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f8e9deb1
    • L
      conf: Format scheduler priority when it is zero · 786539d6
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1235116
      
      According to our XML definition, zero is as valid as any other value.
      Mainly because it should be kernel-agnostic.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      786539d6
  9. 25 6月, 2015 5 次提交
    • E
      json: enhance parser test · cb005533
      Eric Blake 提交于
      We already enable the parser option to detect invalid UTF-8, but
      didn't test it.  Also, JSON states that behavior of an object
      with a duplicated key is undefined; we chose to reject it, but
      were not testing it.
      
      With the enhanced tests in place, we can simplify yajl2
      initialization by relying on parser defaults being sane.
      
      * src/util/virjson.c (virJSONValueFromString): Simplify.
      * tests/jsontest.c (mymain): Test more bad usage.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      cb005533
    • E
      json: even stricter trailing garbage detection · 7e191fd9
      Eric Blake 提交于
      Since older yajl ignores trailing garbage, a client can cause
      problems by intentionally ending the wrapper array early. Since
      we already track nesting, it's not too much harder to reject
      invalid nesting pops.
      
      * src/util/virjson. (_virJSONParser): Add field.
      (virJSONValueFromString): Set witness.
      (virJSONParserHandleEndArray): Use it to catch abuse.
      * tests/jsontest.c (mymain): Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7e191fd9
    • E
      json: reject trailing garbage · 7cd991b7
      Eric Blake 提交于
      Yajl 2 has a nice feature that it can be configured whether to
      allow multiple JSON objects parsed from a single stream, defaulting
      to off.  And yajl 1.0.12 at least provided a way to tell if all
      input bytes were parsed, or if trailing bytes remained after a
      valid JSON object was parsed.  But we target RHEL 6 yajl 1.0.7,
      which has neither of these.  So fake it by always parsing '[...]'
      instead, so that trailing garbage either trips up the array parse,
      or is easily detected when unwrapping the result.
      
      * src/util/virjson.c (virJSONValueFromString): With older json,
      wrap text to avoid trailing garbage.
      * tests/jsontest.c (mymain): Add tests for this.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7cd991b7
    • E
      json: reject javascript comments · 54dbba5b
      Eric Blake 提交于
      We have been allowing javascript style comments in JSON ever
      since commit 9428f2ce (v0.7.5), but qemu doesn't send them, and
      they are not strict JSON.  Reject them for now; if we can later
      prove that it is worthwhile, we can reinstate it at that point
      (or even make it conditional, by adding a bool parameter to
      the libvirt entry point).
      
      * src/util/virjson.c (virJSONValueFromString): Don't enable
      comment parsing.
      * tests/jsontest.c (mymain): Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      54dbba5b
    • E
      json: cope with older yajl semantics · f2acaebd
      Eric Blake 提交于
      Commit ceb496e5 fails on RHEL 6, with yajl 1.0.7, because that
      version of yajl returns yajl_status_insufficient_data when the
      parser is waiting for the rest of a token (this enum value was
      dropped in yajl 2, so we have to wrap it).  It also exposes a
      problem where older yajl silently ignores trailing garbage after
      a successful parse, so this patch works around that by changing
      the testsuite.  Another more invasive patch can add tighter
      semantics to json parsing, but this is sufficient for a minimal
      clean backport.
      
      While touching this, fix up our error message cleanup. Yajl
      documents that error messages produced by yajl_get_error()
      MUST be cleaned with yajl_free_error(); this is certainly
      true if we were to pass non-NULL allocator callbacks during
      yajl_alloc(), but probably harmless in our usage of passing
      NULL.  But better safe than sorry.
      
      * src/util/virjson.c (virJSONValueFromString): Allow different
      error code.  Use canonical cleanup of error message.
      (VIR_YAJL_STATUS_OK): New helper macro.
      * tests/jsontest.c (mymain): Wrap text to avoid difference in
      trailing garbage handling
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f2acaebd
  10. 24 6月, 2015 3 次提交
  11. 23 6月, 2015 4 次提交
    • E
      docs: Fix XML schema handling of LUN address in hostdev tag · c733e973
      Eric Farman 提交于
      Defining a domain with a SCSI disk attached via a hostdev
      tag and a source address unit value longer than two digits
      causes an error when editing the domain with virsh edit,
      even if no changes are made to the domain definition.
      The error suggests invalid XML, somewhere:
      
        # virsh edit lmb_guest
        error: XML document failed to validate against schema:
        Unable to validate doc against /usr/local/share/libvirt/schemas/domain.rng
        Extra element devices in interleave
        Element domain failed to validate content
      
      The virt-xml-validate tool fails with a similar error:
      
        # virt-xml-validate lmb_guest.xml
        Relax-NG validity error : Extra element devices in interleave
        lmb_guest.xml:17: element devices: Relax-NG validity error :
        Element domain failed to validate content
        lmb_guest.xml fails to validate
      
      The hostdev tag requires a source address to be specified,
      which includes bus, target, and unit address attributes.
      According to the SCSI Architecture Model spec (section
      4.9 of SAM-2), a LUN address is 64 bits and thus could be
      up to 20 decimal digits long.  Unfortunately, the XML
      schema limits this string to just two digits.  Similarly,
      the target field can be up to 32 bits in length, which
      would be 10 decimal digits.
      
        # lsscsi -xx
        [0:0:19:0x4022401100000000]  disk    IBM      2107900          3.44 /dev/sda
        # lsscsi
        [0:0:19:1074872354]disk    IBM      2107900          3.44  /dev/sda
        # cat lmb_guest.xml
        <domain type='kvm'>
          <name>lmb_guest</name>
          <memory unit='MiB'>1024</memory>
        ...trimmed...
          <devices>
            <controller type='scsi' model='virtio-scsi' index='0'/>
            <hostdev mode='subsystem' type='scsi'>
              <source>
                <adapter name='scsi_host0'/>
                <address bus='0' target='19' unit='1074872354'/>
              </source>
            </hostdev>
        ...trimmed...
      
      Since the reference unit and target fields are used in
      several places in the XML schema, create a separate one
      specific for SCSI Logical Units that will permit the
      greater length.  This permits both the validation utility
      and the virsh edit command to succeed when a hostdev
      tag is included.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      Reviewed-by: NMatthew Rosato <mjrosato@linux.vnet.ibm.com>
      Reviewed-by: NStefan Zimmermann <stzi@linux.vnet.ibm.com>
      Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      c733e973
    • E
      Convert SCSI logical unit from unsigned int to unsigned long long · 22b8a617
      Eric Farman 提交于
      The SCSI Architecture Model defines a logical unit address
      as 64-bits in length, so change the field accordingly so
      that the entire value could be stored.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      22b8a617
    • E
      json: make it easier to type-check when getting from object · 58fd6703
      Eric Blake 提交于
      While working in qemu_monitor_json, I repeatedly found myself
      getting a value then checking if it was an object.  Add some
      wrappers to make this task easier.
      
      * src/util/virjson.c (virJSONValueObjectGetByType)
      (virJSONValueObjectGetObject, virJSONValueObjectGetArray): New
      functions.
      (virJSONValueObjectGetString, virJSONValueObjectGetNumberInt)
      (virJSONValueObjectGetNumberUint)
      (virJSONValueObjectGetNumberLong)
      (virJSONValueObjectGetNumberUlong)
      (virJSONValueObjectGetNumberDouble)
      (virJSONValueObjectGetBoolean): Simplify.
      (virJSONValueIsNull): Change return type.
      * src/util/virjson.h: Reflect changes.
      * src/libvirt_private.syms (virjson.h): Export them.
      * tests/jsontest.c (testJSONLookup): New test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      58fd6703
    • E
      json: fully parse input string · ceb496e5
      Eric Blake 提交于
      I was adding a JSON test, and was shocked to find out our parser
      treated the input string of "1" as invalid JSON.  It turns out
      that YAJL specifically documents that it buffers input, and that
      if the last input read could be a prefix to a longer token, then
      you have to explicitly tell the parser that the buffer has ended
      before that token will be processed.
      
      It doesn't help that yajl 2 renamed the function from what it was
      in yajl 1.
      
      * src/util/virjson.c (virJSONValueFromString): Complete parse, in
      case buffer ends in possible token prefix.
      * tests/jsontest.c (mymain): Expose the problem.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ceb496e5
  12. 19 6月, 2015 1 次提交
  13. 18 6月, 2015 7 次提交
  14. 17 6月, 2015 1 次提交
  15. 16 6月, 2015 1 次提交