From aef148b0888d797fe3e76fe94b325ee692e64f6d Mon Sep 17 00:00:00 2001 From: "vladimir.p" Date: Fri, 26 Aug 2011 11:14:44 -0700 Subject: [PATCH] added debug prints for scheduler --- nova/scheduler/vsa.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/nova/scheduler/vsa.py b/nova/scheduler/vsa.py index ad5ebc2d..6962dd86 100644 --- a/nova/scheduler/vsa.py +++ b/nova/scheduler/vsa.py @@ -272,7 +272,7 @@ class VsaScheduler(simple.SimpleScheduler): self._consume_resource(qos_cap, vol['size'], -1) def schedule_create_volumes(self, context, request_spec, - availability_zone, *_args, **_kwargs): + availability_zone=None, *_args, **_kwargs): """Picks hosts for hosting multiple volumes.""" num_volumes = request_spec.get('num_volumes') @@ -285,6 +285,8 @@ class VsaScheduler(simple.SimpleScheduler): host = self._check_host_enforcement(context, availability_zone) try: + self._print_capabilities_info() + self._assign_hosts_to_volumes(context, volume_params, host) for vol in volume_params: @@ -324,6 +326,8 @@ class VsaScheduler(simple.SimpleScheduler): return super(VsaScheduler, self).schedule_create_volume(context, volume_id, *_args, **_kwargs) + self._print_capabilities_info() + drive_type = { 'name': volume_type['extra_specs'].get('drive_name'), 'type': volume_type['extra_specs'].get('drive_type'), @@ -398,6 +402,26 @@ class VsaScheduler(simple.SimpleScheduler): self._consume_partition(qos_values, GB_TO_BYTES(size), direction) return + def _print_capabilities_info(self): + host_list = self._get_service_states().iteritems() + for host, host_dict in host_list: + for service_name, service_dict in host_dict.iteritems(): + if service_name != "volume": + continue + + LOG.info(_("Host %s:"), host) + + gos_info = service_dict.get('drive_qos_info', {}) + for qosgrp, qos_values in gos_info.iteritems(): + total = qos_values['TotalDrives'] + used = qos_values['FullDrive']['NumOccupiedDrives'] + free = qos_values['FullDrive']['NumFreeDrives'] + avail = BYTES_TO_GB(qos_values['AvailableCapacity']) + + LOG.info(_("\tDrive %(qosgrp)-25s: total %(total)2s, "\ + "used %(used)2s, free %(free)2s. Available "\ + "capacity %(avail)-5s"), locals()) + class VsaSchedulerLeastUsedHost(VsaScheduler): """