Skip to content

Commit

Permalink
Merge branch 'wobbethan-improved-readme'
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Feb 15, 2024
2 parents cda3f4b + b91a0bc commit aa7bf71
Show file tree
Hide file tree
Showing 40 changed files with 1,662 additions and 123 deletions.
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ lib/Ravada/I18N/ca.po
lib/Ravada/NetInterface.pm
lib/Ravada/Auth.pm
lib/Ravada/Domain.pm
lib/Ravada/Network.pm
lib/Ravada/Routes.pm
script/rvd_front
script/rvd_back
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ravada
# ravada

[![GitHub version](https://img.shields.io/badge/version-1.8.0-brightgreen.svg)](https://github.com/UPC/ravada/releases) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://github.com/UPC/ravada/blob/master/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/ravada/badge/?version=latest)](http://ravada.readthedocs.io/en/latest/?badge=latest)
Expand All @@ -10,34 +10,38 @@

## Remote Virtual Desktops Manager

Ravada is a software that allows the user to connect to a
remote virtual desktop.
Ravada is meant for sysadmins who have some background in GNU/Linux, and want to deploy a VDI project.
Ravada is an open-source project that provides a web-based user interface for managing and accessing virtual machines (VMs) based on the QEMU/KVM virtualization technology. Ravada aims to simplify the management of virtual machines by offering a user-friendly interface accessible through a web browser.Ravada is meant for sysadmins who have some background in GNU/Linux, and want to deploy a VDI project.

Its back-end has been designed and implemented in order to allow future hypervisors to be added to the framework. Currently, it supports KVM and LXC is in the works.
Users can use Ravada to create, configure, and manage virtual machines without the need for a dedicated desktop client. It provides features such as remote console access, snapshot management, and the ability to manage multiple VMs from a central interface. Ravada's back-end has been designed and implemented in order to allow future hypervisors to be added to the framework. Currently, it supports KVM and LXC is in the works.

The client only requirements are: a web-browser and a remote viewer supporting the spice protocol.

In the current release we use the
KVM Hypervisors: [KVM](http://www.linux-kvm.org/) as the backend for the Virtual Machines.
[LXC](https://linuxcontainers.org/) support is currently in development.
[LXC](https://linuxcontainers.org/) support is currently in development.

### Features

* KVM backend for Windows and Linux Virtual machines
* LDAP and SQL authentication
* Kiosk mode
* Remote Access with [Spice](http://www.spice-space.org/) for Windows and Linux
* Light and fast virtual machine clones for each user
* Instant clone creation
* USB redirection
* Easy and customizable end users interface
* Administration from a web browser
- KVM backend for Windows and Linux Virtual machines
- LDAP and SQL authentication
- Kiosk mode
- Remote Access with [Spice](http://www.spice-space.org/) for Windows and Linux
- Light and fast virtual machine clones for each user
- Instant clone creation
- USB redirection
- Easy and customizable end users interface
- Administration from a web browser

## Install

Read [INSTALL](http://ravada.readthedocs.io/en/latest/docs/INSTALL.html).

Install Ravada in [Ubuntu](https://ravada.readthedocs.io/en/latest/docs/INSTALL_Ubuntu.html)
Install Ravada in [Debian](https://ravada.readthedocs.io/en/latest/docs/INSTALL_Debian.html)
Install Ravada on [Fedora](https://ravada.readthedocs.io/en/latest/docs/INSTALL_Fedora.html)
Install Ravada on [Rocky Linux 9 or RHEL9](https://ravada.readthedocs.io/en/latest/docs/INSTALL_Rocky9.html#install-ravada-on-rocky-linux-9-or-rhel9)
Install Ravada - [Ubuntu Xenial](https://ravada.readthedocs.io/en/latest/docs/INSTALL_ubuntu_xenial.html)
Install Ravada from [dockers](https://ravada.readthedocs.io/en/latest/docs/INSTALLfromDockers.html).

### Production

Expand All @@ -48,6 +52,11 @@ for production fine-tuning guidelines.

See [operation](http://ravada.readthedocs.io/en/latest/docs/operation.html).

- [Create users](https://ravada.readthedocs.io/en/latest/docs/INSTALL_Ubuntu.html)
- [Import KVM virtual machines](https://ravada.readthedocs.io/en/latest/docs/INSTALL_Ubuntu.html)
- [View all rvd_back options](https://ravada.readthedocs.io/en/latest/docs/operation.html#view-all-rvd-back-options)
- [Admin Operations](https://ravada.readthedocs.io/en/latest/docs/operation.html#admin)

### Update

See [update](http://ravada.readthedocs.io/en/latest/docs/update.html).
106 changes: 103 additions & 3 deletions lib/Ravada.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,13 @@ sub _add_indexes_generic($self) {
,"index(date_changed)"
,"index(id_owner)"
]
,bundles => [
"unique (name)"
]
,domains_bundle => [
"index(id_domain)"
,"unique (id_bundle, id_domain)"
]
);
my $if_not_exists = '';
$if_not_exists = ' IF NOT EXISTS ' if $CONNECTOR->dbh->{Driver}{Name} =~ /sqlite|mariadb/i;
Expand Down Expand Up @@ -2382,6 +2389,21 @@ sub _sql_create_tables($self) {
}
]
,
[
bundles => {
id => 'integer PRIMARY KEY AUTO_INCREMENT',
name => 'char(255) NOT NULL',
private_network => 'integer NOT NULL default 0'
}
],
[
domains_bundle => {
id => 'integer PRIMARY KEY AUTO_INCREMENT',
id_bundle => 'integer NOT NULL references `bundles` (`id`) ON DELETE CASCADE',
id_domain => 'integer NOT NULL references `domains` (`id`) ON DELETE CASCADE',
}
]
,
[virtual_networks => {
id => 'integer PRIMARY KEY AUTO_INCREMENT',
,id_vm => 'integer NOT NULL references `vms` (`id`) ON DELETE CASCADE',
Expand Down Expand Up @@ -2888,6 +2910,7 @@ sub _upgrade_tables {
$self->_upgrade_table('domains','has_backups','int not null default 0');
$self->_upgrade_table('domains','auto_compact','int default NULL');
$self->_upgrade_table('domains','date_status_change' , 'datetime');
$self->_upgrade_table('domains','show_clones' , 'int not null default 1');

$self->_upgrade_table('domains_network','allowed','int not null default 1');

Expand Down Expand Up @@ -3290,6 +3313,13 @@ sub create_domain {
$base = Ravada::Domain->open($id_base)
or confess "Unknown base id: $id_base";
$vm = $base->_vm;

my $net_bundle = $self->_net_bundle($base, $id_owner);
if ($net_bundle) {
unlock_hash(%args);
$args{options}->{network} = $net_bundle->{name};
lock_hash(%args);
}
}
my $user = Ravada::Auth::SQL->search_by_id($id_owner)
or confess "Error: Unkown user '$id_owner'";
Expand Down Expand Up @@ -4623,6 +4653,25 @@ sub _cmd_remove {
$self->remove_domain(name => $request->args('name'), uid => $request->args('uid'));
}

sub _cmd_remove_clones($self, $request) {

my $uid = $request->args('uid');
my $user = Ravada::Auth::SQL->search_by_id($uid);

my $id_domain = $request->args('id_domain');

die "Error: user ".$user->name." not authorized to remove clones"
unless $user->is_admin();

my $domain = Ravada::Front::Domain->open($id_domain);
for my $clone ( $domain->clones ) {
Ravada::Request->remove_domain(
uid => $uid
,name => $clone->{name}
);
}
}

sub _cmd_restore_domain($self,$request) {
my $domain = Ravada::Domain->open($request->args('id_domain'));
return $domain->restore(Ravada::Auth::SQL->search_by_id($request->args('uid')));
Expand Down Expand Up @@ -4713,22 +4762,66 @@ sub _cmd_clone($self, $request) {

$args->{alias} = $alias if $alias;

my $net_bundle = $self->_net_bundle($domain, $user);

$args->{options}->{network} = $net_bundle->{name} if $net_bundle;

my $clone = $domain->clone(
name => $name
,%$args
);

$request->id_domain($clone->id) if $clone;
my $req_next = $request;

Ravada::Request->start_domain(
uid => $user->id
,id_domain => $clone->id
,remote_ip => $request->defined_arg('remote_ip')
,after_request => $request->id
,after_request => $req_next->id
) if $request->defined_arg('start');

}

sub _net_bundle($self, $domain, $user0) {
my $bundle = $domain->bundle();

return unless $bundle && exists $bundle->{private_network}
&& $bundle->{private_network};

my $user = $user0;
$user = Ravada::Auth::SQL->search_by_id($user0) if !ref($user);

my ($net) = grep { $_->{id_owner} == $user->id }
$domain->_vm->list_virtual_networks();

return $net if $net;

my $req_new_net = Ravada::Request->new_network(
uid => Ravada::Utils::user_daemon->id
,id_vm => $domain->_vm->id
,name => $bundle->{name}."-".$user->name
);
$self->_cmd_new_network($req_new_net);
my $data = decode_json($req_new_net->output);
$req_new_net->status('done');

my $req_network = Ravada::Request->create_network(
uid => Ravada::Utils::user_daemon->id
,id_vm => $domain->_vm->id
,data => $data
);
$self->_cmd_create_network($req_network);
$req_network->status('done');

($net) = grep { $_->{name} eq $data->{name} }
$domain->_vm->list_virtual_networks();

$domain->_vm->_update_network_db($net, {id_owner => $user->id });

return $net;
}

sub _new_clone_name($self, $base,$user) {
my $name;
my $alias = $base->name;
Expand Down Expand Up @@ -5486,7 +5579,7 @@ sub _cmd_check_storage($self, $request) {
my $path = ''.$vm->_storage_path($storage);
_check_mounted($path,\%fstab,\%mtab);
my ($ok,$err) = $vm->write_file("$path/check_storage",$contents);
die "Error on starage pool $storage : $err. Retry.\n" if $err;
die "Error on storage pool $storage : $err. Retry.\n" if $err;
}
}
}
Expand Down Expand Up @@ -5859,7 +5952,10 @@ sub _refresh_active_vms ($self) {
next;
}
$active_vm{$vm->id} = 1;
$vm->list_virtual_networks();
eval {
$vm->list_virtual_networks();
};
warn $@ if $@;
}
return \%active_vm;
}
Expand Down Expand Up @@ -5911,6 +6007,7 @@ sub _refresh_down_nodes($self, $request = undef ) {
my $vm;
eval { $vm = Ravada::VM->open($id) };
warn $@ if $@;
$vm->is_active() if $vm;
}
}

Expand Down Expand Up @@ -6271,6 +6368,8 @@ sub _req_method {
,pause => \&_cmd_pause
,create => \&_cmd_create
,remove => \&_cmd_remove
,remove_domain => \&_cmd_remove
,remove_clones => \&_cmd_remove_clones
,restore_domain => \&_cmd_restore_domain
,resume => \&_cmd_resume
,dettach => \&_cmd_dettach
Expand Down Expand Up @@ -6525,6 +6624,7 @@ sub _enforce_limits_active($self, $request) {

my %domains;
for my $domain ($self->list_domains( active => 1 )) {
next if $domain->is_in_bundle();
push @{$domains{$domain->id_owner}},$domain;
$domain->client_status();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Ravada/Auth/SQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ sub can_remove_clones($self, $id_domain=undef) {
return $self->can_do('remove_clones') if !$id_domain;

my $domain = Ravada::Front::Domain->open($id_domain);
confess "ERROR: domain is not a base " if !$domain->id_base;
confess "ERROR: domain ".$domain->name." is not a base " if !$domain->id_base;

return 1 if $self->can_remove_clone_all();

Expand Down
Loading

0 comments on commit aa7bf71

Please sign in to comment.