Merge "Retry on vmware create_vm when it fails"
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import fixtures
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
@@ -1041,7 +1042,8 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
|
|||||||
vm_util.ExtraSpecs(),
|
vm_util.ExtraSpecs(),
|
||||||
os_type='invalid_os_type')
|
os_type='invalid_os_type')
|
||||||
|
|
||||||
self.assertRaises(vexc.VMwareDriverException,
|
# Because of retries timeout will be raised
|
||||||
|
self.assertRaises(fixtures.TimeoutException,
|
||||||
vm_util.create_vm, session, self._instance,
|
vm_util.create_vm, session, self._instance,
|
||||||
'folder', config_spec, 'res-pool')
|
'folder', config_spec, 'res-pool')
|
||||||
self.assertTrue(found[0])
|
self.assertTrue(found[0])
|
||||||
|
@@ -23,6 +23,7 @@ import copy
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_service import loopingcall
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
from oslo_vmware import exceptions as vexc
|
from oslo_vmware import exceptions as vexc
|
||||||
@@ -1325,6 +1326,9 @@ def get_vmdk_adapter_type(adapter_type):
|
|||||||
return vmdk_adapter_type
|
return vmdk_adapter_type
|
||||||
|
|
||||||
|
|
||||||
|
@loopingcall.RetryDecorator(
|
||||||
|
max_retry_count=20, inc_sleep_time=2, max_sleep_time=20,
|
||||||
|
exceptions=(vexc.VimFaultException,))
|
||||||
def create_vm(session, instance, vm_folder, config_spec, res_pool_ref):
|
def create_vm(session, instance, vm_folder, config_spec, res_pool_ref):
|
||||||
"""Create VM on ESX host."""
|
"""Create VM on ESX host."""
|
||||||
LOG.debug("Creating VM on the ESX host", instance=instance)
|
LOG.debug("Creating VM on the ESX host", instance=instance)
|
||||||
|
Reference in New Issue
Block a user