From 6f6cf7cd64349ba42c3595eecc36b67660aa9311 Mon Sep 17 00:00:00 2001 From: tangbin Date: Wed, 19 Feb 2020 17:56:45 +0800 Subject: [PATCH] aws rebuild root fix --- pkg/multicloud/aws/instance.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/multicloud/aws/instance.go b/pkg/multicloud/aws/instance.go index 5ce258587e..fb57518640 100644 --- a/pkg/multicloud/aws/instance.go +++ b/pkg/multicloud/aws/instance.go @@ -960,12 +960,17 @@ func (self *SRegion) ReplaceSystemDisk(ctx context.Context, instanceId string, i } log.Debugf("ReplaceSystemDisk replace root disk %s", rootDisk.DiskId) + subnetId := "" + if len(instance.VpcAttributes.NetworkId) > 0 { + subnetId = instance.VpcAttributes.NetworkId + } + // create tmp server tempName := fmt.Sprintf("__tmp_%s", instance.GetName()) _id, err := self.CreateInstance(tempName, imageId, instance.InstanceType, - "", + subnetId, "", instance.ZoneId, instance.Description,