vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go
func (r *DiskSubresource) createDisk(l object.VirtualDeviceList) (*types.VirtualDisk, error) {
	disk := new(types.VirtualDisk)
	disk.Backing = new(types.VirtualDiskFlatVer2BackingInfo)

	// Only assign backing info if a datastore cluster is not specified. If one
	// is, skip this step.
	if r.rdd.Get("datastore_cluster_id").(string) == "" {
		if err := r.assignBackingInfo(disk); err != nil {
			return nil, err
		}
	}

	// Set a new device key for this device
	disk.Key = l.NewKey()
	return disk, nil
}
func (r *DiskSubresource) createDisk(l object.VirtualDeviceList) (*types.VirtualDisk, error) {
	disk := new(types.VirtualDisk)
	disk.Backing = new(types.VirtualDiskFlatVer2BackingInfo)

	// Only assign backing info if a datastore cluster is not specified. If one
	// is, skip this step.
	if r.rdd.Get("datastore_cluster_id").(string) == "" {
		if err := r.assignBackingInfo(disk); err != nil {
			return nil, err
		}
	}

	// Set a new device key for this device
	disk.Key = l.NewKey()
	return disk, nil
}
func ( r * DiskSubresource ) createDisk ( l object . VirtualDeviceList ) ( * types . VirtualDisk , error ) { disk := new ( types . VirtualDisk ) disk . Backing = new ( types . VirtualDiskFlatVer2BackingInfo ) // Only assign backing info if a datastore cluster is not specified. If one // is, skip this step. if r . rdd . Get ( " " ) . ( string ) == " " { if err := r . assignBackingInfo ( disk ) ; err != nil { return nil , err } } // Set a new device key for this device disk . Key = l . NewKey ( ) return disk , nil }
// createDisk performs all of the logic for a base virtual disk creation.
createDisk performs all of the logic for a base virtual disk creation .