def _apply_scsi_controller(adapter, adapter_type, bus_sharing, key,
                           bus_number, operation):
    '''
    Returns a vim.vm.device.VirtualDeviceSpec object specifying to
    add/edit a SCSI controller

    adapter
        SCSI controller adapter name

    adapter_type
        SCSI controller adapter type eg. paravirtual

    bus_sharing
         SCSI controller bus sharing eg. virtual_sharing

    key
        SCSI controller unique key

    bus_number
        Device bus number property

    operation
        Describes the operation which should be done on the object,
        the possibles values: 'add' and 'edit', the default value is 'add'

    .. code-block: bash

        scsi:
          adapter: 'SCSI controller 0'
          type: paravirtual or lsilogic or lsilogic_sas
          bus_sharing: 'no_sharing' or 'virtual_sharing' or 'physical_sharing'
    '''
    log.trace('Configuring scsi controller adapter=%s adapter_type=%s '
              'bus_sharing=%s key=%s bus_number=%s',
              adapter, adapter_type, bus_sharing, key, bus_number)
    scsi_spec = vim.vm.device.VirtualDeviceSpec()
    if adapter_type == 'lsilogic':
        summary = 'LSI Logic'
        scsi_spec.device = vim.vm.device.VirtualLsiLogicController()
    elif adapter_type == 'lsilogic_sas':
        summary = 'LSI Logic Sas'
        scsi_spec.device = vim.vm.device.VirtualLsiLogicSASController()
    elif adapter_type == 'paravirtual':
        summary = 'VMware paravirtual SCSI'
        scsi_spec.device = vim.vm.device.ParaVirtualSCSIController()
    elif adapter_type == 'buslogic':
        summary = 'Bus Logic'
        scsi_spec.device = vim.vm.device.VirtualBusLogicController()
    if operation == 'add':
        scsi_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
    elif operation == 'edit':
        scsi_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit
    scsi_spec.device.key = key
    scsi_spec.device.busNumber = bus_number
    scsi_spec.device.deviceInfo = vim.Description()
    scsi_spec.device.deviceInfo.label = adapter
    scsi_spec.device.deviceInfo.summary = summary
    if bus_sharing == 'virtual_sharing':
        # Virtual disks can be shared between virtual machines on
        # the same server
        scsi_spec.device.sharedBus = \
            vim.vm.device.VirtualSCSIController.Sharing.virtualSharing
    elif bus_sharing == 'physical_sharing':
        # Virtual disks can be shared between virtual machines on any server
        scsi_spec.device.sharedBus = \
            vim.vm.device.VirtualSCSIController.Sharing.physicalSharing
    elif bus_sharing == 'no_sharing':
        # Virtual disks cannot be shared between virtual machines
        scsi_spec.device.sharedBus = \
            vim.vm.device.VirtualSCSIController.Sharing.noSharing
    return scsi_spec
Returns a vim.vm.device.VirtualDeviceSpec object specifying to
    add/edit a SCSI controller

    adapter
        SCSI controller adapter name

    adapter_type
        SCSI controller adapter type eg. paravirtual

    bus_sharing
         SCSI controller bus sharing eg. virtual_sharing

    key
        SCSI controller unique key

    bus_number
        Device bus number property

    operation
        Describes the operation which should be done on the object,
        the possibles values: 'add' and 'edit', the default value is 'add'

    .. code-block: bash

        scsi:
          adapter: 'SCSI controller 0'
          type: paravirtual or lsilogic or lsilogic_sas
          bus_sharing: 'no_sharing' or 'virtual_sharing' or 'physical_sharing'