Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
19e21c31
Commit
19e21c31
authored
Jul 01, 2016
by
Francesc Guasch
Browse files
New domain from request works fine now
parent
c728cc6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
19e21c31
...
...
@@ -201,10 +201,12 @@ sub search_domain {
for
my
$vm
(
@
{
$self
->
vm
})
{
my
$domain
=
$vm
->
search_domain
(
$name
,
$import
);
return
if
!
$domain
;
next
if
!
$domain
;
warn
"
found domain
$name
";
my
$id
;
eval
{
$id
=
$domain
->
id
};
# TODO import the domain in the database with an _insert_db or something
warn
$@
if
$@
;
return
$domain
if
$id
||
$import
;
}
return
;
...
...
t/lxc/30_lxc_req.t
View file @
19e21c31
...
...
@@ -19,8 +19,10 @@ my ($NAME) = $0 =~ m{.*/(.*)\.t$};
sub
remove_old
{
for
(
1
..
$CONT
)
{
$vm_lxc
->
remove_domain
("
${NAME}
_
$CONT
");
for
(
0
..
$CONT
)
{
my
$name
=
"
${NAME}
_
$CONT
";
my
$domain
=
$vm_lxc
->
search_domain
(
$name
);
$domain
->
remove
if
$domain
;
}
}
...
...
@@ -50,12 +52,26 @@ sub test_new_req {
,"
Status of request is
"
.
$req
->
status
.
"
it should be done
");
ok
(
!
$req
->
error
,"
Error
"
.
$req
->
error
.
"
creating domain
"
.
$name
);
my
$domain
=
$RAVADA
->
search_domain
(
$name
);
ok
(
$domain
,"
No domain
$name
found
");
my
$domain_r
=
$RAVADA
->
search_domain
(
$name
);
ok
(
$domain_r
,"
No domain
$name
found in Ravada
");
my
$domain_lxc
=
$vm_lxc
->
search_domain
(
$name
);
ok
(
$domain_lxc
,"
No domain
$name
found in LXC
");
my
$domain
=
(
$domain_r
or
$domain_lxc
);
return
if
!
$domain
;
return
$domain
;
}
sub
test_vm_lxc
{
my
$found
=
0
;
for
my
$vm
(
@
{
$RAVADA
->
vm
})
{
$found
++
if
ref
(
$vm
)
eq
'
Ravada::VM::LXC
';
}
ok
(
$found
,"
LXC vm not found
"
.
join
("
,
",
@
{
$RAVADA
->
{
vm
}}));
}
################################################################
eval
{
$vm_lxc
=
Ravada::VM::
LXC
->
new
()
};
...
...
@@ -64,7 +80,9 @@ SKIP: {
my
$msg
=
"
No LXC backend found $@
";
diag
(
$msg
)
if
!
$vm_lxc
;
skip
(
$msg
,
10
)
if
!
$vm_lxc
;
remove_old
();
remove_old
();
test_vm_lxc
();
test_new_req
();
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment