white space cleanups

This commit is contained in:
Dietmar Maurer 2014-12-04 13:07:59 +01:00
parent 2ed5d5724c
commit 67fb9de608

View File

@ -2752,19 +2752,19 @@ sub config_to_command {
my $numa = parse_numa($conf->{"numa$i"}); my $numa = parse_numa($conf->{"numa$i"});
next if !$numa; next if !$numa;
# memory # memory
die "missing numa node$i memory value" if !$numa->{memory}; die "missing numa node$i memory value\n" if !$numa->{memory};
my $numa_memory = $numa->{memory}; my $numa_memory = $numa->{memory};
$numa_totalmemory += $numa_memory; $numa_totalmemory += $numa_memory;
my $numa_object = "memory-backend-ram,id=ram-node$i,size=$numa_memory"."M"; my $numa_object = "memory-backend-ram,id=ram-node$i,size=$numa_memory"."M";
# cpus # cpus
my $cpus_start = $numa->{cpus}->{start}; my $cpus_start = $numa->{cpus}->{start};
die "missing numa node$i cpus" if !defined($cpus_start); die "missing numa node$i cpus\n" if !defined($cpus_start);
my $cpus_end = $numa->{cpus}->{end} if defined($numa->{cpus}->{end}); my $cpus_end = $numa->{cpus}->{end} if defined($numa->{cpus}->{end});
my $cpus = $cpus_start; my $cpus = $cpus_start;
if (defined($cpus_end)) { if (defined($cpus_end)) {
$cpus .= "-$cpus_end"; $cpus .= "-$cpus_end";
die "numa node$i : cpu range $cpus is incorrect" if $cpus_end <= $cpus_start; die "numa node$i : cpu range $cpus is incorrect\n" if $cpus_end <= $cpus_start;
} }
# hostnodes # hostnodes
@ -2774,24 +2774,26 @@ sub config_to_command {
my $hostnodes = $hostnodes_start; my $hostnodes = $hostnodes_start;
if (defined($hostnodes_end)) { if (defined($hostnodes_end)) {
$hostnodes .= "-$hostnodes_end"; $hostnodes .= "-$hostnodes_end";
die "host node $hostnodes range is incorrect" if $hostnodes_end <= $hostnodes_start; die "host node $hostnodes range is incorrect\n" if $hostnodes_end <= $hostnodes_start;
} }
my $hostnodes_end_range = defined($hostnodes_end) ? $hostnodes_end : $hostnodes_start; my $hostnodes_end_range = defined($hostnodes_end) ? $hostnodes_end : $hostnodes_start;
for (my $i = $hostnodes_start; $i <= $hostnodes_end_range; $i++ ) { for (my $i = $hostnodes_start; $i <= $hostnodes_end_range; $i++ ) {
die "host numa node$i don't exist" if !(-d "/sys/devices/system/node/node$i/"); die "host numa node$i don't exist\n" if ! -d "/sys/devices/system/node/node$i/";
} }
# policy # policy
my $policy = $numa->{policy}; my $policy = $numa->{policy};
die "you need to define a policy for hostnode $hostnodes" if !$policy; die "you need to define a policy for hostnode $hostnodes\n" if !$policy;
$numa_object .= ",host-nodes=$hostnodes,policy=$policy"; $numa_object .= ",host-nodes=$hostnodes,policy=$policy";
} }
push @$cmd, '-object', $numa_object; push @$cmd, '-object', $numa_object;
push @$cmd, '-numa', "node,nodeid=$i,cpus=$cpus,memdev=ram-node$i"; push @$cmd, '-numa', "node,nodeid=$i,cpus=$cpus,memdev=ram-node$i";
} }
die "total memory for NUMA nodes must be equal to vm memory" if $numa_totalmemory && $numa_totalmemory != $memory;
die "total memory for NUMA nodes must be equal to vm memory\n"
if $numa_totalmemory && $numa_totalmemory != $memory;
#if no custom tology, we split memory and cores across numa nodes #if no custom tology, we split memory and cores across numa nodes
if(!$numa_totalmemory) { if(!$numa_totalmemory) {
@ -2813,8 +2815,6 @@ sub config_to_command {
push @$cmd, '-S' if $conf->{freeze}; push @$cmd, '-S' if $conf->{freeze};
# set keyboard layout # set keyboard layout
my $kb = $conf->{keyboard} || $defaults->{keyboard}; my $kb = $conf->{keyboard} || $defaults->{keyboard};
push @$cmd, '-k', $kb if $kb; push @$cmd, '-k', $kb if $kb;