diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2020-02-13 14:11:17 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-13 15:11:17 -0500 |
commit | ecffd25df840277ab1fa7d5372659abe833cacbe (patch) | |
tree | 42565263c109485e8e83db70e72696776b792af9 /tests/cloud_tests/platforms/azurecloud/instance.py | |
parent | 81c7477a55b509a33af38bc502b1e9dd4ea643ff (diff) | |
download | vyos-cloud-init-ecffd25df840277ab1fa7d5372659abe833cacbe.tar.gz vyos-cloud-init-ecffd25df840277ab1fa7d5372659abe833cacbe.zip |
azurecloud: fix issues with instances not starting (#205)
The azurecloud platform did not always start instances
during collect runs. This was a result of two issues. First
the image class _instance method did not invoke the start()
method which then allowed collect stage to attempt to run
scripts without an endpoint. Second, azurecloud used the
image_id as both an instance handle (which is typically
vmName in azure api) as well as an image handle (for image
capture). Resolve this by adding a .vm_name property to
the AzureCloudInstance and reference this property in
AzureCloudImage.
Also in this branch
- Fix error encoding user-data when value is None
- Add additional logging in AzureCloud platform
- Update logging format to print pathname,funcName and line number
This greatly eases debugging.
LP: #1861921
Diffstat (limited to 'tests/cloud_tests/platforms/azurecloud/instance.py')
-rw-r--r-- | tests/cloud_tests/platforms/azurecloud/instance.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/cloud_tests/platforms/azurecloud/instance.py b/tests/cloud_tests/platforms/azurecloud/instance.py index 3d77a1a7..f1e28a96 100644 --- a/tests/cloud_tests/platforms/azurecloud/instance.py +++ b/tests/cloud_tests/platforms/azurecloud/instance.py @@ -41,6 +41,7 @@ class AzureCloudInstance(Instance): self.ssh_ip = None self.instance = None self.image_id = image_id + self.vm_name = 'ci-azure-i-%s' % self.platform.tag self.user_data = user_data self.ssh_key_file = os.path.join( platform.config['data_dir'], platform.config['private_key']) @@ -74,16 +75,18 @@ class AzureCloudInstance(Instance): self.image_id ) image_exists = True - LOG.debug('image found, launching instance') + LOG.debug('image found, launching instance, image_id=%s', + self.image_id) except CloudError: - LOG.debug( - 'image not found, launching instance with base image') + LOG.debug(('image not found, launching instance with base image, ' + 'image_id=%s'), self.image_id) pass vm_params = { + 'name': self.vm_name, 'location': self.platform.location, 'os_profile': { - 'computer_name': 'CI', + 'computer_name': 'CI-%s' % self.platform.tag, 'admin_username': self.ssh_username, "customData": self.user_data, "linuxConfiguration": { @@ -129,7 +132,9 @@ class AzureCloudInstance(Instance): try: self.instance = self.platform.compute_client.virtual_machines.\ create_or_update(self.platform.resource_group.name, - self.image_id, vm_params) + self.vm_name, vm_params) + LOG.debug('creating instance %s from image_id=%s', self.vm_name, + self.image_id) except CloudError: raise RuntimeError('failed creating instance:\n{}'.format( traceback.format_exc())) |