Revision 41303ed0 logic/backend.py

b/logic/backend.py
64 64
    also update the operating state of the VM.
65 65

  
66 66
    """
67
    if (opcode not in [x[0] for x in VirtualMachine.BACKEND_OPCODES] or
68
       status not in [x[0] for x in VirtualMachine.BACKEND_STATUSES]):
67
    # See #1492, #1031, #1111 why this line has been removed
68
    #if (opcode not in [x[0] for x in VirtualMachine.BACKEND_OPCODES] or
69
    if status not in [x[0] for x in VirtualMachine.BACKEND_STATUSES]:
69 70
        raise VirtualMachine.InvalidBackendMsgError(opcode, status)
70 71

  
71 72
    vm.backendjobid = jobid
......
74 75
    vm.backendlogmsg = logmsg
75 76

  
76 77
    # Notifications of success change the operating state
77
    if status == 'success' and VirtualMachine.OPER_STATE_FROM_OPCODE[opcode] is not None:
78
        utils.update_state(vm, VirtualMachine.OPER_STATE_FROM_OPCODE[opcode])
79
        # Set the deleted flag explicitly, to cater for admin-initiated removals
78
    state_for_success = VirtualMachine.OPER_STATE_FROM_OPCODE.get(opcode, None)
79
    if status == 'success' and state_for_success is not None:
80
        utils.update_state(vm, state_for_success)
81
        # Set the deleted flag explicitly, cater for admin-initiated removals
80 82
        if opcode == 'OP_INSTANCE_REMOVE':
81 83
            vm.deleted = True
82 84

  
......
135 137
            index=i,
136 138
            mac=nic.get('mac', ''),
137 139
            ipv4=nic.get('ip', ''),
138
            ipv6=nic.get('ipv6',''),
140
            ipv6=nic.get('ipv6', ''),
139 141
            firewall_profile=firewall_profile)
140 142

  
141 143
        # network nics modified, update network object
......
249 251
    #
250 252
    # kw['pnode']=rapi.GetNodes()[0]
251 253
    kw['dry_run'] = settings.TEST
252
    
254

  
253 255
    kw['beparams'] = {
254 256
        'auto_balance': True,
255 257
        'vcpus': flavor.cpu,
256 258
        'memory': flavor.ram}
257
    
259

  
258 260
    kw['osparams'] = {
259 261
        'img_id': image.backend_id,
260 262
        'img_passwd': password,
261 263
        'img_format': image.format}
262 264
    if personality:
263 265
        kw['osparams']['img_personality'] = json.dumps(personality)
264
    
266

  
265 267
    # Defined in settings.GANETI_CREATEINSTANCE_KWARGS
266 268
    # kw['hvparams'] = dict(serial_console=False)
267 269

  
......
414 416
    rapi.ModifyInstance(vm.backend_id,
415 417
                        os_name=settings.GANETI_CREATEINSTANCE_KWARGS['os'])
416 418

  
419

  
417 420
def get_ganeti_instances():
418 421
    return rapi.GetInstances()
419 422

  
423

  
420 424
def get_ganeti_nodes():
421 425
    return rapi.GetNodes()
422 426

  
427

  
423 428
def get_ganeti_jobs():
424 429
    return rapi.GetJobs()

Also available in: Unified diff