~ubuntu-branches/ubuntu/raring/virtinst/raring-proposed

« back to all changes in this revision

Viewing changes to virt-install

  • Committer: Bazaar Package Importer
  • Author(s): Guido Günther
  • Date: 2009-03-22 20:13:27 UTC
  • mto: (1.4.1 sid)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20090322201327-5ch3kqxe772e23zx
Tags: upstream-0.400.3
Import upstream version 0.400.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
    shared = False
81
81
    sparse = True
82
82
    bus = None
 
83
    cache = None
83
84
 
84
85
    # Strip media type
85
86
    if path.startswith("path="):
130
131
                sparse = False
131
132
            else:
132
133
                fail(_("Unknown '%s' value '%s'") % (opt_type, opt_val))
 
134
        elif opt_type == "cache":
 
135
            cache = opt_val
133
136
        else:
134
137
            fail(_("Unknown --disk option '%s'.") % (opt,))
135
138
 
136
 
    # We return (path, (poolname, volname), volinst, device, bus, readonly, shared)
 
139
    # We return (path, (poolname, volname), volinst, device, bus, readonly,
 
140
    #            shared)
137
141
    if path_type == "path=":
138
142
        abspath = os.path.abspath(path)
139
143
        if os.path.dirname(abspath) == DEFAULT_POOL_PATH:
164
168
 
165
169
    if not devtype:
166
170
        devtype = virtinst.VirtualDisk.DEVICE_DISK
167
 
    ret = (abspath, voltuple, volinst, devtype, bus, ro, shared, size, sparse)
 
171
    ret = (abspath, voltuple, volinst, devtype, bus, ro, shared, size, sparse,
 
172
           cache)
168
173
    logging.debug("parse_disk: returning %s" % str(ret))
169
174
    return ret
170
175
 
173
178
    try:
174
179
        # Get disk parameters
175
180
        if is_file_path:
176
 
            (path, voltuple, volinst, device, bus, readOnly, ignore, size,
177
 
             sparse) = \
 
181
            (path, voltuple, volinst, device, bus, readOnly, shared, size,
 
182
             sparse, cache) = \
178
183
             (disk, None, None, virtinst.VirtualDisk.DEVICE_DISK, None, False,
179
 
              False, size, sparse)
 
184
              False, size, sparse, None)
180
185
        else:
181
186
            (path, voltuple, volinst,
182
 
             device, bus, readOnly, ignore,
183
 
             size, sparse) = parse_disk_option(guest, disk, size)
 
187
             device, bus, readOnly, shared,
 
188
             size, sparse, cache) = parse_disk_option(guest, disk, size)
184
189
            if not sparse and volinst:
185
190
                volinst.allocation = volinst.capacity
186
191
 
187
192
        d = virtinst.VirtualDisk(path=path, size=size, sparse=sparse,
188
193
                                 volInstall=volinst, volName=voltuple,
189
 
                                 readOnly=readOnly, device=device, bus=bus,
190
 
                                 conn=guest.conn)
 
194
                                 readOnly=readOnly, shareable=shared,
 
195
                                 device=device, bus=bus, conn=guest.conn,
 
196
                                 driverCache=cache)
191
197
        # Default file backed PV guests to tap driver
192
198
        if d.type == virtinst.VirtualDisk.TYPE_FILE \
193
199
           and not(hvm) and virtinst.util.is_blktap_capable():
239
245
    else:
240
246
        get_disk(disk, size, sparse, guest, hvm, conn, is_file_path)
241
247
 
242
 
def get_networks(macs, bridges, networks, guest):
 
248
def get_networks(macs, bridges, networks, nonetworks, guest):
 
249
    if nonetworks:
 
250
        if macs:
 
251
            fail(_("Cannot use --mac with --nonetworks"))
 
252
        if bridges:
 
253
            fail(_("Cannot use --bridges with --nonetworks"))
 
254
        if networks:
 
255
            fail(_("Cannot use --network with --nonetworks"))
 
256
        return
243
257
    (macs, networks) = cli.digest_networks(guest.conn, macs, bridges,
244
258
                                           networks, nics=1)
245
259
    map(lambda m, n: cli.get_network(m, n, guest), macs, networks)
251
265
    guest.extraargs = extra
252
266
 
253
267
 
254
 
def get_install_media(location, cdpath, pxe, livecd, guest, ishvm):
 
268
def get_install_media(location, cdpath, pxe, livecd, import_install,
 
269
                      guest, ishvm):
255
270
 
256
 
    if (pxe and location) or (location and cdpath) or (cdpath and pxe):
257
 
        fail(_("Only one of --pxe, --location and --cdrom can be used"))
 
271
    found = False
 
272
    for m in [pxe, location, cdpath, import_install]:
 
273
        if m:
 
274
            if found:
 
275
                fail(_("Only one install method (%s) can be used") %
 
276
                       "--pxe, --location, --cdrom, --import")
 
277
            found = True
258
278
 
259
279
    if not ishvm:
260
280
        if pxe:
262
282
                   "guests"))
263
283
        if cdpath or livecd:
264
284
            fail(_("Paravirtualized guests cannot install off cdrom media."))
265
 
        if location is None:
266
 
            fail(_("location must be specified for paravirtualized guests."))
267
285
 
268
286
    if location and virtinst.util.is_uri_remote(guest.conn.getURI()):
269
287
        fail(_("--location can not be specified for remote connections."))
270
288
 
271
289
    cdinstall = (cdpath or False)
272
 
    if not (pxe or cdpath or location):
 
290
    if not (pxe or cdpath or location or import_install):
273
291
        # Look at Guest disks: if there is a cdrom, use for install
274
292
        for disk in guest.disks:
275
293
            if disk.device == virtinst.VirtualDisk.DEVICE_CDROM:
276
294
                cdinstall = True
277
295
        if not cdinstall:
278
 
            fail(_("One of --pxe, --location, or cdrom media must be "
279
 
                    "specified."))
280
 
    if pxe:
 
296
            fail(_("One of %s, or cdrom media must be specified.") %
 
297
                  "--pxe, --location, --import")
 
298
 
 
299
    if pxe or import_install:
281
300
        return
282
301
    try:
283
302
        if location or cdpath:
336
355
    geng.add_option("", "--cpuset", type="string", dest="cpuset",
337
356
                    action="callback", callback=cli.check_before_store,
338
357
                    help=_("Set which physical CPUs Domain can use."))
339
 
    parser.add_option_group(geng)
340
 
 
341
 
    fulg = OptionGroup(parser, _("Full Virtualization specific options."))
342
 
    fulg.add_option("", "--sound", action="store_true", dest="sound",
343
 
                    default=False, help=_("Use sound device emulation"))
344
 
    fulg.add_option("", "--os-type", type="string", dest="os_type",
 
358
    geng.add_option("", "--os-type", type="string", dest="distro_type",
345
359
                    action="callback", callback=cli.check_before_store,
346
360
                    help=_("The OS type for fully virtualized guests, e.g. "
347
361
                           "'linux', 'unix', 'windows'"))
348
 
    fulg.add_option("", "--os-variant", type="string", dest="os_variant",
 
362
    geng.add_option("", "--os-variant", type="string", dest="distro_variant",
349
363
                      action="callback", callback=cli.check_before_store,
350
364
                      help=_("The OS variant for fully virtualized guests, "
351
365
                             "e.g. 'fedora6', 'rhel5', 'solaris10', 'win2k'"))
 
366
    geng.add_option("", "--host-device", type="string", dest="hostdevs",
 
367
                    action="callback", callback=cli.check_before_append,
 
368
                    help=_("Physical host device to attach to the domain."))
 
369
    parser.add_option_group(geng)
 
370
 
 
371
    fulg = OptionGroup(parser, _("Full Virtualization specific options"))
 
372
    fulg.add_option("", "--sound", action="store_true", dest="sound",
 
373
                    default=False, help=_("Use sound device emulation"))
352
374
    fulg.add_option("", "--noapic", action="store_true", dest="noapic",
353
375
                    default=False,
354
376
                    help=_("Disables APIC for fully virtualized guest "
380
402
                           "http://host/path, ftp://host/path)"))
381
403
    insg.add_option("", "--pxe", action="store_true", dest="pxe",
382
404
                    help=_("Boot from the network using the PXE protocol"))
 
405
    insg.add_option("", "--import", action="store_true", dest="import_install",
 
406
                    help=_("Build guest around an existing disk image"))
383
407
    insg.add_option("", "--livecd", action="store_true", dest="livecd",
384
 
                    help=_("Treat the CDROM media is a LiveCD"))
 
408
                    help=_("Treat the CD-ROM media as a Live CD"))
385
409
    insg.add_option("-x", "--extra-args", type="string", dest="extra",
386
410
                    default="",
387
411
                    help=_("Additional arguments to pass to the kernel "
388
412
                           "booted from --location"))
389
 
 
390
413
    parser.add_option_group(insg)
 
414
 
391
415
    stog = OptionGroup(parser, _("Storage Configuration"))
392
416
    stog.add_option("", "--disk", type="string", dest="diskopts",
393
417
                    action="callback", callback=cli.check_before_append,
421
445
                    action="callback", callback=cli.check_before_append,
422
446
                    help=_("Fixed MAC address for the guest; if none or "
423
447
                           "RANDOM is given a random address will be used"))
 
448
    netg.add_option("", "--nonetworks", action="store_true",
 
449
                    help=_("Don't create network interfaces for the guest."))
424
450
    parser.add_option_group(netg)
425
451
 
426
452
    vncg = OptionGroup(parser, _("Graphics Configuration"))
497
523
def main():
498
524
    options = parse_args()
499
525
 
 
526
    # Default setup options
500
527
    cli.setupLogging("virt-install", options.debug)
501
528
    cli.set_force(options.force)
502
529
    cli.set_prompt(options.prompt)
503
530
    conn = cli.getConnection(options.connect)
504
531
    capabilities = virtinst.CapabilitiesParser.parse(conn.getCapabilities())
505
532
 
 
533
 
 
534
    # Set up all virt/hypervisor parameters
506
535
    if options.fullvirt and options.paravirt:
507
536
        fail(_("Can't do both --hvm and --paravirt"))
508
537
 
509
538
    if options.fullvirt:
510
 
        os_type = "hvm"
 
539
        req_virt_type = "hvm"
511
540
    elif options.paravirt:
512
 
        os_type = "xen"
 
541
        req_virt_type = "xen"
513
542
    else:
514
543
        # This should force capabilities to give us the most sensible default
515
 
        os_type = None
516
 
 
517
 
    logging.debug("Requesting virt method '%s'" % (os_type and os_type or \
518
 
                                                  _("default")))
519
 
 
520
 
    guest = capabilities.guestForOSType(type=os_type, arch=options.arch)
521
 
    if guest is None:
522
 
        msg = _("Unsupported virtualization type '%s' " % (os_type and os_type
523
 
                                                           or _("default")))
524
 
        if options.arch:
525
 
            msg += _("for arch '%s'" % options.arch)
526
 
        fail(msg)
527
 
 
528
 
    os_type = guest.os_type
529
 
    logging.debug("Received virt method '%s'" % os_type)
530
 
    if os_type == "hvm":
531
 
        hvm = True
532
 
    else:
533
 
        hvm = False
534
 
 
535
 
    domain = guest.bestDomainType(options.accelerate)
536
 
    htype = domain.hypervisor_type
537
 
    logging.debug("Hypervisor type is '%s'" % htype)
538
 
 
 
544
        req_virt_type = None
 
545
 
 
546
    logging.debug("Requesting virt method '%s'" % (req_virt_type and
 
547
                                                   req_virt_type or
 
548
                                                   _("default")))
 
549
 
 
550
    try:
 
551
        (capsguest,
 
552
         capsdomain) = virtinst.CapabilitiesParser.guest_lookup(conn=conn,
 
553
                        caps=capabilities, os_type=req_virt_type,
 
554
                        arch=options.arch, type=None,
 
555
                        accelerated=options.accelerate)
 
556
    except Exception, e:
 
557
        fail(e)
 
558
 
 
559
    virt_type = capsguest.os_type
 
560
    hv_name = capsdomain.hypervisor_type
 
561
    logging.debug("Received virt method '%s'" % virt_type)
 
562
    logging.debug("Hypervisor name is '%s'" % hv_name)
 
563
 
 
564
 
 
565
    # Build the Installer instance
539
566
    if options.livecd:
540
 
        installer = virtinst.LiveCDInstaller(type = htype, os_type = os_type,
541
 
                                             conn = conn)
 
567
        instclass = virtinst.LiveCDInstaller
542
568
    elif options.pxe:
543
 
        installer = virtinst.PXEInstaller(type = htype, os_type = os_type,
544
 
                                          conn = conn)
545
 
    else:
546
 
        installer = virtinst.DistroInstaller(type = htype, os_type = os_type,
547
 
                                             conn = conn)
548
 
 
549
 
    if hvm:
550
 
        guest = virtinst.FullVirtGuest(connection=conn, installer=installer,
551
 
                                       arch=guest.arch)
552
 
    else:
553
 
        guest = virtinst.ParaVirtGuest(connection=conn, installer=installer)
 
569
        if options.nonetworks:
 
570
            fail(_("Can't use --pxe with --nonetworks"))
 
571
 
 
572
        instclass = virtinst.PXEInstaller
 
573
    elif options.import_install:
 
574
        instclass = virtinst.ImportInstaller
 
575
    else:
 
576
        instclass = virtinst.DistroInstaller
 
577
    installer = instclass(type=hv_name, os_type=virt_type, conn=conn)
 
578
    installer.arch = capsguest.arch
 
579
 
 
580
 
 
581
    # Get Guest instance from installer parameters.
 
582
    guest = installer.guest_from_installer()
 
583
 
554
584
 
555
585
    # now let's get some of the common questions out of the way
 
586
    if virt_type == "hvm":
 
587
        ishvm = True
 
588
    else:
 
589
        ishvm = False
 
590
 
556
591
    cli.get_name(options.name, guest)
557
592
    cli.get_memory(options.memory, guest)
558
593
    cli.get_uuid(options.uuid, guest)
559
594
    cli.get_vcpus(options.vcpus, options.check_cpu, guest, conn)
560
595
    cli.get_cpuset(options.cpuset, guest.memory, guest, conn)
561
 
    if hvm:
 
596
    if ishvm:
562
597
        cli.get_sound(options.sound, guest)
563
598
 
564
599
    # set up disks
565
600
    get_disks(options.file_path, options.diskopts, options.disksize,
566
 
              options.sparse, options.nodisks, guest, hvm, conn)
 
601
              options.sparse, options.nodisks, guest, ishvm, conn)
567
602
 
568
603
    # set up network information
569
 
    get_networks(options.mac, options.bridge, options.network, guest)
 
604
    get_networks(options.mac, options.bridge, options.network,
 
605
                 options.nonetworks, guest)
570
606
 
571
607
    # set up graphics information
572
608
    cli.get_graphics(options.vnc, options.vncport, options.nographics,
573
609
                     options.sdl, options.keymap, guest)
574
610
 
 
611
    # Set host device info
 
612
    cli.get_hostdevs(options.hostdevs, guest)
 
613
 
575
614
    get_extraargs(options.extra, guest)
 
615
    if options.distro_type:
 
616
        guest.set_os_type(options.distro_type)
 
617
    if options.distro_variant:
 
618
        guest.set_os_variant(options.distro_variant)
576
619
 
577
620
    # and now for the full-virt vs paravirt specific questions
578
621
    get_install_media(options.location, options.cdrom, options.pxe,
579
 
                      options.livecd, guest, hvm)
580
 
    if not hvm: # paravirt
 
622
                      options.livecd, options.import_install, guest, ishvm)
 
623
    if not ishvm: # paravirt
581
624
        continue_inst = False
582
625
    else:
583
626
        if options.noacpi:
584
627
            guest.features["acpi"] = False
585
628
        if options.noapic:
586
629
            guest.features["apic"] = False
587
 
        if options.os_type:
588
 
            guest.set_os_type(options.os_type)
589
 
        if options.os_variant:
590
 
            guest.set_os_variant(options.os_variant)
591
630
        continue_inst = guest.get_continue_inst()
592
631
 
593
632
    def show_console(dom):
599
638
        else:
600
639
            return txt_console(dom, options.connect)
601
640
 
602
 
    wait = False
603
 
    wait_time = 0
 
641
    # There are two main cases we care about:
 
642
    #
 
643
    # Scripts: these should specify --wait always, maintaining the
 
644
    # semantics of virt-install exit implying the domain has finished
 
645
    # installing.
 
646
    #
 
647
    # Interactive: If this is a continue_inst domain, we default to
 
648
    # waiting.  Otherwise, we can exit before the domain has finished
 
649
    # installing. Passing --wait will give the above semantics.
 
650
    # 
 
651
    wait = continue_inst
 
652
    wait_time = -1
 
653
    autoconsole = options.autoconsole
 
654
 
604
655
    if options.wait:
605
656
        wait = True
606
657
        wait_time = options.wait * 60
607
 
 
608
 
    if wait is True and wait_time == 0:
609
 
        # wait == 0 implies noautoconsole
610
 
        options.autoconsole = False
611
 
 
612
 
    if options.autoconsole is False:
 
658
        if wait_time == 0:
 
659
            # --wait 0 implies --noautoconsole
 
660
            autoconsole = False
 
661
 
 
662
    if autoconsole is False:
613
663
        conscb = None
614
664
    else:
615
665
        conscb = show_console
616
666
 
617
667
    progresscb = progress.TextMeter()
618
668
 
 
669
 
619
670
    # we've got everything -- try to start the install
 
671
    print _("\n\nStarting install...")
 
672
 
620
673
    try:
621
 
        def domain_is_shutdown(dom):
622
 
            info     = dom.info()
623
 
            state    = info[0]
624
 
            cpu_time = info[4]
625
 
 
626
 
            if state == libvirt.VIR_DOMAIN_SHUTOFF:
627
 
                return True
628
 
 
629
 
            # If --wait was specified, the dom object we have was looked up
630
 
            # before initially shutting down, which seems to bogus up the
631
 
            # info data (all 0's). So, if it is bogus, assume the domain is
632
 
            # shutdown. We will catch the error later.
633
 
            return state == libvirt.VIR_DOMAIN_NOSTATE and cpu_time == 0
634
 
 
635
 
        print _("\n\nStarting install...")
636
 
 
637
674
        start_time = time.time()
638
675
 
639
 
        started = False
640
 
        while True:
641
 
            if not started:
642
 
                dom = guest.start_install(conscb, progresscb, wait=(not wait))
643
 
            elif continue_inst:
644
 
                dom = guest.continue_install(conscb, progresscb,
645
 
                                             wait=(not wait))
646
 
                continue_inst = False
647
 
            else:
648
 
                break
649
 
 
650
 
            if dom is None:
651
 
                print _("Guest installation failed")
652
 
                sys.exit(0)
653
 
            elif dom.info()[0] != libvirt.VIR_DOMAIN_SHUTOFF:
654
 
                # domain seems to be running
655
 
                if wait:
656
 
                    print _("Domain installation still in progress. Waiting"+\
657
 
                            ((wait_time > 0)
658
 
                             and (_(" %d minutes") % (int(wait_time) / 60))
659
 
                             or "") + \
660
 
                            " for domain to shutdown.")
661
 
                    while True:
662
 
                        if domain_is_shutdown(dom):
663
 
                            print _("Domain has shutdown. Continuing.")
664
 
                            try:
665
 
                                # Lookup a new domain object incase current
666
 
                                # one returned bogus data (see comment in
667
 
                                # domain_is_shutdown
668
 
                                dom = guest.conn.lookupByName(guest.name)
669
 
                            except Exception, e:
670
 
                                raise RuntimeError(_("Could not lookup domain after install: %s" % str(e)))
671
 
                            break
672
 
                        if wait_time < 0 or \
673
 
                           ((time.time() - start_time) < wait_time):
674
 
                            time.sleep(2)
675
 
                        else:
676
 
                            print _("Installation has exceeded specified time"
677
 
                                    "limit. Exiting application.")
678
 
                            sys.exit(1)
679
 
                else:
680
 
                    print _("Domain installation still in progress. "
681
 
                            "You can reconnect to \nthe console to complete "
682
 
                            "the installation process.")
683
 
                    sys.exit(0)
684
 
 
685
 
            if not started:
686
 
                started = True
687
 
                if not guest.post_install_check():
688
 
                    print _("Domain installation does not appear to have been\n successful.  If it was, you can restart your domain\n by running 'virsh start %s'; otherwise, please\n restart your installation.") %(guest.name,)
689
 
                    sys.exit(0)
 
676
        # Do first install phase
 
677
        dom = do_install(guest, conscb, progresscb, wait, wait_time,
 
678
                         start_time, guest.start_install)
 
679
 
 
680
        # This should be valid even before doing continue install
 
681
        if not guest.post_install_check():
 
682
            print _("Domain installation does not appear to have been\n "
 
683
                    "successful.  If it was, you can restart your domain\n "
 
684
                    "by running 'virsh start %s'; otherwise, please\n "
 
685
                    "restart your installation.") % guest.name
 
686
            sys.exit(0)
 
687
 
 
688
        if continue_inst:
 
689
            dom = do_install(guest, conscb, progresscb, wait, wait_time,
 
690
                             start_time, guest.continue_install)
690
691
 
691
692
        if options.noreboot:
692
 
            print _("Guest installation complete... you can restart your domain\n"
693
 
                    "by running 'virsh start %s'") %(guest.name,)
 
693
            print _("Guest installation complete... you can restart your "
 
694
                    "domain\nby running 'virsh start %s'") % guest.name
694
695
        else:
 
696
            # FIXME: Should we say 'installation' complete for livecd, import?
695
697
            print _("Guest installation complete... restarting guest.")
696
698
            dom.create()
697
699
            guest.connect_console(conscb)
 
700
 
 
701
    except KeyboardInterrupt, e:
 
702
        guest.terminate_console()
 
703
        print _("Guest install interrupted.")
698
704
    except RuntimeError, e:
699
705
        fail(e)
700
706
    except SystemExit, e:
701
707
        sys.exit(e.code)
702
708
    except Exception, e:
703
709
        print str(e)
704
 
        print _("Domain installation may not have been\n successful.  If it was, you can restart your domain\n by running 'virsh start %s'; otherwise, please\n restart your installation.") %(guest.name,)
 
710
        print (_("Domain installation may not have been\n successful.  If it "
 
711
                 "was, you can restart your domain\n by running 'virsh start "
 
712
                 "%s'; otherwise, please\n restart your installation.") %
 
713
                 guest.name)
705
714
        raise
706
715
 
 
716
def domain_is_shutdown(dom):
 
717
    info     = dom.info()
 
718
    state    = info[0]
 
719
    cpu_time = info[4]
 
720
 
 
721
    if state == libvirt.VIR_DOMAIN_SHUTOFF:
 
722
        return True
 
723
 
 
724
    # If --wait was specified, the dom object we have was looked up
 
725
    # before initially shutting down, which seems to bogus up the
 
726
    # info data (all 0's). So, if it is bogus, assume the domain is
 
727
    # shutdown. We will catch the error later.
 
728
    return state == libvirt.VIR_DOMAIN_NOSTATE and cpu_time == 0
 
729
 
 
730
def do_install(guest, conscb, progresscb, wait, wait_time, start_time,
 
731
               install_func):
 
732
 
 
733
    dom = install_func(conscb, progresscb, wait=(not wait))
 
734
 
 
735
    if dom is None:
 
736
        print _("Guest installation failed.")
 
737
        sys.exit(0)
 
738
 
 
739
    if domain_is_shutdown(dom):
 
740
        return dom
 
741
 
 
742
    # Domain seems to be running
 
743
    if wait:
 
744
        timestr = ""
 
745
        if wait_time > 0:
 
746
            timestr = _("%d minutes ") % (int(wait_time) / 60)
 
747
 
 
748
        print _("Domain installation still in progress. Waiting %s"
 
749
                 "for domain to complete installation.") % timestr
 
750
 
 
751
        # Wait loop
 
752
        while True:
 
753
            if domain_is_shutdown(dom):
 
754
                print _("Domain has shutdown. Continuing.")
 
755
                try:
 
756
                    # Lookup a new domain object incase current
 
757
                    # one returned bogus data (see comment in
 
758
                    # domain_is_shutdown
 
759
                    dom = guest.conn.lookupByName(guest.name)
 
760
                except Exception, e:
 
761
                    raise RuntimeError(_("Could not lookup domain after "
 
762
                                         "install: %s" % str(e)))
 
763
                break
 
764
 
 
765
            if wait_time < 0 or ((time.time() - start_time) < wait_time):
 
766
                time.sleep(2)
 
767
            else:
 
768
                print _("Installation has exceeded specified time limit. "
 
769
                        "Exiting application.")
 
770
                sys.exit(1)
 
771
    else:
 
772
        print _("Domain installation still in progress. You can reconnect"
 
773
                " to \nthe console to complete the installation process.")
 
774
        sys.exit(0)
 
775
 
 
776
    return dom
 
777
 
707
778
if __name__ == "__main__":
708
779
    try:
709
780
        main()