+##############################################################################
+# Copyright (c) 2016 NEC Corporation and others.
#
-# Copyright 2016 NEC Corporation.
-#
-# 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.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
import argparse
from flask import Flask
import novaclient.client as novaclient
+import nova_force_down
+
class DoctorInspectorSample(object):
opts = {'all_tenants': True, 'host': hostname}
for server in self.nova.servers.list(detailed=False, search_opts=opts):
self.nova.servers.reset_state(server, 'error')
- self.nova.services.force_down(hostname, 'nova-compute', True)
+
+ # NOTE: We use our own client here instead of this novaclient for a
+ # workaround. Once keystone provides v2.1 nova api endpoint
+ # in the service catalog which is configured by OpenStack
+ # installer, we can use this:
+ #
+ # self.nova.services.force_down(hostname, 'nova-compute', True)
+ #
+ nova_force_down.force_down(hostname)
app = Flask(__name__)
def get_args():
- parser = argparse.ArgumentParser(description='Doctor Sample Monitor')
+ parser = argparse.ArgumentParser(description='Doctor Sample Inspector')
parser.add_argument('port', metavar='PORT', type=int, nargs='?',
- help='a port for inspectpr')
+ help='a port for inspector')
return parser.parse_args()