1. 09 12月, 2019 2 次提交
  2. 04 12月, 2019 3 次提交
  3. 14 11月, 2019 1 次提交
    • D
      qemu_hotplug.c: adding qemuDomainGetUnplugTimeout · e03e27ee
      Daniel Henrique Barboza 提交于
      For some architectures and setups, device removal can take
      longer than the default 5 seconds. This results in commands
      such as 'virsh setvcpus' to fire timeout messages even if
      the operation were successful in the guest, confusing the
      user.
      
      This patch sets a new 10 seconds unplug timeout for PPC64
      guests. All other archs will keep the default 5 seconds
      timeout.
      
      Instead of putting 'if PPC64' conditionals inside qemu_hotplug.c
      to set the new timeout value, a new function called
      qemuDomainGetUnplugTimeout was added. The timeout value is then
      retrieved when needed, by passing the correspondent DomainDef
      object. This approach allows for different guest architectures
      to have distint unplug timeout intervals, regardless of the
      host architecture. This design also makes it easier to
      modify/enhance the unplug timeout logic in the future
      (allow for special timeouts for TCG domains, for example).
      
      A new mock file was created to work with qemuhotplugtest.c,
      given that the test timeout is significantly shorter than
      the actual timeout value in qemu_hotplug.c.
      
      The now unused 'qemuDomainRemoveDeviceWaitTime' global can't
      be simply erased from qemu_hotplug.c though. Next patch will
      remove it properly.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Suggested-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      e03e27ee
  4. 09 11月, 2019 2 次提交
  5. 24 10月, 2019 1 次提交
  6. 14 10月, 2019 1 次提交
    • D
      build: link to glib library · cfbe9f12
      Daniel P. Berrangé 提交于
      Add the main glib.h to internal.h so that all common code can use it.
      
      Historically glib allowed applications to register an alternative
      memory allocator, so mixing g_malloc/g_free with malloc/free was not
      safe.
      
      This was feature was dropped in 2.46.0 with:
      
            commit 3be6ed60aa58095691bd697344765e715a327fc1
            Author: Alexander Larsson <alexl@redhat.com>
            Date:   Sat Jun 27 18:38:42 2015 +0200
      
              Deprecate and drop support for memory vtables
      
      Applications are still encourged to match g_malloc/g_free, but it is no
      longer a mandatory requirement for correctness, just stylistic. This is
      explicitly clarified in
      
          commit 1f24b36607bf708f037396014b2cdbc08d67b275
          Author: Daniel P. Berrangé <berrange@redhat.com>
          Date:   Thu Sep 5 14:37:54 2019 +0100
      
              gmem: clarify that g_malloc always uses the system allocator
      
      Applications can still use custom allocators in general, but they must
      do this by linking to a library that replaces the core malloc/free
      implemenentation entirely, instead of via a glib specific call.
      
      This means that libvirt does not need to be concerned about use of
      g_malloc/g_free causing an ABI change in the public libary, and can
      avoid memory copying when talking to external libraries.
      
      This patch probes for glib, which provides the foundation layer with
      a collection of data structures, helper APIs, and platform portability
      logic.
      
      Later patches will introduce linkage to gobject which provides the
      object type system, built on glib, and gio which providing objects
      for various interesting tasks, most notably including DBus client
      and server support and portable sockets APIs, but much more too.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      cfbe9f12
  7. 12 10月, 2019 1 次提交
  8. 10 10月, 2019 1 次提交
  9. 25 9月, 2019 1 次提交
  10. 13 9月, 2019 1 次提交
  11. 09 9月, 2019 1 次提交
  12. 23 8月, 2019 3 次提交
    • R
      tests: Make references to global symbols indirect in test drivers · f6d6086d
      Roman Bolshakov 提交于
      A library has to be built with -flat_namespace to get all references to
      global symbols indirected. That can also be achieved with two-level
      namespace interposition but we're not using explicit symbol
      interposition since it's more verbose and requires massive changes to
      the mocks.
      
      This provides a way to interpose a mock for virQEMUCapsProbeHostCPU from
      qemucpumock and fixes domaincapstest on macOS.
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      f6d6086d
    • R
      tests: Remove -module flag for mocks · 647c6518
      Roman Bolshakov 提交于
      macOS has two kinds of loadable libraries: MH_BUNDLE, and MH_DYLIB.
      bundle is used for plugins that are loaded with dlopen/dlsym/dlclose.
      And there's no way to preload a bundle into an application. dynamic
      linker (dyld) will reject it when finds it in DYLD_INSERT_LIBRARIES.
      
      Unfortunately, a bundle is built if -module flag is provided to libtool.
      The flag has been removed to build dylibs with ".dylib" suffix.
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      647c6518
    • R
      tests: Add lib- prefix to all mocks · fde36108
      Roman Bolshakov 提交于
      In preparation libtool "-module" flag removal, add lib prefix to all
      mock shared objects.
      
      While at it, introduce VIR_TEST_MOCK macros that makes path out of mock
      name to be used with VIR_TEST_PRELOAD or VIR_TEST_MAIN_PRELOAD.  That,
      hopefully, improves readability, reduces line length and allows to
      tailor VIR_TEST_MOCK for specific platform if it has shared library
      suffix different from ".so".
      Signed-off-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      fde36108
  13. 14 8月, 2019 1 次提交
  14. 13 8月, 2019 1 次提交
  15. 27 7月, 2019 3 次提交
    • E
      backup: Add virsh-checkpoints test · 43686f36
      Eric Blake 提交于
      Similar to virsh-snapshots. Provides decent coverage of the checkpoint
      API, the test driver implementation, and the virsh access to the API.
      A later patch will worry about testing that snapshots and checkpoints
      are mutually exclusive (in part so it is easier to revert that when we
      finally implement the interaction and lift that restriction).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      43686f36
    • E
      backup: Parse and output checkpoint XML · 1a4df34a
      Eric Blake 提交于
      Add a new file checkpoint_conf.c that performs the translation to and
      from new XML describing a checkpoint. The code shares a common base
      class with snapshots, since a checkpoint similarly represents the
      domain state at a moment in time. Add some basic testing of round trip
      XML handling through the new code.
      
      Of note - this code intentionally differs from snapshots in that XML
      schema validation is unconditional, rather than based on a public API
      flag.  We have many existing interfaces that still need to add a flag
      for opt-in schema validation, but those interfaces have existing
      clients that may not have been producing strictly-compliant XML, or we
      may still uncover bugs where our RNG grammar is inconsistent with our
      code (where omitting the opt-in flag allows existing apps to keep
      working while waiting for an RNG patch).  But since checkpoints are
      brand-new, it's easier to ensure the code matches the schema by always
      using the schema.  If needed, a later patch could extend the API and
      add a flag to turn on to request schema validation, rather than having
      it forced (possibly just the validation of the <domain> sub-element
      during REDEFINE) - but if a user encounters XML that looks like it
      should be good but fails to validate with our RNG schema, they would
      either have to upgrade to a new libvirt that adds the new flag, or
      upgrade to a new libvirt that fixes the RNG schema, which implies
      adding such a flag won't help much.
      
      Also, the redefine flag requires the <domain> sub-element to be
      present, rather than catering to historical back-compat to older
      versions.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1a4df34a
    • E
      backup: Document new XML for checkpoints · d85842cf
      Eric Blake 提交于
      Prepare for new checkpoint APIs by describing the XML that will
      represent a checkpoint.  The checkpoint XML is modeled heavily after
      virDomainSnapshotPtr. See the docs for more details.
      
      Add testsuite coverage for some minimal uses of the XML (bare minimum,
      the sample from html, and a full dumpxml, and some counter-examples
      that should fail schema validation). Although use of the REDEFINE flag
      will require the <domain> subelement to be present, it is easier for
      most of the tests to provide counterpart output produced with the
      NO_DOMAIN flag (particularly since synthesizing a valid <domain>
      during testing is not trivial).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      d85842cf
  16. 18 7月, 2019 1 次提交
  17. 16 7月, 2019 1 次提交
  18. 09 7月, 2019 3 次提交
  19. 20 6月, 2019 1 次提交
  20. 17 6月, 2019 1 次提交
  21. 13 6月, 2019 3 次提交
    • A
      tests: Include LDADDS in qemu_LDADDS · 73cfc362
      Andrea Bolognani 提交于
      At this point, all test programs that use qemu_LDADDS also
      use LDADDS, so we can remove a bunch of repetition by simply
      including the latter in the former.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      73cfc362
    • A
      tests: Tweak vircapstest_LDADD · 6b8048b4
      Andrea Bolognani 提交于
      We optionally include QEMU and LXC support in this test and
      depending on which is enabled (if either is enabled at all) we
      need to link in different objects.
      
      Right now we implicitly depend on the fact that qemu_LDADDS is
      empty when QEMU is not enabled to get the correct set of objects,
      but it's better to be explicit about it.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      6b8048b4
    • A
      tests: Tweak cputest_LDADDS · 74d8909f
      Andrea Bolognani 提交于
      We want all test programs using qemu_LDADDS to also use LDADDS,
      and cputest is the only existing exception.
      
      We can't just replace GNULIB_LIBS with LDADDS though, even though
      the latter is a superset of the former, because that would result
      in a linking error due to including the same object twice:
      
        /usr/bin/ld:
        ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
        multiple definition of `libvirt_object_new_semaphore';
        ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
        first defined here
      
      To work around this, we include both qemu_LDADDS and LDADDS when
      QEMU support is enabled, and just LDADDS otherwise.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      74d8909f
  22. 04 6月, 2019 1 次提交
  23. 30 5月, 2019 1 次提交
    • J
      build: fix linking libqemutestdriver with LTO enabled · 76b420d0
      Jim Fehlig 提交于
      openSUSE Factory is in the process of enabling Link Time Optimization [0]
      and stumbled upon missing symbols when linking libqemutestdriver
      
      libtool: link: gcc -shared  -fPIC -DPIC  ../src/libvirt_qemu_probes.o  \
      -Wl,--whole-archive ../src/.libs/libvirt_driver_qemu_impl.a \
      ../src/.libs/libvirt_driver_network_impl.a \
      ../src/.libs/libvirt_driver_storage_impl.a -Wl,--no-whole-archive  \
      -lcap-ng -lgnutls -lnl-route-3 -lnl-3 -ldbus-1 -lselinux -lapparmor \
      /usr/lib/libxml2.so -ldl -lz -llzma -lm -lblkid -ltirpc  \
      -fstack-protector-strong -O2 -fstack-protector-strong -flto=16 -g -O2 \
      -fstack-protector-strong -flto=16 -g \
      -Wl,-soname -Wl,libqemutestdriver.so -o .libs/libqemutestdriver.so
      ...
      /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `mdir_name'
      /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_ioctl'
      /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_pipe2'
      /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `recvfd'
      /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `c_strcasecmp'
      
      The missing symbols are provided by GNUlib. Add it when linking
      libqemutestdriver.
      
      [0] https://en.opensuse.org/openSUSE:LTOSigned-off-by: NJim Fehlig <jfehlig@suse.com>
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      76b420d0
  24. 10 4月, 2019 1 次提交
    • M
      domain capabilities: Expose firmware auto selection feature · 5b9819ee
      Michal Privoznik 提交于
      If a management application wants to use firmware auto selection
      feature it can't currently know if the libvirtd it's talking to
      support is or not. Moreover, it doesn't know which values that
      are accepted for the @firmware attribute of <os/> when parsing
      will allow successful start of the domain later, i.e. if the mgmt
      application wants to use 'bios' whether there exists a FW
      descriptor in the system that describes bios.
      
      This commit then adds 'firmware' enum to <os/> element in
      <domainCapabilities/> XML like this:
      
        <enum name='firmware'>
          <value>bios</value>
          <value>efi</value>
        </enum>
      
      We can see both 'bios' and 'efi' listed which means that there
      are descriptors for both found in the system (matched with the
      machine type and architecture reported in the domain capabilities
      earlier and not shown here).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Acked-by: NLaszlo Ersek <lersek@redhat.com>
      5b9819ee
  25. 03 4月, 2019 2 次提交
    • D
    • D
      tests: fix mocking of stat() / lstat() functions · ff376c62
      Daniel P. Berrangé 提交于
      Quite a few of the tests have a need to mock the stat() / lstat()
      functions and they are taking somewhat different & inconsistent
      approaches none of which are actually fully correct. This is shown
      by fact that 'make check' fails on 32-bit hosts. Investigation
      revealed that the code was calling into the native C library impl,
      not getting intercepted by our mocks.
      
      The POSIX stat() function might resolve to any number of different
      symbols in the C library.
      
      The may be an additional stat64() function exposed by the headers
      too.
      
      On 64-bit hosts the stat & stat64 functions are identical, always
      refering to the 64-bit ABI.
      
      On 32-bit hosts they refer to the 32-bit & 64-bit ABIs respectively.
      
      Libvirt uses _FILE_OFFSET_BITS=64 on 32-bit hosts, which causes the
      C library to transparently rewrite stat() calls to be stat64() calls.
      Libvirt will never see the 32-bit ABI from the traditional stat()
      call. We cannot assume this rewriting is done using a macro. It might
      be, but on GLibC it is done with a magic __asm__ statement to apply
      the rewrite at link time instead of at preprocessing.
      
      In GLibC there may be two additional functions exposed by the headers,
      __xstat() and __xstat64(). When these exist, stat() and stat64() are
      transparently rewritten to call __xstat() and __xstat64() respectively.
      The former symbols will not actally exist in the library at all, only
      the header. The leading "__" indicates the symbols are a private impl
      detail of the C library that applications should not care about.
      Unfortunately, because we are trying to mock replace the C library,
      we need to know about this internal impl detail.
      
      With all this in mind the list of functions we have to mock will depend
      on several factors
      
       - If _FILE_OFFSET_BITS is set, then we are on a 32-bit host, and we
         only need to mock stat64 and __xstat64. The other stat / __xstat
         functions exist, but we'll never call them so they can be ignored
         for mocking.
      
       - If _FILE_OFFSET_BITS is not set, then we are on a 64-bit host and
         we should mock stat, stat64, __xstat & __xstat64. Either may be
         called by app code.
      
       - If __xstat & __xstat64 exist, then stat & stat64 will not exist
         as symbols in the library, so the latter should not be mocked.
      
      The same all applies to lstat()
      
      These rules are complex enough that we don't want to duplicate them
      across every mock file, so this centralizes all the logic in a helper
      file virmockstathelper.c that should be #included when needed. The
      code merely need to provide a filename rewriting callback called
      virMockStatRedirect(). Optionally VIR_MOCK_STAT_HOOK can be defined
      as a macro if further processing is needed inline.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      ff376c62
  26. 25 3月, 2019 1 次提交
    • E
      snapshot: Add tests of virsh -c test:///default snapshot* · 280a2b41
      Eric Blake 提交于
      Had this been in place earlier, I would have avoided the bugs in
      commit 0baf6945 and 55c2ab3e. Writing the test required me to extend
      the power of virsh - creating enough snapshots to cause fanout
      requires enough input in a single session that adding comments and
      markers makes it easier to check that output is correct. It's still a
      bit odd that with test:///default, reverting to a snapshot changes the
      domain from running to paused (possibly a bug in how the test driver
      copied from the qemu driver) - but the important part is that the test
      is reproducible, and any future tweaks we make to snapshot code have
      less chance of breaking successful command sequences.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      280a2b41
  27. 15 3月, 2019 1 次提交