[one-users] Host-based VLAN Through OCCI, OpenNebula v3.0

Hutson Betts hut101 at tamu.edu
Thu Dec 22 14:07:16 PST 2011


For those who are interested in Host-based VLAN for OpenNebula v3.0,
through the OCCI interface, here is the patch included at the bottom of
this e-mail. This is only a temporary patch meant for those who are,
like me, stuck with v3.0 for a while, but still need that specific
feature. Also, don't forget to include the network.erb file in your OCCI
templates folder. That file can be found at:
http://dev.opennebula.org/projects/opennebula/repository/revisions/master/changes/src/cloud/occi/etc/templates/network.erb

Patch:

diff -u original/OCCIServer.rb modified/OCCIServer.rb
--- original/OCCIServer.rb	2011-12-22 15:54:08.545139919 -0600
+++ modified/OCCIServer.rb	2011-12-22 14:01:15.000000000 -0600
@@ -299,7 +299,7 @@
                         VirtualNetwork.build_xml,
                         self.client,
                         request.body,
-                        @config[:bridge])
+                        @config[:template_location])
 
         # --- Generate the template and Allocate the new Instance ---
         template = network.to_one_template
diff -u original/VirtualNetworkOCCI.rb modified/VirtualNetworkOCCI.rb
--- original/VirtualNetworkOCCI.rb	2011-12-22 15:54:20.765139120 -0600
+++ modified/VirtualNetworkOCCI.rb	2011-12-22 14:01:54.000000000 -0600
@@ -51,10 +51,10 @@
     }.gsub(/^        /, '')
 
     # Class constructor
-    def initialize(xml, client, xml_info=nil, bridge=nil)
+    def initialize(xml, client, xml_info=nil, base=nil)
         super(xml, client)
-        @bridge    = bridge
         @vnet_info = nil
+        @common_template = base + '/network.erb' if base
 
         if xml_info != nil
             xmldoc     = XMLElement.build_xml(xml_info, 'NETWORK')
@@ -82,7 +82,13 @@
             return error
         end
 
-        one = ERB.new(ONE_NETWORK)
-        return one.result(binding)
+	begin
+		template = ERB.new(File.read(@common_template)).result(binding)
+        rescue Exception => e
+		error = OpenNebula::Error.new(e.message)
+		return error
+        end
+
+        return template
     end
 end
-- 
Hutson Betts
Computer Science and Engineering
Texas A&M University


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20111222/2f824827/attachment-0002.pgp>


More information about the Users mailing list