github.com/vmware/govmomi@v0.37.1/simulator/esx/virtual_device.go (about)

     1  /*
     2  Copyright (c) 2017-2023 VMware, Inc. All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package esx
    18  
    19  import "github.com/vmware/govmomi/vim25/types"
    20  
    21  // VirtualDevice is the default set of VirtualDevice types created for a VirtualMachine
    22  // Capture method:
    23  //
    24  //	govc vm.create foo
    25  //	govc object.collect -s -dump vm/foo config.hardware.device
    26  var VirtualDevice = []types.BaseVirtualDevice{
    27  	&types.VirtualIDEController{
    28  		VirtualController: types.VirtualController{
    29  			VirtualDevice: types.VirtualDevice{
    30  				DynamicData: types.DynamicData{},
    31  				Key:         200,
    32  				DeviceInfo: &types.Description{
    33  					DynamicData: types.DynamicData{},
    34  					Label:       "IDE 0",
    35  					Summary:     "IDE 0",
    36  				},
    37  				Backing:       nil,
    38  				Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
    39  				SlotInfo:      nil,
    40  				ControllerKey: 0,
    41  				UnitNumber:    (*int32)(nil),
    42  			},
    43  			BusNumber: 0,
    44  			Device:    nil,
    45  		},
    46  	},
    47  	&types.VirtualIDEController{
    48  		VirtualController: types.VirtualController{
    49  			VirtualDevice: types.VirtualDevice{
    50  				DynamicData: types.DynamicData{},
    51  				Key:         201,
    52  				DeviceInfo: &types.Description{
    53  					DynamicData: types.DynamicData{},
    54  					Label:       "IDE 1",
    55  					Summary:     "IDE 1",
    56  				},
    57  				Backing:       nil,
    58  				Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
    59  				SlotInfo:      nil,
    60  				ControllerKey: 0,
    61  				UnitNumber:    (*int32)(nil),
    62  			},
    63  			BusNumber: 1,
    64  			Device:    nil,
    65  		},
    66  	},
    67  	&types.VirtualPS2Controller{
    68  		VirtualController: types.VirtualController{
    69  			VirtualDevice: types.VirtualDevice{
    70  				DynamicData: types.DynamicData{},
    71  				Key:         300,
    72  				DeviceInfo: &types.Description{
    73  					DynamicData: types.DynamicData{},
    74  					Label:       "PS2 controller 0",
    75  					Summary:     "PS2 controller 0",
    76  				},
    77  				Backing:       nil,
    78  				Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
    79  				SlotInfo:      nil,
    80  				ControllerKey: 0,
    81  				UnitNumber:    (*int32)(nil),
    82  			},
    83  			BusNumber: 0,
    84  			Device:    []int32{600, 700},
    85  		},
    86  	},
    87  	&types.VirtualPCIController{
    88  		VirtualController: types.VirtualController{
    89  			VirtualDevice: types.VirtualDevice{
    90  				DynamicData: types.DynamicData{},
    91  				Key:         100,
    92  				DeviceInfo: &types.Description{
    93  					DynamicData: types.DynamicData{},
    94  					Label:       "PCI controller 0",
    95  					Summary:     "PCI controller 0",
    96  				},
    97  				Backing:       nil,
    98  				Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
    99  				SlotInfo:      nil,
   100  				ControllerKey: 0,
   101  				UnitNumber:    (*int32)(nil),
   102  			},
   103  			BusNumber: 0,
   104  			Device:    []int32{500, 12000},
   105  		},
   106  	},
   107  	&types.VirtualSIOController{
   108  		VirtualController: types.VirtualController{
   109  			VirtualDevice: types.VirtualDevice{
   110  				DynamicData: types.DynamicData{},
   111  				Key:         400,
   112  				DeviceInfo: &types.Description{
   113  					DynamicData: types.DynamicData{},
   114  					Label:       "SIO controller 0",
   115  					Summary:     "SIO controller 0",
   116  				},
   117  				Backing:       nil,
   118  				Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
   119  				SlotInfo:      nil,
   120  				ControllerKey: 0,
   121  				UnitNumber:    (*int32)(nil),
   122  			},
   123  			BusNumber: 0,
   124  			Device:    nil,
   125  		},
   126  	},
   127  	&types.VirtualKeyboard{
   128  		VirtualDevice: types.VirtualDevice{
   129  			DynamicData: types.DynamicData{},
   130  			Key:         600,
   131  			DeviceInfo: &types.Description{
   132  				DynamicData: types.DynamicData{},
   133  				Label:       "Keyboard ",
   134  				Summary:     "Keyboard",
   135  			},
   136  			Backing:       nil,
   137  			Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
   138  			SlotInfo:      nil,
   139  			ControllerKey: 300,
   140  			UnitNumber:    types.NewInt32(0),
   141  		},
   142  	},
   143  	&types.VirtualPointingDevice{
   144  		VirtualDevice: types.VirtualDevice{
   145  			DynamicData: types.DynamicData{},
   146  			Key:         700,
   147  			DeviceInfo: &types.Description{
   148  				DynamicData: types.DynamicData{},
   149  				Label:       "Pointing device",
   150  				Summary:     "Pointing device; Device",
   151  			},
   152  			Backing: &types.VirtualPointingDeviceDeviceBackingInfo{
   153  				VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{
   154  					VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{},
   155  					DeviceName:               "",
   156  					UseAutoDetect:            types.NewBool(false),
   157  				},
   158  				HostPointingDevice: "autodetect",
   159  			},
   160  			Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
   161  			SlotInfo:      nil,
   162  			ControllerKey: 300,
   163  			UnitNumber:    types.NewInt32(1),
   164  		},
   165  	},
   166  	&types.VirtualMachineVideoCard{
   167  		VirtualDevice: types.VirtualDevice{
   168  			DynamicData: types.DynamicData{},
   169  			Key:         500,
   170  			DeviceInfo: &types.Description{
   171  				DynamicData: types.DynamicData{},
   172  				Label:       "Video card ",
   173  				Summary:     "Video card",
   174  			},
   175  			Backing:       nil,
   176  			Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
   177  			SlotInfo:      nil,
   178  			ControllerKey: 100,
   179  			UnitNumber:    types.NewInt32(0),
   180  		},
   181  		VideoRamSizeInKB:       4096,
   182  		NumDisplays:            1,
   183  		UseAutoDetect:          types.NewBool(false),
   184  		Enable3DSupport:        types.NewBool(false),
   185  		Use3dRenderer:          "automatic",
   186  		GraphicsMemorySizeInKB: 262144,
   187  	},
   188  	&types.VirtualMachineVMCIDevice{
   189  		VirtualDevice: types.VirtualDevice{
   190  			DynamicData: types.DynamicData{},
   191  			Key:         12000,
   192  			DeviceInfo: &types.Description{
   193  				DynamicData: types.DynamicData{},
   194  				Label:       "VMCI device",
   195  				Summary:     "Device on the virtual machine PCI bus that provides support for the virtual machine communication interface",
   196  			},
   197  			Backing:       nil,
   198  			Connectable:   (*types.VirtualDeviceConnectInfo)(nil),
   199  			SlotInfo:      nil,
   200  			ControllerKey: 100,
   201  			UnitNumber:    types.NewInt32(17),
   202  		},
   203  		Id:                             -1,
   204  		AllowUnrestrictedCommunication: types.NewBool(false),
   205  		FilterEnable:                   types.NewBool(true),
   206  		FilterInfo:                     (*types.VirtualMachineVMCIDeviceFilterInfo)(nil),
   207  	},
   208  }
   209  
   210  // EthernetCard template for types.VirtualEthernetCard
   211  var EthernetCard = types.VirtualE1000{
   212  	VirtualEthernetCard: types.VirtualEthernetCard{
   213  		VirtualDevice: types.VirtualDevice{
   214  			DynamicData: types.DynamicData{},
   215  			Key:         4000,
   216  			Backing: &types.VirtualEthernetCardNetworkBackingInfo{
   217  				VirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{
   218  					VirtualDeviceBackingInfo: types.VirtualDeviceBackingInfo{},
   219  					DeviceName:               "VM Network",
   220  					UseAutoDetect:            types.NewBool(false),
   221  				},
   222  				Network:           (*types.ManagedObjectReference)(nil),
   223  				InPassthroughMode: types.NewBool(false),
   224  			},
   225  			Connectable: &types.VirtualDeviceConnectInfo{
   226  				DynamicData:       types.DynamicData{},
   227  				StartConnected:    true,
   228  				AllowGuestControl: true,
   229  				Connected:         false,
   230  				Status:            "untried",
   231  			},
   232  			SlotInfo: &types.VirtualDevicePciBusSlotInfo{
   233  				VirtualDeviceBusSlotInfo: types.VirtualDeviceBusSlotInfo{},
   234  				PciSlotNumber:            32,
   235  			},
   236  			ControllerKey: 100,
   237  			UnitNumber:    types.NewInt32(7),
   238  		},
   239  		AddressType:      "generated",
   240  		MacAddress:       "",
   241  		WakeOnLanEnabled: types.NewBool(true),
   242  	},
   243  }