Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

删除虚拟机失败的解决办法 #37

Open
benma9 opened this issue May 31, 2019 · 0 comments
Open

删除虚拟机失败的解决办法 #37

benma9 opened this issue May 31, 2019 · 0 comments

Comments

@benma9
Copy link

benma9 commented May 31, 2019

删除虚拟机的逻辑:

  • 判断是否开机,
  • 如果开始执行destroy操作,
  • 然后删除硬盘,数据删记录,
  • 最后undefine instance

由于数据库数据都是空的,(不知道 @welliamcao ,在刷新宿主机后,怎么没有把 虚拟机更新到服务器上。是celery出问题吗?) 执行到这一步,系统抛出异常。

修复:VManagePlatform/views/vInstance.py 文件。

362: elif op == 'delete':
INSTANCE.delDisk(instance) # 删除硬盘

这里的逻辑到数据库上找VmServerInstance表到数据,然后删除这个表的数据。由于这个表是空的,模型操作报异常。 DoesNotExist,

            try:
                VmServerInstance.objects.get(token=INSTANCE.getInsUUID(instance)).delete()
            except:
                pass

就可以成功删除虚拟机了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant