[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remove unused network.default_{gateway, netmask}.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1172448434 0
# Node ID 568433250d84632732580668698695400b8e2d74
# Parent  48d581be85eaa78240a7dbbca9be10698b837424
Remove unused network.default_{gateway,netmask}.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex    |  134 -----------------------------------
 tools/libxen/include/xen_network.h   |   36 ---------
 tools/libxen/src/xen_network.c       |   78 --------------------
 tools/python/xen/xend/XendAPI.py     |   24 ------
 tools/python/xen/xend/XendNetwork.py |   46 ------------
 tools/python/xen/xend/XendNode.py    |   12 ---
 6 files changed, 12 insertions(+), 318 deletions(-)

diff -r 48d581be85ea -r 568433250d84 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:45:39 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Mon Feb 26 00:07:14 2007 +0000
@@ -6657,8 +6657,6 @@ Quals & Field & Type & Description \\
 $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg 
human-readable description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt VIFs} & (VIF ref) Set & list of connected 
vifs \\
 $\mathit{RO}_\mathit{run}$ &  {\tt PIFs} & (PIF ref) Set & list of connected 
pifs \\
-$\mathit{RW}$ &  {\tt default\_gateway} & string & default gateway IP address. 
Used for auto-configuring guests with fixed IP setting \\
-$\mathit{RW}$ &  {\tt default\_netmask} & string & default netmask. Used for 
auto-configuring guests with fixed IP setting \\
 \hline
 \end{longtable}
 \subsection{Additional RPCs associated with class: network}
@@ -6908,138 +6906,6 @@ Get the PIFs field of the given network.
 
 
 value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_default\_gateway}
-
-{\bf Overview:} 
-Get the default\_gateway field of the given network.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_default_gateway (session_id s, network ref 
self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt network ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_default\_gateway}
-
-{\bf Overview:} 
-Set the default\_gateway field of the given network.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_default_gateway (session_id s, network ref self, 
string value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt network ref } & self & reference to the object \\ \hline 
-
-{\tt string } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_default\_netmask}
-
-{\bf Overview:} 
-Get the default\_netmask field of the given network.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_default_netmask (session_id s, network ref 
self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt network ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_default\_netmask}
-
-{\bf Overview:} 
-Set the default\_netmask field of the given network.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_default_netmask (session_id s, network ref self, 
string value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt network ref } & self & reference to the object \\ \hline 
-
-{\tt string } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
diff -r 48d581be85ea -r 568433250d84 tools/libxen/include/xen_network.h
--- a/tools/libxen/include/xen_network.h        Sun Feb 25 23:45:39 2007 +0000
+++ b/tools/libxen/include/xen_network.h        Mon Feb 26 00:07:14 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * Copyright (c) 2006-2007, XenSource Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,8 +26,8 @@
 
 
 /*
- * The network class. 
- *  
+ * The network class.
+ * 
  * A virtual network.
  */
 
@@ -68,8 +68,6 @@ typedef struct xen_network_record
     char *name_description;
     struct xen_vif_record_opt_set *vifs;
     struct xen_pif_record_opt_set *pifs;
-    char *default_gateway;
-    char *default_netmask;
 } xen_network_record;
 
 /**
@@ -222,20 +220,6 @@ xen_network_get_pifs(xen_session *sessio
 
 
 /**
- * Get the default_gateway field of the given network.
- */
-extern bool
-xen_network_get_default_gateway(xen_session *session, char **result, 
xen_network network);
-
-
-/**
- * Get the default_netmask field of the given network.
- */
-extern bool
-xen_network_get_default_netmask(xen_session *session, char **result, 
xen_network network);
-
-
-/**
  * Set the name/label field of the given network.
  */
 extern bool
@@ -250,20 +234,6 @@ xen_network_set_name_description(xen_ses
 
 
 /**
- * Set the default_gateway field of the given network.
- */
-extern bool
-xen_network_set_default_gateway(xen_session *session, xen_network network, 
char *default_gateway);
-
-
-/**
- * Set the default_netmask field of the given network.
- */
-extern bool
-xen_network_set_default_netmask(xen_session *session, xen_network network, 
char *default_netmask);
-
-
-/**
  * Return a list of all the networks known to the system.
  */
 extern bool
diff -r 48d581be85ea -r 568433250d84 tools/libxen/src/xen_network.c
--- a/tools/libxen/src/xen_network.c    Sun Feb 25 23:45:39 2007 +0000
+++ b/tools/libxen/src/xen_network.c    Mon Feb 26 00:07:14 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * Copyright (c) 2006-2007, XenSource Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -52,13 +52,7 @@ static const struct_member xen_network_r
           .offset = offsetof(xen_network_record, vifs) },
         { .key = "PIFs",
           .type = &abstract_type_ref_set,
-          .offset = offsetof(xen_network_record, pifs) },
-        { .key = "default_gateway",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_network_record, default_gateway) },
-        { .key = "default_netmask",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_network_record, default_netmask) }
+          .offset = offsetof(xen_network_record, pifs) }
     };
 
 const abstract_type xen_network_record_abstract_type_ =
@@ -84,8 +78,6 @@ xen_network_record_free(xen_network_reco
     free(record->name_description);
     xen_vif_record_opt_set_free(record->vifs);
     xen_pif_record_opt_set_free(record->pifs);
-    free(record->default_gateway);
-    free(record->default_netmask);
     free(record);
 }
 
@@ -247,40 +239,6 @@ xen_network_get_pifs(xen_session *sessio
 
 
 bool
-xen_network_get_default_gateway(xen_session *session, char **result, 
xen_network network)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = network }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("network.get_default_gateway");
-    return session->ok;
-}
-
-
-bool
-xen_network_get_default_netmask(xen_session *session, char **result, 
xen_network network)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = network }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("network.get_default_netmask");
-    return session->ok;
-}
-
-
-bool
 xen_network_set_name_label(xen_session *session, xen_network network, char 
*label)
 {
     abstract_value param_values[] =
@@ -313,38 +271,6 @@ xen_network_set_name_description(xen_ses
 
 
 bool
-xen_network_set_default_gateway(xen_session *session, xen_network network, 
char *default_gateway)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = network },
-            { .type = &abstract_type_string,
-              .u.string_val = default_gateway }
-        };
-
-    xen_call_(session, "network.set_default_gateway", param_values, 2, NULL, 
NULL);
-    return session->ok;
-}
-
-
-bool
-xen_network_set_default_netmask(xen_session *session, xen_network network, 
char *default_netmask)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = network },
-            { .type = &abstract_type_string,
-              .u.string_val = default_netmask }
-        };
-
-    xen_call_(session, "network.set_default_netmask", param_values, 2, NULL, 
NULL);
-    return session->ok;
-}
-
-
-bool
 xen_network_get_all(xen_session *session, struct xen_network_set **result)
 {
 
diff -r 48d581be85ea -r 568433250d84 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sun Feb 25 23:45:39 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Mon Feb 26 00:07:14 2007 +0000
@@ -824,18 +824,13 @@ class XendAPI(object):
 
     network_attr_ro = ['VIFs', 'PIFs']
     network_attr_rw = ['name_label',
-                       'name_description',
-                       'default_gateway',
-                       'default_netmask']
+                       'name_description']
     
     network_funcs = [('create', 'network')]
     
-    def network_create(self, _, name_label, name_description,
-                       default_gateway, default_netmask):
+    def network_create(self, _, name_label, name_description):
         return xen_api_success(
-            XendNode.instance().network_create(name_label, name_description,
-                                               default_gateway,
-                                               default_netmask))
+            XendNode.instance().network_create(name_label, name_description))
 
     def network_destroy(self, _, ref):
         return xen_api_success(XendNode.instance().network_destroy(ref))
@@ -856,12 +851,6 @@ class XendAPI(object):
     def network_get_name_description(self, _, ref):
         return xen_api_success(self._get_network(ref).name_description)
 
-    def network_get_default_gateway(self, _, ref):
-        return xen_api_success(self._get_network(ref).default_gateway)
-
-    def network_get_default_netmask(self, _, ref):
-        return xen_api_success(self._get_network(ref).default_netmask)
-
     def network_get_VIFs(self, _, ref):
         return xen_api_success(self._get_network(ref).get_VIF_UUIDs())
 
@@ -873,13 +862,6 @@ class XendAPI(object):
 
     def network_set_name_description(self, _, ref, val):
         return 
xen_api_success(self._get_network(ref).set_name_description(val))
-
-    def network_set_default_gateway(self, _, ref, val):
-        return xen_api_success(self._get_network(ref).set_default_gateway(val))
-
-    def network_set_default_netmask(self, _, ref, val):
-        return xen_api_success(self._get_network(ref).set_default_netmask(val))
-
 
     # Xen API: Class PIF
     # ----------------------------------------------------------------
diff -r 48d581be85ea -r 568433250d84 tools/python/xen/xend/XendNetwork.py
--- a/tools/python/xen/xend/XendNetwork.py      Sun Feb 25 23:45:39 2007 +0000
+++ b/tools/python/xen/xend/XendNetwork.py      Mon Feb 26 00:07:14 2007 +0000
@@ -27,43 +27,11 @@ from XendLogging import log
 
 IP_ROUTE_RE = r'^default via ([\d\.]+) dev (\w+)'
 
-def linux_get_default_network():
-    """Returns the network details of the host."""
-
-    ip_cmd = '/sbin/ip route'
-    rc, output = commands.getstatusoutput(ip_cmd)
-    default_route = None
-    default_dev = None
-    default_netmask = None
-    if rc == 0:
-        # find default route/device
-        for line in output.split('\n'):
-            is_default = re.search(IP_ROUTE_RE, line)
-            if is_default:
-                default_route = is_default.group(1)
-                default_dev = is_default.group(2)
-
-        # find network address and network mask
-        if default_dev:
-            dev_re = r'^([\d\.]+)/(\d+) dev %s' % default_dev
-            for line in output.split('\n'):
-                is_dev = re.search(dev_re, line)
-                if is_dev:
-                    # convert integer netmask to string representation
-                    netmask = 0xffffffff ^ (2**(32-int(is_dev.group(2))) - 1)
-                    packed = struct.pack('!I', netmask)
-                    default_netmask = socket.inet_ntoa(packed)
-
-    return (default_route, default_netmask)
-
-
 class XendNetwork:
-    def __init__(self, uuid, name, description, gateway, netmask):
+    def __init__(self, uuid, name, description):
         self.uuid = uuid
         self.name_label = name 
         self.name_description = description
-        self.default_gateway = gateway
-        self.default_netmask = netmask
 
     def set_name_label(self, new_name):
         self.name_label = new_name
@@ -72,16 +40,6 @@ class XendNetwork:
     def set_name_description(self, new_desc):
         self.name_description = new_desc
         XendNode.instance().save_networks()
-
-    def set_default_gateway(self, new_gateway):
-        if re.search('^\d+\.\d+\.\d+\.\d+$', new_gateway):
-            self.default_gateway = new_gateway
-            XendNode.instance().save_networks()
-
-    def set_default_netmask(self, new_netmask):
-        if re.search('^\d+\.\d+\.\d+\.\d+$', new_netmask):
-            self.default_netmask = new_netmask
-            XendNode.instance().save_networks()
 
     def get_VIF_UUIDs(self):
         result = []
@@ -103,8 +61,6 @@ class XendNetwork:
             'uuid': self.uuid,
             'name_label': self.name_label,
             'name_description': self.name_description,
-            'default_gateway': self.default_gateway,
-            'default_netmask': self.default_netmask,
         }
         if transient:
             result['VIFs'] = self.get_VIF_UUIDs()
diff -r 48d581be85ea -r 568433250d84 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Sun Feb 25 23:45:39 2007 +0000
+++ b/tools/python/xen/xend/XendNode.py Mon Feb 26 00:07:14 2007 +0000
@@ -109,12 +109,9 @@ class XendNode:
             for net_uuid, network in saved_networks.items():
                 self.network_create(network.get('name_label'),
                                     network.get('name_description', ''),
-                                    network.get('default_gateway', ''),
-                                    network.get('default_netmask', ''),
                                     False, net_uuid)
         else:
-            gateway, netmask = linux_get_default_network()
-            self.network_create('net0', '', gateway, netmask, False)
+            self.network_create('net0', '', False)
 
         # initialise PIFs
         saved_pifs = self.state_store.load_state('pif')
@@ -168,15 +165,12 @@ class XendNode:
 
 
 
-    def network_create(self, name_label, name_description,
-                       default_gateway, default_netmask, persist = True,
+    def network_create(self, name_label, name_description, persist = True,
                        net_uuid = None):
         if net_uuid is None:
             net_uuid = uuid.createString()
         self.networks[net_uuid] = XendNetwork(net_uuid, name_label,
-                                              name_description,
-                                              default_gateway,
-                                              default_netmask)
+                                              name_description)
         if persist:
             self.save_networks()
         return net_uuid

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.