change LOG.warn() to LOG.warning()
because python 3 deprecated the logger.warn method,see: https://docs.python.org/3/library/logging.html#logging.warning optimized some text formatting Change-Id: Id9e5d29c6355ba69c906a320bd2ba8c5fbf90989 Closes-Bug: #1530742
This commit is contained in:
parent
3aae5eda0a
commit
b3c538fcc0
|
@ -46,11 +46,11 @@ class DiskConstraint(constraints.BaseLinearConstraint):
|
|||
instance_type.get('swap', 0))
|
||||
for inst_type_key in ['root_gb', 'ephemeral_gb', 'swap']:
|
||||
if inst_type_key not in instance_type:
|
||||
LOG.warn(_LW("Disk information of requested instances\' %s "
|
||||
LOG.warning(_LW("Disk information of requested instances\' %s "
|
||||
"is incomplete, use 0 as the requested size."),
|
||||
inst_type_key)
|
||||
if requested_disk <= 0:
|
||||
LOG.warn(_LW("DiskConstraint is skipped because requested "
|
||||
LOG.warning(_LW("DiskConstraint is skipped because requested "
|
||||
"instance disk size is 0 or invalid."))
|
||||
return constraint_matrix
|
||||
|
||||
|
|
|
@ -39,12 +39,12 @@ class ExactDiskConstraint(constraints.BaseLinearConstraint):
|
|||
instance_type.get('swap', 0))
|
||||
for inst_type_key in ['root_gb', 'ephemeral_gb', 'swap']:
|
||||
if inst_type_key not in instance_type:
|
||||
LOG.warn(_LW("Disk information of requested instances\' %s "
|
||||
"is incomplete, use 0 as the requested size."),
|
||||
inst_type_key)
|
||||
LOG.warning(_LW("Disk information of requested instances\' %s "
|
||||
"is incomplete, use 0 as the requested size."),
|
||||
inst_type_key)
|
||||
if requested_disk <= 0:
|
||||
LOG.warn(_LW("ExactDiskConstraint is skipped because requested "
|
||||
"instance disk size is 0 or invalid."))
|
||||
LOG.warning(_LW("ExactDiskConstraint is skipped because requested "
|
||||
"instance disk size is 0 or invalid."))
|
||||
return constraint_matrix
|
||||
|
||||
for i in xrange(num_hosts):
|
||||
|
|
|
@ -36,11 +36,11 @@ class ExactRamConstraint(constraints.BaseLinearConstraint):
|
|||
instance_type = filter_properties.get('instance_type') or {}
|
||||
requested_ram = instance_type.get('memory_mb', 0)
|
||||
if 'memory_mb' not in instance_type:
|
||||
LOG.warn(_LW("No information about requested instances\' RAM size "
|
||||
"was found, default value (0) is used."))
|
||||
LOG.warning(_LW("No information about requested instances\' "
|
||||
"RAM size was found, default value (0) is used."))
|
||||
if requested_ram <= 0:
|
||||
LOG.warn(_LW("ExactRamConstraint is skipped because requested "
|
||||
"instance RAM size is 0 or invalid."))
|
||||
LOG.warning(_LW("ExactRamConstraint is skipped because requested "
|
||||
"instance RAM size is 0 or invalid."))
|
||||
return constraint_matrix
|
||||
|
||||
for i in xrange(num_hosts):
|
||||
|
|
|
@ -38,14 +38,14 @@ class ExactVcpuConstraint(constraints.BaseLinearConstraint):
|
|||
else:
|
||||
instance_vcpus = instance_type['vcpus']
|
||||
if instance_vcpus <= 0:
|
||||
LOG.warn(_LW("ExactVcpuConstraint is skipped because requested "
|
||||
"instance vCPU number is 0 or invalid."))
|
||||
LOG.warning(_LW("ExactVcpuConstraint is skipped because "
|
||||
"requested instance vCPU number is 0 or invalid."))
|
||||
return constraint_matrix
|
||||
|
||||
for i in xrange(num_hosts):
|
||||
# get available vcpus
|
||||
if not hosts[i].vcpus_total:
|
||||
LOG.warn(_LW("vCPUs of %(host)s not set; assuming CPU "
|
||||
LOG.warning(_LW("vCPUs of %(host)s not set; assuming CPU "
|
||||
"collection broken."), {'host': hosts[i]})
|
||||
constraint_matrix[i] = [False for j in xrange(num_instances)]
|
||||
continue
|
||||
|
|
|
@ -57,8 +57,8 @@ class PciPassthroughConstraint(constraints.BaseLinearConstraint):
|
|||
|
||||
pci_requests = filter_properties.get('pci_requests')
|
||||
if not pci_requests:
|
||||
LOG.warn(_LW("PciPassthroughConstraint check is skipped because "
|
||||
"requested instance PCI requests is unavailable."))
|
||||
LOG.warning(_LW("PciPassthroughConstraint check is skipped "
|
||||
"because requested instance PCI requests is unavailable."))
|
||||
return constraint_matrix
|
||||
|
||||
for i in xrange(num_hosts):
|
||||
|
|
|
@ -43,10 +43,10 @@ class RamConstraint(constraints.BaseLinearConstraint):
|
|||
instance_type = filter_properties.get('instance_type') or {}
|
||||
requested_ram = instance_type.get('memory_mb', 0)
|
||||
if 'memory_mb' not in instance_type:
|
||||
LOG.warn(_LW("No information about requested instances\' RAM size "
|
||||
"was found, default value (0) is used."))
|
||||
LOG.warning(_LW("No information about requested instances\' "
|
||||
"RAM size was found, default value (0) is used."))
|
||||
if requested_ram <= 0:
|
||||
LOG.warn(_LW("RamConstraint is skipped because requested "
|
||||
LOG.warning(_LW("RamConstraint is skipped because requested "
|
||||
"instance RAM size is 0 or invalid."))
|
||||
return constraint_matrix
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class VcpuConstraint(constraints.BaseLinearConstraint):
|
|||
else:
|
||||
instance_vcpus = instance_type['vcpus']
|
||||
if instance_vcpus <= 0:
|
||||
LOG.warn(_LW("VcpuConstraint is skipped because requested "
|
||||
LOG.warning(_LW("VcpuConstraint is skipped because requested "
|
||||
"instance vCPU number is 0 or invalid."))
|
||||
return constraint_matrix
|
||||
|
||||
|
@ -54,7 +54,7 @@ class VcpuConstraint(constraints.BaseLinearConstraint):
|
|||
hosts[i], filter_properties)
|
||||
# get available vcpus
|
||||
if not hosts[i].vcpus_total:
|
||||
LOG.warn(_LW("vCPUs of %(host)s not set; assuming CPU "
|
||||
LOG.warning(_LW("vCPUs of %(host)s not set; assuming CPU "
|
||||
"collection broken."), {'host': hosts[i]})
|
||||
continue
|
||||
else:
|
||||
|
|
|
@ -53,8 +53,8 @@ class RamCost(solver_costs.BaseLinearCost):
|
|||
instance_type = filter_properties.get('instance_type') or {}
|
||||
requested_ram = instance_type.get('memory_mb', 0)
|
||||
if 'memory_mb' not in instance_type:
|
||||
LOG.warn(_LW("No information about requested instances\' RAM size "
|
||||
"was found, default value (0) is used."))
|
||||
LOG.warning(_LW("No information about requested instances\' "
|
||||
"RAM size was found, default value (0) is used."))
|
||||
|
||||
extended_cost_matrix = [[0 for j in xrange(num_instances + 1)]
|
||||
for i in xrange(num_hosts)]
|
||||
|
|
|
@ -53,15 +53,15 @@ class VcpuCost(solver_costs.BaseLinearCost):
|
|||
instance_type = filter_properties.get('instance_type') or {}
|
||||
requested_vcpus = instance_type.get('vcpus', 0)
|
||||
if requested_vcpus <= 0:
|
||||
LOG.warn(_LW("Requested instances\' vCPU number is 0 or invalid, "
|
||||
"default value (0) is used."))
|
||||
LOG.warning(_LW("Requested instances\' vCPU number is 0 or "
|
||||
"invalid,default value (0) is used."))
|
||||
|
||||
remaining_vcpus_list = []
|
||||
for i in xrange(num_hosts):
|
||||
vcpus_total = hosts[i].vcpus_total
|
||||
vcpus_used = hosts[i].vcpus_used
|
||||
if not vcpus_total:
|
||||
LOG.warn(_LW("vCPUs of %(host)s not set; assuming CPU "
|
||||
LOG.warning(_LW("vCPUs of %(host)s not set; assuming CPU "
|
||||
"collection broken."), {'host': hosts[i]})
|
||||
vcpus_total = 0
|
||||
remaining_vcpus = vcpus_total - vcpus_used
|
||||
|
|
|
@ -213,7 +213,7 @@ class PulpSolver(scheduler_solver.BaseHostSolver):
|
|||
host_instance_combinations.append(
|
||||
(host_key_map[host_key], instances_iter.next()))
|
||||
else:
|
||||
LOG.warn(_LW("Pulp solver didnot find optimal solution! "
|
||||
LOG.warning(_LW("Pulp solver didnot find optimal solution! "
|
||||
"reason: %s"), pulp.LpStatus[prob.status])
|
||||
host_instance_combinations = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue