Commit 2c73d0dc authored by Francesc Guasch's avatar Francesc Guasch
Browse files

doc: comment some misssing public methods

parent 2820b02f
......@@ -4230,6 +4230,12 @@ sub _cmd_open_exposed_ports($self, $request) {
$domain->open_exposed_ports();
}
=head2 setting
Returns the value of a configuration setting
=cut
sub setting($self, $name) {
my $sth = $CONNECTOR->dbh->prepare(
"SELECT id,value "
......
......@@ -733,6 +733,15 @@ sub _around_prepare_base($orig, $self, @args) {
$self->_post_prepare_base($user, $request);
}
=head2 pre_prepare_base
Run 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.
=cut
sub pre_prepare_base($self) {}
=head2 prepare_base
......
......@@ -469,6 +469,15 @@ sub disk_device {
}
=head2 pre_prepare_base
Run this before preparing the base. It is necessary to correctly
detect disks drivers for newer libvirts.
This is executed automatically so it shouldn't been called.
=cut
sub pre_prepare_base($self) {
$self->_detect_disks_driver();
}
......
......@@ -1225,6 +1225,12 @@ sub _get_settings($self, $id_parent=0) {
return $ret;
}
=head2 settings_global
Returns the list of global settings as a hash
=cut
sub settings_global($self) {
return $self->_get_settings();
}
......@@ -1239,6 +1245,12 @@ sub _settings_by_id($self) {
return $orig_settings;
}
=head2 update_settings_global
Updates the global settings
=cut
sub update_settings_global($self, $arg, $user, $orig_settings = $self->_settings_by_id) {
confess if !ref($arg);
if (exists $arg->{frontend}
......@@ -1270,6 +1282,12 @@ sub update_settings_global($self, $arg, $user, $orig_settings = $self->_settings
}
=head2 is_in_maintenance
Returns wether the service is in maintenance mode
=cut
sub is_in_maintenance($self) {
my $settings = $self->settings_global();
return 0 if ! $settings->{frontend}->{maintenance}->{value};
......
......@@ -355,7 +355,7 @@ sub _connect_ssh($self) {
return $ssh;
}
sub ssh($self) {
sub _ssh($self) {
my $ssh = $self->netssh;
return if !$ssh;
return $ssh if $ssh->check_master;
......@@ -1273,7 +1273,7 @@ sub run_command($self, @command) {
}
return $self->_run_command_local(@command) if $self->is_local();
my $ssh = $self->ssh or confess "Error: Error connecting to ".$self->host;
my $ssh = $self->_ssh or confess "Error: Error connecting to ".$self->host;
my ($out, $err) = $ssh->capture2({timeout => 10},join " ",@command);
chomp $err if $err;
......@@ -1337,9 +1337,9 @@ Writes a file to the node
sub write_file( $self, $file, $contents ) {
return $self->_write_file_local($file, $contents ) if $self->is_local;
my $ssh = $self->ssh or confess "Error: no ssh connection";
my ($rin, $pid) = $self->ssh->pipe_in("cat > $file")
or die "pipe_in method failed ".$self->ssh->error;
my $ssh = $self->_ssh or confess "Error: no ssh connection";
my ($rin, $pid) = $self->_ssh->pipe_in("cat > $file")
or die "pipe_in method failed ".$self->_ssh->error;
print $rin $contents;
close $rin;
......@@ -1363,8 +1363,8 @@ Reads a file in memory from the storage of the virtual manager
sub read_file( $self, $file ) {
return $self->_read_file_local($file) if $self->is_local;
my ($rout, $pid) = $self->ssh->pipe_out("cat $file")
or die "pipe_out method failed ".$self->ssh->error;
my ($rout, $pid) = $self->_ssh->pipe_out("cat $file")
or die "pipe_out method failed ".$self->_ssh->error;
return join ("",<$rout>);
}
......@@ -1384,7 +1384,7 @@ Returns true if the file exists in this virtual manager storage
sub file_exists( $self, $file ) {
return -e $file if $self->is_local;
my $ssh = $self->ssh;
my $ssh = $self->_ssh;
confess "Error: no ssh connection to ".$self->name if ! $ssh;
confess "Error: dangerous filename '$file'"
......@@ -1873,6 +1873,14 @@ sub _new_free_port($self) {
return $free_port;
}
=head2 list_network_interfaces
Returns a list of all the known interface
Argument: type ( nat or bridge )
=cut
sub list_network_interfaces($self, $type) {
my $sub = {
nat => \&_list_nat_interfaces
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment