[et-mgmt-tools] [PATCH] Add --autocf

john.levon at sun.com john.levon at sun.com
Thu Dec 4 04:30:53 UTC 2008


# HG changeset patch
# User john.levon at sun.com
# Date 1228365030 28800
# Node ID d9898b68352ad1c2491a3c9697d4b34af6630fc7
# Parent  fd554fd90595417dbaadb42aecc598d586b7f99e
Add --autocf

Add an option for passing Solaris JumpStart information.  For HVM
guests, this means a floppy image (!).

Signed-off-by: John Levon <john.levon at sun.com>

diff --git a/man/en/virt-install.1 b/man/en/virt-install.1
--- a/man/en/virt-install.1
+++ b/man/en/virt-install.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -25,11 +25,11 @@
 ..
 .\" Set up some character translations and predefined strings.  \*(-- will
 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
-.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
+.\" double quote, and \*(R" will give a right double quote.  | will give a
+.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
+.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
+.\" expand to `' in nroff, nothing in troff, for use with C<>.
+.tr \(*W-|\(bv\*(Tr
 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
 .ie n \{\
 .    ds -- \(*W-
@@ -48,25 +48,22 @@
 .    ds R" ''
 'br\}
 .\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\"
 .\" If the F register is turned on, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
-.ie \nF \{\
+.if \nF \{\
 .    de IX
 .    tm Index:\\$1\t\\n%\t"\\$2"
 ..
 .    nr % 0
 .    rr F
 .\}
-.el \{\
-.    de IX
-..
-.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -132,11 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "VIRT-INSTALL 1"
-.TH VIRT-INSTALL 1 "2008-09-08" "perl v5.10.0" "Virtual Machine Install Tools"
-.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
+.TH VIRT-INSTALL 1 "2008-12-03" "perl v5.8.8" "Virtual Machine Install Tools"
 .SH "NAME"
 virt\-install \- provision new virtual machines
 .SH "SYNOPSIS"
@@ -200,7 +193,7 @@ Set which physical cpus the guest can us
 .Sp
 .Vb 2
 \&    0,2,3,5     : Use processors 0,2,3 and 5
-\&    1\-3,5,6\-8   : Use processors 1,2,3,5,6,7 and 8
+\&    1-3,5,6-8   : Use processors 1,2,3,5,6,7 and 8
 .Ve
 .Sp
 If the value 'auto' is passed, virt-install attempts to automatically determine
@@ -211,7 +204,7 @@ general format of a disk string is
 general format of a disk string is
 .Sp
 .Vb 1
-\&    \-\-disk opt1=val1,opt2=val2,...
+\&    --disk opt1=val1,opt2=val2,...
 .Ve
 .Sp
 To specify media, one of the following options is required:
@@ -234,7 +227,7 @@ specifying a 'size' value.
 .IP "\fBvol\fR" 4
 .IX Item "vol"
 An existing libvirt storage volume to use. This is specified as
-\&'poolname:volname'.
+\&'poolname/volname'.
 .RE
 .RS 4
 .Sp
@@ -244,6 +237,11 @@ Disk device type. Value can be 'cdrom', 
 Disk device type. Value can be 'cdrom', 'disk', or 'floppy'. Default is
 \&'disk'. If a 'cdrom' is specified, and no install method is chosen, the
 cdrom is used as the install media.
+.IP "\fBbux\fR" 4
+.IX Item "bux"
+Disk bus type. Value can be 'ide', 'scsi', 'usb', 'virtio' or 'xen'.  The
+default is hypervisor dependent since not all hypervisors support all bus
+types.
 .IP "\fBperms\fR" 4
 .IX Item "perms"
 Disk permissions. Value can be 'rw' (Read/Write), 'ro' (Readonly),
@@ -285,7 +283,7 @@ time taken to fully-allocate the guest v
 time taken to fully-allocate the guest virtual disk will be usually by balanced
 by faster install times inside the guest. Thus use of this optional is recommended 
 to ensure consistently high performance and to avoid I/O errors in the guest 
-should the host filesystem fill up.
+should the host filesystem fill up. 
 .IP "\-m \s-1MAC\s0, \-\-mac=MAC" 4
 .IX Item "-m MAC, --mac=MAC"
 Fixed \s-1MAC\s0 address for the guest; If this parameter is omitted, or the value
@@ -341,12 +339,12 @@ parameters are specified, this will be p
 .IX Item "--vncport=VNCPORT"
 Request a permanent, statically assigned port number for the guest \s-1VNC\s0
 console. Use of this option is discouraged as other guests may automatically
-choose to run on this port causing a clash.
+choose to run on this port causing a clash. 
 .IP "\-\-sdl" 4
 .IX Item "--sdl"
 Setup a virtual console in the guest and display an \s-1SDL\s0 window in the
 host to render the output. If the \s-1SDL\s0 window is closed the guest may
-be unconditionally terminated.
+be unconditionally terminated. 
 .IP "\-\-nographics" 4
 .IX Item "--nographics"
 Disable all interactive prompts for the guest virtual console. No graphical
@@ -558,7 +556,7 @@ virtualized guest.
 .IP "\-\-noacpi" 4
 .IX Item "--noacpi"
 Override the \s-1OS\s0 type / variant to disables the \s-1ACPI\s0 setting for fully 
-virtualized guest.
+virtualized guest. 
 .IP "\-\-arch=ARCH" 4
 .IX Item "--arch=ARCH"
 Request a non-native \s-1CPU\s0 architecture for the guest virtual machine.
@@ -593,6 +591,11 @@ An \s-1FTP\s0 server location containing
 .RE
 .RS 4
 .RE
+.IP "\-\-autocf \s-1CF\s0" 4
+.IX Item "--autocf CF"
+Provide a path to automated install information. Currently this can
+either be a path to a Solaris JumpStart floppy disk image, or an \s-1NFS\s0
+path (for network installs).
 .IP "\-x \s-1EXTRA\s0, \-\-extra\-args=EXTRA" 4
 .IX Item "-x EXTRA, --extra-args=EXTRA"
 Additional kernel command line arguments to pass to the installer when
@@ -627,58 +630,58 @@ booting from the host \s-1CDROM\s0, usin
 booting from the host \s-1CDROM\s0, using \s-1VNC\s0 server/viewer
 .PP
 .Vb 9
-\&  # virt\-install \e
-\&       \-\-connect qemu:///system \e
-\&       \-\-name demo \e
-\&       \-\-ram 500 \e
-\&       \-\-disk path=/var/lib/libvirt/images/demo.img,size=5 \e
-\&       \-\-network network:default \e
-\&       \-\-accelerate \e
-\&       \-\-vnc \e
-\&       \-\-cdrom /dev/cdrom
+\&  # virt-install \e
+\&       --connect qemu:///system \e
+\&       --name demo \e
+\&       --ram 500 \e
+\&       --disk path=/var/lib/libvirt/images/demo.img,size=5 \e
+\&       --network network:default \e
+\&       --accelerate \e
+\&       --vnc \e
+\&       --cdrom /dev/cdrom
 .Ve
 .PP
 Install a Fedora 9 \s-1KVM\s0 guest, using \s-1LVM\s0 partition, virtual networking,
 booting from \s-1PXE\s0, using \s-1VNC\s0 server/viewer
 .PP
 .Vb 9
-\&  # virt\-install \e
-\&       \-\-connect qemu:///system \e
-\&       \-\-name demo \e
-\&       \-\-ram 500 \e
-\&       \-\-disk path=/dev/HostVG/DemoVM \e
-\&       \-\-network network:default \e
-\&       \-\-accelerate \e
-\&       \-\-vnc \e
-\&       \-\-os\-variant fedora9
+\&  # virt-install \e
+\&       --connect qemu:///system \e
+\&       --name demo \e
+\&       --ram 500 \e
+\&       --disk path=/dev/HostVG/DemoVM \e
+\&       --network network:default \e
+\&       --accelerate \e
+\&       --vnc \e
+\&       --os-variant fedora9
 .Ve
 .PP
 Install a \s-1QEMU\s0 guest, with a real partition, for a different architecture
 using \s-1SDL\s0 graphics, using a remote kernel and initrd pair:
 .PP
 .Vb 9
-\&  # virt\-install \e
-\&       \-\-connect qemu:///system \e
-\&       \-\-name demo \e
-\&       \-\-ram 500 \e
-\&       \-\-disk path=/dev/hdc \e
-\&       \-\-network bridge:eth1 \e
-\&       \-\-arch ppc64 \e
-\&       \-\-sdl \e
-\&       \-\-location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
+\&  # virt-install \e
+\&       --connect qemu:///system \e
+\&       --name demo \e
+\&       --ram 500 \e
+\&       --disk path=/dev/hdc \e
+\&       --network bridge:eth1 \e
+\&       --arch ppc64 \e
+\&       --sdl \e
+\&       --location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
 .Ve
 .PP
 Run a Live \s-1CD\s0 image under Xen fullyvirt, in diskless environment
 .PP
 .Vb 8
-\&  # virt\-install \e
-\&       \-\-hvm \e
-\&       \-\-name demo \e
-\&       \-\-ram 500 \e
-\&       \-\-nodisks \e
-\&       \-\-livecd \e
-\&       \-\-vnc \e
-\&       \-\-cdrom /root/fedora7live.iso
+\&  # virt-install \e
+\&       --hvm \e
+\&       --name demo \e
+\&       --ram 500 \e
+\&       --nodisks \e
+\&       --livecd \e
+\&       --vnc \e
+\&       --cdrom /root/fedora7live.iso
 .Ve
 .PP
 Install a paravirtualized Xen guest, 500 \s-1MB\s0 of \s-1RAM\s0, a 5 \s-1GB\s0 of disk, and
@@ -686,14 +689,14 @@ options:
 options:
 .PP
 .Vb 8
-\&  # virt\-install \e
-\&       \-\-paravirt \e
-\&       \-\-name demo \e
-\&       \-\-ram 500 \e
-\&       \-\-file /var/lib/xen/images/demo.img \e
-\&       \-\-file\-size 6 \e
-\&       \-\-nographics \e
-\&       \-\-location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
+\&  # virt-install \e
+\&       --paravirt \e
+\&       --name demo \e
+\&       --ram 500 \e
+\&       --file /var/lib/xen/images/demo.img \e
+\&       --file-size 6 \e
+\&       --nographics \e
+\&       --location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
 .Ve
 .SH "AUTHOR"
 .IX Header "AUTHOR"
diff --git a/man/en/virt-install.pod b/man/en/virt-install.pod
--- a/man/en/virt-install.pod
+++ b/man/en/virt-install.pod
@@ -538,6 +538,12 @@ An FTP server location containing an ins
 An FTP server location containing an installable distribution image
 
 =back
+
+=item  --autocf CF
+
+Provide a path to automated install information. Currently this can
+either be a path to a Solaris JumpStart floppy disk image, or an NFS
+path (for network installs).
 
 =item  -x EXTRA, --extra-args=EXTRA
 
diff --git a/virt-install b/virt-install
--- a/virt-install
+++ b/virt-install
@@ -385,6 +385,10 @@ def parse_args():
                     default="",
                     help=_("Additional arguments to pass to the kernel "
                            "booted from --location"))
+    parser.add_option("", "--autocf", type="string", dest="autocf",
+                      default=None, action="callback",
+                      callback=check_before_store,
+                      help=_("Guest auto-configuration path"))
 
     parser.add_option_group(insg)
     stog = OptionGroup(parser, _("Storage Configuration"))
@@ -588,6 +592,9 @@ def main():
         if options.os_variant:
             guest.set_os_variant(options.os_variant)
         continue_inst = guest.get_continue_inst()
+
+    if options.autocf is not None:
+        guest.autocf = options.autocf
 
     def show_console(dom):
         if guest.graphics_dev:
diff --git a/virtinst/FullVirtGuest.py b/virtinst/FullVirtGuest.py
--- a/virtinst/FullVirtGuest.py
+++ b/virtinst/FullVirtGuest.py
@@ -158,6 +158,13 @@ class FullVirtGuest(Guest):
                 disk.bus = "ide"
             used_targets.append(disk.generate_target(used_targets))
 
+        # attach a floppy device if provided '--autocf=/pathname'
+        if install and self.autocf and self.autocf.startswith('/'):
+            autocf_floppy = VirtualDisk(self.autocf, \
+                device=VirtualDisk.DEVICE_FLOPPY, transient=True, \
+                  readOnly=True)
+            ret = autocf_floppy.get_xml_config('fda')
+
         for d in self._install_disks:
             saved_path = None
             if d.device == VirtualDisk.DEVICE_CDROM \
diff --git a/virtinst/Guest.py b/virtinst/Guest.py
--- a/virtinst/Guest.py
+++ b/virtinst/Guest.py
@@ -524,6 +524,7 @@ class Guest(object):
         self._vcpus = None
         self._cpuset = None
         self._graphics_dev = None
+        self._autocf = None
 
         self._os_type = None
         self._os_variant = None
@@ -562,7 +563,6 @@ class Guest(object):
     def set_type(self, val):
         self._installer.type = val
     type = property(get_type, set_type)
-
 
     # Domain name of the guest
     def get_name(self):
@@ -599,6 +599,19 @@ class Guest(object):
         self._maxmemory = val
     maxmemory = property(get_maxmemory, set_maxmemory)
 
+    # location of auto-install config data (Solaris jumpstart)
+    def get_autocf(self):
+        return self._autocf
+    def set_autocf(self, val):
+        if type(val) is not type("string") or len(val) == 0:
+            raise ValueError, _("You must specify a valid pathname to autoconfiguration data")
+        if val.startswith('nfs:'):
+            self._autocf = val
+        else:
+            if not os.path.exists(val):
+                raise ValueError, _("%s does not exist" % val)
+            self._autocf = val
+    autocf = property(get_autocf, set_autocf)
 
     # UUID for the guest
     def get_uuid(self):




More information about the et-mgmt-tools mailing list