Skip to content

Commit c696796

Browse files
authored
fix(region): add device for disk (#23690)
1 parent ae86971 commit c696796

File tree

18 files changed

+216
-26
lines changed

18 files changed

+216
-26
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ require (
9898
k8s.io/cri-api v0.28.15
9999
k8s.io/klog/v2 v2.20.0
100100
moul.io/http2curl/v2 v2.3.0
101-
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251031063556-cfcc66d60507
101+
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251105060645-39907b8eac4a
102102
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
103103
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
104104
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
14701470
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
14711471
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
14721472
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
1473-
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251031063556-cfcc66d60507 h1:g0nP+pDPhwH9wgQDtwIcW/u+3lBzIkqQE8qwPpGLi1g=
1474-
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251031063556-cfcc66d60507/go.mod h1:MeA5UnvNhLXMvy+xPMOzRqjWMWMkZ3QXZP0u1bYEM0M=
1473+
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251105060645-39907b8eac4a h1:BtmF6BX/yZfULtJ7pRdMS6wYz5noZTYloBbQ0/5vWPI=
1474+
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251105060645-39907b8eac4a/go.mod h1:MeA5UnvNhLXMvy+xPMOzRqjWMWMkZ3QXZP0u1bYEM0M=
14751475
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
14761476
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
14771477
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=

pkg/compute/guestdrivers/managedvirtual.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,12 @@ func (drv *SManagedVirtualizedGuestDriver) RequestAttachDisk(ctx context.Context
459459
if err != nil {
460460
return false, errors.Wrapf(err, "RequestAttachDisk.iVM.WaitStatus")
461461
}
462+
if device := iDisks[i].GetDeviceName(); len(device) > 0 {
463+
db.Update(disk, func() error {
464+
disk.Device = device
465+
return nil
466+
})
467+
}
462468

463469
return true, nil
464470
}
@@ -1226,6 +1232,7 @@ func (drv *SManagedVirtualizedGuestDriver) OnGuestDeployTaskDataReceived(ctx con
12261232
disk.ExternalId = diskInfo[i].Uuid
12271233
disk.DiskType = diskInfo[i].DiskType
12281234
disk.Status = api.DISK_READY
1235+
disk.Device = diskInfo[i].Device
12291236

12301237
disk.FsFormat = diskInfo[i].FsFromat
12311238
if diskInfo[i].AutoDelete {

pkg/compute/guestdrivers/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type SDiskInfo struct {
4141
CacheMode string
4242
ExpiredAt time.Time
4343
StorageExternalId string
44+
Device string
4445

4546
Metadata map[string]string
4647
}
@@ -97,6 +98,7 @@ func fetchIVMinfo(desc cloudprovider.SManagedVMCreateConfig, iVM cloudprovider.I
9798
dinfo.TemplateId = idisks[i].GetTemplateId()
9899
dinfo.FsFromat = idisks[i].GetFsFormat()
99100
dinfo.ExpiredAt = idisks[i].GetExpiredAt()
101+
dinfo.Device = idisks[i].GetDeviceName()
100102
dinfo.StorageExternalId = idisks[i].GetIStorageId()
101103
diskSysTags := idisks[i].GetSysTags()
102104
diskTags, _ := idisks[i].GetTags()

pkg/compute/models/disks.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ type SDisk struct {
114114
// 备份Id
115115
BackupId string `width:"256" charset:"ascii" nullable:"true" list:"user" json:"backup_id"`
116116

117+
// 设备名称
118+
Device string `width:"32" charset:"ascii" nullable:"true" get:"user" list:"user"`
119+
117120
// 文件系统
118121
FsFormat string `width:"32" charset:"ascii" nullable:"true" list:"user" json:"fs_format"`
119122
// 文件系统特性
@@ -1927,6 +1930,9 @@ func (self *SDisk) syncWithCloudDisk(ctx context.Context, userCred mcclient.Toke
19271930
if extDisk.GetIsAutoDelete() {
19281931
self.AutoDelete = true
19291932
}
1933+
if device := extDisk.GetDeviceName(); len(device) > 0 {
1934+
self.Device = device
1935+
}
19301936
// self.TemplateId = extDisk.GetTemplateId() no sync template ID
19311937
if templateId := extDisk.GetTemplateId(); len(templateId) > 0 {
19321938
cachedImage, err := db.FetchByExternalId(CachedimageManager, templateId)
@@ -2011,6 +2017,7 @@ func (manager *SDiskManager) newFromCloudDisk(ctx context.Context, userCred mccl
20112017
disk.DiskType = api.DISK_TYPE_SYS
20122018
}
20132019
disk.Nonpersistent = extDisk.GetIsNonPersistent()
2020+
disk.Device = extDisk.GetDeviceName()
20142021

20152022
disk.IsEmulated = extDisk.IsEmulated()
20162023

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
20392039
# sigs.k8s.io/yaml v1.2.0
20402040
## explicit; go 1.12
20412041
sigs.k8s.io/yaml
2042-
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251031063556-cfcc66d60507
2042+
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251105060645-39907b8eac4a
20432043
## explicit; go 1.24
20442044
yunion.io/x/cloudmux/pkg/apis
20452045
yunion.io/x/cloudmux/pkg/apis/billing

vendor/yunion.io/x/cloudmux/pkg/cloudprovider/resources.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/yunion.io/x/cloudmux/pkg/multicloud/aliyun/disk.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/yunion.io/x/cloudmux/pkg/multicloud/aws/disk.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/yunion.io/x/cloudmux/pkg/multicloud/aws/image.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)