direct-io.hg

changeset 14116:568433250d84

Remove unused network.default_{gateway,netmask}.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Feb 26 00:07:14 2007 +0000 (2007-02-26)
parents 48d581be85ea
children bfd188f0cf5d
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_network.h tools/libxen/src/xen_network.c tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendNetwork.py tools/python/xen/xend/XendNode.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Sun Feb 25 23:45:39 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Mon Feb 26 00:07:14 2007 +0000
     1.3 @@ -6657,8 +6657,6 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg human-readable description \\
     1.5  $\mathit{RO}_\mathit{run}$ &  {\tt VIFs} & (VIF ref) Set & list of connected vifs \\
     1.6  $\mathit{RO}_\mathit{run}$ &  {\tt PIFs} & (PIF ref) Set & list of connected pifs \\
     1.7 -$\mathit{RW}$ &  {\tt default\_gateway} & string & default gateway IP address. Used for auto-configuring guests with fixed IP setting \\
     1.8 -$\mathit{RW}$ &  {\tt default\_netmask} & string & default netmask. Used for auto-configuring guests with fixed IP setting \\
     1.9  \hline
    1.10  \end{longtable}
    1.11  \subsection{Additional RPCs associated with class: network}
    1.12 @@ -6911,138 +6909,6 @@ value of the field
    1.13  \vspace{0.3cm}
    1.14  \vspace{0.3cm}
    1.15  \vspace{0.3cm}
    1.16 -\subsubsection{RPC name:~get\_default\_gateway}
    1.17 -
    1.18 -{\bf Overview:} 
    1.19 -Get the default\_gateway field of the given network.
    1.20 -
    1.21 - \noindent {\bf Signature:} 
    1.22 -\begin{verbatim} string get_default_gateway (session_id s, network ref self)\end{verbatim}
    1.23 -
    1.24 -
    1.25 -\noindent{\bf Arguments:}
    1.26 -
    1.27 - 
    1.28 -\vspace{0.3cm}
    1.29 -\begin{tabular}{|c|c|p{7cm}|}
    1.30 - \hline
    1.31 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.32 -{\tt network ref } & self & reference to the object \\ \hline 
    1.33 -
    1.34 -\end{tabular}
    1.35 -
    1.36 -\vspace{0.3cm}
    1.37 -
    1.38 - \noindent {\bf Return Type:} 
    1.39 -{\tt 
    1.40 -string
    1.41 -}
    1.42 -
    1.43 -
    1.44 -value of the field
    1.45 -\vspace{0.3cm}
    1.46 -\vspace{0.3cm}
    1.47 -\vspace{0.3cm}
    1.48 -\subsubsection{RPC name:~set\_default\_gateway}
    1.49 -
    1.50 -{\bf Overview:} 
    1.51 -Set the default\_gateway field of the given network.
    1.52 -
    1.53 - \noindent {\bf Signature:} 
    1.54 -\begin{verbatim} void set_default_gateway (session_id s, network ref self, string value)\end{verbatim}
    1.55 -
    1.56 -
    1.57 -\noindent{\bf Arguments:}
    1.58 -
    1.59 - 
    1.60 -\vspace{0.3cm}
    1.61 -\begin{tabular}{|c|c|p{7cm}|}
    1.62 - \hline
    1.63 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.64 -{\tt network ref } & self & reference to the object \\ \hline 
    1.65 -
    1.66 -{\tt string } & value & New value to set \\ \hline 
    1.67 -
    1.68 -\end{tabular}
    1.69 -
    1.70 -\vspace{0.3cm}
    1.71 -
    1.72 - \noindent {\bf Return Type:} 
    1.73 -{\tt 
    1.74 -void
    1.75 -}
    1.76 -
    1.77 -
    1.78 -
    1.79 -\vspace{0.3cm}
    1.80 -\vspace{0.3cm}
    1.81 -\vspace{0.3cm}
    1.82 -\subsubsection{RPC name:~get\_default\_netmask}
    1.83 -
    1.84 -{\bf Overview:} 
    1.85 -Get the default\_netmask field of the given network.
    1.86 -
    1.87 - \noindent {\bf Signature:} 
    1.88 -\begin{verbatim} string get_default_netmask (session_id s, network ref self)\end{verbatim}
    1.89 -
    1.90 -
    1.91 -\noindent{\bf Arguments:}
    1.92 -
    1.93 - 
    1.94 -\vspace{0.3cm}
    1.95 -\begin{tabular}{|c|c|p{7cm}|}
    1.96 - \hline
    1.97 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.98 -{\tt network ref } & self & reference to the object \\ \hline 
    1.99 -
   1.100 -\end{tabular}
   1.101 -
   1.102 -\vspace{0.3cm}
   1.103 -
   1.104 - \noindent {\bf Return Type:} 
   1.105 -{\tt 
   1.106 -string
   1.107 -}
   1.108 -
   1.109 -
   1.110 -value of the field
   1.111 -\vspace{0.3cm}
   1.112 -\vspace{0.3cm}
   1.113 -\vspace{0.3cm}
   1.114 -\subsubsection{RPC name:~set\_default\_netmask}
   1.115 -
   1.116 -{\bf Overview:} 
   1.117 -Set the default\_netmask field of the given network.
   1.118 -
   1.119 - \noindent {\bf Signature:} 
   1.120 -\begin{verbatim} void set_default_netmask (session_id s, network ref self, string value)\end{verbatim}
   1.121 -
   1.122 -
   1.123 -\noindent{\bf Arguments:}
   1.124 -
   1.125 - 
   1.126 -\vspace{0.3cm}
   1.127 -\begin{tabular}{|c|c|p{7cm}|}
   1.128 - \hline
   1.129 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.130 -{\tt network ref } & self & reference to the object \\ \hline 
   1.131 -
   1.132 -{\tt string } & value & New value to set \\ \hline 
   1.133 -
   1.134 -\end{tabular}
   1.135 -
   1.136 -\vspace{0.3cm}
   1.137 -
   1.138 - \noindent {\bf Return Type:} 
   1.139 -{\tt 
   1.140 -void
   1.141 -}
   1.142 -
   1.143 -
   1.144 -
   1.145 -\vspace{0.3cm}
   1.146 -\vspace{0.3cm}
   1.147 -\vspace{0.3cm}
   1.148  \subsubsection{RPC name:~create}
   1.149  
   1.150  {\bf Overview:} 
     2.1 --- a/tools/libxen/include/xen_network.h	Sun Feb 25 23:45:39 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_network.h	Mon Feb 26 00:07:14 2007 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2006, XenSource Inc.
     2.6 + * Copyright (c) 2006-2007, XenSource Inc.
     2.7   *
     2.8   * This library is free software; you can redistribute it and/or
     2.9   * modify it under the terms of the GNU Lesser General Public
    2.10 @@ -26,8 +26,8 @@
    2.11  
    2.12  
    2.13  /*
    2.14 - * The network class. 
    2.15 - *  
    2.16 + * The network class.
    2.17 + * 
    2.18   * A virtual network.
    2.19   */
    2.20  
    2.21 @@ -68,8 +68,6 @@ typedef struct xen_network_record
    2.22      char *name_description;
    2.23      struct xen_vif_record_opt_set *vifs;
    2.24      struct xen_pif_record_opt_set *pifs;
    2.25 -    char *default_gateway;
    2.26 -    char *default_netmask;
    2.27  } xen_network_record;
    2.28  
    2.29  /**
    2.30 @@ -222,20 +220,6 @@ xen_network_get_pifs(xen_session *sessio
    2.31  
    2.32  
    2.33  /**
    2.34 - * Get the default_gateway field of the given network.
    2.35 - */
    2.36 -extern bool
    2.37 -xen_network_get_default_gateway(xen_session *session, char **result, xen_network network);
    2.38 -
    2.39 -
    2.40 -/**
    2.41 - * Get the default_netmask field of the given network.
    2.42 - */
    2.43 -extern bool
    2.44 -xen_network_get_default_netmask(xen_session *session, char **result, xen_network network);
    2.45 -
    2.46 -
    2.47 -/**
    2.48   * Set the name/label field of the given network.
    2.49   */
    2.50  extern bool
    2.51 @@ -250,20 +234,6 @@ xen_network_set_name_description(xen_ses
    2.52  
    2.53  
    2.54  /**
    2.55 - * Set the default_gateway field of the given network.
    2.56 - */
    2.57 -extern bool
    2.58 -xen_network_set_default_gateway(xen_session *session, xen_network network, char *default_gateway);
    2.59 -
    2.60 -
    2.61 -/**
    2.62 - * Set the default_netmask field of the given network.
    2.63 - */
    2.64 -extern bool
    2.65 -xen_network_set_default_netmask(xen_session *session, xen_network network, char *default_netmask);
    2.66 -
    2.67 -
    2.68 -/**
    2.69   * Return a list of all the networks known to the system.
    2.70   */
    2.71  extern bool
     3.1 --- a/tools/libxen/src/xen_network.c	Sun Feb 25 23:45:39 2007 +0000
     3.2 +++ b/tools/libxen/src/xen_network.c	Mon Feb 26 00:07:14 2007 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2006, XenSource Inc.
     3.6 + * Copyright (c) 2006-2007, XenSource Inc.
     3.7   *
     3.8   * This library is free software; you can redistribute it and/or
     3.9   * modify it under the terms of the GNU Lesser General Public
    3.10 @@ -52,13 +52,7 @@ static const struct_member xen_network_r
    3.11            .offset = offsetof(xen_network_record, vifs) },
    3.12          { .key = "PIFs",
    3.13            .type = &abstract_type_ref_set,
    3.14 -          .offset = offsetof(xen_network_record, pifs) },
    3.15 -        { .key = "default_gateway",
    3.16 -          .type = &abstract_type_string,
    3.17 -          .offset = offsetof(xen_network_record, default_gateway) },
    3.18 -        { .key = "default_netmask",
    3.19 -          .type = &abstract_type_string,
    3.20 -          .offset = offsetof(xen_network_record, default_netmask) }
    3.21 +          .offset = offsetof(xen_network_record, pifs) }
    3.22      };
    3.23  
    3.24  const abstract_type xen_network_record_abstract_type_ =
    3.25 @@ -84,8 +78,6 @@ xen_network_record_free(xen_network_reco
    3.26      free(record->name_description);
    3.27      xen_vif_record_opt_set_free(record->vifs);
    3.28      xen_pif_record_opt_set_free(record->pifs);
    3.29 -    free(record->default_gateway);
    3.30 -    free(record->default_netmask);
    3.31      free(record);
    3.32  }
    3.33  
    3.34 @@ -247,40 +239,6 @@ xen_network_get_pifs(xen_session *sessio
    3.35  
    3.36  
    3.37  bool
    3.38 -xen_network_get_default_gateway(xen_session *session, char **result, xen_network network)
    3.39 -{
    3.40 -    abstract_value param_values[] =
    3.41 -        {
    3.42 -            { .type = &abstract_type_string,
    3.43 -              .u.string_val = network }
    3.44 -        };
    3.45 -
    3.46 -    abstract_type result_type = abstract_type_string;
    3.47 -
    3.48 -    *result = NULL;
    3.49 -    XEN_CALL_("network.get_default_gateway");
    3.50 -    return session->ok;
    3.51 -}
    3.52 -
    3.53 -
    3.54 -bool
    3.55 -xen_network_get_default_netmask(xen_session *session, char **result, xen_network network)
    3.56 -{
    3.57 -    abstract_value param_values[] =
    3.58 -        {
    3.59 -            { .type = &abstract_type_string,
    3.60 -              .u.string_val = network }
    3.61 -        };
    3.62 -
    3.63 -    abstract_type result_type = abstract_type_string;
    3.64 -
    3.65 -    *result = NULL;
    3.66 -    XEN_CALL_("network.get_default_netmask");
    3.67 -    return session->ok;
    3.68 -}
    3.69 -
    3.70 -
    3.71 -bool
    3.72  xen_network_set_name_label(xen_session *session, xen_network network, char *label)
    3.73  {
    3.74      abstract_value param_values[] =
    3.75 @@ -313,38 +271,6 @@ xen_network_set_name_description(xen_ses
    3.76  
    3.77  
    3.78  bool
    3.79 -xen_network_set_default_gateway(xen_session *session, xen_network network, char *default_gateway)
    3.80 -{
    3.81 -    abstract_value param_values[] =
    3.82 -        {
    3.83 -            { .type = &abstract_type_string,
    3.84 -              .u.string_val = network },
    3.85 -            { .type = &abstract_type_string,
    3.86 -              .u.string_val = default_gateway }
    3.87 -        };
    3.88 -
    3.89 -    xen_call_(session, "network.set_default_gateway", param_values, 2, NULL, NULL);
    3.90 -    return session->ok;
    3.91 -}
    3.92 -
    3.93 -
    3.94 -bool
    3.95 -xen_network_set_default_netmask(xen_session *session, xen_network network, char *default_netmask)
    3.96 -{
    3.97 -    abstract_value param_values[] =
    3.98 -        {
    3.99 -            { .type = &abstract_type_string,
   3.100 -              .u.string_val = network },
   3.101 -            { .type = &abstract_type_string,
   3.102 -              .u.string_val = default_netmask }
   3.103 -        };
   3.104 -
   3.105 -    xen_call_(session, "network.set_default_netmask", param_values, 2, NULL, NULL);
   3.106 -    return session->ok;
   3.107 -}
   3.108 -
   3.109 -
   3.110 -bool
   3.111  xen_network_get_all(xen_session *session, struct xen_network_set **result)
   3.112  {
   3.113  
     4.1 --- a/tools/python/xen/xend/XendAPI.py	Sun Feb 25 23:45:39 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendAPI.py	Mon Feb 26 00:07:14 2007 +0000
     4.3 @@ -824,18 +824,13 @@ class XendAPI(object):
     4.4  
     4.5      network_attr_ro = ['VIFs', 'PIFs']
     4.6      network_attr_rw = ['name_label',
     4.7 -                       'name_description',
     4.8 -                       'default_gateway',
     4.9 -                       'default_netmask']
    4.10 +                       'name_description']
    4.11      
    4.12      network_funcs = [('create', 'network')]
    4.13      
    4.14 -    def network_create(self, _, name_label, name_description,
    4.15 -                       default_gateway, default_netmask):
    4.16 +    def network_create(self, _, name_label, name_description):
    4.17          return xen_api_success(
    4.18 -            XendNode.instance().network_create(name_label, name_description,
    4.19 -                                               default_gateway,
    4.20 -                                               default_netmask))
    4.21 +            XendNode.instance().network_create(name_label, name_description))
    4.22  
    4.23      def network_destroy(self, _, ref):
    4.24          return xen_api_success(XendNode.instance().network_destroy(ref))
    4.25 @@ -856,12 +851,6 @@ class XendAPI(object):
    4.26      def network_get_name_description(self, _, ref):
    4.27          return xen_api_success(self._get_network(ref).name_description)
    4.28  
    4.29 -    def network_get_default_gateway(self, _, ref):
    4.30 -        return xen_api_success(self._get_network(ref).default_gateway)
    4.31 -
    4.32 -    def network_get_default_netmask(self, _, ref):
    4.33 -        return xen_api_success(self._get_network(ref).default_netmask)
    4.34 -
    4.35      def network_get_VIFs(self, _, ref):
    4.36          return xen_api_success(self._get_network(ref).get_VIF_UUIDs())
    4.37  
    4.38 @@ -874,13 +863,6 @@ class XendAPI(object):
    4.39      def network_set_name_description(self, _, ref, val):
    4.40          return xen_api_success(self._get_network(ref).set_name_description(val))
    4.41  
    4.42 -    def network_set_default_gateway(self, _, ref, val):
    4.43 -        return xen_api_success(self._get_network(ref).set_default_gateway(val))
    4.44 -
    4.45 -    def network_set_default_netmask(self, _, ref, val):
    4.46 -        return xen_api_success(self._get_network(ref).set_default_netmask(val))
    4.47 -
    4.48 -
    4.49      # Xen API: Class PIF
    4.50      # ----------------------------------------------------------------
    4.51  
     5.1 --- a/tools/python/xen/xend/XendNetwork.py	Sun Feb 25 23:45:39 2007 +0000
     5.2 +++ b/tools/python/xen/xend/XendNetwork.py	Mon Feb 26 00:07:14 2007 +0000
     5.3 @@ -27,43 +27,11 @@ from XendLogging import log
     5.4  
     5.5  IP_ROUTE_RE = r'^default via ([\d\.]+) dev (\w+)'
     5.6  
     5.7 -def linux_get_default_network():
     5.8 -    """Returns the network details of the host."""
     5.9 -
    5.10 -    ip_cmd = '/sbin/ip route'
    5.11 -    rc, output = commands.getstatusoutput(ip_cmd)
    5.12 -    default_route = None
    5.13 -    default_dev = None
    5.14 -    default_netmask = None
    5.15 -    if rc == 0:
    5.16 -        # find default route/device
    5.17 -        for line in output.split('\n'):
    5.18 -            is_default = re.search(IP_ROUTE_RE, line)
    5.19 -            if is_default:
    5.20 -                default_route = is_default.group(1)
    5.21 -                default_dev = is_default.group(2)
    5.22 -
    5.23 -        # find network address and network mask
    5.24 -        if default_dev:
    5.25 -            dev_re = r'^([\d\.]+)/(\d+) dev %s' % default_dev
    5.26 -            for line in output.split('\n'):
    5.27 -                is_dev = re.search(dev_re, line)
    5.28 -                if is_dev:
    5.29 -                    # convert integer netmask to string representation
    5.30 -                    netmask = 0xffffffff ^ (2**(32-int(is_dev.group(2))) - 1)
    5.31 -                    packed = struct.pack('!I', netmask)
    5.32 -                    default_netmask = socket.inet_ntoa(packed)
    5.33 -
    5.34 -    return (default_route, default_netmask)
    5.35 -
    5.36 -
    5.37  class XendNetwork:
    5.38 -    def __init__(self, uuid, name, description, gateway, netmask):
    5.39 +    def __init__(self, uuid, name, description):
    5.40          self.uuid = uuid
    5.41          self.name_label = name 
    5.42          self.name_description = description
    5.43 -        self.default_gateway = gateway
    5.44 -        self.default_netmask = netmask
    5.45  
    5.46      def set_name_label(self, new_name):
    5.47          self.name_label = new_name
    5.48 @@ -73,16 +41,6 @@ class XendNetwork:
    5.49          self.name_description = new_desc
    5.50          XendNode.instance().save_networks()
    5.51  
    5.52 -    def set_default_gateway(self, new_gateway):
    5.53 -        if re.search('^\d+\.\d+\.\d+\.\d+$', new_gateway):
    5.54 -            self.default_gateway = new_gateway
    5.55 -            XendNode.instance().save_networks()
    5.56 -
    5.57 -    def set_default_netmask(self, new_netmask):
    5.58 -        if re.search('^\d+\.\d+\.\d+\.\d+$', new_netmask):
    5.59 -            self.default_netmask = new_netmask
    5.60 -            XendNode.instance().save_networks()
    5.61 -
    5.62      def get_VIF_UUIDs(self):
    5.63          result = []
    5.64          vms = XendDomain.instance().get_all_vms()
    5.65 @@ -103,8 +61,6 @@ class XendNetwork:
    5.66              'uuid': self.uuid,
    5.67              'name_label': self.name_label,
    5.68              'name_description': self.name_description,
    5.69 -            'default_gateway': self.default_gateway,
    5.70 -            'default_netmask': self.default_netmask,
    5.71          }
    5.72          if transient:
    5.73              result['VIFs'] = self.get_VIF_UUIDs()
     6.1 --- a/tools/python/xen/xend/XendNode.py	Sun Feb 25 23:45:39 2007 +0000
     6.2 +++ b/tools/python/xen/xend/XendNode.py	Mon Feb 26 00:07:14 2007 +0000
     6.3 @@ -109,12 +109,9 @@ class XendNode:
     6.4              for net_uuid, network in saved_networks.items():
     6.5                  self.network_create(network.get('name_label'),
     6.6                                      network.get('name_description', ''),
     6.7 -                                    network.get('default_gateway', ''),
     6.8 -                                    network.get('default_netmask', ''),
     6.9                                      False, net_uuid)
    6.10          else:
    6.11 -            gateway, netmask = linux_get_default_network()
    6.12 -            self.network_create('net0', '', gateway, netmask, False)
    6.13 +            self.network_create('net0', '', False)
    6.14  
    6.15          # initialise PIFs
    6.16          saved_pifs = self.state_store.load_state('pif')
    6.17 @@ -168,15 +165,12 @@ class XendNode:
    6.18  
    6.19  
    6.20  
    6.21 -    def network_create(self, name_label, name_description,
    6.22 -                       default_gateway, default_netmask, persist = True,
    6.23 +    def network_create(self, name_label, name_description, persist = True,
    6.24                         net_uuid = None):
    6.25          if net_uuid is None:
    6.26              net_uuid = uuid.createString()
    6.27          self.networks[net_uuid] = XendNetwork(net_uuid, name_label,
    6.28 -                                              name_description,
    6.29 -                                              default_gateway,
    6.30 -                                              default_netmask)
    6.31 +                                              name_description)
    6.32          if persist:
    6.33              self.save_networks()
    6.34          return net_uuid