diff options
author | Lee Yarwood <lyarwood@redhat.com> | 2020-11-13 19:27:16 +0000 |
---|---|---|
committer | melanie witt <melwittt@gmail.com> | 2022-08-02 21:25:47 +0000 |
commit | bf701eb4a0e84e86803e5423ee80531d6cbd8bef (patch) | |
tree | 348254eb5c4b964358ce77d067534109c9846dcf /nova/objects | |
parent | cdea73bd9cc811b2d267dd937cf3289dc1a39a15 (diff) | |
download | nova-bf701eb4a0e84e86803e5423ee80531d6cbd8bef.tar.gz |
BlockDeviceMapping: Add is_local property
Add a simple property to quickly check if a BlockDeviceMapping has a
destination_type of local.
Change-Id: I7c118d7731fe65aff14336deb3b9160a8568a66d
Diffstat (limited to 'nova/objects')
-rw-r--r-- | nova/objects/block_device.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/objects/block_device.py b/nova/objects/block_device.py index 5d21db9557..82ce1c6806 100644 --- a/nova/objects/block_device.py +++ b/nova/objects/block_device.py @@ -320,6 +320,11 @@ class BlockDeviceMapping(base.NovaPersistentObject, base.NovaObject, def is_image(self): return self.source_type == fields.BlockDeviceSourceType.IMAGE + @property + def is_local(self): + return (self.destination_type == + fields.BlockDeviceDestinationType.LOCAL) + def get_image_mapping(self): return block_device.BlockDeviceDict(self).get_image_mapping() |