Skip to content

Commit 1bb6130

Browse files
committed
Merge remote-tracking branch 'apache/4.18' into main
2 parents fcbf540 + e199678 commit 1bb6130

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

test/integration/smoke/test_templates.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,8 @@ def test_09_list_templates_download_details(self):
989989
)
990990

991991
for template in list_template_response:
992+
if template.directdownload == True:
993+
continue
992994
self.assertNotEqual(
993995
len(template.downloaddetails),
994996
0,
@@ -1248,11 +1250,7 @@ def setUpClass(cls):
12481250

12491251
@classmethod
12501252
def tearDownClass(cls):
1251-
try:
1252-
cleanup_resources(cls.apiclient, cls._cleanup)
1253-
except Exception as e:
1254-
raise Exception("Warning: Exception during cleanup : %s" % e)
1255-
return
1253+
super(TestCreateTemplateWithDirectDownload, cls).tearDownClass()
12561254

12571255
def setUp(self):
12581256
self.apiclient = self.testClient.getApiClient()
@@ -1264,13 +1262,7 @@ def setUp(self):
12641262
return
12651263

12661264
def tearDown(self):
1267-
try:
1268-
#Clean up, terminate the created templates
1269-
cleanup_resources(self.apiclient, self.cleanup)
1270-
1271-
except Exception as e:
1272-
raise Exception("Warning: Exception during cleanup : %s" % e)
1273-
return
1265+
super(TestCreateTemplateWithDirectDownload, self).tearDown()
12741266

12751267
@attr(tags=["advanced", "smoke"], required_hardware="true")
12761268
def test_01_register_template_direct_download_flag(self):
@@ -1323,10 +1315,11 @@ def test_03_deploy_vm_wrong_checksum(self):
13231315
"""
13241316
Deploy a VM from a Direct Download registered template with wrong checksum
13251317
"""
1326-
self.template["checksum"]="{MD5}XXXXXXX"
1318+
self.template["checksum"]="{MD5}" + ("X" * 32)
13271319
tmpl = Template.register(self.apiclient, self.template, zoneid=self.zone.id, hypervisor=self.hypervisor, randomize_name=False)
13281320
self.cleanup.append(tmpl)
13291321

1322+
failed = False
13301323
try:
13311324
virtual_machine = VirtualMachine.create(
13321325
self.apiclient,
@@ -1337,8 +1330,19 @@ def test_03_deploy_vm_wrong_checksum(self):
13371330
serviceofferingid=self.service_offering.id
13381331
)
13391332
self.cleanup.append(virtual_machine)
1340-
self.fail("Expected to fail deployment")
1333+
failed = True
13411334
except Exception as e:
13421335
self.debug("Expected exception")
1336+
list_virtual_machine_response = VirtualMachine.list(
1337+
self.apiclient,
1338+
templateid=tmpl.id,
1339+
listall=True
1340+
)
1341+
if type(list_virtual_machine_response) == list and len(list_virtual_machine_response) > 0:
1342+
for virtual_machine_response in list_virtual_machine_response:
1343+
VirtualMachine.delete(virtual_machine_response, self.apiclient, expunge=True)
1344+
1345+
if failed == True:
1346+
self.fail("Expected to fail VM deployment with wrong checksum template")
13431347

13441348
return

tools/marvin/marvin/lib/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,8 @@ def register(cls, apiclient, services, zoneid=None,
15221522

15231523
if "directdownload" in services:
15241524
cmd.directdownload = services["directdownload"]
1525+
if "checksum" in services:
1526+
cmd.checksum = services["checksum"]
15251527

15261528
# Register Template
15271529
template = apiclient.registerTemplate(cmd)

ui/src/components/view/ListView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
</template>
177177
<template v-if="column.key === 'physicalsize'">
178178
<span v-if="text">
179-
{{ parseFloat(parseFloat(text) / 1024.0 / 1024.0 / 1024.0).toFixed(2) }} GiB
179+
{{ isNaN(text) ? text : (parseFloat(parseFloat(text) / 1024.0 / 1024.0 / 1024.0).toFixed(2) + ' GiB') }}
180180
</span>
181181
</template>
182182
<template v-if="column.key === 'physicalnetworkname'">

ui/src/config/section/storage.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ export default {
4242
const metricsFields = ['diskkbsread', 'diskkbswrite', 'diskiopstotal']
4343

4444
if (store.getters.userInfo.roletype === 'Admin') {
45-
metricsFields.push({
46-
physicalsize: (record) => {
47-
return record.physicalsize ? parseFloat(record.physicalsize / (1024.0 * 1024.0 * 1024.0)).toFixed(2) + 'GB' : ''
48-
}
49-
})
45+
metricsFields.push('physicalsize')
5046
}
5147
metricsFields.push('utilization')
5248

ui/src/views/image/TemplateZones.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
</a-form-item>
201201
<div :span="24" class="action-button">
202202
<a-button @click="onCloseModal">{{ $t('label.cancel') }}</a-button>
203-
<a-button type="primary" ref="submit" @click="deleteTemplate">{{ $t('label.ok') }}</a-button>
203+
<a-button type="primary" ref="submit" @click="selectedItems.length > 0 ? deleteTemplates() : deleteTemplate(currentRecord)">{{ $t('label.ok') }}</a-button>
204204
</div>
205205
</a-spin>
206206
</div>

0 commit comments

Comments
 (0)