Lint: W293 blank line contains whitespace
This commit is contained in:
@ -1143,7 +1143,7 @@ def collect_ceph_stats(queue):
|
||||
'write_ops': pool['write_ops'],
|
||||
'write_bytes': pool['write_bytes']
|
||||
}
|
||||
|
||||
|
||||
# Write the pool data to Zookeeper
|
||||
zkhandler.writedata(zk_conn, {
|
||||
'/ceph/pools/{}/stats'.format(pool['name']): str(json.dumps(pool_df))
|
||||
@ -1487,13 +1487,13 @@ def node_keepalive():
|
||||
vm_thread_queue = Queue()
|
||||
vm_stats_thread = Thread(target=collect_vm_stats, args=(vm_thread_queue,), kwargs={})
|
||||
vm_stats_thread.start()
|
||||
|
||||
|
||||
# Run Ceph status collection in separate thread for parallelization
|
||||
if enable_storage:
|
||||
ceph_thread_queue = Queue()
|
||||
ceph_stats_thread = Thread(target=collect_ceph_stats, args=(ceph_thread_queue,), kwargs={})
|
||||
ceph_stats_thread.start()
|
||||
|
||||
|
||||
# Get node performance statistics
|
||||
this_node.memtotal = int(psutil.virtual_memory().total / 1024 / 1024)
|
||||
this_node.memused = int(psutil.virtual_memory().used / 1024 / 1024)
|
||||
@ -1627,7 +1627,7 @@ def node_keepalive():
|
||||
node_daemon_state = 'unknown'
|
||||
node_domain_state = 'unknown'
|
||||
node_keepalive = 0
|
||||
|
||||
|
||||
# Handle deadtime and fencng if needed
|
||||
# (A node is considered dead when its keepalive timer is >6*keepalive_interval seconds
|
||||
# out-of-date while in 'start' state)
|
||||
|
@ -49,33 +49,33 @@ class MetadataAPIInstance(object):
|
||||
@self.mdapi.route('/', methods=['GET'])
|
||||
def api_root():
|
||||
return flask.jsonify({"message": "PVC Provisioner Metadata API version 1"}), 209
|
||||
|
||||
|
||||
@self.mdapi.route('/<version>/meta-data/', methods=['GET'])
|
||||
def api_metadata_root(version):
|
||||
metadata = """instance-id\nname\nprofile"""
|
||||
return metadata, 200
|
||||
|
||||
|
||||
@self.mdapi.route('/<version>/meta-data/instance-id', methods=['GET'])
|
||||
def api_metadata_instanceid(version):
|
||||
source_address = flask.request.__dict__['environ']['REMOTE_ADDR']
|
||||
vm_details = self.get_vm_details(source_address)
|
||||
instance_id = vm_details.get('uuid', None)
|
||||
return instance_id, 200
|
||||
|
||||
|
||||
@self.mdapi.route('/<version>/meta-data/name', methods=['GET'])
|
||||
def api_metadata_hostname(version):
|
||||
source_address = flask.request.__dict__['environ']['REMOTE_ADDR']
|
||||
vm_details = self.get_vm_details(source_address)
|
||||
vm_name = vm_details.get('name', None)
|
||||
return vm_name, 200
|
||||
|
||||
|
||||
@self.mdapi.route('/<version>/meta-data/profile', methods=['GET'])
|
||||
def api_metadata_profile(version):
|
||||
source_address = flask.request.__dict__['environ']['REMOTE_ADDR']
|
||||
vm_details = self.get_vm_details(source_address)
|
||||
vm_profile = vm_details.get('profile', None)
|
||||
return vm_profile, 200
|
||||
|
||||
|
||||
@self.mdapi.route('/<version>/user-data', methods=['GET'])
|
||||
def api_userdata(version):
|
||||
source_address = flask.request.__dict__['environ']['REMOTE_ADDR']
|
||||
@ -88,7 +88,7 @@ class MetadataAPIInstance(object):
|
||||
else:
|
||||
userdata = None
|
||||
return flask.Response(userdata)
|
||||
|
||||
|
||||
def launch_wsgi(self):
|
||||
try:
|
||||
self.md_http_server = gevent.pywsgi.WSGIServer(
|
||||
@ -159,7 +159,7 @@ class MetadataAPIInstance(object):
|
||||
def get_vm_details(self, source_address):
|
||||
# Start connection to Zookeeper
|
||||
_discard, networks = pvc_network.get_list(self.zk_conn, None)
|
||||
|
||||
|
||||
# Figure out which server this is via the DHCP address
|
||||
host_information = dict()
|
||||
networks_managed = (x for x in networks if x.get('type') == 'managed')
|
||||
@ -172,12 +172,12 @@ class MetadataAPIInstance(object):
|
||||
host_information = information
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# Get our real information on the host; now we can start querying about it
|
||||
client_hostname = host_information.get('hostname', None)
|
||||
client_macaddr = host_information.get('mac_address', None)
|
||||
client_ipaddr = host_information.get('ip4_address', None)
|
||||
|
||||
|
||||
# Find the VM with that MAC address - we can't assume that the hostname is actually right
|
||||
_discard, vm_list = pvc_vm.get_list(self.zk_conn, None, None, None)
|
||||
vm_name = None
|
||||
@ -190,6 +190,6 @@ class MetadataAPIInstance(object):
|
||||
vm_details = vm
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
return vm_details
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user