On debian wheezy its mount output uses device-by-label and makes
our normal method of checking if a device is mounted not work.
Since vm's will always be vda for their boot device we will just
remove it from devs if its in there so it doesn't attempt to zap
vda.
I also added a strip() to remove the last blank entry that was
always getting added to the devs list on all machines. Example:
devs=['/dev/sda', '/dev/sdb', '/dev/sdc', '/dev/sdd', '']
Signed-off-by: Sandon Van Ness <sandon@inktank.com>
Reviewed-by: Alfredo Deza <alfredo@deza.pe>
args=['ls', run.Raw('/dev/[sv]d?')],
stdout=StringIO()
)
- devs = r.stdout.getvalue().split('\n')
+ devs = r.stdout.getvalue().strip().split('\n')
+
+ #Remove root device (vm guests) from the disk list
+ for dev in devs:
+ if 'vda' in dev:
+ devs.remove(dev)
+ log.warn("Removing root device: %s from device list" % dev)
log.debug('devs={d}'.format(d=devs))