<commit_before>/*
Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package object

import (
	"errors"
	"fmt"
	"math/rand"
	"path/filepath"
	"reflect"
	"regexp"
	"sort"
	"strings"

	"github.com/vmware/govmomi/vim25/types"
)

// Type values for use in BootOrder
const (
	DeviceTypeNone     = "-"
	DeviceTypeCdrom    = "cdrom"
	DeviceTypeDisk     = "disk"
	DeviceTypeEthernet = "ethernet"
	DeviceTypeFloppy   = "floppy"
)

// VirtualDeviceList provides helper methods for working with a list of virtual devices.
type VirtualDeviceList []types.BaseVirtualDevice

// SCSIControllerTypes are used for adding a new SCSI controller to a VM.
func SCSIControllerTypes() VirtualDeviceList {
	// Return a mutable list of SCSI controller types, initialized with defaults.
	return VirtualDeviceList([]types.BaseVirtualDevice{
		&types.VirtualLsiLogicController{},
		&types.VirtualBusLogicController{},
		&types.ParaVirtualSCSIController{},
		&types.VirtualLsiLogicSASController{},
	}).Select(func(device types.BaseVirtualDevice) bool {
		c := device.(types.BaseVirtualSCSIController).GetVirtualSCSIController()
		c.SharedBus = types.VirtualSCSISharingNoSharing
		c.BusNumber = -1
		return true
	})
}

// EthernetCardTypes are used for adding a new ethernet card to a VM.
func EthernetCardTypes() VirtualDeviceList {
	return VirtualDeviceList([]types.BaseVirtualDevice{
		&types.VirtualE1000{},
		&types.VirtualE1000e{},
		&types.VirtualVmxnet2{},
		&types.VirtualVmxnet3{},
		&types.VirtualPCNet32{},
		&types.VirtualSriovEthernetCard{},
	}).Select(func(device types.BaseVirtualDevice) bool {
		c := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard()

		key := rand.Int31() * -1
		if key == 0 {
			key = -1
		}
<commit_msg>Added Support for vrdma NIC Type Signed-off-by: <NAME> <<EMAIL>><commit_after>/*
Copyright (c) 2015-2017 VMware, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package object

import (
	"errors"
	"fmt"
	"math/rand"
	"path/filepath"
	"reflect"
	"regexp"
	"sort"
	"strings"

	"github.com/vmware/govmomi/vim25/types"
)

// Type values for use in BootOrder
const (
	DeviceTypeNone     = "-"
	DeviceTypeCdrom    = "cdrom"
	DeviceTypeDisk     = "disk"
	DeviceTypeEthernet = "ethernet"
	DeviceTypeFloppy   = "floppy"
)

// VirtualDeviceList provides helper methods for working with a list of virtual devices.
type VirtualDeviceList []types.BaseVirtualDevice

// SCSIControllerTypes are used for adding a new SCSI controller to a VM.
func SCSIControllerTypes() VirtualDeviceList {
	// Return a mutable list of SCSI controller types, initialized with defaults.
	return VirtualDeviceList([]types.BaseVirtualDevice{
		&types.VirtualLsiLogicController{},
		&types.VirtualBusLogicController{},
		&types.ParaVirtualSCSIController{},
		&types.VirtualLsiLogicSASController{},
	}).Select(func(device types.BaseVirtualDevice) bool {
		c := device.(types.BaseVirtualSCSIController).GetVirtualSCSIController()
		c.SharedBus = types.VirtualSCSISharingNoSharing
		c.BusNumber = -1
		return true
	})
}

// EthernetCardTypes are used for adding a new ethernet card to a VM.
func EthernetCardTypes() VirtualDeviceList {
	return VirtualDeviceList([]types.BaseVirtualDevice{
		&types.VirtualE1000{},
		&types.VirtualE1000e{},
		&types.VirtualVmxnet2{},
		&types.VirtualVmxnet3{},
		&types.VirtualVmxnet3Vrdma{},
		&types.VirtualPCNet32{},
		&types.VirtualSriovEthernetCard{},
	}).Select(func(device types.BaseVirtualDevice) bool {
		c := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard()

		key := rand.Int31() * -1
		if key == 0 {
			key = -1
		}

{'fraction_non_alphanumeric': 0.09950032587442972, 'fraction_numerical': 0.014121225287855746, 'mean_word_length': 4.69097651421508, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4985390', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1416, 'n_words': 427}