vmware / vmware/pyvmomi

VFlashCacheConfigInfo not updating VM Settings

Open
#785 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs verification
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

It seems as if the module for adding vflashcache is not properly sending the information during a vmchange. I've been able to perform the action sending an identical object using perl. When I send it with pyvmomi in python, vmware recognizes that a change is happening, performs the update, but the vcache is not applied.

Here is my code excerpt:

def vmEnableFlashCache(vmuuid):
try:
    vcstuff = vcenter.RetrieveContent()
except:
    global vcenter 
    vcenter = refreshVcenter()
    vcstuff = vcenter.RetrieveContent()
custvm = vcstuff.searchIndex.FindByUuid(None, vmuuid, True)
disk_spec = []
for device in custvm.config.hardware.device:
    if isinstance(device, vim.vm.device.VirtualDisk):
        flashcapacity = (device.capacityInKB * .10)/1024
        diskspec = vim.vm.device.VirtualDeviceSpec()
        diskspec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit
        diskspec.device = device
        flashcacheconfig = vim.vm.device.VirtualDisk.VFlashCacheConfigInfo()
        flashcacheconfig.reservationInMB = int(flashcapacity)
        flashcacheconfig.blockSizeInKB = 4
        flashcacheconfig.cacheMode = "write_thru"
        flashcacheconfig.cacheConsistencyType = "strong"
        diskspec.device.vFlashCacheConfigInfo = flashcacheconfig
        disk_spec.append(diskspec)
        print disk_spec
newconfig = vim.vm.ConfigSpec(deviceChange=disk_spec)
status = custvm.ReconfigVM_Task(newconfig)
print status
raw_input("check to see if Flash worked.")

There is no error in the vmware logs. I have compared the object created by python and submitted by pyvmomi and the object created by perl and they appear the same. However, vmware only updates from the perl script. I'm using python 2.7 and pyvmomi 6.7.1.2018.12.

Here is the pyvmomi deviceSpec output:

(vim.vm.device.VirtualDeviceSpec) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   operation = 'edit',
   fileOperation = <unset>,
   device = (vim.vm.device.VirtualDisk) {
      dynamicType = <unset>,
      dynamicProperty = (vmodl.DynamicProperty) [],
      key = 2001,
      deviceInfo = (vim.Description) {
         dynamicType = <unset>,
         dynamicProperty = (vmodl.DynamicProperty) [],
         label = 'Hard disk 2',
         summary = '167,772,160 KB'
      },
      backing = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) {
         dynamicType = <unset>,
         dynamicProperty = (vmodl.DynamicProperty) [],
         fileName = '[rubrik_ec9c98c1176941b48e4cdf1a4b01b014] 2001/FIN-APP_1.vmdk',
         datastore = 'vim.Datastore:datastore-44335',
         backingObjectId = <unset>,
         diskMode = 'persistent',
         split = false,
         writeThrough = false,
         thinProvisioned = false,
         eagerlyScrub = true,
         uuid = '6000C298-75fc-2db5-8bb0-5ec422f163b9',
         contentId = '1624048253fa0183b10237f6fffffffe',
         changeId = <unset>,
         parent = <unset>,
         deltaDiskFormat = <unset>,
         digestEnabled = <unset>,
         deltaGrainSize = <unset>,
         deltaDiskFormatVariant = <unset>,
         sharing = <unset>,
         keyId = <unset>
      },
      connectable = <unset>,
      slotInfo = <unset>,
      controllerKey = 1000,
      unitNumber = 1,
      capacityInKB = 167772160L,
      capacityInBytes = <unset>,
      shares = (vim.SharesInfo) {
         dynamicType = <unset>,
         dynamicProperty = (vmodl.DynamicProperty) [],
         shares = 1000,
         level = 'normal'
      },
      storageIOAllocation = (vim.StorageResourceManager.IOAllocationInfo) {
         dynamicType = <unset>,
         dynamicProperty = (vmodl.DynamicProperty) [],
         limit = -1L,
         shares = (vim.SharesInfo) {
            dynamicType = <unset>,
            dynamicProperty = (vmodl.DynamicProperty) [],
            shares = 1000,
            level = 'normal'
         },
         reservation = <unset>
      },
      diskObjectId = <unset>,
      vFlashCacheConfigInfo = (vim.vm.device.VirtualDisk.VFlashCacheConfigInfo) {
         dynamicType = <unset>,
         dynamicProperty = (vmodl.DynamicProperty) [],
         vFlashModule = 'vfc',
         reservationInMB = 16384,
         cacheConsistencyType = 'strong',
         cacheMode = 'write_thru',
         blockSizeInKB = 4
      },
      iofilter = (str) [],
      vDiskId = <unset>
   },
   profile = (vim.vm.ProfileSpec) [],
   backing = <unset>
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the vmEnableFlashCache entry point and the ReconfigVM_Task call, using the provided pyvmomi deviceSpec and VMware comparison as the reproduction. Trace how the VFlashCacheConfigInfo fields are submitted and confirm done when an equivalent VM reconfiguration applies the vcache. No repository file or test is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.