VMware {code} Community
r123
Contributor
Contributor

CopyDatastoreFile_Task strange behaviour

Hello,

I need to copy virtual disks (or files) between datastors in VI. I am using VMware Infrastructure (VI) API from perl. Initialy I tried to use CopyVirtualDisk_Task, but it apeared that it works just with ESX servers not virtual center. Then I tried to use CopyDatastoreFile_Task. CopyDatastoreFile_Task works fine with copying files in general, but it has strange behaviour when VM disk files ".vmdk" should be copied. When copying vmdk files it just creates very smallfile in destination - I think that it is some kind of reference to original file. Why it is so?

Following code is used in perl script to do the copy.

my $service_content = Vim::get_service_content();

my $file_mgr = Vim::get_view(mo_ref => $service_content->fileManager);

$file_mgr->waitForTask($file_mgr->CopyDatastoreFile_Task(sourceName => $SourceName,sourceDatacenter => $SourceDatacenter,destinationName => $DestName,destinationDatacenter => $DestDatacenter));

I also tried to move the file using MoveDatastoreFile_Task - it renamed source file dummy.vmdk to dummy-flat.vmdk, but in destination it again created very small file dummy.vmdk. But after that I was able to copy dummy-flat.vmdk with CopyDatastoreFile_Task. Can somebody explain this strange behaviour? Is there something wrong in those perl lines above? Files with extentions vmx, vmsd, vmxf I was able to copy successfuly.

Regards,

Roberts

Tags (1)
Reply
0 Kudos
1 Reply
r123
Contributor
Contributor

I forgot to add that all this happens on:

VMware ESX Server 3i, 3.5.0, 169697

VMware VirtualCenter Version 2.5.0 Build 147633

Client that executes perl script is: VMware-VIPerl-1.6.0-104313 on RedHat

Reply
0 Kudos