Merge pull request #19034 from wanyaoqi/automated-cherry-pick-of-#19031-upstream-master

Automated cherry pick of #19031: fix(host-deployer): pass config files to deploy vm
This commit is contained in:
Zexi Li
2023-12-18 17:25:29 +08:00
committed by GitHub
3 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ var (
RUN_ON_HOST_ROOT_PATH = "/opt/cloud/host-deployer"
DEPLOY_ISO = "/opt/cloud/host-deployer/host_deployer_v1.iso"
DEPLOYER_BIN = "/opt/yunion/bin/host-deployer"
DEPLOYER_BIN = "/opt/yunion/bin/host-deployer --common-config-file /opt/yunion/common.conf --config /opt/yunion/host.conf"
YUNIONOS_PASSWD = "mosbaremetal"
)
@@ -360,6 +360,18 @@ func (s *SDeployService) PrepareEnv() error {
if err != nil {
return errors.Wrapf(err, "cp files failed %s", out)
}
if DeployOption.Config != "" && fileutils2.Exists(DeployOption.Config) {
out, err = procutils.NewCommand("cp", "-Lrf", DeployOption.Config, "/opt/yunion/host.conf").Output()
if err != nil {
return errors.Wrapf(err, "cp files failed %s", out)
}
}
if DeployOption.CommonConfigFile != "" && fileutils2.Exists(DeployOption.CommonConfigFile) {
out, err = procutils.NewCommand("cp", "-Lrf", DeployOption.CommonConfigFile, "/opt/yunion/common.conf").Output()
if err != nil {
return errors.Wrapf(err, "cp files failed %s", out)
}
}
err = procutils.NewCommand("mkdir", "-p", qemu_kvm.RUN_ON_HOST_ROOT_PATH).Run()
if err != nil {
@@ -23,6 +23,7 @@ import (
"yunion.io/x/pkg/errors"
commonconsts "yunion.io/x/onecloud/pkg/cloudcommon/consts"
"yunion.io/x/onecloud/pkg/hostman/diskutils"
"yunion.io/x/onecloud/pkg/hostman/guestfs/fsdriver"
deployapi "yunion.io/x/onecloud/pkg/hostman/hostdeployer/apis"
@@ -113,6 +114,7 @@ func LocalInitEnv() error {
if err := fsdriver.Init(DeployOption.PrivatePrefixes, DeployOption.CloudrootDir); err != nil {
return errors.Wrap(err, "init fsdriver")
}
commonconsts.SetAllowVmSELinux(DeployOption.AllowVmSELinux)
winutils.SetChntpwPath("/opt/yunion/bin/chntpw.static")
return nil
}