Results 1 to 2 of 2

Thread: Need advise - create new or clone for particular scenario.

  1. #1
    Join Date
    Jan 2013

    Question Need advise - create new or clone for particular scenario.

    I need advise on what would be best way of creating particular set of VMs.
    This is a strange scenario so it might take a while explain. I have a feeling solution is probably simple one line command that I cannot seem to be able to get.

    I have 44 hosts. Eeach of those host will be running ubuntu server with KVM and single VM inside. That VM will be running Fedora 10.

    44 hosts are automatically build using PXE boot kickstart script (that already taken care of).
    Once they are build i need to create a VM, that VM once started will go to and PXE boot itself and install Fedora 10. (PXE boot script for VM is ready and working.)

    I have test VM set and it's seems to be doing what I want.

    I am trying to figure out how on the first boot of each host
    create VM with empty drive of the size I need (pretty much raw image) with particular networking setup (2 network cards on each VM mapping to appropriate bridge.) and start it up.

    I know how to create this particular VM in virt-manager but so far was not successful in generating it in command line, so I am wondering if cloning it or copying some sample machine and scripting edit of xml file to change mac addresses might be safer way.
    Sadly I cannot clone existing disks, I have to generate each VM using PXE.

    Here is test vm xml file

    HTML Code:
    <domain type='kvm'>
        <type arch='x86_64' machine='pc-1.0'>hvm</type>
        <boot dev='hd'/>
      <clock offset='utc'/>
        <disk type='file' device='disk'>
          <driver name='qemu' type='raw'/>
          <source file='/var/lib/libvirt/images/dot-node.img'/>
          <target dev='vda' bus='virtio'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
        <controller type='virtio-serial' index='0'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
        <interface type='bridge'>
          <mac address='52:54:01:81:14:09'/>
          <source bridge='br1'/>
          <model type='virtio'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        <interface type='bridge'>
          <mac address='52:54:01:02:c8:5d'/>
          <source bridge='br0'/>
          <model type='virtio'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
        <serial type='pty'>
          <target port='0'/>
        <console type='pty'>
          <target type='serial' port='0'/>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='-1' autoport='yes'/>
        <sound model='ich6'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
          <model type='vga' vram='9216' heads='1'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
        <memballoon model='virtio'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

  2. #2
    Join Date
    Jan 2013

    Re: Need advise - create new or clone for particular scenario.

    Looks like easiest way to accomplish this to copy .xml file to new host post install, change mac addresses and then run following :
    qemu-img create -f raw /var/lib/libvirt/images/dot-node.img 100g
    virsh define node.xml
    virsh start


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts