From 177ad3f61268c58bbbd211d6255381fc8b85c58d Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Thu, 26 Jul 2012 18:46:30 +0000 Subject: Fix resizing VDIs on XenServer >= 6 The check used 'is' when it should have been '=='. Also, a couple of small cleanups to make the code easier to read. Change-Id: If98892703bc557732093230b023085c4744b8455 --- nova/virt/xenapi/vmops.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 5dcc53b94..91e41c261 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -799,17 +799,18 @@ class VMOps(object): def check_resize_func_name(self): """Check the function name used to resize an instance based - on product_brand and product_version.""" - if ((self._session.product_brand == 'XCP' and - (self._session.product_version[0] == 1 and - self._session.product_version[1] > 1)) or - (self._session.product_brand == 'XCP' and - self._session.product_version[0] > 1) or - (self._session.product_brand is 'XenServer' and - self._session.product_version[0] > 5)): + on product_brand and product_version.""" + if (self._session.product_brand == 'XCP' and + ((self._session.product_version[0] == 1 and + self._session.product_version[1] > 1) or + self._session.product_version[0] > 1)): return 'VDI.resize' - else: - return 'VDI.resize_online' + + if (self._session.product_brand == 'XenServer' and + self._session.product_version[0] > 5): + return 'VDI.resize' + + return 'VDI.resize_online' def reboot(self, instance, reboot_type): """Reboot VM instance.""" -- cgit