| 1 | def listAllSnapshots(self, flags: Optional[int] = 0) -> list['virDomainSnapshot']: |
| 2 | """List all snapshots and returns a list of snapshot objects""" |
| 3 | ret = libvirtmod.virDomainListAllSnapshots(self._o, flags) |
| 4 | if ret is None: |
| 5 | raise libvirtError("virDomainListAllSnapshots() failed") |
| 6 | |
| 7 | return [virDomainSnapshot(self, _obj=snapptr) for snapptr in ret] |
| 8 | |
| 9 | def listAllCheckpoints(self, flags: Optional[int] = 0) -> list['virDomainCheckpoint']: |
| 10 | """List all checkpoints and returns a list of checkpoint objects""" |
| 11 | ret = libvirtmod.virDomainListAllCheckpoints(self._o, flags) |
| 12 | if ret is None: |
| 13 | raise libvirtError("virDomainListAllCheckpoints() failed") |
| 14 | |
| 15 | return [virDomainCheckpoint(self, _obj=chkptr) for chkptr in ret] |
| 16 | |
| 17 | def createWithFiles(self, files: list[int], flags: Optional[int] = 0) -> 'virDomain': |
| 18 | """Launch a defined domain. If the call succeeds the domain moves from the |
| 19 | defined to the running domains pools. |
| 20 | |
| 21 | @files provides an array of file descriptors which will be |
| 22 | made available to the 'init' process of the guest. The file |
| 23 | handles exposed to the guest will be renumbered to start |
| 24 | from 3 (ie immediately following stderr). This is only |
| 25 | supported for guests which use container based virtualization |
| 26 | technology. |
| 27 | |
| 28 | If the VIR_DOMAIN_START_PAUSED flag is set, or if the guest domain |
| 29 | has a managed save image that requested paused state (see |
| 30 | virDomainManagedSave()) the guest domain will be started, but its |
| 31 | CPUs will remain paused. The CPUs can later be manually started |
| 32 | using virDomainResume(). In all other cases, the guest domain will |
| 33 | be running. |
| 34 | |
| 35 | If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest |
| 36 | domain will be automatically destroyed when the virConnectPtr |
| 37 | object is finally released. This will also happen if the |
| 38 | client application crashes / loses its connection to the |
| 39 | libvirtd daemon. Any domains marked for auto destroy will |
| 40 | block attempts at migration, save-to-file, or snapshots. |
| 41 | |
| 42 | If the VIR_DOMAIN_START_BYPASS_CACHE flag is set, and there is a |
| 43 | managed save file for this domain (created by virDomainManagedSave()), |
| 44 | then libvirt will attempt to bypass the file system cache while restoring |
| 45 | the file, or fail if it cannot do so for the given system; this can allow |
| 46 | less pressure on file system cache, but also risks slowing loads from NFS. |
| 47 | |
| 48 | If the VIR_DOMAIN_START_FORCE_BOOT flag is set, then any managed save |
| 49 | file for this domain is discarded, and the domain boots from scratch. """ |
| 50 | ret = libvirtmod.virDomainCreateWithFiles(self._o, files, flags) |
| 51 | if ret == -1: |
| 52 | raise libvirtError('virDomainCreateWithFiles() failed') |
| 53 | return ret |
| 54 | |
| 55 | def fsFreeze(self, mountpoints: Optional[list[str]] = None, flags: Optional[int] = 0) -> int: |
| 56 | """Freeze specified filesystems within the guest """ |
| 57 | ret = libvirtmod.virDomainFSFreeze(self._o, mountpoints, flags) |
| 58 | if ret == -1: |
| 59 | raise libvirtError('virDomainFSFreeze() failed') |
| 60 | return ret |
| 61 | |
| 62 | def fsThaw(self, mountpoints: Optional[list[str]] = None, flags: Optional[int] = 0) -> int: |
| 63 | """Thaw specified filesystems within the guest """ |
| 64 | ret = libvirtmod.virDomainFSThaw(self._o, mountpoints, flags) |
| 65 | if ret == -1: |
| 66 | raise libvirtError('virDomainFSThaw() failed') |
| 67 | return ret |
| 68 | |
| 69 | def getTime(self, flags: Optional[int] = 0) -> int: |
| 70 | """Extract information about guest time """ |
| 71 | ret = libvirtmod.virDomainGetTime(self._o, flags) |
| 72 | if ret is None: |
| 73 | raise libvirtError('virDomainGetTime() failed') |
| 74 | return ret |
| 75 | |
| 76 | def setTime(self, time: Optional[int] = None, flags: Optional[int] = 0) -> int: |
| 77 | """Set guest time to the given value. @time is a dict containing |
| 78 | 'seconds' field for seconds and 'nseconds' field for nanoseconds """ |
| 79 | ret = libvirtmod.virDomainSetTime(self._o, time, flags) |
| 80 | if ret == -1: |
| 81 | raise libvirtError('virDomainSetTime() failed') |
| 82 | return ret |
| 83 | |
| 84 | def FDAssociate(self, name: str, files: list[int], flags: Optional[int] = 0) -> int: |
| 85 | """Associate the array of FDs passed as @fds with the domain object |
| 86 | under @name. The FDs are associated as long as the connection used to |
| 87 | associated exists and are disposed of afterwards. FD may still be kept |
| 88 | open by the hypervisor for as long as it's needed. |
| 89 | |
| 90 | Security labelling (e.g. via the selinux) may be applied on the passed |
| 91 | FDs when requiredg for usage by the VM. By default libvirt does not |
| 92 | restore the seclabels on the FDs afterwards to avoid keeping it open |
| 93 | unnecessarily. |
| 94 | |
| 95 | Restoring of the security label can be requested by passing either |
| 96 | VIR_DOMAIN_FD_ASSOCIATE_SECLABEL_RESTORE for a best-effort attempt to |
| 97 | restore the security label after use. Requesting the restore of |
| 98 | security label will require that the file descriptors are kept open for |
| 99 | the whole time they are used by the hypervisor, or other additional |
| 100 | overhead. |
| 101 | |
| 102 | In certain cases usage of the fd group would imply read-only access. |
| 103 | Passing VIR_DOMAIN_FD_ASSOCIATE_SECLABEL_WRITABLE in @flags ensures |
| 104 | that a writable security label is picked in case when the file |
| 105 | represented by the fds may be used in write mode. """ |
| 106 | ret = libvirtmod.virDomainFDAssociate(self._o, name, files, flags) |
| 107 | if ret == -1: |
| 108 | raise libvirtError('virDomainFDAssociate() failed') |
| 109 | return ret |
| 110 |