add more log

This commit is contained in:
TangBin
2018-11-10 14:00:22 +08:00
parent d71357f906
commit 4b9c26aee2
3 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -140,8 +140,8 @@ func (self *SAwsGuestDriver) RequestDeployGuestOnHost(ctx context.Context, guest
if err != nil {
return nil, err
}
log.Debugf("VMcreated %s, wait status ready ...", iVM.GetGlobalId())
err = cloudprovider.WaitStatus(iVM, models.VM_READY, time.Second*5, time.Second*1800)
log.Debugf("VMcreated %s, wait status running ...", iVM.GetGlobalId())
err = cloudprovider.WaitStatus(iVM, models.VM_RUNNING, time.Second*5, time.Second*1800)
if err != nil {
return nil, err
}
+1
View File
@@ -56,6 +56,7 @@ func (self *SHost) GetIVMs() ([]cloudprovider.ICloudVM, error) {
}
func (self *SHost) GetIVMById(gid string) (cloudprovider.ICloudVM, error) {
log.Debugf("GetIVMById %s", gid)
ivms, _, err := self.zone.region.GetInstances(self.zone.ZoneId, []string{gid}, 0, 1)
if err != nil {
return nil, err
+6 -3
View File
@@ -404,6 +404,8 @@ func (self *SRegion) GetInstances(zoneId string, ids []string, offset int, limit
if len(filters) > 0 {
params = params.SetFilters(filters)
}
log.Debugf("GetInstances with params: %s", params.String())
res, err := self.ec2Client.DescribeInstances(params)
if err != nil {
log.Errorf("GetInstances fail %s", err)
@@ -413,6 +415,7 @@ func (self *SRegion) GetInstances(zoneId string, ids []string, offset int, limit
instances := []SInstance{}
for _, reservation := range res.Reservations {
for _, instance := range reservation.Instances {
log.Debugf("GetInstances %s", instance.String())
if err := FillZero(instance); err != nil {
return nil, 0, err
}
@@ -540,7 +543,9 @@ func (self *SRegion) CreateInstance(name string, imageId string, instanceType st
size = int64(disk.Size)
ebs := &ec2.EbsBlockDevice{
DeleteOnTermination: &disk.DeleteWithInstance,
Encrypted: &disk.Encrypted,
// The st1 volume type cannot be used for boot volumes. Please use a supported boot volume type: standard,io1,gp2.
// the encrypted flag cannot be specified since device /dev/sda1 has a snapshot specified.
// Encrypted: &disk.Encrypted,
VolumeSize: &size,
VolumeType: &disk.Category,
}
@@ -581,7 +586,6 @@ func (self *SRegion) CreateInstance(name string, imageId string, instanceType st
return "", err
}
dryrun := true
params := ec2.RunInstancesInput{
ImageId: &imageId,
InstanceType: &instanceType,
@@ -594,7 +598,6 @@ func (self *SRegion) CreateInstance(name string, imageId string, instanceType st
Placement: &ec2.Placement{AvailabilityZone: &zoneId},
SecurityGroupIds: []*string{&securityGroupId},
TagSpecifications: []*ec2.TagSpecification{ec2TagSpec},
DryRun: &dryrun, // todo: 测试
}
res, err := self.ec2Client.RunInstances(&params)
if err != nil {