From patchwork Fri Nov 24 15:36:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10074203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BAFA86037F for ; Fri, 24 Nov 2017 15:38:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC6F52A271 for ; Fri, 24 Nov 2017 15:38:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0A822A27A; Fri, 24 Nov 2017 15:38:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 591312A271 for ; Fri, 24 Nov 2017 15:38:26 +0000 (UTC) Received: from localhost ([::1]:49863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIG3d-0004FV-IK for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 Nov 2017 10:38:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIG2T-0004Dn-Ok for qemu-devel@nongnu.org; Fri, 24 Nov 2017 10:37:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIG2P-0004cK-Ue for qemu-devel@nongnu.org; Fri, 24 Nov 2017 10:37:13 -0500 Received: from mail-eopbgr40105.outbound.protection.outlook.com ([40.107.4.105]:57962 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIG2P-0004a7-Mb for qemu-devel@nongnu.org; Fri, 24 Nov 2017 10:37:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=n/dGXGWisGrz5+54amSsiVT8YTK0sYZ9T4dJxwvORUs=; b=AAPfIFoh5BMtv8RtOPy2jNsUbTEOHASdlC8JzbIcq8DRk09EHd1fQD6c51e/l1tiZQ1f8w9ezz7bYFzd9kkqDkS6WitsM1IPkc1lT/RqwkW8Gkt+HgIJq5LsHUJFc8t7Hz0OMY20WsSn19KYPYBUZUDL8iUlM447bCP3NJBkPlI= Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Fri, 24 Nov 2017 15:37:05 +0000 From: Roman Kagan To: qemu-devel@nongnu.org, "Michael S. Tsirkin" , Igor Mammedov , Ben Warren Date: Fri, 24 Nov 2017 18:36:56 +0300 Message-Id: <20171124153656.30199-3-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171124153656.30199-1-rkagan@virtuozzo.com> References: <20171124153656.30199-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR07CA0045.eurprd07.prod.outlook.com (2603:10a6:7:66::31) To VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:VI1PR08MB0847; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 3:F1ttnitWk6vAXVUy6rCPpV4+Hc19cnMggzxBCN4tQd4zg0cohWigGJkbzRQ5cdd9k6TYSIbJXd66n4zsWYrhvo3hdJBumTBL/xcYWiSRxGWfKDJn0twLOLVE+jtnF1KT1/GxA4FJpXC3gc26teddrgUXIvUR0CgcceoJg0XuJyc/V7Dc8oxqBpfrPK/v6sAMVtsCVSK04UPU4m2W2PagLkURcTsF/3obfr+oeSzTdtfxE+k4D+70HfGoJZDvRDg0; 25:zlTPP0wSuv1T5FwlxhQPBHacAI7wIAuXyp2VQuXSt9sMQ69krc1V0Vpta2S2zG9Mml/ZAz3KaW1EVhL7fi8M9f4vDh6LgKTnbS3L7Zns7h++0cdS6CEGkbTJ5ZmvJV5RXIuM9MZWrU9RBR08FiGc91RXMH3SYLyZy7My4GKNqIvPpdh029s5gdcFLPEDGce6eoV8U6UFmZZAXvb/31xbe/GuW9Z0oMXAXwGJ8j4Ys9e4ySiTNJD7ODZlgctfyWtWx6Vu6jNLjk9NhtAeLL/E/d2Gk1o4R4NcDn+lMP1luVrnR7DvcA8rj35L3gojTS8IepHvJ1uHXWxjSjIWwLXTpg==; 31:qTvNZDGEY9Csvy2DrSHUIo5LQQ4Cvl+Vl9PQrbUiUdkk/CsbltsH2zgrAZ5RgDGa9m3zhGMhUmRyGWpeOLQPr0LREY3H3qH0cJPg790I5UDdubd9xcUE0kPGjLKnEJ6TgCyOKHvBIP8mmLZzk7SnqmR1qHz5J7ShvgHyBmqUCB//D6Uh3J0rCe+u08boDm0mz1yBT391UokeNzykqBo5n/2rrcCoshrvxJBGdfPKrRE= X-MS-TrafficTypeDiagnostic: VI1PR08MB0847: X-MS-Office365-Filtering-Correlation-Id: 3badff68-deca-4210-a218-08d5335137c7 X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 20:GYgSIIzteQ5BZxDbE6btnVOAmKvayZCESms+PYKUiZ98VojGbsIftpHi7vyVUXkH1TrBqdULc40u3r9gn9CgErkwYOr+eIi41y1F4HFGLy7ND/IewlZ8eB5K9m8CtW+yl6Vg+UuR24Lm0yLu/eanH+P9HISPLt7lybZhb2gRo0fAqCtlkOv24FZGgtnsLcTLgXAxRDRt6qjFErlzlEWZpmWXyfrvGEYa52RWIuExiBCiBgL80EoFTxo2mvlVnWUSgInTCDMn5VwLAfEvI4vJRLk5T6KYIa0rlndREASbzqDPDCuLOUElLRPU/jdpX6fE6drtJVPyCgn75kU9MxKCSX2Oo/PaGBO++cf9UQNka61Q9reTtkpLhRL9RhVRoADEkiYUYxpwuwZ8jHmJXG8L1HNZ2SHFtPoQmLJX6DkFuPk=; 4:sdcuQcdLe8spyTVt4zjWoXhgS0PqyMKHDRUE14uIGT0ADU3f18jyo7BszKC693khu6H2Mki6ABtdE7oXN/f1FbpqeX7qImLmX6rFvFqGay84LZ46cFs3bPG2GGCck/GD6DrW646btX1+Ks+f7bVh+hoWH+4vlnsFYqVNUEXu0wICMcUYkZZWgOs+8OsKlW7/Zd5NqA6vKV5aeCz8LF/Tk6CMA/WB59c679tAAoLp2GhxWiivzg9mYsb5eA5dGERVRw4ECrymUgyPETE/d2LgeQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(3002001)(93006095)(93001095)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011); SRVR:VI1PR08MB0847; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR08MB0847; X-Forefront-PRVS: 05015EB482 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(366004)(376002)(199003)(189002)(97736004)(101416001)(48376002)(50466002)(8676002)(81156014)(5660300001)(81166006)(53936002)(2906002)(7736002)(86362001)(6116002)(3846002)(478600001)(16586007)(6486002)(66066001)(6506006)(55236003)(107886003)(105586002)(2950100002)(16526018)(8936002)(50986999)(68736007)(189998001)(47776003)(76176999)(106356001)(33646002)(4326008)(25786009)(316002)(110136005)(52116002)(69596002)(54906003)(50226002)(1076002)(6512007)(36756003)(51416003)(53416004)(305945005)(6666003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB0847; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB0847; 23:oMbo9GqnUQs3/coeWz/3KTSKRBIvlPmWII/mZ9YoM?= =?us-ascii?Q?WGQgpqBXLBDIIp7mW2VJwTRnSFaBIjMCjerP3zv8+NDxLD9P/H/18vJW0dxH?= =?us-ascii?Q?3YiW57sjh0bojeea27Lgc6XO+Wk01QVxzQrdob6R/Z7exe7pCT85/1D8TVGF?= =?us-ascii?Q?gxhN/gb5BoZT8yeDua4yRlTy0u5QvMpNICbppPoT4md0LzcvLWDXBu/txBk/?= =?us-ascii?Q?JlbrSRKL8iJ9qDHZ1NqeuM86u5rgglaYX7hLG6NkEiVZk85O2R4/0R4NWoIv?= =?us-ascii?Q?AvyLWwkUwwOc6hwIHl/SNT83TxHspq63VfFY6Tow3WyZN+UYTItOxk+NFhNC?= =?us-ascii?Q?KhaCz8vKDY3CYK2XP2tW6y/OVQVkmZ5kMEq8Dmi04eeB1S85LjRdsNjjWqK0?= =?us-ascii?Q?HVfZZlc+lC8NmaGXLOWN/vC5h9m058TC1n+S/YQCI2/s7iZjnY09PU7o1KXf?= =?us-ascii?Q?/XqrhgWMG1asK+MMi0nsUs8Y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: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2017 15:37:05.8053 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3badff68-deca-4210-a218-08d5335137c7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0847 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.105 Subject: [Qemu-devel] [PATCH 2/2] vmgenid: use UUID property type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , "Denis V. Lunev" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Switch vmgenid device to use the UUID property type introduced in the previous patch for its 'guid' property. One semantic change it introduces is that post-realize modification of 'guid' via HMP or QMP will now be rejected with an error; however, according to docs/specs/vmgenid.txt this is actually desirable. Signed-off-by: Roman Kagan Reviewed-by: Marc-André Lureau Reviewed-by: Ben Warren --- hw/acpi/vmgenid.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index 105044f666..84ff015bda 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -162,21 +162,6 @@ static void vmgenid_update_guest(VmGenIdState *vms) } } -static void vmgenid_set_guid(Object *obj, const char *value, Error **errp) -{ - VmGenIdState *vms = VMGENID(obj); - - if (!strcmp(value, "auto")) { - qemu_uuid_generate(&vms->guid); - } else if (qemu_uuid_parse(value, &vms->guid) < 0) { - error_setg(errp, "'%s. %s': Failed to parse GUID string: %s", - object_get_typename(OBJECT(vms)), VMGENID_GUID, value); - return; - } - - vmgenid_update_guest(vms); -} - /* After restoring an image, we need to update the guest memory and notify * it of a potential change to VM Generation ID */ @@ -224,23 +209,24 @@ static void vmgenid_realize(DeviceState *dev, Error **errp) } qemu_register_reset(vmgenid_handle_reset, vms); + + vmgenid_update_guest(vms); } +static Property vmgenid_device_properties[] = { + DEFINE_PROP_UUID("guid", VmGenIdState, guid), + DEFINE_PROP_END_OF_LIST(), +}; + static void vmgenid_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_vmgenid; dc->realize = vmgenid_realize; + dc->props = vmgenid_device_properties; dc->hotpluggable = false; set_bit(DEVICE_CATEGORY_MISC, dc->categories); - - object_class_property_add_str(klass, VMGENID_GUID, NULL, - vmgenid_set_guid, NULL); - object_class_property_set_description(klass, VMGENID_GUID, - "Set Global Unique Identifier " - "(big-endian) or auto for random value", - NULL); } static const TypeInfo vmgenid_device_info = {