mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(region,host-deployer): qga os distribution format (#19110)
host-deployer fix xfs mount error Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
This commit is contained in:
@@ -76,10 +76,34 @@ func (self *GuestQgaSyncOsInfoTask) updateOsInfo(ctx context.Context, guest *mod
|
||||
if osInfo.Id == "mswindows" {
|
||||
osType = "Windows"
|
||||
}
|
||||
osDistribution := osInfo.PrettyName
|
||||
switch osInfo.Id {
|
||||
case "centos":
|
||||
osDistribution = "CentOS"
|
||||
case "debian":
|
||||
osDistribution = "Debian"
|
||||
case "ubuntu":
|
||||
osDistribution = "Ubuntu"
|
||||
case "fedora":
|
||||
osDistribution = "Fedora"
|
||||
case "openEuler":
|
||||
osDistribution = "OpenEuler"
|
||||
case "gentoo":
|
||||
osDistribution = "Gentoo"
|
||||
case "cirros":
|
||||
osDistribution = "Cirros"
|
||||
case "archLinux":
|
||||
osDistribution = "ArchLinux"
|
||||
case "kylin":
|
||||
osDistribution = "Kylin"
|
||||
case "anolis":
|
||||
osDistribution = "Anolis"
|
||||
}
|
||||
|
||||
osInput := api.ServerSetOSInfoInput{
|
||||
Type: osType,
|
||||
Distribution: osInfo.PrettyName,
|
||||
Version: osInfo.Version,
|
||||
Distribution: osDistribution,
|
||||
Version: osInfo.VersionId,
|
||||
Arch: osInfo.Machine,
|
||||
}
|
||||
_, err = guest.PerformSetOsInfo(ctx, self.UserCred, nil, osInput)
|
||||
|
||||
@@ -177,13 +177,14 @@ func (p *SKVMGuestDiskPartition) mount(readonly bool) error {
|
||||
cmds = append(cmds, p.partDev, p.mountPath)
|
||||
|
||||
var err error
|
||||
var mountSuccess = false
|
||||
if fsType == "xfs" {
|
||||
uuids, _ := fileutils2.GetDevUuid(p.partDev)
|
||||
p.uuid = uuids["UUID"]
|
||||
if len(p.uuid) > 0 {
|
||||
xfsutils.LockXfsPartition(p.uuid)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if !mountSuccess {
|
||||
xfsutils.UnlockXfsPartition(p.uuid)
|
||||
}
|
||||
}()
|
||||
@@ -203,7 +204,7 @@ func (p *SKVMGuestDiskPartition) mount(readonly bool) error {
|
||||
}
|
||||
}()
|
||||
select {
|
||||
case err := <-errChan:
|
||||
case err = <-errChan:
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -226,6 +227,7 @@ func (p *SKVMGuestDiskPartition) mount(readonly bool) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "mount failed")
|
||||
}
|
||||
mountSuccess = true
|
||||
return nil // errors.Wrapf(err, "mount failed: %s", output)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user