1. 27 3月, 2017 40 次提交
    • M
    • J
      virsh: reject more negative numbers · df6551fe
      Ján Tomko 提交于
      Be more positive and reject negative numbers where we don't
      allow them by using the virStrToLong variants with 'p'.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1436119
      df6551fe
    • J
    • J
      build: Fix syntax check in VPATH · eeeaaa0b
      Jiri Denemark 提交于
      Matching the beginning of a path in syntax check does not work because
      each path is enriched with a prefix of the source tree.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      eeeaaa0b
    • J
      build: Fix sc_prohibit_exit_in_tests syntax check · 88a18596
      Jiri Denemark 提交于
      This check makes sense only in *.c files.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      88a18596
    • J
      cputest: Add tests for virCPUUpdateLive API · 84cc51ea
      Jiri Denemark 提交于
      The test takes
      
        x86-cpuid-Something-guest.xml CPU (the CPU libvirt would use for
          host-model on a CPU described by x86_64-cpuid-Something.xml without
          talking to QEMU about what it supports on the host)
      
      and updates it according to CPUID data from QEMU:
      
        x86_64-cpuid-Something-enabled.xml (reported as "feature-words"
          property of the CPU device)
      
      and
      
        x86_64-cpuid-Something-disabled.xml (reported as "filtered-features"
          property of the CPU device).
      
      The result is compared to
      
        x86_64-cpuid-Something-json.xml (the CPU libvirt would use as
          host-model based on the reply from query-cpu-model-expansion).
      
      The comparison is a bit tricky because the *-json.xml CPU contains fewer
      disabled features. Only the features which are included in the base CPU
      model, but listed as disabled in *.json will be disabled in *-json.xml.
      The CPU computed by virCPUUpdateLive from the test data will list all
      features present in the host's CPUID data and not enabled in *.json as
      disabled. The cpuTestUpdateLiveCompare function checks that the computed
      and expected sets of enabled features match.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      84cc51ea
    • J
      cputest: Disable "cmt" feature unknown to QEMU · 88705d4c
      Jiri Denemark 提交于
      All CPU features which QEMU does not know about but libvirt knows them
      (currently "cmt" is the only one) are implicitly disabled by QEMU and
      should be present in x86_64-cpuid-*-disabled.xml.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      88705d4c
    • J
      cputest: Disable TSX on broken models · cc033b10
      Jiri Denemark 提交于
      Commit v3.1.0-26-gd60012b4 started filtering hle and rtm features from
      broken Intel Haswell CPUs. QEMU implemented similar functionality and
      thus it doesn't report rtm and hle features as enabled for Core i5-4670T
      CPU anymore.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      cc033b10
    • J
      cputest: Generate data for virCPUUpdateLive · 9b6c0184
      Jiri Denemark 提交于
      Generated with
      
          (cd tests/cputestdata; ./cpu-cpuid.py diff x86_64-cpuid-*.json)
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      9b6c0184
    • J
      cputest: Add "diff" command to cpu-cpuid.py · 2aeef0f6
      Jiri Denemark 提交于
      The new command can be used to generate test data for virCPUUpdateLive.
      
      When "cpu-cpuid.py diff x86-cpuid-Something.json" is run, it reads raw
      CPUID data stored in x86-cpuid-Something.xml and CPUID data from QEMU
      stored in x86-cpuid-Something.json to produce two more CPUID files:
      x86-cpuid-Something-enabled.xml and x86-cpuid-Something-disabled.xml.
      
      - x86-cpuid-Something-enabled.xml will contain CPUID bits present in
          x86-cpuid-Something.json (i.e., enabled by QEMU for the "host" CPU)
      
      - x86-cpuid-Something-disabled.xml will contain all CPUID bits from
          x86-cpuid-Something.xml which are not present in
          x86-cpuid-Something.json (i.e., CPUID bits which the host CPU
          supports, but QEMU does not enable them for the "host" CPU)
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      2aeef0f6
    • J
      cputest: Add cpuidLeaf helper to cpu-cpuid.py · 74f0b0c5
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      74f0b0c5
    • J
      cputest: Add cpuidIsSet helper to cpu-cpuid.py · e7bf3c06
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      e7bf3c06
    • J
      cputest: Rename cpu-convert.py script as cpu-cpuid.py · 72c44a15
      Jiri Denemark 提交于
      The new script is going to be more general and the original
      functionality can be requested by "cpu-cpuid.py convert".
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      72c44a15
    • J
      cputest: Move instantiation of JSONDecoder in cpu-convert.py · ac49ce42
      Jiri Denemark 提交于
      Let's make the object local to the parseFeatureWords function which uses
      it.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      ac49ce42
    • J
      cpu: Do not pass virConnectBaselineCPUFlags to cpuBaseline · c117ecec
      Jiri Denemark 提交于
      The public API flags are handled by the cpuBaselineXML wrapper. The
      internal cpuBaseline API only needs to know whether it is supposed to
      drop non-migratable features.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      c117ecec
    • J
      cpu: Move feature expansion out of cpuBaseline · d8b3dd16
      Jiri Denemark 提交于
      cpuBaseline is responsible for computing a baseline CPU while feature
      expansion is done by virCPUExpandFeatures. The cpuBaselineXML wrapper
      (used by hypervisor drivers to implement virConnectBaselineCPU API)
      calls cpuBaseline followed by virCPUExpandFeatures if requested by
      VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES flag.
      
      The features in the three changed test files had to be sorted using
      "sort -k 3" because virCPUExpandFeatures returns a sorted list of
      features.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      d8b3dd16
    • J
      cpu: Drop unused flags from cpuArchDecode · 86e2df6e
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      86e2df6e
    • J
      cpu: Introduce virCPUExpandFeatures · 0aa9383f
      Jiri Denemark 提交于
      Having to use cpuBaseline with VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES
      flag to expand CPU features is strange. Not to mention that cpuBaseline
      can only expand host CPU definitions (i.e., it completely ignores
      feature policies). The new virCPUExpandFeatures API is designed to work
      with both host and guest CPU definitions.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      0aa9383f
    • J
      cpu_conf: Introduce virCPUDefFreeFeatures · 532fc7b7
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      532fc7b7
    • L
      docs: make interface start mode element optional · b101101d
      Laine Stump 提交于
      This brings the libvirt version of this RNG file in line with the same
      file in netcf (as soon as the corresponding patch there is ACKed and
      pushed).
      
      There's no reason to require it when defining an interface (the config
      option it corresponds to is optional), and it isn't even output in the
      status of an interface.
      
      Resolves: https://bugzilla.redhat.com/1414404
      b101101d
    • L
      conf: validate that PCI controller index is < 256 · 272f1856
      Laine Stump 提交于
      This is the maximum for many reasons, for starters because index ==
      bus number, and a controller's bus number is 8 bits.
      
      This incidentally resolves: https://bugzilla.redhat.com/1329090
      272f1856
    • L
    • L
      util: log all setting of MAC addresses and vlan tags · 6ec36b06
      Laine Stump 提交于
      Having this information available will make it easier to determine the
      culprit when MAC or vlan tag appear to not be set, eg.:
      
        https://bugzilla.redhat.com/1364073
      
      (This patch doesn't fix that bug, just makes it easier to diagnose)
      6ec36b06
    • L
      util: try *really* hard to set the MAC address of an SRIOV VF · 86556e16
      Laine Stump 提交于
      If an SRIOV VF has previously been used for VFIO device assignment,
      the "admin MAC" that is stored in the PF driver's table of VF info
      will have been set to the MAC address that the virtual machine wanted
      the device to have. Setting the admin MAC for a VF also sets a flag in
      the PF that is loosely called the "administratively set" flag. Once
      that flag is set, it is no longer possible for the net driver of the
      VF (either on the host or in a virtual machine) to directly set the
      VF's MAC again; this flag isn't reset until the *PF* driver is
      restarted, and that requires taking *all* VFs offline, so it's not
      really feasible to do.
      
      If the same SRIOV VF is later used for macvtap passthrough mode, the
      VF's MAC address must be set, but normally we don't unbind the VF from
      its host net driver (since we actually need the host net driver in
      this case). Since setting the VF MAC directly will fail, in the past
      "we" ("I") had tried to fix the problem by simply setting the admin MAC
      (via the PF) instead. This *appeared* to work (and might have at one
      time, due to promiscuous mode being turned on somewhere or something),
      but it currently creates a non-working interface because only the
      value for admin MAC is set to the desired value, *not* the actual MAC
      that the VF is using.
      
      Earlier patches in this series reverted that behavior, so that we once
      again set the MAC of the VF itself for macvtap passthrough operation,
      not the admin MAC. But that brings back the original bug - if the
      interface has been used for VFIO device assignment, you can no longer
      use it for macvtap passthrough.
      
      This patch solves that problem by noticing when virNetDevSetMAC()
      fails for a VF, and in that case it sets the desired MAC to the admin
      MAC via the PF, then "bounces" the VF driver (by unbinding and the
      immediately rebinding it to the VF). This causes the VF's MAC to be
      reinitialized from the admin MAC, and everybody is happy (until the
      *next* time someone wants to set the VF's MAC address, since the
      "administratively set" bit is still turned on).
      86556e16
    • L
      util: if setting admin MAC to 00:00:00:00:00:00 fails, try 02:00:00:00:00:00 · d5f4abef
      Laine Stump 提交于
      Some PF drivers allow setting the admin MAC (that is the MAC address
      that the VF will be initialized to the next time the VF's driver is
      loaded) to 00:00:00:00:00:00, and some don't. Multiple drivers
      initialize the admin MACs to all 0, but don't allow setting it to that
      very same value. It has been an uphill battle convincing the driver
      people that it's reasonable to expect The argument that's used is
      that an all 0 device MAC address on a device is invalid; however, from
      an outsider's point of view, when the admin MAC is set to 0 at the
      time the VF driver is loaded, the VF's MAC is *not* set to 0, but to a
      random non-0 value. But that's beside the point - even if I could
      convince one or two SRIOV driver maintainers to permit setting the
      admin MAC to 0, there are still several other drivers.
      
      So rather than fighting that losing battle, this patch checks for a
      failure to set the admin MAC due to an all 0 value, and retries it
      with 02:00:00:00:00:00. That won't result in a random value being set
      in the VF MAC at next VF driver init, but that's okay, because we
      always want to set a specific value anyway. Rather, the "almost 0"
      setting makes it easy to visually detect from the output of "ip link
      show" which VFs are currently in use and which are free.
      d5f4abef
    • L
      util: remove unused functions from virnetdev.c · bc4168f3
      Laine Stump 提交于
      The global functions virNetDevReplaceMacAddress(),
      virNetDevReplaceNetConfig(), virNetDevRestoreMacAddress(), and
      virNetDevRestoreNetConfig() are no longer used, as their functionality
      has been replaced by virNetDev(Save|Read|Set)NetConfig().
      
      The static functions virNetDevReplaceVfConfig() and
      virNetDevRestoreVfConfig() were only used by the above-named global
      functions that were removed.
      bc4168f3
    • L
      util: after hostdev assignment, restore VF MAC address via setting admin MAC · d6ef331f
      Laine Stump 提交于
      It takes longer to explain this than to fix it...
      
      In the past we weren't able to save the VF's own MAC address *at all*
      when using it for hostdev assignment, because we had already unbound
      the VF from the host net driver prior to saving its config. With the
      previous patch, that problem has been solved, so we now have the VF's
      MAC address saved and can move on to the *next* problem, which is twofold:
      
      1) during teardown we restore the config before we've re-bound, so the
         VF doesn't have a net driver, and thus we can't set its MAC address
         directly.
      
      2) even if we delay restoring the config until the VF is bound to a
         net driver, the request to set its MAC address would fail, since
         (during device setup) we had set the "admin MAC" for the VF via an
         RTM_SETLINK to the PF - once you've set the admin MAC for a VF, the
         VF driver (either on host or on guest) is not allowed to change the
         VF's MAC address "forever" (well, until you reload the PF driver,
         but that requires destroying and recreating every single VF, which
         isn't something you can require).
      
      The solution is to keep the restoration of config at the same place,
      but to set the *admin MAC* to the address you want the VF to have -
      when the VF net driver is later initialized (as a part of re-binding
      to the VF net driver) its MAC will be initialized to the current value
      of the admin MAC.
      d6ef331f
    • L
      util: save hostdev network device config before unbinding from host driver · cceada57
      Laine Stump 提交于
      In order to properly restore the original state of an SRIOV VF when
      we're finished with it, we need to save the MAC address of the VF
      itself (not just the admin MAC address for the VF that is stored in
      the PF). But that can only be done when the VF is still bound to the
      host's netdev driver, and we have always done the saving of device
      config after the VF is already bound to vfio-pci. This patch prepares
      us for adding a save of the VF's MAC by calling the function that
      saves netconfig earlier in the device preparation, before we've
      unbound it from the host netdev driver.
      cceada57
    • L
      util: replace virHostdevNetConfigReplace with ...(Save|Set)NetConfig() · b684734b
      Laine Stump 提交于
      These two operations will need to be separated so that saving of the
      original config is done before detaching the host net driver, and
      setting the new config is done after attaching vfio-pci. This patch
      splits the single function into two, but for now calls them together
      (to make bisecting easier if there is a regression).
      b684734b
    • L
      util: use new virNetDev*NetConfig() functions for hostdev setup/teardown · 9c004d55
      Laine Stump 提交于
      virHostdevNetConfigReplace() and virHostdevNetConfigRestore() are
      modified to use the new virNetDev*NetConfig() functions.
      
      Note that due to the VF's original MAC addresses being saved after it
      has already been un-bound from the host net driver, the actual current
      VF MAC address won't be saved (because it no longer exists) - only the
      "admin MAC" will be saved. This reflects existing behavior that will
      be fixed in an upcoming patch.
      9c004d55
    • L
      util: use new virNetDev*NetConfig() functions for macvtap setup/teardown · b91a3363
      Laine Stump 提交于
      This patch modifies the macvtap passthrough setup to use
      virNetDevSaveNetConfig()+virNetDevSetConfig() instead of
      virNetDevReplaceNetConfig() or virNetDevReplaceMacAddress(), and the
      teardown to use virNetDevReadNetConfig()+virNetDevSetConfig() instead
      of virNetDevRestoreNetConfig() or virNetDevRestoreMacAddress().
      
      Since the older functions only saved/restored the admin MAC and vlan
      tag (which is incorrect) and the new functions save/restore the VF's
      own MAC address and vlan tag (correct), this actually fixes a bug
      (which was introduced by commit cb3fe38c, which was itself supposed
      to be a fix for https://bugzilla.redhat.com/1113474 ).
      
      The downside to this patch is that it causes an *apparent* regression
      in that bug (because there will once again be an error reported if the
      interface had previously been used for VFIO device assignment), but in
      reality, the code hasn't been working for *any* case before this
      current patch (at least not with any recent kernel). Anyway, that
      "regression" will be fixed with an upcoming patch that fixes it the
      *right* way.
      b91a3363
    • L
      util: new functions virNetDev(Save|Read|Set)NetConfig() · 26694daf
      Laine Stump 提交于
      These three functions are destined to replace
      virNetDev(Replace|Restore)NetConfig() and
      virNetDev(Replace|Restore)MacAddress(), which both do the save and set
      together as a single step. We need to separate the save, read, and set
      steps because there will be situations where we need to do something
      else in between (in particular, we will need to rebind a VF's driver
      after save but before set).
      
      This patch creates the new functions, but doesn't call them - that
      will come in a subsequent patch. Note that the new functions to
      read/write the file that stores the original network config now uses
      JSON rather than plaintext (it still recognizes the old format as well
      though, so it won't get confused during an upgrade).
      26694daf
    • P
      qemu: Log additional data from hyperv crash notifier · 2af04bde
      Peter Krempa 提交于
      The hyperv panic notifier reports additional data in form of 5 registers
      that are reported in the crash event from qemu. Log them into the VM log
      file and report them as a warning so that admins can see the cause of
      crash of their windows VMs.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426176
      2af04bde
    • P
      qemu: monitor: Extract additional info from GUEST_PANICKED event · d7580dd6
      Peter Krempa 提交于
      For certain kinds of panic notifiers (notably hyper-v) qemu is able to
      report some data regarding the crash passed from the guest.
      
      Make the data accessible to the callback in qemu so that it can be
      processed further.
      d7580dd6
    • P
      7d5c27e9
    • P
      qemu: driver: Remove useless forward declarations · 59a5d158
      Peter Krempa 提交于
      59a5d158
    • E
      c6d0c350
    • E
      docs: Document the new hostdev type 'mdev' · 229dcc73
      Erik Skultety 提交于
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      229dcc73
    • E
      test: Add some test cases for our test suite regarding the mdevs · 1696806f
      Erik Skultety 提交于
      For now, these only cover the unmanaged, i.e. user pre-created devices.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      1696806f
    • E
      qemu: Format mdevs on qemu command line · ef18a50b
      Erik Skultety 提交于
      Format the mediated devices on the qemu command line as
      -device vfio-pci,sysfsdev='/path/to/device/in/syfs'.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      ef18a50b