MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / addNIC

Function addNIC

src/cmd/linuxkit/run_vcenter.go:266–284  ·  view source on GitHub ↗
(ctx context.Context, vm *object.VirtualMachine, net object.NetworkReference)

Source from the content-addressed store, hash-verified

264}
265
266func addNIC(ctx context.Context, vm *object.VirtualMachine, net object.NetworkReference) {
267 backing, err := net.EthernetCardBackingInfo(ctx)
268 if err != nil {
269 log.Fatalf("Unable to determine vCenter network backend\n%v", err)
270 }
271
272 netdev, err := object.EthernetCardTypes().CreateEthernetCard("vmxnet3", backing)
273 if err != nil {
274 log.Fatalf("Unable to create vmxnet3 network interface\n%v", err)
275 }
276
277 log.Infof("Adding VM Networking")
278 var add []types.BaseVirtualDevice
279 add = append(add, netdev)
280
281 if err := vm.AddDevice(ctx, add...); err != nil {
282 log.Fatalf("Unable to add new networking device to VM configuration\n%v", err)
283 }
284}
285
286func addVMDK(ctx context.Context, vm *object.VirtualMachine, dss *object.Datastore, newVM vmConfig) {
287 devices, err := vm.Device(ctx)

Callers 1

runVCenterCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected