Revision 1c382247 logic/backend.py
b/logic/backend.py | ||
---|---|---|
183 | 183 |
else: |
184 | 184 |
sz = flavor.disk * 1024 |
185 | 185 |
|
186 |
return rapi.CreateInstance( |
|
187 |
mode='create', |
|
188 |
name=vm.backend_id, |
|
189 |
disk_template=settings.GANETI_DISK_TEMPLATE, |
|
190 |
disks=[{"size": sz}], #FIXME: Always ask for a 4GB disk for now |
|
191 |
nics=[nic], |
|
192 |
os=settings.GANETI_OS_PROVIDER, |
|
193 |
ip_check=False, |
|
194 |
name_check=False, |
|
195 |
# Do not specific a node explicitly, have |
|
196 |
# Ganeti use an iallocator instead |
|
197 |
# |
|
198 |
# pnode=rapi.GetNodes()[0], |
|
199 |
dry_run=settings.TEST, |
|
200 |
beparams=dict(auto_balance=True, vcpus=flavor.cpu, memory=flavor.ram), |
|
201 |
osparams=dict(img_id=image.backend_id, img_passwd=password, |
|
202 |
img_format=image.format), |
|
203 |
# Be explicit about setting serial_console = False for Synnefo-based |
|
204 |
# instances regardless of the cluster-wide setting, see #785 |
|
205 |
hvparams=dict(serial_console=False)) |
|
186 |
# Handle arguments to CreateInstance() as a dictionary, |
|
187 |
# initialize it based on a deployment-specific value. |
|
188 |
# This enables the administrator to override deployment-specific |
|
189 |
# arguments, such as the disk templatei to use, name of os provider |
|
190 |
# and hypervisor-specific parameters at will (see Synnefo #785, #835). |
|
191 |
# |
|
192 |
kw = settings.GANETI_CREATEINSTANCE_KWARGS |
|
193 |
kw['mode'] = 'create' |
|
194 |
kw['name'] = vm.backend_id |
|
195 |
# Defined in settings.GANETI_CREATE_INSTANCE_KWARGS |
|
196 |
# kw['disk_template'] = settings.GANETI_DISK_TEMPLATE |
|
197 |
kw['disks'] = [{"size": sz}] |
|
198 |
kw['nics'] = [nic] |
|
199 |
# Defined in settings.GANETI_CREATE_INSTANCE_KWARGS |
|
200 |
# kw['os'] = settings.GANETI_OS_PROVIDER |
|
201 |
kw['ip_check'] = False |
|
202 |
kw['name_check'] = False |
|
203 |
# Do not specific a node explicitly, have |
|
204 |
# Ganeti use an iallocator instead |
|
205 |
# |
|
206 |
# kw['pnode']=rapi.GetNodes()[0] |
|
207 |
kw['dry_run'] = settings.TEST |
|
208 |
kw['beparams'] = dict(auto_balance=True, vcpus=flavor.cpu, |
|
209 |
memory=flavor.ram) |
|
210 |
kw['osparams'] = dict(img_id=image.backend_id, img_passwd=password, |
|
211 |
img_format=image.format) |
|
212 |
# Defined in settings.GANETI_CREATE_INSTANCE_KWARGS |
|
213 |
# kw['hvparams'] = dict(serial_console=False) |
|
214 |
|
|
215 |
return rapi.CreateInstance(**kw) |
|
206 | 216 |
|
207 | 217 |
|
208 | 218 |
def delete_instance(vm): |
Also available in: Unified diff