This project is read-only.

Creating XVA from Vhds

Nov 2, 2010 at 2:37 AM

Hi Ken,

I am trying to create a XVA file from 2 Vhds. After my code (below) runs, I get an outputted XVA with the approrpiate size. However, when I try to import it into XenCenter, the import fails. Looking deeper into the issue, I run the import from the cmd line on the XenServer and get the error: 'The VM could not be imported. msg: INTERNAL_ERROR [ Failure("int_of_string") ] '. Could you please take a look at see if I am attacking the problem the right way, or is there another method I should be using?


            string vhd1 = @"C:\mydisk1.vhd";
            string vhd2 = @"C:\mydisk2.vhd";            

            VirtualDisk vhdDisk1 = VirtualDisk.OpenDisk(vhd1,FileAccess.Read);
            VirtualDisk vhdDisk2 = VirtualDisk.OpenDisk(vhd2, FileAccess.Read);         
            VirtualMachineBuilder vmB = new VirtualMachineBuilder();
            vmB.AddDisk("Disk-1", vhdDisk1.Content, Ownership.None);
            vmB.AddDisk("Disk-2", vhdDisk2.Content, Ownership.None);          
            vmB.DisplayName = "My Outputed XVA";


Nov 4, 2010 at 9:38 PM

This looks like a bug with DiscUtils.  It'll take me a little while, but I'll take a look and see what's going wrong.



Nov 4, 2010 at 9:41 PM

Excellent, thank you very much Ken. Your effort and punctuality is quite impressive.


Nov 13, 2010 at 1:26 PM

I've found some pretty huge bugs in the XVA support in DiscUtils - I've posted a change that should make things a whole lot better.

With the fixes, I'm able to import XVAs containing multiple disks.




Nov 17, 2010 at 11:44 PM

Hi Ken,

Thanks. I have downloaded the new dll's and verified the import works flawlessly for the XVA created with disc utils. :-)


I do have a follow-up question on continuing note; I would be more than happy to create a new thread if you wish.

The VM I am attempting to import a VM that (obviously) has 2 VHDs and a corresponding OVF file describing the construction of the VM with the VHDs. This VM's kernel has been Xenified. This makes changes which, among other things, points the hard drive's device paths to /dev/xvda and /dev/xvdb. The kernel informtion from `uname -a` command can be seen below:


Linux localhost.localdomain 2.6.18-194.17.4.el5xen #1 SMP Mon Oct 25 17:15:40 EDT 2010 i686 i686 i386 GNU/Linux


Upon doing an Appliance Import (of the OVF - no DiscUtils involved) from XenCenter, under the "Storage" tab I see the two hard drives; their device path is "<unknown>". Once the VM is powered on their device path becomes "/dev/xvda/" and "/dev/xvdb", then the VM boots as normal.

When Import is performed (of the XVA - created by DiscUtils from these two hard drives) the import successfully completes. After turning the VM on, their Device Path (under the "Storage" tab) is  "/dev/hda" and "/dev/hdb". The VM Does not boot-up but is left at the screen:


Booting 'CentOS (2.6.18-194.17.4.el5xen)'

root (hd0,0)
 Filesystem type is ext2fs, partition tyep 0x83
kernel /vmlinuz-2.6.18-194.17.4.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet

Error 13: Invalid or unsupported executable format

Press any key to continue...

The device path as "/dev/xvd*" is imperative to the health of this VM and it's hard drives. I was wondering how does DiscUtils determine this device path? From googling around, I saw many questions about the device path with "/dev/hd*" that referred to a Windows VM being imported. As a shot in the dark, could DiscUtils be handling Windows/Unix hard drives differently, or the same when they should be different? Again, just something to get some ideas flowing.

Again, thank you very much for your efforts.


Nov 21, 2010 at 11:04 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.