From nobody Sun May 5 13:08:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612275740; cv=none; d=zohomail.com; s=zohoarc; b=L9+ubg2jGb3FnDQNKQmPdkoj3om5rFQEMRk4eYyWWKPVIl5WRdnHp8J7RRw7VdsrbSuIyWCB4XU1S0ojKqydqCoBxAbc/sYV53Yk5lFO+7ezCQ1/tXjy0cTlkUqkVOOv2xxSvhvxlFW2ZdD4wqmqK+Z2wCyXF3TDxkuKpgjVSHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612275740; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+Ki3lCzcQspq4ZrSG7TdIHSFaV6V3SrCZlRZY27m5es=; b=gLEvid8p1DuzUAGAFDvv3jo+WuZB4R/hp8Tp+0PcnKRo3sfryIrBEvmVXEssaIIdMBrZku8sxB8Jp7UE75z0jzqAPgxeG/3uvzFhwl56aQ7UuWy6MyeC6FdY6OQurE7iyXFFOWxs0PxLycfVRwVTQHMb1fYzwooKfOIJWCgMNd0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161227574061495.49236596416222; Tue, 2 Feb 2021 06:22:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-v9zlIiVQOPu-c_qBxPVX0A-1; Tue, 02 Feb 2021 09:22:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 460A5835E22; Tue, 2 Feb 2021 14:22:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D00D5D722; Tue, 2 Feb 2021 14:22:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1FB665003A; Tue, 2 Feb 2021 14:22:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 112EM5bh032348 for ; Tue, 2 Feb 2021 09:22:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 48E0F85781; Tue, 2 Feb 2021 14:22:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C11AAB582 for ; Tue, 2 Feb 2021 14:22:02 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F70D1875040 for ; Tue, 2 Feb 2021 14:22:02 +0000 (UTC) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-Thi8JkCmPGGRZVQ2K1Qs_w-1; Tue, 02 Feb 2021 09:21:58 -0500 Received: by mail-pf1-f169.google.com with SMTP id w18so14412881pfu.9 for ; Tue, 02 Feb 2021 06:21:57 -0800 (PST) Received: from localhost.localdomain.localdomain ([222.67.221.235]) by smtp.gmail.com with ESMTPSA id q12sm21979355pgj.24.2021.02.02.06.21.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2021 06:21:55 -0800 (PST) X-MC-Unique: v9zlIiVQOPu-c_qBxPVX0A-1 X-MC-Unique: Thi8JkCmPGGRZVQ2K1Qs_w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+Ki3lCzcQspq4ZrSG7TdIHSFaV6V3SrCZlRZY27m5es=; b=CSRp2Thf6qCgEOKiJKBuYPGLY2ry++5akunCU31BU+BXy5Xf21Oy1ai1djFchQ5+Ly Hl1usgeOz37xLbQS3+sC8tEkv3RtBflxzJjxpXO8t9Q+jmB2ADfGl+igKm9TaCOROPXg AW7YvLz1lPNG3sD0No+xM5ueKJn/4T0WrqW8eZDuFPZUICt9ypPgZFmqmbU9+ZemWGd9 UfMSdAQkt5ssR1E4hbCrNFN35/TZDR9hO9w9IxfXIBghErg3xjFxAzfYVCW7AVNr3f6v hXojAtsnyFivC2143MNs5qJL4KbLImxoFPA0cdMiZERvO4JrVlwkEAtzx4ZDAePaf33y y4jw== X-Gm-Message-State: AOAM532dz+L0dwL0Gq4B6tBsBb9ft/E27nl0P/AZOSSEQhnw+A19yvin Di8VxL3/+UQ0ngOE9nzueeZOxg== X-Google-Smtp-Source: ABdhPJzRH8NAOA6owpt78EoTdnrtlv5a9g9BtJWPsxsW46WuntEDHL3lg4RtwZoBJvqGrQ2x94J0EQ== X-Received: by 2002:a62:401:0:b029:1c3:fb36:8f55 with SMTP id 1-20020a6204010000b02901c3fb368f55mr21646455pfe.52.1612275716596; Tue, 02 Feb 2021 06:21:56 -0800 (PST) From: gongwei To: mprivozn@redhat.com, libvir-list@redhat.com Subject: [PATCH] conf: add realtime parameter for rtc Date: Tue, 2 Feb 2021 09:20:46 -0500 Message-Id: <1612275646-50357-1-git-send-email-gongwei@smartx.com> In-Reply-To: References: X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: gongwei X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Pass the parameter clock rt to qemu to ensure that the virtual machine is not synchronized with the host time Signed-off-by: gongwei Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 2 +- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 3 +++ src/qemu/qemu_validate.c | 1 + tests/qemuxml2argvdata/clock-realtime.args | 30 +++++++++++++++++++++++ tests/qemuxml2argvdata/clock-realtime.xml | 31 +++++++++++++++++++++++ tests/qemuxml2xmloutdata/clock-realtime.xml | 38 +++++++++++++++++++++++++= ++++ 9 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/clock-realtime.args create mode 100644 tests/qemuxml2argvdata/clock-realtime.xml create mode 100644 tests/qemuxml2xmloutdata/clock-realtime.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index c738078..75cc60b 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2059,7 +2059,7 @@ Windows, however, expects it to be in so called 'loca= ltime'. feature for guests running the Microsoft Windows operating system. ``track`` The ``track`` attribute specifies what the timer tracks, and can be - "boot", "guest", or "wall". Only valid for ``name=3D"rtc"`` or + "boot", "guest", or "wall", or "realtime". Only valid for ``name=3D"= rtc"`` or ``name=3D"platform"``. ``tickpolicy`` The ``tickpolicy`` attribute determines what happens when QEMU misse= s a diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a4bddcf..d882f90 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1209,6 +1209,7 @@ boot guest wall + realtime 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", ); =20 VIR_ENUM_IMPL(virDomainTimerTickpolicy, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 95ad052..e73b69c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2160,6 +2160,7 @@ typedef enum { VIR_DOMAIN_TIMER_TRACK_BOOT =3D 0, VIR_DOMAIN_TIMER_TRACK_GUEST, VIR_DOMAIN_TIMER_TRACK_WALL, + VIR_DOMAIN_TIMER_TRACK_REALTIME, =20 VIR_DOMAIN_TIMER_TRACK_LAST } virDomainTimerTrackType; 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=3Dhost"); break; + case VIR_DOMAIN_TIMER_TRACK_REALTIME: + virBufferAddLit(&buf, ",clock=3Drt"); + break; } =20 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 *de= f, 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, diff --git a/tests/qemuxml2argvdata/clock-realtime.args b/tests/qemuxml2arg= vdata/clock-realtime.args new file mode 100644 index 0000000..7965696 --- /dev/null +++ b/tests/qemuxml2argvdata/clock-realtime.args @@ -0,0 +1,30 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc,driftfix=3Dslew,clock=3Drt \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/clock-realtime.xml b/tests/qemuxml2argv= data/clock-realtime.xml new file mode 100644 index 0000000..71bdc5a --- /dev/null +++ b/tests/qemuxml2argvdata/clock-realtime.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + +
+ + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/clock-realtime.xml b/tests/qemuxml2xm= loutdata/clock-realtime.xml new file mode 100644 index 0000000..3ba6b4c --- /dev/null +++ b/tests/qemuxml2xmloutdata/clock-realtime.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + +
+ + +
+ + + + + +
+ + + --=20 1.8.3.1