func CreateConfig(d *deployer.CommonData, i *metadata.InputData) (*metadata.Config, error) { if d.DefaultExportDir == "" { d.DefaultExportDir = "/var/lib/libvirt/images" } m, err := metadata.NewMetdataConfig(d, i.StorageConfigFile) if err != nil { return nil, utils.FormatError(err) } controller.RegisterSteps(func() func() error { return func() error { var err error m.Hwdriver, err = hwinfodriver.NewHostinfoDriver(m.SshConfig, i.Lshw, filepath.Join(d.RootDir, ".hwinfo.json")) if err != nil { return utils.FormatError(err) } m.Metadata = new(metadata.Metadata) m.EnvDriver = envdriver.NewDriver(m.SshConfig) if m.Metadata.EmulatorPath, err = m.EnvDriver.Emulator(d.Arch); err != nil { return utils.FormatError(err) } return controller.SkipStep } }()) if err := metadata.RegisterSteps(d, i, m, &meta{}); err != nil { return nil, utils.FormatError(err) } return m, nil }
// For testing purpose func MultiQueueSupportedMock(kernelVersion, libvirtVersion string, sshconfig *ssh.Config) (bool, error) { c := sysinfo.NewCollector(sshconfig) if c.KernelMajorMinorEqualOrGreaterThan(kernelVersion) { d := envdriver.NewDriver(sshconfig) curVersion, err := d.Version() if err != nil { return false, err } if curVersion >= libvirtVersion { return true, nil } } return false, nil }
func MultiQueueSupported(sshconfig *ssh.Config) (bool, error) { c := sysinfo.NewCollector(sshconfig) if c.KernelMajorMinorEqualOrGreaterThan(multiQueueKernelVersion) { d := envdriver.NewDriver(sshconfig) curVersion, err := d.Version() if err != nil { return false, utils.FormatError(err) } if curVersion >= multiQueueLibvirtVersion { return true, nil } } return false, nil }
func NewPostProcessor(sshconf *ssh.Config, startDomain bool) *PostProcessor { p := new(PostProcessor) p.driver = libvirt_kvm.NewDriver(sshconf) p.startDomain = startDomain return p }