Commit 395bd172 by Szabolcs Gelencsér

Add 'allow all' security group to created interfaces

parent 019ee29f
...@@ -189,7 +189,21 @@ class AddInterfaceOperation(InstanceOperation): ...@@ -189,7 +189,21 @@ class AddInterfaceOperation(InstanceOperation):
os_policy_actions = (("compute", "compute:attach_interface"),) os_policy_actions = (("compute", "compute:attach_interface"),)
def _operation(self, request, user, system, vlan, managed=None): def _operation(self, request, user, system, vlan, managed=None):
openstack_api.nova.interface_attach(request, self.instance, net_id=vlan) interface = openstack_api.nova.interface_attach(request, self.instance, net_id=vlan)
security_group = openstack_api.neutron.security_group_create(request, interface.port_id, interface.port_id)
# TODO: add UI elements to adjust this
openstack_api.neutron.security_group_rule_create(
request,
security_group.id,
"ingress",
"IPv4",
None, None, None,
"0.0.0.0/0", None,
)
openstack_api.neutron.port_update(request, interface.port_id, security_groups=[security_group.id])
@register_operation @register_operation
class CreateDiskOperation(InstanceOperation): class CreateDiskOperation(InstanceOperation):
...@@ -411,6 +425,7 @@ class RemoveInterfaceOperation(InstanceOperation): ...@@ -411,6 +425,7 @@ class RemoveInterfaceOperation(InstanceOperation):
def _operation(self, request, port_id): def _operation(self, request, port_id):
openstack_api.nova.interface_detach(request, self.instance.id, port_id) openstack_api.nova.interface_detach(request, self.instance.id, port_id)
#TODO: remove public IPs, associated security groups
@register_operation @register_operation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment