|
35 | 35 | import org.apache.cloudstack.api.command.user.network.ResetNetworkPermissionsCmd; |
36 | 36 | import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd; |
37 | 37 | import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd; |
| 38 | +import org.apache.cloudstack.api.command.admin.network.AssociateNetworkToNicCmd; |
| 39 | +import org.apache.cloudstack.api.command.admin.network.ChangeNicPrimaryNetworkCmd; |
| 40 | +import org.apache.cloudstack.api.command.admin.network.DisassociateNetworkFromNicCmd; |
38 | 41 | import org.apache.cloudstack.api.command.user.vm.ListNicsCmd; |
39 | 42 | import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse; |
40 | 43 | import org.apache.cloudstack.framework.config.ConfigKey; |
|
59 | 62 | import com.cloud.utils.exception.CloudRuntimeException; |
60 | 63 | import com.cloud.vm.Nic; |
61 | 64 | import com.cloud.vm.NicSecondaryIp; |
| 65 | +import com.cloud.vm.VirtualMachine; |
62 | 66 |
|
63 | 67 | /** |
64 | 68 | * The NetworkService interface is the "public" api to entities that make requests to the orchestration engine |
@@ -249,6 +253,32 @@ Network createPrivateNetwork(String networkName, String displayText, long physic |
249 | 253 |
|
250 | 254 | List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd listNicsCmd); |
251 | 255 |
|
| 256 | + /** |
| 257 | + * Associates one or more additional networks with an existing nic, delivering them as a multi-VLAN trunk |
| 258 | + */ |
| 259 | + Nic associateNetworkToNic(AssociateNetworkToNicCmd cmd) |
| 260 | + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, InsufficientAddressCapacityException; |
| 261 | + |
| 262 | + /** |
| 263 | + * Disassociates a network from an existing nic, shrinking its multi-VLAN trunk. The primary network cannot be disassociated. |
| 264 | + */ |
| 265 | + Nic disassociateNetworkFromNic(DisassociateNetworkFromNicCmd cmd) throws ResourceUnavailableException; |
| 266 | + |
| 267 | + /** |
| 268 | + * Changes a multi-VLAN trunk nic's primary network to one of its already-associated networks. Only allowed while |
| 269 | + * the owning Instance is stopped, since the nic is rebuilt fresh on its next start. |
| 270 | + */ |
| 271 | + Nic changeNicPrimaryNetwork(ChangeNicPrimaryNetworkCmd cmd); |
| 272 | + |
| 273 | + /** |
| 274 | + * Associates additional networks with a nic that was just created (e.g. during VM deploy), before the owning |
| 275 | + * Instance has ever started. No live agent update is issued - the nic's first plug already reads these |
| 276 | + * associations fresh. requestedIps (nullable) optionally requests a specific ip4/ip6 address per associated |
| 277 | + * network id - a network with no entry (or a null map) auto-allocates, same as today. |
| 278 | + */ |
| 279 | + void associateNetworksToNic(Nic nic, List<Long> networkIds, Map<Long, IpAddresses> requestedIps) |
| 280 | + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, InsufficientAddressCapacityException; |
| 281 | + |
252 | 282 | AcquirePodIpCmdResponse allocatePodIp(Account account, String zoneId, String podId) throws ResourceAllocationException, ConcurrentOperationException; |
253 | 283 |
|
254 | 284 | boolean releasePodIp(ReleasePodIpCmdByAdmin ip) throws CloudRuntimeException; |
@@ -281,4 +311,10 @@ Network createPrivateNetwork(String networkName, String displayText, long physic |
281 | 311 | String getNicVlanValueForExternalVm(NicTO nic); |
282 | 312 |
|
283 | 313 | Long getPreferredNetworkIdForPublicIpRuleAssignment(IpAddress ip, Long networkId); |
| 314 | + |
| 315 | + // Re-applies each nic's VLAN membership on the host of a Running Instance, e.g. after a memory revert recreates its taps. |
| 316 | + void reapplyLiveVlanMembership(VirtualMachine vm) throws ResourceUnavailableException; |
| 317 | + |
| 318 | + // Pushes a migrated network's new VLAN and DHCP entries to the Running Instances that carry it as a trunk nic association. |
| 319 | + void refreshTrunkNicsAssociatedToNetwork(Network network); |
284 | 320 | } |
0 commit comments