virtualbox.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:AerisCloud 作者: AerisCloud 项目源码 文件源码
def vm_start(name, headless=True):
    """
    Start or resume a VM in headmode by default
    :param name: str
    :param headless: bool
    :return: None
    """
    try:
        VBoxManage('startvm', name, '--type', headless and 'headless' or 'gui')
    except ErrorReturnCode_1 as e:
        # if the VM was not found
        if 'VBOX_E_OBJECT_NOT_FOUND' in e.stderr:
            raise VMNotFound(name)
        if 'VBOX_E_INVALID_OBJECT_STATE' in e.stderr:
            raise InvalidState(e.stderr.split('\n')[0][17:])
        # something else happened, just let it go
        raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号