WIP: bug with python3 support and other new relations
Tested with new Doctor changes to support fuel installer and using python3 Change-Id: I5c2e9d2f3b0d5569c79dc5d7d7d88308f6444b73 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
This commit is contained in:
parent
eb74b0bd9d
commit
d2913eacd3
|
@ -45,7 +45,7 @@ class ProjectController(rest.RestController):
|
|||
abort(400)
|
||||
engine_data = self.engine_rpcapi.project_get_session(session_id,
|
||||
project_id)
|
||||
response.body = jsonutils.dumps(engine_data)
|
||||
response.text = jsonutils.dumps(engine_data)
|
||||
|
||||
# PUT /v1/maintenance/<session_id>/<project_id>
|
||||
@policy.authorize('maintenance:session:project', 'put')
|
||||
|
@ -55,7 +55,7 @@ class ProjectController(rest.RestController):
|
|||
engine_data = self.engine_rpcapi.project_update_session(session_id,
|
||||
project_id,
|
||||
data)
|
||||
response.body = jsonutils.dumps(engine_data)
|
||||
response.text = jsonutils.dumps(engine_data)
|
||||
|
||||
|
||||
class SessionController(rest.RestController):
|
||||
|
@ -76,7 +76,7 @@ class SessionController(rest.RestController):
|
|||
if session is None:
|
||||
response.status = 404
|
||||
return {"error": "Invalid session"}
|
||||
response.body = jsonutils.dumps(session)
|
||||
response.text = jsonutils.dumps(session)
|
||||
|
||||
# PUT /v1/maintenance/<session_id>
|
||||
@policy.authorize('maintenance:session', 'put')
|
||||
|
@ -84,7 +84,7 @@ class SessionController(rest.RestController):
|
|||
def put(self, session_id):
|
||||
data = json.loads(request.body.decode('utf8'))
|
||||
engine_data = self.engine_rpcapi.admin_update_session(session_id, data)
|
||||
response.body = jsonutils.dumps(engine_data)
|
||||
response.text = jsonutils.dumps(engine_data)
|
||||
|
||||
# DELETE /v1/maintenance/<session_id>
|
||||
@policy.authorize('maintenance:session', 'delete')
|
||||
|
@ -94,7 +94,7 @@ class SessionController(rest.RestController):
|
|||
LOG.error("Unexpected data")
|
||||
abort(400)
|
||||
engine_data = self.engine_rpcapi.admin_delete_session(session_id)
|
||||
response.body = jsonutils.dumps(engine_data)
|
||||
response.text = jsonutils.dumps(engine_data)
|
||||
|
||||
|
||||
class MaintenanceController(rest.RestController):
|
||||
|
@ -112,7 +112,7 @@ class MaintenanceController(rest.RestController):
|
|||
LOG.error("Unexpected data")
|
||||
abort(400)
|
||||
sessions = self.engine_rpcapi.admin_get()
|
||||
response.body = jsonutils.dumps(sessions)
|
||||
response.text = jsonutils.dumps(sessions)
|
||||
|
||||
# POST /v1/maintenance
|
||||
@policy.authorize('maintenance', 'post')
|
||||
|
@ -124,4 +124,4 @@ class MaintenanceController(rest.RestController):
|
|||
if session is None:
|
||||
response.status = 509
|
||||
return {"error": "Too many sessions"}
|
||||
response.body = jsonutils.dumps(session)
|
||||
response.text = jsonutils.dumps(session)
|
||||
|
|
|
@ -96,7 +96,7 @@ class BaseWorkflow(Thread):
|
|||
if isinstance(data, six.string_types):
|
||||
return str(data)
|
||||
elif isinstance(data, collections.Mapping):
|
||||
return dict(map(self.convert, data.iteritems()))
|
||||
return dict(map(self.convert, six.iteritems(data)))
|
||||
elif isinstance(data, collections.Iterable):
|
||||
return type(data)(map(self.convert, data))
|
||||
else:
|
||||
|
|
|
@ -231,12 +231,12 @@ class Workflow(BaseWorkflow):
|
|||
if len(project_ids):
|
||||
self.projects = self.init_projects(project_ids)
|
||||
else:
|
||||
LOG.info('%s: No projects on computes under maintenance %s' %
|
||||
LOG.info('%s: No projects on computes under maintenance' %
|
||||
self.session_id)
|
||||
if len(instances):
|
||||
self.instances = self.add_instances(instances)
|
||||
else:
|
||||
LOG.info('%s: No instances on computes under maintenance %s' %
|
||||
LOG.info('%s: No instances on computes under maintenance' %
|
||||
self.session_id)
|
||||
LOG.info(str(self))
|
||||
|
||||
|
@ -385,7 +385,8 @@ class Workflow(BaseWorkflow):
|
|||
prev_hostname = ''
|
||||
LOG.info('checking hypervisors for VCPU capacity')
|
||||
for hvisor in hvisors:
|
||||
hostname = hvisor.__getattr__('hypervisor_hostname')
|
||||
hostname = (
|
||||
hvisor.__getattr__('hypervisor_hostname').split(".", 1)[0])
|
||||
if hostname not in self.get_compute_hosts():
|
||||
continue
|
||||
vcpus = hvisor.__getattr__('vcpus')
|
||||
|
@ -407,7 +408,8 @@ class Workflow(BaseWorkflow):
|
|||
|
||||
def get_free_vcpus_by_host(self, host, hvisors):
|
||||
hvisor = ([h for h in hvisors if
|
||||
h.__getattr__('hypervisor_hostname') == host][0])
|
||||
h.__getattr__('hypervisor_hostname').split(".", 1)[0]
|
||||
== host][0])
|
||||
vcpus = hvisor.__getattr__('vcpus')
|
||||
vcpus_used = hvisor.__getattr__('vcpus_used')
|
||||
return vcpus - vcpus_used
|
||||
|
|
Loading…
Reference in New Issue