Commit 6487ae94 by Dudás Ádám

vm: assign locally unique device numbers to disks on deploy

parent 4b4735b7
......@@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
from datetime import timedelta
from logging import getLogger
from importlib import import_module
import string
import django.conf
from django.db.models import (BooleanField, CharField, DateTimeField,
......@@ -480,7 +481,15 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
# Deploy virtual images
with act.sub_activity('deploying_disks'):
devnums = list(string.lowercase) # a-z
for disk in self.disks.all():
# assign device numbers
if disk.dev_num in devnums:
devnums.remove(disk.dev_num)
else:
disk.dev_num = devnums.pop(0)
disk.save()
# deploy disk
disk.deploy()
queue_name = self.get_remote_queue_name('vm')
......
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