Method to filter non-root block device mappings
Adding a generator that would provide a non-root block device mappings, when it's optional variable exclude_root_mapping is set to true. Otherwise, all mappings will be returned. The method will be used to handle LXC volumes, as it's root FS should be handled differently. Change-Id: I879916021c3b61f19dd69ff11838dbbac19f72d1 Related-Bug: #1269990
This commit is contained in:
@@ -422,6 +422,14 @@ def get_root_bdm(bdms):
|
||||
return None
|
||||
|
||||
|
||||
def get_bdms_to_connect(bdms, exclude_root_mapping=False):
|
||||
"""Will return non-root mappings, when exclude_root_mapping is true.
|
||||
Otherwise all mappings will be returned.
|
||||
"""
|
||||
return (bdm for bdm in bdms if bdm.get('boot_index', -1) != 0 or
|
||||
not exclude_root_mapping)
|
||||
|
||||
|
||||
def mappings_prepend_dev(mappings):
|
||||
"""Prepend '/dev/' to 'device' entry of swap/ephemeral virtual type."""
|
||||
for m in mappings:
|
||||
|
||||
Reference in New Issue
Block a user