Commit eec75448 authored by frankiejol's avatar frankiejol
Browse files

Merge branch 'master' into 949_fallback

parents a68a4e14 e0f90cf3
......@@ -3,7 +3,12 @@
**Implemented enhancements:**
- Create an empty virtual machine [\#918]
- Add ISO for Debian Buster [\#1108]
- non-predictable MAC addresses [\#1103]
- first login fails after inactivity logout [\#1102]
**Fixed bugs:**
**Bugfixes**
- Specified key was too long with MariaDB 10.1 in Debian [\#1104]
- Login name with spaces [\#1100]
- Volatile domains get invalid SPICE IP [\#1099]
......@@ -34,7 +34,7 @@ the branch so it is easier to follow.
A good branch name would be (where issue #77 is the one you're working on):
```sh
git checkout -b 77_start_machine
git checkout -b fix/77_start_machine
```
## 4. Code Style
......@@ -68,7 +68,7 @@ footer #issue
Example:
```
fix: active virtual machines can not be started
fix(backend): active virtual machines can not be started
check the machine status before start
returns if machine active
......
......@@ -10,7 +10,6 @@ WriteMakefile(
,'DateTime' => 0
,'DBIx::Connector' => 0
,'Authen::Passphrase' => 0
,'Date::Calc' => 0
,'IPC::Run3' => 0
,'JSON::XS' => 0
,'Moose' => 0
......
......@@ -46,14 +46,18 @@ my $LIST;
my $HIBERNATE_DOMAIN;
my $START_DOMAIN;
my $SHUTDOWN_DOMAIN;
my $REBASE;
my $IMPORT_DOMAIN_OWNER;
my $ADD_LOCALE_REPOSITORY;
my $USAGE = "$0 "
." [--debug] [--config=$FILE_CONFIG_DEFAULT] [--add-user=name] [--add-user-ldap=name]"
." [--change-password] [--make-admin=username] [--import-vbox=image_file.vdi]"
." [--test-ldap] "
." [-X] [start|stop|status]"
." [--rebase MACHINE]"
."\n"
." --add-user : adds a new db user\n"
." --add-user-ldap : adds a new LDAP user\n"
......@@ -65,6 +69,7 @@ my $USAGE = "$0 "
." --no-fork : start in foreground\n"
." --url-isos=(URL|default)\n"
." --import-vbox : import a VirtualBox image\n"
.' --add-locale-repository LOCALE : adds ISO repositories for this locale'
."\n"
."Operations on Virtual Machines:\n"
." --list\n"
......@@ -87,6 +92,7 @@ GetOptions ( help => \$help
,list => \$LIST
,debug => \$DEBUG
,verbose => \$VERBOSE
,rebase => \$REBASE
,'no-fork'=> \$NOFORK
,'start=s' => \$START_DOMAIN
,'config=s'=> \$FILE_CONFIG
......@@ -104,6 +110,8 @@ GetOptions ( help => \$help
,'import-domain=s' => \$IMPORT_DOMAIN
,'import-vbox=s' => \$IMPORT_VBOX
,'import-domain-owner=s' => \$IMPORT_DOMAIN_OWNER
,'add-locale-repository=s' => \$ADD_LOCALE_REPOSITORY
) or exit;
$START = 1 if $DEBUG || $FILE_CONFIG || $NOFORK;
......@@ -129,6 +137,9 @@ die "ERROR: Shutdown requires a domain name, or --all , --hibernated , --disconn
die "ERROR: Hibernate requires a domain name, or --all , --disconnected\n"
if defined $HIBERNATE_DOMAIN && !$HIBERNATE_DOMAIN && !$ALL && !$DISCONNECTED;
die "ERROR: Missing the machine name or id\n$USAGE"
if $REBASE && !@ARGV;
my %CONFIG;
%CONFIG = ( config => $FILE_CONFIG ) if $FILE_CONFIG;
......@@ -150,8 +161,8 @@ sub do_start {
my $t_refresh = 0;
my $ravada = Ravada->new( %CONFIG );
Ravada::Request->enforce_limits();
Ravada::Request->refresh_vms();
# Ravada::Request->enforce_limits();
#Ravada::Request->refresh_vms();
for (;;) {
my $t0 = time;
$ravada->process_priority_requests();
......@@ -434,7 +445,8 @@ sub shutdown_domain {
my $down = 0;
my $found = 0;
DOMAIN:
for my $domain ($rvd_back->list_domains) {
for my $domain_data ($rvd_back->list_domains_data) {
my $domain = Ravada::Front::Domain->open($domain_data->{id});
if ((defined $domain_name && $domain->name eq $domain_name)
|| ($hibernated && $domain->is_hibernated)
|| ($DISCONNECTED
......@@ -460,10 +472,11 @@ sub shutdown_domain {
next DOMAIN if _verify_connection($domain);
}
print "Shutting down ".$domain->name.".\n";
eval {
$domain->shutdown(user => Ravada::Utils::user_daemon(), timeout => 300);
$down++;
};
Ravada::Request->shutdown_domain(uid => Ravada::Utils::user_daemon()->id
,id_domain => $domain->id
, timeout => 300
);
$down++;
warn $@ if $@;
}
}
......@@ -511,6 +524,31 @@ sub test_ldap {
exit;
}
sub add_locale_repository {
my $locale = shift;
for my $lang ( split /,/, $locale ) {
print "Adding locales for $lang.\n";
my $found = Ravada::Repository::ISO::insert_iso_locale($lang, 'verbose');
print "$found found.\n";
}
}
sub rebase {
my ($domain_name) = $ARGV[0];
my $rvd_back = Ravada->new(%CONFIG);
my $domain;
if ($domain_name =~ /^\d+$/) {
$domain = Ravada::Domain->open($domain_name);
} else {
$domain = $rvd_back->search_domain($domain_name);
}
die "Error: Unknown domain $domain_name\n" if !$domain;
die "Error: ".$domain->name." is not a clone\n" if !$domain->id_base;
my $base = Ravada::Domain->open($domain->id_base);
$base->rebase(Ravada::Utils::user_daemon, $domain);
}
sub DESTROY {
}
......@@ -529,6 +567,7 @@ make_admin($MAKE_ADMIN_USER) if $MAKE_ADMIN_USER;
remove_admin($REMOVE_ADMIN_USER) if $REMOVE_ADMIN_USER;
set_url_isos($URL_ISOS) if $URL_ISOS;
test_ldap if $TEST_LDAP;
rebase() if $REBASE;
list($ALL) if $LIST;
hibernate($HIBERNATE_DOMAIN , $ALL) if defined $HIBERNATE_DOMAIN;
......@@ -537,6 +576,7 @@ start_domain($START_DOMAIN) if $START_DOMAIN;
shutdown_domain($SHUTDOWN_DOMAIN, $ALL, $HIBERNATED)
if defined $SHUTDOWN_DOMAIN;
add_locale_repository($ADD_LOCALE_REPOSITORY) if $ADD_LOCALE_REPOSITORY;
}
......
......@@ -3,6 +3,7 @@
use warnings;
use strict;
use Carp qw(confess);
use Cwd qw(getcwd);
use File::Path qw(remove_tree make_path);
use IPC::Run3;
......@@ -11,7 +12,8 @@ use Ravada;
use File::Copy;
my $VERSION = Ravada::version();
my $DIR_DST = getcwd."/../ravada-$VERSION";
my $DIR_SRC = getcwd;
my $DIR_DST;
my $DEBIAN = "DEBIAN";
my %DIR = (
......@@ -80,8 +82,8 @@ sub copy_files {
sub remove_not_needed {
for my $file (@REMOVE) {
$file = "$DIR_DST/$file";
unlink $file or die "$! $file";
my $file2 = "$DIR_DST/$file";
unlink $file2 or die "$! $file2";
}
for my $dir ('usr/share/doc/ravada/sql/sqlite') {
my $path = "$DIR_DST/$dir";
......@@ -114,7 +116,10 @@ sub create_md5sums {
}
sub create_deb {
my $deb = "ravada_${VERSION}_all.deb";
my $dist = shift or confess "Missing dist";
mkdir "ravada_release" if !-e "ravada_release";
my $deb = "ravada_release/ravada_${VERSION}_${dist}_all.deb";
my @cmd = ('dpkg','-b',"$DIR_DST/",$deb);
my ($in, $out, $err);
run3(\@cmd, \$in, \$out, \$err);
......@@ -218,7 +223,7 @@ sub chown_pms {
sub chmod_control_files {
for (qw(control conffiles)) {
my $path = "$DIR_DST/$DEBIAN/$_";
warn "Missing $path" if ! -e $path;
confess "Missing $path" if ! -e $path;
chmod 0644 , $path or die "$! $path" if -e $path;
}
......@@ -229,19 +234,22 @@ sub chmod_control_files {
}
sub chmod_ravada_conf {
chmod 0644,"$DIR_DST/etc/ravada.conf" or die $!;
chmod 0600,"$DIR_DST/etc/ravada.conf" or die $!;
}
sub tar {
my $dist = shift;
my @cmd = ('tar','czvf',"ravada_$VERSION.orig.tar.gz"
,"ravada-$VERSION"
,"ravada-$VERSION-$dist"
);
warn "@cmd";
my ($in, $out, $err);
run3(\@cmd, \$in, \$out, \$err);
die $err if $err;
confess $err if $err;
}
sub make_pl {
chdir $DIR_SRC or die "$! $DIR_SRC";
my @cmd = ('perl','Makefile.PL');
my ($in, $out, $err);
run3(\@cmd, \$in, \$out, \$err);
......@@ -257,7 +265,7 @@ sub set_version {
my $file_in = "$DIR_DST/DEBIAN/control";
my $file_out = "$file_in.version";
open my $in ,'<',$file_in or die "$! $file_in";
open my $in ,'<',$file_in or confess "$! $file_in";
open my $out,'>',$file_out or die "$! $file_out";
my $version = $VERSION;
......@@ -281,12 +289,49 @@ sub set_version {
unlink $file_out;
}
sub list_dists {
opendir my $dir,'debian' or die "$! debian";
my @dists;
while ( my $file = readdir $dir ) {
my ($dist) = $file =~ /control-(.*)/;
push @dists,($dist) if $dist;
}
closedir $dir;
die "Error: no dists control files found in 'debian' dir"
if !@dists;
return @dists;
}
sub set_control_file {
my $dist = shift;
my $dst = "$DIR_DST/DEBIAN/control";
my $src = "$dst-$dist";
die "Error: no $src" if ! -e $src;
copy($src, $dst) or die "$! $src -> $dst";
opendir my $dir,"$DIR_DST/DEBIAN" or die $!;
while ( my $file = readdir $dir ) {
unlink "$DIR_DST/DEBIAN/$file" or die "$! $file"
if $file =~ /^control-/;
}
closedir $dir;
}
#########################################################################
for my $dist (list_dists) {
$DIR_DST = "$DIR_SRC/../ravada-$VERSION-$dist";
clean();
make_pl();
copy_dirs();
copy_files();
set_control_file($dist);
set_version();
remove_not_needed();
remove_use_lib();
......@@ -306,13 +351,15 @@ chown_files('usr/sbin',0755,0755);
#chown_files('usr/share/ravada/public');
#chown_files('usr/share/ravada/templates');
chown_files('etc');
chmod_ravada_conf();
chown_files('lib');
#chown_files('lib/systemd');
chown_files('var/lib/ravada');
chown_files('usr/share/perl5');
#chown_files('usr/share/man');
create_md5sums();
tar();
tar($dist);
#chown_pms();
create_md5sums();
create_deb();
create_deb($dist);
}
Package: ravada
Version: 0.2.5
Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
......@@ -4,7 +4,7 @@ Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-bin,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libparallel-forkmanager-perl, libfile-rsync-perl
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-bin,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
control-ubuntu-19.04
\ No newline at end of file
Package: ravada
Version: 0.2.5
Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
......@@ -2,4 +2,4 @@
db:
hostname: localhost
user: rvd_user
password: changeme
password: Pword12345*
name: Linkat 18.04 - 64 bits
description: Distribuci&oacute; educativa del Departament d'Ensenyament de Catalunya. Versi&oacute; de 64 bits
url: http://download-linkat.xtec.cat/distribution/linkat-edu-18.04/iso/
file_re: linkat-edu-18.04-amd64.iso
md5_url: $url/MD5SUMS
arch: amd64
xml: bionic-amd64.xml
xml_volume: bionic64-volume.xml
min_disk_size: 19
name: Linkat Lleugera 18.04 - 64 bits
description: Distribuci&oacute; educativa del Departament d'Ensenyament de Catalunya. Versi&oacute; lleugera de 64 bits per ordinadors amb poques prestacions
url: http://download-linkat.xtec.cat/distribution/linkat-edu-18.04/iso/
file_re: linkat-lleugera-18.04-amd64.iso
md5_url: $url/MD5SUMS
arch: amd64
xml: bionic-amd64.xml
xml_volume: bionic64-volume.xml
min_disk_size: 17
name: Linkat Lleugera 18.04 - 32 bits
description: Distribuci&oacute; educativa del Departament d'Ensenyament de Catalunya. Versi&oacute; lleugera de 32 bits per ordinadors amb poques prestacions
url: http://download-linkat.xtec.cat/distribution/linkat-edu-18.04/iso/
file_re: linkat-lleugera-18.04-i386.iso
md5_url: $url/MD5SUMS
arch: i386
xml: bionic-i386.xml
xml_volume: bionic32-volume.xml
min_disk_size: 15
......@@ -15,12 +15,6 @@
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='full'>
<model fallback='forbid'>Penryn</model>
<feature policy='require' name='vme'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='hypervisor'/>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
......@@ -138,12 +132,4 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor' relabel='yes'>
<label>libvirt-a289e5a7-77c8-4447-b21e-177105598ec6</label>
<imagelabel>libvirt-a289e5a7-77c8-4447-b21e-177105598ec6</imagelabel>
</seclabel>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+64055:+130</label>
<imagelabel>+64055:+130</imagelabel>
</seclabel>
</domain>
......@@ -12,9 +12,6 @@
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Penryn</model>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
......@@ -47,18 +44,6 @@
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
......@@ -100,9 +85,6 @@
<redirdev bus='usb' type='spicevmc'>
<address type='usb' bus='0' port='1'/>
</redirdev>
<redirdev bus='usb' type='spicevmc'>
<address type='usb' bus='0' port='2'/>
</redirdev>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
......
......@@ -12,9 +12,6 @@
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Penryn</model>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
......
......@@ -12,9 +12,6 @@
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Penryn</model>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
......
......@@ -63,6 +63,10 @@
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'>
<alias name='input0'/>
</input>
......
......@@ -52,6 +52,10 @@
<console type='pty'>
<target type='serial' port='0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='spice' autoport='yes' listen='127.0.0.1'>
......
......@@ -12,9 +12,6 @@
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Penryn</model>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
......
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