Merge remote-tracking branch 'apache/4.18' into main

This commit is contained in:
Abhishek Kumar 2023-10-20 11:00:22 +05:30
commit 1bb6130795
5 changed files with 23 additions and 21 deletions

View File

@ -989,6 +989,8 @@ class TestTemplates(cloudstackTestCase):
) )
for template in list_template_response: for template in list_template_response:
if template.directdownload == True:
continue
self.assertNotEqual( self.assertNotEqual(
len(template.downloaddetails), len(template.downloaddetails),
0, 0,
@ -1248,11 +1250,7 @@ class TestCreateTemplateWithDirectDownload(cloudstackTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
try: super(TestCreateTemplateWithDirectDownload, cls).tearDownClass()
cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
@ -1264,13 +1262,7 @@ class TestCreateTemplateWithDirectDownload(cloudstackTestCase):
return return
def tearDown(self): def tearDown(self):
try: super(TestCreateTemplateWithDirectDownload, self).tearDown()
#Clean up, terminate the created templates
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@attr(tags=["advanced", "smoke"], required_hardware="true") @attr(tags=["advanced", "smoke"], required_hardware="true")
def test_01_register_template_direct_download_flag(self): def test_01_register_template_direct_download_flag(self):
@ -1323,10 +1315,11 @@ class TestCreateTemplateWithDirectDownload(cloudstackTestCase):
""" """
Deploy a VM from a Direct Download registered template with wrong checksum Deploy a VM from a Direct Download registered template with wrong checksum
""" """
self.template["checksum"]="{MD5}XXXXXXX" self.template["checksum"]="{MD5}" + ("X" * 32)
tmpl = Template.register(self.apiclient, self.template, zoneid=self.zone.id, hypervisor=self.hypervisor, randomize_name=False) tmpl = Template.register(self.apiclient, self.template, zoneid=self.zone.id, hypervisor=self.hypervisor, randomize_name=False)
self.cleanup.append(tmpl) self.cleanup.append(tmpl)
failed = False
try: try:
virtual_machine = VirtualMachine.create( virtual_machine = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -1337,8 +1330,19 @@ class TestCreateTemplateWithDirectDownload(cloudstackTestCase):
serviceofferingid=self.service_offering.id serviceofferingid=self.service_offering.id
) )
self.cleanup.append(virtual_machine) self.cleanup.append(virtual_machine)
self.fail("Expected to fail deployment") failed = True
except Exception as e: except Exception as e:
self.debug("Expected exception") self.debug("Expected exception")
list_virtual_machine_response = VirtualMachine.list(
self.apiclient,
templateid=tmpl.id,
listall=True
)
if type(list_virtual_machine_response) == list and len(list_virtual_machine_response) > 0:
for virtual_machine_response in list_virtual_machine_response:
VirtualMachine.delete(virtual_machine_response, self.apiclient, expunge=True)
if failed == True:
self.fail("Expected to fail VM deployment with wrong checksum template")
return return

View File

@ -1522,6 +1522,8 @@ class Template:
if "directdownload" in services: if "directdownload" in services:
cmd.directdownload = services["directdownload"] cmd.directdownload = services["directdownload"]
if "checksum" in services:
cmd.checksum = services["checksum"]
# Register Template # Register Template
template = apiclient.registerTemplate(cmd) template = apiclient.registerTemplate(cmd)

View File

@ -176,7 +176,7 @@
</template> </template>
<template v-if="column.key === 'physicalsize'"> <template v-if="column.key === 'physicalsize'">
<span v-if="text"> <span v-if="text">
{{ parseFloat(parseFloat(text) / 1024.0 / 1024.0 / 1024.0).toFixed(2) }} GiB {{ isNaN(text) ? text : (parseFloat(parseFloat(text) / 1024.0 / 1024.0 / 1024.0).toFixed(2) + ' GiB') }}
</span> </span>
</template> </template>
<template v-if="column.key === 'physicalnetworkname'"> <template v-if="column.key === 'physicalnetworkname'">

View File

@ -42,11 +42,7 @@ export default {
const metricsFields = ['diskkbsread', 'diskkbswrite', 'diskiopstotal'] const metricsFields = ['diskkbsread', 'diskkbswrite', 'diskiopstotal']
if (store.getters.userInfo.roletype === 'Admin') { if (store.getters.userInfo.roletype === 'Admin') {
metricsFields.push({ metricsFields.push('physicalsize')
physicalsize: (record) => {
return record.physicalsize ? parseFloat(record.physicalsize / (1024.0 * 1024.0 * 1024.0)).toFixed(2) + 'GB' : ''
}
})
} }
metricsFields.push('utilization') metricsFields.push('utilization')

View File

@ -200,7 +200,7 @@
</a-form-item> </a-form-item>
<div :span="24" class="action-button"> <div :span="24" class="action-button">
<a-button @click="onCloseModal">{{ $t('label.cancel') }}</a-button> <a-button @click="onCloseModal">{{ $t('label.cancel') }}</a-button>
<a-button type="primary" ref="submit" @click="deleteTemplate">{{ $t('label.ok') }}</a-button> <a-button type="primary" ref="submit" @click="selectedItems.length > 0 ? deleteTemplates() : deleteTemplate(currentRecord)">{{ $t('label.ok') }}</a-button>
</div> </div>
</a-spin> </a-spin>
</div> </div>