From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 12/17] KVM test: kvm_preprocessing.py: simplify handling of params['migration_mode'] Date: Mon, 3 Jan 2011 20:27:13 +0200 Message-ID: <1294079238-21239-12-git-send-email-mgoldish@redhat.com> References: <1294079238-21239-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1294079238-21239-1-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Also reorder the if statements because if migration_mode is specified it causes an unconditional VM restart (unlike start_vm). Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_preprocessing.py | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py index 450cf59..5ce0a3b 100644 --- a/client/tests/kvm/kvm_preprocessing.py +++ b/client/tests/kvm/kvm_preprocessing.py @@ -60,11 +60,12 @@ def preprocess_vm(test, params, env, name): start_vm = False - migration_mode = params.get("migration_mode", None) - if params.get("restart_vm") == "yes": logging.debug("'restart_vm' specified; (re)starting VM...") start_vm = True + elif params.get("migration_mode"): + logging.debug("Starting VM in incoming migration mode...") + start_vm = True elif params.get("start_vm") == "yes": if not vm.is_alive(): logging.debug("VM is not alive; starting it...") @@ -74,16 +75,11 @@ def preprocess_vm(test, params, env, name): logging.debug("VM's qemu command differs from requested one; " "restarting it...") start_vm = True - elif migration_mode is not None: - logging.debug("Starting VM on migration incoming mode...") - start_vm = True if start_vm: - if migration_mode is not None: - vm.create(name, params, test.bindir, migration_mode=migration_mode) - else: - # Start the VM (or restart it if it's already up) - vm.create(name, params, test.bindir) + # Start the VM (or restart it if it's already up) + vm.create(name, params, test.bindir, + migration_mode=params.get("migration_mode")) else: # Don't start the VM, just update its params vm.params = params -- 1.7.3.4