~tritone-team/tritone/eucalyptus

« back to all changes in this revision

Viewing changes to cluster/handlers.c

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-01 21:09:28 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: james.westby@ubuntu.com-20091201210928-o2dvg0ubljhb0ft6
Tags: upstream-1.6.1~bzr1083
ImportĀ upstreamĀ versionĀ 1.6.1~bzr1083

Show diffs side-by-side

added added

removed removed

Lines of Context:
602
602
  print_instanceCache();
603
603
 
604
604
  *outServiceTags = malloc(sizeof(char *) * config->numResources);
605
 
  *outServiceTagsLen = config->numResources;
606
 
  for (i=0; i<config->numResources; i++) {
607
 
    (*outServiceTags)[i] = strdup(config->resourcePool[i].ncURL);
 
605
  if (*outServiceTags == NULL) {
 
606
      *outServiceTagsLen = 0;
 
607
       logprintfl(EUCAWARN,"cannot allocate outServiceTags\n");
 
608
  } else {
 
609
      *outServiceTagsLen = config->numResources;
 
610
      for (i=0; i<config->numResources; i++) {
 
611
        (*outServiceTags)[i] = strdup(config->resourcePool[i].ncURL);
 
612
        if ((*outServiceTags)[i] == NULL) 
 
613
           logprintfl(EUCAWARN,"not enough memory fot outServiceTags[%d]\n", i);
 
614
      }
608
615
  }
609
616
  
610
617
  *outTypesMax = NULL;
611
618
  *outTypesAvail = NULL;
612
619
  
613
620
  *outTypesMax = malloc(sizeof(int) * vmLen);
 
621
  *outTypesAvail = malloc(sizeof(int) * vmLen);
 
622
  if (*outTypesMax == NULL || *outTypesAvail == NULL) {
 
623
      logprintfl(EUCAERROR,"DescribeResources(): out of memory\n");
 
624
      if (*outTypesAvail) free(*outTypesAvail);
 
625
      if (*outTypesMax) free(*outTypesMax);
 
626
      *outTypesLen = 0;
 
627
      if (*outServiceTags) {
 
628
         for (i=0; i < config->numResources; i++) 
 
629
            if ((*outServiceTags)[i]) free((*outServiceTags)[i]);
 
630
         free(*outServiceTags);
 
631
      }
 
632
      *outServiceTags = NULL;
 
633
      *outServiceTagsLen = 0;
 
634
      return(1);
 
635
  }
614
636
  bzero(*outTypesMax, sizeof(int) * vmLen);
615
 
 
616
 
  *outTypesAvail = malloc(sizeof(int) * vmLen);
617
637
  bzero(*outTypesAvail, sizeof(int) * vmLen);
618
638
 
619
639
  *outTypesLen = vmLen;
624
644
      if (*outTypesAvail) free(*outTypesAvail);
625
645
      if (*outTypesMax) free(*outTypesMax);
626
646
      *outTypesLen = 0;
 
647
      if (*outServiceTags) {
 
648
         for (i=0; i < config->numResources; i++) 
 
649
            if ((*outServiceTags)[i]) free((*outServiceTags)[i]);
 
650
         free(*outServiceTags);
 
651
      }
 
652
      *outServiceTags = NULL;
 
653
      *outServiceTagsLen = 0;
627
654
      return(1);
628
655
    }
629
656
  }
728
755
      } else {
729
756
        close(filedes[1]);
730
757
        ncRes = malloc(sizeof(ncResource));
731
 
        bzero(ncRes, sizeof(ncResource));
732
 
        op_timer = timeout - (time(NULL) - op_start);
733
 
        logprintfl(EUCADEBUG, "\ttime left for next op: %d\n", op_timer);
734
 
        rc = timeread(filedes[0], ncRes, sizeof(ncResource), minint(op_timer / (config->numResources - i), OP_TIMEOUT_PERNODE));
735
 
        close(filedes[0]);
736
 
        if (rc <= 0) {
737
 
          // timeout or read went badly
 
758
        if (!ncRes) {
 
759
          logprintfl(EUCAERROR, "refresh_resources: out of memory\n");
738
760
          kill(pid, SIGKILL);
739
761
          wait(&status);
740
762
          rc = 1;
741
763
        } else {
742
 
          wait(&status);
743
 
          rc = WEXITSTATUS(status);
 
764
          bzero(ncRes, sizeof(ncResource));
 
765
          op_timer = timeout - (time(NULL) - op_start);
 
766
          logprintfl(EUCADEBUG, "\ttime left for next op: %d\n", op_timer);
 
767
          rc = timeread(filedes[0], ncRes, sizeof(ncResource), minint(op_timer / (config->numResources - i), OP_TIMEOUT_PERNODE));
 
768
          close(filedes[0]);
 
769
          if (rc <= 0) {
 
770
            // timeout or read went badly
 
771
            kill(pid, SIGKILL);
 
772
            wait(&status);
 
773
            rc = 1;
 
774
          } else {
 
775
            wait(&status);
 
776
            rc = WEXITSTATUS(status);
 
777
          }
744
778
        }
745
779
      }
746
780
      
944
978
            myInstance->networkIndex = -1;
945
979
            
946
980
            cacheInstance=NULL;
947
 
            find_instanceCacheId(ncOutInsts[j]->instanceId, &cacheInstance);
948
 
            if (cacheInstance) {
 
981
            if (!find_instanceCacheId(ncOutInsts[j]->instanceId, &cacheInstance)) {
949
982
              logprintfl(EUCADEBUG, "\t%s in cache\n", ncOutInsts[j]->instanceId);
950
983
              memcpy(myInstance, cacheInstance, sizeof(ccInstance));
951
984
            }
963
996
                  rc = mac2ip(vnetconfig, myInstance->ccnet.publicMac, &ip);
964
997
                  if (!rc) {
965
998
                    strncpy(myInstance->ccnet.publicIp, ip, 24);
 
999
                    free(ip);
966
1000
                  }
967
1001
                }
968
1002
              }
970
1004
                rc = mac2ip(vnetconfig, myInstance->ccnet.privateMac, &ip);
971
1005
                if (!rc) {
972
1006
                  strncpy(myInstance->ccnet.privateIp, ip, 24);
 
1007
                  free(ip);
973
1008
                }
974
1009
              }
975
1010
            }
978
1013
            logprintfl(EUCADEBUG, "returning instance state: %s/%s\n", myInstance->instanceId, myInstance->state);
979
1014
          }
980
1015
        }
981
 
        for (j=0; j<ncOutInstsLen; j++) {
982
 
          free_instance(&(ncOutInsts[j]));
983
 
        }
984
 
        if (ncOutInsts) free(ncOutInsts);
 
1016
      }
 
1017
      if (ncOutInsts) {
 
1018
        for (j=0; j<ncOutInstsLen; j++) {
 
1019
          free_instance(&(ncOutInsts[j]));
 
1020
        }
 
1021
        free(ncOutInsts);
 
1022
        ncOutInsts = NULL;
985
1023
      }
986
1024
    }
987
1025
  }
1094
1132
  strncpy(dst->keyName, src->keyName, 1024);
1095
1133
  strncpy(dst->launchIndex, src->launchIndex, 64);
1096
1134
  strncpy(dst->userData, src->userData, 64);
1097
 
  for (i=0; i<src->groupNamesSize || i >= 64; i++) {
 
1135
  for (i=0; i < src->groupNamesSize && i < 64; i++) {
1098
1136
    snprintf(dst->groupNames[i], 32, "%s", src->groupNames[i]);
1099
1137
  }
1100
1138
  strncpy(dst->state, src->stateName, 16);
1314
1352
  
1315
1353
  *outInstsLen = 0;
1316
1354
  
 
1355
  if (!ccvm) {
 
1356
    logprintfl(EUCAERROR,"RunInstances(): invalid ccvm\n");
 
1357
    return(-1);
 
1358
  }
1317
1359
  if (minCount <= 0 || maxCount <= 0 || instIdsLen < maxCount) {
1318
1360
    logprintfl(EUCAERROR,"RunInstances(): bad min or max count, or not enough instIds (%d, %d, %d)\n", minCount, maxCount, instIdsLen);
1319
1361
    return(-1);
1423
1465
          time_t startRun;
1424
1466
          ret=0;
1425
1467
          close(filedes[0]);
1426
 
          ncs = ncStubCreate(res->ncURL, NULL, NULL);
1427
 
          if (config->use_wssec) {
1428
 
            rc = InitWSSEC(ncs->env, ncs->stub, config->policyFile);
1429
 
          }
1430
1468
          logprintfl(EUCAINFO,"\tclient (%s) running instance: %s %s %s %s %d %s\n", res->ncURL, instId, amiId, mac, mac, vlan, keyName);
1431
1469
          logprintfl(EUCAINFO,"\tasking for virtual hardware (mem/disk/cores): %d/%d/%d\n", ncvm.memorySize, ncvm.diskSize, ncvm.numberOfCores);
1432
1470
          rc = 1;
1433
1471
          startRun = time(NULL);
1434
1472
          while(rc && ((time(NULL) - startRun) < config->wakeThresh)){
1435
 
            rc = ncStartNetworkStub(ncs, ccMeta, NULL, 0, 0, vlan, NULL);
 
1473
            int clientpid;
 
1474
 
 
1475
            // call StartNetwork client
 
1476
            clientpid = fork();
 
1477
            if (!clientpid) {
 
1478
             ncs = ncStubCreate(res->ncURL, NULL, NULL);
 
1479
             if (config->use_wssec) {
 
1480
               rc = InitWSSEC(ncs->env, ncs->stub, config->policyFile);
 
1481
             }
 
1482
             rc = ncStartNetworkStub(ncs, ccMeta, NULL, 0, 0, vlan, NULL);
 
1483
             exit(0);
 
1484
            } else {
 
1485
              rc = timewait(clientpid, &status, 30);
 
1486
            }
 
1487
 
 
1488
            // call RunInstances client
 
1489
            ncs = ncStubCreate(res->ncURL, NULL, NULL);
 
1490
            if (config->use_wssec) {
 
1491
              rc = InitWSSEC(ncs->env, ncs->stub, config->policyFile);
 
1492
            }
1436
1493
            rc = ncRunInstanceStub(ncs, ccMeta, instId, reservationId, &ncvm, amiId, amiURL, kernelId, kernelURL, ramdiskId, ramdiskURL, keyName, mac, mac, vlan, userData, launchIndex, netNames, netNamesLen, &outInst);
1437
1494
          }
1438
1495
          if (!rc) {
1439
 
            //rc = write(filedes[1], outInst, sizeof(ncInstance));
1440
1496
            ret = 0;
1441
1497
          } else {
1442
1498
            ret = 1;
1445
1501
          exit(ret);
1446
1502
        } else {
1447
1503
          close(filedes[1]);
1448
 
          //      outInst = malloc(sizeof(ncInstance));
1449
 
          op_timer = OP_TIMEOUT - (time(NULL) - op_start);
1450
 
          logprintfl(EUCADEBUG, "\ttime left for op: %d\n", op_timer / (maxCount - i));
1451
 
          //      rbytes = timeread(filedes[0], outInst, sizeof(ncInstance), op_timer / (maxCount - i));
1452
 
          rbytes = 1;
1453
1504
          close(filedes[0]);
1454
 
          if (rbytes <= 0) {
 
1505
          /*
 
1506
            op_timer = OP_TIMEOUT - (time(NULL) - op_start);
 
1507
            logprintfl(EUCADEBUG, "\ttime left for op: %d\n", op_timer / (maxCount - i));
 
1508
            rbytes = timeread(filedes[0], outInst, sizeof(ncInstance), op_timer / (maxCount - i));
 
1509
            rbytes = 1;
 
1510
            close(filedes[0]);
 
1511
            if (rbytes <= 0) {
1455
1512
            // read went badly
1456
1513
            kill(pid, SIGKILL);
1457
1514
            wait(&status);
1458
1515
            rc = -1;
1459
 
          } else {
 
1516
            } else {
1460
1517
            rc = 0;
1461
 
          }
 
1518
            }
 
1519
          */
 
1520
          rc = 0;
1462
1521
          logprintfl(EUCAINFO,"\tcall complete (pid/rc): %d/%d\n", pid, rc);
1463
1522
        }
1464
1523
        if (rc != 0) {
1484
1543
          allocate_ccInstance(myInstance, instId, amiId, kernelId, ramdiskId, amiURL, kernelURL, ramdiskURL, ownerId, "Pending", time(NULL), reservationId, &(myInstance->ccnet), &(myInstance->ccvm), myInstance->ncHostIdx, keyName, myInstance->serviceTag, userData, launchIndex, myInstance->groupNames, myInstance->volumes, myInstance->volumesSize, myInstance->networkIndex);
1485
1544
 
1486
1545
          // instance info that CC has
1487
 
          myInstance->networkIndex = thenidx;
 
1546
          if (thenidx >= 0) {
 
1547
            myInstance->networkIndex = networkIndexList[thenidx];
 
1548
          }
1488
1549
          myInstance->ts = time(NULL);
1489
1550
          if (strcmp(pubip, "0.0.0.0")) {
1490
1551
            strncpy(myInstance->ccnet.publicIp, pubip, 16);
1542
1603
  op_start = time(NULL);
1543
1604
  op_timer = OP_TIMEOUT;
1544
1605
 
 
1606
  consoleOutput = NULL;
1545
1607
  myInstance = NULL;
1546
1608
  
1547
1609
  *outConsoleOutput = NULL;
1764
1826
      
1765
1827
      sem_post(vnetConfigLock);
1766
1828
      
1767
 
      if (myInstance) free(myInstance);
 
1829
      free(myInstance);
1768
1830
    } else {
1769
1831
      start = 0;
1770
1832
      stop = config->numResources;
2087
2149
        sem_wait(configLock);
2088
2150
        config->numResources = numHosts;
2089
2151
        memcpy(config->resourcePool, res, sizeof(resource) * numHosts);
2090
 
        if (res) free(res);
 
2152
        free(res);
2091
2153
        sem_post(configLock);
2092
2154
      }
2093
2155
    }
2130
2192
    int initFail=0, len;
2131
2193
    
2132
2194
    // DHCP Daemon Configuration Params
2133
 
    daemon = NULL;
2134
2195
    daemon = getConfString(configFile, "VNET_DHCPDAEMON");
2135
2196
    if (!daemon) {
2136
2197
      logprintfl(EUCAWARN,"no VNET_DHCPDAEMON defined in config, using default\n");
2137
 
      daemon = NULL;
2138
2198
    }
2139
2199
    
2140
2200
    dhcpuser = getConfString(configFile, "VNET_DHCPUSER");
2141
2201
    if (!dhcpuser) {
2142
2202
      dhcpuser = strdup("root");
 
2203
      if (!dhcpuser)
 
2204
         logprintfl(EUCAWARN,"Out of memory\n");
2143
2205
    }
2144
2206
    
2145
2207
    pubmode = getConfString(configFile, "VNET_MODE");
2146
2208
    if (!pubmode) {
2147
2209
      logprintfl(EUCAWARN,"VNET_MODE is not defined, defaulting to 'SYSTEM'\n");
2148
2210
      pubmode = strdup("SYSTEM");
 
2211
      if (!pubmode)
 
2212
         logprintfl(EUCAWARN,"Out of memory\n");
2149
2213
    }
2150
2214
    
2151
2215
    {
2152
2216
      int usednew=0;
2153
2217
      
2154
 
      pubInterface = NULL;
2155
2218
      pubInterface = getConfString(configFile, "VNET_PUBINTERFACE");
2156
2219
      if (!pubInterface) {
2157
2220
        logprintfl(EUCAWARN,"VNET_PUBINTERFACE is not defined, defaulting to 'eth0'\n");
2173
2236
        tmpstr = getConfString(configFile, "VNET_INTERFACE");
2174
2237
        if (tmpstr) {
2175
2238
          logprintfl(EUCAWARN, "VNET_INTERFACE is deprecated, please use VNET_PUBINTERFACE and VNET_PRIVINTERFACE instead.  Will set both to value of VNET_INTERFACE (%s) for now.\n", tmpstr);
 
2239
          if (pubInterface) free(pubInterface);
2176
2240
          pubInterface = strdup(tmpstr);
 
2241
          if (privInterface) free(privInterface);
2177
2242
          privInterface = strdup(tmpstr);
2178
2243
        }
2179
2244
        if (tmpstr) free(tmpstr);
2180
2245
      }
2181
2246
    }
2182
2247
 
2183
 
    if (!strcmp(pubmode, "STATIC")) {
 
2248
    if (pubmode && !strcmp(pubmode, "STATIC")) {
2184
2249
      pubSubnet = getConfString(configFile, "VNET_SUBNET");
2185
2250
      pubSubnetMask = getConfString(configFile, "VNET_NETMASK");
2186
2251
      pubBroadcastAddress = getConfString(configFile, "VNET_BROADCAST");
2191
2256
      if (!pubSubnet || !pubSubnetMask || !pubBroadcastAddress || !pubRouter || !pubDNS || !pubmacmap) {
2192
2257
        logprintfl(EUCAFATAL,"in 'STATIC' network mode, you must specify values for 'VNET_SUBNET, VNET_NETMASK, VNET_BROADCAST, VNET_ROUTER, VNET_DNS, and VNET_MACMAP'\n");
2193
2258
        initFail = 1;
2194
 
      } else {
2195
2259
      }
2196
 
    } else if (!strcmp(pubmode, "MANAGED") || !strcmp(pubmode, "MANAGED-NOVLAN")) {
 
2260
    } else if (pubmode && (!strcmp(pubmode, "MANAGED") || !strcmp(pubmode, "MANAGED-NOVLAN"))) {
2197
2261
      numaddrs = getConfString(configFile, "VNET_ADDRSPERNET");
2198
2262
      pubSubnet = getConfString(configFile, "VNET_SUBNET");
2199
2263
      pubSubnetMask = getConfString(configFile, "VNET_NETMASK");
2213
2277
    
2214
2278
    if (initFail) {
2215
2279
      logprintfl(EUCAFATAL, "bad network parameters, must fix before system will work\n");
 
2280
      if (cloudIp) free(cloudIp);
 
2281
      if (pubSubnet) free(pubSubnet);
 
2282
      if (pubSubnetMask) free(pubSubnetMask);
 
2283
      if (pubBroadcastAddress) free(pubBroadcastAddress);
 
2284
      if (pubRouter) free(pubRouter);
 
2285
      if (pubDNS) free(pubDNS);
 
2286
      if (pubmacmap) free(pubmacmap);
 
2287
      if (numaddrs) free(numaddrs);
 
2288
      if (pubips) free(pubips);
 
2289
      if (localIp) free(localIp);
 
2290
      if (pubInterface) free(pubInterface);
 
2291
      if (privInterface) free(privInterface);
 
2292
      if (dhcpuser) free(dhcpuser);
 
2293
      if (daemon) free(daemon);
 
2294
      if (pubmode) free(pubmode);
2216
2295
      return(1);
2217
2296
    }
2218
2297
    
2219
2298
    sem_wait(vnetConfigLock);
2220
2299
    
2221
2300
    vnetInit(vnetconfig, pubmode, eucahome, netPath, CLC, pubInterface, privInterface, numaddrs, pubSubnet, pubSubnetMask, pubBroadcastAddress, pubDNS, pubRouter, daemon, dhcpuser, NULL, localIp, cloudIp);
 
2301
    if (cloudIp) free(cloudIp);
 
2302
    if (pubSubnet) free(pubSubnet);
 
2303
    if (pubSubnetMask) free(pubSubnetMask);
 
2304
    if (pubBroadcastAddress) free(pubBroadcastAddress);
 
2305
    if (pubDNS) free(pubDNS);
 
2306
    if (pubRouter) free(pubRouter);
 
2307
    if (numaddrs) free(numaddrs);
 
2308
    if (pubmode) free(pubmode);
 
2309
    if (dhcpuser) free(dhcpuser);
 
2310
    if (daemon) free(daemon);
 
2311
    if (privInterface) free(privInterface);
 
2312
    if (pubInterface) free(pubInterface);
2222
2313
    
2223
2314
    vnetAddDev(vnetconfig, vnetconfig->privInterface);
2224
2315
 
2235
2326
        toka = strtok_r(NULL, " ", &ptra);
2236
2327
      }
2237
2328
      vnetKickDHCP(vnetconfig);
 
2329
      free(pubmacmap);
2238
2330
    } else if (pubips) {
2239
2331
      char *ip, *ptra, *toka;
2240
2332
      toka = strtok_r(pubips, " ", &ptra);
2266
2358
        if (ips) free(ips);
2267
2359
        if (nms) free(nms);
2268
2360
      }
 
2361
      free(pubips);
2269
2362
    }
2270
2363
    
2271
2364
    //    vnetPrintNets(vnetconfig);
2277
2370
    // error
2278
2371
    logprintfl(EUCAWARN,"parsing config file (%s) for SCHEDPOLICY, defaulting to GREEDY\n", configFile);
2279
2372
    schedPolicy = SCHEDGREEDY;
 
2373
    tmpstr = NULL;
2280
2374
  } else {
2281
2375
    if (!strcmp(tmpstr, "GREEDY")) schedPolicy = SCHEDGREEDY;
2282
2376
    else if (!strcmp(tmpstr, "ROUNDROBIN")) schedPolicy = SCHEDROUNDROBIN;
2290
2384
  if (rc != 1) {
2291
2385
    logprintfl(EUCAWARN,"parsing config file (%s) for POWER_IDLETHRESH, defaulting to 300 seconds\n", configFile);
2292
2386
    idleThresh = 300;
 
2387
    tmpstr = NULL;
2293
2388
  } else {
2294
2389
    idleThresh = atoi(tmpstr);
2295
2390
    if (idleThresh < 300) {
2303
2398
  if (rc != 1) {
2304
2399
    logprintfl(EUCAWARN,"parsing config file (%s) for POWER_WAKETHRESH, defaulting to 300 seconds\n", configFile);
2305
2400
    wakeThresh = 300;
 
2401
    tmpstr = NULL;
2306
2402
  } else {
2307
2403
    wakeThresh = atoi(tmpstr);
2308
2404
    if (wakeThresh < 300) {
2313
2409
  if (tmpstr) free(tmpstr);
2314
2410
 
2315
2411
  // WS-Security
2316
 
  rc = get_conf_var(configFile, "ENABLE_WS_SECURITY", &tmpstr);
2317
 
  if (rc != 1) {
 
2412
  use_wssec = 0;
 
2413
  tmpstr = getConfString(configFile, "ENABLE_WS_SECURITY");
 
2414
  if (!tmpstr) {
2318
2415
    // error
2319
2416
    logprintfl(EUCAFATAL,"parsing config file (%s) for ENABLE_WS_SECURITY\n", configFile);
2320
2417
    return(1);
2321
2418
  } else {
2322
2419
    if (!strcmp(tmpstr, "Y")) {
2323
2420
      use_wssec = 1;
2324
 
    } else {
2325
 
      use_wssec = 0;
2326
2421
    }
2327
2422
  }
2328
2423
  if (tmpstr) free(tmpstr);
2427
2522
  }
2428
2523
  for (i=1; i<NUMBER_OF_PUBLIC_IPS; i++) {
2429
2524
    if (vnetconfig->publicips[i].allocated) {
2430
 
      snprintf(cmd, 255, "%s/usr/lib/eucalyptus/euca_rootwrap ip addr add %s/32 dev %s", config->eucahome, hex2dot(vnetconfig->publicips[i].ip), vnetconfig->pubInterface);
 
2525
      char *tmp;
 
2526
 
 
2527
      tmp = hex2dot(vnetconfig->publicips[i].ip);
 
2528
      snprintf(cmd, 255, "%s/usr/lib/eucalyptus/euca_rootwrap ip addr add %s/32 dev %s", config->eucahome, tmp, vnetconfig->pubInterface);
2431
2529
      logprintfl(EUCAINFO,"running cmd %s\n", cmd);
2432
2530
      rc = system(cmd);
2433
2531
      if (rc) {
2434
 
        logprintfl(EUCAWARN, "cannot add ip %s\n", hex2dot(vnetconfig->publicips[i].ip));
 
2532
        logprintfl(EUCAWARN, "cannot add ip %s\n", tmp);
2435
2533
      }
 
2534
      free(tmp);
2436
2535
    }
2437
2536
  }
2438
2537
 
2446
2545
      if (rc) {
2447
2546
        logprintfl(EUCADEBUG, "failed to reactivate network: %d", i);
2448
2547
      }
 
2548
      if (brname) free(brname);
2449
2549
    }
2450
2550
  }
2451
2551
  // get DHCPD back up and running
2484
2584
  rc = get_conf_var(configFile, CONFIG_NC_PORT, &tmpstr);
2485
2585
  if (rc != 1) {
2486
2586
    // error
 
2587
    free(ncservice);
2487
2588
    logprintfl(EUCAFATAL,"parsing config file (%s) for NC_PORT\n", configFile);
2488
2589
    return(1);
2489
2590
  } else {
2494
2595
  rc = get_conf_var(configFile, CONFIG_NODES, &tmpstr);
2495
2596
  if (rc != 1) {
2496
2597
    // error
 
2598
    free(ncservice);
2497
2599
    logprintfl(EUCAWARN,"NODES parameter is missing from (%s)\n", configFile);
2498
2600
    return(0);
2499
2601
  } else {
2500
2602
    hosts = from_var_to_char_list(tmpstr);
2501
2603
    if (hosts == NULL) {
 
2604
      free(ncservice);
2502
2605
      logprintfl(EUCAWARN, "NODES list is empty in configfile (%s)\n", configFile);
2503
2606
      if (tmpstr) free(tmpstr);
2504
2607
      return(0);
2527
2630
      i++;
2528
2631
    }
2529
2632
  }
 
2633
  free(ncservice);
2530
2634
  if (hosts) free(hosts);
2531
2635
  if (tmpstr) free(tmpstr);
2532
2636
  return(0);