added warning when size of subnet(s) being created are larger than FLAG.network_size in attempt to alleviate confusion. For example, currently when 'nova-manage network create foo 192.168.0.0/16', the result is that it creates a 192.168.0.0/24 instead without any indication to why.
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
import gettext
|
||||
import glob
|
||||
import json
|
||||
import math
|
||||
import netaddr
|
||||
import os
|
||||
import sys
|
||||
@@ -669,6 +670,14 @@ class NetworkCommands(object):
|
||||
num_networks = FLAGS.num_networks
|
||||
if not network_size:
|
||||
network_size = FLAGS.network_size
|
||||
fixnet = netaddr.IPNetwork(fixed_range)
|
||||
each_subnet_size = fixnet.size / int(num_networks)
|
||||
if each_subnet_size > network_size:
|
||||
subnet = 32 - int(math.log(network_size, 2))
|
||||
oversize_msg = _('Subnet(s) too large, defaulting to /%s.'
|
||||
' To override, specify network_size flag.'
|
||||
% subnet)
|
||||
print oversize_msg
|
||||
if not multi_host:
|
||||
multi_host = FLAGS.multi_host
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user