1. 18 10月, 2019 3 次提交
    • D
      util: drop support for stack traces with logging · 9b80e0c1
      Daniel P. Berrangé 提交于
      The log filters have supported the use of a "+" before the source match
      string to request that a stack trace be emitted for every log message:
      
        commit 54856395
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed May 9 15:18:56 2012 +0100
      
          Allow stack traces to be included with log messages
      
          Sometimes it is useful to see the callpath for log messages.
          This change enhances the log filter syntax so that stack traces
          can be show by setting '1:+NAME' instead of '1:NAME'.
      
      With the huge & ever increasing number of logging statements per file,
      this will be incredibly verbose and have a major performance penalty.
      This makes the feature impractical to use widely and as such it is not
      worth the code maint cost.
      
      Removing this seldom used feature allows us to drop the 'execinfo'
      module in gnulib which provides the backtrace() function which doesn't
      exist on non-Linux.
      
      Users who want to get stack traces of parts of libvirt can use GDB,
      or systemtap for live tracing with minimal perf impact.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      9b80e0c1
    • J
      qemu: Generate 'xres' and 'yres' for QEMU video devices · 71519d46
      Julio Faracco 提交于
      This commit let QEMU command line define 'xres' and 'yres' properties
      if XML contains both properties from video model: based on resolution
      fields 'x' and 'y'. There is a conditional structure inside
      qemuDomainDeviceDefValidateVideo() that validates if video model
      supports this feature. This commit includes the necessary changes to
      cover resolution for 'video-qxl-resolution' test cases too.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      71519d46
    • J
      conf: Add 'x' and 'y' resolution into video XML definition · 72862797
      Julio Faracco 提交于
      This commit adds resolution element with parameters 'x' and 'y' into video
      XML domain group definition. Both, properties were added into an element
      called 'resolution' and it was added inside 'model' element. They are set
      as optional. This element does not follow QEMU properties 'xres' and
      'yres' format. Both HTML documentation and schema were changed too. This
      commit includes a simple test case to cover resolution for QEMU video
      models. The new XML format for resolution looks like:
      
          <model ...>
            <resolution x='800' y='600'/>
          </model>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      72862797
  2. 16 10月, 2019 7 次提交
  3. 15 10月, 2019 5 次提交
  4. 14 10月, 2019 8 次提交
    • M
      security: Pass @migrated to virSecurityManagerSetAllLabel · 458d0a8c
      Michal Privoznik 提交于
      In upcoming commits, virSecurityManagerSetAllLabel() will perform
      rollback in case of failure by calling
      virSecurityManagerRestoreAllLabel(). But in order to do that, the
      former needs to have @migrated argument so that it can be passed
      to the latter.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      458d0a8c
    • D
      build: remove use of usleep gnulib module in favour of g_usleep · 27cb4c1a
      Daniel P. Berrangé 提交于
      The usleep function was missing on older mingw versions, but we can rely
      on it existing everywhere these days. It may only support times upto 1
      second in duration though, so we'll prefer to use g_usleep instead.
      
      The commandhelper program is not changed since that can't link to glib.
      Fortunately it doesn't need to build on Windows platforms either.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      27cb4c1a
    • D
      util: replace strerror/strerror_r with g_strerror · c4d18e8b
      Daniel P. Berrangé 提交于
      g_strerror is offers the safety/correctness benefits of strerror_r, with
      the API design convenience of strerror.
      
      Use of virStrerror should be eliminated through the codebase in favour
      of g_strerror.
      
      commandhelper.c is a special case as its a tiny single threaded test
      program, not linked to glib, so it just uses traditional strerror().
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      c4d18e8b
    • D
      util: convert virIdentity class to use GObject · 16121a88
      Daniel P. Berrangé 提交于
      Converting from virObject to GObject is reasonably straightforward,
      as illustrated by this patch for virIdentity
      
      In the header file
      
       - Remove
      
           typedef struct _virIdentity virIdentity
      
       - Add
      
           #define VIR_TYPE_IDENTITY virIdentity_get_type ()
           G_DECLARE_FINAL_TYPE (virIdentity, vir_identity, VIR, IDENTITY, GObject);
      
         Which provides the typedef we just removed, and class
         declaration boilerplate and various other constants/macros.
      
      In the source file
      
       - Change 'virObject parent' to 'GObject parent' in the struct
       - Remove the virClass variable and its initializing call
       - Add
      
            G_DEFINE_TYPE(virIdentity, vir_identity, G_TYPE_OBJECT)
      
         which declares the instance & class constructor functions
      
       - Add an impl of the instance & class constructors
         wiring up the finalize method to point to our dispose impl
      
      In all files
      
       - Replace VIR_AUTOUNREF(virIdentityPtr) with g_autoptr(virIdentity)
      
       - Replace virObjectRef/Unref with g_object_ref/unref. Note
         the latter functions do *NOT* accept a NULL object where as
         libvirt's do. If you replace g_object_unref with g_clear_object
         it is NULL safe, but also clears the pointer.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      16121a88
    • D
    • D
      util: convert virIdentity implementation and test suite to g_autoptr · c6825d88
      Daniel P. Berrangé 提交于
      To simplify the later conversion from virObject to GObject, introduce
      the use of g_autoptr to the virIdentity implementnation and test suite.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      c6825d88
    • D
      util: convert virSystemdActivation to use VIR_DEFINE_AUTOPTR_FUNC · 74d93267
      Daniel P. Berrangé 提交于
      Using the standard macro will facilitate the conversion to glib's
      auto cleanup macros.
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      74d93267
    • 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
  5. 12 10月, 2019 1 次提交
  6. 11 10月, 2019 4 次提交
  7. 10 10月, 2019 5 次提交
  8. 09 10月, 2019 2 次提交
    • M
      qemu: Fix @vm locking issue when connecting to the monitor · 75dd5958
      Michal Privoznik 提交于
      When connecting to qemu's monitor the @vm object is unlocked.
      This is justified - connecting may take a long time and we don't
      want to wait with the domain object locked. However, just before
      the domain object is locked again, the monitor's FD is registered
      in the event loop. Therefore, there is a small window where the
      event loop has a chance to call a handler for an event that
      occurred on the monitor FD but vm is not initalized properly just
      yet (i.e. priv->mon is not set). For instance, if there's an
      incoming migration, qemu creates its socket but then fails to
      initialize (for various reasons, I'm reproducing this by using
      hugepages but leaving the HP pool empty) then the following may
      happen:
      
      1) qemuConnectMonitor() unlocks @vm
      
      2) qemuMonitorOpen() connects to the monitor socket and by
         calling qemuMonitorOpenInternal() which subsequently calls
         qemuMonitorRegister() the event handler is installed
      
      3) qemu fails to initialize and exit()-s, which closes the
         monitor
      
      4) The even loop sees EOF on the monitor and the control gets to
         qemuProcessEventHandler() which locks @vm and calls
         processMonitorEOFEvent() which then calls
         qemuMonitorLastError(priv->mon). But priv->mon is not set just
         yet.
      
      5) qemuMonitorLastError() dereferences NULL pointer
      
      The solution is to unlock the domain object for a shorter time
      and most importantly, register event handler with domain object
      locked so that any possible event processing is done only after
      @vm's private data was properly initialized.
      
      This issue is also mentioned in v4.2.0-99-ga5a777a8.
      
      Since we are unlocking @vm and locking it back, another thread
      might have destroyed the domain meanwhile. Therefore we have to
      check if domain is still active, and we have to do it at the
      same place where domain lock is acquired back, i.e. in
      qemuMonitorOpen(). This creates a small problem for our test
      suite which calls qemuMonitorOpen() directly and passes @vm which
      has no definition. This makes virDomainObjIsActive() call crash.
      Fortunately, allocating empty domain definition is sufficient.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      75dd5958
    • J
      qemu: Adapt to changed ppc64 CPU model names · db873ab3
      Jiri Denemark 提交于
      QEMU 2.11 for ppc64 changed all CPU model names to lower case. Since
      libvirt can't change the model names for compatibility reasons, we need
      to translate the matching lower case models to the names known by
      libvirt.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      db873ab3
  9. 07 10月, 2019 5 次提交