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
396cfaef
Commit
396cfaef
authored
Apr 06, 2017
by
Francesc Guasch
Browse files
[#168] Fixed critic suggestions
- Conditional declaring - Strict - Loop vars No big deal anyway
parent
722ab373
Changes
8
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
396cfaef
...
...
@@ -339,7 +339,7 @@ sub create_domain {
my
$vm_name
=
$args
{
vm
};
delete
$args
{
vm
};
my
$request
=
$args
{
request
}
if
$args
{
request
}
;
my
$request
=
(
$args
{
request
}
or
undef
)
;
my
$vm
;
if
(
$vm_name
)
{
...
...
@@ -805,7 +805,7 @@ sub list_vm_types {
my
(
$name
)
=
ref
(
$vm
)
=~
/.*::(.*)/
;
$type
{
$name
}
++
;
}
return
sort
keys
%type
;
return
keys
%type
;
}
sub
_execute
{
...
...
lib/Ravada/Domain/KVM.pm
View file @
396cfaef
...
...
@@ -135,7 +135,8 @@ sub _vol_remove {
my
$file
=
shift
;
my
$warning
=
shift
;
my
(
$name
)
=
$file
=~
m{.*/(.*)}
if
$file
=~
m{/}
;
my
$name
;
(
$name
)
=
$file
=~
m{.*/(.*)}
if
$file
=~
m{/}
;
#TODO: do a remove_volume in the VM
my
@vols
=
$self
->
_vm
->
storage_pool
->
list_volumes
();
...
...
lib/Ravada/Domain/Void.pm
View file @
396cfaef
...
...
@@ -297,7 +297,8 @@ sub disk_device {
sub
list_volumes
{
my
$self
=
shift
;
my
$data
=
LoadFile
(
$self
->
_config_file
)
if
-
e
$self
->
_config_file
;
my
$data
;
$data
=
LoadFile
(
$self
->
_config_file
)
if
-
e
$self
->
_config_file
;
return
()
if
!
exists
$data
->
{
device
};
my
@vol
;
...
...
@@ -310,13 +311,15 @@ sub list_volumes {
}
sub
list_volumes_target
{
my
$self
=
shift
;
my
$data
=
LoadFile
(
$self
->
_config_file
)
if
-
e
$self
->
_config_file
;
my
$self
=
shift
;
my
$data
;
$data
=
LoadFile
(
$self
->
_config_file
)
if
-
e
$self
->
_config_file
;
return
()
if
!
exists
$data
->
{
device
};
my
@vol
;
for
my
$dev
(
keys
%
{
$data
->
{
device
}})
{
my
$vol
=
(
$data
->
{
device
}
->
{
$dev
}
->
{
path
})
my
$vol
;
$vol
=
(
$data
->
{
device
}
->
{
$dev
}
->
{
path
})
if
!
exists
$data
->
{
device
}
->
{
$dev
}
->
{
type
}
||
$data
->
{
device
}
->
{
$dev
}
->
{
type
}
ne
'
base
';
next
if
!
$vol
;
...
...
lib/Ravada/Front.pm
View file @
396cfaef
...
...
@@ -556,7 +556,8 @@ sub list_requests {
$sth
->
bind_columns
(
\
(
$id
,
$command
,
$j_args
,
$date_changed
,
$status
,
$error
));
while
(
$sth
->
fetch
)
{
my
$args
=
decode_json
(
$j_args
)
if
$j_args
;
my
$args
;
$args
=
decode_json
(
$j_args
)
if
$j_args
;
push
@reqs
,{
id
=>
$id
,
command
=>
$command
,
date_changed
=>
$date_changed
,
status
=>
$status
,
error
=>
$error
,
name
=>
$args
->
{
name
}};
}
...
...
lib/Ravada/I18N.pm
View file @
396cfaef
package
Ravada::
I18N
;
use
warnings
;
use
strict
;
use
base
'
Locale::Maketext
';
use
File::
Basename
qw/dirname/
;
use
Locale::Maketext::
Lexicon
{
...
...
lib/Ravada/Request.pm
View file @
396cfaef
...
...
@@ -114,8 +114,8 @@ sub open {
confess
"
I can't find id=
$id
"
if
!
defined
$row
;
$sth
->
finish
;
my
$args
=
decode_json
(
$row
->
{
args
})
if
$row
->
{
args
};
$args
=
{}
if
!
$
args
;
my
$args
=
{
};
$args
=
decode_json
(
$row
->
{
args
})
if
$row
->
{
args
}
;
$row
->
{
args
}
=
$args
;
...
...
lib/Ravada/VM/KVM.pm
View file @
396cfaef
...
...
@@ -434,7 +434,8 @@ sub _domain_create_from_iso {
my
$device_cdrom
=
$self
->
_iso_name
(
$iso
,
$args
{
request
});
my
$disk_size
=
$args
{
disk
}
if
$args
{
disk
};
my
$disk_size
;
$disk_size
=
$args
{
disk
}
if
$args
{
disk
};
my
$file_xml
=
$DIR_XML
.
"
/
"
.
$iso
->
{
xml_volume
};
...
...
@@ -594,7 +595,7 @@ sub _domain_create_from_base {
die
"
Domain
$args
{name} already exists
"
if
$self
->
search_domain
(
$args
{
name
});
my
$base
=
$args
{
base
}
if
$args
{
base
};
my
$base
=
$args
{
base
};
$base
=
$self
->
_search_domain_by_id
(
$args
{
id_base
})
if
$args
{
id_base
};
confess
"
Unknown base id:
$args
{id_base}
"
if
!
$base
;
...
...
@@ -1013,17 +1014,17 @@ sub _xml_add_usb_ehci1 {
my
$devices
= shift;
my
$model
= 'ich9-ehci1';
my
$ctrl
= _search_xml(
my
$ctrl
_found
= _search_xml(
xml =>
$devices
,name => 'controller'
,type => 'usb'
,model =>
$model
);
if (
$ctrl
) {
if (
$ctrl
_found
) {
# warn
"
$model
found
\
n
"
.
$ctrl
->toString.
"
\
n
"
;
return;
}
for
$ctrl
(
$devices
->findnodes('controller')) {
for
my
$ctrl
(
$devices
->findnodes('controller')) {
next if
$ctrl
->getAttribute('type') ne 'usb';
next if
$ctrl
->getAttribute('model')
&&
$ctrl
->getAttribute('model') eq
$model
;
...
...
lib/Ravada/VM/Void.pm
View file @
396cfaef
...
...
@@ -84,7 +84,7 @@ sub list_domains {
closedir
$ls
;
return
sort
keys
%domain
;
return
keys
%domain
;
}
sub
search_domain
{
...
...
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