X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=mclu_build.py;h=5ae8bae92d379b7e83fbaad7df564926ce9525ca;hb=a44a7182be648f5d979342df621d9943fe07a71f;hp=ce077a657c45e8ce63a0bc8d158759fbc3db4ecc;hpb=8f509fea52826d18df504f18ad0e702f54320f48;p=mclu.git diff --git a/mclu_build.py b/mclu_build.py index ce077a6..5ae8bae 100644 --- a/mclu_build.py +++ b/mclu_build.py @@ -25,6 +25,7 @@ import libvirt import config import lib +import libvirt_xml def cmdline (subparsers): p = subparsers.add_parser ( @@ -105,75 +106,11 @@ def run (c, args, nodes): # Generate the XML. Would be nice to use virt-install here, but # it doesn't work: RHBZ#1095789 - network_model = "virtio" - if not args.virtio: - network_model = "e1000" - - # XXX Quoting, and we should use a real XML generator. - xml = """ - - %s - %d - %d - %d - - hvm - - - - - - - - - - - - - - destroy - restart - restart - - - - - - - - - - - - - -""" % (vm_name, args.memory, args.memory, args.vcpus, network_model) - - # virtio-scsi or IDE disk: - if args.virtio: - xml += """ - - - - - - -""" % output - else: - xml += """ - - - - - -""" % output - - xml += """ - - -""" + xml = libvirt_xml.generate_libvirt_xml (vm_name, + args.memory, + args.vcpus, + args.virtio, + output) # Write the XML to the xmls_dir. fp = open ("%s/%s.xml" % (c['xmls_dir'], vm_name), "w") @@ -182,3 +119,4 @@ def run (c, args, nodes): # Start the guest. lib.start_guest (c, node, vm_name) + print "guest built and started on node %s" % node.name