diff --git a/circle/storage/models.py b/circle/storage/models.py index 8e3a5d8..24fc860 100644 --- a/circle/storage/models.py +++ b/circle/storage/models.py @@ -185,12 +185,24 @@ class Disk(AclBase, TimeStampedModel): return { 'qcow2-norm': 'vd', 'qcow2-snap': 'vd', - 'iso': 'hd', + 'iso': 'sd', 'raw-ro': 'vd', 'raw-rw': 'vd', }[self.type] @property + def device_bus(self): + """Returns the proper device prefix for different types of images. + """ + return { + 'qcow2-norm': 'virtio', + 'qcow2-snap': 'virtio', + 'iso': 'scsi', + 'raw-ro': 'virtio', + 'raw-rw': 'virtio', + }[self.type] + + @property def is_deletable(self): """True if the associated file can be deleted. """ @@ -251,6 +263,7 @@ class Disk(AclBase, TimeStampedModel): 'driver_type': self.vm_format, 'driver_cache': 'none', 'target_device': self.device_type + self.dev_num, + 'target_bus': self.device_bus, 'disk_device': 'cdrom' if self.type == 'iso' else 'disk' }