Commit d6cc980d authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Merge branch 'stable-2.7' into stable-2.8



* stable-2.7
  Make shrinkByType aware of individual disks
  Add a test for hspace to respect instance policy

Conflicts: (trival, take union of added files/tests)
	Makefile.am
	test/hs/shelltests/htools-hspace.test

Semantic conflicts:
	test/data/htools/hspace-tiered-ipolicy.data
	(adapt to changed text format)
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parents 96357135 6b502fa3
......@@ -1035,6 +1035,7 @@ TEST_FILES = \
test/data/htools/hbal-excl-tags.data \
test/data/htools/hbal-split-insts.data \
test/data/htools/hspace-tiered-dualspec.data \
test/data/htools/hspace-tiered-ipolicy.data \
test/data/htools/hspace-tiered.data \
test/data/htools/invalid-node.data \
test/data/htools/missing-resources.data \
......
......@@ -249,10 +249,12 @@ shrinkByType inst T.FailMem = let v = mem inst - T.unitMem
in if v < T.unitMem
then Bad "out of memory"
else Ok inst { mem = v }
shrinkByType inst T.FailDisk = let v = dsk inst - T.unitDsk
in if v < T.unitDsk
shrinkByType inst T.FailDisk =
let newdisks = map (flip (-) T.unitDsk) $ disks inst
v = dsk inst - (length . disks $ inst) * T.unitDsk
in if any (< T.unitDsk) newdisks
then Bad "out of disk"
else Ok inst { dsk = v }
else Ok inst { dsk = v, disks = newdisks }
shrinkByType inst T.FailCPU = let v = vcpus inst - T.unitCpu
in if v < T.unitCpu
then Bad "out of vcpus"
......
group-01|fake-uuid-01|preferred|
node-01-001|2000|200|1800|4300|4300|8|N|fake-uuid-01
node-01-002|2000|4|1996|3900|3900|8|N|fake-uuid-01
node-01-003|2000|4|1996|3900|3900|8|N|fake-uuid-01
node-01-004|2000|4|1996|3900|3900|8|N|fake-uuid-01
|936,4,1064,1,1,1|900,4,2200,1,1,1;1000,4,2600,16,8,12|plain,diskless,file,sharedfile,blockdev,drbd,rbd,ext|4.0|32.0
group-01|900,4,2200,1,1,1|900,4,2200,1,1,1;1000,4,2600,16,8,12|plain,diskless,file,sharedfile,blockdev,drbd,rbd,ext|4.0|32.0
......@@ -178,7 +178,7 @@ prop_shrinkDG inst =
prop_shrinkDF :: Instance.Instance -> Property
prop_shrinkDF inst =
forAll (choose (0, 2 * Types.unitDsk - 1)) $ \dsk ->
let inst' = inst { Instance.dsk = dsk }
let inst' = inst { Instance.dsk = dsk, Instance.disks = [dsk] }
in isBad $ Instance.shrinkByType inst' Types.FailDisk
prop_setMovable :: Instance.Instance -> Bool -> Property
......
......@@ -15,3 +15,18 @@
./test/hs/hspace --machine-readable -t $TESTDATA_DIR/hspace-tiered-dualspec.data > $T/capacity && sh -c ". $T/capacity && test \"\${HTS_TSPEC}\" = '131072,1048576,4=4 129984,1048320,4=2 65472,524288,2=2' && test \"\${HTS_ALLOC_INSTANCES}\" = 14"
>>>2
>>>=0
# Verify that instance policy for disks is adhered to
./test/hs/hspace --machine-readable -t $TESTDATA_DIR/hspace-tiered-ipolicy.data
>>>/HTS_TRL_INST_CNT=4/
>>>=0
# ...and instance positioning in human-readable form
./test/hs/hspace -pname,pcnt -t $TESTDATA_DIR/hspace-tiered-ipolicy.data
>>>2/Tiered allocation status:
Name pcnt
node-01-001 1
node-01-002 1
node-01-003 1
node-01-004 1/
>>>=0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment