func expandCPUCountConfig(d *schema.ResourceData) int32 {
	occ, ncc := d.GetChange("num_cpus")
	cha, _ := d.GetChange("cpu_hot_add_enabled")
	currentHotAdd := cha.(bool)
	chr, _ := d.GetChange("cpu_hot_remove_enabled")
	currentHotRemove := chr.(bool)
	oldCPUCount := int32(occ.(int))
	newCPUCount := int32(ncc.(int))

	switch {
	case oldCPUCount < newCPUCount:
		// Adding CPUs
		if !currentHotAdd {
			log.Printf("[DEBUG] %s: CPU operation requires a VM restart", resourceVSphereVirtualMachineIDString(d))
			d.Set("reboot_required", true)
		}
	case oldCPUCount > newCPUCount:
		// Removing CPUs
		if !currentHotRemove {
			log.Printf("[DEBUG] %s: CPU operation requires a VM restart", resourceVSphereVirtualMachineIDString(d))
			d.Set("reboot_required", true)
		}
	}
	return newCPUCount
}
func expandCPUCountConfig(d *schema.ResourceData) int32 {
	occ, ncc := d.GetChange("num_cpus")
	cha, _ := d.GetChange("cpu_hot_add_enabled")
	currentHotAdd := cha.(bool)
	chr, _ := d.GetChange("cpu_hot_remove_enabled")
	currentHotRemove := chr.(bool)
	oldCPUCount := int32(occ.(int))
	newCPUCount := int32(ncc.(int))

	switch {
	case oldCPUCount < newCPUCount:
		// Adding CPUs
		if !currentHotAdd {
			log.Printf("[DEBUG] %s: CPU operation requires a VM restart", resourceVSphereVirtualMachineIDString(d))
			d.Set("reboot_required", true)
		}
	case oldCPUCount > newCPUCount:
		// Removing CPUs
		if !currentHotRemove {
			log.Printf("[DEBUG] %s: CPU operation requires a VM restart", resourceVSphereVirtualMachineIDString(d))
			d.Set("reboot_required", true)
		}
	}
	return newCPUCount
}
// expandCPUCountConfig is a helper for expandVirtualMachineConfigSpec that
// determines if we need to restart the VM due to a change in CPU count. This
// is determined by the net change in CPU count and the pre-update values of
// cpu_hot_add_enabled and cpu_hot_remove_enabled. The pre-update value is
// important here as while CPU hot-add/remove is supported while the values are
// enabled on the virtual machine, modification of hot-add/remove themselves is
// an operation that requires a power down of the VM.