1. 19 8月, 2015 1 次提交
  2. 18 8月, 2015 7 次提交
    • L
      virsh: Reset global error after successfull domain lookup · 70f56dd7
      Luyao Huang 提交于
      When looking up a domain, we try to look up by ID, UUID and NAME
      consequently while not really caring which of those lookups succeeds.
      The problem is that if any of them fails, we dispatch the error from the
      driver and that means setting both threadlocal and global error. Let's
      say the last lookup (by NAME) succeeds and resets the threadlocal error as any
      other API does, however leaving the global error unchanged. If the underlying
      virsh command does not succeed afterwards, our cleanup routine in
      vshCommandRun ensures that no libvirt error will be forgotten and that's
      exactly where this global error comes in incorrectly.
      
       # virsh domif-setlink 123 vnet1 up
       error: interface (target: vnet1) not found
       error: Domain not found: no domain with matching id 123
      
      This patch also resets the global error which would otherwise cause some
      minor confusion in reported error messages.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1254152Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      70f56dd7
    • E
      build: fix mingw build · 0a617b53
      Eric Blake 提交于
      Ever since commit e44b0269, 64-bit mingw compilation fails with:
      
      ../../src/util/virprocess.c: In function 'virProcessGetPids':
      ../../src/util/virprocess.c:628:50: error: passing argument 4 of 'virStrToLong_i' from incompatible pointer type [-Werror=incompatible-pointer-types]
               if (virStrToLong_i(ent->d_name, NULL, 10, &tmp_pid) < 0)
                                                        ^
      In file included from ../../src/util/virprocess.c:59:0:
      ../../src/util/virstring.h:53:5: note: expected 'int *' but argument is of type 'pid_t * {aka long long int *}'
       int virStrToLong_i(char const *s,
           ^
      cc1: all warnings being treated as errors
      
      Although mingw won't be using this function, it does compile the
      file, and the fix is relatively simple.
      
      * src/util/virprocess.c (virProcessGetPids): Don't assume pid_t
      fits in int.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0a617b53
    • M
      qemuDomainRename: Explicitly check if domain is renaming to itself · 0ace4d98
      Michal Privoznik 提交于
      It may happen that user (mistakenly) wants to rename a domain to
      itself. Which is no renaming at all. We should reject that with
      some meaningful error message.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0ace4d98
    • M
      virHashAddEntry: Report error on duplicate key · 1dc25872
      Michal Privoznik 提交于
      If this function fails, the error message is reported only in
      some cases (e.g. OOM), but in some it's not (e.g. duplicate key).
      This fact is painful and we should either not report error at all
      or report the error in all possible cases. I vote for the latter.
      Unfortunately, since the key may be an arbitrary value (not
      necessarily a string) we can't report it in the error message.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1dc25872
    • M
      virHashAddOrUpdateEntry: Turn @new_name into void * · 890676d2
      Michal Privoznik 提交于
      In 9190f0b0 we've tried to fix an OOM. And boy, was that fix
      successful. But back then, the hash table implementation worked
      strictly over string keys, which is not the case anymore. Hash
      table have this function keyCopy() which returns void *.
      Therefore a local variable that is temporarily holding the
      intermediate return value from that function should be void *
      too.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      890676d2
    • L
      libvirt-domain: forbid use virDomainRename in readonly connection · 2b3fb38f
      Luyao Huang 提交于
      This function will change the guest name, we shouldn't
      allow the readonly user do this.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      2b3fb38f
    • L
      virsh: fix always return false in domrename · b2da1d45
      Luyao Huang 提交于
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      b2da1d45
  3. 16 8月, 2015 1 次提交
    • J
      qemu: Resolve Coverity UNINIT · c4cfc0d0
      John Ferlan 提交于
      Coverity complained that 'vm' wasn't initialized before jumping to
      cleanup: and calling virDomainObjEndAPI if the VIR_STRDUP fails.
      So I initialized vm = NULL and also moved the VIR_STRDUP closer to
      usage and used endjob for goto. Lots of other reasons for failures.
      c4cfc0d0
  4. 15 8月, 2015 2 次提交
  5. 14 8月, 2015 8 次提交
  6. 13 8月, 2015 9 次提交
    • J
      conf: Remove 'vmdef' from virDomainHostdevDefParseXML · 11d57147
      John Ferlan 提交于
      Since it's not used, let's remove it to avoid any future usage.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      11d57147
    • M
      qemu: Use numad information when getting pin information · 776924e3
      Martin Kletzander 提交于
      Pinning information returned for emulatorpin and vcpupin calls is being
      returned from our data without querying cgroups for some time.  However,
      not all the data were utilized.  When automatic placement is used the
      information is not returned for the calls mentioned above.  Since the
      numad hint in private data is properly saved/restored, we can safely use
      it to return true information.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1162947Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      776924e3
    • M
      qemu: Keep numad hint after daemon restart · 8ce86722
      Martin Kletzander 提交于
      The numad hint stored in priv->autoNodeset is information that gets lost
      during daemon restart.  And because we would like to use that
      information in the future, we also need to save it in the status XML.
      For the sake of tests, we need to initialize nnumaCell_max to some
      value, so that the restoration doesn't fail in our test suite.  There is
      no need to fill in the actual numa cell data since the recalculating
      function virCapabilitiesGetCpusForNodemask() will not fail, it will just
      skip filling the data in the bitmap which we don't use in tests anyway.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      8ce86722
    • M
      conf: Pass private data to Parse function of XML options · 7c8028cd
      Martin Kletzander 提交于
      This needs a reorder of XML option definitions.  It might come in handy
      one day.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      7c8028cd
    • M
      qemu: Fix segfault when parsing private domain data · 92ddffdb
      Martin Kletzander 提交于
      When parsing private domain data, there are two paths that are flawed.
      They are both error paths, just from different parts of the function.
      One of them can call free() on an uninitialized pointer.  Initialization
      to NULL is enough here.  The other one is a bit trickier to explain, but
      as easy as the first one to fix.  We create capabilities, parse them and
      then assign them into the private data pointer inside the domain object.
      If, however, we get to fail from now on, the error path calls unrefs the
      capabilities and then, when the domain object is being cleaned,
      qemuDomainObjPrivateFree() tries to unref them as well.  That causes a
      segfault.  Settin the pointer to NULL upon successful addition to the
      private data is enough.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      92ddffdb
    • J
      conf: Check for hostdev conflicts when assign default disk address · 1b08cc17
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1210587  (completed)
      
      When generating the default drive address for a SCSI <disk> device,
      check the generated address to ensure it doesn't conflict with a SCSI
      <hostdev> address. The <disk> address generation algorithm uses the
      <target> "dev" name in order to determine which controller and unit
      in order to place the device. Since a SCSI <hostdev> device doesn't
      require a target device name, its placement on the guest SCSI address
      "could" conflict.  For instance, if a SCSI <hostdev> exists at
      controller=0 unit=0 and an attempt to hotplug 'sda' into the guest
      made, there would be a conflict if the <hostdev> is already using
      /dev/sda.
      1b08cc17
    • J
      conf: Create locals for virDomainDiskDefAssignAddress · d6ea4adb
      John Ferlan 提交于
      Create local controller/bus variables to be used by a future patch
      d6ea4adb
    • J
      conf: Add SCSI hostdev check for disk drive address already in use · 8d46386b
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1210587  (partial)
      
      If a SCSI subsystem <hostdev> element address is provided, we need to
      make sure the address provided doesn't conflict with an existing or
      libvirt generated address for a SCSI <disk> element. We can handle
      this condition in device post processing since we're not generating an
      address based on some target name - rather it's either generated based
      on space or provided from the user. If the user provides one that conflicts,
      then we need to disallow the change.
      
      This will fix the issue where the domain XML provided an <address> for
      the <hostdev>, but not the <disk> element where the address provided
      ends up being the same address used for the <disk>. A <disk> address
      is generated using it's assigned <target> 'dev' name prior to the
      check/validation of the <hostdev> address value.
      8d46386b
    • F
      Drive hot-unplug: reliable parsing of HMP results · 69a3b0df
      Frank Schreuder 提交于
      Hot-unplugging a disk from a guest that supports hot-unplugging generates an error
      in the libvirt log when running QEMU with the "-msg timestamp=on" flag.
      
      2015-08-06 10:48:59.945+0000: 11662: error : qemuMonitorTextDriveDel:2594 :
      operation failed: deleting drive-virtio-disk4 drive failed:
      2015-08-06T10:48:59.945058Z Device 'drive-virtio-disk4' not found
      
      This error is caused because the HMP results are getting prefixed with a timestamp.
      Parsing the output is not reliable with STRPREFIX as the results can be prefixed with a timestamp.
      
      Using strstr ensures that parsing the output works whether the results are prefixed or not.
      
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NFrank Schreuder <fschreuder@transip.nl>
      69a3b0df
  7. 12 8月, 2015 10 次提交
    • L
      Revert "qemu: Allow to plug virtio-net-pci into PCIe slot" · d5e6d1cf
      Laine Stump 提交于
      This reverts commit ede34470, which
      was apparently written based on testing performed before commits
      1e15be1b and 9a12b6 were pushed upstream. Once those two patches are in
      place, commit ede34470 is redundant, and can even cause
      incorrect/unexpected behavior when auto-assigning addresses for
      virtio-net devices.
      d5e6d1cf
    • M
      cmdAttachInterface: Fully implement @floor support · 68b2405c
      Michal Privoznik 提交于
      In my previous commit d7f5c889 I tried to introduce support
      for inbound.floor. But the code change was incomplete. This is
      the change needed to fully enable the feature.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      68b2405c
    • M
      networkBandwidthGenericChecks: Drop useless check · f7fba69b
      Michal Privoznik 提交于
      There's a check right at the beginning of the function that
      shortcuts if the function was called over all NULL arguments.
      However, this was meant just as a fool-proof check so that we
      don't crash if function is used in a bad manner. Anyway, it makes
      Coverity unhappy as it then thinks any of the arguments could be
      NULL. Well, with the current state of the code it can't.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f7fba69b
    • M
      networkBandwidthUpdate: Don't blindly dereference pointers · ef6b3b62
      Michal Privoznik 提交于
      It may happen that an interface don't have any bandwidth set and
      a new one is to be set. In that case, @ifaceBand will be NULL.
      This will cause troubles later in the code when deciding what to
      do.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      ef6b3b62
    • P
      virsh: Refactor parseRateStr to avoid false-positive uninitialized variable · 73ca6f98
      Peter Krempa 提交于
      Commit 6983d6d2 tried to improve parseRateStr but broke the build
      instead for compilers that were not able to properly introspect the for
      loop indexed by the enum resulting into the following error:
      
      virsh-domain.c: In function 'parseRateStr':
      virsh-domain.c:916:13: error: 'field_name' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                   vshError(ctl, _("malformed %s field"), field_name);
                   ^
      virsh-domain.c:915:13: error: 'tmp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
               if (virStrToLong_ullp(token, NULL, 10, tmp) < 0) {
                   ^
      Rather than trying to fix the code, refactor the function again by
      reusing virStringSplit.
      73ca6f98
    • C
      domain: Fix crash if trying to live update disk <serial> · c7790408
      Cole Robinson 提交于
      If you pass <disk><serial> XML to UpdateDevice, and the original device
      didn't have a <serial> block, libvirtd crashes trying to read the original
      NULL serial string.
      
      Use _NULLABLE string comparisons to avoid the crash. A couple other
      properties needed the change too.
      c7790408
    • L
      qemu: fix qemuDomainSupportsPCI() for ARM machines of "virt" machinetype · 9bd16ad3
      Laine Stump 提交于
      Commit e8d55172 updated the domain post-parse to automatically add
      pcie-root et al for certain ARM "virt" machinetypes, but didn't update
      the function qemuDomainSupportsPCI() which is called later on when we
      are auto-assigning PCI addresses and default settings for the PCI
      controller <model> and <target> attributes. The result was that PCI
      addresses weren't assigned, and the controllers didn't have their
      attribute default values set, leading to an error when the domain was
      started, e.g.:
      
        internal error: autogenerated dmi-to-pci-bridge options not set
      
      This patch adds the same check made in the earlier patch to
      qemuDomainSupportsPCI(), so that PCI address auto-assignment and
      target/model default values will be set.
      9bd16ad3
    • G
      virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable · fbb27088
      Guido Günther 提交于
      When running the test suite using "unshare -n" we might have IPv6 but no
      configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
      EAI_NONAME which we should then treat as IPv6 unavailable.
      fbb27088
    • L
      util: don't overwrite stack when getting ethtool gfeatures · bfaaa2b6
      Laine Stump 提交于
      This fixes the crash described here:
      
       https://www.redhat.com/archives/libvir-list/2015-August/msg00162.html
      
      In short, we were calling ioctl(SIOCETHTOOL) pointing to a too-short
      object that was a local on the stack, resulting in the memory past the
      end of the object being overwritten. This was because the struct used
      by the ETHTOOL_GFEATURES command of SIOCETHTOOL ends with a 0-length
      array, but we were telling ethtool that it could use 2 elements on the
      array.
      
      The fix is to allocate the necessary memory with VIR_ALLOC_VAR(),
      including the extra length needed for a 2 element array at the end.
      bfaaa2b6
    • A
      cpu: Fix segfault in the ppc64 driver · 133c25c8
      Andrea Bolognani 提交于
      Commit adb865df introduced some changes in ppc64DriverNodeData()
      that cause libvirtd to crash on startup unless this patch is
      applied as well.
      133c25c8
  8. 11 8月, 2015 2 次提交