Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote-tracking branch 'origin/dev/sjones/EUCA-9605' into testing

  • Loading branch information...
commit 213e47f5906a814cd5d8dfbffb63d0f95ff54e4c 2 parents 8c69d4f + 7ee8bd2
Steve Jones sjones4 authored

Showing 37 changed files with 1,009 additions and 159 deletions. Show diff stats Hide diff stats

  1. +153 2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/VmInstanceLifecycleHelpers.groovy
  2. +10 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/run/Allocations.java
  3. +23 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/NetworkInterface.java
  4. +43 7 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/NetworkInterfaceAttachment.java
  5. +38 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/SecurityGroups.java
  6. +3 2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/Subnet.java
  7. +6 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/Subnets.java
  8. +81 12 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/VpcManager.java
  9. +5 1 ...s/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceDhcpOptionSets.java
  10. +5 1 ...cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceInternetGateways.java
  11. +7 1 ...ules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceNetworkAcls.java
  12. +5 1 ...luster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceNetworkInterfaces.java
  13. +7 1 ...ules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceRouteTables.java
  14. +79 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/persist/PersistenceSecurityGroups.java
  15. +5 2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceSubnets.java
  16. +5 1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/PersistenceVpcs.java
  17. +3 2 ...dules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/{ → persist}/VpcPersistenceSupport.java
  18. +20 5 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/EdgeNetworkingService.groovy
  19. +93 12 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/NetworkGroup.java
  20. +17 4 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/NetworkGroupManager.java
  21. +57 81 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/NetworkGroups.java
  22. +5 1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/NetworkPeer.java
  23. +52 1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmBootRecord.java
  24. +1 5 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmControl.java
  25. +68 4 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstance.java
  26. +8 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstances.java
  27. +15 0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmNetworkConfig.java
  28. +3 1 clc/modules/cluster-manager/src/main/resources/eucalyptus-userdata.xml
  29. +12 1 clc/modules/compute-common/src/main/java/com/eucalyptus/compute/common/VPC.groovy
  30. +73 5 clc/modules/compute-common/src/main/java/com/eucalyptus/compute/common/VmControl.groovy
  31. +1 0  clc/modules/compute-common/src/main/java/com/eucalyptus/compute/common/VmSecurity.groovy
  32. +1 0  clc/modules/compute-common/src/main/java/com/eucalyptus/compute/common/network/NetworkingFeature.java
  33. +10 0 clc/modules/compute-common/src/main/java/com/eucalyptus/compute/common/network/NetworkingMessages.groovy
  34. +9 0 clc/modules/compute-common/src/main/resources/ec2-vpc-10-06-15.xml
  35. +12 1 clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/VPC.groovy
  36. +73 5 clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/VmControl.groovy
  37. +1 0  clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/VmSecurity.groovy
155 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/VmInstanceLifecycleHelpers.groovy
@@ -31,6 +31,8 @@ import com.eucalyptus.cloud.util.IllegalMetadataAccessException
31 31 import com.eucalyptus.cloud.util.MetadataException
32 32 import com.eucalyptus.cloud.util.ResourceAllocationException
33 33 import com.eucalyptus.cluster.callback.StartNetworkCallback
  34 +import com.eucalyptus.component.Partition
  35 +import com.eucalyptus.component.Partitions
34 36 import com.eucalyptus.component.id.Eucalyptus
35 37 import com.eucalyptus.compute.common.network.NetworkResource
36 38 import com.eucalyptus.compute.common.network.Networking
@@ -40,6 +42,14 @@ import com.eucalyptus.compute.common.network.PrivateNetworkIndexResource
40 42 import com.eucalyptus.compute.common.network.PublicIPResource
41 43 import com.eucalyptus.compute.common.network.ReleaseNetworkResourcesType
42 44 import com.eucalyptus.compute.common.network.SecurityGroupResource
  45 +import com.eucalyptus.compute.common.network.VpcNetworkInterfaceResource
  46 +import com.eucalyptus.compute.common.network.VpcResource
  47 +import com.eucalyptus.compute.identifier.ResourceIdentifiers
  48 +import com.eucalyptus.compute.vpc.NetworkInterfaceAttachment
  49 +import com.eucalyptus.compute.vpc.NetworkInterfaces
  50 +import com.eucalyptus.compute.vpc.NetworkInterface as VpcNetworkInterface
  51 +import com.eucalyptus.compute.vpc.Subnet
  52 +import com.eucalyptus.compute.vpc.persist.PersistenceNetworkInterfaces
43 53 import com.eucalyptus.entities.Entities
44 54 import com.eucalyptus.entities.Transactions
45 55 import com.eucalyptus.network.NetworkGroup
@@ -51,6 +61,7 @@ import com.eucalyptus.records.EventType
51 61 import com.eucalyptus.records.Logs
52 62 import com.eucalyptus.system.Threads
53 63 import com.eucalyptus.util.Callback
  64 +import com.eucalyptus.util.Cidr
54 65 import com.eucalyptus.util.CollectionUtils
55 66 import com.eucalyptus.util.LockResource
56 67 import com.eucalyptus.util.Ordered
@@ -72,6 +83,7 @@ import com.google.common.collect.Lists
72 83 import com.google.common.collect.Maps
73 84 import com.google.common.collect.Sets
74 85 import edu.ucsb.eucalyptus.cloud.VmInfo
  86 +import edu.ucsb.eucalyptus.msgs.RunInstancesType
75 87 import groovy.transform.CompileStatic
76 88 import groovy.transform.PackageScope
77 89 import org.apache.log4j.Logger
@@ -502,11 +514,14 @@ class VmInstanceLifecycleHelpers {
502 514 static final class SecurityGroupVmInstanceLifecycleHelper extends NetworkResourceVmInstanceLifecycleHelper {
503 515 @Override
504 516 void verifyAllocation( final Allocation allocation ) throws MetadataException {
  517 + //TODO:STEVE: update to verify VPC constraints
505 518 final AccountFullName accountFullName = allocation.getOwnerFullName( ).asAccountFullName( )
506 519
507 520 final Set<String> networkNames = Sets.newLinkedHashSet( allocation.getRequest( ).securityGroupNames( ) )
508 521 final Set<String> networkIds = Sets.newLinkedHashSet( allocation.getRequest().securityGroupsIds() )
509   - if ( networkNames.isEmpty( ) && networkIds.isEmpty() ) {
  522 + final String vpcId = allocation?.subnet?.vpc?.displayName
  523 + final boolean isVpc = vpcId
  524 + if ( networkNames.isEmpty( ) && networkIds.isEmpty( ) ) {
510 525 Threads.enqueue( Eucalyptus, VmInstanceLifecycleHelper, 5 ){
511 526 NetworkGroups.lookup( accountFullName, NetworkGroups.defaultNetworkName( ) )
512 527 }
@@ -517,7 +532,11 @@ class VmInstanceLifecycleHelpers {
517 532 // AWS EC2 lets you pass a name as an ID, but not an ID as a name.
518 533 for ( String groupName : networkNames ) {
519 534 if ( !Iterables.tryFind( groups, CollectionUtils.propertyPredicate( groupName, RestrictedTypes.toDisplayName() ) ).isPresent() ) {
520   - groups.add( NetworkGroups.lookup( accountFullName, groupName ) )
  535 + if ( !isVpc ) {
  536 + groups.add( NetworkGroups.lookup( accountFullName, groupName ) )
  537 + } else if ( groupName == NetworkGroups.defaultNetworkName( ) ) {
  538 + groups.add( NetworkGroups.lookupDefault( accountFullName, vpcId ) )
  539 + }
521 540 }
522 541 }
523 542 for ( String groupId : networkIds ) {
@@ -572,8 +591,140 @@ class VmInstanceLifecycleHelpers {
572 591 messages.addRequest( State.CREATE_NETWORK, callback )
573 592 EventRecord.here( ClusterAllocator, EventType.VM_PREPARE, callback.getClass( ).getSimpleName( ), net.toString( ) ).debug( )
574 593 }
  594 + void
  595 + }
  596 + }
  597 + }
  598 + }
  599 +
  600 + /**
  601 + * For network interface, including mac address and private IP address
  602 + */
  603 + static final class VpcNetworkInterfaceVmInstanceLifecycleHelper extends NetworkResourceVmInstanceLifecycleHelper {
  604 + final NetworkInterfaces networkInterfaces = new PersistenceNetworkInterfaces( )
  605 +
  606 + @Override
  607 + void verifyAllocation( final Allocation allocation ) throws MetadataException {
  608 + final RunInstancesType runInstances = (RunInstancesType) allocation.request
  609 + final String subnetId = runInstances.subnetId
  610 + final String privateIp = runInstances.privateIpAddress
  611 + if ( !Strings.isNullOrEmpty( subnetId ) || !Strings.isNullOrEmpty( privateIp ) ) {
  612 + final Subnet subnet = Entities.transaction( Subnet ){ Entities.uniqueResult( Subnet.exampleWithName( null, subnetId ) ) }
  613 + if ( !RestrictedTypes.filterPrivileged( ).apply( subnet ) ) {
  614 + throw new IllegalMetadataAccessException( "Not authorized to use subnet ${subnetId} for ${allocation.ownerFullName.userName}" )
  615 + }
  616 + if ( !Cidr.parse( subnet.cidr ).contains( privateIp ) ) {
  617 + throw new MetadataException( "Private IP ${privateIp} not valid for subnet ${subnetId} cidr ${subnet.cidr}" )
  618 + }
  619 + allocation.subnet = subnet
  620 +
  621 + //TODO:STEVE: Error if availability zone was set in request
  622 + final Partition partition = Partitions.lookupByName( subnet.getAvailabilityZone( ) );
  623 + allocation.setPartition( partition );
  624 + }
  625 + }
  626 +
  627 + @Override
  628 + void prepareNetworkAllocation(
  629 + final Allocation allocation,
  630 + final PrepareNetworkResourcesType prepareNetworkResourcesType) {
  631 + if ( allocation.subnet && !prepareFromTokenResources( allocation, prepareNetworkResourcesType, VpcResource ) ) {
  632 + allocation?.allocationTokens?.each{ ResourceToken token ->
  633 + Collection<NetworkResource> resources = token.getAttribute(NetworkResourcesKey).findAll{ NetworkResource resource ->
  634 + resource instanceof VpcResource && resource.ownerId != null }
  635 + if ( resources.isEmpty( ) ) {
  636 + String identifier = ResourceIdentifiers.generateString( 'eni' )
  637 + //TODO:STEVE: mac address prefix? use eni identifier for mac uniqueness
  638 + final String mac = String.format( "d0:0d:%s:%s:%s:%s",
  639 + token.instanceId.substring( 2, 4 ),
  640 + token.instanceId.substring( 4, 6 ),
  641 + token.instanceId.substring( 6, 8 ),
  642 + token.instanceId.substring( 8, 10 ) )
  643 + //String.format( "d0:0d:%s:%s:%s:%s", identifier.substring( 4, 6 ), identifier.substring( 6, 8 ), identifier.substring( 8, 10 ), identifier.substring( 10, 12 ) );
  644 + resources = [
  645 + new VpcResource(
  646 + ownerId: token.instanceId,
  647 + value: allocation.subnet.vpc.displayName
  648 + ),
  649 + new VpcNetworkInterfaceResource(
  650 + ownerId: token.instanceId,
  651 + value: identifier,
  652 + mac: mac,
  653 + privateIp: ((RunInstancesType)allocation.request).privateIpAddress // TODO:STEVE: track address usage and update subnet free address count
  654 + )
  655 + ] as Collection<NetworkResource>
  656 + if ( allocation.subnet.mapPublicIpOnLaunch ) {
  657 + resources << new PublicIPResource( ownerId: identifier )
  658 + }
  659 + }
  660 + token.getAttribute(NetworkResourcesKey).removeAll( resources )
  661 + prepareNetworkResourcesType.resources.addAll( resources )
  662 + }
  663 + }
  664 + }
  665 +
  666 + @Override
  667 + void prepareVmRunType(
  668 + final ResourceToken resourceToken,
  669 + final VmRunBuilder builder
  670 + ) {
  671 + VpcNetworkInterfaceResource resource = ( VpcNetworkInterfaceResource ) \
  672 + resourceToken.getAttribute(NetworkResourcesKey).find{ it instanceof VpcNetworkInterfaceResource }
  673 + resource?.with{
  674 + builder.privateAddress( resource.privateIp )
  675 + }
  676 + }
  677 +
  678 + @Override
  679 + void prepareVmInstance( final ResourceToken resourceToken,
  680 + final VmInstanceBuilder builder ) {
  681 + List<VpcNetworkInterfaceResource> resources = resourceToken.getAttribute(NetworkResourcesKey).findAll{
  682 + it instanceof VpcNetworkInterfaceResource } as List<VpcNetworkInterfaceResource>
  683 + if ( resources ) {
  684 + builder.onBuild( { VmInstance instance ->
  685 + instance.updateMacAddress( resources[0].mac )
  686 + instance.updatePrivateAddress( resources[0].privateIp )
  687 + int index = 0;
  688 + for ( VpcNetworkInterfaceResource resource : resources ) {
  689 + VpcNetworkInterface networkInterface = networkInterfaces.save( VpcNetworkInterface.create(
  690 + instance.owner,
  691 + instance.bootRecord.vpc,
  692 + instance.bootRecord.subnet,
  693 + resource.value,
  694 + resource.mac,
  695 + resource.privateIp,
  696 + 'Primary network interface' //TODO:STEVE: use description passed in run instances (if any)
  697 + ) )
  698 + networkInterface.attach( NetworkInterfaceAttachment.create(
  699 + ResourceIdentifiers.generateString( "eni-attach" ),
  700 + instance,
  701 + instance.displayName,
  702 + instance.owner.accountNumber,
  703 + index,
  704 + NetworkInterfaceAttachment.Status.attached,
  705 + new Date( ),
  706 + true //TODO:STEVE: use value passed in run instances (if any)
  707 + ) )
  708 + // Add so eni information is available from instance, not for
  709 + // persistence
  710 + instance.getNetworkInterfaces( ).add( networkInterface );
  711 + index++
  712 + }
  713 + } as Callback<VmInstance> )
  714 + }
  715 + }
  716 +
  717 + @Override
  718 + void cleanUpInstance( final VmInstance instance, final VmState state ) {
  719 + if ( VmInstance.VmStateSet.DONE.contains( state ) && Entities.isPersistent( instance ) ) {
  720 + for ( VpcNetworkInterface networkInterface : instance.networkInterfaces ) {
  721 + if ( networkInterface?.attachment?.deleteOnTerminate ) {
  722 + Entities.delete( networkInterface )
  723 + }
  724 + networkInterface.detach( )
575 725 }
576 726 }
577 727 }
578 728 }
  729 +
579 730 }
10 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/run/Allocations.java
@@ -85,6 +85,7 @@
85 85 import com.eucalyptus.cloud.util.MetadataException;
86 86 import com.eucalyptus.cloud.util.NotEnoughResourcesException;
87 87 import com.eucalyptus.component.Partition;
  88 +import com.eucalyptus.compute.vpc.Subnet;
88 89 import com.eucalyptus.context.Context;
89 90 import com.eucalyptus.context.Contexts;
90 91 import com.eucalyptus.entities.Entities;
@@ -136,6 +137,7 @@
136 137 private SshKeyPair sshKeyPair;
137 138 private BootableSet bootSet;
138 139 private VmType vmType;
  140 + private Subnet subnet;
139 141 private NetworkGroup primaryNetwork;
140 142 private Map<String, NetworkGroup> networkGroups = Maps.newHashMap( );
141 143 private String iamInstanceProfileArn;
@@ -363,6 +365,14 @@ public void setVmType(final VmType vmType) {
363 365 this.vmType = vmType;
364 366 }
365 367
  368 + public Subnet getSubnet() {
  369 + return subnet;
  370 + }
  371 +
  372 + public void setSubnet( final Subnet subnet ) {
  373 + this.subnet = subnet;
  374 + }
  375 +
366 376 public UserFullName getOwnerFullName() {
367 377 return this.ownerFullName;
368 378 }
23 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/NetworkInterface.java
@@ -38,6 +38,7 @@
38 38 import com.eucalyptus.entities.UserMetadata;
39 39 import com.eucalyptus.util.FullName;
40 40 import com.eucalyptus.util.OwnerFullName;
  41 +import com.eucalyptus.vm.VmInstance;
41 42
42 43 /**
43 44 *
@@ -118,6 +119,13 @@ public static NetworkInterface exampleWithName( final OwnerFullName owner, final
118 119 @Cache( usage = CacheConcurrencyStrategy.TRANSACTIONAL )
119 120 private Subnet subnet;
120 121
  122 + // Due to an issue with mappedBy on VmNetworkConfig we define the instance
  123 + // reference here rather than on the embedded attachment where it belongs
  124 + @ManyToOne( fetch = FetchType.LAZY )
  125 + @JoinColumn( name = "metadata_instance_id" )
  126 + @Cache( usage = CacheConcurrencyStrategy.TRANSACTIONAL )
  127 + private VmInstance instance;
  128 +
121 129 @Column( name = "metadata_zone", nullable = false, updatable = false )
122 130 private String availabilityZone;
123 131
@@ -177,6 +185,10 @@ public void setSubnet( final Subnet subnet ) {
177 185 this.subnet = subnet;
178 186 }
179 187
  188 + VmInstance getInstance() {
  189 + return instance;
  190 + }
  191 +
180 192 public String getAvailabilityZone() {
181 193 return availabilityZone;
182 194 }
@@ -248,4 +260,15 @@ public boolean isAttached( ) {
248 260 public NetworkInterfaceAttachment getAttachment( ) {
249 261 return attachment;
250 262 }
  263 +
  264 + public void attach( final NetworkInterfaceAttachment attachment ) {
  265 + if ( isAttached( ) ) throw new IllegalStateException( "Already attached" );
  266 + this.attachment = attachment;
  267 + this.instance = attachment.getInstance( );
  268 + }
  269 +
  270 + public void detach( ) {
  271 + this.attachment = null;
  272 + this.instance = null;
  273 + }
251 274 }
50 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/NetworkInterfaceAttachment.java
@@ -23,6 +23,10 @@
23 23 import java.util.Date;
24 24 import javax.persistence.Column;
25 25 import javax.persistence.Embeddable;
  26 +import javax.persistence.PostLoad;
  27 +import javax.persistence.Transient;
  28 +import org.hibernate.annotations.Parent;
  29 +import com.eucalyptus.vm.VmInstance;
26 30
27 31 /**
28 32 *
@@ -43,6 +47,7 @@ protected NetworkInterfaceAttachment( ) {
43 47 }
44 48
45 49 protected NetworkInterfaceAttachment( final String attachmentId,
  50 + final VmInstance instance,
46 51 final String instanceId,
47 52 final String instanceOwnerId,
48 53 final Integer deviceIndex,
@@ -50,6 +55,7 @@ protected NetworkInterfaceAttachment( final String attachmentId,
50 55 final Date attachTime,
51 56 final Boolean deleteOnTerminate ) {
52 57 this.attachmentId = attachmentId;
  58 + this.instance = instance;
53 59 this.instanceId = instanceId;
54 60 this.instanceOwnerId = instanceOwnerId;
55 61 this.deviceIndex = deviceIndex;
@@ -58,15 +64,17 @@ protected NetworkInterfaceAttachment( final String attachmentId,
58 64 this.deleteOnTerminate = deleteOnTerminate;
59 65 }
60 66
61   - public NetworkInterfaceAttachment create( final String attachmentId,
62   - final String instanceId,
63   - final String instanceOwnerId,
64   - final Integer deviceIndex,
65   - final Status status,
66   - final Date attachTime,
67   - final Boolean deleteOnTerminate ) {
  67 + public static NetworkInterfaceAttachment create( final String attachmentId,
  68 + final VmInstance instance,
  69 + final String instanceId,
  70 + final String instanceOwnerId,
  71 + final Integer deviceIndex,
  72 + final Status status,
  73 + final Date attachTime,
  74 + final Boolean deleteOnTerminate ) {
68 75 return new NetworkInterfaceAttachment(
69 76 attachmentId,
  77 + instance,
70 78 instanceId,
71 79 instanceOwnerId,
72 80 deviceIndex,
@@ -76,6 +84,13 @@ public NetworkInterfaceAttachment create( final String attachmentId,
76 84 );
77 85 }
78 86
  87 + @Parent
  88 + private NetworkInterface networkInterface;
  89 +
  90 + // Persisted by field in parent NetworkInterface
  91 + @Transient
  92 + private VmInstance instance;
  93 +
79 94 @Column( name = "metadata_attachment_id" )
80 95 private String attachmentId;
81 96
@@ -97,6 +112,14 @@ public NetworkInterfaceAttachment create( final String attachmentId,
97 112 @Column( name = "metadata_att_delete_on_term" )
98 113 private Boolean deleteOnTerminate;
99 114
  115 + protected NetworkInterface getNetworkInterface() {
  116 + return networkInterface;
  117 + }
  118 +
  119 + protected void setNetworkInterface( final NetworkInterface networkInterface ) {
  120 + this.networkInterface = networkInterface;
  121 + }
  122 +
100 123 public String getAttachmentId() {
101 124 return attachmentId;
102 125 }
@@ -105,6 +128,14 @@ public void setAttachmentId( final String attachmentId ) {
105 128 this.attachmentId = attachmentId;
106 129 }
107 130
  131 + public VmInstance getInstance() {
  132 + return instance;
  133 + }
  134 +
  135 + public void setInstance( final VmInstance instance ) {
  136 + this.instance = instance;
  137 + }
  138 +
108 139 public String getInstanceId() {
109 140 return instanceId;
110 141 }
@@ -152,4 +183,9 @@ public Boolean getDeleteOnTerminate() {
152 183 public void setDeleteOnTerminate( final Boolean deleteOnTerminate ) {
153 184 this.deleteOnTerminate = deleteOnTerminate;
154 185 }
  186 +
  187 + @PostLoad
  188 + protected void postLoad( ) {
  189 + this.instance = networkInterface.getInstance( );
  190 + }
155 191 }
38 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/SecurityGroups.java
... ... @@ -0,0 +1,38 @@
  1 +/*************************************************************************
  2 + * Copyright 2009-2014 Eucalyptus Systems, Inc.
  3 + *
  4 + * This program is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU General Public License as published by
  6 + * the Free Software Foundation; version 3 of the License.
  7 + *
  8 + * This program is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU General Public License for more details.
  12 + *
  13 + * You should have received a copy of the GNU General Public License
  14 + * along with this program. If not, see http://www.gnu.org/licenses/.
  15 + *
  16 + * Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
  17 + * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
  18 + * additional information or have any questions.
  19 + ************************************************************************/
  20 +package com.eucalyptus.compute.vpc;
  21 +
  22 +import static com.eucalyptus.compute.common.CloudMetadata.NetworkGroupMetadata;
  23 +import com.eucalyptus.network.NetworkGroup;
  24 +import com.google.common.base.Function;
  25 +
  26 +/**
  27 + *
  28 + */
  29 +public interface SecurityGroups {
  30 +
  31 + <T> T lookupDefault( String vpcId,
  32 + Function<? super NetworkGroup,T> transform ) throws VpcMetadataException;
  33 +
  34 + NetworkGroup save( NetworkGroup networkGroup ) throws VpcMetadataException;
  35 +
  36 + boolean delete( NetworkGroup networkGroup ) throws VpcMetadataException;
  37 +
  38 +}
5 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/Subnet.java
@@ -34,6 +34,7 @@
34 34 import org.hibernate.annotations.CacheConcurrencyStrategy;
35 35 import com.eucalyptus.component.ComponentIds;
36 36 import com.eucalyptus.component.id.Eucalyptus;
  37 +import com.eucalyptus.compute.identifier.ResourceIdentifiers;
37 38 import com.eucalyptus.crypto.Crypto;
38 39 import com.eucalyptus.entities.UserMetadata;
39 40 import com.eucalyptus.util.Cidr;
@@ -73,9 +74,9 @@ public static Subnet create( final OwnerFullName owner,
73 74 final Subnet subnet = new Subnet( owner, name );
74 75 subnet.setVpc( vpc );
75 76 subnet.setNetworkAcl( networkAcl );
76   - subnet.setNetworkAclAssociationId( Crypto.generateId( "aclassoc" ) );
  77 + subnet.setNetworkAclAssociationId( ResourceIdentifiers.generateString( "aclassoc" ) );
77 78 subnet.setRouteTable( routeTable );
78   - subnet.setRouteTableAssociationId( Crypto.generateId( "rtbassoc" ) );
  79 + subnet.setRouteTableAssociationId( ResourceIdentifiers.generateString( "rtbassoc" ) );
79 80 subnet.setCidr( cidr );
80 81 subnet.setAvailabilityZone( availabilityZone );
81 82 subnet.setAvailableIpAddressCount( ((int) Math.pow( 2, 32 - Cidr.parse( cidr ).getPrefix( ) )) - 5 ); // 5 reserved
6 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/Subnets.java
@@ -28,6 +28,7 @@
28 28 import org.hibernate.criterion.Criterion;
29 29 import com.eucalyptus.compute.common.CloudMetadatas;
30 30 import com.eucalyptus.tags.FilterSupport;
  31 +import com.eucalyptus.util.Callback;
31 32 import com.eucalyptus.util.OwnerFullName;
32 33 import com.eucalyptus.util.TypeMapper;
33 34 import com.google.common.base.Enums;
@@ -54,6 +55,11 @@
54 55
55 56 Subnet save( Subnet subnet ) throws VpcMetadataException;
56 57
  58 + Subnet updateByExample( Subnet example,
  59 + OwnerFullName ownerFullName,
  60 + String key,
  61 + Callback<Subnet> updateCallback ) throws VpcMetadataException;
  62 +
57 63 @TypeMapper
58 64 public enum SubnetToSubnetTypeTransform implements Function<Subnet,SubnetType> {
59 65 INSTANCE;
93 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/VpcManager.java
@@ -23,10 +23,12 @@
23 23 import java.util.Collections;
24 24 import java.util.List;
25 25 import java.util.Map;
  26 +import javax.inject.Inject;
26 27 import org.apache.log4j.Logger;
27 28 import com.eucalyptus.auth.AuthQuotaException;
28 29 import com.eucalyptus.auth.principal.AccountFullName;
29 30 import com.eucalyptus.auth.principal.UserFullName;
  31 +import com.eucalyptus.component.annotation.ComponentNamed;
30 32 import com.eucalyptus.compute.ClientComputeException;
31 33 import com.eucalyptus.compute.ComputeException;
32 34 import com.eucalyptus.compute.common.CloudMetadata;
@@ -35,9 +37,12 @@
35 37 import com.eucalyptus.compute.identifier.ResourceIdentifiers;
36 38 import com.eucalyptus.context.Context;
37 39 import com.eucalyptus.context.Contexts;
38   -import com.eucalyptus.crypto.Crypto;
39 40 import com.eucalyptus.entities.AbstractPersistent;
40 41 import com.eucalyptus.entities.Entities;
  42 +import com.eucalyptus.network.NetworkGroup;
  43 +import com.eucalyptus.network.NetworkGroups;
  44 +import com.eucalyptus.network.NetworkPeer;
  45 +import com.eucalyptus.network.NetworkRule;
41 46 import com.eucalyptus.tags.*;
42 47 import com.eucalyptus.util.Callback;
43 48 import com.eucalyptus.util.CollectionUtils;
@@ -55,6 +60,7 @@
55 60 import com.google.common.base.Predicates;
56 61 import com.google.common.base.Supplier;
57 62 import com.google.common.collect.Iterables;
  63 +import com.google.common.collect.Lists;
58 64 import edu.ucsb.eucalyptus.msgs.*;
59 65 import edu.ucsb.eucalyptus.msgs.Filter;
60 66
@@ -62,17 +68,38 @@
62 68 *
63 69 */
64 70 @SuppressWarnings( "UnnecessaryLocalVariable" )
  71 +@ComponentNamed
65 72 public class VpcManager {
66 73
67 74 private static final Logger logger = Logger.getLogger( VpcManager.class );
68 75
69   - private final Vpcs vpcs = new PersistenceVpcs( ); //TODO:STEVE: injection
70   - private final Subnets subnets = new PersistenceSubnets( );
71   - private final InternetGateways internetGateways = new PersistenceInternetGateways( );
72   - private final DhcpOptionSets dhcpOptionSets = new PersistenceDhcpOptionSets( );
73   - private final NetworkAcls networkAcls = new PersistenceNetworkAcls( );
74   - private final RouteTables routeTables = new PersistenceRouteTables( );
75   - private final NetworkInterfaces networkInterfaces = new PersistenceNetworkInterfaces( );
  76 + private final DhcpOptionSets dhcpOptionSets;
  77 + private final InternetGateways internetGateways;
  78 + private final NetworkAcls networkAcls;
  79 + private final NetworkInterfaces networkInterfaces;
  80 + private final RouteTables routeTables;
  81 + private final SecurityGroups securityGroups;
  82 + private final Subnets subnets;
  83 + private final Vpcs vpcs;
  84 +
  85 + @Inject
  86 + public VpcManager( final DhcpOptionSets dhcpOptionSets,
  87 + final InternetGateways internetGateways,
  88 + final NetworkAcls networkAcls,
  89 + final NetworkInterfaces networkInterfaces,
  90 + final RouteTables routeTables,
  91 + final SecurityGroups securityGroups,
  92 + final Subnets subnets,
  93 + final Vpcs vpcs ) {
  94 + this.dhcpOptionSets = dhcpOptionSets;
  95 + this.internetGateways = internetGateways;
  96 + this.networkAcls = networkAcls;
  97 + this.networkInterfaces = networkInterfaces;
  98 + this.routeTables = routeTables;
  99 + this.securityGroups = securityGroups;
  100 + this.subnets = subnets;
  101 + this.vpcs = vpcs;
  102 + }
76 103
77 104 public AcceptVpcPeeringConnectionResponseType acceptVpcPeeringConnection(AcceptVpcPeeringConnectionType request) throws EucalyptusCloudException {
78 105 AcceptVpcPeeringConnectionResponseType reply = request.getReply( );
@@ -333,7 +360,21 @@ public Vpc get( ) {
333 360 vpcs.save( Vpc.create( userFullName, Identifier.vpc.generate( ), options, request.getCidrBlock( ), false ) );
334 361 routeTables.save( RouteTable.create( userFullName, vpc, Identifier.rtb.generate( ), vpc.getCidr( ), true ) );
335 362 networkAcls.save( NetworkAcl.create( userFullName, vpc, Identifier.acl.generate( ), true ) );
336   - //TODO:STEVE: create default security group with rules alowing intra-group traffic
  363 + final NetworkGroup group = NetworkGroup.create(
  364 + userFullName,
  365 + vpc,
  366 + ResourceIdentifiers.generateString( NetworkGroup.ID_PREFIX ),
  367 + NetworkGroups.defaultNetworkName(),
  368 + "default VPC security group" );
  369 + //TODO:STEVE: update when security group protocol support is updated for VPC
  370 + final Collection<NetworkPeer> peers = Lists.newArrayList( NetworkPeer.create( group.getGroupId( ) ) );
  371 + group.getNetworkRules( ).addAll( Lists.newArrayList(
  372 + NetworkRule.create( NetworkRule.Protocol.icmp, -1, -1, peers, null ),
  373 + NetworkRule.create( NetworkRule.Protocol.tcp, 0, 65535, peers, null ),
  374 + NetworkRule.create( NetworkRule.Protocol.udp, 0, 65535, peers, null )
  375 + ) );
  376 + securityGroups.save( group );
  377 + //TODO:STEVE: rules
337 378 return vpc;
338 379 } catch ( Exception ex ) {
339 380 throw new RuntimeException( ex );
@@ -541,9 +582,11 @@ public Vpc apply( final Pair<AccountFullName, String> accountAndId ) {
541 582 try {
542 583 final Vpc vpc = vpcs.lookupByName( accountAndId.getLeft( ), accountAndId.getRight( ), Functions.<Vpc>identity( ) );
543 584 if ( RestrictedTypes.filterPrivileged( ).apply( vpc ) ) {
544   - //TODO:STEVE: delete default security group
545 585 networkAcls.delete( networkAcls.lookupDefault( vpc.getDisplayName(), Functions.<NetworkAcl>identity() ) );
546 586 routeTables.delete( routeTables.lookupMain( vpc.getDisplayName(), Functions.<RouteTable>identity() ) );
  587 + try {
  588 + securityGroups.delete( securityGroups.lookupDefault( vpc.getDisplayName(), Functions.<NetworkGroup>identity() ) );
  589 + } catch ( VpcMetadataNotFoundException e ) { /* so no need to delete */ }
547 590 vpcs.delete( vpc );
548 591 } // else treat this as though the vpc does not exist
549 592 return null;
@@ -748,6 +791,32 @@ public ModifyNetworkInterfaceAttributeResponseType modifyNetworkInterfaceAttribu
748 791 return reply;
749 792 }
750 793
  794 + public ModifySubnetAttributeResponseType modifySubnetAttribute( final ModifySubnetAttributeType request ) throws EucalyptusCloudException {
  795 + final ModifySubnetAttributeResponseType reply = request.getReply( );
  796 + final Context ctx = Contexts.lookup( );
  797 + final AccountFullName accountFullName = ctx.getUserFullName( ).asAccountFullName( );
  798 + try {
  799 + subnets.updateByExample(
  800 + Subnet.exampleWithName( ctx.isAdministrator( ) ? null : accountFullName, Identifier.subnet.normalize( request.getSubnetId( ) ) ),
  801 + accountFullName,
  802 + request.getSubnetId( ),
  803 + new Callback<Subnet>() {
  804 + @Override
  805 + public void fire( final Subnet subnet ) {
  806 + if ( RestrictedTypes.filterPrivileged( ).apply( subnet ) ) {
  807 + final AttributeBooleanValueType value = request.getMapPublicIpOnLaunch( );
  808 + if ( value != null && value.getValue( ) != null ) {
  809 + subnet.setMapPublicIpOnLaunch( value.getValue( ) );
  810 + }
  811 + }
  812 + }
  813 + } );
  814 + } catch( Exception e ) {
  815 + throw handleException( e );
  816 + }
  817 + return reply;
  818 + }
  819 +
751 820 public ModifyVpcAttributeResponseType modifyVpcAttribute(ModifyVpcAttributeType request) throws EucalyptusCloudException {
752 821 ModifyVpcAttributeResponseType reply = request.getReply( );
753 822 return reply;
@@ -813,7 +882,7 @@ public UnassignPrivateIpAddressesResponseType unassignPrivateIpAddresses(Unassig
813 882 }
814 883
815 884 public String generate( ) {
816   - return Crypto.generateId( name( ) );
  885 + return ResourceIdentifiers.generateString( name( ) );
817 886 }
818 887
819 888 public String normalize( final String identifier ) throws EucalyptusCloudException {
@@ -926,7 +995,7 @@ public String normalize( final String identifier, final String parameter ) throw
926 995 }
927 996 }
928 997
929   - private static void handleException( final Exception e ) throws ComputeException {
  998 + private static ComputeException handleException( final Exception e ) throws ComputeException {
930 999 throw handleException( e, false );
931 1000 }
932 1001
6 ...lyptus/compute/vpc/PersistenceDhcpOptionSets.java → ...ompute/vpc/persist/PersistenceDhcpOptionSets.java
@@ -17,14 +17,18 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
22 22 import static com.eucalyptus.compute.common.CloudMetadata.DhcpOptionSetMetadata;
  23 +import com.eucalyptus.component.annotation.ComponentNamed;
  24 +import com.eucalyptus.compute.vpc.DhcpOptionSet;
  25 +import com.eucalyptus.compute.vpc.DhcpOptionSets;
23 26 import com.eucalyptus.util.OwnerFullName;
24 27
25 28 /**
26 29 *
27 30 */
  31 +@ComponentNamed
28 32 public class PersistenceDhcpOptionSets extends VpcPersistenceSupport<DhcpOptionSetMetadata, DhcpOptionSet> implements DhcpOptionSets {
29 33
30 34 public PersistenceDhcpOptionSets( ) {
6 ...ptus/compute/vpc/PersistenceInternetGateways.java → ...pute/vpc/persist/PersistenceInternetGateways.java
@@ -17,14 +17,18 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
  22 +import com.eucalyptus.component.annotation.ComponentNamed;
22 23 import com.eucalyptus.compute.common.CloudMetadata;
  24 +import com.eucalyptus.compute.vpc.InternetGateway;
  25 +import com.eucalyptus.compute.vpc.InternetGateways;
23 26 import com.eucalyptus.util.OwnerFullName;
24 27
25 28 /**
26 29 *
27 30 */
  31 +@ComponentNamed
28 32 public class PersistenceInternetGateways extends VpcPersistenceSupport<CloudMetadata.InternetGatewayMetadata, InternetGateway> implements InternetGateways {
29 33
30 34 public PersistenceInternetGateways( ) {
8 ...ucalyptus/compute/vpc/PersistenceNetworkAcls.java → ...s/compute/vpc/persist/PersistenceNetworkAcls.java
@@ -17,12 +17,17 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
22 22 import static com.eucalyptus.compute.common.CloudMetadata.NetworkAclMetadata;
23 23 import java.util.Collections;
24 24 import java.util.NoSuchElementException;
25 25 import org.hibernate.criterion.Restrictions;
  26 +import com.eucalyptus.component.annotation.ComponentNamed;
  27 +import com.eucalyptus.compute.vpc.NetworkAcl;
  28 +import com.eucalyptus.compute.vpc.NetworkAcls;
  29 +import com.eucalyptus.compute.vpc.VpcMetadataException;
  30 +import com.eucalyptus.compute.vpc.VpcMetadataNotFoundException;
26 31 import com.eucalyptus.util.OwnerFullName;
27 32 import com.google.common.base.Function;
28 33 import com.google.common.base.Predicates;
@@ -31,6 +36,7 @@
31 36 /**
32 37 *
33 38 */
  39 +@ComponentNamed
34 40 public class PersistenceNetworkAcls extends VpcPersistenceSupport<NetworkAclMetadata, NetworkAcl> implements NetworkAcls {
35 41
36 42 public PersistenceNetworkAcls() {
6 ...tus/compute/vpc/PersistenceNetworkInterfaces.java → ...ute/vpc/persist/PersistenceNetworkInterfaces.java
@@ -17,14 +17,18 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
22 22 import static com.eucalyptus.compute.common.CloudMetadata.NetworkInterfaceMetadata;
  23 +import com.eucalyptus.component.annotation.ComponentNamed;
  24 +import com.eucalyptus.compute.vpc.NetworkInterface;
  25 +import com.eucalyptus.compute.vpc.NetworkInterfaces;
23 26 import com.eucalyptus.util.OwnerFullName;
24 27
25 28 /**
26 29 *
27 30 */
  31 +@ComponentNamed
28 32 public class PersistenceNetworkInterfaces extends VpcPersistenceSupport<NetworkInterfaceMetadata, NetworkInterface> implements NetworkInterfaces {
29 33
30 34 public PersistenceNetworkInterfaces( ) {
8 ...ucalyptus/compute/vpc/PersistenceRouteTables.java → ...s/compute/vpc/persist/PersistenceRouteTables.java
@@ -17,12 +17,17 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
22 22 import static com.eucalyptus.compute.common.CloudMetadata.RouteTableMetadata;
23 23 import java.util.Collections;
24 24 import java.util.NoSuchElementException;
25 25 import org.hibernate.criterion.Restrictions;
  26 +import com.eucalyptus.component.annotation.ComponentNamed;
  27 +import com.eucalyptus.compute.vpc.RouteTable;
  28 +import com.eucalyptus.compute.vpc.RouteTables;
  29 +import com.eucalyptus.compute.vpc.VpcMetadataException;
  30 +import com.eucalyptus.compute.vpc.VpcMetadataNotFoundException;
26 31 import com.eucalyptus.util.OwnerFullName;
27 32 import com.google.common.base.Function;
28 33 import com.google.common.base.Predicates;
@@ -31,6 +36,7 @@
31 36 /**
32 37 *
33 38 */
  39 +@ComponentNamed
34 40 public class PersistenceRouteTables extends VpcPersistenceSupport<RouteTableMetadata, RouteTable> implements RouteTables {
35 41
36 42 public PersistenceRouteTables() {
79 clc/modules/cluster-manager/src/main/java/com/eucalyptus/compute/vpc/persist/PersistenceSecurityGroups.java
... ... @@ -0,0 +1,79 @@
  1 +/*************************************************************************
  2 + * Copyright 2009-2014 Eucalyptus Systems, Inc.
  3 + *
  4 + * This program is free software: you can redistribute it and/or modify
  5 + * it under the terms of the GNU General Public License as published by
  6 + * the Free Software Foundation; version 3 of the License.
  7 + *
  8 + * This program is distributed in the hope that it will be useful,
  9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11 + * GNU General Public License for more details.
  12 + *
  13 + * You should have received a copy of the GNU General Public License
  14 + * along with this program. If not, see http://www.gnu.org/licenses/.
  15 + *
  16 + * Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
  17 + * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
  18 + * additional information or have any questions.
  19 + ************************************************************************/
  20 +package com.eucalyptus.compute.vpc.persist;
  21 +
  22 +import static com.eucalyptus.compute.common.CloudMetadata.NetworkGroupMetadata;
  23 +import java.util.NoSuchElementException;
  24 +import com.eucalyptus.component.annotation.ComponentNamed;
  25 +import com.eucalyptus.compute.vpc.SecurityGroups;
  26 +import com.eucalyptus.compute.vpc.VpcMetadataException;
  27 +import com.eucalyptus.compute.vpc.VpcMetadataNotFoundException;
  28 +import com.eucalyptus.entities.Transactions;
  29 +import com.eucalyptus.network.NetworkGroup;
  30 +import com.eucalyptus.network.NetworkGroups;
  31 +import com.eucalyptus.util.OwnerFullName;
  32 +import com.google.common.base.Function;
  33 +import com.google.common.base.Predicates;
  34 +import com.google.common.collect.Iterables;
  35 +
  36 +/**
  37 + *
  38 + */
  39 +@ComponentNamed
  40 +public class PersistenceSecurityGroups extends VpcPersistenceSupport<NetworkGroupMetadata, NetworkGroup> implements SecurityGroups {
  41 +
  42 + public PersistenceSecurityGroups( ) {
  43 + super( "security-group" );
  44 + }
  45 +
  46 + @Override
  47 + public <T> T lookupDefault( final String vpcId,
  48 + final Function<? super NetworkGroup, T> transform ) throws VpcMetadataException {
  49 + try {
  50 + return Iterables.getOnlyElement( listByExample(
  51 + NetworkGroup.namedForVpc( null, vpcId, NetworkGroups.defaultNetworkName() ),
  52 + Predicates.alwaysTrue(),
  53 + transform ) );
  54 + } catch ( NoSuchElementException e ) {
  55 + throw new VpcMetadataNotFoundException( "Default security group not found for " + vpcId );
  56 + }
  57 + }
  58 +
  59 + public boolean delete( final NetworkGroup networkGroup ) throws VpcMetadataException {
  60 + try {
  61 + return Transactions.delete( networkGroup );
  62 + } catch ( NoSuchElementException e ) {
  63 + return false;
  64 + } catch ( Exception e ) {
  65 + throw metadataException( "Error deleting "+typeDescription+" '"+describe( networkGroup )+"'", e );
  66 + }
  67 +
  68 + }
  69 +
  70 + @Override
  71 + protected NetworkGroup exampleWithOwner( final OwnerFullName ownerFullName ) {
  72 + return NetworkGroup.withOwner( ownerFullName );
  73 + }
  74 +
  75 + @Override
  76 + protected NetworkGroup exampleWithName( final OwnerFullName ownerFullName, final String name ) {
  77 + return NetworkGroup.named( ownerFullName, name );
  78 + }
  79 +}
7 ...om/eucalyptus/compute/vpc/PersistenceSubnets.java → ...yptus/compute/vpc/persist/PersistenceSubnets.java
@@ -17,15 +17,18 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
  22 +import com.eucalyptus.component.annotation.ComponentNamed;
22 23 import com.eucalyptus.compute.common.CloudMetadata;
23   -import com.eucalyptus.entities.AbstractPersistentSupport;
  24 +import com.eucalyptus.compute.vpc.Subnet;
  25 +import com.eucalyptus.compute.vpc.Subnets;
24 26 import com.eucalyptus.util.OwnerFullName;
25 27
26 28 /**
27 29 *
28 30 */
  31 +@ComponentNamed
29 32 public class PersistenceSubnets extends VpcPersistenceSupport<CloudMetadata.SubnetMetadata, Subnet> implements Subnets {
30 33
31 34 public PersistenceSubnets( ) {
6 ...a/com/eucalyptus/compute/vpc/PersistenceVpcs.java → ...calyptus/compute/vpc/persist/PersistenceVpcs.java
@@ -17,14 +17,18 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
  22 +import com.eucalyptus.component.annotation.ComponentNamed;
22 23 import com.eucalyptus.compute.common.CloudMetadata;
  24 +import com.eucalyptus.compute.vpc.Vpc;
  25 +import com.eucalyptus.compute.vpc.Vpcs;
23 26 import com.eucalyptus.util.OwnerFullName;
24 27
25 28 /**
26 29 *
27 30 */
  31 +@ComponentNamed
28 32 public class PersistenceVpcs extends VpcPersistenceSupport<CloudMetadata.VpcMetadata, Vpc> implements Vpcs {
29 33
30 34 public PersistenceVpcs( ) {
5 ...eucalyptus/compute/vpc/VpcPersistenceSupport.java → ...us/compute/vpc/persist/VpcPersistenceSupport.java
@@ -17,9 +17,10 @@
17 17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 18 * additional information or have any questions.
19 19 ************************************************************************/
20   -package com.eucalyptus.compute.vpc;
  20 +package com.eucalyptus.compute.vpc.persist;
21 21
22   -import com.eucalyptus.compute.common.CloudMetadata;
  22 +import com.eucalyptus.compute.vpc.VpcMetadataException;
  23 +import com.eucalyptus.compute.vpc.VpcMetadataNotFoundException;
23 24 import com.eucalyptus.entities.AbstractPersistent;
24 25 import com.eucalyptus.entities.AbstractPersistentSupport;
25 26 import com.eucalyptus.util.RestrictedType;
25 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/EdgeNetworkingService.groovy
@@ -36,6 +36,8 @@ import com.eucalyptus.compute.common.network.UpdateInstanceResourcesResponseType
36 36 import com.eucalyptus.compute.common.network.UpdateInstanceResourcesType
37 37 import com.eucalyptus.compute.common.network.UpdateNetworkResourcesResponseType
38 38 import com.eucalyptus.compute.common.network.UpdateNetworkResourcesType
  39 +import com.eucalyptus.compute.common.network.VpcNetworkInterfaceResource
  40 +import com.eucalyptus.compute.common.network.VpcResource
39 41 import com.eucalyptus.network.config.NetworkConfigurations