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

« 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): 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:
1
 
/*******************************************************************************
2
 
 *Copyright (c) 2009 Eucalyptus Systems, Inc.
3
 
 * 
4
 
 * This program is free software: you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation, only version 3 of the License.
7
 
 * 
8
 
 * 
9
 
 * This file is distributed in the hope that it will be useful, but WITHOUT
10
 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
 
 * for more details.
13
 
 * 
14
 
 * You should have received a copy of the GNU General Public License along
15
 
 * with this program. If not, see <http://www.gnu.org/licenses/>.
16
 
 * 
17
 
 * Please contact Eucalyptus Systems, Inc., 130 Castilian
18
 
 * Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
19
 
 * if you need additional information or have any questions.
20
 
 * 
21
 
 * This file may incorporate work covered under the following copyright and
22
 
 * permission notice:
23
 
 * 
24
 
 * Software License Agreement (BSD License)
25
 
 * 
26
 
 * Copyright (c) 2008, Regents of the University of California
27
 
 * All rights reserved.
28
 
 * 
29
 
 * Redistribution and use of this software in source and binary forms, with
30
 
 * or without modification, are permitted provided that the following
31
 
 * conditions are met:
32
 
 * 
33
 
 * Redistributions of source code must retain the above copyright notice,
34
 
 * this list of conditions and the following disclaimer.
35
 
 * 
36
 
 * Redistributions in binary form must reproduce the above copyright
37
 
 * notice, this list of conditions and the following disclaimer in the
38
 
 * documentation and/or other materials provided with the distribution.
39
 
 * 
40
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
41
 
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
42
 
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43
 
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
44
 
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45
 
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
46
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
47
 
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
48
 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
49
 
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50
 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF
51
 
 * THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE
52
 
 * LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS
53
 
 * SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
54
 
 * IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA
55
 
 * BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN
56
 
 * THE REGENTS’ DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT
57
 
 * OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR
58
 
 * WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
59
 
 * ANY SUCH LICENSES OR RIGHTS.
60
 
 *******************************************************************************/
61
 
/*
62
 
 * Author: chris grzegorczyk <grze@eucalyptus.com>
63
 
 */
64
 
 
65
 
package edu.ucsb.eucalyptus.cloud.cluster;
66
 
 
67
 
import com.eucalyptus.bootstrap.Component;
68
 
import com.eucalyptus.util.EucalyptusProperties;
69
 
import com.eucalyptus.util.HasName;
70
 
import com.google.common.collect.Lists;
71
 
import edu.ucsb.eucalyptus.cloud.Network;
72
 
import edu.ucsb.eucalyptus.cloud.VmImageInfo;
73
 
import edu.ucsb.eucalyptus.cloud.VmKeyInfo;
74
 
import edu.ucsb.eucalyptus.constants.VmState;
75
 
import edu.ucsb.eucalyptus.msgs.AttachedVolume;
76
 
import edu.ucsb.eucalyptus.msgs.NetworkConfigType;
77
 
import edu.ucsb.eucalyptus.msgs.RunningInstancesItemType;
78
 
import edu.ucsb.eucalyptus.msgs.VmTypeInfo;
79
 
import org.apache.commons.lang.time.StopWatch;
80
 
import org.apache.log4j.Logger;
81
 
 
82
 
import java.util.ArrayList;
83
 
import java.util.Date;
84
 
import java.util.HashMap;
85
 
import java.util.List;
86
 
import java.util.Map;
87
 
 
88
 
public class VmInstance implements HasName {
89
 
  private static Logger        LOG         = Logger.getLogger( VmInstance.class );
90
 
 
91
 
  public static String         DEFAULT_IP  = "0.0.0.0";
92
 
  public static String         DEFAULT_TYPE  = "m1.small";
93
 
  private String               reservationId;
94
 
  private int                  launchIndex;
95
 
  private String               instanceId;
96
 
  private String               ownerId;
97
 
  private String               placement;
98
 
  private Date                 launchTime;
99
 
  private StopWatch            stopWatch;
100
 
  private volatile int                  networkIndex;
101
 
 
102
 
  private String               userData;
103
 
  private String               serviceTag;
104
 
  private String               reason;
105
 
  private VmImageInfo          imageInfo;
106
 
  private VmKeyInfo            keyInfo;
107
 
  private VmTypeInfo           vmTypeInfo;
108
 
  private List<Network>        networks    = Lists.newArrayList( );
109
 
  private VmState              state;
110
 
  private StringBuffer         consoleOutput;
111
 
  private List<AttachedVolume> volumes     = Lists.newArrayList( );
112
 
  private NetworkConfigType    networkConfig;
113
 
  private Boolean              privateNetwork;
114
 
  private List<String>         ancestorIds = Lists.newArrayList( );
115
 
 
116
 
  public VmInstance( ) {
117
 
    this.launchTime = new Date( );
118
 
    this.state = VmState.PENDING;
119
 
    this.networkConfig = new NetworkConfigType( );
120
 
    this.stopWatch = new StopWatch( );
121
 
    this.stopWatch.start( );
122
 
    this.consoleOutput = new StringBuffer( );
123
 
    this.volumes = new ArrayList<AttachedVolume>( );
124
 
  }
125
 
 
126
 
  public VmInstance( final String reservationId, final int launchIndex, final String instanceId, final String ownerId, final String placement, final String userData, final VmImageInfo imageInfo, final VmKeyInfo keyInfo, final VmTypeInfo vmTypeInfo, final List<Network> networks, String networkIndex ) {
127
 
    this( );
128
 
 
129
 
    this.reservationId = reservationId;
130
 
    this.launchIndex = launchIndex;
131
 
    this.instanceId = instanceId;
132
 
    this.ownerId = ownerId;
133
 
    this.placement = placement;
134
 
    this.userData = userData;
135
 
    this.imageInfo = imageInfo;
136
 
    this.keyInfo = keyInfo;
137
 
    this.vmTypeInfo = vmTypeInfo;
138
 
    this.networks = networks;
139
 
    this.networkIndex = Integer.parseInt( networkIndex );
140
 
    String mac = String.format( "%s:%s:%s:%s", this.instanceId.substring( 2, 4 ), this.instanceId.substring( 4, 6 ), this.instanceId.substring( 6, 8 ), this.instanceId.substring( 8, 10 ) );
141
 
    this.networkConfig.setMacAddress( "d0:0d:" + mac );
142
 
    this.networkConfig.setIgnoredMacAddress( "d0:0f:" + mac );
143
 
    this.networkConfig.setIpAddress( DEFAULT_IP );
144
 
    this.networkConfig.setIgnoredPublicIp( DEFAULT_IP );
145
 
  }
146
 
 
147
 
  public String getName( ) {
148
 
    return this.instanceId;
149
 
  }
150
 
  
151
 
  public boolean equals( Object o ) {
152
 
    if ( this == o ) return true;
153
 
    if ( o == null || getClass( ) != o.getClass( ) ) return false;
154
 
 
155
 
    VmInstance vmInstance = ( VmInstance ) o;
156
 
 
157
 
    if ( !instanceId.equals( vmInstance.instanceId ) ) return false;
158
 
 
159
 
    return true;
160
 
  }
161
 
 
162
 
  public void setLaunchTime( final Date launchTime ) {
163
 
    this.launchTime = launchTime;
164
 
  }
165
 
 
166
 
  public int hashCode( ) {
167
 
    return instanceId.hashCode( );
168
 
  }
169
 
 
170
 
  public String getReservationId( ) {
171
 
    return reservationId;
172
 
  }
173
 
 
174
 
  public String getInstanceId( ) {
175
 
    return instanceId;
176
 
  }
177
 
 
178
 
  public String getOwnerId( ) {
179
 
    return ownerId;
180
 
  }
181
 
 
182
 
  public int getLaunchIndex( ) {
183
 
    return launchIndex;
184
 
  }
185
 
 
186
 
  public String getPlacement( ) {
187
 
    return placement;
188
 
  }
189
 
 
190
 
  public Date getLaunchTime( ) {
191
 
    return launchTime;
192
 
  }
193
 
 
194
 
  public VmState getState( ) {
195
 
    return state;
196
 
  }
197
 
 
198
 
  public void setState( final VmState state ) {
199
 
    if ( this.getState( ) != null && !this.getState( ).equals( state ) ) {
200
 
      LOG.info( String.format( "%s state change: %s -> %s", this.getInstanceId( ), this.getState( ), state ) );
201
 
    }
202
 
    this.state = state;
203
 
  }
204
 
 
205
 
  public String getUserData( ) {
206
 
    return userData;
207
 
  }
208
 
 
209
 
  public void setUserData( final String userData ) {
210
 
    this.userData = userData;
211
 
  }
212
 
 
213
 
  public RunningInstancesItemType getAsRunningInstanceItemType( boolean dns ) {
214
 
    RunningInstancesItemType runningInstance = new RunningInstancesItemType( );
215
 
 
216
 
    runningInstance.setAmiLaunchIndex( Integer.toString( this.launchIndex ) );
217
 
    runningInstance.setStateCode( Integer.toString( this.state.getCode( ) ) );
218
 
    runningInstance.setStateName( this.state.getName( ) );
219
 
 
220
 
    runningInstance.setInstanceId( this.instanceId );
221
 
    runningInstance.setImageId( this.imageInfo.getImageId( ) );
222
 
    runningInstance.setKernel( this.imageInfo.getKernelId( ) );
223
 
    runningInstance.setRamdisk( this.imageInfo.getRamdiskId( ) );
224
 
    runningInstance.setProductCodes( this.imageInfo.getProductCodes( ) );
225
 
 
226
 
    if( dns ) {
227
 
      runningInstance.setDnsName( this.getNetworkConfig( ).getPublicDnsName( ) );
228
 
      runningInstance.setPrivateDnsName( this.getNetworkConfig( ).getPrivateDnsName( ) );
229
 
    } else {
230
 
      runningInstance.setPrivateDnsName( this.getNetworkConfig( ).getIpAddress( ) );
231
 
      if ( !VmInstance.DEFAULT_IP.equals( this.getNetworkConfig( ).getIgnoredPublicIp( ) ) ) {
232
 
        runningInstance.setDnsName( this.getNetworkConfig( ).getIgnoredPublicIp( ) );
233
 
      } else {
234
 
        runningInstance.setDnsName( this.getNetworkConfig( ).getIpAddress( ) );
235
 
      }
236
 
    } 
237
 
    if ( this.getReason( ) != null || !"".equals( this.getReason( ) ) ) runningInstance.setReason( this.getReason( ) );
238
 
 
239
 
    if ( this.getKeyInfo( ) != null ) runningInstance.setKeyName( this.getKeyInfo( ).getName( ) );
240
 
    else runningInstance.setKeyName( "" );
241
 
 
242
 
    runningInstance.setInstanceType( this.getVmTypeInfo( ).getName( ) );
243
 
    runningInstance.setPlacement( this.placement );
244
 
 
245
 
    runningInstance.setLaunchTime( this.launchTime );
246
 
 
247
 
    return runningInstance;
248
 
  }
249
 
 
250
 
 
251
 
 
252
 
  
253
 
  public VmKeyInfo getKeyInfo( ) {
254
 
    return keyInfo;
255
 
  }
256
 
 
257
 
  public void setKeyInfo( final VmKeyInfo keyInfo ) {
258
 
    this.keyInfo = keyInfo;
259
 
  }
260
 
 
261
 
  public VmTypeInfo getVmTypeInfo( ) {
262
 
    return vmTypeInfo;
263
 
  }
264
 
 
265
 
  public void setVmTypeInfo( final VmTypeInfo vmTypeInfo ) {
266
 
    this.vmTypeInfo = vmTypeInfo;
267
 
  }
268
 
 
269
 
  public List<Network> getNetworks( ) {
270
 
    return networks;
271
 
  }
272
 
 
273
 
  public List<String> getNetworkNames( ) {
274
 
    List<String> nets = new ArrayList<String>( );
275
 
    for ( Network net : this.getNetworks( ) )
276
 
      nets.add( net.getNetworkName( ) );
277
 
    return nets;
278
 
  }
279
 
 
280
 
  public void setNetworks( final List<Network> networks ) {
281
 
    this.networks = networks;
282
 
  }
283
 
 
284
 
  public NetworkConfigType getNetworkConfig( ) {
285
 
    return networkConfig;
286
 
  }
287
 
 
288
 
  public void setNetworkConfig( final NetworkConfigType networkConfig ) {
289
 
    this.networkConfig = networkConfig;
290
 
  }
291
 
 
292
 
  public VmImageInfo getImageInfo( ) {
293
 
    return imageInfo;
294
 
  }
295
 
 
296
 
  public void setImageInfo( final VmImageInfo imageInfo ) {
297
 
    this.imageInfo = imageInfo;
298
 
  }
299
 
 
300
 
  public List<AttachedVolume> getVolumes( ) {
301
 
    return volumes;
302
 
  }
303
 
 
304
 
  public void setVolumes( final List<AttachedVolume> volumes ) {
305
 
    this.volumes = volumes;
306
 
  }
307
 
 
308
 
  public List<String> getAncestorIds( ) {
309
 
    return ancestorIds;
310
 
  }
311
 
 
312
 
  public void setAncestorIds( final List<String> ancestorIds ) {
313
 
    this.ancestorIds = ancestorIds;
314
 
  }
315
 
 
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
 
  }
323
 
 
324
 
  private Map<String, String> getMetadataMap( ) {
325
 
    Map<String, String> m = new HashMap<String, String>( );
326
 
    m.put( "ami-id", this.getImageInfo( ).getImageId( ) );
327
 
    m.put( "product-codes", this.getImageInfo( ).getProductCodes( ).toString( ).replaceAll( "[\\Q[]\\E]", "" ).replaceAll( ", ", "\n" ) );
328
 
    m.put( "ami-launch-index", "" + this.getLaunchIndex( ) );
329
 
    m.put( "ancestor-ami-ids", this.getImageInfo( ).getAncestorIds( ).toString( ).replaceAll( "[\\Q[]\\E]", "" ).replaceAll( ", ", "\n" ) );
330
 
 
331
 
    m.put( "ami-manifest-path", this.getImageInfo( ).getImageLocation( ) );
332
 
    m.put( "hostname", this.getNetworkConfig( ).getIgnoredPublicIp( ) );
333
 
    m.put( "instance-id", this.getInstanceId( ) );
334
 
    m.put( "instance-type", this.getVmTypeInfo( ).getName( ) );
335
 
    if( Component.dns.isLocal( ) ) {
336
 
      m.put( "local-hostname", this.getNetworkConfig( ).getPrivateDnsName( ) );      
337
 
    } else {
338
 
      m.put( "local-hostname", this.getNetworkConfig( ).getIpAddress( ) );      
339
 
    }
340
 
    m.put( "local-ipv4", this.getNetworkConfig( ).getIpAddress( ) );
341
 
    if( Component.dns.isLocal( ) ) {
342
 
      m.put( "public-hostname", this.getNetworkConfig( ).getPublicDnsName( ) );
343
 
    } else {
344
 
      m.put( "public-hostname", this.getNetworkConfig( ).getIgnoredPublicIp( ) );
345
 
    }
346
 
    m.put( "public-ipv4", this.getNetworkConfig( ).getIgnoredPublicIp( ) );
347
 
    m.put( "reservation-id", this.getReservationId( ) );
348
 
    m.put( "kernel-id", this.getImageInfo( ).getKernelId( ) );
349
 
    if( this.getImageInfo( ).getRamdiskId( ) != null ) {
350
 
      m.put( "ramdisk-id", this.getImageInfo( ).getRamdiskId( ) );
351
 
    }
352
 
    m.put( "security-groups", this.getNetworkNames( ).toString( ).replaceAll( "[\\Q[]\\E]", "" ).replaceAll( ", ", "\n" ) );
353
 
 
354
 
    m.put( "block-device-mapping/", "emi\nephemeral0\nroot\nswap" );
355
 
    m.put( "block-device-mapping/emi", "sda1" );
356
 
    m.put( "block-device-mapping/ami", "sda1" );
357
 
    m.put( "block-device-mapping/ephemeral0", "sda2" );
358
 
    m.put( "block-device-mapping/swap", "sda3" );
359
 
    m.put( "block-device-mapping/root", "/dev/sda1" );
360
 
 
361
 
    m.put( "public-keys/", "0=" + this.getKeyInfo( ).getName( ) );
362
 
    m.put( "public-keys/0", "openssh-key" );
363
 
    m.put( "public-keys/0/", "openssh-key" );
364
 
    m.put( "public-keys/0/openssh-key", this.getKeyInfo( ).getValue( ) );
365
 
 
366
 
    m.put( "placement/", "availability-zone" );
367
 
    m.put( "placement/availability-zone", this.getPlacement( ) );
368
 
    String dir = "";
369
 
    for ( String entry : m.keySet( ) ) {
370
 
      if ( entry.contains( "/" ) && !entry.endsWith( "/" ) ) continue;
371
 
      if ( entry.equals("ramdisk-id") &&
372
 
           this.getImageInfo( ).getRamdiskId( ) == null ) {
373
 
        continue;
374
 
      }
375
 
      dir += entry + "\n";
376
 
    }
377
 
    m.put( "", dir );
378
 
    return m;
379
 
  }
380
 
 
381
 
  public int compareTo( final Object o ) {
382
 
    VmInstance that = ( VmInstance ) o;
383
 
    return this.getName( ).compareTo( that.getName( ) );
384
 
  }
385
 
 
386
 
  public synchronized long resetStopWatch( ) {
387
 
    this.stopWatch.stop( );
388
 
    long ret = this.stopWatch.getTime( );
389
 
    this.stopWatch.reset( );
390
 
    this.stopWatch.start( );
391
 
    return ret;
392
 
  }
393
 
 
394
 
  public synchronized long getSplitTime( ) {
395
 
    this.stopWatch.split( );
396
 
    long ret = this.stopWatch.getSplitTime( );
397
 
    this.stopWatch.unsplit( );
398
 
    return ret;
399
 
  }
400
 
 
401
 
  public String getReason( ) {
402
 
    return reason;
403
 
  }
404
 
 
405
 
  public void setReason( final String reason ) {
406
 
    this.reason = reason;
407
 
  }
408
 
 
409
 
  public StringBuffer getConsoleOutput( ) {
410
 
    return consoleOutput;
411
 
  }
412
 
 
413
 
  public void setConsoleOutput( final StringBuffer consoleOutput ) {
414
 
    this.consoleOutput = consoleOutput;
415
 
  }
416
 
 
417
 
  public int getNetworkIndex( ) {
418
 
    return networkIndex;
419
 
  }
420
 
 
421
 
  public void setNetworkIndex( int networkIndex ) {
422
 
    this.networkIndex = networkIndex;
423
 
  }
424
 
 
425
 
  @Override
426
 
  public String toString( ) {
427
 
    return String.format(
428
 
                          "VmInstance [imageInfo=%s, instanceId=%s, keyInfo=%s, launchIndex=%s, launchTime=%s, networkConfig=%s, networkIndex=%s, networks=%s, ownerId=%s, placement=%s, privateNetwork=%s, reason=%s, reservationId=%s, state=%s, stopWatch=%s, userData=%s, vmTypeInfo=%s, volumes=%s]",
429
 
                          this.imageInfo, this.instanceId, this.keyInfo, this.launchIndex, this.launchTime,
430
 
                          this.networkConfig, this.networkIndex, this.networks, this.ownerId, this.placement,
431
 
                          this.privateNetwork, this.reason, this.reservationId, this.state, this.stopWatch,
432
 
                          this.userData, this.vmTypeInfo, this.volumes );
433
 
  }
434
 
 
435
 
  public void setServiceTag( String serviceTag ) {
436
 
    this.serviceTag = serviceTag;
437
 
  }
438
 
 
439
 
  public String getServiceTag( ) {
440
 
    return serviceTag;
441
 
  }
442
 
 
443
 
  public boolean hasPublicAddress() {
444
 
    NetworkConfigType conf = getNetworkConfig( );
445
 
    return conf != null && !( DEFAULT_IP.equals(conf.getIgnoredPublicIp( )) || conf.getIpAddress( ).equals( conf.getIgnoredPublicIp( ) ) );
446
 
  }
447
 
 
448
 
}