~blake-rouse/maas/is-importing-2.1

« back to all changes in this revision

Viewing changes to src/provisioningserver/drivers/hardware/virsh.py

  • Committer: LaMont Jones
  • Date: 2016-12-07 12:59:10 UTC
  • mfrom: (5561 2.1)
  • mto: This revision was merged to the branch mainline in revision 5563.
  • Revision ID: lamont@canonical.com-20161207125910-fow7gg8v9bo0s1iq
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
282
282
        state = conn.get_state(machine)
283
283
        macs = conn.get_mac_addresses(machine)
284
284
 
285
 
        # Force the machine off, as MAAS will control the machine
286
 
        # and it needs to be in a known state of off.
287
 
        if state == VirshVMState.ON:
288
 
            conn.poweroff(machine)
289
 
 
290
285
        params = {
291
286
            'power_address': poweraddr,
292
287
            'power_id': machine,
296
291
        system_id = create_node(
297
292
            macs, arch, 'virsh', params, domain, machine).wait(30)
298
293
 
299
 
        if system_id is not None:
300
 
            conn.configure_pxe_boot(machine)
 
294
        # If the system_id is None an error occured when creating the machine.
 
295
        # Most likely the error is the node already exists.
 
296
        if system_id is None:
 
297
            continue
 
298
 
 
299
        # Force the machine off, as MAAS will control the machine
 
300
        # and it needs to be in a known state of off.
 
301
        if state == VirshVMState.ON:
 
302
            conn.poweroff(machine)
 
303
 
 
304
        conn.configure_pxe_boot(machine)
301
305
 
302
306
        if accept_all:
303
307
            commission_node(system_id, user).wait(30)