1. 18 7月, 2014 11 次提交
    • M
      examples: Introduce domtop · 28d54aab
      Michal Privoznik 提交于
      There's this question on the list that is asked over and over again.
      How do I get {cpu, memory, ...} usage in percentage? Or its modified
      version: How do I plot nice graphs like virt-manager does?
      
      It would be nice if we have an example to inspire people. And that's
      what domtop should do. Yes, it could be written in different ways, but
      I've chosen this one as I think it show explicitly what users need to
      implement in order to imitate virt-manager's graphing.
      
      Note: The usage is displayed from host perspective. That is, how much
      host CPUs the domain is using. But it should be fairly simple to
      switch do just guest CPU usage if needed.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      28d54aab
    • M
      Kill last strto{l,ll,d} scouts · 50281605
      Michal Privoznik 提交于
      There's no need to use it since we have this shiny functions
      that even checks for conversion and overflow errors.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      50281605
    • C
      7c10a774
    • C
      lxc network configuration allows setting target container NIC name · 3ba0469c
      Cédric Bosdonnat 提交于
      LXC network devices can now be assigned a custom NIC device name on the
      container side. For example, this is configured with:
      
          <interface type='network'>
            <source network='default'/>
            <guest dev="eth1"/>
          </interface>
      
      In this example the network card will appear as eth1 in the guest.
      3ba0469c
    • J
      spec: Consolidate with_qemu* definitions · d659b412
      Jiri Denemark 提交于
      Decisions whether qemu driver and libvirt-daemon-{qemu,kvm} packages
      should be built on various OS/arch combinations were scattered around
      the spec file. Let's make it easier to see where qemu driver is going to
      be built.
      d659b412
    • J
      storage: Disallow vol_wipe for sparse logical volumes · 8a9f7cbe
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1091866
      
      Add a new boolean 'sparse'.  This will be used by the logical backend
      storage driver to determine whether the target volume is sparse or not
      (also known by a snapshot or thin logical volume). Although setting sparse
      to true at creation could be seen as duplicitous to setting during
      virStorageBackendLogicalMakeVol() in case there are ever other code paths
      between Create and FindLVs that need to know about the volume be sparse.
      
      Use the 'sparse' in a new virStorageBackendLogicalVolWipe() to decide whether
      to attempt to wipe the logical volume or not. For now, I have found no
      means to wipe the volume without writing to it. Writing to the sparse
      volume causes it to be filled. A sparse logical volume is not completely
      writeable as there exists metadata which if overwritten will cause the
      sparse lv to go INACTIVE which means pool-refresh will not find it.
      Access to whatever lvm uses to manage data blocks is not provided by
      any API I could find.
      8a9f7cbe
    • J
      storage: Convert 'building' into a bool · 10087386
      John Ferlan 提交于
      Rather than a unsigned int, use a 'bool' since that's how it was used.
      10087386
    • G
      esx: Fix a comment about VSphere versions · 325f98aa
      Geoff Hickey 提交于
      Update the VSphere version comment in esx_vi.c for ESX 5.1 and 5.5.
      325f98aa
    • R
      Fix build by dropping redefined typedefs · 479ef260
      Roman Bogorodskiy 提交于
      Commit 93e82727 introduced numatune_conf.h file that contains
      typedefs already defined in domain_conf.h, such as:
      
       - virDomainNumatune
       - virDomainNumatunePtr
       - virDomainDef
       - virDomainDefPtr
      
      As numatune_conf.h is included by domain_conf.h, clang
      complains about redefinition of typedef and the build fails.
      
      In order to fix it, drop typedefs already defined by numatume_conf.h
      from domain_conf.h.
      479ef260
    • J
      virsh: Document bandwidth maximum more clearly · 83a928ef
      John Ferlan 提交于
      Commit id '0e2d7305' modified the code to allow a negative value to be
      supplied for the bandwidth argument of the various block virsh commands
      and the migrate-setspeed; however, it failed to update the man page to
      describe the "feature" whereby a very large value could be interpreted
      by the hypervisor to mean maximum value allowed. Although initially
      designed to handle a -1 value, the reality is just about any negative
      value could be provided and essentially perform the same feature.
      83a928ef
    • J
      virsh vol-upload/download disallow negative offset · 570d0f63
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1087104
      
      Commit id 'c6212539' explicitly allowed a negative value to be used for
      offset and length as a shorthand for the largest value after commit id
      'f18c02ec' modified virStrToLong_ui() to essentially disallow a negative
      value.
      
      However, allowing a negative value for offset ONLY worked if the negative
      value was -1 since the eventual lseek() does allow a -1 to mean the end
      of the file.  Providing other negative values resulted in errors such as:
      
      $ virsh vol-download --pool default qcow3-vol2 /home/vm-images/raw \
        --offset -2 --length -1000
      error: cannot download from volume qcow3-vol2
      error: Unable to seek /home/vm-images/qcow3-vol2 to 18446744073709551614: Invalid argument
      
      $
      
      Thus, it seems unreasonable to expect or allow a negative value for offset
      since the only benefit is to lseek() to the end of the file and then only
      take advantage of how the OS would handle such a seek. For the purposes of
      upload or download of volume data, that seems to be a no-op.  Therefore,
      disallow a negative value for offset.
      
      Additionally, modify the man page for vol-upload and vol-download to provide
      more details regarding the valid values for both offset and length.
      570d0f63
  2. 17 7月, 2014 24 次提交
  3. 16 7月, 2014 5 次提交
    • E
      blockjob: wait for pivot to complete · 97c59b9c
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1119173 documents that
      commit eaba79d2 was flawed in the implementation of the
      VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC flag when it comes to completing
      a blockcopy.  Basically, the qemu pivot action is async (the QMP
      command returns immediately, but the user must wait for the
      BLOCK_JOB_COMPLETE event to know that all I/O related to the job
      has finally been flushed), but the libvirt command was documented
      as synchronous by default.  As active block commit will also be
      using this code, it is worth fixing now.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Don't skip wait
      loop after pivot.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      97c59b9c
    • E
      util: forbid freeing const pointers · a0b5ace2
      Eric Blake 提交于
      Now that we've finally fixed all the violators, it's time to
      enforce that any pointer to a const object is never freed (it
      is aliasing some other memory, where the non-const original
      should be freed instead).  Alas, the code still needs a normal
      vs. Coverity version, but at least we are still guaranteeing
      that the macro call evaluates its argument exactly once.
      
      I verified that we still get the following compiler warnings,
      which in turn halts the build thanks to -Werror on gcc (hmm,
      gcc 4.8.3's placement of the ^ for ?: type mismatch is a bit
      off, but that's not our problem):
      
          int oops1 = 0;
          VIR_FREE(oops1);
          const char *oops2 = NULL;
          VIR_FREE(oops2);
          struct blah { int dummy; } oops3;
          VIR_FREE(oops3);
      
      util/virauthconfig.c:159:35: error: pointer/integer type mismatch in conditional expression [-Werror]
           VIR_FREE(oops1);
                                         ^
      util/virauthconfig.c:161:5: error: passing argument 1 of 'virFree' discards 'const' qualifier from pointer target type [-Werror]
           VIR_FREE(oops2);
           ^
      In file included from util/virauthconfig.c:28:0:
      util/viralloc.h:79:6: note: expected 'void *' but argument is of type 'const void *'
       void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
            ^
      util/virauthconfig.c:163:35: error: type mismatch in conditional expression
           VIR_FREE(oops3);
                                         ^
      
      * src/util/viralloc.h (VIR_FREE): No longer cast away const.
      * src/xenapi/xenapi_utils.c (xenSessionFree): Work around bogus
      header.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a0b5ace2
    • C
      add nocow test case · 0b0c641b
      Chunyan Liu 提交于
      Add file in storagevolxml2xmlin and storagevolxml2xmlout, let
      storagevolxml2xmltest and storagevolschematest cover 'nocow'.
      Add test case to storagevolxml2argvtest to cover 'nocow'.
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      0b0c641b
    • C
      storagevol: add nocow to vol xml · a9fd30e6
      Chunyan Liu 提交于
      Add 'nocow' to storage volume xml so that user can have an option
      to set NOCOW flag to the newly created volume. It's useful on btrfs
      file system to enhance performance.
      
      Btrfs has low performance when hosting VM images, even more when the guest
      in those VM are also using btrfs as file system. One way to mitigate this
      bad performance is to turn off COW attributes on VM files. Generally, there
      are two ways to turn off COW on btrfs: a) by mounting fs with nodatacow,
      then all newly created files will be NOCOW. b) per file. Add the NOCOW file
      attribute. It could only be done to empty or new files.
      
      This patch tries the second way, according to 'nocow' option, it could set
      NOCOW flag per file:
      for raw file images, handle 'nocow' in libvirt code; for non-raw file images,
      pass 'nocow=on' option to qemu-img, and let qemu-img to handle that (requires
      qemu-img version >= 2.1).
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      a9fd30e6
    • M
      Fix const correctness · 607806f8
      Michal Privoznik 提交于
      In many places we define a variable as a 'const char *' when in fact
      we modify it just a few lines below. Or even free it. We should not do
      that.
      
      There's one exception though, in xenSessionFree() xenapi_utils.c. We
      are freeing the xen_session structure which is defined in
      xen/api/xen_common.h public header. The structure contains session_id
      which is type of 'const char *' when in fact it should have been just
      'char *'. So I'm leaving this unmodified, just noticing the fact in
      comment.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      607806f8