VMware {code} Community
VladimirT
Contributor
Contributor

Changed Block Tracking

Hi

I have two problems with change block tracking:

1. Activating with VirtualMachineConfigSpec does not work. I use the snipet

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec;

configSpec.ChangeTrackingEnabled = true;

ManagedObjectReference taskMoRef =

serviceConnection.getService().ReconfigureVm_Task(targetVM_MoRef, configSpec);

Task completes successfully. But verifying changeTrackingEnabled field in MOB shows false.

To enable it I had to add ctkEnabled field and set it to true.

2. After manually enabling change tracking and rebooting vm, I am creating a snapshot in Virtual Client and in MOB navigating to snapshots -> snapshot -> config -> hardware - virtualdisk - backing and changeId is set to Unset.

changeTrackingSupported capability is set to true as well. What am I missing?

Thanks

0 Kudos
6 Replies
tos2k
Expert
Expert

Most probably the virtual hardware is below version 7.

Block Change tracking requires vCenter/ESX 4, and so VMs of hardware version 7

Tos2k

0 Kudos
VladimirT
Contributor
Contributor

It is ESX4 and VM version is 7.

When enabling and geting changeId, do I have to connect to vCenter or ESX host?

Thanks

0 Kudos
tos2k
Expert
Expert

Right Smiley Wink I think you missed one line:

            VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
            configSpec.changeTrackingEnabled = true;
            configSpec.changeTrackingEnabledSpecified = true;
            ManagedObjectReference taskMoRef = _service.ReconfigVM_Task(v, configSpec);

Tos2k

0 Kudos
rahqa
VMware Employee
VMware Employee

Another thing i would want you to confirm from the VI client front is that, when you add the line ctkEnabled (value = true), under VM edit settings -> options -> advanced -> configuration parameters -> you need to ensure that you need to add lines for the individual VMDKs. I e along with the line ctkEnabled = true, there should be other lines for the VMDKs as well. For ex : scsi0:0.ctkEnabled = true; scsi0:1.ctkEnables = true and so on.

hope this helps

Thanks

Rahul

0 Kudos
ICT-Freak
Enthusiast
Enthusiast

I created a function that will enable CBT for al the VMDKs/Devices on running VM's.

Function EnableChangeTracking{<br /><br/>
param($vm)<br/><br/>
$vmView = Get-VM $vm | Get-View<br/><br/>
<br/><br/>
if($vmView.Config.Version -eq "vmx-04"){<br/><br/>
Write-Host -ForegroundColor Red `<br/><br/>
"The Virtual Hardware version of this VM does not support Changed Block Tracking"<br/><br/>
return<br/><br/>
}<br/><br/>
<br/><br/>
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec<br/><br/>
$vmConfigSpec.changeTrackingEnabled = $true<br/><br/>
$vmView.ReconfigVM($vmConfigSpec)<br/><br/>
<br/><br/>
sleep 3<br/><br/>
<br/><br/>
Get-VM $vm | New-Snapshot -Name "Temp" <br/><br/>
<br/><br/>
sleep 5<br/><br/>
<br/><br/>
Get-VM $vm | Get-Snapshot | Where {$_.Name -eq "Temp"} | Remove-Snapshot -Confirm:$false<br/><br/>
}


More info:

0 Kudos
lamw
Community Manager
Community Manager

Here is a vSphere SDK for Perl solution: ... depending if you need to enable this while VMs are running, you'll need to perform a stun operation to the VM for the actual CBT to take full affect which can be done via poweron/off, suspend/resume or creation of snapshot. The snapshot is probably the ideal one for enabling CBT for a VM that's online and can easily be modified within the script to support online VM updates.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos