vmware2libvirt fails when converting vmx file created under windows

Bug #385410 reported by Nelson Kwai
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
virt-goodies (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: virt-goodies

in package, virt-goodies 0.3

Ubuntu 9.04, jaunty

Fails with error when converting a vmx file created under windows.

 File "usr/bin/vmware2libvirt", line 85, in get_memory
   memory = int(memsize) * 1024
"ValueEror: invalid literal for int() with base 10: '512"'

Change line 85 from:
value = pat.sub( '', line)[1:-2]

to:
value = pat.sub( '', line.replace("\r","")[1:-2]

Revision history for this message
David Llop (dllop) wrote :

Same output. I hope my comment helps to fix it. The .vmx and .vmdk are under the same directory.

$vmware2libvirt -f ./Windows\ XP\ Professional.vmx > Windows\ XP\ Professional.xml
WARN: '/media/DATA/MV/c:\MV\Windows XP Professional.vmdk"' does not exist
Traceback (most recent call last):
  File "/usr/bin/vmware2libvirt", line 232, in <module>
    </disk>''' + get_network(vmx, bridge) + '''
  File "/usr/bin/vmware2libvirt", line 85, in get_memory
    memory = int(memsize) * 1024
ValueError: invalid literal for int() with base 10: '512"'

VMX file:

config.version = "8"

virtualHW.version = "4"

scsi0.present = "TRUE"

memsize = "512"

MemAllowAutoScaleDown = "FALSE"

ide0:0.present = "TRUE"

ide0:0.fileName = "c:\MV\Windows XP Professional.vmdk"

ide1:0.present = "FALSE"

ide1:0.fileName = "auto detect"

ide1:0.deviceType = "cdrom-raw"

floppy0.present = "FALSE"

ethernet0.present = "TRUE"

ethernet0.connectionType = "nat"

usb.present = "TRUE"

sound.present = "TRUE"

sound.virtualDev = "es1371"

sound.fileName = "-1"

sound.autodetect = "TRUE"

displayName = "Windows XP Professional"

guestOS = "winxppro"

nvram = "Windows XP Professional.nvram"
[...]

Changing ide0:0.fileName = "c:\MV\Windows XP Professional.vmdk" to ide0:0.fileName = "Windows XP Professional.vmdk" I have the same output:

WARN: '/media/DATA/MV/Windows XP Professional.vmdk"' does not exist
Traceback (most recent call last):
  File "/usr/bin/vmware2libvirt", line 232, in <module>
    </disk>''' + get_network(vmx, bridge) + '''
  File "/usr/bin/vmware2libvirt", line 85, in get_memory
    memory = int(memsize) * 1024
ValueError: invalid literal for int() with base 10: '512"'

Revision history for this message
CuteChaps (sh-senthilkumar) wrote :

I too get the same error,

root@CSS-SMOD:/home/senthil/My Documents/Virtual-Os/Solaris10VVM# vmware2libvirt -f Solaris\ 10.vmx > Solaris-10.xml
Traceback (most recent call last):
  File "/usr/bin/vmware2libvirt", line 232, in <module>
    </disk>''' + get_network(vmx, bridge) + '''
  File "/usr/bin/vmware2libvirt", line 85, in get_memory
    memory = int(memsize) * 1024
ValueError: invalid literal for int() with base 10: '256"

Revision history for this message
Trey Nolen (ubuntu-bellsouthsux) wrote :

I'm also seeing this issue, but not with Windwos VM. I am using the VMWare image for Ultimate Deployment Appliance. It can be found here: http://www.ultimatedeployment.org/uda14.zip

The error I get is this:
vmware2libvirt -f ./uda14.vmx > uda14.xml
WARN: '/virtroot2/deployment/uda14.vmdk"' does not exist
Traceback (most recent call last):
  File "/usr/bin/vmware2libvirt", line 232, in <module>
    </disk>''' + get_network(vmx, bridge) + '''
  File "/usr/bin/vmware2libvirt", line 85, in get_memory
    memory = int(memsize) * 1024
ValueError: invalid literal for int() with base 10: '256"'

Now, the thing is that the WARN: says that this file does not use, but check this out:

tnolen@vserv1:/virtroot2/deployment$ ls -al uda14.vmdk
-rw-r--r-- 1 tnolen tnolen 2147483648 2009-09-30 10:55 uda14.vmdk

Looks like it exists to me....

Revision history for this message
doughold (doug-westechsolutions) wrote :

I am having this issue as well. I am trying to move a vmware server 2003 machine to kvm and I get two errors. One is with the disk, it says "A disk read error occurred" (won't get into that here). When I try to conver the vmx file using:

vmware2libvirt -f <vmx_file> > <xml_file>
WARN: '<filename>.vmdk"' does not exist
Traceback (most recent call last):
  File "/usr/bin/vmware2libvirt", line 232, in <module>
    </disk>''' + get_network(vmx, bridge) + '''
  File "/usr/bin/vmware2libvirt", line 85, in get_memory
    memory = int(memsize) * 1024
ValueError: invalid literal for int() with base 10: '880"'

File definitely exists and I have converted two other VMWare linux boxes so I know it should work...

Revision history for this message
hssxy (e11years) wrote :

Wasn't clear in the original post. The following fix worked for me:

Make this change in the file "usr/bin/vmware2libvirt" :

Change line 85 from:
value = pat.sub( '', line)[1:-2]

to:
value = pat.sub( '', line.replace("\r","")[1:-2]

Revision history for this message
Jamin W. Collins (jcollins) wrote :

Just an FYI, the line for me was 65, not 85, and the value to value hssxy is recommending is missing a closing parenthesis, it should be

value = pat.sub( '', line.replace("\r",""))[1:-2]

Revision history for this message
Petter Reinholdtsen (pere-hungry) wrote :

I ran into this problem too, and can confirm that the fix from Jamin W. Collins work.

Here is the diff.

--- /tmp/vmware2libvirt 2010-02-17 11:21:15.000000000 +0100
+++ /usr/bin/vmware2libvirt 2010-02-17 11:21:31.000000000 +0100
@@ -62,7 +62,7 @@
     for line in vmx:
         if pat.search(line):
             # extract value without quotes
- value = pat.sub('', line)[1:-2]
+ value = pat.sub( '', line.replace("\r",""))[1:-2]

     if value == "":
         raise V2LError("Bad value for '" + key + "'")

Revision history for this message
Petter Reinholdtsen (pere-hungry) wrote :

I believe this issue was fixed in version 0.4.

Soren Hansen (soren)
Changed in virt-goodies (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.