Fixing typo fencor > fencer

Change-Id: I3ecbd4c2cbfd6d38a6e351ac4409068abf37be2f
This commit is contained in:
Saad Zaher
2015-12-23 15:56:21 +00:00
parent 788b98dee5
commit 8640e43e3f
12 changed files with 57 additions and 55 deletions

View File

@@ -91,7 +91,7 @@
#instance_uuid_format = "[instance: %(uuid)s] "
[fencor]
[fencer]
#
# From osha
@@ -100,16 +100,18 @@
# YAML File contains the required credentials for compute nodes (string value)
#credentials_file = <None>
# Number of retries to fence the each compute node. (integer value)
# Number of retries to fence the each compute node. Must be at least 1 to try
# first the soft shutdown (integer value)
#retries = 1
# Time in seconds to wait between retries (integer value)
# Time in seconds to wait between retries. Should be reasonable amount of time
# as different servers take different times to shut off (integer value)
#hold_period = 10
# Choose the best fencor driver i.e.(ipmi, libvirt, .. (string value)
#driver = osha.fencors.drivers.ipmi.driver.IpmiDriver
# Choose the best fencer driver i.e.(ipmi, libvirt, .. (string value)
#driver = osha.fencers.drivers.ipmi.driver.IpmiDriver
# List of kwargs to customize the fencor operation. You fencor driver should
# List of kwargs to customize the fencer operation. You fencer driver should
# support these options. Options should be in key:value format (dict value)
#options =

View File

@@ -20,41 +20,41 @@
- id: deployer
ip-addr: 192.168.10.254
hostname: padawan-cp1-c0-m1-mgmt
ilo-ip: 192.168.9.2
ilo-password: password
ilo-user: admin
fencer-ip: 192.168.9.2
fencer-password: password
fencer-user: admin
- id: ccn-0001
ip-addr: 192.168.10.3
hostname: padawan-cp1-c1-m1-mgmt
ilo-ip: 192.168.9.3
ilo-password: password
ilo-user: admin
fencer-ip: 192.168.9.3
fencer-password: password
fencer-user: admin
- id: ccn-0002
ip-addr: 192.168.10.4
hostname: padawan-cp1-c1-m2-mgmt
ilo-ip: 192.168.9.4
ilo-password: password
ilo-user: admin
fencer-ip: 192.168.9.4
fencer-password: password
fencer-user: admin
- id: ccn-0003
ip-addr: 192.168.10.5
hostname: padawan-cp1-c1-m3-mgmt
ilo-ip: 192.168.9.5
ilo-password: password
ilo-user: admin
fencer-ip: 192.168.9.5
fencer-password: password
fencer-user: admin
- id: COMPUTE-0001
ip-addr: 192.168.10.6
hostname: padawan-ccp-comp0001-mgmt
ilo-ip: 192.168.9.6
ilo-password: password
ilo-user: admin
fencer-ip: 192.168.9.6
fencer-password: password
fencer-user: admin
- id: COMPUTE-0002
ip-addr: 192.168.10.7
hostname: padawan-ccp-comp0002-mgmt
ilo-ip: 192.168.9.7
ilo-password: password
ilo-user: admin
fencer-ip: 192.168.9.7
fencer-password: password
fencer-user: admin

View File

@@ -43,7 +43,7 @@ _COMMON = [
help='Time to wait between different operations')
]
_FENCOR = [
_FENCER = [
cfg.StrOpt('credentials-file',
help='YAML File contains the required credentials for compute '
'nodes'),
@@ -57,12 +57,12 @@ _FENCOR = [
'reasonable amount of time as different servers take '
'different times to shut off'),
cfg.StrOpt('driver',
default='osha.fencors.drivers.ipmi.driver.IpmiDriver',
help='Choose the best fencor driver i.e.(ipmi, libvirt, ..'),
default='osha.fencers.drivers.ipmi.driver.IpmiDriver',
help='Choose the best fencer driver i.e.(ipmi, libvirt, ..'),
cfg.DictOpt('options',
default={},
help='List of kwargs to customize the fencor operation. You '
'fencor driver should support these options. Options '
help='List of kwargs to customize the fencer operation. You '
'fencer driver should support these options. Options '
'should be in key:value format')
]
@@ -154,12 +154,12 @@ def configure():
CONF.register_group(monitors_grp)
CONF.register_opts(_MONITORS, group='monitoring')
fencors_grp = cfg.OptGroup('fencor',
title='Fencor Options',
help='Fencor Driver/plugin to be used to '
fencers_grp = cfg.OptGroup('fencer',
title='fencer Options',
help='fencer Driver/plugin to be used to '
'fence compute nodes')
CONF.register_group(fencors_grp)
CONF.register_opts(_FENCOR, group='fencor')
CONF.register_group(fencers_grp)
CONF.register_opts(_FENCER, group='fencer')
default_conf = cfg.find_config_files('osha', 'osha',
'.conf')
@@ -192,7 +192,7 @@ def list_opts():
None: _COMMON,
'monitoring': _MONITORS,
'keystone': build_os_options(),
'fencor': _FENCOR
'fencer': _FENCER
}
return _OPTS.items()

View File

@@ -17,15 +17,15 @@ import six
@six.add_metaclass(abc.ABCMeta)
class FencorBaseDriver(object):
class FencerBaseDriver(object):
"""
Abstract class that all fencor plugins should implement to have a
Abstract class that all fencer plugins should implement to have a
unified interface and as many plugins as we want...
"""
def __init__(self, node_ip, node_username, node_password, **kwargs):
"""
Initializing the driver. Any fencor driver requires the following
Initializing the driver. Any fencer driver requires the following
parameters to do the api calls. All these parameters can be passed from
the configuration file in /etc/osha/osha.conf (default)
:param credentials_file: path to the credentials file

View File

@@ -21,12 +21,12 @@ CONF = cfg.CONF
LOG = log.getLogger(__name__)
class FencorManager(object):
class FencerManager(object):
def __init__(self, nodes):
self.fencor = CONF.get('fencor')
self.fencer = CONF.get('fencer')
self.nodes = nodes
self.parser = YamlParser(self.fencor.get('credentials_file'))
self.parser = YamlParser(self.fencer.get('credentials_file'))
def fence(self):
"""
@@ -37,11 +37,11 @@ class FencorManager(object):
for node in self.nodes:
node_details = self.parser.find_server_by_ip(node.get('ip'))
driver = importutils.import_object(
self.fencor.get('driver'),
node_details.get('fencor-ip'),
node_details.get('fencor-user'),
node_details.get('fencor-password'),
**self.fencor.get('options')
self.fencer.get('driver'),
node_details.get('fencer-ip'),
node_details.get('fencer-user'),
node_details.get('fencer-password'),
**self.fencer.get('options')
)
node['status'] = self.do_shutdown_procedure(driver)
print "Shit Happens", driver.status()
@@ -49,7 +49,7 @@ class FencorManager(object):
return processed_nodes
def do_shutdown_procedure(self, driver):
for retry in range(0, self.fencor.get('retries', 1)):
for retry in range(0, self.fencer.get('retries', 1)):
if driver.status():
try:
driver.graceful_shutdown()
@@ -59,9 +59,9 @@ class FencorManager(object):
return True
# try to wait a pre-configured amount of time before redoing
# the fence call again :)
sleep(self.fencor.get('hold_period', 10))
sleep(self.fencer.get('hold_period', 10))
LOG.info('wait for %d seconds before retrying to gracefully '
'shutdown' % self.fencor.get('hold_period', 10))
'shutdown' % self.fencer.get('hold_period', 10))
LOG.info('Retrying to gracefully shutdown the node.')
try:

View File

@@ -11,8 +11,8 @@
# 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.
from osha.fencors.common.driver import FencorBaseDriver
from osha.fencors.drivers.ipmi.ipmitool import IpmiInterface
from osha.fencers.common.driver import FencerBaseDriver
from osha.fencers.drivers.ipmi.ipmitool import IpmiInterface
from oslo_log import log
from oslo_config import cfg
@@ -20,7 +20,7 @@ CONF = cfg.CONF
LOG = log.getLogger(__name__)
class IpmiDriver(FencorBaseDriver):
class IpmiDriver(FencerBaseDriver):
def __init__(self, node_ip, node_username, node_password, **kwargs):
super(IpmiDriver, self).__init__(node_ip, node_username, node_password,
**kwargs)

View File

@@ -15,7 +15,7 @@ from osha.common import config
from oslo_config import cfg
from oslo_log import log
from osha.monitors.common.manager import MonitorManager
from osha.fencors.common.manager import FencorManager
from osha.fencers.common.manager import FencerManager
CONF = cfg.CONF
LOG = log.getLogger(__name__)
@@ -35,6 +35,6 @@ def main():
# deployments
# Load Fence driver
# Shutdown the node
fencor = FencorManager(nodes)
nodes = fencor.fence()
fencer = FencerManager(nodes)
nodes = fencer.fence()
print "Fenced nodes are", nodes