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
968740ac
Commit
968740ac
authored
Jan 23, 2018
by
Francesc Guasch
Browse files
[#202] cache active VMs
parent
8e580696
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
968740ac
...
...
@@ -715,6 +715,7 @@ sub _upgrade_tables {
$self
->
_upgrade_table
('
vms
','
cached_active
',"
integer DEFAULT 0
");
$self
->
_upgrade_table
('
vms
','
cached_active_time
',"
integer DEFAULT 0
");
$self
->
_upgrade_table
('
vms
','
public_ip
',"
varchar(128) DEFAULT NULL
");
$self
->
_upgrade_table
('
vms
','
is_active
',"
int DEFAULT 0
");
$self
->
_upgrade_table
('
requests
','
at_time
','
int(11) DEFAULT NULL
');
$self
->
_upgrade_table
('
requests
','
pid
','
int(11) DEFAULT NULL
');
...
...
lib/Ravada/Front.pm
View file @
968740ac
...
...
@@ -298,7 +298,7 @@ Returns a list of Virtual Managers
sub
list_vms
($self, $type=undef) {
my
$sql
=
"
SELECT id,name,hostname,
status
FROM vms
";
my
$sql
=
"
SELECT id,name,hostname,
is_active
FROM vms
";
my
@args
=
();
if
(
$type
)
{
...
...
@@ -312,8 +312,6 @@ sub list_vms($self, $type=undef) {
my
@list
;
while
(
my
$row
=
$sth
->
fetchrow_hashref
)
{
$row
->
{
is_active
}
=
0
;
$row
->
{
is_active
}
=
1
if
$row
->
{
status
}
eq
'
active
';
my
$vm
=
$self
->
_vm_id
(
$row
->
{
id
});
$self
->
_list_bases_vm
(
$row
);
lock_hash
(
%$row
);
...
...
sql/mysql/vms.sql
View file @
968740ac
...
...
@@ -5,6 +5,7 @@ create table vms (
`hostname`
varchar
(
128
)
NOT
NULL
,
`default_storage`
varchar
(
64
)
DEFAULT
'default'
,
`security`
varchar
(
20
)
default
null
,
`is_active`
int
default
0
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`name`
(
`name`
),
UNIQUE
KEY
`hostname_type`
(
`hostname`
,
`vm_type`
)
...
...
t/kvm/n10_nodes.t
View file @
968740ac
...
...
@@ -763,7 +763,7 @@ sub test_shutdown($node) {
diag
("
SKIPPED: I can't test shutdown of
"
.
$node
->
type
.
"
nodes
");
}
is
(
$clone
->
is_active
,
0
,"
[
"
.
$clone
->
type
.
"
] Expecting clone
"
.
$clone
->
name
.
"
inactive
")
or
return
;
is
(
$clone
->
_data
('
is_
active
'
),
1
,"
[
"
.
$clone
->
type
.
"
] Expecting clone
"
.
$clone
->
name
.
"
data active
")
or
return
;
is
(
$clone
->
_data
('
status
'),'
active
',"
[
"
.
$clone
->
type
.
"
] Expecting clone
"
.
$clone
->
name
.
"
data active
")
or
return
;
my
$clone2
=
Ravada::
Domain
->
open
(
$clone
->
id
);
#open will clean internal shutdown
...
...
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