ia64/xen-unstable

changeset 977:32f065cf544b

bitkeeper revision 1.630 (3fbf4c5eGi95ZU5mjOHJ4L6ioUNlKA)

stopdom.py:
Rename: tools/examples/xi_stopdom.py -> tools/examples/stopdom.py
destroydom.py:
Rename: tools/examples/xi_destroydom.py -> tools/examples/destroydom.py
listdoms.py:
Rename: tools/examples/xi_listdoms.py -> tools/examples/listdoms.py
createlinuxdom.py:
Rename: tools/examples/xi_createlinuxdom.py -> tools/examples/createlinuxdom.py
author kaf24@scramble.cl.cam.ac.uk
date Sat Nov 22 11:45:34 2003 +0000 (2003-11-22)
parents 2b1d395d801a
children 6ec887aa9d16
files .rootkeys tools/examples/createlinuxdom.py tools/examples/destroydom.py tools/examples/listdoms.py tools/examples/stopdom.py tools/examples/xi_createlinuxdom.py tools/examples/xi_destroydom.py tools/examples/xi_listdoms.py tools/examples/xi_stopdom.py
line diff
     1.1 --- a/.rootkeys	Sat Nov 22 11:43:49 2003 +0000
     1.2 +++ b/.rootkeys	Sat Nov 22 11:45:34 2003 +0000
     1.3 @@ -39,10 +39,10 @@ 3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Mak
     1.4  3e6377b24eQqYMsDi9XrFkIgTzZ47A tools/balloon/Makefile
     1.5  3e6377d6eiFjF1hHIS6JEIOFk62xSA tools/balloon/README
     1.6  3e6377dbGcgnisKw16DPCaND7oGO3Q tools/balloon/balloon.c
     1.7 -3fbe2f12OPAkzIUtumU3wRAihnhocQ tools/examples/xi_createlinuxdom.py
     1.8 -3fbe2f12dZbmXLlgQdMgkmnSUj23AQ tools/examples/xi_destroydom.py
     1.9 -3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/xi_listdoms.py
    1.10 -3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/xi_stopdom.py
    1.11 +3fbe2f12OPAkzIUtumU3wRAihnhocQ tools/examples/createlinuxdom.py
    1.12 +3fbe2f12dZbmXLlgQdMgkmnSUj23AQ tools/examples/destroydom.py
    1.13 +3fbe2f12ltvweb13kBSsxqzZDAq4sg tools/examples/listdoms.py
    1.14 +3fbe2f12Bnt8mwmr1ZCP6HWGS6yvYw tools/examples/stopdom.py
    1.15  3f776bd2Xd-dUcPKlPN2vG89VGtfvQ tools/misc/Makefile
    1.16  3f6dc136ZKOjd8PIqLbFBl_v-rnkGg tools/misc/miniterm/Makefile
    1.17  3f6dc140C8tAeBfroAF24VrmCS4v_w tools/misc/miniterm/README
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/examples/createlinuxdom.py	Sat Nov 22 11:45:34 2003 +0000
     2.3 @@ -0,0 +1,101 @@
     2.4 +#!/usr/bin/env python
     2.5 +
     2.6 +#
     2.7 +# Example script for creating and building a new Linux guest OS for Xen.
     2.8 +#
     2.9 +
    2.10 +import Xc, XenoUtil, sys, os
    2.11 +
    2.12 +# Variable declaration. Set these up properly later on, as needed.
    2.13 +nfsserv = nfspath = root_partn = usr_partn = ""
    2.14 +
    2.15 +# STEP 1. Specify kernel image file.
    2.16 +image = "FULL_PATH_TO_IMAGE"
    2.17 +
    2.18 +# STEP 2. Specify IP address, netmask and gateway for the new domain.
    2.19 +ipaddr  = "ADDRESS"
    2.20 +netmask = XenoUtil.get_current_ipmask()
    2.21 +gateway = XenoUtil.get_current_ipgw()
    2.22 +
    2.23 +# STEP 3a. Specify NFS server and path to rootfs (only needed for network boot)
    2.24 +nfsserv = "ADDRESS"
    2.25 +nfspath = "FULL_PATH_TO_ROOT_DIR"
    2.26 +
    2.27 +# STEP 3b. Specify root (and possibly /usr) on local disc (if not NFS booting)
    2.28 +#root_partn = "/dev/sda2"
    2.29 +#usr_partn  = "/dev/sda6"
    2.30 +
    2.31 +# STEP 4. Check that the following cmdline setup is to your taste.
    2.32 +cmdline = "ip="+ipaddr+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off"
    2.33 +if root_partn:
    2.34 +    # Boot from local disc. May specify a separate /usr.
    2.35 +    cmdline = cmdline + " root="+root_partn+" ro"
    2.36 +    if usr_partn:
    2.37 +        " usr="+usr_partn
    2.38 +elif nfsserv:
    2.39 +    # NFS boot
    2.40 +    cmdline = cmdline + " root=/dev/nfs"
    2.41 +    cmdline = cmdline + " nfsroot="+nfspath
    2.42 +
    2.43 +if root_partn:
    2.44 +    root_info = XenoUtil.lookup_blkdev_partn_info(root_partn)
    2.45 +    if not root_info:
    2.46 +        print "Could not obtain info on partition '" + root_partn + "'"
    2.47 +        sys.exit()
    2.48 +
    2.49 +if usr_partn:
    2.50 +    usr_info = XenoUtil.lookup_blkdev_partn_info(usr_partn)
    2.51 +    if not usr_info:
    2.52 +        print "Could not obtain info on partition '" + usr_partn + "'"
    2.53 +        sys.exit()
    2.54 +
    2.55 +if not os.path.isfile( image ):
    2.56 +    print "Image file '" + image + "' does not exist"
    2.57 +    sys.exit()
    2.58 +
    2.59 +xc = Xc.new()
    2.60 +
    2.61 +id = xc.domain_create()
    2.62 +if id <= 0:
    2.63 +    print "Error creating domain"
    2.64 +    sys.exit()
    2.65 +
    2.66 +if xc.linux_build( dom=id, image=image, cmdline=cmdline ):
    2.67 +    print "Error building Linux guest OS"
    2.68 +    xc.domain_destroy ( dom=id )
    2.69 +    sys.exit()
    2.70 +
    2.71 +if root_partn:
    2.72 +    if xc.vbd_create( dom=id, vbd=root_info[0], writeable=1 ):
    2.73 +        print "Error creating root VBD"
    2.74 +        xc.domain_destroy ( dom=id )
    2.75 +        sys.exit()
    2.76 +    if xc.vbd_add_extent( dom=id,
    2.77 +                          vbd=root_info[0],
    2.78 +                          device=root_info[1],
    2.79 +                          start_sector=root_info[2],
    2.80 +                          nr_sectors=root_info[3] ):
    2.81 +        print "Error populating root VBD"
    2.82 +        xc.domain_destroy ( dom=id )
    2.83 +        sys.exit()
    2.84 +
    2.85 +if usr_partn:
    2.86 +    if xc.vbd_create( dom=id, vbd=usr_info[0], writeable=0 ):
    2.87 +        print "Error creating usr VBD"
    2.88 +        xc.domain_destroy ( dom=id )
    2.89 +        sys.exit()
    2.90 +    if xc.vbd_add_extent( dom=id,
    2.91 +                          vbd=usr_info[0],
    2.92 +                          device=usr_info[1],
    2.93 +                          start_sector=usr_info[2],
    2.94 +                          nr_sectors=usr_info[3] ):
    2.95 +        print "Error populating usr VBD"
    2.96 +        xc.domain_destroy ( dom=id )
    2.97 +        sys.exit()
    2.98 +
    2.99 +XenoUtil.setup_vfr_rules_for_vif( id, 0, ipaddr )
   2.100 +
   2.101 +if xc.domain_start( dom=id ):
   2.102 +    print "Error starting domain"
   2.103 +    xc.domain_destroy ( dom=id )
   2.104 +    sys.exit()
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/examples/destroydom.py	Sat Nov 22 11:45:34 2003 +0000
     3.3 @@ -0,0 +1,18 @@
     3.4 +#!/usr/bin/env python
     3.5 +
     3.6 +#
     3.7 +# Destroy specified domain.
     3.8 +#
     3.9 +
    3.10 +import Xc, sys, re
    3.11 +
    3.12 +xc = Xc.new()
    3.13 +
    3.14 +if len(sys.argv) < 2:
    3.15 +    print "Specify a domain identifier"
    3.16 +    sys.exit()
    3.17 +
    3.18 +if (len(sys.argv) > 2) and re.match( 'force', sys.argv[2] ):
    3.19 +    xc.domain_destroy( dom=int(sys.argv[1]), force=1 )
    3.20 +else:
    3.21 +    xc.domain_destroy( dom=int(sys.argv[1]), force=0 )
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/examples/listdoms.py	Sat Nov 22 11:45:34 2003 +0000
     4.3 @@ -0,0 +1,10 @@
     4.4 +#!/usr/bin/env python
     4.5 +
     4.6 +#
     4.7 +# List info on all domains.
     4.8 +#
     4.9 +
    4.10 +import Xc, sys
    4.11 +xc = Xc.new()
    4.12 +print xc.domain_getinfo()
    4.13 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/examples/stopdom.py	Sat Nov 22 11:45:34 2003 +0000
     5.3 @@ -0,0 +1,15 @@
     5.4 +#!/usr/bin/env python
     5.5 +
     5.6 +#
     5.7 +# Stop execution of specified domain.
     5.8 +#
     5.9 +
    5.10 +import Xc, sys, re
    5.11 +
    5.12 +xc = Xc.new()
    5.13 +
    5.14 +if len(sys.argv) != 2:
    5.15 +    print "Specify a domain identifier"
    5.16 +    sys.exit()
    5.17 +
    5.18 +xc.domain_stop( dom=int(sys.argv[1]) )
     6.1 --- a/tools/examples/xi_createlinuxdom.py	Sat Nov 22 11:43:49 2003 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,101 +0,0 @@
     6.4 -#!/usr/bin/env python
     6.5 -
     6.6 -#
     6.7 -# Example script for creating and building a new Linux guest OS for Xen.
     6.8 -#
     6.9 -
    6.10 -import Xc, XenoUtil, sys, os
    6.11 -
    6.12 -# Variable declaration. Set these up properly later on, as needed.
    6.13 -nfsserv = nfspath = root_partn = usr_partn = ""
    6.14 -
    6.15 -# STEP 1. Specify kernel image file.
    6.16 -image = "FULL_PATH_TO_IMAGE"
    6.17 -
    6.18 -# STEP 2. Specify IP address, netmask and gateway for the new domain.
    6.19 -ipaddr  = "ADDRESS"
    6.20 -netmask = XenoUtil.get_current_ipmask()
    6.21 -gateway = XenoUtil.get_current_ipgw()
    6.22 -
    6.23 -# STEP 3a. Specify NFS server and path to rootfs (only needed for network boot)
    6.24 -nfsserv = "ADDRESS"
    6.25 -nfspath = "FULL_PATH_TO_ROOT_DIR"
    6.26 -
    6.27 -# STEP 3b. Specify root (and possibly /usr) on local disc (if not NFS booting)
    6.28 -#root_partn = "/dev/sda2"
    6.29 -#usr_partn  = "/dev/sda6"
    6.30 -
    6.31 -# STEP 4. Check that the following cmdline setup is to your taste.
    6.32 -cmdline = "ip="+ipaddr+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off"
    6.33 -if root_partn:
    6.34 -    # Boot from local disc. May specify a separate /usr.
    6.35 -    cmdline = cmdline + " root="+root_partn+" ro"
    6.36 -    if usr_partn:
    6.37 -        " usr="+usr_partn
    6.38 -elif nfsserv:
    6.39 -    # NFS boot
    6.40 -    cmdline = cmdline + " root=/dev/nfs"
    6.41 -    cmdline = cmdline + " nfsroot="+nfspath
    6.42 -
    6.43 -if root_partn:
    6.44 -    root_info = XenoUtil.lookup_blkdev_partn_info(root_partn)
    6.45 -    if not root_info:
    6.46 -        print "Could not obtain info on partition '" + root_partn + "'"
    6.47 -        sys.exit()
    6.48 -
    6.49 -if usr_partn:
    6.50 -    usr_info = XenoUtil.lookup_blkdev_partn_info(usr_partn)
    6.51 -    if not usr_info:
    6.52 -        print "Could not obtain info on partition '" + usr_partn + "'"
    6.53 -        sys.exit()
    6.54 -
    6.55 -if not os.path.isfile( image ):
    6.56 -    print "Image file '" + image + "' does not exist"
    6.57 -    sys.exit()
    6.58 -
    6.59 -xc = Xc.new()
    6.60 -
    6.61 -id = xc.domain_create()
    6.62 -if id <= 0:
    6.63 -    print "Error creating domain"
    6.64 -    sys.exit()
    6.65 -
    6.66 -if xc.linux_build( dom=id, image=image, cmdline=cmdline ):
    6.67 -    print "Error building Linux guest OS"
    6.68 -    xc.domain_destroy ( dom=id )
    6.69 -    sys.exit()
    6.70 -
    6.71 -if root_partn:
    6.72 -    if xc.vbd_create( dom=id, vbd=root_info[0], writeable=1 ):
    6.73 -        print "Error creating root VBD"
    6.74 -        xc.domain_destroy ( dom=id )
    6.75 -        sys.exit()
    6.76 -    if xc.vbd_add_extent( dom=id,
    6.77 -                          vbd=root_info[0],
    6.78 -                          device=root_info[1],
    6.79 -                          start_sector=root_info[2],
    6.80 -                          nr_sectors=root_info[3] ):
    6.81 -        print "Error populating root VBD"
    6.82 -        xc.domain_destroy ( dom=id )
    6.83 -        sys.exit()
    6.84 -
    6.85 -if usr_partn:
    6.86 -    if xc.vbd_create( dom=id, vbd=usr_info[0], writeable=0 ):
    6.87 -        print "Error creating usr VBD"
    6.88 -        xc.domain_destroy ( dom=id )
    6.89 -        sys.exit()
    6.90 -    if xc.vbd_add_extent( dom=id,
    6.91 -                          vbd=usr_info[0],
    6.92 -                          device=usr_info[1],
    6.93 -                          start_sector=usr_info[2],
    6.94 -                          nr_sectors=usr_info[3] ):
    6.95 -        print "Error populating usr VBD"
    6.96 -        xc.domain_destroy ( dom=id )
    6.97 -        sys.exit()
    6.98 -
    6.99 -XenoUtil.setup_vfr_rules_for_vif( id, 0, ipaddr )
   6.100 -
   6.101 -if xc.domain_start( dom=id ):
   6.102 -    print "Error starting domain"
   6.103 -    xc.domain_destroy ( dom=id )
   6.104 -    sys.exit()
     7.1 --- a/tools/examples/xi_destroydom.py	Sat Nov 22 11:43:49 2003 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,18 +0,0 @@
     7.4 -#!/usr/bin/env python
     7.5 -
     7.6 -#
     7.7 -# Destroy specified domain.
     7.8 -#
     7.9 -
    7.10 -import Xc, sys, re
    7.11 -
    7.12 -xc = Xc.new()
    7.13 -
    7.14 -if len(sys.argv) < 2:
    7.15 -    print "Specify a domain identifier"
    7.16 -    sys.exit()
    7.17 -
    7.18 -if (len(sys.argv) > 2) and re.match( 'force', sys.argv[2] ):
    7.19 -    xc.domain_destroy( dom=int(sys.argv[1]), force=1 )
    7.20 -else:
    7.21 -    xc.domain_destroy( dom=int(sys.argv[1]), force=0 )
     8.1 --- a/tools/examples/xi_listdoms.py	Sat Nov 22 11:43:49 2003 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,10 +0,0 @@
     8.4 -#!/usr/bin/env python
     8.5 -
     8.6 -#
     8.7 -# List info on all domains.
     8.8 -#
     8.9 -
    8.10 -import Xc, sys
    8.11 -xc = Xc.new()
    8.12 -print xc.domain_getinfo()
    8.13 -
     9.1 --- a/tools/examples/xi_stopdom.py	Sat Nov 22 11:43:49 2003 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,15 +0,0 @@
     9.4 -#!/usr/bin/env python
     9.5 -
     9.6 -#
     9.7 -# Stop execution of specified domain.
     9.8 -#
     9.9 -
    9.10 -import Xc, sys, re
    9.11 -
    9.12 -xc = Xc.new()
    9.13 -
    9.14 -if len(sys.argv) != 2:
    9.15 -    print "Specify a domain identifier"
    9.16 -    sys.exit()
    9.17 -
    9.18 -xc.domain_stop( dom=int(sys.argv[1]) )