@yas, Is Bastion required or needed for Openstack?
+++ b/modules/cloud_service_providers/openstack/openstack.module
@@ -810,3 +880,563 @@ function openstack_query_openstack_instance_views_access_alter(AlterableInterfac
+ * Return orders of AWS Cloud cloud server template fields.
The comment should apply to Openstack.
+++ b/modules/cloud_service_providers/openstack/src/Form/Config/OpenStackAdminSettings.php
@@ -157,6 +157,50 @@ class OpenStackAdminSettings extends ConfigFormBase {
+ $form['schedule']['schedule_settings'] = [
+ '#type' => 'details',
+ '#title' => $this->t('OpenStack Instance Scheduler'),
+ '#open' => TRUE,
+ ];
+
+ $form['schedule']['schedule_settings']['openstack_scheduler_tag'] = [
+ '#type' => 'textfield',
+ '#title' => $this->t('Schedule Tag'),
+ '#description' => $this->t('Name of scheduling tag. This tag value is defined when setting up the <a href=":stack">OpenStack Instance Scheduler</a>.', [
+ ':stack' => 'https://docs.aws.amazon.com/solutions/latest/instance-scheduler/deployment.html',
+ ]),
+ '#default_value' => $config->get('openstack_scheduler_tag'),
+ ];
+
+ $form['schedule']['schedule_settings']['openstack_scheduler_periods'] = [
+ '#type' => 'textarea',
+ '#title' => $this->t('Schedule periods'),
+ '#description' => $this->t('<p>Schedules defined in OpenStack Instance Scheduler. The values entered are shown in the Schedule field on instance edit form and launch template launch form. Enter one value per line, in the format <strong>key|label</strong>.</p><p>The key corresponds to the schedule name defined in OpenStack Instance Scheduler. The label is a free form descriptive value shown to users. An example configuration might be:<br/>office-hours|Office Hours - Monday to Friday 9:00am - 5:00pm.<br/><p>See <a href=:stack>Scheduler Configuration</a> for more information.</p>', [
+ ':stack' => 'https://docs.aws.amazon.com/solutions/latest/instance-scheduler/components.html',
+ ]),
+ '#default_value' => $config->get('openstack_scheduler_periods'),
+ ];
+
+ $form['cost_management'] = [
+ '#type' => 'details',
+ '#title' => $this->t('Cost Management'),
+ '#open' => TRUE,
+ ];
+
+ $form['cost_management']['openstack_instance_type_cost'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->t('Instance Type Cost'),
+ '#description' => $this->t('Enable Instance Type cost in launch template create or edit form.'),
+ '#default_value' => $config->get('openstack_instance_type_cost'),
+ ];
+
+ $form['cost_management']['openstack_instance_type_cost_list'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->t('Instance Type Cost List'),
+ '#description' => $this->t('Enable Instance Type Cost List in launch template launch form.'),
+ '#default_value' => $config->get('openstack_instance_type_cost_list'),
+ ];
+
@yas, please verify if these are all required for Openstack. For example, I don't think scheduler_tag will work for Openstack, since it pertains to AWS Instance Scheduler. What about Cost Management and Instance Type Cost List
+++ b/modules/cloud_service_providers/openstack/src/Plugin/cloud/server_template/OpenStackServerTemplatePlugin.php
@@ -0,0 +1,646 @@
+ // Create a new VPC peering connection.
+ $result = $this->ec2Service->createVpcPeeringConnection([
+ 'VpcId' => $from_vpc_id,
+ 'PeerVpcId' => $to_vpc_id,
+ ]);
+ $connection_id = $result['VpcPeeringConnection']['VpcPeeringConnectionId'];
+
+ // Accept a VPC peering connection request.
+ $result = $this->ec2Service->acceptVpcPeeringConnection([
+ 'VpcPeeringConnectionId' => $connection_id,
+ ]);
+ if (empty($result['VpcPeeringConnection'])) {
+ $this->messenger->addError($this->t(
+ 'Failed to accept the VPC peering connection request. It is possible due to that two VPCs have overlapping CIDR blocks. Please confirm the CIDR blocks of the VPC @from_vpc_id and @to_vpc_id.',
+ ['@from_vpc_id' => $from_vpc_id, '@to_vpc_id' => $to_vpc_id]
+ ));
+ return FALSE;
+ }
+
+ $this->messenger->addMessage($this->t(
+ 'The VPC peering connection was created from the VPC @from_vpc_id to the VPC @to_vpc_id.',
+ ['@from_vpc_id' => $from_vpc_id, '@to_vpc_id' => $to_vpc_id]
+ ));
Please verify if VpcPeering API works for openstack. When I check the documentation, it seems like a majority of the Peering Connection api is not supported.
Thank you for your high quality review for the patch. Basically we should strip out unsupported AWS features.
OpenStack doesn't support Launch Template, so we should remove that code.
We don't have to include bastion-related logic into the code. Bastion concept is still necessary even in OpenStack, however it should be implemented in the future.
Thanksる
We can remove scheduler- and cost_management-related form items.
We can remove VPC peering-related code.
We can remove that code related to Launch Template.
Thank you @jigish for the updated patch. It is looking good. I have the following comments. @yas, please review them as well, and let me know your thoughts.
Thank you for the update. Could you please re-create the patch by following up newly introduced our own method processOperationStatus() for addMessage() and the log at #3133275-25?
Comments
Comment #2
jigish.addweb commentedComment #3
jigish.addweb commentedComment #4
xiaohua guan commented@jigish.addweb @yas
Thanks for the patch. It looks good to me.
Comment #5
baldwinlouie commented@jigish and @yas, thank you for the patch. I have comments for both @jigish and @yas. Please review them.
This function needs a bit of work. The following code does not apply to Openstack. There are no LaunchTemplates in Openstack.
@yas, Is Bastion required or needed for Openstack?
The comment should apply to Openstack.
@yas, please verify if these are all required for Openstack. For example, I don't think scheduler_tag will work for Openstack, since it pertains to AWS Instance Scheduler. What about Cost Management and Instance Type Cost List
Please verify if VpcPeering API works for openstack. When I check the documentation, it seems like a majority of the Peering Connection api is not supported.
https://docs.openstack.org/api-ref/ec2-api/
I don't think LaunchTemplates are supported in Openstack? Please verify.
Please verify Launch Templates. I don't think they are supported in Openstack.
Comment #6
yas@baldwinlouie
Thank you for your high quality review for the patch. Basically we should strip out unsupported AWS features.
Launch Template, so we should remove that code.bastion-related logic into the code. Bastion concept is still necessary even in OpenStack, however it should be implemented in the future.scheduler- andcost_management-related form items.VPC peering-related code.Launch Template.@jigishaddweb
Could you please update the patch?
Comment #7
jigish.addweb commentedComment #8
jigish.addweb commented@yas @baldwinlouie
Thank you for reviewing the patch.
I updated the code as per your comment.
Please review the updated patch.
Thanks
Comment #9
jigish.addweb commented@yas @baldwinlouie
Please review this new patch as I removed some unnecessary code.
Thanks
Comment #10
jigish.addweb commented@yas @baldwinlouie
I fixed coding standard violations and done some code changes.
Please review the new patch file.
Thanks
Comment #11
baldwinlouie commented@jigish, and @yas,
Thank you @jigish for the updated patch. It is looking good. I have the following comments. @yas, please review them as well, and let me know your thoughts.
I don't think we should have Openstack logic in the aws_cloud module.
I think we should have an Openstack version of this function.
I don't think we should have Openstack logic in the aws_cloud module.
I think we should have an Openstack version of this function.
I don't think we should have Openstack logic in the aws_cloud module.
I think we should have an Openstack version of this function.
I don't think we should have Openstack logic in the aws_cloud module.
I think we should have an Openstack version of this function.
I don't think we should have Openstack logic in AWS.
Should we subclass this for Openstack and add the Openstack specific logic in there.
Comment #12
yas@baldwinlouie
Thank you for your review.
For 1-5. I agree to your comments. We should not include hard-coded string like
'openstack'in aws_cloud.module.@jigishaddweb
Can you modify the logic?
Comment #13
jigish.addweb commentedComment #14
jigish.addweb commented@yas @baldwinlouie
Thank you for the review.
I removed hard-coded string
'openstack'from aws_cloud.module and added that functions in OpenStack.Please review the updated patch.
Thanks
Comment #15
baldwinlouie commented@jigish, @yas,
Thank you for the updated patch. It looks good now. I only have one comment below.
Please switch to
$this->entityTypeManagerComment #16
jigish.addweb commentedComment #17
jigish.addweb commented@yas @baldwinlouie
Thank you for your review.
I changed the code as per your comment.
Please review updated patch.
Thanks
Comment #18
jigish.addweb commented@yas @baldwinlouie
Removing
OpenStackValueConverterand usedAwsCloudValueConverteras OpenStackValueConverter have not any custom logic for OpenStack.Please review this new patch.
Thanks
Comment #19
baldwinlouie commented@jigish, Thank you. The patch looks good to me now.
Comment #20
yas@jigishaddweb
Thank you for the update. Could you please re-create the patch by following up newly introduced our own method
processOperationStatus()for addMessage() and the log at #3133275-25?Comment #21
jigish.addweb commentedComment #22
jigish.addweb commented@yas @baldwinlouie
Thank you for testing the patch and done changes for addMessage().
Please review new patch.
Thanks
Comment #23
yas@jigishaddweb
Thank you for the update. Could you please add
\Drupal::logger()at the following occurrences?Comment #24
jigish.addweb commented@yas
I added
\Drupal::logger()which you mentioned in previous comment.Please review updated patch again.
Thanks
Comment #25
yas@jigishaddweb
Thank you for the refactoring. It looks good now. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #28
yas