From 6c71e033ae9858b302a4b302a147a02b93bed212 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Wed, 11 Mar 2015 11:38:13 +0100 Subject: [PATCH 01/13] fix schema and tests to use OVS bridges --- ncm-opennebula/src/main/pan/components/opennebula/schema.pan | 2 +- ncm-opennebula/src/main/resources/oned.tt | 2 +- .../src/main/resources/tests/regexps/oned/oned_template | 1 + ncm-opennebula/src/main/resources/tests/regexps/oned/simple | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index 4cd4cb143d..4ba13ccede 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -207,7 +207,7 @@ type opennebula_oned = { "image_restricted_attr" : string = 'SOURCE' "inherit_datastore_attr" : string[] = list("CEPH_HOST", "CEPH_SECRET", "CEPH_USER", "RBD_FORMAT", "GLUSTER_HOST", "GLUSTER_VOLUME") - "inherit_vnet_attr" : string = 'VLAN_TAGGED_ID' + "inherit_vnet_attr" : string[] = list("VLAN_TAGGED_ID", "BRIDGE_OVS") }; @{ diff --git a/ncm-opennebula/src/main/resources/oned.tt b/ncm-opennebula/src/main/resources/oned.tt index 2116b8f252..918271fd63 100644 --- a/ncm-opennebula/src/main/resources/oned.tt +++ b/ncm-opennebula/src/main/resources/oned.tt @@ -3,7 +3,7 @@ [%- digits = ['monitoring_interval', 'monitoring_threads', 'port', 'vnc_base_port', 'network_size', 'session_expiration_time', 'default_umask'] -%] -[%- oned_attr_list = ['vm_restricted_attr', 'inherit_datastore_attr'] -%] +[%- oned_attr_list = ['vm_restricted_attr', 'inherit_datastore_attr', 'inherit_vnet_attr'] -%] [%- FOR pair IN oned.pairs -%] [%- SWITCH pair.key -%] [% CASE oned_section -%] diff --git a/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template b/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template index 38e70faf8b..586ac4447f 100644 --- a/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template +++ b/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template @@ -54,6 +54,7 @@ multiline ^INHERIT_DATASTORE_ATTR\s?=\s?"GLUSTER_HOST"$ ^INHERIT_DATASTORE_ATTR\s?=\s?"GLUSTER_VOLUME"$ ^INHERIT_VNET_ATTR\s?=\s?"VLAN_TAGGED_ID"$ +^INHERIT_VNET_ATTR\s?=\s?"BRIDGE_OVS"$ ^LOG\s?=\s?\[$ ^\s{4}debug_level\s?=\s?3,$ ^\s{4}system\s?=\s?"file"$ diff --git a/ncm-opennebula/src/main/resources/tests/regexps/oned/simple b/ncm-opennebula/src/main/resources/tests/regexps/oned/simple index ba11bb0a92..9247d8be2e 100644 --- a/ncm-opennebula/src/main/resources/tests/regexps/oned/simple +++ b/ncm-opennebula/src/main/resources/tests/regexps/oned/simple @@ -16,6 +16,7 @@ multiline ^DEFAULT_UMASK\s?=\s*\d+\s*$ ^IMAGE_RESTRICTED_ATTR\s?=\s?".+"\s*$ ^INHERIT_DATASTORE_ATTR\s?=\s?".+"\s*$ +^INHERIT_VNET_ATTR\s?=\s?".+"\s*$ ^LOG\s?=\s?\[$ ^\s*debug_level\s?=\s*\d+,\s*$ ^\s*system\s?=\s*".+"\s*$ From 6aa691faa3b76a84f0668817056aba849f4eafda Mon Sep 17 00:00:00 2001 From: lsimngar Date: Fri, 27 Mar 2015 14:34:06 +0100 Subject: [PATCH 02/13] included Open vSwitch support --- .../main/pan/components/opennebula/schema.pan | 2 ++ .../main/pan/components/opennebula/sudo.pan | 6 ++++- ncm-opennebula/src/main/perl/opennebula.pm | 17 ++++++++++++-- ncm-opennebula/src/main/perl/opennebula.pod | 22 +++++++++++++++++++ ncm-opennebula/src/test/perl/rpcdata.pm | 18 +++++++-------- ncm-opennebula/src/test/resources/one.pan | 2 ++ 6 files changed, 55 insertions(+), 12 deletions(-) diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index 4ba13ccede..3c9c02e710 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -247,6 +247,8 @@ type component_opennebula = { 'untouchables' : opennebula_untouchables 'oned' : opennebula_oned 'ssh_multiplex' : boolean = true + 'host_ovs' ? boolean + 'host_hyp' : string = 'kvm' with match (SELF, '^(kvm|xen)$') 'tm_system_ds' ? string with match(SELF, "^(shared|ssh|vmfs)$") } = nlist(); diff --git a/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan b/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan index 4146b85fcc..0e833a7d4a 100644 --- a/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan @@ -18,7 +18,11 @@ include 'components/sudo/config'; "/sbin/service libvirtd restart", "/sbin/service libvirt-guests restart", '/usr/bin/virsh secret-set-value *', - '/usr/bin/virsh secret-define *' + '/usr/bin/virsh secret-define *', + '/usr/sbin/iptables', + '/usr/sbin/ebtables', + '/usr/bin/ovs-vsctl', + '/usr/bin/ovs-ofctl' ); foreach (i; cmd; sudolist){ nl = nlist("host", "ALL", diff --git a/ncm-opennebula/src/main/perl/opennebula.pm b/ncm-opennebula/src/main/perl/opennebula.pm index 4e52fdbf73..5d954ec245 100755 --- a/ncm-opennebula/src/main/perl/opennebula.pm +++ b/ncm-opennebula/src/main/perl/opennebula.pm @@ -361,11 +361,22 @@ sub manage_something sub manage_hosts { my ($self, $one, $type, $resources, %protected) = @_; - my $new; + my ($new, $vnm_mad); my $hosts = $resources->{hosts}; my @existhost = $one->get_hosts(); my %newhosts = map { $_ => 1 } @$hosts; my (@rmhosts, @failedhost); + + if (exists($resources->{host_ovs}) and $resources->{host_ovs}) { + if ($type eq "kvm") { + $vnm_mad = "ovswitch"; + } elsif ($type eq "xen") { + $vnm_mad = "ovswitch_brcompat"; + } + } else { + $vnm_mad = "dummy"; + } + foreach my $t (@existhost) { # Remove the host only if there are no VMs running on it if (exists($protected{$t->name})) { @@ -586,6 +597,8 @@ sub Configure my $tm_system_ds = $tree->{tm_system_ds}; # untouchables resources my $untouchables = $tree->{untouchables}; + # hypervisor type + my $hypervisor = $tree->{host_hyp}; # We must change oneadmin pass first if (exists $tree->{rpc}->{password}) { @@ -617,7 +630,7 @@ sub Configure $self->info("Updated system datastore TM_MAD = $tm_system_ds"); } - my $hypervisor = "kvm"; + #my $hypervisor = "kvm"; $self->manage_something($one, $hypervisor, $tree, $untouchables->{hosts}); $self->manage_something($one, "user", $tree->{users}, $untouchables->{users}); diff --git a/ncm-opennebula/src/main/perl/opennebula.pod b/ncm-opennebula/src/main/perl/opennebula.pod index e4759df78b..0d2d1fb361 100755 --- a/ncm-opennebula/src/main/perl/opennebula.pod +++ b/ncm-opennebula/src/main/perl/opennebula.pod @@ -77,6 +77,28 @@ be described in this section. Set ssh multiplex options +=item * host_hyp : string + +Set host hypervisor type + +=over 5 + +=item * kvm + +Set KVM hypervisor + +=item * xen + +Set XEN hypervisor + +=back + +=item * host_ovs : boolean (optional) + +Includes the Open vSwitch network drives in your hypervisors. (OVS must be installed in each host) +Open vSwitch replaces Linux bridges, Linux bridges must be disabled. +More info: http://docs.opennebula.org/4.4/administration/networking/openvswitch.html + =item * tm_system_ds : string (optional) Set system datastore TM_MAD value (shared by default). Valid values: diff --git a/ncm-opennebula/src/test/perl/rpcdata.pm b/ncm-opennebula/src/test/perl/rpcdata.pm index 4e2ea7f63f..69e6652e8a 100644 --- a/ncm-opennebula/src/test/perl/rpcdata.pm +++ b/ncm-opennebula/src/test/perl/rpcdata.pm @@ -227,19 +227,19 @@ $cmds{rpc_update_datastore}{out} = 102; # Manage hosts -$cmds{rpc_create_newhost}{params} = ["hyp101", "kvm", "kvm", "dummy", -1]; +$cmds{rpc_create_newhost}{params} = ["hyp101", "kvm", "kvm", "ovswitch", -1]; $cmds{rpc_create_newhost}{method} = "one.host.allocate"; $cmds{rpc_create_newhost}{out} = 1; -$cmds{rpc_create_newhost2}{params} = ["hyp102", "kvm", "kvm", "dummy", -1]; +$cmds{rpc_create_newhost2}{params} = ["hyp102", "kvm", "kvm", "ovswitch", -1]; $cmds{rpc_create_newhost2}{method} = "one.host.allocate"; $cmds{rpc_create_newhost2}{out} = 167; -$cmds{rpc_create_newhost3}{params} = ["hyp103", "kvm", "kvm", "dummy", -1]; +$cmds{rpc_create_newhost3}{params} = ["hyp103", "kvm", "kvm", "ovswitch", -1]; $cmds{rpc_create_newhost3}{method} = "one.host.allocate"; $cmds{rpc_create_newhost3}{out} = 168; -$cmds{rpc_create_newhost4}{params} = ["hyp104", "kvm", "kvm", "dummy", -1]; +$cmds{rpc_create_newhost4}{params} = ["hyp104", "kvm", "kvm", "ovswitch", -1]; $cmds{rpc_create_newhost4}{method} = "one.host.allocate"; $cmds{rpc_create_newhost4}{out} = 169; @@ -274,32 +274,32 @@ $cmds{rpc_enable_host3}{out} = 168; $cmds{rpc_list_hostspool}{params} = []; $cmds{rpc_list_hostspool}{method} = "one.hostpool.info"; $cmds{rpc_list_hostspool}{out} = <<'EOF'; -1hyp10121410339181-105242881001175291643399680010930314898328793115356686155167hyp10221410339186-10001175291643399680010923215789528800164446800168hyp10331410339177-10000000000000 +1hyp10121410339181-105242881001175291643399680010930314898328793115356686155167hyp10221410339186-10001175291643399680010923215789528800164446800168hyp10331410339177-10000000000000 EOF $cmds{rpc_list_host}{params} = [1]; $cmds{rpc_list_host}{method} = "one.host.info"; $cmds{rpc_list_host}{out} = <<'EOF'; -1hyp10121410339181-105242881001175291643399680010930314898328793115356686155 +1hyp10121410339181-105242881001175291643399680010930314898328793115356686155 EOF $cmds{rpc_list_host2}{params} = [167]; $cmds{rpc_list_host2}{method} = "one.host.info"; $cmds{rpc_list_host2}{out} = <<'EOF'; -167hyp10221410433302-10001175291643399680010921915779876798165412010 +167hyp10221410433302-10001175291643399680010921915779876798165412010 EOF $cmds{rpc_list_host3}{params} = [168]; $cmds{rpc_list_host3}{method} = "one.host.info"; $cmds{rpc_list_host3}{out} = <<'EOF'; -168hyp10351410433305-10000000000000 +168hyp10351410433305-10000000000000 EOF $cmds{rpc_list_host4}{params} = [169]; $cmds{rpc_list_host4}{method} = "one.host.info"; $cmds{rpc_list_host4}{out} = <<'EOF'; -169hyp10451410433305-10000000000000 +169hyp10451410433305-10000000000000 EOF # Manage VMs diff --git a/ncm-opennebula/src/test/resources/one.pan b/ncm-opennebula/src/test/resources/one.pan index 4898cf7880..5c786eb071 100644 --- a/ncm-opennebula/src/test/resources/one.pan +++ b/ncm-opennebula/src/test/resources/one.pan @@ -75,4 +75,6 @@ prefix "/software/components/opennebula"; ); "ssh_multiplex" = true; +"host_hyp" = "kvm"; +"host_ovs" = true; "tm_system_ds" = "ssh"; \ No newline at end of file From d0b79ac25334ce2670142d548bdf42efb10d428b Mon Sep 17 00:00:00 2001 From: lsimngar Date: Fri, 27 Mar 2015 14:51:06 +0100 Subject: [PATCH 03/13] set vnm_mad value --- ncm-opennebula/src/main/perl/opennebula.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncm-opennebula/src/main/perl/opennebula.pm b/ncm-opennebula/src/main/perl/opennebula.pm index 5d954ec245..cb9979e62a 100755 --- a/ncm-opennebula/src/main/perl/opennebula.pm +++ b/ncm-opennebula/src/main/perl/opennebula.pm @@ -400,7 +400,7 @@ sub manage_hosts 'name' => $host, 'im_mad' => $type, 'vmm_mad' => $type, - 'vnm_mad' => "dummy" + 'vnm_mad' => $vnm_mad ); # to keep the record of our cloud infrastructure # we include the host in ONE db even if it fails From e68ef2c1093a82c9b058263d6dcc54ca5e0633a1 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Thu, 2 Apr 2015 15:02:02 +0200 Subject: [PATCH 04/13] Included vnet AR option --- .../main/pan/components/opennebula/schema.pan | 19 +++++++++++++++- ncm-opennebula/src/main/perl/opennebula.pm | 1 - .../resources/tests/profiles/vnet_br100.pan | 1 - .../resources/tests/profiles/vnet_br101.pan | 1 - .../resources/tests/profiles/vnet_ovsbr0.pan | 22 +++++++++++++++++++ .../resources/tests/regexps/vnet_br100/simple | 1 - .../resources/tests/regexps/vnet_br101/simple | 1 - .../tests/regexps/vnet_ovsbr0/simple | 18 +++++++++++++++ ncm-opennebula/src/main/resources/vnet.tt | 14 ++++++++++-- ncm-opennebula/src/test/perl/rpcdata.pm | 20 +++++++++++++++++ ncm-opennebula/src/test/resources/one.pan | 17 ++++++++++++-- 11 files changed, 105 insertions(+), 10 deletions(-) create mode 100644 ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan create mode 100644 ncm-opennebula/src/main/resources/tests/regexps/vnet_ovsbr0/simple diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index 3c9c02e710..ea186ca8ec 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -9,6 +9,7 @@ include 'quattor/schema'; include 'pan/types'; type uuid = string with match(SELF,'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'); +type macaddr = string with match(SELF, '([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'); type directory = string with match(SELF,'[^/]+/?$'); @@ -133,6 +134,19 @@ type opennebula_ceph_datastore = { "rbd_format" ? long(1..2) }; +@{ +type for vnet ars specific attributes. +type and size are mandatory +@} +type opennebula_ar = { + "type" : string with match(SELF, "^(IP4|IP6|IP4_6|ETHER)$") + "ip" ? type_ipv4 + "size" : long (1..) + "mac" ? macaddr + "global_prefix" ? string + "ula_prefix" ? string +}; + @{ type for an opennebula datastore. Defaults to a ceph datastore (ds_mad is ceph) @} type opennebula_datastore = { include opennebula_ceph_datastore @@ -147,11 +161,14 @@ type opennebula_datastore = { type opennebula_vnet = { "name" : string - "type" : string = 'FIXED' "bridge" : string "gateway" : type_ipv4 "dns" : type_ipv4 "network_mask" : type_ipv4 + "bridge_ovs" ? string + "vlan" ? boolean + "vlan_id" ? long(0..4095) + "ar" ? opennebula_ar }; type opennebula_user = { diff --git a/ncm-opennebula/src/main/perl/opennebula.pm b/ncm-opennebula/src/main/perl/opennebula.pm index cb9979e62a..7189223194 100755 --- a/ncm-opennebula/src/main/perl/opennebula.pm +++ b/ncm-opennebula/src/main/perl/opennebula.pm @@ -630,7 +630,6 @@ sub Configure $self->info("Updated system datastore TM_MAD = $tm_system_ds"); } - #my $hypervisor = "kvm"; $self->manage_something($one, $hypervisor, $tree, $untouchables->{hosts}); $self->manage_something($one, "user", $tree->{users}, $untouchables->{users}); diff --git a/ncm-opennebula/src/main/resources/tests/profiles/vnet_br100.pan b/ncm-opennebula/src/main/resources/tests/profiles/vnet_br100.pan index 815eb2e883..8e397dc467 100644 --- a/ncm-opennebula/src/main/resources/tests/profiles/vnet_br100.pan +++ b/ncm-opennebula/src/main/resources/tests/profiles/vnet_br100.pan @@ -8,7 +8,6 @@ bind "/metaconfig/contents/vnet" = opennebula_vnet; prefix "/metaconfig/contents/vnet"; "name" = "node.cubone.os"; -"type" = "FIXED"; "bridge" = "br100"; "gateway" = "10.141.10.250"; "dns" = "10.141.10.250"; diff --git a/ncm-opennebula/src/main/resources/tests/profiles/vnet_br101.pan b/ncm-opennebula/src/main/resources/tests/profiles/vnet_br101.pan index d9cd4c19e4..129de13390 100644 --- a/ncm-opennebula/src/main/resources/tests/profiles/vnet_br101.pan +++ b/ncm-opennebula/src/main/resources/tests/profiles/vnet_br101.pan @@ -8,7 +8,6 @@ bind "/metaconfig/contents/vnet" = opennebula_vnet; prefix "/metaconfig/contents/vnet"; "name" = "node2.cubone.os"; -"type" = "FIXED"; "bridge" = "br101"; "gateway" = "10.141.10.250"; "dns" = "10.141.10.250"; diff --git a/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan b/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan new file mode 100644 index 0000000000..b0ac47c17b --- /dev/null +++ b/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan @@ -0,0 +1,22 @@ +object template vnet_ovsbr0; + +include 'components/opennebula/schema'; + +bind "/metaconfig/contents/vnet" = opennebula_vnet; + +"/metaconfig/module" = "vnet"; + +prefix "/metaconfig/contents/vnet"; +"name" = "node3.cubone.os"; +"bridge" = "br100"; +"bridge_ovs" = "ovsbr0"; +"gateway" = "10.141.3.250"; +"dns" = "10.141.3.250"; +"network_mask" = "255.255.0.0"; +"vlan" = true; +"vlan_id" = 0; +"ar" = nlist( + "type", "IP4", + "ip", "10.141.14.100", + "size", 29, +); diff --git a/ncm-opennebula/src/main/resources/tests/regexps/vnet_br100/simple b/ncm-opennebula/src/main/resources/tests/regexps/vnet_br100/simple index 7cfd67dfe2..0a1d8e74a4 100644 --- a/ncm-opennebula/src/main/resources/tests/regexps/vnet_br100/simple +++ b/ncm-opennebula/src/main/resources/tests/regexps/vnet_br100/simple @@ -7,5 +7,4 @@ multiline ^GATEWAY\s?=\s?".+"\s*$ ^NAME\s?=\s?".+"\s*$ ^NETWORK_MASK\s?=\s?".+"\s*$ -^TYPE\s?=\s?".+"\s*$ ^QUATTOR\s?=\s?\d+\s*$ diff --git a/ncm-opennebula/src/main/resources/tests/regexps/vnet_br101/simple b/ncm-opennebula/src/main/resources/tests/regexps/vnet_br101/simple index 7cfd67dfe2..0a1d8e74a4 100644 --- a/ncm-opennebula/src/main/resources/tests/regexps/vnet_br101/simple +++ b/ncm-opennebula/src/main/resources/tests/regexps/vnet_br101/simple @@ -7,5 +7,4 @@ multiline ^GATEWAY\s?=\s?".+"\s*$ ^NAME\s?=\s?".+"\s*$ ^NETWORK_MASK\s?=\s?".+"\s*$ -^TYPE\s?=\s?".+"\s*$ ^QUATTOR\s?=\s?\d+\s*$ diff --git a/ncm-opennebula/src/main/resources/tests/regexps/vnet_ovsbr0/simple b/ncm-opennebula/src/main/resources/tests/regexps/vnet_ovsbr0/simple new file mode 100644 index 0000000000..8aa391182a --- /dev/null +++ b/ncm-opennebula/src/main/resources/tests/regexps/vnet_ovsbr0/simple @@ -0,0 +1,18 @@ +Opennebular vnet test +--- +multiline +--- +^AR\s?=\s?\[$ +^\s*ip\s?=\s*".+",\s*$ +^\s*size\s?=\s*".+",\s*$ +^\s*type\s?=\s*".+"\s*$ +^\]$ +^BRIDGE\s?=\s?".+"\s*$ +^BRIDGE_OVS\s?=\s?".+"\s*$ +^DNS\s?=\s?".+"\s*$ +^GATEWAY\s?=\s?".+"\s*$ +^NAME\s?=\s?".+"\s*$ +^NETWORK_MASK\s?=\s?".+"\s*$ +^VLAN\s?=\s?".+"\s*$ +^VLAN_ID\s?=\s?".+"\s*$ +^QUATTOR\s?=\s?\d+\s*$ diff --git a/ncm-opennebula/src/main/resources/vnet.tt b/ncm-opennebula/src/main/resources/vnet.tt index 72bb28f632..9de1a19bae 100644 --- a/ncm-opennebula/src/main/resources/vnet.tt +++ b/ncm-opennebula/src/main/resources/vnet.tt @@ -1,4 +1,14 @@ +[%- booleans = ['vlan'] -%] +[%- ar_section = ['ar'] -%] [% FOR pair IN vnet.pairs -%] -[% pair.key.upper %] = "[% pair.value %]" -[% END -%] +[%- SWITCH pair.key -%] +[% CASE booleans -%] +[% pair.key.upper %] = "[% pair.value ? "YES" : "NO" %]" +[% CASE ar_section -%] +[% pair.key.upper %] = [% INCLUDE 'opennebula/oned_level1.tt' + data=vnet.${pair.key} -%] +[% CASE -%] +[% pair.key.upper %] = "[% pair.value %]" +[% END -%] +[%- END -%] QUATTOR = 1 diff --git a/ncm-opennebula/src/test/perl/rpcdata.pm b/ncm-opennebula/src/test/perl/rpcdata.pm index 69e6652e8a..1aeb76b2d0 100644 --- a/ncm-opennebula/src/test/perl/rpcdata.pm +++ b/ncm-opennebula/src/test/perl/rpcdata.pm @@ -110,6 +110,22 @@ $cmds{rpc_create_newvnet2}{params} = [$data, -1]; $cmds{rpc_create_newvnet2}{method} = "one.vn.allocate"; $cmds{rpc_create_newvnet2}{out} = 88; +$data = <<'EOF'; +BRIDGE = "br100" +BRIDGE_OVS = "ovsbr0" +DNS = "10.141.3.250" +GATEWAY = "10.141.3.250" +NAME = "pool.altaria.os" +NETWORK_MASK = "255.255.0.0" +TYPE = "IP4" +VLAN = "YES" +VLAN_ID = "0" +QUATTOR = 1 +EOF +$cmds{rpc_create_newvnet2}{params} = [$data, -1]; +$cmds{rpc_create_newvnet2}{method} = "one.vn.allocate"; +$cmds{rpc_create_newvnet2}{out} = 98; + $cmds{rpc_delete_vnet}{params} = [68]; $cmds{rpc_delete_vnet}{method} = "one.vn.delete"; $cmds{rpc_delete_vnet}{out} = 68; @@ -118,6 +134,10 @@ $cmds{rpc_delete_vnet2}{params} = [88]; $cmds{rpc_delete_vnet2}{method} = "one.vn.delete"; $cmds{rpc_delete_vnet2}{out} = 88; +$cmds{rpc_delete_vnet2}{params} = [98]; +$cmds{rpc_delete_vnet2}{method} = "one.vn.delete"; +$cmds{rpc_delete_vnet2}{out} = 98; + $cmds{rpc_list_vnetspool}{params} = [-2, -1, -1]; $cmds{rpc_list_vnetspool}{method} = "one.vnpool.info"; $cmds{rpc_list_vnetspool}{out} = <<'EOF'; diff --git a/ncm-opennebula/src/test/resources/one.pan b/ncm-opennebula/src/test/resources/one.pan index 5c786eb071..260699deb8 100644 --- a/ncm-opennebula/src/test/resources/one.pan +++ b/ncm-opennebula/src/test/resources/one.pan @@ -26,7 +26,6 @@ prefix "/software/components/opennebula"; "vnets" = list( nlist( "name", "altaria.os", - "type", "FIXED", "bridge", "br100", "gateway", "10.141.3.250", "dns", "10.141.3.250", @@ -34,12 +33,26 @@ prefix "/software/components/opennebula"; ), nlist( "name", "altaria.vsc", - "type", "FIXED", "bridge", "br101", "gateway", "10.141.3.250", "dns", "10.141.3.250", "network_mask", "255.255.0.0" ), + nlist( + "name", "pool.altaria.os", + "bridge", "br100", + "bridge_ovs", "ovsbr0", + "gateway", "10.141.3.250", + "dns", "10.141.3.250", + "network_mask", "255.255.0.0", + "vlan", true, + "vlan_id", 0, + "ar", nlist( + "type", "IP4", + "ip", "10.141.14.100", + "size", 29 + ), + ), ); "datastores" = list( From 859293680710bfe7566d61b1dae8fb3bcb5f2b0b Mon Sep 17 00:00:00 2001 From: lsimngar Date: Thu, 2 Apr 2015 15:33:05 +0200 Subject: [PATCH 05/13] rpc data updated with new examples --- ncm-opennebula/src/test/perl/rpcdata.pm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/ncm-opennebula/src/test/perl/rpcdata.pm b/ncm-opennebula/src/test/perl/rpcdata.pm index 1aeb76b2d0..d52fe9a22e 100644 --- a/ncm-opennebula/src/test/perl/rpcdata.pm +++ b/ncm-opennebula/src/test/perl/rpcdata.pm @@ -111,20 +111,24 @@ $cmds{rpc_create_newvnet2}{method} = "one.vn.allocate"; $cmds{rpc_create_newvnet2}{out} = 88; $data = <<'EOF'; +AR = [ + ip = "10.141.14.100", + size = "29", + type = "IP4" +] BRIDGE = "br100" BRIDGE_OVS = "ovsbr0" DNS = "10.141.3.250" GATEWAY = "10.141.3.250" NAME = "pool.altaria.os" NETWORK_MASK = "255.255.0.0" -TYPE = "IP4" VLAN = "YES" VLAN_ID = "0" QUATTOR = 1 EOF -$cmds{rpc_create_newvnet2}{params} = [$data, -1]; -$cmds{rpc_create_newvnet2}{method} = "one.vn.allocate"; -$cmds{rpc_create_newvnet2}{out} = 98; +$cmds{rpc_create_newvnet3}{params} = [$data, -1]; +$cmds{rpc_create_newvnet3}{method} = "one.vn.allocate"; +$cmds{rpc_create_newvnet3}{out} = 98; $cmds{rpc_delete_vnet}{params} = [68]; $cmds{rpc_delete_vnet}{method} = "one.vn.delete"; @@ -134,9 +138,9 @@ $cmds{rpc_delete_vnet2}{params} = [88]; $cmds{rpc_delete_vnet2}{method} = "one.vn.delete"; $cmds{rpc_delete_vnet2}{out} = 88; -$cmds{rpc_delete_vnet2}{params} = [98]; -$cmds{rpc_delete_vnet2}{method} = "one.vn.delete"; -$cmds{rpc_delete_vnet2}{out} = 98; +$cmds{rpc_delete_vnet3}{params} = [98]; +$cmds{rpc_delete_vnet3}{method} = "one.vn.delete"; +$cmds{rpc_delete_vnet3}{out} = 98; $cmds{rpc_list_vnetspool}{params} = [-2, -1, -1]; $cmds{rpc_list_vnetspool}{method} = "one.vnpool.info"; @@ -168,6 +172,12 @@ $cmds{rpc_list_vnet3}{out} = <<'EOF'; 000oneadminoneadminaltaria.vsc110000000-11br1010102:00:0a:8d:08:1e10.141.8.30fe80::400:aff:fe8d:81e155 EOF +$cmds{rpc_list_vnet4}{params} = [98]; +$cmds{rpc_list_vnet4}{method} = "one.vn.info"; +$cmds{rpc_list_vnet4}{out} = <<'EOF'; +9800oneadminoneadminpool.altaria.os110000000-1br100100 +EOF + $data = <<'EOF'; BRIDGE = "br100" DNS = "10.141.3.250" From b62de60c7dddfb56fbd4047452946fae8747827a Mon Sep 17 00:00:00 2001 From: lsimngar Date: Thu, 2 Apr 2015 16:16:12 +0200 Subject: [PATCH 06/13] Included syslog example --- ncm-opennebula/src/main/resources/tests/profiles/oned.pan | 4 ++++ .../src/main/resources/tests/regexps/oned/oned_template | 2 +- ncm-opennebula/src/test/perl/opennebula.t | 2 +- ncm-opennebula/src/test/resources/one.pan | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ncm-opennebula/src/main/resources/tests/profiles/oned.pan b/ncm-opennebula/src/main/resources/tests/profiles/oned.pan index 4e3877e100..23d86db2b9 100644 --- a/ncm-opennebula/src/main/resources/tests/profiles/oned.pan +++ b/ncm-opennebula/src/main/resources/tests/profiles/oned.pan @@ -15,5 +15,9 @@ prefix "/metaconfig/contents/oned"; "passwd", "my-fancy-pass", "db_name", "opennebula", ); +"log" = nlist( + "system", "syslog", + "debug_level", 3, +); "default_device_prefix" = "vd"; "onegate_endpoint" = "http://hyp004.cubone.os:5030"; diff --git a/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template b/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template index 586ac4447f..51003214d1 100644 --- a/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template +++ b/ncm-opennebula/src/main/resources/tests/regexps/oned/oned_template @@ -57,7 +57,7 @@ multiline ^INHERIT_VNET_ATTR\s?=\s?"BRIDGE_OVS"$ ^LOG\s?=\s?\[$ ^\s{4}debug_level\s?=\s?3,$ -^\s{4}system\s?=\s?"file"$ +^\s{4}system\s?=\s?"syslog"$ ^\]$ ^MAC_PREFIX\s?=\s?"02:00"$ ^MONITORING_INTERVAL\s?=\s?60$ diff --git a/ncm-opennebula/src/test/perl/opennebula.t b/ncm-opennebula/src/test/perl/opennebula.t index dbf89be934..4569dcd3bb 100644 --- a/ncm-opennebula/src/test/perl/opennebula.t +++ b/ncm-opennebula/src/test/perl/opennebula.t @@ -37,7 +37,7 @@ is($NCM::Component::opennebula::ONED_CONF_FILE, "/etc/one/oned.conf", "expected my $fh = get_file($NCM::Component::opennebula::ONED_CONF_FILE); isa_ok($fh, "CAF::FileWriter", "oned.conf CAF::FileWriter instance"); -# only test one entry, the remainder is verified with teh TT unittests +# only test one entry, the remainder is verified with the TT unittests like("$fh", qr{^DB\s?=\s?\[$}m, "oned.conf has expected content"); done_testing(); diff --git a/ncm-opennebula/src/test/resources/one.pan b/ncm-opennebula/src/test/resources/one.pan index 260699deb8..5a05b0e68c 100644 --- a/ncm-opennebula/src/test/resources/one.pan +++ b/ncm-opennebula/src/test/resources/one.pan @@ -18,6 +18,10 @@ prefix "/software/components/opennebula/oned"; "passwd", "my-fancy-pass", "db_name", "opennebula", ); +"log" = nlist( + "system", "syslog", + "debug_level", 3, +); "default_device_prefix" = "vd"; "onegate_endpoint" = "http://hyp004.cubone.os:5030"; From fcc5ec644ca6b48e431f97c8c0668dca492e0e73 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Tue, 7 Apr 2015 09:49:07 +0200 Subject: [PATCH 07/13] fix pan annotations --- .../main/pan/components/opennebula/schema.pan | 28 +++++++++++-------- .../main/pan/components/opennebula/sudo.pan | 6 ++-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index ea186ca8ec..138b8c5c3e 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -101,7 +101,9 @@ type opennebula_tm_mad_conf = { "shared" : boolean = true } = nlist(); -@{ check if a specific type of datastore has the right attributes @} +@documentation{ +check if a specific type of datastore has the right attributes +} function is_consistent_datastore = { ds = ARGV[0]; if (ds['ds_mad'] == 'ceph') { @@ -121,10 +123,10 @@ function is_consistent_datastore = { return(true); }; -@{ +@documentation{ type for ceph datastore specific attributes. ceph_host, ceph_secret, ceph_user, ceph_user_key and pool_name are mandatory -@} +} type opennebula_ceph_datastore = { "ceph_host" ? string[] "ceph_secret" ? uuid @@ -134,10 +136,10 @@ type opennebula_ceph_datastore = { "rbd_format" ? long(1..2) }; -@{ +@documentation{ type for vnet ars specific attributes. type and size are mandatory -@} +} type opennebula_ar = { "type" : string with match(SELF, "^(IP4|IP6|IP4_6|ETHER)$") "ip" ? type_ipv4 @@ -147,7 +149,9 @@ type opennebula_ar = { "ula_prefix" ? string }; -@{ type for an opennebula datastore. Defaults to a ceph datastore (ds_mad is ceph) @} +@documentation{ +type for an opennebula datastore. Defaults to a ceph datastore (ds_mad is ceph) +} type opennebula_datastore = { include opennebula_ceph_datastore "name" : string @@ -227,10 +231,10 @@ type opennebula_oned = { "inherit_vnet_attr" : string[] = list("VLAN_TAGGED_ID", "BRIDGE_OVS") }; -@{ +@documentation{ Type that sets the OpenNebula conf to contact to ONE RPC server -@} +} type opennebula_rpc = { "port" : long(0..) = 2633 "host" : string = 'localhost' @@ -238,10 +242,10 @@ type opennebula_rpc = { "password" : string } = nlist(); -@{ +@documentation{ Type that sets the OpenNebula untouchable resources -@} +} type opennebula_untouchables = { "datastores" ? string[] "vnets" ? string[] @@ -250,10 +254,10 @@ type opennebula_untouchables = { }; -@{ +@documentation{ Type to define ONE basic resources datastores, vnets, hosts names, etc -@} +} type component_opennebula = { include structure_component 'datastores' : opennebula_datastore[1..] diff --git a/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan b/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan index 0e833a7d4a..778200f68b 100644 --- a/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan @@ -3,11 +3,11 @@ # ${author-info} # ${build-info} -@{ +@documentation{ sudo template sets the sudoers file. oneadmin user should be able to restart libvirt services and set virsh secret (Ceph) in each hypervisor. -@} +} unique template components/${project.artifactId}/sudo; @@ -22,7 +22,7 @@ include 'components/sudo/config'; '/usr/sbin/iptables', '/usr/sbin/ebtables', '/usr/bin/ovs-vsctl', - '/usr/bin/ovs-ofctl' + '/usr/bin/ovs-ofctl', ); foreach (i; cmd; sudolist){ nl = nlist("host", "ALL", From 0df14c4222785d4b7155ad25f821700427ad5fc4 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Tue, 7 Apr 2015 10:34:23 +0200 Subject: [PATCH 08/13] rpcdata ovs update --- ncm-opennebula/src/test/perl/rpcdata.pm | 2 -- 1 file changed, 2 deletions(-) diff --git a/ncm-opennebula/src/test/perl/rpcdata.pm b/ncm-opennebula/src/test/perl/rpcdata.pm index d52fe9a22e..199a57d693 100644 --- a/ncm-opennebula/src/test/perl/rpcdata.pm +++ b/ncm-opennebula/src/test/perl/rpcdata.pm @@ -90,7 +90,6 @@ DNS = "10.141.3.250" GATEWAY = "10.141.3.250" NAME = "altaria.os" NETWORK_MASK = "255.255.0.0" -TYPE = "FIXED" QUATTOR = 1 EOF $cmds{rpc_create_newvnet}{params} = [$data, -1]; @@ -103,7 +102,6 @@ DNS = "10.141.3.250" GATEWAY = "10.141.3.250" NAME = "altaria.vsc" NETWORK_MASK = "255.255.0.0" -TYPE = "FIXED" QUATTOR = 1 EOF $cmds{rpc_create_newvnet2}{params} = [$data, -1]; From b315433faa573799ad78405e03fcd6ba2bcb4ad4 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Fri, 17 Apr 2015 13:47:19 +0200 Subject: [PATCH 09/13] add missing newline --- ncm-opennebula/src/test/resources/one.pan | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ncm-opennebula/src/test/resources/one.pan b/ncm-opennebula/src/test/resources/one.pan index 5a05b0e68c..9daff060d8 100644 --- a/ncm-opennebula/src/test/resources/one.pan +++ b/ncm-opennebula/src/test/resources/one.pan @@ -94,4 +94,5 @@ prefix "/software/components/opennebula"; "ssh_multiplex" = true; "host_hyp" = "kvm"; "host_ovs" = true; -"tm_system_ds" = "ssh"; \ No newline at end of file +"tm_system_ds" = "ssh"; + From a8bce71ccbf8d9676890000d95ba51ad4887a221 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Mon, 20 Apr 2015 11:00:55 +0200 Subject: [PATCH 10/13] fix pair.key FILTER upper method to work with older perl-Template-Toolkit --- ncm-opennebula/src/main/resources/datastore.tt | 2 +- ncm-opennebula/src/main/resources/oned.tt | 16 ++++++++-------- .../src/main/resources/remoteconf_ceph.tt | 2 +- ncm-opennebula/src/main/resources/user.tt | 2 +- ncm-opennebula/src/main/resources/vnet.tt | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ncm-opennebula/src/main/resources/datastore.tt b/ncm-opennebula/src/main/resources/datastore.tt index e7f8de6932..19db44dda7 100644 --- a/ncm-opennebula/src/main/resources/datastore.tt +++ b/ncm-opennebula/src/main/resources/datastore.tt @@ -7,7 +7,7 @@ [% IF pair.key == 'ceph_user_key' -%] [% -%] [% ELSE -%] -[% pair.key.upper %] = +[% pair.key FILTER upper %] = [%- SWITCH pair.key -%] [% CASE lists -%] "[% pair.value.join(' ') %]" diff --git a/ncm-opennebula/src/main/resources/oned.tt b/ncm-opennebula/src/main/resources/oned.tt index 918271fd63..b7566ee622 100644 --- a/ncm-opennebula/src/main/resources/oned.tt +++ b/ncm-opennebula/src/main/resources/oned.tt @@ -7,32 +7,32 @@ [%- FOR pair IN oned.pairs -%] [%- SWITCH pair.key -%] [% CASE oned_section -%] -[% pair.key.upper %] = [% INCLUDE 'opennebula/oned_level1.tt' +[% pair.key FILTER upper %] = [% INCLUDE 'opennebula/oned_level1.tt' data=oned.${pair.key} -%] [% CASE 'im_mad' -%] [%- FOREACH item IN oned.${pair.key}.pairs -%] -[% pair.key.upper %] = [% INCLUDE 'opennebula/oned_level1.tt' +[% pair.key FILTER upper %] = [% INCLUDE 'opennebula/oned_level1.tt' data=item.value name=item.key -%] [% END -%] [% CASE 'vm_mad' -%] [%- FOREACH item IN oned.${pair.key}.pairs -%] -[% pair.key.upper %] = [% INCLUDE 'opennebula/oned_level1.tt' +[% pair.key FILTER upper %] = [% INCLUDE 'opennebula/oned_level1.tt' data=item.value name=item.key type=item.key -%] [% END -%] [% CASE 'tm_mad_conf' -%] [%- FOREACH item IN oned.${pair.key} -%] -[% pair.key.upper %] = [% INCLUDE 'opennebula/oned_level1.tt' +[% pair.key FILTER upper %] = [% INCLUDE 'opennebula/oned_level1.tt' data=item -%] [% END -%] [% CASE oned_attr_list -%] [%- FOREACH item IN oned.${pair.key} -%] -[% pair.key.upper %] = "[% item %]" +[% pair.key FILTER upper %] = "[% item %]" [% END -%] [% CASE booleans -%] -[% pair.key.upper %] = "[% pair.value ? "yes" : "no" %]" +[% pair.key FILTER upper %] = "[% pair.value ? "yes" : "no" %]" [% CASE digits -%] -[% pair.key.upper %] = [% pair.value %] +[% pair.key FILTER upper %] = [% pair.value %] [% CASE -%] -[% pair.key.upper %] = "[% pair.value %]" +[% pair.key FILTER upper %] = "[% pair.value %]" [% END -%] [%- END -%] diff --git a/ncm-opennebula/src/main/resources/remoteconf_ceph.tt b/ncm-opennebula/src/main/resources/remoteconf_ceph.tt index fe3a5ab0f7..91391139e0 100644 --- a/ncm-opennebula/src/main/resources/remoteconf_ceph.tt +++ b/ncm-opennebula/src/main/resources/remoteconf_ceph.tt @@ -1,3 +1,3 @@ [% FOR pair IN remoteconf_ceph.pairs -%] -[% pair.key.upper %]=[% pair.value %] +[% pair.key FILTER upper %]=[% pair.value %] [% END -%] diff --git a/ncm-opennebula/src/main/resources/user.tt b/ncm-opennebula/src/main/resources/user.tt index 523b6437c9..34b500ebfa 100644 --- a/ncm-opennebula/src/main/resources/user.tt +++ b/ncm-opennebula/src/main/resources/user.tt @@ -1,7 +1,7 @@ [% FOR pair IN user.pairs -%] [%- SWITCH pair.key -%] [% CASE 'ssh_public_key' -%] -[% pair.key.upper %] = "[% pair.value %]" +[% pair.key FILTER upper %] = "[% pair.value %]" [% END -%] [% END -%] QUATTOR = 1 diff --git a/ncm-opennebula/src/main/resources/vnet.tt b/ncm-opennebula/src/main/resources/vnet.tt index 9de1a19bae..7dea2e1c80 100644 --- a/ncm-opennebula/src/main/resources/vnet.tt +++ b/ncm-opennebula/src/main/resources/vnet.tt @@ -3,12 +3,12 @@ [% FOR pair IN vnet.pairs -%] [%- SWITCH pair.key -%] [% CASE booleans -%] -[% pair.key.upper %] = "[% pair.value ? "YES" : "NO" %]" +[% pair.key FILTER upper %] = "[% pair.value ? "YES" : "NO" %]" [% CASE ar_section -%] -[% pair.key.upper %] = [% INCLUDE 'opennebula/oned_level1.tt' +[% pair.key FILTER upper %] = [% INCLUDE 'opennebula/oned_level1.tt' data=vnet.${pair.key} -%] [% CASE -%] -[% pair.key.upper %] = "[% pair.value %]" +[% pair.key FILTER upper %] = "[% pair.value %]" [% END -%] [%- END -%] QUATTOR = 1 From f68d2479aa2b0d6d10bc0e44a9fb0b9992c28524 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Mon, 20 Apr 2015 15:11:53 +0200 Subject: [PATCH 11/13] fix replaced nlist by dict --- .../main/pan/components/opennebula/schema.pan | 52 +++++------ .../main/pan/components/opennebula/sudo.pan | 2 +- .../main/resources/tests/profiles/oned.pan | 4 +- .../src/main/resources/tests/profiles/vm.pan | 86 ------------------- .../resources/tests/profiles/vnet_ovsbr0.pan | 2 +- ncm-opennebula/src/test/resources/one.pan | 18 ++-- ncm-opennebula/src/test/resources/oned.pan | 2 +- 7 files changed, 40 insertions(+), 126 deletions(-) delete mode 100644 ncm-opennebula/src/main/resources/tests/profiles/vm.pan diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index 138b8c5c3e..9bae90cecd 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -25,81 +25,81 @@ type opennebula_db = { type opennebula_log = { "system" : string = 'file' with match (SELF, '^(file|syslog)$') "debug_level" : long(0..3) = 3 -} = nlist(); +} = dict(); type opennebula_federation = { "mode" : string = 'STANDALONE' with match (SELF, '^(STANDALONE|MASTER|SLAVE)$') "zone_id" : long = 0 "master_oned" : string = '' -} = nlist(); +} = dict(); type opennebula_im = { "executable" : string = 'one_im_ssh' "arguments" : string -} = nlist(); +} = dict(); type opennebula_im_mad_collectd = { include opennebula_im -} = nlist("executable", 'collectd', "arguments", '-p 4124 -f 5 -t 50 -i 20'); +} = dict("executable", 'collectd', "arguments", '-p 4124 -f 5 -t 50 -i 20'); type opennebula_im_mad_kvm = { include opennebula_im -} = nlist("arguments", '-r 3 -t 15 kvm'); +} = dict("arguments", '-r 3 -t 15 kvm'); type opennebula_im_mad_xen = { include opennebula_im -} = nlist("arguments", '-r 3 -t 15 xen4'); +} = dict("arguments", '-r 3 -t 15 xen4'); type opennebula_im_mad = { "collectd" : opennebula_im_mad_collectd "kvm" : opennebula_im_mad_kvm "xen" : opennebula_im_mad_xen -} = nlist(); +} = dict(); type opennebula_vm = { "executable" : string = 'one_vmm_exec' "arguments" : string "default" : string -} = nlist(); +} = dict(); type opennebula_vm_mad_kvm = { include opennebula_vm -} = nlist("arguments", '-t 15 -r 0 kvm', "default", 'vmm_exec/vmm_exec_kvm.conf'); +} = dict("arguments", '-t 15 -r 0 kvm', "default", 'vmm_exec/vmm_exec_kvm.conf'); type opennebula_vm_mad_xen = { include opennebula_vm -} = nlist("arguments", '-t 15 -r 0 xen4', "default", 'vmm_exec/vmm_exec_xen4.conf'); +} = dict("arguments", '-t 15 -r 0 xen4', "default", 'vmm_exec/vmm_exec_xen4.conf'); type opennebula_vm_mad = { "kvm" : opennebula_vm_mad_kvm "xen" : opennebula_vm_mad_xen -} = nlist(); +} = dict(); type opennebula_tm_mad = { "executable" : string = 'one_tm' "arguments" : string = '-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph' -} = nlist(); +} = dict(); type opennebula_datastore_mad = { "executable" : string = 'one_datastore' "arguments" : string = '-t 15 -d dummy,fs,vmfs,lvm,ceph' -} = nlist(); +} = dict(); type opennebula_hm_mad = { "executable" : string = 'one_hm' -} = nlist(); +} = dict(); type opennebula_auth_mad = { "executable" : string = 'one_auth_mad' "authn" : string = 'ssh,x509,ldap,server_cipher,server_x509' -} = nlist(); +} = dict(); type opennebula_tm_mad_conf = { "name" : string = "dummy" "ln_target" : string = "NONE" "clone_target" : string = "SYSTEM" "shared" : boolean = true -} = nlist(); +} = dict(); @documentation{ check if a specific type of datastore has the right attributes @@ -215,14 +215,14 @@ type opennebula_oned = { "hm_mad" : opennebula_hm_mad "auth_mad" : opennebula_auth_mad "tm_mad_conf" : opennebula_tm_mad_conf[] = list( - nlist(), - nlist("name", "lvm", "clone_target", "SELF"), - nlist("name", "shared"), - nlist("name", "fs_lvm", "ln_target", "SYSTEM"), - nlist("name", "qcow2"), - nlist("name", "ssh", "ln_target", "SYSTEM", "shared", false), - nlist("name", "vmfs"), - nlist("name", "ceph", "clone_target", "SELF") + dict(), + dict("name", "lvm", "clone_target", "SELF"), + dict("name", "shared"), + dict("name", "fs_lvm", "ln_target", "SYSTEM"), + dict("name", "qcow2"), + dict("name", "ssh", "ln_target", "SYSTEM", "shared", false), + dict("name", "vmfs"), + dict("name", "ceph", "clone_target", "SELF") ) "vm_restricted_attr" : string[] = list("CONTEXT/FILES", "NIC/MAC", "NIC/VLAN_ID", "NIC/BRIDGE") "image_restricted_attr" : string = 'SOURCE' @@ -240,7 +240,7 @@ type opennebula_rpc = { "host" : string = 'localhost' "user" : string = 'oneadmin' "password" : string -} = nlist(); +} = dict(); @documentation{ Type that sets the OpenNebula @@ -271,5 +271,5 @@ type component_opennebula = { 'host_ovs' ? boolean 'host_hyp' : string = 'kvm' with match (SELF, '^(kvm|xen)$') 'tm_system_ds' ? string with match(SELF, "^(shared|ssh|vmfs)$") -} = nlist(); +} = dict(); diff --git a/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan b/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan index 778200f68b..6727a39289 100644 --- a/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/sudo.pan @@ -25,7 +25,7 @@ include 'components/sudo/config'; '/usr/bin/ovs-ofctl', ); foreach (i; cmd; sudolist){ - nl = nlist("host", "ALL", + nl = dict("host", "ALL", "options", "NOPASSWD:", "run_as", "ALL", "user", "oneadmin"); diff --git a/ncm-opennebula/src/main/resources/tests/profiles/oned.pan b/ncm-opennebula/src/main/resources/tests/profiles/oned.pan index 23d86db2b9..1ebb611e5e 100644 --- a/ncm-opennebula/src/main/resources/tests/profiles/oned.pan +++ b/ncm-opennebula/src/main/resources/tests/profiles/oned.pan @@ -7,7 +7,7 @@ bind "/metaconfig/contents/oned" = opennebula_oned; "/metaconfig/module" = "oned"; prefix "/metaconfig/contents/oned"; -"db" = nlist( +"db" = dict( "backend", "mysql", "server", "localhost", "port", 0, @@ -15,7 +15,7 @@ prefix "/metaconfig/contents/oned"; "passwd", "my-fancy-pass", "db_name", "opennebula", ); -"log" = nlist( +"log" = dict( "system", "syslog", "debug_level", 3, ); diff --git a/ncm-opennebula/src/main/resources/tests/profiles/vm.pan b/ncm-opennebula/src/main/resources/tests/profiles/vm.pan deleted file mode 100644 index 36a700b914..0000000000 --- a/ncm-opennebula/src/main/resources/tests/profiles/vm.pan +++ /dev/null @@ -1,86 +0,0 @@ -unique template vm; - -prefix "/hardware"; -"bios" = nlist( - "releasedate", "01/01/2007", - "version", "0.5.1", -); -"cards" = nlist( - "bmc", list(nlist("console", "ttyS0,115200")), - "nic", nlist( - "eth0", nlist("boot", "true", "hwaddr", "AA:00:00:80:01:00", "pxe", "true"), - "eth1", nlist("boot", "false", "hwaddr", "AA:00:00:80:01:01", "pxe", "true"), - ), -); - -"cpu" = list( - nlist( - "arch", "x86_64", - "cores", 2, - "manufacturer", "Intel", - "model", "Intel(R) Xeon(R) E5520 2.27GHz", - "speed", 2260, - "vendor", "Intel", - ), - nlist( - "arch", "x86_64", - "cores", 2, - "manufacturer", "Intel", - "model", "Intel(R) Xeon(R) E5520 2.27GHz", - "speed", 2260, - "vendor", "Intel", - ) -); -"harddisks" = nlist( - "vda", nlist( - "capacity", 20480, - "interface", "sas", - "model", "Generic SAS disk", - "part_prefix", "" - ), - "vdb", nlist( - "capacity", 10480, - "interface", "sas", - "model", "Generic SAS disk", - "part_prefix", "" - ), -); -"location" = "cubone hyp"; -"model" = "KVM Virtual Machine"; -"ram" = list ( - nlist ("size", 2048,), - nlist ("size", 2048,), -); -"serialnumber" = "kvm/QUATTOR_IMAGE001"; - -prefix "/system/network"; -"default_gateway" = "10.141.10.250"; -"domainname" = "cubone.os"; -"hostname" = "node630"; -"interfaces" = nlist( - "eth0", nlist( - "broadcast", "10.141.10.255", - "driver", "bnx2", - "ip", "10.141.8.30", - "netmask", "255.255.0.0" - ), - "eth1", nlist( - "broadcast", "172.24.255.255", - "device", "eth1", - "ip", "172.24.8.30", - "netmask", "255.255.0.0", - ), -); - -include 'metaconfig/opennebula/schema'; - -bind "/system/opennebula" = opennebula_vmtemplate; - -prefix "/system/opennebula"; -"vnet" = nlist( - "eth0", "br100", - "eth1", "br101"); - -"datastore" = nlist( - "vda", "ceph", - "vdb", "default"); diff --git a/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan b/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan index b0ac47c17b..5725315b37 100644 --- a/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan +++ b/ncm-opennebula/src/main/resources/tests/profiles/vnet_ovsbr0.pan @@ -15,7 +15,7 @@ prefix "/metaconfig/contents/vnet"; "network_mask" = "255.255.0.0"; "vlan" = true; "vlan_id" = 0; -"ar" = nlist( +"ar" = dict( "type", "IP4", "ip", "10.141.14.100", "size", 29, diff --git a/ncm-opennebula/src/test/resources/one.pan b/ncm-opennebula/src/test/resources/one.pan index 9daff060d8..60e6f8afe6 100644 --- a/ncm-opennebula/src/test/resources/one.pan +++ b/ncm-opennebula/src/test/resources/one.pan @@ -10,7 +10,7 @@ prefix "/software/components/opennebula/untouchables"; "datastores" = list('system'); prefix "/software/components/opennebula/oned"; -"db" = nlist( +"db" = dict( "backend", "mysql", "server", "localhost", "port", 0, @@ -18,7 +18,7 @@ prefix "/software/components/opennebula/oned"; "passwd", "my-fancy-pass", "db_name", "opennebula", ); -"log" = nlist( +"log" = dict( "system", "syslog", "debug_level", 3, ); @@ -28,21 +28,21 @@ prefix "/software/components/opennebula/oned"; prefix "/software/components/opennebula"; "vnets" = list( - nlist( + dict( "name", "altaria.os", "bridge", "br100", "gateway", "10.141.3.250", "dns", "10.141.3.250", "network_mask", "255.255.0.0" ), - nlist( + dict( "name", "altaria.vsc", "bridge", "br101", "gateway", "10.141.3.250", "dns", "10.141.3.250", "network_mask", "255.255.0.0" ), - nlist( + dict( "name", "pool.altaria.os", "bridge", "br100", "bridge_ovs", "ovsbr0", @@ -51,7 +51,7 @@ prefix "/software/components/opennebula"; "network_mask", "255.255.0.0", "vlan", true, "vlan_id", 0, - "ar", nlist( + "ar", dict( "type", "IP4", "ip", "10.141.14.100", "size", 29 @@ -60,7 +60,7 @@ prefix "/software/components/opennebula"; ); "datastores" = list( - nlist( + dict( "name", "ceph.altaria", "bridge_list", list("hyp004.cubone.os"), "ceph_host", list("ceph001.cubone.os","ceph002.cubone.os","ceph003.cubone.os"), @@ -74,13 +74,13 @@ prefix "/software/components/opennebula"; ); "users" = list( - nlist( + dict( "user", "lsimngar", "password", "my_fancy_pass", "ssh_public_key", "ssh-dss AAAAB3NzaC1kc3MAAACBAOTAivURhUrg2Zh3DqgVd2ofRYKmXKjWDM4LITQJ/Tr6RBWhufdxmJos/w0BG9jFbPWbUyPn1mbRFx9/2JJjaspJMACiNsQV5KD2a2H/yWVBxNkWVUwmq36JNh0Tvx+ts9Awus9MtJIxUeFdvT433DePqRXx9EtX9WCJ1vMyhwcFAAAAFQDcuA4clpwjiL9E/2CfmTKHPCAxIQAAAIEAnCQBn1/tCoEzI50oKFyF5Lvum/TPxh6BugbOKu18Okvwf6/zpsiUTWhpxaa40S4FLzHFopTklTHoG3JaYHuksdP4ZZl1mPPFhCTk0uFsqfEVlK9El9sQak9vXPIi7Tw/dyylmRSq+3p5cmurjXSI93bJIRv7X4pcZlIAvHWtNAYAAACBAOCkwou/wYp5polMTqkFLx7dnNHG4Je9UC8Oqxn2Gq3uu088AsXwaVD9t8tTzXP1FSUlG0zfDU3BX18Ds11p57GZtBSECAkqH1Q6vMUiWcoIwj4hq+xNq3PFLmCG/QP+5Od5JvpbBKqX9frc1UvOJJ3OKSjgWMx6FfHr8PxqqACw lsimngar@OptiPlex-790", "quattor", 1 ), - nlist( + dict( "user", "stdweird", "password", "another_fancy_pass", "quattor", 1 diff --git a/ncm-opennebula/src/test/resources/oned.pan b/ncm-opennebula/src/test/resources/oned.pan index 238f7f48ce..a357e50902 100644 --- a/ncm-opennebula/src/test/resources/oned.pan +++ b/ncm-opennebula/src/test/resources/oned.pan @@ -1,7 +1,7 @@ unique template oned; prefix "/software/components/opennebula/oned"; -"db" = nlist( +"db" = dict( "backend", "mysql", "server", "localhost", "port", 0, From c9b86ccb1b8f858612dac72689c1813c6adc5540 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Mon, 20 Apr 2015 16:01:55 +0200 Subject: [PATCH 12/13] fix replaced macaddr by pan/type type_hwaddr --- ncm-opennebula/src/main/pan/components/opennebula/schema.pan | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index 9bae90cecd..001a5e3651 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -9,7 +9,6 @@ include 'quattor/schema'; include 'pan/types'; type uuid = string with match(SELF,'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'); -type macaddr = string with match(SELF, '([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'); type directory = string with match(SELF,'[^/]+/?$'); @@ -144,7 +143,7 @@ type opennebula_ar = { "type" : string with match(SELF, "^(IP4|IP6|IP4_6|ETHER)$") "ip" ? type_ipv4 "size" : long (1..) - "mac" ? macaddr + "mac" ? type_hwaddr "global_prefix" ? string "ula_prefix" ? string }; From 7254795c8731750cdd5650c52d8ace913d598cb3 Mon Sep 17 00:00:00 2001 From: lsimngar Date: Tue, 21 Apr 2015 09:13:23 +0200 Subject: [PATCH 13/13] Replaced uuid by pan/type type_uuid --- ncm-opennebula/src/main/pan/components/opennebula/schema.pan | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan index 001a5e3651..7676c7ad49 100755 --- a/ncm-opennebula/src/main/pan/components/opennebula/schema.pan +++ b/ncm-opennebula/src/main/pan/components/opennebula/schema.pan @@ -8,8 +8,6 @@ declaration template components/opennebula/schema; include 'quattor/schema'; include 'pan/types'; -type uuid = string with match(SELF,'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'); - type directory = string with match(SELF,'[^/]+/?$'); type opennebula_db = { @@ -128,7 +126,7 @@ ceph_host, ceph_secret, ceph_user, ceph_user_key and pool_name are mandatory } type opennebula_ceph_datastore = { "ceph_host" ? string[] - "ceph_secret" ? uuid + "ceph_secret" ? type_uuid "ceph_user" ? string "ceph_user_key" ? string "pool_name" ? string