Start mclu version 2.
[mclu.git] / libvirt_xml.py
diff --git a/libvirt_xml.py b/libvirt_xml.py
deleted file mode 100644 (file)
index ceb5ab7..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/python
-# mclu (mini cluster)
-# Copyright (C) 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-import os
-import random
-import sys
-
-# Generate libvirt XML.  Would be nice to use virt-install here, but
-# it doesn't work: RHBZ#1095789
-def generate_libvirt_xml (vm_name, memory, vcpus, virtio, output):
-    network_model = "virtio"
-    if not virtio:
-        network_model = "e1000"
-
-    # Give the network a fixed MAC address, otherwise libvirt will
-    # generate a random one on every guest restart.
-    network_mac = "52:54:00:%02x:%02x:%02x" % (random.randint (0, 0xff),
-                                               random.randint (0, 0xff),
-                                               random.randint (0, 0xff))
-
-    # XXX Quoting, and we should use a real XML generator.
-    xml = """
-<domain type='kvm'>
-  <name>%s</name>
-  <memory unit='MiB'>%d</memory>
-  <currentMemory unit='MiB'>%d</currentMemory>
-  <vcpu>%d</vcpu>
-  <os>
-    <type>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <features>
-    <acpi/>
-    <apic/>
-    <pae/>
-  </features>
-  <cpu mode='host-model' fallback='allow' />
-  <clock offset='utc'>
-    <timer name='rtc' tickpolicy='catchup'/>
-    <timer name='pit' tickpolicy='delay'/>
-    <timer name='hpet' present='no'/>
-  </clock>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
-  <devices>
-    <interface type='bridge'>
-      <mac address='%s'/>
-      <source bridge='br0'/>
-      <model type='%s'/>
-    </interface>
-    <console type='pty'>
-      <target type='virtio' port='0'/>
-    </console>
-    <input type='tablet' bus='usb'/>
-    <input type='mouse' bus='ps2'/>
-    <!-- <input type='keyboard' bus='ps2'/> -->
-    <graphics type='vnc' autoport='yes'/>
-    <video>
-      <model type='cirrus' vram='9216' heads='1'/>
-    </video>
-""" % (vm_name, memory, memory, vcpus, network_mac, network_model)
-
-    # virtio-scsi or IDE disk:
-    if virtio:
-        xml += """
-    <controller type="scsi" index="0" model="virtio-scsi"/>
-    <disk type='file' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' io='native'/>
-      <source file='%s'/>
-      <target dev='sda' bus='scsi'/>
-    </disk>
-""" % output
-    else:
-        xml += """
-    <disk type='file' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' io='native'/>
-      <source file='%s'/>
-      <target dev='sda' bus='ide'/>
-    </disk>
-""" % output
-
-    xml += """
-  </devices>
-</domain>
-"""
-
-    return xml