Fix qvm-remove undefines domain in libvirt
- Return error if domain is not halted - Undefine the domain in libvirt, to avoid: "Domain already exists with uuid…"
This commit is contained in:
parent
1ff1ca37a1
commit
63a1edc274
@ -40,8 +40,12 @@ parser.add_argument('--just-db',
|
||||
def main(args=None): # pylint: disable=missing-docstring
|
||||
args = parser.parse_args(args)
|
||||
for vm in args.domains:
|
||||
if not vm.is_halted():
|
||||
parser.print_error('VM {!s} not halted'.format(vm))
|
||||
return 1
|
||||
del args.app.domains[vm.qid]
|
||||
args.app.save()
|
||||
vm.libvirt_domain.undefine()
|
||||
if not args.just_db:
|
||||
vm.remove_from_disk()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user