From patchwork Thu Jan 12 15:52:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashijeet Acharya X-Patchwork-Id: 9513481 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 BE9D060476 for ; Thu, 12 Jan 2017 15:53:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10FA286D5 for ; Thu, 12 Jan 2017 15:53:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5B68286DD; Thu, 12 Jan 2017 15:53:46 +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=-3.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, 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 5A824286DB for ; Thu, 12 Jan 2017 15:53:45 +0000 (UTC) Received: from localhost ([::1]:34760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRhh9-00010L-RD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Jan 2017 10:53:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRhgV-0000xO-Lv for qemu-devel@nongnu.org; Thu, 12 Jan 2017 10:53:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRhgO-0001NZ-1w for qemu-devel@nongnu.org; Thu, 12 Jan 2017 10:53:03 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:33395) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cRhgN-0001NG-SD for qemu-devel@nongnu.org; Thu, 12 Jan 2017 10:52:55 -0500 Received: by mail-pf0-x241.google.com with SMTP id 127so4067552pfg.0 for ; Thu, 12 Jan 2017 07:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AChMt2ugOxWe7xpI90sgU2dD0dFtVx1N9LgPz7CRI+c=; b=c3kKYHhFo7CqDDzJFa7fwqkFPD90NPnk9dUJb+fTZr8zExiIl54qK7563o4r6E0Zss mK0tV+fIqvM3IlJ+RnYqM7j0kd2c+dgKGD4IQX1EkbcJsW7SY+Uj06m+oeOA+OmqlEnw 4yzu7mkc1/mNB5X+Vo2qJl8dYRzV82fYm52naVFzH4s7G4hi1PW/YcY5N8wuQXy1mw4b yllnGKWllMPw+luQtYGBXXxlGw6zL5w93zkXWatu6pbjr5+L0Hl9sr5iAHhKsZEIqEeA 9UVAirPGRpa6ONMEShOh1sBjZoO+sgWZ0rW30VsiGPeerf/gO0+Y9orq3zx7gqivEEdx LIaQ== 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=AChMt2ugOxWe7xpI90sgU2dD0dFtVx1N9LgPz7CRI+c=; b=p0NV21IHDPyYqnNxaXlRdnTZhJlEAsRXSbyPm16luS+bX48GLW6YpvqMnWMPUBfLUK B4xDJ7sL7veFZLd+l9RKzx5s/v6tMcucO2BL8sidIB14B9Mldx6AEPJkOUEHIaFs/u4p frZ6xylT7n4mAwZAUQ081TgmHF9pqQ6L+GoZ/BtbSDMytWjIPKyj+vaP+aICTSOkGX0b 5srKh9lBKisqsdlBywSMYOK3UcGCXJhmHDhrzSiGLQvgR5MCJ0U/bM59aAay7jWqqknB JCR7zn2waj/J8RWQvcN061zM3wAFv35814LGZhwOYXbg/86oZAADiNq3N3WWhfK37pYp 49Qg== X-Gm-Message-State: AIkVDXLbksjelCtN4A92nrEm/DxMxZE3b2lRiRxmBEZighYTT22k9rIzoTJlGuqhI/07Hg== X-Received: by 10.84.210.35 with SMTP id z32mr22526803plh.112.1484236374888; Thu, 12 Jan 2017 07:52:54 -0800 (PST) Received: from linux.local ([27.251.197.196]) by smtp.gmail.com with ESMTPSA id u124sm22810900pgb.6.2017.01.12.07.52.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Jan 2017 07:52:54 -0800 (PST) From: Ashijeet Acharya To: dgilbert@redhat.com Date: Thu, 12 Jan 2017 21:22:31 +0530 Message-Id: <1484236354-9640-2-git-send-email-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1484236354-9640-1-git-send-email-ashijeetacharya@gmail.com> References: <1484236354-9640-1-git-send-email-ashijeetacharya@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH v5 1/4] migration: Add a new option to enable only-migratable 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: kwolf@redhat.com, peter.maydell@linaro.org, quintela@redhat.com, qemu-devel@nongnu.org, mst@redhat.com, armbru@redhat.com, groug@kaod.org, aneesh.kumar@linux.vnet.ibm.com, Ashijeet Acharya , marcandre.lureau@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a new option "--only-migratable" in qemu which will allow to add only those devices which will not fail qemu after migration. Devices set with the flag 'unmigratable' cannot be added when this option will be used. Signed-off-by: Ashijeet Acharya Reviewed-by: Dr. David Alan Gilbert --- include/migration/migration.h | 3 +++ qemu-options.hx | 9 +++++++++ vl.c | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/include/migration/migration.h b/include/migration/migration.h index c309d23..40b3697 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -38,6 +38,9 @@ #define QEMU_VM_COMMAND 0x08 #define QEMU_VM_SECTION_FOOTER 0x7e +/* for vl.c */ +extern int only_migratable; + struct MigrationParams { bool blk; bool shared; diff --git a/qemu-options.hx b/qemu-options.hx index c534a2f..1e16ae8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3574,6 +3574,15 @@ be used to change settings (such as migration parameters) prior to issuing the migrate_incoming to allow the migration to begin. ETEXI +DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \ + "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL) +STEXI +@item -only-migratable +@findex -only-migratable +Only allow migratable devices. Devices will not be allowed to enter an +unmigratable state. +ETEXI + DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \ "-nodefaults don't create default devices\n", QEMU_ARCH_ALL) STEXI diff --git a/vl.c b/vl.c index d77dd86..6078a76 100644 --- a/vl.c +++ b/vl.c @@ -180,6 +180,7 @@ bool boot_strict; uint8_t *boot_splash_filedata; size_t boot_splash_filedata_size; uint8_t qemu_extra_params_fw[2]; +int only_migratable; /* turn it off unless user states otherwise */ int icount_align_option; @@ -3914,6 +3915,9 @@ int main(int argc, char **argv, char **envp) } incoming = optarg; break; + case QEMU_OPTION_only_migratable: + only_migratable = 1; + break; case QEMU_OPTION_nodefaults: has_defaults = 0; break;