summaryrefslogtreecommitdiff
path: root/nova/objects
diff options
context:
space:
mode:
authorLee Yarwood <lyarwood@redhat.com>2020-11-13 19:27:16 +0000
committermelanie witt <melwittt@gmail.com>2022-08-02 21:25:47 +0000
commitbf701eb4a0e84e86803e5423ee80531d6cbd8bef (patch)
tree348254eb5c4b964358ce77d067534109c9846dcf /nova/objects
parentcdea73bd9cc811b2d267dd937cf3289dc1a39a15 (diff)
downloadnova-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.py5
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()