func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger, runner) sigarCollector := boshstats.NewSigarStatsCollector() linuxDiskManager := boshdisk.NewLinuxDiskManager(logger, runner, fs) udev := boshudev.NewConcreteUdevDevice(runner) linuxCdrom := boshcdrom.NewLinuxCdrom("/dev/sr0", udev, runner) linuxCdutil := boshcd.NewCdUtil(dirProvider.SettingsDir(), fs, linuxCdrom) compressor := boshcmd.NewTarballCompressor(runner, fs) copier := boshcmd.NewCpCopier(runner, fs) vitalsService := boshvitals.NewService(sigarCollector, dirProvider) centosNetManager := boshnet.NewCentosNetManager(fs, runner, 10*time.Second) ubuntuNetManager := boshnet.NewUbuntuNetManager(fs, runner, 10*time.Second) centos := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, centosNetManager, 500*time.Millisecond, logger, ) ubuntu := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, ubuntuNetManager, 500*time.Millisecond, logger, ) p.platforms = map[string]Platform{ "ubuntu": ubuntu, "centos": centos, "dummy": NewDummyPlatform(sigarCollector, fs, runner, dirProvider, linuxDiskManager), } return }
func NewProvider(fs boshsys.FileSystem) (p provider) { runner := boshsys.ExecCmdRunner{} ubuntuDiskManager := boshdisk.NewUbuntuDiskManager(runner, fs) sigarStatsCollector := boshstats.NewSigarStatsCollector() p.platforms = map[string]Platform{ "ubuntu": newUbuntuPlatform(sigarStatsCollector, fs, runner, ubuntuDiskManager), "dummy": newDummyPlatform(), } return }
// There is a reason the runner is not injected. // Other entities should not use a runner, they should go through the platform func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger, runner) sigarStatsCollector := boshstats.NewSigarStatsCollector() ubuntuDiskManager := boshdisk.NewUbuntuDiskManager(logger, runner, fs) compressor := boshcmd.NewTarballCompressor(runner, fs) p.platforms = map[string]Platform{ "ubuntu": newUbuntuPlatform(sigarStatsCollector, fs, runner, ubuntuDiskManager, compressor, dirProvider), "dummy": newDummyPlatform(), } return }
func NewProvider(fs boshsys.FileSystem) (p provider) { // There is a reason the runner is not injected. // Other entities should not use a runner, they should go through the platform runner := boshsys.ExecCmdRunner{} ubuntuDiskManager := boshdisk.NewUbuntuDiskManager(runner, fs) sigarStatsCollector := boshstats.NewSigarStatsCollector() p.platforms = map[string]Platform{ "ubuntu": newUbuntuPlatform(sigarStatsCollector, fs, runner, ubuntuDiskManager), "dummy": newDummyPlatform(), } return }
// There is a reason the runner is not injected. // Other entities should not use a runner, they should go through the platform func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger, runner) sigarStatsCollector := boshstats.NewSigarStatsCollector() ubuntuDiskManager := boshdisk.NewUbuntuDiskManager(logger, runner, fs) centosDiskManager := boshdisk.NewCentosDiskManager(logger, runner, fs) p.platforms = map[string]Platform{ "ubuntu": NewUbuntuPlatform(sigarStatsCollector, fs, runner, ubuntuDiskManager, dirProvider, 500*time.Millisecond, 10*time.Second, 3*time.Minute), "centos": NewCentosPlatform(sigarStatsCollector, fs, runner, centosDiskManager, dirProvider, 500*time.Millisecond, 10*time.Second, 3*time.Minute), "dummy": NewDummyPlatform(sigarStatsCollector, fs, runner, dirProvider), } return }
func NewProvider(logger boshlog.Logger) (p provider) { fs := boshsys.NewOsFileSystem(logger) // There is a reason the runner is not injected. // Other entities should not use a runner, they should go through the platform runner := boshsys.NewExecCmdRunner(logger) sigarStatsCollector := boshstats.NewSigarStatsCollector() ubuntuDiskManager := boshdisk.NewUbuntuDiskManager(logger, runner, fs) compressor := boshdisk.NewTarballCompressor(runner, fs) p.platforms = map[string]Platform{ "ubuntu": newUbuntuPlatform(sigarStatsCollector, fs, runner, ubuntuDiskManager, compressor), "dummy": newDummyPlatform(), } return }
func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider, options ProviderOptions) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger) linuxDiskManager := boshdisk.NewLinuxDiskManager(logger, runner, fs, options.Linux.BindMountPersistentDisk) udev := boshudev.NewConcreteUdevDevice(runner) linuxCdrom := boshcdrom.NewLinuxCdrom("/dev/sr0", udev, runner) linuxCdutil := boshcd.NewCdUtil(dirProvider.SettingsDir(), fs, linuxCdrom) compressor := boshcmd.NewTarballCompressor(runner, fs) copier := boshcmd.NewCpCopier(runner, fs, logger) sigarCollector := boshstats.NewSigarStatsCollector(&sigar.ConcreteSigar{}) // Kick of stats collection as soon as possible go sigarCollector.StartCollecting(SigarStatsCollectionInterval, nil) vitalsService := boshvitals.NewService(sigarCollector, dirProvider) routesSearcher := boshnet.NewCmdRoutesSearcher(runner) ipResolver := boship.NewIPResolver(boship.NetworkInterfaceToAddrsFunc) defaultNetworkResolver := boshnet.NewDefaultNetworkResolver(routesSearcher, ipResolver) arping := bosharp.NewArping(runner, fs, logger, ArpIterations, ArpIterationDelay, ArpInterfaceCheckDelay) centosNetManager := boshnet.NewCentosNetManager(fs, runner, defaultNetworkResolver, ipResolver, arping, logger) ubuntuNetManager := boshnet.NewUbuntuNetManager(fs, runner, defaultNetworkResolver, ipResolver, arping, logger) centos := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, centosNetManager, 500*time.Millisecond, options.Linux, logger, ) ubuntu := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, ubuntuNetManager, 500*time.Millisecond, options.Linux, logger, ) p.platforms = map[string]Platform{ "ubuntu": ubuntu, "centos": centos, "dummy": NewDummyPlatform(sigarCollector, fs, runner, dirProvider, logger), } return }
func NewProvider(logger boshlog.Logger, dirProvider boshdirs.DirectoriesProvider, options ProviderOptions) (p provider) { runner := boshsys.NewExecCmdRunner(logger) fs := boshsys.NewOsFileSystem(logger) linuxDiskManager := boshdisk.NewLinuxDiskManager(logger, runner, fs, options.Linux.BindMountPersistentDisk) udev := boshudev.NewConcreteUdevDevice(runner) linuxCdrom := boshcdrom.NewLinuxCdrom("/dev/sr0", udev, runner) linuxCdutil := boshcd.NewCdUtil(dirProvider.SettingsDir(), fs, linuxCdrom) compressor := boshcmd.NewTarballCompressor(runner, fs) copier := boshcmd.NewCpCopier(runner, fs, logger) sigarCollector := boshstats.NewSigarStatsCollector() vitalsService := boshvitals.NewService(sigarCollector, dirProvider) routesSearcher := boshnet.NewCmdRoutesSearcher(runner) defaultNetworkResolver := boshnet.NewDefaultNetworkResolver( routesSearcher, boshnet.DefaultInterfaceToAddrsFunc, ) centosNetManager := boshnet.NewCentosNetManager(fs, runner, defaultNetworkResolver, 10*time.Second, logger) ubuntuNetManager := boshnet.NewUbuntuNetManager(fs, runner, defaultNetworkResolver, 10*time.Second, logger) centos := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, centosNetManager, 500*time.Millisecond, options.Linux, logger, ) ubuntu := NewLinuxPlatform( fs, runner, sigarCollector, compressor, copier, dirProvider, vitalsService, linuxCdutil, linuxDiskManager, ubuntuNetManager, 500*time.Millisecond, options.Linux, logger, ) p.platforms = map[string]Platform{ "ubuntu": ubuntu, "centos": centos, "dummy": NewDummyPlatform(sigarCollector, fs, runner, dirProvider, linuxDiskManager, logger), } return }