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 1477872 Details for
Bug 1620087
ovirt api vm snapshot cloning error
[?]
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 script using API
clone_vm_snap.py (text/x-python), 2.08 KB, created by
Peter Hudec
on 2018-08-22 12:35:17 UTC
(
hide
)
Description:
python script using API
Filename:
MIME Type:
Creator:
Peter Hudec
Created:
2018-08-22 12:35:17 UTC
Size:
2.08 KB
patch
obsolete
>#!/usr/bin/env python > >import logging >import time >import ovirtsdk4 as sdk >import ovirtsdk4.types as types > >logging.basicConfig(level=logging.DEBUG, filename='example.log') > ># This example will connect to the server and add a snapshot to an ># existing virtual machine: > ># Create the connection to the server: >connection = sdk.Connection( > url='XXXXX', > username='XXXX', > password='XXXX', > debug=True, > insecure=True, > log=logging.getLogger(), >) > ># Locate the virtual machines service and use it to find the virtual ># machine: >vms_service = connection.system_service().vms_service() >vm = vms_service.list(search='name=ditlcm09')[0] > ># Locate the service that manages the snapshots of the virtual machine: >snapshots_service = vms_service.vm_service(vm.id).snapshots_service() > ># Add the new snapshot: >snap = snapshots_service.add( > types.Snapshot( > description='My snapshot Test', > ), >) >snap_service = snapshots_service.snapshot_service(snap.id) > >print("VM %s" % snap.snapshot_status) >while snap.snapshot_status != types.SnapshotStatus.OK: > time.sleep(2) > snap = snap_service.get() > print("VM %s" % snap.snapshot_status) > ># checking disk states >snap_disks_service = snap_service.disks_service() >snap_disks = snap_disks_service.list() >for snap_disk in snap_disks: > print("Disk %s %s" % (snap_disk.name, snap_disk.status)) > ># Create a new virtual machine, cloning it from the snapshot: >cloned_vm = vms_service.add( > vm=types.Vm( > name='myclonedvm', > snapshots=[ > types.Snapshot( > id=snap.id > ) > ], > cluster=types.Cluster( > name='internal' > ) > ) >) > ># Find the service that manages the cloned virtual machine: >cloned_vm_service = vms_service.vm_service(cloned_vm.id) > ># Wait till the virtual machine is down, as that means that the creation ># of the disks of the virtual machine has been completed: >while True: > time.sleep(5) > cloned_vm = cloned_vm_service.get() > print "%s" % cloned_vm.status > if cloned_vm.status == types.VmStatus.DOWN: > break > ># Close the connection to the server: >connection.close() >
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 1620087
: 1477872