1. 03 6月, 2016 2 次提交
    • M
      Drop virPerfGetEventFd · 89ef1589
      Michal Privoznik 提交于
      This function is not used anywhere. Moreover, the code that would
      use lives in virperf.c and therefore has access to the FD anyway.
      Well, for instance virPerfReadEvent is doing just that.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      89ef1589
    • M
      virDomainChrGetDomainPtrsInternal: Return an integer · 43395f19
      Michal Privoznik 提交于
      There's this problem on the recent gcc-6.1:
      
      In file included from conf/domain_conf.c:37:0:
      conf/domain_conf.c: In function 'virDomainChrPreAlloc':
      conf/domain_conf.c:14109:35: error: potential null pointer dereference [-Werror=null-dereference]
           return VIR_REALLOC_N(*arrPtr, *cntPtr + 1);
                                         ^~
      ./util/viralloc.h:158:73: note: in definition of macro 'VIR_REALLOC_N'
       # define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count), \
                                                                               ^~~~~
      conf/domain_conf.c: In function 'virDomainChrRemove':
      conf/domain_conf.c:14133:21: error: potential null pointer dereference [-Werror=null-dereference]
           for (i = 0; i < *cntPtr; i++) {
                           ^~~~~~~
      
      GCC basically fails to see, that the
      virDomainChrGetDomainPtrsInternal will never actually return NULL
      because it's never called over a domain char device with _LAST
      type. But to make it shut up, lets turn this function into
      returning an integer and check in the callers if a zero value
      value was returned.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      43395f19
  2. 02 6月, 2016 3 次提交
    • M
      virDomainFormatSchedDef: Avoid false positive NULL dereference · f916194c
      Michal Privoznik 提交于
      Okay, I admit that our code here is complex. It's not easy to
      spot that NULL deref can't really happen here. So it's no wonder
      that a dumb compiler fails to see all the connections and
      produces the following errors:
      
        CC       conf/libvirt_conf_la-domain_conf.lo
      conf/domain_conf.c: In function 'virDomainDefFormatInternal':
      conf/domain_conf.c:22162:22: error: potential null pointer dereference [-Werror=null-dereference]
                   if (sched->policy == i)
                       ~~~~~^~~~~~~~
      <snip/>
      cc1: all warnings being treated as errors
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f916194c
    • M
      ppc64Compute: Avoid possible NULL dereference · 09258c3c
      Michal Privoznik 提交于
      cpu/cpu_ppc64.c: In function 'ppc64Compute':
      cpu/cpu_ppc64.c:620:27: error: potential null pointer dereference [-Werror=null-dereference]
           if (STRNEQ(guest_model->name, host_model->name)) {
                      ~~~~~~~~~~~^~~
      cpu/cpu_ppc64.c:620:9: note: in expansion of macro 'STRNEQ'
           if (STRNEQ(guest_model->name, host_model->name)) {
               ^~~~~~
      cc1: all warnings being treated as errors
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      09258c3c
    • M
      virNetDevBridgeGet: Don't require users to virNetDevSetupControl · 263a8880
      Michal Privoznik 提交于
      So far, this function has just three callers. Two of them call
      virNetDevSetupControl to create a socket that we can then
      optionally use for ioctl() to fetch data. However, querying sysfs
      is preferred. Therefore it doesn't make much sense to require
      users to set up the socket if they don't even know it will be
      used in favour of sysfs. We can set up the socket iff we need to.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      263a8880
  3. 01 6月, 2016 2 次提交
  4. 31 5月, 2016 2 次提交
    • M
      esxStorageVolGetXMLDesc: Lookup SCSI lun properly · 99809fd4
      Michal Privoznik 提交于
      So the idea is as follows: firstly we obtain a list of all the
      luns, then iterate over it trying to find the one we want to work
      with and after all the iterations we detect whether we have found
      something. Now, the last check is broken, because it compares a
      value form previous iteration, not the one we've just been
      through.
      
      Then, when computing md5 sum of lun's UUID, we use wrong variable
      again. Well, @hostScsiDisk which is type of esxVI_HostScsiDisk
      extends esxVI_ScsiLun type so they both have the uuid member, but
      it just doesn't feel right to access the data via two different
      variables in one function call.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      99809fd4
    • M
      qemuMonitorTextGetAllBlockStatsInfo: Fix line validation · c94720f8
      Michal Privoznik 提交于
      There's a bug in the function. We expect the following format for
      the data we are parsing here:
      
        key: value
      
      So we use strchr() to find ':' and then see if it is followed by
      space. But the check that does just that is slightly incorrect.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c94720f8
  5. 30 5月, 2016 2 次提交
    • M
      virSocketAddrIsPrivate: Work on 32bits platforms · 2bd61c84
      Michal Privoznik 提交于
      Yet another one of those where signed int (or long int) is not
      enough. And useless to as we're aiming at unsigned anyway.
      
      ../../src/util/virsocketaddr.c: In function 'virSocketAddrIsPrivate':
      ../../src/util/virsocketaddr.c:289:45: error: result of '192l << 24' requires 33 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
              return ((val & 0xFFFF0000) == ((192L << 24) + (168 << 16)) ||
                                                   ^~
      ../../src/util/virsocketaddr.c:290:45: error: result of '172l << 24' requires 33 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
                      (val & 0xFFF00000) == ((172L << 24) + (16  << 16)) ||
                                                   ^~
      cc1: all warnings being treated as errors
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2bd61c84
    • M
      apibuild: Substitute only pure number tokens · 3864d863
      Michal Privoznik 提交于
      In 38df47c9 I've tried to prepare our apibuild.py script for
      change made in 0628f349 (1U << 31). What I've done in the
      former commit was to replace \d+U in parsed tokens with \d.
      Problem was, my regular expression there was not quite right as
      it also translated VIR_123U_VAL into VIR_123_VAL.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3864d863
  6. 29 5月, 2016 1 次提交
  7. 28 5月, 2016 4 次提交
    • M
      Turn 1<<31 into 1U<<31 · 0628f349
      Michal Privoznik 提交于
      Apparently, 1 << 31 is signed which in turn does not fit into
      a signed integer variable:
      
      ../../include/libvirt/libvirt-domain.h:1881:57: error: result of '1 << 31' requires 33 bits to represent, but 'int' only has 32 bits [-Werror=shift-overflow=]
           VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 1 << 31, /* enforce requested stats */
                                                               ^~
      cc1: all warnings being treated as errors
      
      The solution is to make it an unsigned value. I've found only two
      such occurrences in our code base.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0628f349
    • M
      docs: Teach apibuild to deal with (1U << 31) too · 38df47c9
      Michal Privoznik 提交于
      The apibuild script is a terrifying beast that parses some source
      files of ours and produces an XML representation of them. When it
      comes to parsing enums we have in some header files, it tries to
      be clever and detect a value that an enum member has (or if it is
      an alias for a different member). Whilst doing that it has to
      deal with values we give to the members in many formats. At some
      places we just pass the value in decimal:
      
          VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1,
      
      in other places, we use the aliasing:
      
          VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE = VIR_CONNECT_LIST_DOMAINS_ACTIVE,
      
      and in other places bitwise shifts are used:
      
          VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 1 << 31, /* enforce requested stats */
      
      The script tries to parse all of these resulting in the following
      tokens: "1", "VIR_CONNECT_LIST_DOMAINS_ACTIVE", "1<<31"; Then, the
      script tries to turn these into integers using python's eval()
      function. This function succeeds on the first and the last
      tokens. But, if we were to modify the last example so that it's
      of the following form:
      
          VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 1U << 31, /* enforce requested stats */
      
      the token representing enum's member value will then be "1U<<31".
      So our parsing is good. Unfortunately, python is not aware of the
      difference between signed and unsigned C types, therefore eval()
      fails over this token and the parser falls back thinking it's an
      alias to another enum member. Well it's not.
      
      The solution is to transform [0-9]U into [0-9] as for our
      purposes here it's the same thing.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      38df47c9
    • E
      maint: update to latest gnulib · 0ebd0b19
      Eric Blake 提交于
      Fix a regression in checking for realpath (which caused link
      failures regarding duplicate rpl_canonicalize_file_name), and
      fix the mingw build regarding unsetenv.
      
      * .gnulib: Update to latest.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0ebd0b19
    • C
      spec: Advertise nvram paths of official fedora edk2 builds · e9ef4dfa
      Cole Robinson 提交于
      Fedora now ships edk2 firmware in its official repos, so adapt
      the nvram path list to match. Eventually we can remove the nightly
      links as well once some integration kinks have been worked out,
      and documentation updated.
      
      Move the macro building into the %build target, which lets us
      build up a shell variable and make things a bit more readable
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1335395
      e9ef4dfa
  8. 27 5月, 2016 3 次提交
    • K
      lxc: Fix virLXCDomainObjBeginJob position in lxcDomainSetMemoryParameters · 9b9d0f13
      Katerina Koukiou 提交于
      Adjust the code to perform the virLXCDomainObjBeginJob first
      and then the call virDomainLiveConfigHelperMethod.
      As Ján Tomko pointed out, in virDomainLiveConfigHelperMethod,
      there is a check to see if the domain is active when AFFECT_LIVE is set.
      Since virLXCDomainObjBeginJob unlocks the virDomainObjPtr lock,
      the domain could possibly be destroyed while we wait for the job
      and the check results would no longer be valid.
      Signed-off-by: NKaterina Koukiou <k.koukiou@gmail.com>
      9b9d0f13
    • E
      maint: update to latest gnulib · 0cd64883
      Eric Blake 提交于
      Pulls in several portability fixes, including the fact that gnulib
      now only works on platforms with two's complement signed integers.
      Also makes for a smaller delta on the next update (we are waiting
      on a license change to unsetenv for the sake of mingw).
      
      * .gnulib: Update to latest.
      * bootstrap: Resync from upstream.
      * tests/virstringtest.c: Drop use of obsolete probes of integer
      properties.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0cd64883
    • D
      esx: do not store escaped password in esxVI_Context. · 3ef5e218
      Dawid Zamirski 提交于
      This patch fixes an issue where screenshot API call was failing when
      the esx/vcenter password contains special characters such as
      apostrophee. The reason for failures was that passwords were escaped
      for XML and stored in esxVI_Context which was then passed to raw CURL
      API calls where the password must be passed in original form to
      authenticate successfully. So this patch addresses this by storing
      original passwords in the esxVI_Context struct and escape only for
      esxVI_Login call.
      3ef5e218
  9. 26 5月, 2016 8 次提交
    • A
      qemu: Fix error message when PCI bridge has index <= bus · c7289cf3
      Andrea Bolognani 提交于
      Commit ff212622 changed the error message to be more
      detailed about the failure at hand; however, while the new
      error message claims that "bus must be <= index", the error
      message is displayed if "idx <= addr->bus", ie. when bus
      is larger than or *equal to* index.
      
      Change the error message to report the correct constraint,
      and format it in a way that mirrors the check exactly to
      make it clearer to people reading the code. The new error
      message reads "index must be larger than bus".
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1339900
      c7289cf3
    • N
      daemon: cleanup state drivers in order reverse to init order · 3ba93c75
      Nikolay Shirokovskiy 提交于
      This patch aims to fix observed crash on daemon shutdown. Main thread is in
      the process of state drivers cleanup, network driver is cleaned up and
      qemu driver is not yet. Meanwhile eof event from qemu process triggers
      qemuProcessStop -> networkReleaseActualDevice and crash happens as
      network driver is already cleaned up.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      3ba93c75
    • D
      esx: use newer virtualHW version for 5.1+ hosts · f8f74408
      Dawid Zamirski 提交于
      This is because there's a known issue where ESX will refuse to attach
      drives bigger than 4TB when virtualHW < 9. Therefore, to avoid that
      use the higher virtualHW for hosts that support it.
      
      https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2054952
      f8f74408
    • D
      esx: Add VMCI device for virtualHW >= 7 · 5b36410f
      Dawid Zamirski 提交于
      This patch fixes an issue where vMotion fails when VMCI device is not
      present in the vmx file.
      5b36410f
    • D
      esx: add pciBridge devices when SCSI is used · 2b89f1d8
      Dawid Zamirski 提交于
      When a SCSI controller is present, ESX adds several pciBridge devices
      to vmx file. This fixes an error message where it refuses to create VM
      due to not enough PCI devices available. This applies only to virtualHW
      version >= 7.
      2b89f1d8
    • L
      conf: permit auto-assignment of controller indexes · 4d100c7a
      Laine Stump 提交于
      Hand-entering indexes for 20 PCI controllers is not as tedious as
      manually determining and entering their PCI addresses, but it's still
      annoying, and the algorithm for determining the proper index is
      incredibly simple (in all cases except one) - just pick the lowest
      unused index.
      
      The one exception is USB2 controllers because multiple controllers in
      the same group have the same index. For these we look to see if 1) the
      most recently added USB controller is also a USB2 controller, and 2)
      the group *that* controller belongs to doesn't yet have a controller
      of the exact model we're just now adding - if both are true, the new
      controller gets the same index, but in all other cases we just assign
      the lowest unused index.
      
      With this patch in place and combined with the automatic PCI address
      assignment, we can define a PCIe switch with several ports like this:
      
        <controller type='pci' model='pcie-root-port'/>
        <controller type='pci' model='pcie-switch-upstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        ...
      
      These will each get a unique index, and PCI addresses that connect
      them together appropriately with no pesky numbers required.
      4d100c7a
    • L
      conf: make virDomainControllerFindUnusedIndex() more generally usable · 808e16ff
      Laine Stump 提交于
      Make virDomainControllerFindUnusedIndex() a global function so that it
      can be used outside domain_conf.c (as well as higher up in
      domain_conf.c itself)/ Also make its DomainDef arg a const* so that
      functions which only have a const* to the domain can use it.
      808e16ff
    • L
      conf/qemu: make IS_USB2_CONTROLLER globally available · 1140b31f
      Laine Stump 提交于
      IS_USB2_CONTROLLER() is useful in more places aside from just when
      assigning PCI addresses in QEMU, and is checking for enum values that
      are all defined in conf/domain_conf.h anyway, so define it there
      instead.
      1140b31f
  10. 25 5月, 2016 13 次提交