Ravada::Domain - Online Linux Manual PageSection : 3
Updated : 2021-03-05
Source : perl v5.32.1
Note : User Contributed Perl Documentation
NAMERavada::Domain − Domains ( Virtual Machines ) library for Ravada
pre_prepare_baseRun this before preparing the base. By default does nothing and may be implemented in the object. This is executed automatically so it shouldn't been called.
prepare_basePrepares the virtual machine as a base: • shuts it down • creates read only volumes based on this base • locks it so it won't get started • stores the virtual machine template for the clones
post_prepare_basePlaceholder for optional method implemented in subclasses. This will run after preparing the base files.
spinoffMakes volumes indpendent from base sub _check_disk_modified {
my $self = shift; if ( !$self−>is_base() ) {
return;
}
my $last_stat_base = 0;
for my $file_base ( $self−>list_files_base ) {
my @stat_base = stat($file_base);
$last_stat_base = $stat_base[9] if$stat_base[9] > $last_stat_base;
# warn $last_stat_base;
}
my $files_updated = 0;
for my $file ( $self−>disk_device ) {
my @stat = stat($file) or next;
$files_updated++ if $stat[9] > $last_stat_base;
# warn "\ncheck\t$file ".$stat[9]."\n vs \tfile_base $last_stat_base $files_updated\n";
}
die "Base already created and no disk images updated"
if !$files_updated;
}
id Returns the id of the domain my $id = $domain−>id();
openOpen a domain Argument: id Arguments: id => $id , [ readonly => {0|1} ] Returns: Domain object
check_statusChecks if a virtual machine known status is in sync. • Checks it is already started • Performs shutdown cleaning procedures if down
is_knownReturns if the domain is known in Ravada.
Returns if the domain has extra fields information known in Ravada.
start_timeReturns the last time (epoch format in seconds) the domain was started.
spice_passwordReturns the password defined for the spice viewers
display_fileReturns a file with the display information. Defaults to spice.
display_file_tlsReturns a file with the display information in TLS connections. Defaults to spice.
displayReturns the display information.
infoReturn information about the domain.
pre_removeCode to run before removing the domain. It can be implemented in each domain. It is not expected to run by itself, the remove function calls it before proceeding. $domain−>pre_remove(); # This isn't likely to be necessary
$domain−>remove(); # Automatically calls the domain pre_remove method
restoreReturns the clone to an initial state. Depending of the type of volumes added to the virtual machines all the information stored there is removed. Only data volumes are kept untouched. • system : cleaned to the initial state • tmp/swap : cleaned to the initial state • data : nothing gets removed
is_base Returns true or false if the domain is a prepared base
is_locked Shows if the domain has running or pending requests. It could be considered too as the domain is busy doing something like starting, shutdown or prepare base. Returns true if locked.
id_owner Returns the id of the user that created this domain
id_base Returns the id from the base this domain is based on, if any.
vm Returns a string with the name of the VM ( Virtual Machine ) this domain was created on
clones Returns a list of clones from this virtual machine my @clones = $domain−>clones
has_clones Returns the number of clones from this virtual machine my $has_clones = $domain−>has_clones
list_files_base Returns a list of the filenames of this base-type domain
list_files_base_targetReturns a list of the filenames and targets of this base-type domain
can_screenshot Returns wether this domain can take an screenshot.
remove_base Makes the domain a regular, non-base virtual machine and removes the base files.
cloneClones a domain arguments user => $user : The user that owns the clone name => $name : Name of the new clone
can_hybernateReturns wether a domain supports hybernation
can_hibernateReturns wether a domain supports hibernation
add_volume_swapAdds a swap volume to the virtual machine Arguments: size => $kb
name => $name (optional)
exposeExpose a TCP port from the domain Arguments:
− number of the port
− optional name Returns: public ip and port
exposed_portReturns all the data from an exposed port. Argument: number or name description of the port permission. my $port_data = $domain−>exposed_port(80);
my $port_data = $domain−>exposed_port('web');
open_exposed_portsPerforms an iptables open of all the exposed ports of the domain
remove_exposeRemove exposed port Argument: virtual machine exposed port [ optional ] If no port is passed all the exposed ports are removed.
list_portsList of exposed TCP ports
post_resume_auxMethod after resume
open_iptablesOpen iptables for a remote client user remote_ip
is_publicSets or get the domain public $domain−>is_public(1);
if ($domain−>is_public()) {
...
}
is_volatileReturns if the domain is volatile, so it will be removed on shutdown
is_persistentReturns true if the virtual machine is persistent. So it is not removed after shut down.
run_timeoutSets or get the domain run timeout. When it expires it is shut down. $domain−>run_timeout(60 * 60); # 60 minutes
clean_swap_volumesCheck if the domain has swap volumes defined, and clean them $domain−>clean_swap_volumes();
get_controllerCalls the method to get the specified controller info Attributes:
name −> name of the controller type
get_controllersReturns a hashref of the hardware controllers for this virtual machine
driversList the drivers available for a domain. It may filter for a given type. my @drivers = $domain−>drivers();
my @video_drivers = $domain−>drivers('video');
set_driver_idSets the driver of a domain given it id. The id must be one from the table domain_drivers_options $domain−>set_driver_id($id_driver);
last_vmReturns the last virtual machine manager on which this domain was launched. my $vm = $domain−>last_vm();
list_requestsReturns a list of pending requests from the domain. It won't show those requests scheduled for later.
list_all_requestsReturns a list of pending requests from the domain including those scheduled for later
get_driverReturns the driver from a domain Argument: name of the device [ optional ] Returns all the drivers if not passwed my $driver = $domain−>get_driver('video');
get_driver_idGets the value of a driver Argument: name my $driver = $domain−>get_driver('video');
set_optionSets a domain option: • description • run_timeout $domain−>set_option(description => 'Virtual Machine for ...');
typeReturns the virtual machine type as a string.
rsyncSynchronizes the volume data to a remote node. Arguments: ( node => $node, request => $request, files => \@files ) • node => Ravada::VM • request => Ravada::Request ( optional ) • files => listref of files ( optional ) When files is not specified it syncs the volumes and base volumes if any
set_base_vm Prepares or removes a base in a virtual manager.
$domain−>set_base_vm(
id_vm => $id_vm # you can pass the id_vm
,vm => $vm # or the vm
,user => $user
,value => $value # if it is 0, it removes the base
,request => $req
);
migrate_baseMigrates a base to a virtual manager node. Alias for set_base_vm.
remove_base_vmRemoves a base in a Virtual Machine Manager node. $domain−>remove_base_vm($vm, $user);
file_screenshotReturns the file name where the domain screenshot has been stored
list_vmsReturns a list for virtual machine managers where this domain is base
base_in_vmReturns if this domain has a base prepared in this virtual manager if ($domain−>base_in_vm($id_vm)) { ...
is_localReturns wether this domain is in the local host
poolsEnables or disables pools of clones for this virtual machine
pool_clonesNumber of clones of this virtual machine that belong to the pool
pool_startNumber of clones of this virtual machine that are pre-started
is_poolReturn if the virtual machine belongs to a pool of clones
internal_idReturns the internal id of this domain as found in its Virtual Manager connection
volatile_clonesEnables or disables a domain volatile clones feature. Volatile clones are removed when shut down
statusSets or gets the status of a virtual machine $machine−>status('active');
Valid values are: • active • down • hibernated
client_statusReturns the status of the viewer connection. The virtual machine must be active, and the remote ip must be known. Possible results: • connecting : set at the start of the virtual machine • IP : known remote ip from the current connection • disconnected : the remote client has been closed This method is used from higher level commands, for example, you can shut down or hibernate all the disconnected virtual machines like this: # rvd_back −−hibernate −−disconnected
# rvd_back −−shutdown −−disconnected
You could also set this command on a cron entry to run nightly, hourly or whenever you find suitable.
needs_restartReturns true or false if the virtual machine needs to be restarted so some hardware change can be applied.
Access restrictionsThese methods implement access restrictions to clone a domain
allow_ldap_accessIf specified, only the LDAP users with that attribute value can clone these virtual machines. $base−>allow_ldap_attribute( attribute => 'value' );
Example: $base−>allow_ldap_attribute( tipology => 'student' );
default_accessSets the default access value
grant_accessGrant access to a virtual machine Arguments is a named list • attribute • value • type • allowed ( true / false ) defaults to true • last : if this grant matches it stops looking
access_allowedReturns if a client is granted access to a virtual machine Arguments: expects a named vars list of client attributes retrieved from the web connection.
list_accessReturns a list of access grants Argument: optionally pass the type of grant.
delete_accessDeletes a list of access grants from the database
delete_ldap_accessDeletes a granted ldap access setting Argument: id of the access from the table access_ldap_attribute
list_ldap_accessList granted ldap access settings
deny_ldap_accessIf specified, only the LDAP users with that attribute value can clone these virtual machines. $base−>deny_ldap_attribute( attribute => 'value' );
Example: $base−>deny_ldap_attribute( tipology => 'student' );
move_ldap_accessMoves an access access grant up or down Arguments: • id_ldap_access • position: +1/−1
move_accessMoves an access access grant up or down Arguments: • id_access • position: +1/−1
set_ldap_accessChanges access grant allowed and last states Arguments: • id_access • allowed • last
set_accessChanges access grant allowed and last states • id_access • allowed • last
rebaseRebases the virtual machine to another one If it is a base it rebases all the clones.
list_instancesReturns a list of instances of the virtual machine in all the physical nodes
has_non_shared_storageReturn wether this virtual machine has non shared storage volumes
POD ERRORSHey! The above document had some coding errors, which are explained below: Around line 813: You forgot a '=back' before '=head2' Around line 1962: You forgot a '=back' before '=head2' Around line 4834: You forgot a '=back' before '=head2' 0
Johanes Gumabo
Data Size : 57,334 byte
man-Ravada::Domain.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 173,365
Visitor ID : :
Visitor IP : 3.144.242.149 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Ravada::Domain.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Ravada::Domain.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Ravada::Domain.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|Ravada::Domain.3pm|43|'br══─}─══ |'br══─}─══
)