[PATCH] conf: add realtime parameter for rtc

Daniel Henrique Barboza danielhb413 at gmail.com
Mon Feb 1 13:15:50 UTC 2021


This patch won't compile in my env:

domain_conf.c.o -c ../src/conf/domain_conf.c
In file included from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                  from /usr/include/glib-2.0/glib/gtypes.h:32,
                  from /usr/include/glib-2.0/glib/galloca.h:32,
                  from /usr/include/glib-2.0/glib.h:30,
                  from ../src/util/glibcompat.h:21,
                  from ../src/internal.h:30,
                  from ../src/conf/domain_conf.c:30:
/usr/include/glib-2.0/glib/gmacros.h:745:53: error: size of array ‘_GStaticAssertCompileTimeAssertion_111’ is negative
   745 | #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
       |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:735:47: note: in definition of macro ‘G_PASTE_ARGS’
   735 | #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
       |                                               ^~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:745:44: note: in expansion of macro ‘G_PASTE’
   745 | #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
       |                                            ^~~~~~~
../src/util/virenum.h:45:5: note: in expansion of macro ‘G_STATIC_ASSERT’
    45 |     G_STATIC_ASSERT(G_N_ELEMENTS(name ## TypeList) == lastVal)
       |     ^~~~~~~~~~~~~~~
../src/conf/domain_conf.c:1104:1: note: in expansion of macro ‘VIR_ENUM_IMPL’
  1104 | VIR_ENUM_IMPL(virDomainTimerTrack,
       | ^~~~~~~~~~~~~
[107/1007] Compiling C object src/util/libvirt_util.a.p/virutil.c.o
ninja: build stopped: subcommand failed.


You're missing this chunk in domain_conf.h:


$ git diff
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0a5d151150..51b1189951 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2160,6 +2160,7 @@ typedef enum {
      VIR_DOMAIN_TIMER_TRACK_BOOT = 0,
      VIR_DOMAIN_TIMER_TRACK_GUEST,
      VIR_DOMAIN_TIMER_TRACK_WALL,
+    VIR_DOMAIN_TIMER_TRACK_REALTIME,
  
      VIR_DOMAIN_TIMER_TRACK_LAST
  } virDomainTimerTrackType;



Also, I believe that since you're adding a new timer track attribute
"realtime" you'll also need to:

- change domaincommon.rng to add it as a valid timer track value
- change formatdomain.rst, section 'Time keeping' - clock - timer - track,
and add this new "realtime" value


I would also claim that you would also need a new qemuxmlargvtest.c since you're
adding a new QEMU command line option, but given that we do not have any test
for the others existing timer track command lines I'd consider this new test
good to have, but optional.


Thanks,


DHB


On 1/25/21 3:23 AM, gongwei wrote:
>      Pass the parameter clock rt to qemu to ensure that the
>      virtual machine is not synchronized with the host time
> ---
>   src/conf/domain_conf.c   | 1 +
>   src/qemu/qemu_command.c  | 3 +++
>   src/qemu/qemu_validate.c | 1 +
>   3 files changed, 5 insertions(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index dab4f10..c19124d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -1106,6 +1106,7 @@ VIR_ENUM_IMPL(virDomainTimerTrack,
>                 "boot",
>                 "guest",
>                 "wall",
> +              "realtime",
>   );
>   
>   VIR_ENUM_IMPL(virDomainTimerTickpolicy,
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 1ec302d..5e09aa0 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -5947,6 +5947,9 @@ qemuBuildClockArgStr(virDomainClockDefPtr def)
>               case VIR_DOMAIN_TIMER_TRACK_WALL:
>                   virBufferAddLit(&buf, ",clock=host");
>                   break;
> +            case VIR_DOMAIN_TIMER_TRACK_REALTIME:
> +                virBufferAddLit(&buf, ",clock=rt");
> +                break;
>               }
>   
>               switch (def->timers[i]->tickpolicy) {
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index a060bd9..d4fe40f 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -444,6 +444,7 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
>               case -1: /* unspecified - use hypervisor default */
>               case VIR_DOMAIN_TIMER_TRACK_GUEST:
>               case VIR_DOMAIN_TIMER_TRACK_WALL:
> +            case VIR_DOMAIN_TIMER_TRACK_REALTIME:
>                   break;
>               case VIR_DOMAIN_TIMER_TRACK_BOOT:
>                   virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> 




More information about the libvir-list mailing list