That is the problem, my code is written exactly like the link you have provided and it does not work. Since I take the information from the ConfigInfo file I stored during backup, I read and load values from the file. I fill the controller key like this
vmConfigSpec.deviceChange[currIndex]->device = vd[devIndex];
int cKey = -(*scsiCtrl->controllerKey);
vmConfigSpec.deviceChange[currIndex]->device->controllerKey = &(cKey);
vmConfigSpec.deviceChange[currIndex]->device->key = -(scsiCtrl->key);
Where the scsiCtrl is the pointer to the scsicontroller that I filled up the deviceChange with. As an experiment I removed the disk from the configuration and the VM gets created without any problem.
Thanks,
./Siva.