@@ -5397,10 +5397,11 @@ public Vlan dedicatePublicIpRange(final DedicatePublicIpRangeCmd cmd) throws Res
53975397
53985398 // Check if any of the Public IP addresses is allocated to another
53995399 // account
5400- boolean forSystemVms = false ;
54015400 final List <IPAddressVO > ips = _publicIpAddressDao .listByVlanId (vlanDbId );
54025401 for (final IPAddressVO ip : ips ) {
5403- forSystemVms = ip .isForSystemVms ();
5402+ if (ip .isForSystemVms ()) {
5403+ throw new InvalidParameterValueException (ip .getAddress () + " Public IP address in range is dedicated to system vms " );
5404+ }
54045405 final Long allocatedToAccountId = ip .getAllocatedToAccountId ();
54055406 if (allocatedToAccountId != null ) {
54065407 if (vlanOwner != null && allocatedToAccountId != vlanOwner .getId ()) {
@@ -5425,7 +5426,7 @@ public Vlan dedicatePublicIpRange(final DedicatePublicIpRangeCmd cmd) throws Res
54255426 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_NET_IP_ASSIGN , vlanOwner .getId (), ip .getDataCenterId (), ip .getId (), ip .getAddress ().toString (), ip .isSourceNat (),
54265427 vlan .getVlanType ().toString (), ip .getSystem (), usageHidden , ip .getClass ().getName (), ip .getUuid ());
54275428 }
5428- } else if (domain != null && ! forSystemVms ) {
5429+ } else if (domain != null ) {
54295430 // Create an DomainVlanMapVO entry
54305431 DomainVlanMapVO domainVlanMapVO = new DomainVlanMapVO (domain .getId (), vlan .getId ());
54315432 _domainVlanMapDao .persist (domainVlanMapVO );
@@ -7250,7 +7251,6 @@ public Account getVlanAccount(final long vlanId) {
72507251 @ Override
72517252 public Domain getVlanDomain (long vlanId ) {
72527253 Vlan vlan = _vlanDao .findById (vlanId );
7253- Long domainId = null ;
72547254
72557255 // if vlan is Virtual Domain specific, get vlan information from the
72567256 // accountVlanMap; otherwise get account information
0 commit comments