Example #1
0
File: linux.go Project: vmware/vic
// NewLinuxGuest returns a new Linux guest spec with predefined values
func NewLinuxGuest(ctx context.Context, session *session.Session, config *spec.VirtualMachineConfigSpecConfig) (Guest, error) {
	s, err := spec.NewVirtualMachineConfigSpec(ctx, session, config)
	if err != nil {
		return nil, err
	}

	// SCSI controller
	scsi := spec.NewVirtualSCSIController(scsiBusNumber, scsiKey)
	// PV SCSI controller
	pv := spec.NewParaVirtualSCSIController(scsi)
	s.AddParaVirtualSCSIController(pv)

	// Disk
	disk := spec.NewVirtualSCSIDisk(scsi)
	s.AddVirtualDisk(disk)

	// IDE controller
	ide := spec.NewVirtualIDEController(ideKey)
	s.AddVirtualIDEController(ide)

	// CDROM
	cdrom := spec.NewVirtualCdrom(ide)
	s.AddVirtualCdrom(cdrom)

	// Set the guest id
	s.GuestId = linuxGuestID

	return &LinuxGuestType{
		VirtualMachineConfigSpec: s,
		controller:               &scsi,
	}, nil
}
Example #2
0
File: linux.go Project: kjplatz/vic
// NewLinuxGuest returns a new Linux guest spec with predefined values
func NewLinuxGuest(ctx context.Context, session *session.Session, config *spec.VirtualMachineConfigSpecConfig) (Guest, error) {
	s, err := spec.NewVirtualMachineConfigSpec(ctx, session, config)
	if err != nil {
		return nil, err
	}

	// SCSI controller
	scsi := spec.NewVirtualSCSIController(scsiBusNumber, scsiKey)
	// PV SCSI controller
	pv := spec.NewParaVirtualSCSIController(scsi)
	s.AddParaVirtualSCSIController(pv)

	// Disk
	disk := spec.NewVirtualSCSIDisk(scsi)
	s.AddVirtualDisk(disk)

	// IDE controller
	ide := spec.NewVirtualIDEController(ideKey)
	s.AddVirtualIDEController(ide)

	// CDROM
	cdrom := spec.NewVirtualCdrom(ide)
	s.AddVirtualCdrom(cdrom)

	// Tether serial port - backed by network
	serial := spec.NewVirtualSerialPort()
	s.AddVirtualConnectedSerialPort(serial)

	// Debug serial port - backed by datastore file
	debugserial := spec.NewVirtualSerialPort()
	s.AddVirtualFileSerialPort(debugserial, "debug")

	// Session log serial port - backed by datastore file
	sessionserial := spec.NewVirtualSerialPort()
	s.AddVirtualFileSerialPort(sessionserial, "log")

	// Set the guest id
	s.GuestId = linuxGuestID

	return &LinuxGuestType{
		VirtualMachineConfigSpec: s,
		controller:               &scsi,
	}, nil
}