Skip to content

Commit

Permalink
fix(host-deployer): pass config files to deploy vm
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyaoqi committed Dec 18, 2023
1 parent ce7dc3b commit 499946f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/hostman/diskutils/qemu_kvm/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
12 changes: 12 additions & 0 deletions pkg/hostman/hostdeployer/deployserver/deployserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions pkg/hostman/hostdeployer/deployserver/localdeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 499946f

Please sign in to comment.