Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDSTACK-10090:createPortForwardingRule api call accepts 'halt' as … #2273

Merged
merged 1 commit into from Nov 8, 2017
Merged

Conversation

mrunalinikankariya
Copy link
Contributor

…Protocol which Stops VR

When we run the createPortForwardingRule API with input as Protocol as halt the PF rule is added however Halt is executed on VR. Hence the VR is stopped.

Following entry added to Firewall_Rules table and VirtualRouter went to halt(stopped)
mysql> select * from firewall_rules where id = 7

*************************** 1. row ***************************
id: 7
uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXX
ip_address_id: 13
start_port: 222
end_port: 222
state: Revoke
protocol: halt
purpose: PortForwarding
account_id: 2
domain_id: 1
network_id: 208
xid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
created: 2017-09-04 04:48:16
icmp_code: NULL
icmp_type: NULL
related: NULL
type: User
vpc_id: NULL
traffic_type

capabilities.put(Service.PortForwarding, null);

final Map<Capability, String> portForwardingCapabilities = new HashMap<Capability, String>();
portForwardingCapabilities.put(Capability.SupportedProtocols, NetUtils.TCP_PROTO + "," + NetUtils.UDP_PROTO);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why UDP? HAProxy cannot do UDP loadbalancing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@remibergsma
The changes here are for PF not for LB. Did I get you correctly ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind

@jayapalu
Copy link
Contributor

for PF protocol validation code changes LGTM

@niteshsarda
Copy link
Contributor

Tested the fix and it seems to be working fine. Test LGTM.

Before Applying fix :

If createPortForwardingRule api is executed with Protocol as "Halt", then router goes into halt state.

After Applying fix :

If createPortForwardingRule api is executed with Protocol as "Halt", then it throws an error. Below is the screenshot :

screenshot

@mrunalinikankariya
Copy link
Contributor Author

tag:This is Ready to Merge

@mrunalinikankariya
Copy link
Contributor Author

@rhtyd Could you merge this please

@rohityadavcloud
Copy link
Member

@mrunalinikankariya can you explain where/how this method is used and if putting a hardcoded protocol list can have undesirable effects, for example what if not both tcp,udp don't need to be port-forwarded.

For merging, this needs to be tested first.
@blueorangutan package

@blueorangutan
Copy link

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1211

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@mrunalinikankariya
Copy link
Contributor Author

@rhtyd
Here we are hardcoding the Port Forwarding capabilities which is used to validate the type of protocol while creating port forwarding rule. If the capabilities list is empty no validation is done and hence any value is accepted as the protocol type. With this change now only TCP and UDP protocol type are allowed for port forwarding rule creation. Hope this answers your question

@rohityadavcloud
Copy link
Member

Thanks @mrunalinikankariya for the explanation, however, I'm wondering if this might break use-cases where you would want to port-forward non-tcp/non-udp traffic such as esp, ah. Instead, can we add list of keywords that should not be allowed to be added to the protocol option? /cc @PaulAngus @DaanHoogland @nvazquez @borisstoyanov @wido @swill and others

@blueorangutan
Copy link

Trillian test result (tid-1622)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 38736 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2273-t1622-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermitten failure detected: /marvin/tests/smoke/test_host_annotations.py
Intermitten failure detected: /marvin/tests/smoke/test_internal_lb.py
Intermitten failure detected: /marvin/tests/smoke/test_iso.py
Intermitten failure detected: /marvin/tests/smoke/test_list_ids_parameter.py
Intermitten failure detected: /marvin/tests/smoke/test_loadbalance.py
Intermitten failure detected: /marvin/tests/smoke/test_metrics_api.py
Intermitten failure detected: /marvin/tests/smoke/test_multipleips_per_nic.py
Intermitten failure detected: /marvin/tests/smoke/test_nested_virtualization.py
Intermitten failure detected: /marvin/tests/smoke/test_network_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_network.py
Intermitten failure detected: /marvin/tests/smoke/test_nic.py
Intermitten failure detected: /marvin/tests/smoke/test_password_server.py
Intermitten failure detected: /marvin/tests/smoke/test_portforwardingrules.py
Intermitten failure detected: /marvin/tests/smoke/test_primary_storage.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_reset_vm_on_reboot.py
Intermitten failure detected: /marvin/tests/smoke/test_router_dhcphosts.py
Intermitten failure detected: /marvin/tests/smoke/test_router_dns.py
Intermitten failure detected: /marvin/tests/smoke/test_router_dnsservice.py
Intermitten failure detected: /marvin/tests/smoke/test_routers_iptables_default_policy.py
Intermitten failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermitten failure detected: /marvin/tests/smoke/test_routers.py
Intermitten failure detected: /marvin/tests/smoke/test_secondary_storage.py
Intermitten failure detected: /marvin/tests/smoke/test_service_offerings.py
Intermitten failure detected: /marvin/tests/smoke/test_snapshots.py
Intermitten failure detected: /marvin/tests/smoke/test_ssvm.py
Intermitten failure detected: /marvin/tests/smoke/test_templates.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_snapshots.py
Intermitten failure detected: /marvin/tests/smoke/test_volumes.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_router_nics.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Test completed. 29 look OK, 34 have error(s)

Test Result Time (s) Test File
test_10_destroy_cpvm Failure 0.04 test_ssvm.py
test_09_destroy_ssvm Failure 0.04 test_ssvm.py
test_08_reboot_cpvm Failure 0.04 test_ssvm.py
test_07_reboot_ssvm Failure 0.04 test_ssvm.py
test_06_stop_cpvm Failure 0.04 test_ssvm.py
test_05_stop_ssvm Failure 0.04 test_ssvm.py
test_04_cpvm_internals Failure 0.04 test_ssvm.py
test_03_ssvm_internals Failure 0.04 test_ssvm.py
test_02_list_cpvm_vm Failure 0.04 test_ssvm.py
test_01_list_sec_storage_vm Failure 0.04 test_ssvm.py
test_02_sys_template_ready Failure 0.10 test_secondary_storage.py
test_01_create_iso Failure 1514.46 test_iso.py
ContextSuite context=TestVpcSite2SiteVpn>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestVpcRemoteAccessVpn>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestRVPCSite2SiteVpn>:setup Error 0.00 test_vpc_vpn.py
ContextSuite context=TestVPCNics>:setup Error 0.00 test_vpc_router_nics.py
ContextSuite context=TestVPCRedundancy>:setup Error 0.00 test_vpc_redundant.py
ContextSuite context=TestVolumes>:setup Error 0.00 test_volumes.py
ContextSuite context=TestCreateVolume>:setup Error 0.00 test_volumes.py
ContextSuite context=TestVmSnapshot>:setup Error 0.06 test_vm_snapshots.py
ContextSuite context=TestVMLifeCycle>:setup Error 0.00 test_vm_life_cycle.py
ContextSuite context=TestDeployVM>:setup Error 0.00 test_vm_life_cycle.py
test_05_create_template_with_no_checksum Error 65.62 test_templates.py
test_04_create_template_with_checksum_md5 Error 65.50 test_templates.py
test_03_create_template_with_checksum_sha256 Error 65.58 test_templates.py
test_02_create_template_with_checksum_sha1 Error 65.50 test_templates.py
ContextSuite context=TestTemplates>:setup Error 70.84 test_templates.py
ContextSuite context=TestSnapshotRootDisk>:setup Error 0.00 test_snapshots.py
ContextSuite context=TestServiceOfferings>:setup Error 0.20 test_service_offerings.py
test_02_isolate_network_FW_PF_default_routes_egress_false Error 0.17 test_routers_network_ops.py
test_01_isolate_network_FW_PF_default_routes_egress_true Error 0.18 test_routers_network_ops.py
ContextSuite context=TestRedundantIsolateNetworks>:setup Error 1519.35 test_routers_network_ops.py
ContextSuite context=TestVPCIpTablesPolicies>:setup Error 0.00 test_routers_iptables_default_policy.py
ContextSuite context=TestRouterIpTablesPolicies>:setup Error 0.00 test_routers_iptables_default_policy.py
ContextSuite context=TestRouterServices>:setup Error 0.00 test_routers.py
ContextSuite context=TestRouterDnsService>:setup Error 0.00 test_router_dnsservice.py
ContextSuite context=TestRouterDns>:setup Error 0.00 test_router_dns.py
ContextSuite context=TestRouterDHCPOpts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestRouterDHCPHosts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestResetVmOnReboot>:setup Error 0.00 test_reset_vm_on_reboot.py
ContextSuite context=TestPrivateGwACL>:setup Error 0.00 test_privategw_acl.py
test_01_add_primary_storage_disabled_host Error 36.79 test_primary_storage.py
ContextSuite context=TestStorageTags>:setup Error 35.88 test_primary_storage.py
ContextSuite context=TestPortForwardingRules>:setup Error 0.00 test_portforwardingrules.py
ContextSuite context=TestIsolatedNetworksPasswdServer>:setup Error 0.00 test_password_server.py
test_01_nic Error 0.08 test_nic.py
ContextSuite context=TestNetworkACL>:setup Error 0.00 test_network_acl.py
test_releaseIP Error 0.72 test_network.py
test_reboot_router Error 0.09 test_network.py
test_delete_account Error 0.72 test_network.py
ContextSuite context=TestRouterRules>:setup Error 0.79 test_network.py
ContextSuite context=TestPortForwarding>:setup Error 0.78 test_network.py
ContextSuite context=TestNestedVirtualization>:setup Error 0.00 test_nested_virtualization.py
test_nic_secondaryip_add_remove Error 0.07 test_multipleips_per_nic.py
test_list_vms_metrics Error 0.15 test_metrics_api.py
ContextSuite context=TestLoadBalance>:setup Error 0.00 test_loadbalance.py
ContextSuite context=TestListIdsParams>:setup Error 0.00 test_list_ids_parameter.py
test_04_create_iso_with_no_checksum Error 65.48 test_iso.py
test_03_create_iso_with_checksum_md5 Error 65.63 test_iso.py
test_02_create_iso_with_checksum_sha256 Error 65.60 test_iso.py
test_01_create_iso_with_checksum_sha1 Error 65.67 test_iso.py
ContextSuite context=TestISO>:setup Error 3033.94 test_iso.py
ContextSuite context=TestInternalLb>:setup Error 0.00 test_internal_lb.py
test_05_add_annotation_for_invalid_entityType Error 0.07 test_host_annotations.py
ContextSuite context=TestDeployVirtioSCSIVM>:setup Error 0.00 test_deploy_virtio_scsi_vm.py
test_change_service_offering_for_vm_with_snapshots Skipped 0.00 test_vm_snapshots.py
ContextSuite context=TestCreateTemplate>:setup Skipped 0.00 test_templates.py
ContextSuite context=TestCopyDeleteTemplate>:setup Skipped 0.00 test_templates.py
test_static_role_account_acls Skipped 0.02 test_staticroles.py
test_11_ss_nfs_version_on_ssvm Skipped 0.02 test_ssvm.py
test_01_scale_vm Skipped 0.00 test_scale_vm.py
test_01_primary_storage_iscsi Skipped 0.08 test_primary_storage.py
test_vm_nic_adapter_vmxnet3 Skipped 0.00 test_nic_adapter_type.py
test_03_nic_multiple_vmware Skipped 0.06 test_nic.py
test_list_ha_for_host_valid Skipped 0.04 test_hostha_simulator.py
test_list_ha_for_host_invalid Skipped 0.07 test_hostha_simulator.py
test_list_ha_for_host Skipped 0.06 test_hostha_simulator.py
test_hostha_enable_feature_without_setting_provider Skipped 0.04 test_hostha_simulator.py
test_hostha_enable_feature_valid Skipped 0.04 test_hostha_simulator.py
test_hostha_disable_feature_valid Skipped 0.06 test_hostha_simulator.py
test_hostha_configure_invalid_provider Skipped 0.04 test_hostha_simulator.py
test_hostha_configure_default_driver Skipped 0.07 test_hostha_simulator.py
test_ha_verify_fsm_recovering Skipped 0.06 test_hostha_simulator.py
test_ha_verify_fsm_fenced Skipped 0.02 test_hostha_simulator.py
test_ha_verify_fsm_degraded Skipped 0.06 test_hostha_simulator.py
test_ha_verify_fsm_available Skipped 0.04 test_hostha_simulator.py
test_ha_multiple_mgmt_server_ownership Skipped 0.04 test_hostha_simulator.py
test_ha_list_providers Skipped 0.05 test_hostha_simulator.py
test_ha_enable_feature_invalid Skipped 0.04 test_hostha_simulator.py
test_ha_disable_feature_invalid Skipped 0.03 test_hostha_simulator.py
test_ha_configure_enabledisable_across_clusterzones Skipped 0.06 test_hostha_simulator.py
test_configure_ha_provider_valid Skipped 0.06 test_hostha_simulator.py
test_configure_ha_provider_invalid Skipped 0.03 test_hostha_simulator.py
test_hostha_kvm_host_recovering Skipped 31.08 test_hostha_kvm.py
test_hostha_kvm_host_fencing Skipped 36.09 test_hostha_kvm.py
test_deploy_vgpu_enabled_vm Skipped 0.03 test_deploy_vgpu_enabled_vm.py
test_3d_gpu_support Skipped 0.04 test_deploy_vgpu_enabled_vm.py

@jayapalu
Copy link
Contributor

jayapalu commented Nov 7, 2017

@rhtyd We can add list of allowed/supported protocols in the port forwarding capabilities rest will be blocked. If esp, ah is used in PF these can be added as well.

@rohityadavcloud
Copy link
Member

rohityadavcloud commented Nov 7, 2017

@jayapalu @mrunalinikankariya looks like there are several regression failures, this cannot be accepted as such, you can consider refactoring the logic to throw exception only for unsupported keywords/protocols

@jayapalu
Copy link
Contributor

jayapalu commented Nov 7, 2017

@rhtyd @mrunalinikankariya Test failures are not related these changes. If we look at the changes there are cpvm, ssvm, iso failures which are unrelated to it. There are test setup failures as well.

@rohityadavcloud
Copy link
Member

Okay @jayapalu rekicking tests.
@blueorangutan test

@blueorangutan
Copy link

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-1632)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 30644 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2273-t1632-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_host_annotations.py
Intermitten failure detected: /marvin/tests/smoke/test_internal_lb.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Test completed. 60 look OK, 3 have error(s)

Test Result Time (s) Test File
test_01_vpc_remote_access_vpn Failure 60.63 test_vpc_vpn.py
test_04_rvpc_privategw_static_routes Failure 327.68 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Failure 137.00 test_privategw_acl.py
test_02_vpc_privategw_static_routes Failure 242.25 test_privategw_acl.py
test_01_vpc_privategw_acl Failure 56.11 test_privategw_acl.py
test_05_add_annotation_for_invalid_entityType Error 0.05 test_host_annotations.py
test_change_service_offering_for_vm_with_snapshots Skipped 0.00 test_vm_snapshots.py
test_09_copy_delete_template Skipped 0.01 test_templates.py
test_06_copy_template Skipped 0.00 test_templates.py
test_static_role_account_acls Skipped 0.01 test_staticroles.py
test_11_ss_nfs_version_on_ssvm Skipped 0.01 test_ssvm.py
test_01_scale_vm Skipped 0.00 test_scale_vm.py
test_01_primary_storage_iscsi Skipped 0.05 test_primary_storage.py
test_vm_nic_adapter_vmxnet3 Skipped 0.00 test_nic_adapter_type.py
test_03_nic_multiple_vmware Skipped 0.69 test_nic.py
test_nested_virtualization_vmware Skipped 0.00 test_nested_virtualization.py
test_06_copy_iso Skipped 0.00 test_iso.py
test_list_ha_for_host_valid Skipped 0.02 test_hostha_simulator.py
test_list_ha_for_host_invalid Skipped 0.02 test_hostha_simulator.py
test_list_ha_for_host Skipped 0.03 test_hostha_simulator.py
test_hostha_enable_feature_without_setting_provider Skipped 0.01 test_hostha_simulator.py
test_hostha_enable_feature_valid Skipped 0.01 test_hostha_simulator.py
test_hostha_disable_feature_valid Skipped 0.01 test_hostha_simulator.py
test_hostha_configure_invalid_provider Skipped 0.02 test_hostha_simulator.py
test_hostha_configure_default_driver Skipped 0.01 test_hostha_simulator.py
test_ha_verify_fsm_recovering Skipped 0.01 test_hostha_simulator.py
test_ha_verify_fsm_fenced Skipped 0.01 test_hostha_simulator.py
test_ha_verify_fsm_degraded Skipped 0.02 test_hostha_simulator.py
test_ha_verify_fsm_available Skipped 0.01 test_hostha_simulator.py
test_ha_multiple_mgmt_server_ownership Skipped 0.01 test_hostha_simulator.py
test_ha_list_providers Skipped 0.03 test_hostha_simulator.py
test_ha_enable_feature_invalid Skipped 0.01 test_hostha_simulator.py
test_ha_disable_feature_invalid Skipped 0.01 test_hostha_simulator.py
test_ha_configure_enabledisable_across_clusterzones Skipped 0.02 test_hostha_simulator.py
test_configure_ha_provider_valid Skipped 0.01 test_hostha_simulator.py
test_configure_ha_provider_invalid Skipped 0.02 test_hostha_simulator.py
test_deploy_vgpu_enabled_vm Skipped 0.09 test_deploy_vgpu_enabled_vm.py
test_3d_gpu_support Skipped 0.04 test_deploy_vgpu_enabled_vm.py

@rohityadavcloud
Copy link
Member

rohityadavcloud commented Nov 8, 2017

Tests LGTM, given the provided feedback and explanations I'll merge this now. Thanks @mrunalinikankariya and @jayapalu

@rohityadavcloud rohityadavcloud merged commit 137d6a8 into apache:master Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants