Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 826726 Details for
Bug 1020909
Restoring VM from snapshot stuck in "Image Locked" state
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
python reset-vm-to-snapshot pviktori-z-ci-host1 remote-host
reset-vm-to-snapshot.py (text/plain), 2.03 KB, created by
Petr Spacek
on 2013-11-20 15:57:18 UTC
(
hide
)
Description:
python reset-vm-to-snapshot pviktori-z-ci-host1 remote-host
Filename:
MIME Type:
Creator:
Petr Spacek
Created:
2013-11-20 15:57:18 UTC
Size:
2.03 KB
patch
obsolete
>#! /usr/bin/python2 > >import argparse >import sys >from ovirtsdk.api import API >from time import sleep > >from locals import URL, USERNAME, PASSWORD, CA_FILE > > >def restore(api, vm_name, snapshot_description): > def vm(): > return api.vms.get(vm_name) > > snapshots = [s for s in vm().snapshots.list() > if s.get_description() == snapshot_description] > if not snapshots: > raise RuntimeError('Given snapshot does not exist') > elif len(snapshots) > 2: > raise RuntimeError('Multiple snapshots with this description') > else: > [snapshot] = snapshots > > if vm().status.state != 'down': > print 'Stopping the VM:' > vm().shutdown() > > for i in range(15): > if vm().status.state == 'down': > break > print 'Status:', vm().status.state > sys.stdout.flush() > sleep(1) > > if vm().status.state != 'down': > print 'Hard-stopping the VM:' > vm().stop() > > print 'Waiting for VM to reach Down status' > while vm().status.state != 'down': > print 'Status:', vm().status.state > sys.stdout.flush() > sleep(1) > > print 'Restoring snapshot', snapshot_description > snapshot.restore() > > print 'Starting VM' > vm().start() > > print 'Waiting for VM to reach Up status' > while vm().status.state != 'up': > print 'Status:', vm().status.state > sys.stdout.flush() > sleep(1) > > >def main(argv): > parser = argparse.ArgumentParser( > description='Reset a RHEVM machine to the given snapshot.') > parser.add_argument('vm_name', type=str, > help='Name of the VM to reset') > parser.add_argument('snapshot_description', type=str, > help='Description of the snapshot to reset to') > > args = parser.parse_args(argv) > > api = API(url=URL, username=USERNAME, password=PASSWORD, ca_file=CA_FILE) > > restore(api, args.vm_name, args.snapshot_description) > >if __name__ == '__main__': > main(sys.argv[1:]) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1020909
: 826726