Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
e931e05b
Commit
e931e05b
authored
Jul 04, 2016
by
fv3rdugo
Browse files
List LXC templates
parent
19e21c31
Changes
6
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
e931e05b
...
...
@@ -350,6 +350,37 @@ sub list_images_data {
}
sub
list_images_lxc
{
my
$self
=
shift
;
my
@domains
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
(
"
SELECT * FROM lx_templates ORDER BY name
"
);
$sth
->
execute
;
while
(
my
$row
=
$sth
->
fetchrow_hashref
)
{
push
@domains
,(
$row
);
}
$sth
->
finish
;
return
@domains
;
}
=head2 list_images_data
List information about the images
=cut
sub
list_images_data_lxc
{
my
$self
=
shift
;
my
@data
;
for
(
$self
->
list_images_lxc
)
{
push
@data
,{
id
=>
$_
->
{
id
}
,
name
=>
$_
->
{
name
}
};
}
return
\
@data
;
}
=head2 remove_volume
$ravada->remove_volume($file);
...
...
lib/Ravada/VM/LXC.pm
View file @
e931e05b
...
...
@@ -96,10 +96,10 @@ sub _search_template {
my
$self
=
shift
;
my
$id_template
=
shift
or
confess
"
Missing id_template
";
my
$sth
=
$$CONNECTOR
->
dbh
->
prepare
("
SELECT * FROM lx
c
_templates WHERE id = ?
");
my
$sth
=
$$CONNECTOR
->
dbh
->
prepare
("
SELECT * FROM lx_templates WHERE id = ?
");
$sth
->
execute
(
$id_template
);
my
$row
=
$sth
->
fetchrow_hashref
;
die
"
Missing lx
c
_template id=
$id_template
"
if
!
keys
%$row
;
die
"
Missing lx_template id=
$id_template
"
if
!
keys
%$row
;
lock_hash
(
%$row
);
return
$row
;
...
...
public/js/ravada.js
View file @
e931e05b
...
...
@@ -24,6 +24,9 @@
$http
.
get
(
'
/list_vm_types.json
'
).
then
(
function
(
response
)
{
$scope
.
backends
=
response
.
data
;
});
$http
.
get
(
'
/list_templates.json
'
).
then
(
function
(
response
)
{
$scope
.
templates_lxc
=
response
.
data
;
});
};
...
...
public/templates/new_machine.html
View file @
e931e05b
...
...
@@ -57,8 +57,8 @@
<label
for=
"id_template"
>
Template
</label>
<select
name =
"id_template"
ng-model=
"id_template"
ng-options=
"item.name for item in templates_lxc track by item.id"
required=
""
>
<option
label=
"busybox"
value=
"busybox"
>
busybox
</option>
</select>
</div><br/>
...
...
@@ -120,4 +120,4 @@
</form>
</div>
</div>
\ No newline at end of file
</div>
rvd_front.pl
View file @
e931e05b
...
...
@@ -115,6 +115,12 @@ get '/list_machines.json' => sub {
$c
->
render
(
json
=>
$RAVADA
->
list_domains_data
);
};
get
'
/list_templates.json
'
=>
sub
{
my
$c
=
shift
;
$c
->
render
(
json
=>
$RAVADA
->
list_images_data_lxc
);
};
# machine commands
get
'
/machine/manage/*html
'
=>
sub
{
...
...
t/kvm/20_domain_kvm.t
View file @
e931e05b
...
...
@@ -53,7 +53,8 @@ sub test_remove_domain_by_name {
}
sub
search_domain_db
{
sub
search_domain_db
{
my
$name
=
shift
;
my
$sth
=
$test
->
dbh
->
prepare
("
SELECT * FROM domains WHERE name=?
");
$sth
->
execute
(
$name
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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