[Ovirt-devel] [PATCH server] add network QMF apis. (still in progress)
Scott Seago
sseago at redhat.com
Thu Jul 16 19:43:12 UTC 2009
This isn't yet functional, but I'm submitting the patch so Ian can continue work on it.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
.../lib/ovirt/controllers/network_controller.rb | 26 ++++++++++++++++++++
.../physical_network_impl_controller.rb | 10 +++++++
.../lib/ovirt/controllers/vlan_impl_controller.rb | 9 +++++++
src/ovirt-agent/ovirt_api.xml | 12 +++++++++
4 files changed, 57 insertions(+), 0 deletions(-)
create mode 100644 src/ovirt-agent/lib/ovirt/controllers/network_controller.rb
create mode 100644 src/ovirt-agent/lib/ovirt/controllers/physical_network_impl_controller.rb
create mode 100644 src/ovirt-agent/lib/ovirt/controllers/vlan_impl_controller.rb
diff --git a/src/ovirt-agent/lib/ovirt/controllers/network_controller.rb b/src/ovirt-agent/lib/ovirt/controllers/network_controller.rb
new file mode 100644
index 0000000..dd6b4e5
--- /dev/null
+++ b/src/ovirt-agent/lib/ovirt/controllers/network_controller.rb
@@ -0,0 +1,26 @@
+module Ovirt
+
+ class NetworkController < AgentController
+
+ include NetworkService
+
+ def find(id)
+ svc_show(id)
+ render(@network)
+ end
+
+ def list
+ puts "query for Network class!"
+ svc_list
+ @networks.collect { |network| render(network) }
+ end
+
+ def render(network)
+ puts "calling to_qmf on #{pool}, #{pool.name}"
+ obj = to_qmf(network, :propmap => { :proto => nil})
+ obj.proto = network.boot_type.label
+ return obj
+ end
+
+ end
+end
diff --git a/src/ovirt-agent/lib/ovirt/controllers/physical_network_impl_controller.rb b/src/ovirt-agent/lib/ovirt/controllers/physical_network_impl_controller.rb
new file mode 100644
index 0000000..456b4e9
--- /dev/null
+++ b/src/ovirt-agent/lib/ovirt/controllers/physical_network_impl_controller.rb
@@ -0,0 +1,10 @@
+module Ovirt
+
+ class PhysicalNetworkImplController < NetworkController
+
+ <!-- FIXME: NICs ref needed once the VM/Host NIC model is finalized -->
+ def render(network)
+ super(network)
+ end
+ end
+end
diff --git a/src/ovirt-agent/lib/ovirt/controllers/vlan_impl_controller.rb b/src/ovirt-agent/lib/ovirt/controllers/vlan_impl_controller.rb
new file mode 100644
index 0000000..4cbb7d8
--- /dev/null
+++ b/src/ovirt-agent/lib/ovirt/controllers/vlan_impl_controller.rb
@@ -0,0 +1,9 @@
+module Ovirt
+
+ class VlanImplController < NetworkController
+ <!-- FIXME: Bondings ref needed once Bondings are added to the API -->
+ def render(network)
+ super(network)
+ end
+ end
+end
diff --git a/src/ovirt-agent/ovirt_api.xml b/src/ovirt-agent/ovirt_api.xml
index a5aa383..8eb7ef2 100644
--- a/src/ovirt-agent/ovirt_api.xml
+++ b/src/ovirt-agent/ovirt_api.xml
@@ -73,12 +73,24 @@
</doc:desc>
<property name="name" type="sstr" desc="The name of the network"/>
<property name="proto" type="sstr" desc="The boot protocol on this network, one of 'static', 'dhcp' or 'bootp'"/>
+ <!-- FIXME: What about IP addresses, usages, and VMs references -->
<method name="create_vm_nic_def" desc="Create a new NIC for a VM">
<arg name="mac" type="sstr" dir="I" desc="The MAC address for the new NIC"/>
<arg name="nic" dir="O" type="objId" references="VmNicDef" desc="Newly created VM NIC"/>
</method>
</class>
+ <!-- FIXME: This needs to use inheritance when QMF infrastructure is available -->
+ <class name="VlanImpl">
+ <property name="network" type="objId" references="Network" access="RC" desc="Reference to the network this implementation is for."/>
+ <property name="number" type="uint32" access="RW" desc="VLAN Number"/>
+ <!-- FIXME: Bondings ref needed once Bondings are added to the API -->
+ </class>
+ <class name="PhysicalNetworkImpl">
+ <property name="network" type="objId" references="Network" access="RC" desc="Reference to the network this implementation is for."/>
+ <!-- FIXME: NICs ref needed once the VM/Host NIC model is finalized -->
+ </class>
+
<class name="VmNicDef">
<doc:desc>
The virtual NIC of a VM; ties a MAC address to a logical network
--
1.6.0.6
More information about the ovirt-devel
mailing list