Repository URL to install this package:
|
Version:
1:1.40.2-4.fc30 ▾
|
python3-trilio-libguestfs
/
usr
/
lib64
/
python3.7
/
site-packages
/
__pycache__
/
guestfs.cpython-37.pyc
|
|---|
B
ÿ\ ã @ st d Z ddlZddlZddlZdZdZdZdZdZdZ d Z
d
ZdZdZ
d
Zdd ZG dd deZG dd deZdS )a= Python bindings for libguestfs
import guestfs
g = guestfs.GuestFS(python_return_dict=True)
g.add_drive_opts("guest.img", format="raw")
g.launch()
parts = g.list_partitions()
The guestfs module provides a Python binding to the libguestfs API
for examining and modifying virtual machine disk images.
Amongst the things this is good for: making batch configuration
changes to guests, getting disk used/free statistics (see also:
virt-df), migrating between virtualization systems (see also:
virt-p2v), performing partial backups, performing partial guest
clones, cloning guests and changing registry/UUID/hostname info, and
much else besides.
Libguestfs uses Linux kernel and qemu code, and can access any type of
guest filesystem that Linux and qemu can, including but not limited
to: ext2/3/4, btrfs, FAT and NTFS, LVM, many different disk partition
schemes, qcow, qcow2, vmdk.
Libguestfs provides ways to enumerate guest storage (eg. partitions,
LVs, what filesystem is in each LV, etc.). It can also run commands
in the context of the guest. Also you can access filesystems over
FUSE.
Errors which happen while using the API are turned into Python
RuntimeError exceptions.
To create a guestfs handle you usually have to perform the following
sequence of calls:
# Create the handle, call add_drive* at least once, and possibly
# several times if the guest has multiple block devices:
g = guestfs.GuestFS()
g.add_drive_opts("guest.img", format="raw")
# Launch the qemu subprocess and wait for it to become ready:
g.launch()
# Now you can issue commands, for example:
logvols = g.lvs()
é Né é é é é é é@ é é i iÿ c C s
t | ¡S )z8Return a printable string from an event or event bitmask)Ú
libguestfsmodÚevent_to_string)Zevents© r
ú/usr/lib64/python3.7/guestfs.pyr X s r c @ s e Zd ZdS )ÚClosedHandleN)Ú__name__Ú
__module__Ú__qualname__r
r
r
r r ] s r c ? @ s² e Zd ZdZdãddZdd Zdd Zd
d Zdd
Zdd Z dd Z
dd Zdd Zdd Z
dd ZdäddZdåddZeZdd Zd!d" Zdæd#d$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PdZsdÐdĄ Ztd"dŐdƄZudǐdȄ Zvdɐdʄ Zwdːd̄ Zxd͐d΄ ZydϐdЄ Zzdѐd҄ Z{dӐdԄ Z|dՐdք Z}dאd Z~dِdڄ Zdېd܄ Zdݐdބ Zdߐdà Zdádâ ZdS (# ÚGuestFSz3Instances of this class are libguestfs API handles.FTc C sV d}|s|t jO }|s |t jO }t |¡| _|| _tj t j
d ¡}t | j|¡ dS )aÉ Create a new libguestfs handle.
Note about "python_return_dict" flag:
Setting this flag to 'True' causes all functions
that internally return hashes to return a dict. This is
natural for Python, and all new code should use
python_return_dict=True.
If this flag is not present then hashes are returned
as lists of pairs. This was the only possible behaviour
in libguestfs <= 1.20.
r N)r ZGUESTFS_CREATE_NO_ENVIRONMENTZGUESTFS_CREATE_NO_CLOSE_ON_EXITZcreateÚ_oÚ_python_return_dictÚosÚpathÚbasenameÚsysÚargvÚset_program)ÚselfZpython_return_dictÚenvironmentZ
close_on_exitÚflagsÚprogramr
r
r Ú__init__d s
zGuestFS.__init__c C s | j rt | j ¡ d S )N)r r Úclose)r r
r
r Ú__del__ s zGuestFS.__del__c C s | j stdd S )Nz'GuestFS: method called on closed handle)r r )r r
r
r Ú_check_not_closed s zGuestFS._check_not_closedc C s | j rt|}|S )N)r Údict)r Úrr
r
r Ú_maybe_convert_to_dict s zGuestFS._maybe_convert_to_dictc C s | ¡ t | j¡ d| _dS )aÅ Explicitly close the guestfs handle.
The handle is closed implicitly when its reference count goes
to zero (eg. when it goes out of scope or the program ends).
This call is only needed if you want to force the handle to
close now. After calling this, the program must not call
any method on the handle (except the implicit call to
__del__ which happens when the final reference is cleaned up).
N)r# r r! r )r r
r
r r! s z
GuestFS.closec C s | ¡ t | j||¡S )a Register an event callback.
Register "cb" as a callback function for all of the
events in "event_bitmask". "event_bitmask" should be
one or more "guestfs.EVENT_*" flags logically or'd together.
This function returns an event handle which can be used
to delete the callback (see "delete_event_callback").
The callback function receives 4 parameters:
cb (event, event_handle, buf, array)
"event" is one of the "EVENT_*" flags. "buf" is a
message buffer (only for some types of events). "array"
is an array of integers (only for some types of events).
You should read the documentation for
"guestfs_set_event_callback" in guestfs(3) before using
this function.
)r# r Úset_event_callbackr )r ÚcbZ
event_bitmaskr
r
r r' s zGuestFS.set_event_callbackc C s | ¡ t | j|¡ dS )zDelete an event callback.N)r# r Údelete_event_callbackr )r Zevent_handler
r
r r) ´ s zGuestFS.delete_event_callbackc C s | ¡ t | j|¡}|S )zÌThis function deletes the default POSIX Access Control
List (ACL) attached to directory "dir".
This function depends on the feature "acl". See also
"g.feature-available".
)r# r Úacl_delete_def_filer )r Údirr% r
r
r r* ¹ s zGuestFS.acl_delete_def_filec C s | ¡ t | j||¡}|S )a
This function returns the POSIX Access Control List
(ACL) attached to "path". The ACL is returned in "long
text form" (see acl(5)).
The "acltype" parameter may be:
"access"
Return the ordinary (access) ACL for any file,
directory or other filesystem object.
"default"
Return the default ACL. Normally this only makes
sense if "path" is a directory.
This function depends on the feature "acl". See also
"g.feature-available".
)r# r Úacl_get_filer )r r Úacltyper% r
r
r r, Ä s zGuestFS.acl_get_filec C s | ¡ t | j|||¡}|S )a
This function sets the POSIX Access Control List (ACL)
attached to "path".
The "acltype" parameter may be:
"access"
Set the ordinary (access) ACL for any file,
directory or other filesystem object.
"default"
Set the default ACL. Normally this only makes sense
if "path" is a directory.
The "acl" parameter is the new ACL in either "long text
form" or "short text form" (see acl(5)). The new ACL
completely replaces any previous ACL on the file. The
ACL must contain the full Unix permissions (eg.
"u::rwx,g::rx,o::rx").
If you are specifying individual users or groups, then
the mask field is also required (eg. "m::rwx"), followed
by the "u:*ID*:..." and/or "g:*ID*:..." field(s). A full
ACL string might therefore look like this:
u::rwx,g::rwx,o::rwx,m::rwx,u:500:rwx,g:500:rwx
\ Unix permissions / \mask/ \ ACL /
You should use numeric UIDs and GIDs. To map usernames
and groupnames to the correct numeric ID in the context
of the guest, use the Augeas functions (see
"g.aug_init").
This function depends on the feature "acl". See also
"g.feature-available".
)r# r Úacl_set_filer )r r r- Zaclr% r
r
r r. Ú s $zGuestFS.acl_set_filec C s | ¡ t | j|¡}|S )aØ This function adds a virtual CD-ROM disk image to the
guest.
The image is added as read-only drive, so this function
is equivalent of "g.add_drive_ro".
*This function is deprecated.* In new code, use the
"add_drive_ro" call instead.
Deprecated functions will not be removed from the API,
but the fact that they are deprecated indicates that
there are problems with correct use of these functions.
)r# r Ú add_cdromr )r Úfilenamer% r
r
r r/ s zGuestFS.add_cdromNc
C s, | ¡ t | j||||||||| |
¡}|S )a This function adds the disk(s) attached to the named
libvirt domain "dom". It works by connecting to libvirt,
requesting the domain and domain XML from libvirt,
parsing it for disks, and calling "g.add_drive_opts" on
each one.
The number of disks added is returned. This operation is
atomic: if an error is returned, then no disks are
added.
This function does some minimal checks to make sure the
libvirt domain is not running (unless "readonly" is
true). In a future version we will try to acquire the
libvirt lock on each disk.
Disks must be accessible locally. This often means that
adding disks from a remote libvirt connection (see
<http://libvirt.org/remote.html>) will fail unless those
disks are accessible via the same device path locally
too.
The optional "libvirturi" parameter sets the libvirt URI
(see <http://libvirt.org/uri.html>). If this is not set
then we connect to the default libvirt URI (or one set
through an environment variable, see the libvirt
documentation for full details).
The optional "live" flag controls whether this call will
try to connect to a running virtual machine "guestfsd"
process if it sees a suitable <channel> element in the
libvirt XML definition. The default (if the flag is
omitted) is never to try. See "ATTACHING TO RUNNING
DAEMONS" in guestfs(3) for more information.
If the "allowuuid" flag is true (default is false) then
a UUID *may* be passed instead of the domain name. The
"dom" string is treated as a UUID first and looked up,
and if that lookup fails then we treat "dom" as a name
as usual.
The optional "readonlydisk" parameter controls what we
do for disks which are marked <readonly/> in the libvirt
XML. Possible values are:
readonlydisk = "error"
If "readonly" is false:
The whole call is aborted with an error if any disk
with the <readonly/> flag is found.
If "readonly" is true:
Disks with the <readonly/> flag are added read-only.
readonlydisk = "read"
If "readonly" is false:
Disks with the <readonly/> flag are added read-only.
Other disks are added read/write.
If "readonly" is true:
Disks with the <readonly/> flag are added read-only.
readonlydisk = "write" (default)
If "readonly" is false:
Disks with the <readonly/> flag are added
read/write.
If "readonly" is true:
Disks with the <readonly/> flag are added read-only.
readonlydisk = "ignore"
If "readonly" is true or false:
Disks with the <readonly/> flag are skipped.
The other optional parameters are passed directly
through to "g.add_drive_opts".
)r# r Ú
add_domainr )r ÚdomZ
libvirturiÚreadonlyÚifaceÚliveZ allowuuidÚreadonlydiskÚ cachemodeÚdiscardÚ
copyonreadr% r
r
r r1 s
UzGuestFS.add_domainc C s2 | ¡ t | j||||||||| |
|||
¡}|S )u! This function adds a disk image called filename to the
handle. filename may be a regular host file or a host
device.
When this function is called before "g.launch" (the
usual case) then the first time you call this function,
the disk appears in the API as /dev/sda, the second time
as /dev/sdb, and so on.
In libguestfs ≥ 1.20 you can also call this function
after launch (with some restrictions). This is called
"hotplugging". When hotplugging, you must specify a
"label" so that the new disk gets a predictable name.
For more information see "HOTPLUGGING" in guestfs(3).
You don't necessarily need to be root when using
libguestfs. However you obviously do need sufficient
permissions to access the filename for whatever
operations you want to perform (ie. read access if you
just want to read the image or write access if you want
to modify the image).
This call checks that filename exists.
filename may be the special string "/dev/null". See
"NULL DISKS" in guestfs(3).
The optional arguments are:
"readonly"
If true then the image is treated as read-only.
Writes are still allowed, but they are stored in a
temporary snapshot overlay which is discarded at the
end. The disk that you add is not modified.
"format"
This forces the image format. If you omit this (or
use "g.add_drive" or "g.add_drive_ro") then the
format is automatically detected. Possible formats
include "raw" and "qcow2".
Automatic detection of the format opens you up to a
potential security hole when dealing with untrusted
raw-format images. See CVE-2010-3851 and
RHBZ#642934. Specifying the format closes this
security hole.
"iface"
This rarely-used option lets you emulate the
behaviour of the deprecated "g.add_drive_with_if"
call (q.v.)
"name"
The name the drive had in the original guest, e.g.
/dev/sdb. This is used as a hint to the guest
inspection process if it is available.
"label"
Give the disk a label. The label should be a unique,
short string using *only* ASCII characters
"[a-zA-Z]". As well as its usual name in the API
(such as /dev/sda), the drive will also be named
/dev/disk/guestfs/*label*.
See "DISK LABELS" in guestfs(3).
"protocol"
The optional protocol argument can be used to select
an alternate source protocol.
See also: "REMOTE STORAGE" in guestfs(3).
"protocol = "file""
filename is interpreted as a local file or
device. This is the default if the optional
protocol parameter is omitted.
"protocol = "ftp"|"ftps"|"http"|"https"|"tftp""
Connect to a remote FTP, HTTP or TFTP server.
The "server" parameter must also be supplied -
see below.
See also: "FTP, HTTP AND TFTP" in guestfs(3)
"protocol = "gluster""
Connect to the GlusterFS server. The "server"
parameter must also be supplied - see below.
See also: "GLUSTER" in guestfs(3)
"protocol = "iscsi""
Connect to the iSCSI server. The "server"
parameter must also be supplied - see below. The
"username" parameter may be supplied. See below.
The "secret" parameter may be supplied. See
below.
See also: "ISCSI" in guestfs(3).
"protocol = "nbd""
Connect to the Network Block Device server. The
"server" parameter must also be supplied - see
below.
See also: "NETWORK BLOCK DEVICE" in guestfs(3).
"protocol = "rbd""
Connect to the Ceph (librbd/RBD) server. The
"server" parameter must also be supplied - see
below. The "username" parameter may be supplied.
See below. The "secret" parameter may be
supplied. See below.
See also: "CEPH" in guestfs(3).
"protocol = "sheepdog""
Connect to the Sheepdog server. The "server"
parameter may also be supplied - see below.
See also: "SHEEPDOG" in guestfs(3).
"protocol = "ssh""
Connect to the Secure Shell (ssh) server.
The "server" parameter must be supplied. The
"username" parameter may be supplied. See below.
See also: "SSH" in guestfs(3).
"server"
For protocols which require access to a remote
server, this is a list of server(s).
Protocol Number of servers required
-------- --------------------------
file List must be empty or param not used at all
ftp|ftps|http|https|tftp Exactly one
gluster Exactly one
iscsi Exactly one
nbd Exactly one
rbd Zero or more
sheepdog Zero or more
ssh Exactly one
Each list element is a string specifying a server.
The string must be in one of the following formats:
hostname
hostname:port
tcp:hostname
tcp:hostname:port
unix:/path/to/socket
If the port number is omitted, then the standard
port number for the protocol is used (see
/etc/services).
"username"
For the "ftp", "ftps", "http", "https", "iscsi",
"rbd", "ssh" and "tftp" protocols, this specifies
the remote username.
If not given, then the local username is used for
"ssh", and no authentication is attempted for ceph.
But note this sometimes may give unexpected results,
for example if using the libvirt backend and if the
libvirt backend is configured to start the qemu
appliance as a special user such as "qemu.qemu". If
in doubt, specify the remote username you want.
"secret"
For the "rbd" protocol only, this specifies the
‘secret’ to use when connecting to the remote
device. It must be base64 encoded.
If not given, then a secret matching the given
username will be looked up in the default keychain
locations, or if no username is given, then no
authentication will be used.
"cachemode"
Choose whether or not libguestfs will obey sync
operations (safe but slow) or not (unsafe but fast).
The possible values for this string are:
"cachemode = "writeback""
This is the default.
Write operations in the API do not return until
a write(2) call has completed in the host [but
note this does not imply that anything gets
written to disk].
Sync operations in the API, including implicit
syncs caused by filesystem journalling, will not
return until an fdatasync(2) call has completed
in the host, indicating that data has been
committed to disk.
"cachemode = "unsafe""
In this mode, there are no guarantees.
Libguestfs may cache anything and ignore sync
requests. This is suitable only for scratch or
temporary disks.
"discard"
Enable or disable discard (a.k.a. trim or unmap)
support on this drive. If enabled, operations such
as "g.fstrim" will be able to discard / make thin /
punch holes in the underlying host file or device.
Possible discard settings are:
"discard = "disable""
Disable discard support. This is the default.
"discard = "enable""
Enable discard support. Fail if discard is not
possible.
"discard = "besteffort""
Enable discard support if possible, but don't
fail if it is not supported.
Since not all backends and not all underlying
systems support discard, this is a good choice
if you want to use discard if possible, but
don't mind if it doesn't work.
"copyonread"
The boolean parameter "copyonread" enables
copy-on-read support. This only affects disk formats
which have backing files, and causes reads to be
stored in the overlay layer, speeding up multiple
reads of the same area of disk.
The default is false.
)r# r Ú add_driver )r r0 r3 Úformatr4 ÚnameÚlabelZprotocolZserverZusernameZsecretr7 r8 r9 r% r
r
r r: o s s
zGuestFS.add_drivec C s | ¡ t | j|¡}|S )züThis function is the equivalent of calling
"g.add_drive_opts" with the optional parameter
"GUESTFS_ADD_DRIVE_OPTS_READONLY" set to 1, so the disk
is added read-only, with the format being detected
automatically.
)r# r Úadd_drive_ror )r r0 r% r
r
r r>