Comments

Xiaohua Guan created an issue. See original summary.

xiaohua guan’s picture

StatusFileSize
new70.81 KB
xiaohua guan’s picture

Status: Active » Needs review

@yas

I mainly modified codes as below.

  • Move field type key_value from k8s to cloud module.
  • Change field types of following fields from tag to key_value
    • field_tags of CloudServerTemplate
    • tags of Instance, Vpc and Subnet

Please review the patch file. Thanks.

yas’s picture

Status: Needs review » Reviewed & tested by the community

@xiaohua-guan

Thank you for providing the patch. I tested it and looks good to me. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

yas’s picture

yas’s picture

Status: Reviewed & tested by the community » Needs work

@xiaohua-guan

I got the following error while applying the patch.

error: patch failed: modules/cloud_service_providers/aws_cloud/aws_cloud.module:1665
error: modules/cloud_service_providers/aws_cloud/aws_cloud.module: patch does not apply

Could you please take a look at it?

xiaohua guan’s picture

StatusFileSize
new70.79 KB
xiaohua guan’s picture

Status: Needs work » Needs review

@yas

I uploaded a new patch file. Please take a look. Thanks.

yas’s picture

Status: Needs review » Needs work

@xiaohua-guan

Thank you for the update. The hook_update_N of the patch is 8197, so I merged 3113318-2.patch at first since the hook_update_N was addressed. So could you please increment hook_update_N to 8199? Sorry for the confusion and thank you for your extra efforts.

xiaohua guan’s picture

StatusFileSize
new70.79 KB
xiaohua guan’s picture

Status: Needs work » Needs review

@yas

I added a new patch file. Please review it. Thanks.

yas’s picture

Status: Needs review » Reviewed & tested by the community

@xiaohua-guan

Thank you for providing the patch. I tested it and looks good to me now. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

  • yas committed da10501 on 8.x-1.x authored by Xiaohua Guan
    Issue #3113290 by Xiaohua Guan, yas: Refactor to move field_tags to...

  • yas committed 6e0d6cb on 8.x-2.x authored by Xiaohua Guan
    Issue #3113290 by Xiaohua Guan, yas: Refactor to move field_tags to...
yas’s picture

Status: Reviewed & tested by the community » Fixed
xiaohua guan’s picture

StatusFileSize
new1.41 KB
xiaohua guan’s picture

Status: Fixed » Needs review

@yas

I fixed the error of unit test case. Could you review the patch file? Thanks,

xiaohua guan’s picture

StatusFileSize
new4.65 KB
xiaohua guan’s picture

@yas

I uploaded a new patch file. Please review it. Thanks.

yas’s picture

StatusFileSize
new1.05 KB

@xiaohua-guan

Thank you for the update. I tried to apply the patch and got the following error:

$ drush updb -y

 ----------- ----------- --------------- -------------------------------------- 
  Module      Update ID   Type            Description                           
 ----------- ----------- --------------- -------------------------------------- 
  aws_cloud   8197        hook_update_n   Rename instance profile, assume role  
                                          and switch role related fields.       
  aws_cloud   8198        hook_update_n   Add all_aws_cloud_volumes view.       
  aws_cloud   8199        hook_update_n   Change the type of field_tag and      
                                          tags to key_value.                    
  k8s         8264        hook_update_n   Update cloud service provider name    
                                          (k8s -> K8s)                          
  k8s         8265        hook_update_n   Add fields to k8s_persistent_volume.  
                                                                                
  k8s         8266        hook_update_n   Add k8s.project.settings.yaml file.   
  k8s         8267        hook_update_n   Add entity type k8s_service_account   
                                          and view k8s_service_account.         
  k8s         8268        hook_update_n   Add sorting order on capacity and     
                                          access modes fields.                  
  k8s         8269        hook_update_n   Add k8s.project.settings.yaml file.   
 ----------- ----------- --------------- -------------------------------------- 


 // Do you wish to run the specified pending updates?: yes.                                                             

>  [notice] Update started: k8s_update_8264
>  [notice] Update completed: k8s_update_8264
>  [notice] Update started: k8s_update_8265
>  [notice] Update completed: k8s_update_8265
>  [notice] Update started: k8s_update_8266
>  [notice] Update completed: k8s_update_8266
>  [notice] Update started: aws_cloud_update_8197
>  [notice] Update completed: aws_cloud_update_8197
>  [notice] Update started: k8s_update_8267
>  [notice] Update completed: k8s_update_8267
>  [notice] Update started: aws_cloud_update_8198
>  [notice] Update completed: aws_cloud_update_8198
>  [notice] Update started: k8s_update_8268
>  [notice] Update completed: k8s_update_8268
>  [notice] Update started: aws_cloud_update_8199
>  [error]  Field field_use_instance_profile is unknown. 
>  [error]  Update failed: aws_cloud_update_8199 
>  [notice] Update started: k8s_update_8269
>  [notice] Update completed: k8s_update_8269
 [error]  Update aborted by: aws_cloud_update_8199 
 [error]  Finished performing updates. 

I found:

  1. [error] Field field_use_instance_profile is unknown. is caused by [error] Update aborted by: aws_cloud_update_8199 because of [error] Update failed: aws_cloud_update_8199.
  2. [error] Update failed: aws_cloud_update_8199 is caused by my existing AWS Cloud service provider misconfiguration because the following code $ec2_service->updateInstancesWithoutBatch() is supposed to be run under the appropriate settings of AWS Cloud service provider:
    +++ b/modules/cloud_service_providers/aws_cloud/aws_cloud.install
    @@ -1705,6 +1706,113 @@ function aws_cloud_update_8198() {
     }
     
     /**
    + * Change the type of field_tag and tags to key_value.
    + */
    +function aws_cloud_update_8199() {
    ...
    +  // Update entities of Instance, Vpc, Subnet and Server templates.
    +  $ec2_service = \Drupal::service('aws_cloud.ec2');
    +  $config_entities = \Drupal::service('plugin.manager.cloud_config_plugin')->loadConfigEntities('aws_ec2');
    +  foreach ($config_entities as $config_entity) {
    +    $ec2_service->setCloudContext($config_entity->getCloudContext());
    +
    +    $ec2_service->updateInstancesWithoutBatch();
    +    $ec2_service->updateVpcsWithoutBatch();
    +    $ec2_service->updateSubnetsWithoutBatch();
    +    $ec2_service->updateCloudServerTemplatesWithoutBatch();
    +  }
    +}

Therefore, I made change as the interdiff-3113290-21.txt by adding try-catch clause. The patch it looks working well on my local testing environment. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

yas’s picture

Status: Needs review » Reviewed & tested by the community
yas’s picture

StatusFileSize
new1.3 KB
new5.31 KB

  • yas committed 62e5855 on 8.x-1.x authored by Xiaohua Guan
    Issue #3113290 by Xiaohua Guan, yas: Refactor to move field_tags to...

  • yas committed d48bf0c on 8.x-2.x authored by Xiaohua Guan
    Issue #3113290 by Xiaohua Guan, yas: Refactor to move field_tags to...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.