Ejemplo n.º 1
0
func (c *FlowCreator) CreateConfig(d *deployer.CommonData) error {
	d.DefaultExportDir = "/var/lib/xen"
	data := new(metadata.InputData)
	data.Lshw = filepath.Join(d.RootDir, "install", d.Arch, "bin/lshw")
	data.InputDataConfigFile = filepath.Join(d.RootDir, mainConfig["input_data_config_file"])
	data.StorageConfigFile = filepath.Join(d.RootDir, mainConfig["storage_config_file"])

	var err error
	if c.config, err = xenconf.CreateConfig(d, data); err != nil {
		return err
	}

	controller.RegisterSteps(func() func() error {
		return func() error {
			fmt.Println("My step 1")
			return nil
		}
	}())

	controller.RegisterSteps(func() func() error {
		return func() error {
			fmt.Println("My step 2")
			return nil
		}
	}())

	if err := controller.RunSteps(); err != nil {
		return err
	}

	// Xen XL metadata requires that the RAM size will be represented in Megabytes
	c.config.Metadata.RAM /= 1024

	d.Ui.Pb.SetSleep("10s")
	d.Ui.Pb.SetStep(10)

	if c.config.RemoteMode {
		d.Ui.Pb.IncreaseSleep("5s")
		d.Ui.Pb.DecreaseStep(4)
	}
	return nil
}
Ejemplo n.º 2
0
func (c *FlowCreator) CreateConfig(d *deployer.CommonData) error {
	d.DefaultExportDir = "/var/lib/libvirt/images"
	data := new(metadata.InputData)
	data.Lshw = filepath.Join(d.RootDir, "install", d.Arch, "bin/lshw")
	data.InputDataConfigFile = filepath.Join(d.RootDir, mainConfig["input_data_config_file"])
	data.StorageConfigFile = filepath.Join(d.RootDir, mainConfig["storage_config_file"])
	data.TemplatesDir = filepath.Join(d.RootDir, mainConfig["metadata_dir"])

	var err error
	if c.config, err = libvirtconf.CreateConfig(d, data); err != nil {
		return err
	}

	controller.RegisterSteps(func() func() error {
		return func() error {
			fmt.Println("My step 1")
			return nil
		}
	}())

	controller.RegisterSteps(func() func() error {
		return func() error {
			fmt.Println("My step 2")
			return nil
		}
	}())

	if err := controller.RunSteps(); err != nil {
		return err
	}

	d.Ui.Pb.SetSleep("10s")
	d.Ui.Pb.SetStep(10)

	if c.config.RemoteMode {
		d.Ui.Pb.IncreaseSleep("5s")
		d.Ui.Pb.DecreaseStep(4)
	}
	return nil
}