From 50f7b064d7785bd0bdc1f431c48d53d188d8b2a7 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 13 Oct 2016 13:42:52 -0400 Subject: [PATCH] Remove watchdog_actions module The only purpose of the watchdog_actions module was for a helper method to check against a list of enums which are also defined in the WatchdogAction enum field, so remove the module and just use the field enums. Change-Id: I0de5fc4efc0ae0b5fe11a56669e180b450d3410a --- nova/virt/libvirt/driver.py | 3 +-- nova/virt/watchdog_actions.py | 24 ------------------------ 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 nova/virt/watchdog_actions.py diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 25a668552f..07a2f92944 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -110,7 +110,6 @@ from nova.virt.libvirt import utils as libvirt_utils from nova.virt.libvirt import vif as libvirt_vif from nova.virt.libvirt.volume import remotefs from nova.virt import netutils -from nova.virt import watchdog_actions from nova.volume import cinder from nova.volume import encryptors @@ -4552,7 +4551,7 @@ class LibvirtDriver(driver.ComputeDriver): # NB(sross): currently only actually supported by KVM/QEmu if watchdog_action != 'disabled': - if watchdog_actions.is_valid_watchdog_action(watchdog_action): + if watchdog_action in fields.WatchdogAction.ALL: bark = vconfig.LibvirtConfigGuestWatchdog() bark.action = watchdog_action guest.add_device(bark) diff --git a/nova/virt/watchdog_actions.py b/nova/virt/watchdog_actions.py deleted file mode 100644 index e6af8ae667..0000000000 --- a/nova/virt/watchdog_actions.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2014 Red Hat, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""Describes and verifies the watchdog device actions.""" - - -# the values which may be passed to libvirt -RAW_WATCHDOG_ACTIONS = ['poweroff', 'reset', 'pause', 'none'] - - -def is_valid_watchdog_action(val): - """Check if the given value is a valid watchdog device parameter.""" - return val in RAW_WATCHDOG_ACTIONS -- 2.39.5