Revision 58194535 snf-cyclades-app/synnefo/volume/volumes.py
b/snf-cyclades-app/synnefo/volume/volumes.py | ||
---|---|---|
1 | 1 |
import logging |
2 | 2 |
|
3 | 3 |
from django.db import transaction |
4 |
from django.conf import settings |
|
4 | 5 |
from snf_django.lib.api import faults |
5 | 6 |
from synnefo.db.models import Volume |
6 | 7 |
from synnefo.volume import util |
... | ... | |
57 | 58 |
# Only ext_ disk template supports cloning from another source. Otherwise |
58 | 59 |
# is must be the root volume so that 'snf-image' fill the volume |
59 | 60 |
disk_template = server.flavor.disk_template |
60 |
can_have_source = (index == 0 or disk_template.startswith("ext_")) |
|
61 |
teplate, provider = util.get_disk_template_provider(disk_template) |
|
62 |
can_have_source = (index == 0 or |
|
63 |
provider in settings.GANETI_CLONE_PROVIDERS) |
|
61 | 64 |
if not can_have_source and source_type != "blank": |
62 | 65 |
msg = ("Volumes of '%s' disk template cannot have a source" % |
63 | 66 |
disk_template) |
... | ... | |
111 | 114 |
|
112 | 115 |
volume = Volume.objects.create(userid=user_id, |
113 | 116 |
size=size, |
117 |
disk_template=disk_template, |
|
114 | 118 |
name=name, |
115 | 119 |
machine=server, |
116 | 120 |
description=description, |
Also available in: Unified diff