|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 3/3] resource allocation: PropEq, PropMinVer: support defaults
Now you can pass another :-separated argument, the default value to
use if none is specified.
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Roger Pau Monné <royger@xxxxxxxxxxx>
---
Osstest/ResourceCondition/PropCompareBase.pm | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Osstest/ResourceCondition/PropCompareBase.pm
b/Osstest/ResourceCondition/PropCompareBase.pm
index e1efe5f..5aff8f3 100644
--- a/Osstest/ResourceCondition/PropCompareBase.pm
+++ b/Osstest/ResourceCondition/PropCompareBase.pm
@@ -34,13 +34,14 @@ BEGIN {
}
sub new {
- my ($class, $name, $prop, $val) = @_;
+ my ($class, $name, $prop, $val, $defval) = @_;
die "propname: $prop?" unless propname_check($prop);
return bless {
Prop => $prop,
- Val => $val
+ Val => $val,
+ DefaultVal => $val,
}, $class;
}
@@ -64,7 +65,11 @@ END
$hpropq->finish();
my $v = $row->[0];
- return $v;
+ return $v if defined $v;
+
+ return $pc->{DefaultVal};
+ # if no default specified, returns undef
+ # then _check gets to decide what to do
}
sub check {
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |