<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>The new fix patch is attached. The code resets the geometry cSectors > 63 (which fails always before this fix), and don't update modification uuid if empty.</DIV>
<DIV> </DIV>
<DIV>a related issue, wonder if you like the idea of changing VDCopy callbacks to float/double percentage? right now, it's an int, the 1st 1% may takes more than 3 mins, not user friendly to update the progress bar<BR><BR>--- On <B>Wed, 10/7/09, Huihong Luo <I><huisinro@yahoo.com></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Huihong Luo <huisinro@yahoo.com><BR>Subject: Re: [vbox-dev] VDCopy() fix for VHD<BR>To: "Klaus Espenlaub" <Klaus.Espenlaub@Sun.COM><BR>Cc: vbox-dev@virtualbox.org<BR>Date: Wednesday, October 7, 2009, 3:02 PM<BR><BR>
<DIV id=yiv2121255793>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>yes, i debugged, and the following fails. So the modification uuid is not correctly set after conversion</DIV>
<DIV> </DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<DIV>static</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> vdiValidateHeader(PVDIHEADER pHeader)</DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<DIV>{</DIV>
<DIV>...</DIV>
<DIV>if</FONT></FONT><FONT size=2> (RTUuidIsNull(getImageModificationUUID(pHeader)))</DIV>
<DIV>{</DIV>
<DIV>LogRel((</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"VDI: uuid of modificator is 0\n"</FONT></FONT><FONT size=2>));</DIV>
<DIV>fFailed = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV>}</DIV>
<DIV></FONT><BR><BR>--- On <B>Wed, 10/7/09, Klaus Espenlaub <I><Klaus.Espenlaub@Sun.COM></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Klaus Espenlaub <Klaus.Espenlaub@Sun.COM><BR>Subject: Re: [vbox-dev] VDCopy() fix for VHD<BR>To: "Huihong Luo" <huisinro@yahoo.com><BR>Cc: vbox-dev@virtualbox.org<BR>Date: Wednesday, October 7, 2009, 2:02 PM<BR><BR>
<DIV class=plainMail>Huihong Luo wrote:<BR>> after the fix, VHD->VMDk seems to be working fine, but VHD->VDI still not working, the generated vdi disk throws invalid header error.<BR><BR>Don't think it's a good idea to apply the change before understanding what's still going wrong in the VDI case. Should be pretty easy to figure out, by running "VBoxManage internalcommands dumphdinfo /path/to/broken.vdi", and setting a breakpoint on vdiValidateHeader. With a little bit of single stepping one should immediately see what's causing trouble. The VDI code is very paranoid.<BR><BR>Klaus<BR><BR>> <BR>> --- On *Wed, 10/7/09, Huihong Luo /<<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank rel=nofollow>huisinro@yahoo.com</A>>/* wrote:<BR>> <BR>> <BR>>     From: Huihong Luo <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank
 rel=nofollow>huisinro@yahoo.com</A>><BR>>     Subject: [vbox-dev] VDCopy() fix for VHD<BR>>     To: <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow>vbox-dev@virtualbox.org</A><BR>>     Date: Wednesday, October 7, 2009, 12:30 AM<BR>> <BR>>     Can you guys add the following code to function VDCopy() in<BR>>     VBoxHDD.cpp? right before VDCreateBase() is called.<BR>>          It resets the geometry if cSectors > 63, VHD disk somehow has more<BR>>     than 63 sectors.<BR>>                   /* vmlite, fix converting error from VHD */<BR>>         if (PCHSGeometryFrom.cHeads > 16 || PCHSGeometryFrom.cSectors > 63)<BR>> 
        {<BR>>          Assert(RT_MIN(cbSize / 512 / 16 / 63, 16383) -<BR>>             (unsigned int)RT_MIN(cbSize / 512 / 16 / 63, 16383) == 0);           PCHSGeometryFrom.cCylinders = (unsigned int)RT_MIN(cbSize / 512<BR>>     / 16 / 63, 16383);<BR>>          PCHSGeometryFrom.cHeads = 16;<BR>>          PCHSGeometryFrom.cSectors = 63;<BR>>         }<BR>>         /* vmlite */<BR>>                     rc = VDCreateBase(pDiskTo, pszBackend, pszFilename,<BR>>     cbSize,<BR>>                                   
    uImageFlags, szComment,<BR>>                                       &PCHSGeometryFrom, &LCHSGeometryFrom,<BR>>                                       NULL, uOpenFlagsFrom &<BR>>     ~VD_OPEN_FLAGS_READONLY, NULL, NULL);<BR>>                     if (RT_SUCCESS(rc) && !RTUuidIsNull(&ImageUuid))<BR>>                             pDiskTo->pLast->Backend->pfnSetUuid(pDiskTo->pLast->pvBackendData,<BR>>     &ImageUuid);<BR>>                 
    if (RT_SUCCESS(rc) && !RTUuidIsNull(&ParentUuid))<BR>>                             pDiskTo->pLast->Backend->pfnSetParentUuid(pDiskTo->pLast->pvBackendData,<BR>>     &ParentUuid);<BR>>               - Huihong<BR>> <BR>> <BR>>     -----Inline Attachment Follows-----<BR>> <BR>>     _______________________________________________<BR>>     vbox-dev mailing list<BR>>     <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow>vbox-dev@virtualbox.org</A><BR>>     <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank
 rel=nofollow>http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org</A>><BR>>     <A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank rel=nofollow>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>> <BR>> _______________________________________________<BR>> vbox-dev mailing list<BR>> <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow>vbox-dev@virtualbox.org</A><BR>> <A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank rel=nofollow>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE></DIV><BR>-----Inline Attachment Follows-----<BR><BR>
<DIV class=plainMail>_______________________________________________<BR>vbox-dev mailing list<BR><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A><BR><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR></DIV></BLOCKQUOTE></td></tr></table>