qvm-template: Make sure that template-dummy is set and used properly.

This commit is contained in:
WillyPillow 2020-08-25 01:43:11 +08:00
parent 55a3982bf6
commit e9e198cc10
No known key found for this signature in database
GPG Key ID: 3839E194B1415A9C

View File

@ -1231,11 +1231,13 @@ def remove(
orig_dummy = dummy
cnt = 1
while dummy in app.domains \
and not app.domains[dummy].features.get('template-dummy', 0):
and app.domains[dummy].features.get(
'template-dummy', '0') == '0':
dummy = '%s-%d' % (orig_dummy, cnt)
cnt += 1
if dummy not in app.domains:
dummy_vm = app.add_new_vm('TemplateVM', dummy, 'red')
dummy_vm.features['template-dummy'] = 1
else:
dummy_vm = app.domains[dummy]