2-Node Red Hat KVM Cluster Tutorial - Archive

From Alteeve Wiki
Jump to navigation Jump to search

Initializing vm0002-ms's Install

As before, we'll run the script with the virt-install command in it.

On an-node01, run;

/shared/provision/vm0002-ms.sh
Starting install...
Creating domain...                                       |    0 B     00:00     
Domain installation still in progress. Waiting for installation to complete.

This install isn't automated like the firewall was, so we'll need to hand-hold the VM through the install.

Initial provision of vm0002-ms.

After you get click to select the Custom (advanced) installation method, you will

The Windows 2008 VM vm0002-ms doesn't see a hard drive.

Click on the Load Driver option on the bottom left. You will be presented with a window telling you your options for loading the drivers.

The Windows 2008 VM vm0002-ms driver prompt.

Click on the OK button and the installer will automatically find the virtual floppy disk and present you with the available drivers. Click to highlight Red Hat VirtIO SCSI Controller (A:\amd64\Win2008\viostor.inf) and click the Next button.

Selecting the Win2008 virtio driver.

At this point, the windows installer will see the virtual hard drive and you can proceed with the install as you would normally install Windows 2008 R2 server.

The Win2008 installer now is about to use the virtio-backed storage.

Once the install is complete, reboot.

Installation of vm0002-ms complete.

Post-Install Housekeeping

We have to be careful to "eject" the virtual floppy and DVD disks from the VM. If you neglect to do so, then later delete the files, virsh will fail to boot the VMs and undefine them entirely. (Yes, that is dumb, in this author's opinion).

Before we see how to remove the media, let's look at what to do to fix the problem in case you ever run into it.

Should you ever run into your VM suddenly vanishing entirely, there is a good chance that this is the cause. Edit your last XML definition file for the VM to remove the <source file='...'/> lines for the removed media. For example, change:

    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source file='/shared/files/virtio-win-1.1.16.vfd'/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' io='threads'/>
      <source file='/shared/files/Windows_Server_2008_R2_64Bit_SP1.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>

To:

    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' io='threads'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>

Then redefine the VM and you can safely restart it again.

virsh define /shared/definitions/vm0002-ms.xml

Now, let's avoid this problem in the first place.

Let's start by confirming which disks are still connected to the VM using virsh;

virsh dumpxml vm0002-ms | grep -A 1 "source file"
      <source file='/shared/files/virtio-win-1.1.16.vfd'/>
      <target dev='fda' bus='fdc'/>
--
      <source file='/shared/files/Windows_Server_2008_R2_64Bit_SP1.iso'/>
      <target dev='hdc' bus='ide'/>

As we see, /shared/files/virtio-win-1.1.16.vfd is the virtual floppy disk and it is connect to the VM's fda device. The DVD-ROM ISO /shared/files/Windows_Server_2008_R2_64Bit_SP1.iso is still connected inside the VM as the hdc device.

Warning: There is a known bug in libvirt before version 0.9.7 where the virsh detach-disk (or using virsh attach-disk with an empty source) would fail. For this reason, the more convoluted editing of the XML definition file is used below.

To "eject" these, we will dump out the VM's XML definition, remove the <source file='...'> lines and then use the edited definition file with the virsh attach-disk reading in the edited XML file.

Any time we make a change to our definition, it's always good to first make a known-good copy in case something goes wrong. So the next four commands will create two dumps of the VM's definition, one for archive and the one we will edit, then a short sed command to remove the floppy and DVD disks from the definition and finally a diff to make sure the disks were removed.

virsh dumpxml vm0002-ms > /shared/archive/2011-11-14_vm0002-ms.xml
virsh dumpxml vm0002-ms > /shared/definitions/vm0002-ms.xml
sed -i '/<source file=/d' /shared/definitions/vm0002-ms.xml
diff -u /shared/archive/2011-11-14_vm0002-ms.xml /shared/definitions/vm0002-ms.xml
--- /shared/archive/2011-11-14_vm0002-ms.xml	2011-11-14 14:49:05.719365673 -0500
+++ /shared/definitions/vm0002-ms.xml	2011-11-14 14:44:19.928339179 -0500
@@ -28,14 +28,12 @@
     </disk>
     <disk type='file' device='floppy'>
       <driver name='qemu' type='raw' cache='none' io='threads'/>
-      <source file='/shared/files/virtio-win-1.1.16.vfd'/>
       <target dev='fda' bus='fdc'/>
       <alias name='fdc0-0-0'/>
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
     <disk type='file' device='cdrom'>
       <driver name='qemu' type='raw' io='threads'/>
-      <source file='/shared/files/Windows_Server_2008_R2_64Bit_SP1.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
       <alias name='ide0-1-0'/>
Note: An alternative way to alter the XML would be to run dumpxml through a reverse-grep; virsh dumpxml vm0002-ms | grep -v "source file" > /shared/definitions/vm0002-ms.xml. Another alternative would be to directly edit the VM using virsh edit vm0002-ms after having made the backup. As always, there are many ways to do the same thing.

Now to remove the disks, call

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Enterprise Support:
Alteeve Support
Community Support
© Alteeve's Niche! Inc. 1997-2024   Anvil! "Intelligent Availability®" Platform
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.