Commit d6488635 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#254] Call spinoff and insert db after import

parent d17bfc35
......@@ -171,7 +171,7 @@ sub change_password {
sub import_domain {
my $name = shift;
print "Virtual Manager: KVM\n";
print "User name : ";
print "User name that will own the domain in Ravada : ";
my $user = <STDIN>;
chomp $user;
my $ravada = Ravada->new( config => $FILE_CONFIG );
......
......@@ -39,6 +39,7 @@ requires 'create_volume';
requires 'connect';
requires 'disconnect';
requires 'import_domain';
############################################################
......@@ -69,6 +70,7 @@ before 'search_domain' => \&_connect;
before 'create_volume' => \&_connect;
around 'import_domain' => \&_around_import_domain;
#############################################################
#
# method modifiers
......@@ -133,6 +135,20 @@ sub _around_create_domain {
return $domain;
}
sub _around_import_domain {
my $orig = shift;
my $self = shift;
my ($name, $user) = @_;
my $domain = $self->$orig(@_);
$domain->_insert_db(name => $name, id_owner => $user->id);
warn "Spinning volumes off their backing files ...\n" if $ENV{TERM};
$domain->spinoff_volumes();
}
############################################################
#
......
......@@ -1618,8 +1618,6 @@ sub import_domain {
, storage => $self->storage_pool
);
$domain->_insert_db(name => $name, id_owner => $user->id);
return $domain;
}
......
......@@ -144,6 +144,10 @@ sub search_volume_path_re {
}
sub import_domain {
confess "Not implemented";
}
#########################################################################3
1;
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