Once I try to modify a hvparam of the LXC hypervisor, I got this error:
ValueError: max() arg is an empty sequence
This is because the current default value of cpu_mask hypervisor
parameter for the LXC hypervisor is the zero-length string, so the
cpu_list which returned by the ParseMultiCpuMask is the blank list.
The zero-length string is a valid for the cpu_mask hvparam, so we need
to skip this check if the cpu_list is the blank list.
Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]>
---
lib/cmdlib/instance.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
index 53702c8..870c3c4 100644
--- a/lib/cmdlib/instance.py
+++ b/lib/cmdlib/instance.py
@@ -3438,7 +3438,7 @@ class LUInstanceSetParams(LogicalUnit):
errors.ECODE_INVAL)
# Only perform this test if a new CPU mask is given
- if constants.HV_CPU_MASK in self.hv_new:
+ if constants.HV_CPU_MASK in self.hv_new and cpu_list:
# Calculate the largest CPU number requested
max_requested_cpu = max(map(max, cpu_list))
# Check that all of the instance's nodes have enough physical CPUs to
--
2.0.4