(maint) Add the last boot time for each pool

This commit add a redis hash where there is one key per pool, and the
stored value is the last time a VM was booted e.g. the last time
a VM went from 'pending' to 'ready'. This is also displayed in the
API as lastBoot:'2018-03-23 17:43:39 +0000'. The data can then be
used by any external system, in this case our alarming system.
This commit is contained in:
Samuel Beaulieu 2018-03-23 12:48:33 -05:00 committed by mattkirby
parent d57fc72fdb
commit 10245321bf
3 changed files with 22 additions and 11 deletions

View file

@ -222,6 +222,12 @@ EOT
redis.hset("vmpooler__vm__#{vm}", 'clone','iamnotparsable_asdate')
expect{subject.move_pending_vm_to_ready(vm, pool, host)}.to raise_error(/iamnotparsable_asdate/)
end
it 'should save the last boot time' do
expect(redis.hget('vmpooler__lastboot', pool)).to be(nil)
subject.move_pending_vm_to_ready(vm, pool, host)
expect(redis.hget('vmpooler__lastboot', pool)).to_not be(nil)
end
end
end