1. 31 1月, 2014 2 次提交
  2. 30 1月, 2014 7 次提交
    • O
      util: Accept test data path for scsi device's sg_path · b1b81efe
      Osier Yang 提交于
      Commit 10c9ceff intended to introduce new argument for the
      testing purpose, but it missed the similar changing of the
      device's sg_path. The problem was hidden since my laptop has
      the /dev/sg0 and /dev/sg1.  A later patch will modify the tests
      accordingly.
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      Reported-by: NPavel Hrdina <phrdina@redhat.com>
      b1b81efe
    • O
      qemu: Fix the error message for scsi host device's shareable checking · f406aa25
      Osier Yang 提交于
      This fixes the wrong argument order.
      f406aa25
    • O
      util: Add one argument for several scsi utils · 10c9ceff
      Osier Yang 提交于
      To support passing the path of the test data to the utils, one
      more argument is added to virSCSIDeviceGetSgName,
      virSCSIDeviceGetDevName, and virSCSIDeviceNew, and the related
      code is changed accordingly.
      
      Later tests for the scsi utils will be based on this patch.
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      10c9ceff
    • O
      qemu: Don't fail if the SCSI host device is shareable between domains · fd243fc4
      Osier Yang 提交于
      It doesn't make sense to fail if the SCSI host device is specified
      as "shareable" explicitly between domains (NB, it works if and only
      if the device is specified as "shareable" for *all* domains,
      otherwise it fails).
      
      To fix the problem, this patch introduces an array for virSCSIDevice
      struct, which records all the names of domain which are using the
      device (note that the recorded domains must specify the device as
      shareable).  And the change on the data struct brings on many
      subsequent changes in the code.
      
      Prior to this patch, the "shareable" tag didn't work as expected,
      it actually work like "non-shareable".  So this patch also added notes
      in formatdomain.html to declare the fact.
      
      * src/util/virscsi.h:
        - Remove virSCSIDeviceGetUsedBy
        - Change definition of virSCSIDeviceGetUsedBy and virSCSIDeviceListDel
        - Add virSCSIDeviceIsAvailable
      
      * src/util/virscsi.c:
        - struct virSCSIDevice: Change "used_by" to be an array; Add
          "n_used_by" as the array count
        - virSCSIDeviceGetUsedBy: Removed
        - virSCSIDeviceFree: frees the "used_by" array
        - virSCSIDeviceSetUsedBy: Copy the domain name to avoid potential
          memory corruption
        - virSCSIDeviceIsAvailable: New
        - virSCSIDeviceListDel: Change the logic, for device which is already
          in the list, just remove the corresponding entry in "used_by". And
          since it's only used in one place, we can safely removing the code
          to find out the dev in the list first.
        - Copyright updating
      
      * src/libvirt_private.sys:
        - virSCSIDeviceGetUsedBy: Remove
        - virSCSIDeviceIsAvailable: New
      
      * src/qemu/qemu_hostdev.c:
        - qemuUpdateActiveScsiHostdevs: Check if the device existing before
          adding it to the list;
        - qemuPrepareHostdevSCSIDevices: Error out if the not all domains
          use the device as "shareable"; Also don't try to add the device
          to the activeScsiHostdevs list if it already there; And make
          more sensible error w.r.t the current "shareable" value in
          driver->activeScsiHostdevs.
        - qemuDomainReAttachHostScsiDevices: Change the logic according
          to the changes on helpers.
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      fd243fc4
    • R
      maint: add configure checks for BSD CPU affinity · d779d218
      Roman Bogorodskiy 提交于
      Check for presence of sys/cpuset.h header and cpuset_getaffinity()
      in configure instead of just using #ifdef __FreeBSD__ for that code.
      d779d218
    • M
      Revert "networkAllocateActualDevice: Set QoS for bridgeless networks too" · 122cd169
      Michal Privoznik 提交于
      This reverts commit 2996e6be
      and some parts of 2636dc8c.
      
      The former one tried to implement QoS setting on bridgeless networks.
      However, as discussed upstream [1], the patch is far away from being
      useful in even a single case. The whole idea of network QoS is to have
      aggregated limits over several interfaces. This patch is doing
      completely the opposite when merging two QoS settings (from the network
      and the domain interface) into one which is then set at the domain
      interface itself, not the network.
      
      The latter one is the test for the previous one. Now none of them makes
      sense.
      
      1: https://www.redhat.com/archives/libvir-list/2014-January/msg01441.html
      
      Conflicts:
      	tests/virnetdevbandwidthtest.c: New test has been introduced since
          then.
      122cd169
    • M
      virCommand: Introduce virCommandSetDryRun · 550a2cef
      Michal Privoznik 提交于
      There are some units within libvirt that utilize virCommand API to run
      some commands and deserve own unit testing. These units are, however,
      not desired to be rewritten to dig virCommand API usage out. As a great
      example virNetDevBandwidth could be used. The problem with the bandwidth
      unit is: it uses virCommand API heavily. Therefore we need a mechanism
      to not really run a command, but rather see its string representation
      after which we can decide if the unit construct the correct sequence of
      commands or not.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      550a2cef
  3. 29 1月, 2014 4 次提交
    • P
      snapshot: Add support for specifying snapshot disk backing type · 7076b4b7
      Peter Krempa 提交于
      Add support for specifying various types when doing snapshots. This will
      later allow to do snapshots on network backed volumes. Disks of type
      'volume' are not supported by snapshots (yet).
      
      Also amend the test suite to check parsing of the various new disk
      types that can now be specified.
      7076b4b7
    • J
      xen: fix parsing xend http response · 37564b47
      Jim Fehlig 提交于
      Commit df36af58 broke parsing of http response from xend.  The prior
      use of atoi() would happily parse e.g. a string containing "200 OK\r\n",
      whereas virStrToLong_i() will fail when called with a NULL end_ptr.
      Change the calls to virStrToLong_i() to provide a non-NULL end_ptr.
      37564b47
    • J
      cpu: Try to use source CPU model in virConnectBaselineCPU · 580ddf0d
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1049391
      
      When all source CPU XMLs contain just a single CPU model (with a
      possibly varying set of additional feature elements),
      virConnectBaselineCPU will try to use this CPU model in the computed
      guest CPU. Thus, when used on just a single CPU (useful with
      VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES), the result will not use a
      different CPU model.
      
      If the computed CPU uses the source model, set fallback mode to 'forbid'
      to make sure the guest CPU will always be as close as possible to the
      source CPUs.
      580ddf0d
    • J
      cpu: Fix VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES · 802f157e
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1049391
      
      VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES flag for virConnectBaselineCPU
      did not work if the resulting guest CPU would disable some features
      present in its base model. This patch makes sure we won't try to add
      such features twice.
      802f157e
  4. 28 1月, 2014 4 次提交
  5. 27 1月, 2014 3 次提交
    • M
      networkAllocateActualDevice: Set QoS for bridgeless networks too · 2996e6be
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1055484
      
      Currently, libvirt's XML schema of network allows QoS to be defined for
      every network even though it has no bridge. For instance:
      
      <network>
          <name>vdsm-no-bridge</name>
          <forward mode='passthrough'>
            <interface dev='em1.10'/>
          </forward>
          <bandwidth>
              <inbound average='1000' peak='5000' burst='1024'/>
              <outbound average='1000' burst='1024'/>
          </bandwidth>
      </network>
      
      The bandwidth limitations can be, however, applied even on such
      networks. In fact, they are going to be applied on the interface that
      will be connected to the network on a domain startup. This approach,
      however, has one limitation. With bridged networks, there are two points
      where QoS can be set: bridge and domain interface. The lower limit of
      the two is enforced then. For instance, if the interface has 10Mbps
      average, but the network only 1Mbps, there's no way for interface to
      transmit packets faster than the 1Mbps limit. With two points this is
      enforced by kernel.  With only one point, we must combine both QoS
      settings into one which is set afterwards. Look at
      virNetDevBandwidthMinimal() and you'll understand immediately what I
      mean.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2996e6be
    • J
      Add test for linuxNodeGetCPUStats · 5099f745
      Ján Tomko 提交于
      Check if cpu stats are read correctly from a sample
      /proc/stat collected from a 24 CPU machine.
      5099f745
    • J
      Move test-local declarations to nodeinfopriv.h · b3b44c57
      Ján Tomko 提交于
      linuxNodeInfoCPUPopulate is only used in the nodeinfo.c file
      and in the test suite.
      b3b44c57
  6. 26 1月, 2014 1 次提交
  7. 25 1月, 2014 1 次提交
    • J
      Block info query: Add check for transient domain · 46a0737e
      John Ferlan 提交于
      Currently the qemuDomainGetBlockInfo will return allocation == physical
      for most backing stores. For a qcow2 block backed device it's possible
      to return the highest lv extent allocated from qemu for an active guest.
      That is a value where allocation != physical and one would hope be less.
      However, if the guest is not running, then the code falls back to returning
      allocation == physical. This turns out to be problematic for rhev which
      monitors the size of the backing store. During a migration, before the
      VM has been started on the target and while it is deemed inactive on the
      source, there's a small window of time where the allocation is returned
      as physical triggering the code to extend the file unnecessarily.
      
      Since rhev uses transient domains and this is edge condition for a transient
      domain, rather than returning good status and allocation == physical when
      this "window of opportunity" exists, this patch will check for a transient
      (or non persistent) domain and return a failure to the caller rather than
      returning the defaults. For a persistent domain, the defaults will be
      returned. The description for the virDomainGetBlockInfo has been updated
      to describe the phenomena.
      46a0737e
  8. 24 1月, 2014 1 次提交
  9. 23 1月, 2014 9 次提交
    • O
      storage: Fix the memory leak · 88ae5dc7
      Osier Yang 提交于
      The return value of virGetFCHostNameByWWN is a strdup'ed string.
      Also add comments to declare that the caller should take care of
      freeing it.
      88ae5dc7
    • O
      util: Fix the indention · 75199587
      Osier Yang 提交于
      Left in the git cache without commit before pushing. Pushed under
      build breaker and trivial rule.
      75199587
    • O
      util: Add "shareable" field for virSCSIDevice struct · 2b66504d
      Osier Yang 提交于
      Unlike the host devices of other types, SCSI host device XML supports
      "shareable" tag. This patch introduces it for the virSCSIDevice struct
      for a later patch use (to detect if the SCSI device is shareable when
      preparing the SCSI host device in QEMU driver).
      2b66504d
    • O
      storage: Fix autostart of pool with "fc_host" type adapter · 2340f019
      Osier Yang 提交于
      The "checkPool" is a bit different for pool with "fc_host"
      type source adapter, since the vHBA it's based on might be
      not created yet (it's created by "startPool", which is
      involked after "checkPool" in storageDriverAutostart). So it
      should not fail, otherwise the "autostart" of the pool will
      fail either.
      
      The problem is easy to reproduce:
          * Enable "autostart" for the pool
          * Restart libvirtd service
          * Check the pool's state
      2340f019
    • B
      Fix buffer size in linuxNodeGetCPUstats · 2310e631
      Bing Bu Cao 提交于
      94f82053 added a space to the string but didn't change the buffer size.
      Signed-off-by: NBing Bu Cao <mars@linux.vnet.ibm.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      2310e631
    • O
      storage: Add document for possible problem on volume detection · 6b29eb84
      Osier Yang 提交于
      For pool which relies on remote resources, such as a "iscsi" type
      pool, since how long it takes to export the corresponding devices
      to host's sysfs is really depended, it could depend on the network
      connection, it also could depend on the host's udev procedures. So
      it's likely that the volumes are not able to be detected during pool
      starting process, polling the sysfs doesn't work, since we don't
      know how much time is best for the polling, and even worse, the
      volumes could still be not detected or partly not detected even after
      the polling.  So we end up with a documentation to prompt the fact,
      in virsh manual.
      
      And as a small improvement, let's explicitly say no LUNs found in
      the debug log in that case.
      6b29eb84
    • O
      util: Correct the NUMA node range checking · ae2860b4
      Osier Yang 提交于
      There are 2 issues here: First we shouldn't add "1" to the return
      value of numa_max_node(), since the semanteme of the error message
      was changed, it's not saying about the number of total NUMA nodes
      anymore.  Second, the value of "bit" is the position of the first
      bit which exceeds either numa_max_node() or NUMA_NUM_NODES, it can
      be any number in the range, so saying "bigger than $bit" is quite
      confused now. For example, assuming there is a NUMA machine which
      has 10 NUMA nodes, and one specifies the "nodeset" as "0,5,88",
      the error message will be like:
      
      Nodeset is out of range, host cannot support NUMA node bigger than 88
      
      It sounds like all NUMA node number less than 88 is fine, but
      actually the maximum NUMA node number the machine supports is 9.
      
      This patch fixes the issues by removing the addition with "1" and
      simplifies the error message as "NUMA node $bit is out of range".
      Also simplifies the comparision in the while loop by getting the
      smaller one of numa_max_node() and NUMA_NUM_NODES up front.
      ae2860b4
    • E
      api: require write permission for guest agent interaction · 7f2d27d1
      Eric Blake 提交于
      I noticed that we allow virDomainGetVcpusFlags even for read-only
      connections, but that with a flag, it can require guest agent
      interaction.  It is feasible that a malicious guest could
      intentionally abuse the replies it sends over the guest agent
      connection to possibly trigger a bug in libvirt's JSON parser,
      or withhold an answer so as to prevent the use of the agent
      in a later command such as a shutdown request.  Although we
      don't know of any such exploits now (and therefore don't mind
      posting this patch publicly without trying to get a CVE assigned),
      it is better to err on the side of caution and explicitly require
      full access to any domain where the API requires guest interaction
      to operate correctly.
      
      I audited all commands that are marked as conditionally using a
      guest agent.  Note that at least virDomainFSTrim is documented
      as needing a guest agent, but that such use is unconditional
      depending on the hypervisor (so the existing domain:fs_trim ACL
      should be sufficient there, rather than also requirng domain:write).
      But when designing future APIs, such as the plans for obtaining
      a domain's IP addresses, we should copy the approach of this patch
      in making interaction with the guest be specified via a flag, and
      use that flag to also require stricter access checks.
      
      * src/libvirt.c (virDomainGetVcpusFlags): Forbid guest interaction
      on read-only connection.
      (virDomainShutdownFlags, virDomainReboot): Improve docs on agent
      interaction.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML)
      (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
      (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS, REMOTE_PROC_DOMAIN_REBOOT)
      (REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS): Require domain:write for any
      conditional use of a guest agent.
      * src/xen/xen_driver.c: Fix clients.
      * src/libxl/libxl_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7f2d27d1
    • J
      vbox: add support for v4.2.20+ and v4.3.4+ · bb85da2c
      Jean-Baptiste Rouault 提交于
      Bugs have been found in the VirtualBox API C bindings. These bugs have
      been fixed in versions 4.2.20 and 4.3.4. However, the changes in the
      C bindings are incompatible with the vbox_CAPI_v4_2.h and vbox_CAPI_v4_3.h
      files which are bundled in libvirt source code.
      This is why the following patch adds vbox_CAPI_v4_2_20.h and
      vbox_CAPI_v4_3_4.h.
      
      The actual underlying problem here is that until now,
      libvirt assumed that VirtualBox API can only change between minor
      versions (4.2 -> 4.3), but we have a case here where it changed
      (or got fixed) between patch versions (4.2.18 -> 4.2.20).
      
      This patch makes the VBOX_API_VERSION represent the full API
      version number (i.e 4002 => 4002000) so there are specific version
      numbers for Vbox 4.2.20 (4002020) and 4.3.4 (4003004)
      bb85da2c
  10. 22 1月, 2014 4 次提交
  11. 21 1月, 2014 4 次提交
    • L
      build: add $(prefix) to SYSTEMD_UNIT_DIR · 00e9d607
      Laine Stump 提交于
      I noticed this problem when adding systemd support to netcf, because I
      setup the configure.ac to automatically prefer using systemd over
      initscripts when possible - although I had copied the
      install-data-local target from the example of libvirt's
      "libvirt-guests" service more or less verbatim, "make distcheck" would
      fail because it was trying to install the service file directly into
      /lib/systemd/system rather than into
      /home/user/some/unimportant/name/lib/systemd/system.
      
      This is caused by the install/uninstall rules for the systemd unit
      files relying on $(DESTDIR) pointing the installed files to the right
      place, but in reality $(DESTDIR) is empty during this part of make
      distcheck - it instead sets $(prefix) with the toplevel directory used
      for its test build/install/uninstall cycle.
      
      (This problem hasn't been seen when running "make distcheck" in
      libvirt because libvirt will never build/install systemd support
      unless explicitly told to do so on the configure commandline, and
      "make distcheck" doesn't put the "--with-initscript=..." option on the
      configure commandline.)
      
      I verified that the same problem does exist in libvirt by modifying
      libvirt's configure.ac to set:
      
        init_systemd=yes
        with_init_script=systemd+redhat
      
      This forces a build/install of the systemd unit files during
      distcheck, which yields an error like this:
      
      /usr/bin/install -c -m 644 virtlockd.service \
        /lib/systemd/system/
      libtool: install: warning: relinking `libvirt-qemu.la'
      /usr/bin/install: cannot remove '/lib/systemd/system/virtlockd.service': Permission denied
      make[4]: *** [install-systemd] Error 1
      
      After adding $(prefix) to all the definitions of SYSTEMD_UNIT_DIR,
      make distcheck now completes successfully with the modified
      configure.ac, and the above lines change to something like this:
      
      /usr/bin/install -c -m 644 virtlockd.service \
        /home/laine/devel/libvirt/libvirt-1.2.1/_inst/lib/systemd/system/
      00e9d607
    • P
      qemu: snapshot: Avoid libvirtd crash when qemu crashes while snapshotting · 55bbb011
      Peter Krempa 提交于
      We shouldn't access the domain definition while we are in the monitor
      section as the domain is unlocked. Additionally after we exit from the
      monitor we need to check if the VM is still alive. Not doing so resulted
      in a crash if qemu exits while attempting to do an external VM snapshot.
      55bbb011
    • F
      spice: expose the QEMU disable file transfer option · 08d07e5f
      Francesco Romani 提交于
      spice-server offers an API to disable file transfer messages
      on the agent channel between the client and the guest.
      This is supported in qemu through the disable-agent-file-xfer option.
      
      This patch exposes this option to libvirt.
      Adds a new element 'filetransfer', with one property,
      'enable', which accepts a boolean.
      Default is enabled, for backward compatibility.
      
      Depends on the capability exported in the first patch of the series.
      Signed-off-by: NFrancesco Romani <fromani@redhat.com>
      08d07e5f
    • F
      spice: detect if qemu can disable file transfer · 19bbc812
      Francesco Romani 提交于
      spice-server offers an API to disable file transfer messages
      on the agent channel between the client and the guest.
      This is supported in qemu through the disable-agent-file-xfer option.
      
      This patch detects if QEMU supports this option, and add
      a capability if does.
      Signed-off-by: NFrancesco Romani <fromani@redhat.com>
      19bbc812