Skip to content

Commit 2a78d1b

Browse files
authored
Merge pull request #1423 from ioito/hotfix/qx-set-disk-tag
fix(aliyun): support set disk tag
2 parents e2b5a2b + d1de99d commit 2a78d1b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

pkg/multicloud/aliyun/disk.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ func (self *SDisk) ChangeBillingType(billingType string) error {
164164
return self.storage.zone.region.ChangeDiskChargeType(self.InstanceId, self.DiskId, billingType)
165165
}
166166

167+
func (self *SDisk) SetTags(tags map[string]string, replace bool) error {
168+
return self.storage.zone.region.SetResourceTags(ALIYUN_SERVICE_ECS, "disk", self.DiskId, tags, replace)
169+
}
170+
167171
func (self *SRegion) ChangeDiskChargeType(vmId, diskId string, billingType string) error {
168172
params := make(map[string]string)
169173
params["RegionId"] = self.RegionId

pkg/multicloud/aws/disk.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ func (self *SDisk) Delete(ctx context.Context) error {
198198
return self.storage.zone.region.DeleteDisk(self.VolumeId)
199199
}
200200

201+
func (self *SDisk) SetTags(tags map[string]string, replace bool) error {
202+
return self.storage.zone.region.setTags("volume", self.VolumeId, tags, replace)
203+
}
204+
201205
func (self *SDisk) CreateISnapshot(ctx context.Context, name string, desc string) (cloudprovider.ICloudSnapshot, error) {
202206
snapshot, err := self.storage.zone.region.CreateSnapshot(self.VolumeId, name, desc)
203207
if err != nil {

pkg/multicloud/qcloud/disk.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ func (self *SDisk) GetExpiredAt() time.Time {
312312
return self.DeadlineTime.Add(time.Hour * -8)
313313
}
314314

315+
func (self *SDisk) SetTags(tags map[string]string, replace bool) error {
316+
return self.storage.zone.region.SetResourceTags("cvm", "volume", []string{self.DiskId}, tags, replace)
317+
}
318+
315319
func (self *SDisk) GetISnapshot(snapshotId string) (cloudprovider.ICloudSnapshot, error) {
316320
snapshots, total, err := self.storage.zone.region.GetSnapshots("", "", "", []string{snapshotId}, 0, 1)
317321
if err != nil {

0 commit comments

Comments
 (0)