mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 06:09:39 +08:00
bugfix
This commit is contained in:
@@ -667,20 +667,20 @@ func (self *SRegion) ChangeVMConfig(zoneId string, instanceId string, ncpu int,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SRegion) DetachDisk(instanceId string, diskId string, deviceName string) error {
|
||||
func (self *SRegion) DetachDisk(instanceId string, diskId string) error {
|
||||
params := &ec2.DetachVolumeInput{}
|
||||
params.SetInstanceId(instanceId)
|
||||
params.SetVolumeId(diskId)
|
||||
params.SetDevice(deviceName)
|
||||
|
||||
_, err := self.ec2Client.DetachVolume(params)
|
||||
return err
|
||||
}
|
||||
|
||||
func (self *SRegion) AttachDisk(instanceId string, diskId string) error {
|
||||
func (self *SRegion) AttachDisk(instanceId string, diskId string, deviceName string) error {
|
||||
params := &ec2.AttachVolumeInput{}
|
||||
params.SetInstanceId(instanceId)
|
||||
params.SetVolumeId(diskId)
|
||||
params.SetDevice(deviceName)
|
||||
|
||||
_, err := self.ec2Client.AttachVolume(params)
|
||||
return err
|
||||
|
||||
@@ -52,8 +52,14 @@ func init() {
|
||||
DISK string `help:"disk ID"`
|
||||
}
|
||||
|
||||
shellutils.R(&InstanceDiskOperationOptions{}, "instance-attach-disk", "Attach a disk to instance", func(cli *aws.SRegion, args *InstanceDiskOperationOptions) error {
|
||||
err := cli.AttachDisk(args.ID, args.DISK)
|
||||
type InstanceDiskAttachOptions struct {
|
||||
ID string `help:"instance ID"`
|
||||
DISK string `help:"disk ID"`
|
||||
DEVICE string `help:"disk device name. eg. /dev/sdb"`
|
||||
}
|
||||
|
||||
shellutils.R(&InstanceDiskAttachOptions{}, "instance-attach-disk", "Attach a disk to instance", func(cli *aws.SRegion, args *InstanceDiskOperationOptions) error {
|
||||
err := cli.AttachDisk(args.ID, args.DISK, args.DEVICE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user