1. 20 6月, 2014 7 次提交
  2. 19 6月, 2014 14 次提交
    • E
      virsh: fix broken code in freepages · 404bac14
      Eric Blake 提交于
      Commit 9e3efe53 broke the build under valgrind or clang, by writing
      8 bytes through an allocation of 4 bytes.  It also risks multiplication
      overflow when mallocing (that's a pervasive problem that needs an
      audit in the rest of the code, but we might as well fix this one while
      we are here), and had a typo.
      
      * tools/virsh-host.c (cmdFreepages): Avoid integer overflow and
      undefined behavior.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      404bac14
    • L
      interface: allow reordering of elements in xml · a341fc73
      Laine Stump 提交于
      The interface xml schema was written with strict rules about the
      ordering of the elements. This was never intentional, but just due to
      omission of <interleave> in the appropriate places. This patch just
      adds in <interleave> wherever there is more than one element, and
      re-indents everything else appropriately.
      a341fc73
    • J
      docs: fix some typos in formatdomain.html · d98a60c2
      Jincheng Miao 提交于
      In section "Block / character devices" of "Host device assignment",
      the description of hostdev element has some error:
      
      For a block device, the type should be "storage", not "block";
      For a character device, the type should be "misc", not "char".
      Signed-off-by: NJincheng Miao <jmiao@redhat.com>
      d98a60c2
    • M
      nodeinfo: Implement nodeGetFreePages · 38fa03f4
      Michal Privoznik 提交于
      And add stubs to other drivers like: lxc, qemu, uml and vbox.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      38fa03f4
    • M
      virsh: Expose virNodeGetFreePages · 9e3efe53
      Michal Privoznik 提交于
      The new API is exposed under 'freepages' command.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9e3efe53
    • M
      Introduce virNodeGetFreePages · 34f2d031
      Michal Privoznik 提交于
      The aim of the API is to get information on number of free pages
      on the system. The API behaves similar to the
      virNodeGetCellsFreeMemory(). User passes starting NUMA cell, the
      count of nodes that he's interested in, pages sizes (yes,
      multiple sizes can be queried at once) and the counts are
      returned in an array.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      34f2d031
    • M
      virCaps: expose pages info · 02129b7c
      Michal Privoznik 提交于
      There are two places where you'll find info on page sizes. The first
      one is under <cpu/> element, where all supported pages sizes are
      listed. Then the second one is under each <cell/> element which refers
      to concrete NUMA node. At this place, the size of page's pool is
      reported. So the capabilities XML looks something like this:
      
      <capabilities>
      
        <host>
          <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
          <cpu>
            <arch>x86_64</arch>
            <model>Westmere</model>
            <vendor>Intel</vendor>
            <topology sockets='1' cores='1' threads='1'/>
            ...
            <pages unit='KiB' size='4'/>
            <pages unit='KiB' size='2048'/>
            <pages unit='KiB' size='1048576'/>
          </cpu>
          ...
          <topology>
            <cells num='4'>
              <cell id='0'>
                <memory unit='KiB'>4054408</memory>
                <pages unit='KiB' size='4'>1013602</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                </cpus>
              </cell>
              <cell id='1'>
                <memory unit='KiB'>4071072</memory>
                <pages unit='KiB' size='4'>1017768</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
                </cpus>
              </cell>
              ...
            </cells>
          </topology>
          ...
        </host>
      
        <guest/>
      
      </capabilities>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      02129b7c
    • M
      virnuma: Introduce pages helpers · 35f1095e
      Michal Privoznik 提交于
      For future work we need two functions that fetches total number of
      pages and number of free pages for given NUMA node and page size
      (virNumaGetPageInfo()).
      
      Then we need to learn pages of what sizes are supported on given node
      (virNumaGetPages()).
      
      Note that system page size is disabled at the moment as there's one
      issue connected. If you have a NUMA node with huge pages allocated the
      kernel would return the normal size of memory for that node. It
      basically ignores the fact that huge pages steal size from the system
      memory. Until we resolve this, it's safer to not confuse users and
      hence not report any system pages yet.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      35f1095e
    • M
      nodeinfo: Rename nodeGetFreeMemory to nodeGetMemory · 99a63aed
      Michal Privoznik 提交于
      For future work we want to get info for not only the free memory
      but overall memory size too. That's why the function must have
      new signature too.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      99a63aed
    • M
      virnuma: Introduce virNumaNodeIsAvailable · 356c6f38
      Michal Privoznik 提交于
      Not on all hosts the set of NUMA nodes IDs is continuous. This is
      critical, because our code currently assumes the set doesn't contain
      holes. For instance in nodeGetFreeMemory() we can see the following
      pattern:
      
          if ((max_node = virNumaGetMaxNode()) < 0)
              return 0;
      
          for (n = 0; n <= max_node; n++) {
              ...
          }
      
      while it should be something like this:
      
          if ((max_node = virNumaGetMaxNode()) < 0)
              return 0;
      
          for (n = 0; n <= max_node; n++) {
              if (!virNumaNodeIsAvailable(n))
                  continue;
              ...
          }
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      356c6f38
    • E
      virsh: expose new active commit controls · f182da20
      Eric Blake 提交于
      Add knobs to virsh to manage a 2-phase active commit of the top
      layer, similar to knobs already present on blockcopy.  While this
      code will fail until later patches actually implement the new
      knobs in the qemu driver, doing it now proves that the API is
      usable and also makes it easier for testing the qemu changes as
      they are made.
      
      * tools/virsh-domain.c (cmdBlockCommit): Add --active, --pivot,
      and --keep-overlay options, modeled after blockcopy.
      (blockJobImpl): Support --active flag.
      * tools/virsh.pod (blockcommit): Document new flags.
      (blockjob): Mention 2-phase commit interaction.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f182da20
    • E
      blockjob: use stable disk string in job event · 1bfe73a1
      Eric Blake 提交于
      When the block job event was first added, it was for block pull,
      where the active layer of the disk remains the same name.  It was
      also in a day where we only cared about local files, and so we
      always had a canonical absolute file name.  But two things have
      changed since then: we now have network disks, where determining
      a single absolute string does not really make sense; and we have
      two-phase jobs (copy and active commit) where the name of the
      active layer changes between the first event (ready, on the old
      name) and second (complete, on the pivoted name).
      
      Adam Litke reported that having an unstable string between events
      makes life harder for clients.  Furthermore, all of our API that
      operate on a particular disk of a domain accept multiple strings:
      not only the absolute name of the active layer, but also the
      destination device name (such as 'vda').  As this latter name is
      stable, even for network sources, it serves as a better string
      to supply in block job events.
      
      But backwards-compatibility demands that we should not change the
      name handed to users unless they explicitly request it.  Therefore,
      this patch adds a new event, BLOCK_JOB_2 (alas, I couldn't think of
      any nicer name - but at least Migrate2 and Migrate3 are precedent
      for a number suffix).  We must double up on emitting both old-style
      and new-style events according to what clients have registered for
      (see also how IOError and IOErrorReason emits double events, but
      there the difference was a larger struct rather than changed
      meaning of one of the struct members).
      
      Unfortunately, adding a new event isn't something that can easily
      be broken into pieces, so the commit is rather large.
      
      * include/libvirt/libvirt.h.in (virDomainEventID): Add a new id
      for VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2.
      (virConnectDomainEventBlockJobCallback): Document new semantics.
      * src/conf/domain_event.c (_virDomainEventBlockJob): Rename field,
      to ensure we catch all clients.
      (virDomainEventBlockJobNew): Add parameter.
      (virDomainEventBlockJobDispose)
      (virDomainEventBlockJobNewFromObj)
      (virDomainEventBlockJobNewFromDom)
      (virDomainEventDispatchDefaultFunc): Adjust clients.
      (virDomainEventBlockJob2NewFromObj)
      (virDomainEventBlockJob2NewFromDom): New functions.
      * src/conf/domain_event.h: Add new prototypes.
      * src/libvirt_private.syms (domain_event.h): Export new functions.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Generate two
      different events.
      * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Likewise.
      * src/remote/remote_protocol.x
      (remote_domain_event_block_job_2_msg): New struct.
      (REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2): New RPC.
      * src/remote/remote_driver.c
      (remoteDomainBuildEventBlockJob2): New handler.
      (remoteEvents): Register new event.
      * daemon/remote.c (remoteRelayDomainEventBlockJob2): New handler.
      (domainEventCallbacks): Register new event.
      * tools/virsh-domain.c (vshEventCallbacks): Likewise.
      (vshEventBlockJobPrint): Adjust client.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1bfe73a1
    • J
      Fix xmconfigtest · 64b60266
      Jim Fehlig 提交于
      Commit ac63014c introduced a regression in the conversion of Xen
      xm config to XML by emitting an empty <cmdline>.  Prior to this
      commit, <cmdline> was omitted if the xm config was missing (or
      contained an empty) 'extra='.
      64b60266
    • I
      xen: handle root= in xen-xm configuration files. · ac63014c
      Ian Campbell 提交于
      In addition to extra= xm supported a root= option which was supposed
      to be incorporated into the final command line. Handle that for "virsh
      domxml-from-native xen-xm". Tested with the libxl backend.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      ac63014c
  3. 18 6月, 2014 7 次提交
  4. 17 6月, 2014 12 次提交
    • P
      vbox: snapshot: Avoid memleaks in functions dealing with disk arrays · 28427e6b
      Peter Krempa 提交于
      In virVBoxSnapshotConfRemoveFakeDisks and
      virVBoxSnapshotConfDiskIsInMediaRegistry the disk array constructed from
      all the disks would be leaked at the end of the function and on
      allocation errors. Also the temporary disk list would be leaked.
      
      Add a cleanup section and free the memory properly.
      
      Found by coverity.
      28427e6b
    • P
      vbox: snapshot: Avoid memleak in virVBoxSnapshotConfAllChildren · ca9a94a0
      Peter Krempa 提交于
      On re-allocation failure the function would leak already allocated
      memory.
      ca9a94a0
    • P
      uuid: Fix coverity warning of unchecked return value · 810eea71
      Peter Krempa 提交于
      Coverity checks for patterns of handling return values of functions.
      Some recent addition must have tripped a threshold where coverity now
      complains that we usually check the return value of virUUIDGenerate but
      don't do it in one place. Add a check to make coverity happy.
      810eea71
    • P
      network: bridge: Avoid freeing uninitialized pointer on cleanup path · b9f8a2f2
      Peter Krempa 提交于
      The cleanup path in networkBuildDhcpDaemonCommandLine could cause a
      crash by freeing uninitialized pointer.
      b9f8a2f2
    • P
      net: leaseshelper: Refactor copying of old entries to avoid double free · 0657ed2a
      Peter Krempa 提交于
      When copying entries from the old lease file into the new array the old
      code would copy the pointer of the json object into the second array
      without removing it from the first. Afterwards when both arrays were
      freed this might lead to a crash due to access of already freed memory.
      
      Refactor the code to use the new array item stealing helper added to the
      json code so that the entry resides just in one array.
      0657ed2a
    • P
      net: leaseshelper: Ignore corrupted lease file and rewrite it · 45d51681
      Peter Krempa 提交于
      Instead of reporting an error and terminating, rewrite the file with
      the newly learned info.
      45d51681
    • P
      net: leaseshelper: Don't crash if DNSMASQ doesn't provide lease expiry · f1385e22
      Peter Krempa 提交于
      The value is provided via environment and causes a crash if not defined.
      f1385e22
    • P
      util: json: Add helpers for manipulating json arrays · 5133b503
      Peter Krempa 提交于
      Add a checker to determine whether a JSON object is an array and a
      helper to steal objects from a JSON array.
      5133b503
    • P
      util: json: Unify function header formatting · 5429a3b6
      Peter Krempa 提交于
      Use consistent formatting of function headers:
      - two newlines separating functions
      - function return type on separate line
      - one argument per line
      5429a3b6
    • E
      blockjob: don't remove older-style mirror XML · b50e1049
      Eric Blake 提交于
      Commit 7c6fc394 introduced a regression in the XML produced for older
      clients.  The argument at the time was that clients shouldn't be
      depending on output-only data for something that is only going to
      be triggered for a transient guest; but John Ferlan reported that
      the automated testsuite was such a client.  It's better to be safe
      than sorry by guaranteeing back-compat cruft.  Note that later
      patches will be using <mirror> for active block commit, but there
      we don't have to worry about back-compat.
      
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Restore old
      style output when necessary.
      * docs/schemas/domaincommon.rng: Validate back-compat style.
      * docs/formatdomain.html.in: Update the documentation.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
      Update tests.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b50e1049
    • E
      blockjob: avoid compiler uncertainty in info sizing · cfe087a2
      Eric Blake 提交于
      We have a policy of avoiding enum types in structs in our public
      API, because it is possible for a client to choose compiler options
      that can change the in-memory ABI of that struct based on whether
      the enum value occupies an int or a minimal size.  But we missed
      this for virDomainBlockJobInfo.  We got lucky on little-endian
      machines - if the enum fits minimal size (a char), we still end
      up padding to the next long before the next field; but on
      big-endian, a client interpreting the enum as a char would always
      see 0 when the server supplies contents as an int.
      
      * include/libvirt/libvirt.h.in (virDomainBlockJobInfo): Enforce
      particular sizing.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      cfe087a2
    • E
      blockjob: document recent job addition · 3de3294d
      Eric Blake 提交于
      I noticed that the web page lacked documentation on block jobs:
      http://libvirt.org/html/libvirt-libvirt.html#virDomainBlockJobType
      not only for the recently added active commit, but also for all
      the other job types.
      
      * include/libvirt/libvirt.h.in (virDomainBlockJobType): Document
      recent addition.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3de3294d