~ubuntu-branches/ubuntu/maverick/eucalyptus/maverick

« back to all changes in this revision

Viewing changes to debian/patches/07-local_support_euca_conf-in.patch

  • Committer: Bazaar Package Importer
  • Author(s): Dave Walker (Daviey)
  • Date: 2010-07-21 17:27:10 UTC
  • mfrom: (1.1.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20100721172710-7xv07dmdqgivc3t9
Tags: 2.0~bzr1211-0ubuntu1
* New major upstream version merge, 2.0 (r1211).
* debian/patches/:
  - 01-wsdl-stubs.patch, debian/wsdl.md5sums: wsdl stubs updated.
  - 02-Makefile.patch: Updated to reflect new code layout.
  - 07-local_support_euca_conf-in.patch: Updated to reflect new code layout.
  - 08-ubuntu-default-networking.patch: Refreshed.
  - 09-small-128-192MB.patch: Updated to point to new location.
  - 10-disable-iscsi.patch: Refreshed.
  - 11-state-cleanup-memleakfix.patch: Removed, fixed upstream.
  - 15-fix-default-ramdisk.patch: Updated to point to new location.
  - 16-kvm_libvirt_xml_default_use_kvm.patch: Updated to reflect changes.
  - 17-fix_walrus_OOM_errors.patch: Removed, fixed upstream.
  - 18-priv_security.patch: Updated to reflect upstream changes.
  - 20-brute-force-webui.patch: Updated to reflect upstream changes. 
  - 21-eucalyptus-1.7-with-gwt-1.6.4.patch: New patch, allows 
    eucalyptus-1.7 to be built against gwt 1.6.4. Based on patch courtesy 
    of Dmitrii Zagorodnov, upstream. (LP: #597330)
* debian/eucalyptus-java-common.links: 
  - Changed symlink for groovy, point to groovy.all.jar, making compatiable 
    with groovy versions >1.7. (LP: #595421)
  - Added ant.jar & jetty-rewrite-handler.jar as they are now required.
* debian/control
  - & debian/build-jars: Added libjavassist-java and libjetty-extra-java as 
    build dependencies.
  - Added libjetty-extra-java as a dependency of eucalyptus-java-common
* The binary resulting jar's have been renamed from eucalyptus-*-1.6.2.jar
  to eucalyptus-*-main.jar:    
  - debian/eucalyptus-cc.upstart
  - debian/eucalyptus-cloud.install
  - debian/eucalyptus-common.eucalyptus.upstart
  - debian/eucalyptus-java-common.install
  - debian/eucalyptus-network.upstart
  - debian/eucalyptus-sc.install
  - debian/eucalyptus-walrus.install
* debian/eucalyptus-java-common.install: New upstream jars that have been
  installed:
  - eucalyptus-db-hsqldb-ext-main.jar
  - eucalyptus-component-main.jar
* debian/control:
  - Updated Standards Version to 3.8.4 (no change)
  - Updated the upstream Homepage to: http://open.eucalyptus.com/
  - Changed Vcs-Bzr to reflect new location of Ubuntu hosted development branch.
  - Made the Build Dependency of groovy and the binary eucalyptus-java-common
    package depend on version >=1.7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
 
172
172
 # first time setup
173
173
 if [ -n "$SETUP" ]; then
174
 
@@ -1333,6 +1369,23 @@
 
174
@@ -1338,6 +1374,23 @@
175
175
                        NODEMODE="ADD"
176
176
                fi
177
177
        fi
195
195
 
196
196
        # check we have a valid command
197
197
        if [ "$NODEMODE" != "ADD" -a "$NODEMODE" != "REM" ]; then
198
 
@@ -1356,25 +1409,27 @@
 
198
@@ -1361,7 +1414,7 @@
199
199
        # warn the user on where we expect the keys to be
200
200
        if [ "$NODEMODE" = "ADD" ]; then 
201
201
                echo
204
204
        fi
205
205
 
206
206
        # adding (or removing) nodes
207
 
        for NEWNODE in ${NEWNODES} ; do
208
 
                # remove is simpler: just remove the node name
209
 
                if [ "$NODEMODE" = "REM" ]; then
210
 
-                       if ! echo "$NODES"|grep "${NEWNODE}" > /dev/null ; then
211
 
+                       if ! xsearch "$NEWNODE" "$NODES"; then
212
 
                                echo "Node ${NEWNODE} is not known"
213
 
                                continue
214
 
                        fi
215
 
                        NODES="`echo $NODES|sed \"s/${NEWNODE}//\"|tr -s ' '`"
216
 
-                       change_var_value $FILE NODES "${NODES}"
217
 
-                       echo "SUCCESS: removed node '${NEWNODE}' from '$FILE'"
218
 
+                       echo "$NODES" | tr ' ' '\n' | uniq > $EUCALYPTUS/var/lib/eucalyptus/nodes.list
219
 
+#                      change_var_value $FILE NODES "${NODES}"
220
 
+                       echo "SUCCESS: removed node '${NEWNODE}'"
221
 
                        continue
222
 
                fi
223
 
 
224
 
                # let's sync keys with the nodes
225
 
                if ! sync_keys ${SOURCEDIR} ${DESTDIR} ${NEWNODE} node-cert.pem cluster-cert.pem node-pk.pem cloud-cert.pem; then
226
 
+                       errors=1
227
 
                        echo
228
 
                        echo "ERROR: could not synchronize keys with $NEWNODE!"
229
 
                        echo "The configuration will not have this node."
230
 
@@ -1394,10 +1449,11 @@
231
 
                fi
232
 
  
233
 
                # NODES list
234
 
-               if ! echo "${NODES}"|grep "${NEWNODE}" > /dev/null ; then
235
 
+               if ! xsearch "$NEWNODE" "$NODES"; then
236
 
                        # node is not present: we need to add it
237
 
                        NODES="${NODES} $NEWNODE"
238
 
-                       change_var_value $FILE NODES "${NODES}"
239
 
+                       echo "$NODES" | tr ' ' '\n' | uniq > $EUCALYPTUS/var/lib/eucalyptus/nodes.list
240
 
+                       # change_var_value $FILE NODES "${NODES}"
241
 
                fi
 
207
@@ -1388,13 +1441,14 @@
 
208
                     fi
 
209
                     NEW_NODES="$x $NEW_NODES"
 
210
                 done
 
211
-                change_var_value $FILE NODES "${NEW_NODES}"
 
212
+                echo "$NODES" | tr ' ' '\n' | uniq > $EUCALYPTUS/var/lib/eucalyptus/nodes.list
 
213
                 echo "SUCCESS: removed node '${NEWNODE}' from '$FILE'"
 
214
                 continue
 
215
             fi
 
216
            
 
217
            # let's sync keys with the nodes
 
218
            if ! sync_keys ${SOURCEDIR} ${DESTDIR} ${NEWNODE} node-cert.pem cluster-cert.pem node-pk.pem cloud-cert.pem; then
 
219
+               errors=1
 
220
                echo
 
221
                echo "ERROR: could not synchronize keys with $NEWNODE!"
 
222
                echo "The configuration will not have this node."
 
223
@@ -1420,7 +1474,7 @@
 
224
 
 
225
             # add the node
 
226
             NODES="${NODES} $NEWNODE"
 
227
-            change_var_value $FILE NODES "${NODES}"
 
228
+            echo "$NODES" | tr ' ' '\n' | uniq > $EUCALYPTUS/var/lib/eucalyptus/nodes.list
 
229
 
242
230
        done
243
231
 fi
244
 
@@ -1474,3 +1530,5 @@
 
232
@@ -1497,3 +1551,5 @@
245
233
                [ $to_start = "Y" ] && echo $x
246
234
        done | sort | uniq > $EUCALYPTUS/var/lib/eucalyptus/services
247
235
 fi
284
272
                    echo "Database upgrade failed! Please check your database before using Eucalyptus."
285
273
                    exit 1
286
274
                fi
 
275
--- a/util/eucalyptus.h
 
276
+++ b/util/eucalyptus.h
 
277
@@ -66,6 +66,7 @@
 
278
 /* file paths relative to $EUCALYPTUS */
 
279
 #define EUCALYPTUS_CONF_LOCATION   "%s/etc/eucalyptus/eucalyptus.conf"
 
280
 #define EUCALYPTUS_CONF_OVERRIDE_LOCATION   "%s/etc/eucalyptus/eucalyptus.local.conf"
 
281
+#define NODES_LIST_LOCATION   "%s/var/lib/eucalyptus/nodes.list"
 
282
 #define EUCALYPTUS_ROOTWRAP        "%s/usr/lib/eucalyptus/euca_rootwrap"
 
283
 #define EUCALYPTUS_ADD_KEY         "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/add_key.pl %s/usr/lib/eucalyptus/euca_mountwrap"
 
284
 #define EUCALYPTUS_GEN_LIBVIRT_XML "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/gen_libvirt_xml"
 
285
--- a/cluster/handlers.c
 
286
+++ b/cluster/handlers.c
 
287
@@ -2383,7 +2383,7 @@
 
288
 }
 
289
 
 
290
 int update_config(void) {
 
291
-  char home[MAX_PATH], *tmpstr=NULL;
 
292
+  char home[MAX_PATH], *tmpstr=NULL, nodesList[1024];
 
293
   ccResource *res=NULL;
 
294
   int rc, numHosts, ret;
 
295
   time_t configMtime;
 
296
@@ -2395,8 +2395,11 @@
 
297
   
 
298
   configMtime = 0;
 
299
   sem_mywait(CONFIG);
 
300
+
 
301
+  snprintf(nodesList, 1024, NODES_LIST_LOCATION, config->eucahome);
 
302
+
 
303
+  // stat the config file(s), update modification time
 
304
   for (i=0; i<2; i++) {
 
305
-    // stat the config file, update modification time
 
306
     rc = stat(config->configFiles[i], &statbuf);
 
307
     if (!rc) {
 
308
       if (statbuf.st_mtime > configMtime) {
 
309
@@ -2404,6 +2407,17 @@
 
310
       }
 
311
     }
 
312
   }
 
313
+
 
314
+  // check the external nodes list file, if it exists
 
315
+  if (!check_file(nodesList)) {
 
316
+    rc = stat(nodesList, &statbuf);
 
317
+    if (!rc) {
 
318
+      if (statbuf.st_mtime > configMtime) {
 
319
+       configMtime = statbuf.st_mtime;
 
320
+      }
 
321
+    }
 
322
+  }
 
323
+
 
324
   if (configMtime == 0) {
 
325
     logprintfl(EUCAERROR, "update_config(): could not stat config files (%s,%s)\n", config->configFiles[0], config->configFiles[1]);
 
326
     sem_mypost(CONFIG);
 
327
@@ -2952,10 +2966,13 @@
 
328
   char ncservice[512];
 
329
   int ncport;
 
330
   char **hosts;
 
331
+  char nodesFile[1024];
 
332
 
 
333
   *numHosts = 0;
 
334
   *res = NULL;
 
335
 
 
336
+  snprintf(nodesFile, 1024, NODES_LIST_LOCATION, config->eucahome);
 
337
+  
 
338
   tmpstr = getConfString(config->configFiles, 2, CONFIG_NC_SERVICE);
 
339
   if (!tmpstr) {
 
340
     // error
 
341
@@ -2980,7 +2997,14 @@
 
342
   }
 
343
   if (tmpstr) free(tmpstr);
 
344
 
 
345
-  tmpstr = getConfString(config->configFiles, 2, CONFIG_NODES);
 
346
+  if (!check_file(nodesFile)) {
 
347
+    // nodesFile exists, read list of nodes from nodesFile
 
348
+    tmpstr = file2str(nodesFile);
 
349
+  } else {
 
350
+    // otherwise, read NODES="..." from eucalyptus config file(s)
 
351
+    tmpstr = getConfString(config->configFiles, 2, CONFIG_NODES);
 
352
+  }
 
353
+  
 
354
   if (!tmpstr) {
 
355
     // error
 
356
     logprintfl(EUCAWARN,"refreshNodes(): NODES parameter is missing from config files(%s,%s)\n", config->configFiles[1], config->configFiles[0]);