Returns a list of vim.vm.device.VirtualDeviceSpec objects representing the
    CD/DVD drives to be created for a virtual machine

    cd_drives
        CD/DVD drive properties

    controllers
        CD/DVD drive controllers (IDE, SATA)

    parent_ref
        Parent object reference

def _create_cd_drives(cd_drives, controllers=None, parent_ref=None):
    '''
    Returns a list of vim.vm.device.VirtualDeviceSpec objects representing the
    CD/DVD drives to be created for a virtual machine

    cd_drives
        CD/DVD drive properties

    controllers
        CD/DVD drive controllers (IDE, SATA)

    parent_ref
        Parent object reference
    '''
    cd_drive_specs = []
    keys = range(-3000, -3050, -1)
    if cd_drives:
        devs = [dvd['adapter'] for dvd in cd_drives]
        log.trace('Creating cd/dvd drives %s', devs)
        for drive, key in zip(cd_drives, keys):
            # if a controller is not available/cannot be created we should use the
            #  one which is available by default, this is 'IDE 0'
            controller_key = 200
            if controllers:
                controller = \
                    _get_device_by_label(controllers, drive['controller'])
                controller_key = controller.key
            cd_drive_specs.append(_apply_cd_drive(
                drive['adapter'],
                key,
                drive['device_type'],
                'add',
                client_device=drive['client_device'] if 'client_device' in drive else None,
                datastore_iso_file=drive['datastore_iso_file'] if 'datastore_iso_file' in drive else None,
                connectable=drive['connectable'] if 'connectable' in drive else None,
                controller_key=controller_key,
                parent_ref=parent_ref))

    return cd_drive_specs