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

Print error message when reverting VM snapshot failed #493

Merged
merged 2 commits into from
Aug 18, 2023

Conversation

keirazhang
Copy link
Contributor

We need to capture the error message while reverting VM snapshot failed, and print it into failed_tasks.log.


TASK [Display revert snapshot result] **************************************************************************************************************************************
task path: /home/qiz/workspace/github/ansible-vsphere-gos-validation/common/vm_revert_snapshot.yml:29
ok: [localhost] => {
    "revert_result": {
        "changed": false,
        "failed": true,
        "msg": "The operation cannot be allowed at the current time because the virtual machine has a question pending: \n 'msg.hbacommon.outofspace:There is no more space for virtual disk 'Ansible_winsrv_vbs_80ga-000003.vmdk'. You might be able to continue this session by freeing disk space on the relevant volume, and clicking Retry. Click Cancel to terminate this session.\n'."
    }
}

TASK [Initialize the fact whether there is snapshot not-exist error] *******************************************************************************************************
task path: /home/qiz/workspace/github/ansible-vsphere-gos-validation/common/vm_revert_snapshot.yml:33
ok: [localhost] => {
    "ansible_facts": {
        "snapshot_not_exists_error": false
    },
    "changed": false
}

TASK [Check there is error message about snasphot not existing] ************************************************************************************************************
task path: /home/qiz/workspace/github/ansible-vsphere-gos-validation/common/vm_revert_snapshot.yml:43
ok: [localhost] => {
    "ansible_facts": {
        "snapshot_not_exists_error": false
    },
    "changed": false
}

TASK [Failed to revert snapshot to BaseSnapshot] ***************************************************************************************************************************
task path: /home/qiz/workspace/github/ansible-vsphere-gos-validation/common/vm_revert_snapshot.yml:59
fatal: [localhost]: FAILED! => {
    "changed": false,
    "msg": "Failed to revert to snapshot 'BaseSnapshot' because of error: The operation cannot be allowed at the current time because the virtual machine has a question pending: \n 'msg.hbacommon.outofspace:There is no more space for virtual disk 'Ansible_winsrv_vbs_80ga-000003.vmdk'. You might be able to continue this session by freeing disk space on the relevant volume, and clicking Retry. Click Cancel to terminate this session.\n'."
}

@keirazhang keirazhang added this to the v3.0 milestone Aug 18, 2023
Signed-off-by: Qi Zhang <[email protected]>
@keirazhang
Copy link
Contributor Author

When VM doesn't have any snapshot, the revert_result is:

2023-08-18 10:58:46,018 | TASK [test_debug][Display revert snapshot result] **********
task path: /home/qiz/workspace/github/ansible-vsphere-gos-validation/common/vm_revert_snapshot.yml:29
ok: [localhost] => {
    "revert_result": {
        "changed": false,
        "failed": true,
        "msg": "virtual machine - qiz-test-ide does not have any snapshots to revert to."
    }   
}

When VM has snapshot(s) but doesn't have the snapshot to revert, the revert_result is:

2023-08-18 10:05:15,018 | TASK [test_debug][Display revert snapshot result] **********
task path: /home/qiz/workspace/github/ansible-vsphere-gos-validation/common/vm_revert_snapshot.yml:29
ok: [localhost] => {
    "revert_result": {
        "changed": false,
        "failed": false,
        "msg": "Couldn't find any snapshots with specified name: test_snapshot on VM: qiz-test-ide"
    }   
}

Copy link
Collaborator

@123lzxm 123lzxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@keirazhang keirazhang merged commit d2eb9e8 into vmware:main Aug 18, 2023
@keirazhang keirazhang deleted the fix_revert_snapshot branch August 22, 2023 05:23
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

Successfully merging this pull request may close these issues.

2 participants