1. 23 6月, 2015 4 次提交
    • E
      Read SCSI address attributes bus, target, unit as positive integer · f714f528
      Eric Farman 提交于
      The SCSI address element attributes bus, target, and unit are expected
      to be positive values, so make sure no one provides a negative value since
      the value is stored as an unsigned.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      f714f528
    • E
      qemu: simplify json parsing · 40783db3
      Eric Blake 提交于
      Rather than grabbing an arbitrary JSON value and then checking
      if it has the right type, we might as well request the correct
      type to begin with.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONIOProcessEvent)
      (qemuMonitorJSONCommandWithFd, qemuMonitorJSONHandleGraphics)
      (qemuMonitorJSONGetStatus, qemuMonitorJSONExtractCPUInfo)
      (qemuMonitorJSONGetVirtType, qemuMonitorJSONGetBalloonInfo)
      (qemuMonitorJSONGetMemoryStats)
      (qemuMonitorJSONDevGetBlockExtent)
      (qemuMonitorJSONGetOneBlockStatsInfo)
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacityOne)
      (qemuMonitorJSONBlockStatsUpdateCapacity)
      (qemuMonitorJSONGetBlockExtent)
      (qemuMonitorJSONGetMigrationStatusReply)
      (qemuMonitorJSONGetDumpGuestMemoryCapability)
      (qemuMonitorJSONAddFd, qemuMonitorJSONQueryRxFilterParse)
      (qemuMonitorJSONExtractChardevInfo)
      (qemuMonitorJSONDiskNameLookupOne)
      (qemuMonitorJSONDiskNameLookup)
      (qemuMonitorJSONGetAllBlockJobInfo)
      (qemuMonitorJSONBlockIoThrottleInfo, qemuMonitorJSONGetVersion)
      (qemuMonitorJSONGetMachines, qemuMonitorJSONGetCPUDefinitions)
      (qemuMonitorJSONGetCommands, qemuMonitorJSONGetEvents)
      (qemuMonitorJSONGetKVMState, qemuMonitorJSONGetObjectTypes)
      (qemuMonitorJSONGetObjectListPaths)
      (qemuMonitorJSONGetObjectProps, qemuMonitorJSONGetTargetArch)
      (qemuMonitorJSONGetMigrationCapabilities)
      (qemuMonitorJSONGetStringArray, qemuMonitorJSONAttachCharDev)
      (qemuMonitorJSONGetCPUx86Data, qemuMonitorJSONGetIOThreads)
      (qemuMonitorJSONGetMemoryDeviceInfo): Use shorter idioms.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      40783db3
    • 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
  2. 22 6月, 2015 6 次提交
  3. 20 6月, 2015 1 次提交
    • I
      libxl: avoid freeing an uninitialised bitmap · cc99d240
      Ian Campbell 提交于
      If vm->def->cputune.nvcpupin is 0 in libxlDomainSetVcpuAffinities (as
      seems to be the case on arm) then the VIR_FREE after cleanup: would be
      operating on an uninitialised pointer in map.map.
      
      Fix this by using libxl_bitmap_init and libxl_bitmap_dispose in the
      appropriate places (like VIR_FREE, libxl_bitmap_dispose is also
      idempotent, so there is no double free on exit from the loop).
      
      libxl_bitmap_dispose is slightly preferable since it also sets
      map.size back to 0, avoiding a potential source of confusion.
      
      This fixes the crashes we've been seeing in the Xen automated tests on
      ARM.
      
      I had a glance at the handful of other users of libxl_bitmap and none
      of them looked to have a similar issue.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      cc99d240
  4. 19 6月, 2015 25 次提交
  5. 18 6月, 2015 4 次提交