1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

F #5027: Adds support for ipv6 addresses in several commands of onevnet.

Fix bugs
This commit is contained in:
Ruben S. Montero 2017-02-22 15:30:22 +01:00
parent faf2c6f3b8
commit a78630ded3
4 changed files with 23 additions and 9 deletions

View File

@ -48,6 +48,14 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
:description => "First IP address in . notation"
}
IP6 = {
:name => "ip6",
:short => "-6 ip6",
:large => "--ip6 ip6",
:format => String,
:description => "First IPv6 address in : notation"
}
SIZE = {
:name => "size",
:short => "-s size",
@ -117,7 +125,8 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
]
ADDAR_OPTIONS = [
SIZE, MAC, IP, IP6_GLOBAL, IP6_ULA, GATEWAY, NETMASK, VN_MAD, VLAN_ID ]
SIZE, MAC, IP, IP6, IP6_GLOBAL, IP6_ULA, GATEWAY, NETMASK, VN_MAD,
VLAN_ID ]
def self.rname
"VNET"

View File

@ -123,15 +123,17 @@ cmd=CommandParser::CmdParser.new(ARGV) do
if options[:ip]
if options[:ip6_global] || options[:ip6_ula]
ar << "TYPE=\"IP4_6\""
elsif options[:ip6]
ar << "TYPE=\"IP4_6_STATIC\""
else
ar << "TYPE=\"IP4\""
end
elsif options[:ip6]
ar << "TYPE=\"IP6_STATIC\""
elsif options[:ip6_global] || options[:ip6_ula]
ar << "TYPE=\"IP6\""
else
if options[:ip6_global] || options[:ip6_ula]
ar << "TYPE=\"IP6\""
else
ar << "TYPE=\"ETHER\""
end
ar << "TYPE=\"ETHER\""
end
if options[:size]
@ -142,6 +144,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
ar << ", IP = " << options[:ip] if options[:ip]
ar << ", IP6 = " << options[:ip6] if options[:ip6]
ar << ", MAC = " << options[:mac] if options[:mac]
ar << ", GLOBAL_PREFIX = " <<
options[:ip6_global] if options[:ip6_global]
@ -234,7 +237,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :reserve, reserve_desc, :vnetid, [:vnetid, nil],
:options=>STD_OPTIONS + [OneVNetHelper::AR, OneVNetHelper::NAME,
OneVNetHelper::SIZE, OneVNetHelper::MAC, OneVNetHelper::IP] do
OneVNetHelper::SIZE, OneVNetHelper::MAC, OneVNetHelper::IP,
OneVNetHelper::IP6 ] do
helper.perform_action(args[0],options,"reservation made") do |vn|
size = options[:size] || -1
name = options[:name] || -1
@ -242,6 +246,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
addr = nil
addr = options[:mac] if options[:mac]
addr = options[:ip] if options[:ip]
addr = options[:ip6] if options[:ip6]
if size == -1
STDERR.puts "Specify a size (-s size) for the reservation"

View File

@ -426,7 +426,7 @@ void VirtualNetworkReserve::request_execute(
rc = vnpool->reserve_addr_by_ip(id, rid, size, ar_id, ip,
att.resp_msg);
}
if (!ip6.empty())
else if (!ip6.empty())
{
rc = vnpool->reserve_addr_by_ip6(id, rid, size, ar_id, ip6,
att.resp_msg);

View File

@ -1562,7 +1562,7 @@ int AddressRange::free_addr_by_ip6(PoolObjectSQL::ObjectType ot, int obid,
{
string error_msg;
if (!is_ipv6())
if (!is_ipv6_static())
{
return -1;
}