Commit b1bfe87f by Guba Sándor

storage: fixing device and types

parent cbf15087
...@@ -85,7 +85,7 @@ class Disk(TimeStampedModel): ...@@ -85,7 +85,7 @@ class Disk(TimeStampedModel):
return { return {
'qcow2-norm': 'qcow2', 'qcow2-norm': 'qcow2',
'qcow2-snap': 'qcow2', 'qcow2-snap': 'qcow2',
'iso': 'iso', 'iso': 'raw',
'raw-ro': 'raw', 'raw-ro': 'raw',
'raw-rw': 'raw', 'raw-rw': 'raw',
}[self.type] }[self.type]
...@@ -93,10 +93,12 @@ class Disk(TimeStampedModel): ...@@ -93,10 +93,12 @@ class Disk(TimeStampedModel):
@property @property
def device_type(self): def device_type(self):
return { return {
'qcow2': 'vd', 'qcow2-norm': 'vd',
'raw': 'vd', 'qcow2-snap': 'vd',
'iso': 'hd', 'iso': 'hd',
}[self.format] 'raw-ro': 'vd',
'raw-rw': 'vd',
}[self.type]
def is_in_use(self): def is_in_use(self):
return self.instance_set.exclude(state='SHUTOFF').exists() return self.instance_set.exclude(state='SHUTOFF').exists()
...@@ -127,7 +129,8 @@ class Disk(TimeStampedModel): ...@@ -127,7 +129,8 @@ class Disk(TimeStampedModel):
'source': self.path, 'source': self.path,
'driver_type': self.format, 'driver_type': self.format,
'driver_cache': 'default', 'driver_cache': 'default',
'target_device': self.device_type + self.dev_num 'target_device': self.device_type + self.dev_num,
'disk_device' : 'cdrom' if self.type == 'iso' else 'disk'
} }
def get_disk_desc(self): def get_disk_desc(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment