Revision 47c27955 snf-cyclades-app/synnefo/logic/servers.py
b/snf-cyclades-app/synnefo/logic/servers.py | ||
---|---|---|
165 | 165 |
|
166 | 166 |
@transaction.commit_on_success |
167 | 167 |
def create(userid, name, password, flavor, image, metadata={}, |
168 |
personality=[], networks=None, use_backend=None): |
|
168 |
personality=[], networks=None, use_backend=None, project=None):
|
|
169 | 169 |
if use_backend is None: |
170 | 170 |
# Allocate server to a Ganeti backend |
171 | 171 |
use_backend = allocate_new_server(userid, flavor) |
... | ... | |
188 | 188 |
else: |
189 | 189 |
flavor.disk_provider = None |
190 | 190 |
|
191 |
if project is None: |
|
192 |
project = userid |
|
193 |
|
|
191 | 194 |
# We must save the VM instance now, so that it gets a valid |
192 | 195 |
# vm.backend_vm_id. |
193 | 196 |
vm = VirtualMachine.objects.create(name=name, |
194 | 197 |
backend=use_backend, |
195 | 198 |
userid=userid, |
199 |
project=project, |
|
196 | 200 |
imageid=image["id"], |
197 | 201 |
flavor=flavor, |
198 | 202 |
operstate="BUILD") |
Also available in: Unified diff