mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 21:14:59 +00:00
tree wide cleanup of s/return undef/return/
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
d0abc7746a
commit
d1c1af4b02
@ -1345,7 +1345,7 @@ my $update_vm_api = sub {
|
||||
|
||||
if ($sync) {
|
||||
&$worker();
|
||||
return undef;
|
||||
return;
|
||||
} else {
|
||||
my $upid = $rpcenv->fork_worker('qmconfig', $vmid, $authuser, $worker);
|
||||
|
||||
@ -1367,7 +1367,7 @@ my $update_vm_api = sub {
|
||||
|
||||
if (!$running) {
|
||||
my $status = PVE::Tools::upid_read_status($upid);
|
||||
return undef if $status eq 'OK';
|
||||
return if $status eq 'OK';
|
||||
die $status;
|
||||
}
|
||||
}
|
||||
@ -1490,7 +1490,7 @@ __PACKAGE__->register_method({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
&$update_vm_api($param, 1);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@ -1621,7 +1621,7 @@ __PACKAGE__->register_method({
|
||||
|
||||
__PACKAGE__->update_vm($param);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
# uses good entropy, each char is limited to 6 bit to get printable chars simply
|
||||
@ -3821,7 +3821,7 @@ __PACKAGE__->register_method({
|
||||
};
|
||||
|
||||
PVE::QemuConfig->lock_config($vmid, $updatefn);
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
@ -4041,7 +4041,7 @@ __PACKAGE__->register_method({
|
||||
|
||||
my $snapname = extract_param($param, 'snapname');
|
||||
|
||||
return undef if !defined($param->{description});
|
||||
return if !defined($param->{description});
|
||||
|
||||
my $updatefn = sub {
|
||||
|
||||
@ -4060,7 +4060,7 @@ __PACKAGE__->register_method({
|
||||
|
||||
PVE::QemuConfig->lock_config($vmid, $updatefn);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
@ -4262,7 +4262,7 @@ __PACKAGE__->register_method({
|
||||
};
|
||||
|
||||
PVE::QemuConfig->lock_config($vmid, $updatefn);
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
|
@ -486,7 +486,7 @@ __PACKAGE__->register_method({
|
||||
my $write = agent_cmd($vmid, "file-write", { handle => $qgafh, 'buf-b64' => $buf }, "can't write to file");
|
||||
my $res = agent_cmd($vmid, "file-close", { handle => $qgafh }, "can't close file");
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
1;
|
||||
|
@ -155,7 +155,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
print "$cmdline\n";
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -194,7 +194,7 @@ __PACKAGE__->register_method ({
|
||||
print "status: $status\n";
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -227,7 +227,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
run_vnc_proxy($vnc_socket);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -254,7 +254,7 @@ __PACKAGE__->register_method ({
|
||||
PVE::QemuConfig->write_config($vmid, $conf);
|
||||
});
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -277,7 +277,7 @@ __PACKAGE__->register_method ({
|
||||
eval { PVE::QemuServer::nbd_stop($vmid) };
|
||||
warn $@ if $@;
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -295,7 +295,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
if (!PVE::Cluster::check_cfs_quorum(1)) {
|
||||
print "no quorum\n";
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my $tunnel_write = sub {
|
||||
@ -328,7 +328,7 @@ __PACKAGE__->register_method ({
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -368,7 +368,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
die "wait failed - got timeout\n" if PVE::QemuServer::check_running ($vmid);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -408,7 +408,7 @@ __PACKAGE__->register_method ({
|
||||
print "ERROR: $@" if $@;
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
|
||||
}});
|
||||
|
||||
@ -442,7 +442,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
PVE::QemuServer::rescan($param->{vmid}, 0, $dryrun);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -497,7 +497,7 @@ __PACKAGE__->register_method ({
|
||||
my ($drive_id, $volid) = PVE::QemuServer::ImportDisk::do_import($source, $vmid, $storeid, { format => $format });
|
||||
print "Successfully imported disk as '$drive_id:$volid'\n";
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -574,7 +574,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
system($cmd);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -672,7 +672,7 @@ __PACKAGE__->register_method ({
|
||||
|
||||
PVE::QemuConfig->remove_lock($vmid, "create");
|
||||
|
||||
return undef;
|
||||
return;
|
||||
|
||||
}
|
||||
});
|
||||
@ -836,7 +836,7 @@ __PACKAGE__->register_method({
|
||||
});
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}});
|
||||
|
||||
my $print_agent_result = sub {
|
||||
|
@ -80,7 +80,7 @@ sub queue_cmd {
|
||||
|
||||
&$push_cmd_to_queue($self, $vmid, $cmd);
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
# execute a single command
|
||||
@ -164,7 +164,7 @@ my $lookup_queue_info = sub {
|
||||
my $queue_info = $self->{queue_lookup}->{$fh};
|
||||
if (!$queue_info) {
|
||||
warn "internal error - unable to lookup queue info" if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
return $queue_info;
|
||||
};
|
||||
|
@ -95,7 +95,7 @@ sub parse_volume {
|
||||
if ($key eq 'vmstate') {
|
||||
eval { PVE::JSONSchema::check_format('pve-volume-id', $volume_string) };
|
||||
if (my $err = $@) {
|
||||
return undef if $noerr;
|
||||
return if $noerr;
|
||||
die $err;
|
||||
}
|
||||
$volume = { 'file' => $volume_string };
|
||||
|
@ -997,7 +997,7 @@ sub verify_volume_id_or_qm_path {
|
||||
# if its neither 'none' nor 'cdrom' nor a path, check if its a volume-id
|
||||
$volid = eval { PVE::JSONSchema::check_format('pve-volume-id', $volid, '') };
|
||||
if ($@) {
|
||||
return undef if $noerr;
|
||||
return if $noerr;
|
||||
die $@;
|
||||
}
|
||||
return $volid;
|
||||
@ -1142,7 +1142,7 @@ sub verify_bootdev {
|
||||
return $dev if $check->("usb");
|
||||
return $dev if $check->("hostpci");
|
||||
|
||||
return undef if $noerr;
|
||||
return if $noerr;
|
||||
die "invalid boot device '$dev'\n";
|
||||
}
|
||||
|
||||
@ -1158,7 +1158,7 @@ sub kvm_version {
|
||||
return $kvm_api_version if $kvm_api_version;
|
||||
|
||||
open my $fh, '<', '/dev/kvm'
|
||||
or return undef;
|
||||
or return;
|
||||
|
||||
# 0xae00 => KVM_GET_API_VERSION
|
||||
$kvm_api_version = ioctl($fh, 0xae00, 0);
|
||||
@ -1241,7 +1241,7 @@ sub filename_to_volume_id {
|
||||
if (!($file eq 'none' || $file eq 'cdrom' ||
|
||||
$file =~ m|^/dev/.+| || $file =~ m/^([^:]+):(.+)$/)) {
|
||||
|
||||
return undef if $file =~ m|/|;
|
||||
return if $file =~ m|/|;
|
||||
|
||||
if ($media && $media eq 'cdrom') {
|
||||
$file = "local:iso/$file";
|
||||
@ -1317,7 +1317,7 @@ sub pve_verify_hotplug_features {
|
||||
|
||||
return $value if parse_hotplug_features($value);
|
||||
|
||||
return undef if $noerr;
|
||||
return if $noerr;
|
||||
|
||||
die "unable to parse hotplug option\n";
|
||||
}
|
||||
@ -1332,12 +1332,12 @@ sub scsi_inquiry {
|
||||
my $ret = ioctl($fh, $SG_GET_VERSION_NUM, $versionbuf);
|
||||
if (!$ret) {
|
||||
die "scsi ioctl SG_GET_VERSION_NUM failoed - $!\n" if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $version = unpack("I", $versionbuf);
|
||||
if ($version < 30000) {
|
||||
die "scsi generic interface too old\n" if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my $buf = "\x00" x 36;
|
||||
@ -1354,13 +1354,13 @@ sub scsi_inquiry {
|
||||
$ret = ioctl($fh, $SG_IO, $packet);
|
||||
if (!$ret) {
|
||||
die "scsi ioctl SG_IO failed - $!\n" if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my @res = unpack($sg_io_hdr_t, $packet);
|
||||
if ($res[17] || $res[18]) {
|
||||
die "scsi ioctl SG_IO status error - $!\n" if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my $res = {};
|
||||
@ -1376,7 +1376,7 @@ sub scsi_inquiry {
|
||||
sub path_is_scsi {
|
||||
my ($path) = @_;
|
||||
|
||||
my $fh = IO::File->new("+<$path") || return undef;
|
||||
my $fh = IO::File->new("+<$path") || return;
|
||||
my $res = scsi_inquiry($fh, 1);
|
||||
close($fh);
|
||||
|
||||
@ -1402,7 +1402,7 @@ sub print_tabletdevice_full {
|
||||
sub print_keyboarddevice_full {
|
||||
my ($conf, $arch, $machine) = @_;
|
||||
|
||||
return undef if $arch ne 'aarch64';
|
||||
return if $arch ne 'aarch64';
|
||||
|
||||
return "usb-kbd,id=keyboard,bus=ehci.0,port=2";
|
||||
}
|
||||
@ -1506,7 +1506,7 @@ sub print_drivedevice_full {
|
||||
sub get_initiator_name {
|
||||
my $initiator;
|
||||
|
||||
my $fh = IO::File->new('/etc/iscsi/initiatorname.iscsi') || return undef;
|
||||
my $fh = IO::File->new('/etc/iscsi/initiatorname.iscsi') || return;
|
||||
while (defined(my $line = <$fh>)) {
|
||||
next if $line !~ m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
|
||||
$initiator = $1;
|
||||
@ -1798,7 +1798,7 @@ sub parse_net {
|
||||
my $res = eval { parse_property_string($net_fmt, $data) };
|
||||
if ($@) {
|
||||
warn $@;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
if (!defined($res->{macaddr})) {
|
||||
my $dc = PVE::Cluster::cfs_read_file('datacenter.cfg');
|
||||
@ -1814,25 +1814,25 @@ sub parse_ipconfig {
|
||||
my $res = eval { parse_property_string($ipconfig_fmt, $data) };
|
||||
if ($@) {
|
||||
warn $@;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($res->{gw} && !$res->{ip}) {
|
||||
warn 'gateway specified without specifying an IP address';
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
if ($res->{gw6} && !$res->{ip6}) {
|
||||
warn 'IPv6 gateway specified without specifying an IPv6 address';
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
if ($res->{gw} && $res->{ip} eq 'dhcp') {
|
||||
warn 'gateway specified together with DHCP';
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
if ($res->{gw6} && $res->{ip6} !~ /^$IPV6RE/) {
|
||||
# gw6 + auto/dhcp
|
||||
warn "IPv6 gateway specified together with $res->{ip6} address";
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$res->{ip} && !$res->{ip6}) {
|
||||
@ -1870,7 +1870,7 @@ sub vm_is_volid_owner {
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub vmconfig_register_unused_drive {
|
||||
@ -1963,7 +1963,7 @@ PVE::JSONSchema::register_format('pve-qm-smbios1', $smbios1_fmt);
|
||||
sub parse_watchdog {
|
||||
my ($value) = @_;
|
||||
|
||||
return undef if !$value;
|
||||
return if !$value;
|
||||
|
||||
my $res = eval { parse_property_string($watchdog_fmt, $value) };
|
||||
warn $@ if $@;
|
||||
@ -1995,7 +1995,7 @@ sub parse_vga {
|
||||
sub parse_rng {
|
||||
my ($value) = @_;
|
||||
|
||||
return undef if !$value;
|
||||
return if !$value;
|
||||
|
||||
my $res = eval { parse_property_string($rng_fmt, $value) };
|
||||
warn $@ if $@;
|
||||
@ -2008,7 +2008,7 @@ sub verify_usb_device {
|
||||
|
||||
return $value if parse_usb_device($value);
|
||||
|
||||
return undef if $noerr;
|
||||
return if $noerr;
|
||||
|
||||
die "unable to parse usb device\n";
|
||||
}
|
||||
@ -2124,7 +2124,7 @@ sub destroy_vm {
|
||||
sub parse_vm_config {
|
||||
my ($filename, $raw) = @_;
|
||||
|
||||
return undef if !defined($raw);
|
||||
return if !defined($raw);
|
||||
|
||||
my $res = {
|
||||
digest => Digest::SHA::sha1_hex($raw),
|
||||
@ -2778,7 +2778,7 @@ sub conf_has_audio {
|
||||
|
||||
$id //= 0;
|
||||
my $audio = $conf->{"audio$id"};
|
||||
return undef if !defined($audio);
|
||||
return if !defined($audio);
|
||||
|
||||
my $audioproperties = parse_property_string($audio_fmt, $audio);
|
||||
my $audiodriver = $audioproperties->{driver} // 'spice';
|
||||
@ -3775,7 +3775,7 @@ sub vm_deviceplug {
|
||||
|
||||
} elsif ($deviceid =~ m/^(net)(\d+)$/) {
|
||||
|
||||
return undef if !qemu_netdevadd($vmid, $conf, $arch, $device, $deviceid);
|
||||
return if !qemu_netdevadd($vmid, $conf, $arch, $device, $deviceid);
|
||||
|
||||
my $machine_type = PVE::QemuServer::Machine::qemu_machine_pxe($vmid, $conf);
|
||||
my $use_old_bios_files = undef;
|
||||
@ -4586,7 +4586,7 @@ sub try_deallocate_drive {
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub vmconfig_delete_or_detach_drive {
|
||||
@ -6593,7 +6593,7 @@ sub do_snapshots_with_qemu {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub qga_check_running {
|
||||
|
@ -30,7 +30,7 @@ sub check_agent_error {
|
||||
die $error if !$noerr;
|
||||
|
||||
warn $error;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -47,7 +47,7 @@ sub agent_available {
|
||||
|
||||
if (my $err = $@) {
|
||||
die $err if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -170,12 +170,12 @@ sub parse_phys_bits {
|
||||
|
||||
if ($str !~ m/^(host|\d{1,2})$/) {
|
||||
die $err_msg if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($str =~ m/^\d+$/ && (int($str) < 8 || int($str) > 64)) {
|
||||
die $err_msg if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
return $str;
|
||||
@ -246,7 +246,7 @@ sub parse_section_header {
|
||||
my ($type, $sectionId, $errmsg, $config) =
|
||||
$class->SUPER::parse_section_header($line);
|
||||
|
||||
return undef if !$type;
|
||||
return if !$type;
|
||||
return ($type, $sectionId, $errmsg, {
|
||||
# name is given by section header, and we can always prepend 'custom-'
|
||||
# since we're reading the custom CPU file
|
||||
@ -331,7 +331,7 @@ sub get_custom_model {
|
||||
my $entry = $conf->{ids}->{$name};
|
||||
if (!defined($entry)) {
|
||||
die "Custom cputype '$name' not found\n" if !$noerr;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = {};
|
||||
|
@ -395,7 +395,7 @@ sub verify_bootdisk {
|
||||
|
||||
return $value if is_valid_drivename($value);
|
||||
|
||||
return undef if $noerr;
|
||||
return if $noerr;
|
||||
|
||||
die "invalid boot disk '$value'\n";
|
||||
}
|
||||
@ -428,17 +428,17 @@ sub parse_drive {
|
||||
$interface = $1;
|
||||
$index = $2;
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!defined($drivedesc_hash->{$key})) {
|
||||
warn "invalid drive key: $key\n";
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my $desc = $drivedesc_hash->{$key}->{format};
|
||||
my $res = eval { PVE::JSONSchema::parse_property_string($desc, $data) };
|
||||
return undef if !$res;
|
||||
return if !$res;
|
||||
$res->{interface} = $interface;
|
||||
$res->{index} = $index;
|
||||
|
||||
@ -475,21 +475,21 @@ sub parse_drive {
|
||||
}
|
||||
}
|
||||
|
||||
return undef if $error;
|
||||
return if $error;
|
||||
|
||||
return undef if $res->{mbps_rd} && $res->{mbps};
|
||||
return undef if $res->{mbps_wr} && $res->{mbps};
|
||||
return undef if $res->{iops_rd} && $res->{iops};
|
||||
return undef if $res->{iops_wr} && $res->{iops};
|
||||
return if $res->{mbps_rd} && $res->{mbps};
|
||||
return if $res->{mbps_wr} && $res->{mbps};
|
||||
return if $res->{iops_rd} && $res->{iops};
|
||||
return if $res->{iops_wr} && $res->{iops};
|
||||
|
||||
if ($res->{media} && ($res->{media} eq 'cdrom')) {
|
||||
return undef if $res->{snapshot} || $res->{trans} || $res->{format};
|
||||
return undef if $res->{heads} || $res->{secs} || $res->{cyls};
|
||||
return undef if $res->{interface} eq 'virtio';
|
||||
return if $res->{snapshot} || $res->{trans} || $res->{format};
|
||||
return if $res->{heads} || $res->{secs} || $res->{cyls};
|
||||
return if $res->{interface} eq 'virtio';
|
||||
}
|
||||
|
||||
if (my $size = $res->{size}) {
|
||||
return undef if !defined($res->{size} = PVE::JSONSchema::parse_size($size));
|
||||
return if !defined($res->{size} = PVE::JSONSchema::parse_size($size));
|
||||
}
|
||||
|
||||
return $res;
|
||||
@ -521,19 +521,19 @@ sub bootdisk_size {
|
||||
my ($storecfg, $conf) = @_;
|
||||
|
||||
my $bootdisks = get_bootdisks($conf);
|
||||
return undef if !@$bootdisks;
|
||||
return if !@$bootdisks;
|
||||
my $bootdisk = $bootdisks->[0];
|
||||
return undef if !is_valid_drivename($bootdisk);
|
||||
return if !is_valid_drivename($bootdisk);
|
||||
|
||||
return undef if !$conf->{$bootdisk};
|
||||
return if !$conf->{$bootdisk};
|
||||
|
||||
my $drive = parse_drive($bootdisk, $conf->{$bootdisk});
|
||||
return undef if !defined($drive);
|
||||
return if !defined($drive);
|
||||
|
||||
return undef if drive_is_cdrom($drive);
|
||||
return if drive_is_cdrom($drive);
|
||||
|
||||
my $volid = $drive->{file};
|
||||
return undef if !$volid;
|
||||
return if !$volid;
|
||||
|
||||
return $drive->{size};
|
||||
}
|
||||
@ -541,7 +541,7 @@ sub bootdisk_size {
|
||||
sub update_disksize {
|
||||
my ($drive, $newsize) = @_;
|
||||
|
||||
return undef if !defined($newsize);
|
||||
return if !defined($newsize);
|
||||
|
||||
my $oldsize = $drive->{size} // 0;
|
||||
|
||||
@ -556,7 +556,7 @@ sub update_disksize {
|
||||
return ($drive, $msg);
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub is_volume_in_use {
|
||||
@ -609,7 +609,7 @@ sub resolve_first_disk {
|
||||
next if drive_is_cdrom($disk) xor $cdrom;
|
||||
return $ds;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -45,7 +45,7 @@ sub parse_cmdline {
|
||||
if (defined($fh)) {
|
||||
my $line = <$fh>;
|
||||
$fh->close;
|
||||
return undef if !$line;
|
||||
return if !$line;
|
||||
my @param = split(/\0/, $line);
|
||||
|
||||
my $cmd = $param[0];
|
||||
@ -70,7 +70,7 @@ sub parse_cmdline {
|
||||
|
||||
return $phash;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub vm_running_locally {
|
||||
@ -100,7 +100,7 @@ sub vm_running_locally {
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub min_version {
|
||||
|
@ -54,7 +54,7 @@ sub extract_version {
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub machine_version {
|
||||
|
@ -62,7 +62,7 @@ sub find_by {
|
||||
return ($resource);
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
sub dtmf_name_to_id {
|
||||
@ -71,7 +71,7 @@ sub dtmf_name_to_id {
|
||||
if ($found) {
|
||||
return $found->{id};
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ sub id_to_pve {
|
||||
if ($resource) {
|
||||
return $resource->{pve_type};
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ my $get_addr_mapping_from_id = sub {
|
||||
my ($map, $id) = @_;
|
||||
|
||||
my $d = $map->{$id};
|
||||
return undef if !defined($d) || !defined($d->{bus}) || !defined($d->{addr});
|
||||
return if !defined($d) || !defined($d->{bus}) || !defined($d->{addr});
|
||||
|
||||
return { bus => $d->{bus}, addr => sprintf("0x%x", $d->{addr}) };
|
||||
};
|
||||
@ -342,7 +342,7 @@ sub print_pcie_root_port {
|
||||
sub parse_hostpci {
|
||||
my ($value) = @_;
|
||||
|
||||
return undef if !$value;
|
||||
return if !$value;
|
||||
|
||||
my $res = PVE::JSONSchema::parse_property_string($hostpci_fmt, $value);
|
||||
|
||||
|
@ -15,7 +15,7 @@ get_usb_devices
|
||||
sub parse_usb_device {
|
||||
my ($value) = @_;
|
||||
|
||||
return undef if !$value;
|
||||
return if !$value;
|
||||
|
||||
my $res = {};
|
||||
if ($value =~ m/^(0x)?([0-9A-Fa-f]{4}):(0x)?([0-9A-Fa-f]{4})$/) {
|
||||
@ -27,7 +27,7 @@ sub parse_usb_device {
|
||||
} elsif ($value =~ m/^spice$/i) {
|
||||
$res->{spice} = 1;
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
@ -399,10 +399,10 @@ $qemu_config_module->mock('assert_config_exists_on_node', \&assert_config_exists
|
||||
# ignore existing replication config
|
||||
my $repl_config_module = new Test::MockModule('PVE::ReplicationConfig');
|
||||
$repl_config_module->mock('new' => sub { return bless {}, "PVE::ReplicationConfig" });
|
||||
$repl_config_module->mock('check_for_existing_jobs' => sub { return undef });
|
||||
$repl_config_module->mock('check_for_existing_jobs' => sub { return });
|
||||
|
||||
my $storage_module = new Test::MockModule('PVE::Storage');
|
||||
$storage_module->mock('config', sub { return undef; });
|
||||
$storage_module->mock('config', sub { return; });
|
||||
$storage_module->mock('path', sub { return "/some/store/statefile/path"; });
|
||||
$storage_module->mock('activate_volumes', \&mocked_activate_volumes);
|
||||
$storage_module->mock('deactivate_volumes', \&mocked_deactivate_volumes);
|
||||
|
Loading…
Reference in New Issue
Block a user