Add functionality to create an image from an instance. Add a link in the entity operation to the new functionality. Add button links from an instance's edit and canonical view.

CommentFileSizeAuthor
#4 3020077_1.patch22.49 KBbaldwinlouie
#2 3020077.patch13.99 KBbaldwinlouie

Comments

baldwinlouie created an issue. See original summary.

baldwinlouie’s picture

Status: Active » Needs review
StatusFileSize
new13.99 KB

Attaching a patch that includes this functionality. Patch includes a test case.

yas’s picture

Status: Needs review » Needs work

@baldwinlouie

I tried the patch and I have a couple of feedback:

  1. I created an image from a running instance. It looks fine. However, when I delete the image while creating it (pending state in AWS management console, it seems to be deleted (deregistered) immediately, but in fact, it is actually not deleted (it is still pending state in AWS management console in my case). I think the validation logic is required to see the image state (available | pending | failed).
  2. The URL https://example.com/clouds/aws_cloud/{cloud_context}/image doesn't work since:
    # Commented out.  This operation takes too long to complete and returns everything
    #aws_cloud.updateImageList:
    #  path: '/clouds/aws_cloud/{cloud_context}/image/update'
    #  defaults:
    #    _controller: '\Drupal\aws_cloud\Controller\Ec2\ApiController::updateImageList'
    #  requirements:
    #    _permission: 'edit aws cloud image'
    
  3. Could you please include the test case? The following is the suggested test sequence (by using mock data):
    1. Repeat the following from 2. to 5. for three different instances
    2. Launch an instance
    3. List to check if the instance is running
    4. Create Image after running the instance
    5. List Image to check if the image creation is complete
    6. Repeat the following from 7. to 8. for three different instances above
    7. Delete an image
    8. List Image to check if the image is gone
baldwinlouie’s picture

Status: Needs work » Needs review
StatusFileSize
new22.49 KB

@yas, Here's the updated patch and my comments

#1. "State" was not being brought into the aws_cloud_image table. I added support for updating that field. I tightened the logic for deleting and image. If an image is in "pending" state, there is no delete button or delete link. For "available" and "failed", I think they are ok to be deleted.

#2. I cannot reproduce this one. I can see the images page on my instance. The route I commented out should not affect the main image page. It could a issue with views caching the route somehow. I've seen this before with other landing pages, but cannot reproduce every time. Now that you have installed and uninstalled the module a few times, do you still see the issue?

#3. I added the requested test cases. Note, I had to start using the $this->clickLink() to simulate a browser click. I was not able to reliably predict the image id that Drupal was assigning to imported/created images. Sometimes, the id would start at 2 and some other times, the id would start at 4. I thought using clickLink() was a good alternative. That is how a user browses the site anyway.

yas’s picture

Status: Needs review » Reviewed & tested by the community

@baldwinlouie

Thank you for the updated patch. I tried it and it looks working well. Now it cares about pending state to block deleting. I'll merge the one.

  • yas committed 07dfa4d on 8.x-1.x authored by baldwinlouie
    Issue #3020077 by baldwinlouie, yas: Create an AMI Image from an...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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