~ubuntu-branches/ubuntu/lucid/eucalyptus/lucid-201003031429

« back to all changes in this revision

Viewing changes to clc/modules/cluster-manager/src/main/java/edu/ucsb/eucalyptus/cloud/cluster/VmInstance.java

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland, Thierry Carrez, Dustin Kirkland
  • Date: 2010-02-11 16:32:06 UTC
  • mfrom: (1.1.34 upstream)
  • Revision ID: james.westby@ubuntu.com-20100211163206-y1uh35xy3n19e2p5
Tags: 1.6.2~bzr1189-0ubuntu1
[ Thierry Carrez ]
* debian/rules: Start publication jobs on package install (LP: #504326)
* debian/*publication.upstart: Do not advertise Walrus, SC, CC or NC if
  eucalyptus authorized_keys is missing, since autoregistration would then
  partially fail (LP: #513722)

[ Dustin Kirkland ]
* Merge from upstream bzr revision, should fix:
  - LP: #453416 - fix metadata subdirectory lists
  - LP: #513842 - fix metadata ephemeral verbage

Show diffs side-by-side

added added

removed removed

Lines of Context:
314
314
  }
315
315
 
316
316
  public String getByKey( String path ) {
 
317
    Map<String, String> m = getMetadataMap( );
 
318
    if ( path == null ) path = "";
 
319
    LOG.debug( "Servicing metadata request:" + path + " -> " + m.get( path ) );
 
320
    if ( m.containsKey( path + "/" ) ) path += "/";
 
321
    return m.get( path ).replaceAll( "\n*\\z", "" );
 
322
  }
317
323
 
 
324
  private Map<String, String> getMetadataMap( ) {
318
325
    Map<String, String> m = new HashMap<String, String>( );
319
326
    m.put( "ami-id", this.getImageInfo( ).getImageId( ) );
320
327
    m.put( "product-codes", this.getImageInfo( ).getProductCodes( ).toString( ).replaceAll( "[\\Q[]\\E]", "" ).replaceAll( ", ", "\n" ) );
342
349
    m.put( "ramdisk-id", this.getImageInfo( ).getRamdiskId( ) );
343
350
    m.put( "security-groups", this.getNetworkNames( ).toString( ).replaceAll( "[\\Q[]\\E]", "" ).replaceAll( ", ", "\n" ) );
344
351
 
345
 
    m.put( "block-device-mapping/", "emi\nephemeral\nroot\nswap" );
 
352
    m.put( "block-device-mapping/", "emi\nephemeral0\nroot\nswap" );
346
353
    m.put( "block-device-mapping/emi", "sda1" );
347
354
    m.put( "block-device-mapping/ami", "sda1" );
348
355
    m.put( "block-device-mapping/ephemeral", "sda2" );
356
363
 
357
364
    m.put( "placement/", "availability-zone" );
358
365
    m.put( "placement/availability-zone", this.getPlacement( ) );
359
 
 
360
 
    if ( path == null ) path = "";
361
366
    String dir = "";
362
367
    for ( String entry : m.keySet( ) ) {
363
368
      if ( entry.contains( "/" ) && !entry.endsWith( "/" ) ) continue;
364
369
      dir += entry + "\n";
365
370
    }
366
371
    m.put( "", dir );
367
 
 
368
 
    LOG.debug( "Servicing metadata request:" + path + " -> " + m.get( path ) );
369
 
    if ( m.containsKey( path + "/" ) ) path += "/";
370
 
    return m.get( path ).replaceAll( "\n*\\z", "" );
 
372
    return m;
371
373
  }
372
374
 
373
375
  public int compareTo( final Object o ) {
436
438
    NetworkConfigType conf = getNetworkConfig( );
437
439
    return conf != null && !( DEFAULT_IP.equals(conf.getIgnoredPublicIp( )) || conf.getIpAddress( ).equals( conf.getIgnoredPublicIp( ) ) );
438
440
  }
 
441
 
439
442
}