Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

RDM (What could be the problem)

$
0
0

Hi Mac,

 

 

For creating RDM we need to do the following:

 

 

 

 

Create the VirtualDeviceConfigSpec and set its properties.

Create VirtualMachineConfigSpec object and set the VirtualDeviceConfigSpec to the device change property of VirtualMachineConfigSpec object.

3.   Call the ReconfigVM_Task.

 

 

 

 

If I follow the process 1 specified below getting the error “Incompatible device backing specified for device 0 “ as it is unable to create the vmdk file with the path specified in

 

backingInfo->fileName. If I specify backingInfo->fileName=”[datastorename]” then it is creating Virtual Disk with unknown size which is not RDM.

 

 

 

 

But if I follow the process 2 , first create vmdk file and then specify this file in backingInfo->fileName, its working fine.

 

But the problem is it works only in case of ESXServer not Virtual Center because for creating VirtualDisk_Task, it takes VirtualDiskManager as

 

Parameter which is not set in case of Virtual Center.

 

 

 

 

So we are unable to understand why it is failing to create the RDM in process 1.

 

I am also enclosing the link where the guy is able to create RDM using Process 1.

 

Link : http://communities.vmware.com/thread/38923;jsessionid=14172672B2B1D99EBB70617BD6066CE5?tstart=15

 

 

 

 

We came to know how to set the values for the following properties also

 

 

 

 

backingInfo->lunUuid

 

vdCfgSpec->device->unitNumber

 

vdCfgSpec->device->controllerKey

 

 

 

 

I also tried setting the below property in process 1 but no use

 

 

 

 

vdCfgSpec ->fileOperation = VirtualDeviceConfigSpecFileOperation::create;       

 

vdCfgSpec ->fileOperationSpecified = true;

 

 

 

 

I am still working on this, but if you find any solution on process 1, please let me know.

 

 

 

 

Thanks & Regards

 

Neela

 

 

 

 

 

 

 

1.Process to create a RDM   (Error : Incompatible device backing specified for device 0)

 

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

 

 

 

 

/// Create VirtualDeviceConfigSpec object and set its properties

 

VimApi::VirtualDeviceConfigSpec^ vdCfgSpec = gcnew VimApi::VirtualDeviceConfigSpec();         

 

vdCfgSpec->operation = VirtualDeviceConfigSpecOperation::add;

 

vdCfgSpec->operationSpecified = true;

 

 

 

 

vdCfgSpec->device = gcnew VirtualDisk();

 

VirtualDiskRawDiskMappingVer1BackingInfo^ backingInfo = gcnew VirtualDiskRawDiskMappingVer1BackingInfo();

 

backingInfo->compatibilityMode = "physicalMode";         

 

/// Need to be changed to the canonical name  

 

backingInfo->deviceName = "vmhba1:1:17:0"; //p_VDisk->;

 

 

 

 

backingInfo->diskMode = "independent_persistent";

 

backingInfo->lunUuid =   01002d00003030303032374443303030374d61676e6974; // uuid we can get from the Host

 

 

 

 

 

 

 

backingInfo->fileName =  "[Primary] vm.vmdk";

 

 

 

 

// Note: set any *Specified values to true

 

vdCfgSpec->device->backing = backingInfo;

 

vdCfgSpec->device->connectable = gcnew VirtualDeviceConnectInfo();

 

vdCfgSpec->device->connectable->allowGuestControl = true;

 

vdCfgSpec->device->connectable->connected = true;

 

vdCfgSpec->device->connectable->startConnected   = true;

 

 

 

 

vdCfgSpec->device->controllerKey = 1000;//vdary[iSCSIControllerIndex].key; // you may have one already, or have to create one in this same spec.

 

vdCfgSpec->device->controllerKeySpecified = true;

 

 

 

 

vdCfgSpec->device->key = -1; // all devices can be -1, but. all SCSI controllers must have unique -ve values

 

vdCfgSpec->device->unitNumber = 3; // next device # in SCSI chain... vdCfgSpec[0].device.unitNumberSpecified = true;

 

vdCfgSpec->device->unitNumberSpecified = true;

 

 

 

 

VimApi::Description^ deviceInfo = gcnew VimApi::Description();

 

deviceInfo->label = "HardDisk123";

 

deviceInfo->summary = "";   

 

vdCfgSpec->device->deviceInfo = deviceInfo;

 

 

 

 

/// Create the Virtual Machine managed object

 

VimApi::ManagedObjectReference ^vm = gcnew VimApi::ManagedObjectReference();

 

vm->type = "VirtualMachine";

 

Morpheus::Model::VMW_ModelObjectId^ VMobj = safe_cast<Morpheus::Model::VMW_ModelObjectId^> (this->ObjectId);

 

vm->Value = VMobj->MOB->Value;

 

 

 

 

 

 

 

// Create the VirtualMachineConfigSpec object

 

VimApi::VirtualMachineConfigSpec^ virtualMacConfigSpec = gcnew VimApi::VirtualMachineConfigSpec();

 

virtualMacConfigSpec->deviceChange = gcnew array<VimApi::VirtualDeviceConfigSpec^>

 

m_pVimSvc->ReconfigVM_Task(vm,virtualMacConfigSpec);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Process to create a RDM   by creating the vmdk file first and then creating RDM (But works only with ESXServer not Virtual Center)

 

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

 

 

 

 

 

 

 

// Create the VirtualDiskManager MO

 

VimApi::ManagedObjectReference ^virtualDiskManager = gcnew VimApi::ManagedObjectReference();

 

virtualDiskManager->type = "VirtualDiskManager";

 

virtualDiskManager->Value = "ha-vdiskmanager";

 

 

 

 

/// create a DeviceBackedVirtualDiskSpec ob

 

VimApi::DeviceBackedVirtualDiskSpec^ virtualDiskSpec = gcnew VimApi::DeviceBackedVirtualDiskSpec();

 

virtualDiskSpec->diskType = "rdm";

 

virtualDiskSpec->adapterType = "lsiLogic";

 

virtualDiskSpec->device = p_VDisk->VMWDevicepath;     

 

pVim->CreateVirtualDisk_Task(virtualDiskManager,"[Primary] vm.vmdk",nullptr,virtualDiskSpec);

 

 

 

 

/// Create VirtualDeviceConfigSpec object and set its properties

 

VimApi::VirtualDeviceConfigSpec^ vdCfgSpec = gcnew VimApi::VirtualDeviceConfigSpec();         

 

vdCfgSpec->operation = VirtualDeviceConfigSpecOperation::add;

 

vdCfgSpec->operationSpecified = true;

 

 

 

 

vdCfgSpec->device = gcnew VirtualDisk();

 

VirtualDiskRawDiskMappingVer1BackingInfo^ backingInfo = gcnew VirtualDiskRawDiskMappingVer1BackingInfo();

 

backingInfo->compatibilityMode = "physicalMode";         

 

/// Need to be changed to the canonical name  

 

backingInfo->deviceName = "vmhba1:1:17:0"; //p_VDisk->;

 

 

 

 

backingInfo->diskMode = "independent_persistent";

 

backingInfo->lunUuid =   01002d00003030303032374443303030374d61676e6974; // uuid we can get from the Host

 

 

 

 

 

 

 

backingInfo->fileName =  "[Primary] vm.vmdk";

 

 

 

 

// Note: set any *Specified values to true

 

vdCfgSpec->device->backing = backingInfo;

 

vdCfgSpec->device->connectable = gcnew VirtualDeviceConnectInfo();

 

vdCfgSpec->device->connectable->allowGuestControl = true;

 

vdCfgSpec->device->connectable->connected = true;

 

vdCfgSpec->device->connectable->startConnected   = true;

 

 

 

 

vdCfgSpec->device->controllerKey = 1000;//vdary[iSCSIControllerIndex].key; // you may have one already, or have to create one in this same spec.

 

vdCfgSpec->device->controllerKeySpecified = true;

 

 

 

 

vdCfgSpec->device->key = -1; // all devices can be -1, but. all SCSI controllers must have unique -ve values

 

vdCfgSpec->device->unitNumber = 3; // next device # in SCSI chain... vdCfgSpec[0].device.unitNumberSpecified = true;

 

vdCfgSpec->device->unitNumberSpecified = true;

 

 

 

 

VimApi::Description^ deviceInfo = gcnew VimApi::Description();

 

deviceInfo->label = "HardDisk123";

 

deviceInfo->summary = "";   

 

vdCfgSpec->device->deviceInfo = deviceInfo;

 

 

 

 

/// Create the Virtual Machine managed object

 

VimApi::ManagedObjectReference ^vm = gcnew VimApi::ManagedObjectReference();

 

vm->type = "VirtualMachine";

 

Morpheus::Model::VMW_ModelObjectId^ VMobj = safe_cast<Morpheus::Model::VMW_ModelObjectId^> (this->ObjectId);

 

vm->Value = VMobj->MOB->Value;

 

 

 

 

 

 

 

// Create the VirtualMachineConfigSpec object

 

VimApi::VirtualMachineConfigSpec^ virtualMacConfigSpec = gcnew VimApi::VirtualMachineConfigSpec();

 

virtualMacConfigSpec->deviceChange = gcnew array<VimApi::VirtualDeviceConfigSpec^>

 

m_pVimSvc->ReconfigVM_Task(vm,virtualMacConfigSpec);

 

 

 

 

 

 

 

 

 

 

 

Regards

 

 

 

 

 

Neela

 

 


Viewing all articles
Browse latest Browse all 2039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>