Drop the double 'dm' from dm_node functions
Add basic tests for device mapper functions

Also fix an issue revealed by the tests.