Class: Fog::Compute::RackspaceV2::Server

Inherits:
Server
  • Object
show all
Defined in:
lib/fog/rackspace/models/compute_v2/server.rb

Constant Summary collapse

ACTIVE =

States

'ACTIVE'
BUILD =
'BUILD'
DELETED =
'DELETED'
ERROR =
'ERROR'
HARD_REBOOT =
'HARD_REBOOT'
MIGRATING =
'MIGRATING'
PASSWORD =
'PASSWORD'
REBOOT =
'REBOOT'
REBUILD =
'REBUILD'
RESCUE =
'RESCUE'
RESIZE =
'RESIZE'
REVERT_RESIZE =
'REVERT_RESIZE'
SUSPENDED =
'SUSPENDED'
UNKNOWN =
'UNKNOWN'
VERIFY_RESIZE =
'VERIFY_RESIZE'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Server

Returns a new instance of Server.



177
178
179
180
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 177

def initialize(attributes={})
  @service = attributes[:service]
  super
end

Instance Attribute Details

#addressHash<String, Array[Hash]> (readonly)

Returns IP addresses allocated for server by network.

Examples:

{
   "public" => [
        {"version"=>4, "addr"=>"166.78.105.63"},
        {"version"=>6, "addr"=>"2001:4801:7817:0072:0fe1:75e8:ff10:61a9"}
               ],
  "private"=> [{"version"=>4, "addr"=>"10.177.18.209"}]
}

Returns:

  • (Hash<String, Array[Hash]>)

    IP addresses allocated for server by network



139
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 139

attribute :addresses

#bandwidthArray (readonly)

Returns The amount of bandwidth used for the specified audit period.

Returns:

  • (Array)

    The amount of bandwidth used for the specified audit period.

See Also:



127
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 127

attribute :bandwidth, :aliases => 'rax-bandwidth:bandwidth'

#boot_image_id=(value) ⇒ String (writeonly)

Returns The ID of an image to create a bootable volume from.

Returns:

  • (String)

    The ID of an image to create a bootable volume from.

See Also:



164
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 164

attribute :boot_image_id

#boot_volume_id=(value) ⇒ String (writeonly)

Returns The ID of a bootable volume from the BlockStorage service.

Returns:

  • (String)

    The ID of a bootable volume from the BlockStorage service.

See Also:



154
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 154

attribute :boot_volume_id

#boot_volume_size=(value) ⇒ Integer (writeonly)

Returns The Size of the boot volume to be created by the BlockStorage service.

Returns:

  • (Integer)

    The Size of the boot volume to be created by the BlockStorage service.

See Also:



159
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 159

attribute :boot_volume_size

#config_drive_extBoolean

Returns whether a read-only configuration drive is attached.

Returns:

  • (Boolean)

    whether a read-only configuration drive is attached

See Also:



117
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 117

attribute :config_drive

#createdString (readonly)

Returns The time stamp for the creation date.

Returns:

  • (String)

    The time stamp for the creation date.



36
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 36

attribute :created

#disk_configString<AUTO, MANUAL>

The disk configuration value.

* AUTO -   The server is built with a single partition the size of the target flavor disk. The file system is automatically adjusted to fit the entire partition.
           This keeps things simple and automated. AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
           This is the default setting for applicable Rackspace base images.

* MANUAL - The server is built using whatever partition scheme and file system is in the source image. If the target flavor disk is larger,
           the remaining disk space is left unpartitioned. This enables images to have non-EXT3 file systems, multiple partitions,
           and so on, and enables you to manage the disk configuration.

Returns:

  • (String<AUTO, MANUAL>)

    The disk configuration value.

See Also:



112
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 112

attribute :disk_config, :aliases => 'OS-DCF:diskConfig'

#flavor_idString (readonly)

Returns The flavor Id.



144
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 144

attribute :flavor_id, :aliases => 'flavor', :squash => 'id'

#host Id(Id) ⇒ Object (readonly)

The host Id. The compute provisioning algorithm has an anti-affinity property that attempts to spread customer VMs across hosts. Under certain situations, VMs from the same customer might be placed on the same host. hostId represents the host your server runs on and can be used to determine this scenario if it is relevant to your application. HostId is unique per account and is not globally unique.



49
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 49

attribute :host_id, :aliases => 'hostId'

#idString (readonly)

Returns The server id.

Returns:

  • (String)

    The server id



28
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 28

identity :id

#image_idString (readonly)

Returns The image Id.



149
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 149

attribute :image_id, :aliases => 'image', :squash => 'id'

#ipv4_addressString Also known as: access_ipv4_address

Note:

This field will populate once the server is ready to use.

Returns The public IP version 4 access address.

Returns:

  • (String)

    The public IP version 4 access address.

See Also:



92
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 92

attribute :ipv4_address, :aliases => 'accessIPv4'

#ipv6_addressString Also known as: access_ipv6_address

Note:

This field will populate once the server is ready to use.

Returns The public IP version 6 access address.

Returns:

  • (String)

    The public IP version 6 access address.

See Also:



98
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 98

attribute :ipv6_address, :aliases => 'accessIPv6'

#key_nameString

Note:

The key_pair/key_name is used to specify the keypair used for server creation. It is not populated by cloud servers.

Returns The name of the key_pair used for server.

Returns:

  • (String)

    The name of the key_pair used for server.



175
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 175

attribute :key_name

Returns Server links.

Returns:

  • (Array)

    Server links.



75
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 75

attribute :links

#nameString

Returns The server name.

Returns:

  • (String)

    The server name.



32
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 32

attribute :name

#passwordString

Note:

Can be set while creating a server, but use change_admin_password instead of save/update for changes.

Returns Password for system adminstrator account.

Returns:

  • (String)

    Password for system adminstrator account.

See Also:



170
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 170

attribute :password

#personalityHash

Note:

This attribute is only used for server creation. This field will be nil on subsequent retrievals.

Returns Hash containing data to inject into the file system of the cloud server instance during server creation.

Examples:

To inject fog.txt into file system

:personality => [{ :path => '/root/fog.txt',
                   :contents => Base64.encode64('Fog was here!')
                }]

Returns:

  • (Hash)

    Hash containing data to inject into the file system of the cloud server instance during server creation.

See Also:



86
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 86

attribute :personality

#progressFixnum (readonly)

Returns The build completion progress, as a percentage. Value is from 0 to 100.

Returns:

  • (Fixnum)

    The build completion progress, as a percentage. Value is from 0 to 100.



63
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 63

attribute :progress

#stateString (readonly)

Returns server status.



54
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 54

attribute :state, :aliases => 'status'

#state_extString (readonly)

Returns server (extended) status.



59
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 59

attribute :state_ext, :aliases => 'OS-EXT-STS:task_state'

#tenant_idString (readonly)

Returns The tenant Id.

Returns:

  • (String)

    The tenant Id.



71
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 71

attribute :tenant_id

#updatedString (readonly)

Returns The time stamp for the last update.

Returns:

  • (String)

    The time stamp for the last update.



40
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 40

attribute :updated

#user_dataBoolean

Returns User-data.



122
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 122

attribute :user_data

#user_idString (readonly)

Returns The user Id.

Returns:

  • (String)

    The user Id.



67
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 67

attribute :user_id

Instance Method Details

#attach_volume(volume, device = nil) ⇒ Fog::Compute::RackspaceV2::Attachment

Attaches Cloud Block Volume

Parameters:

Returns:

Raises:

See Also:



400
401
402
403
404
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 400

def attach_volume(volume, device=nil)
  requires :identity
  volume_id = volume.is_a?(String) ? volume : volume.id
  attachments.create(:server_id => identity, :volume_id => volume_id, :device => device)
end

#attachmentsFog::Compute::RackspaceV2::Attachments

Attached Cloud Block Volumes



382
383
384
385
386
387
388
389
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 382

def attachments
  @attachments ||= begin
    Fog::Compute::RackspaceV2::Attachments.new({
      :service => service,
      :server => self
    })
  end
end

#change_admin_password(password) ⇒ Boolean

Note:

Though Rackspace does not enforce complexity requirements for the password, the operating system might. If the password is not complex enough, the server might enter an ERROR state.

Change admin password

  • Status Transition:

    • ACTIVE -> PASSWORD -> ACTIVE

    • ACTIVE -> PASSWORD -> ERROR (on error)

Parameters:

  • password (String)

    The administrator password.

Returns:

  • (Boolean)

    returns true if operation was scheduled

Raises:

See Also:



613
614
615
616
617
618
619
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 613

def change_admin_password(password)
  requires :identity
  service.change_server_password(identity, password)
  self.state = PASSWORD
  self.password = password
  true
end

#confirm_resizeObject

  • VERIFY_RESIZE -> ERROR (on error)å



504
505
506
507
508
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 504

def confirm_resize
  requires :identity
  service.confirm_resize_server(identity)
  true
end

#create(options) ⇒ Boolean

Note:

You should use servers.create to create servers instead calling this method directly

Creates server

  • requires attributes: service:, :name, :image_id, and :flavor_id

  • optional attributes :disk_config, :metadata, :personality, :config_drive, :boot_volume_id, :boot_image_id

  • :image_id should be “” if :boot_volume_id or :boot_image_id are provided.

  • State Transitions

    • BUILD -> ACTIVE

    • BUILD -> ERROR (on error)

Returns:

  • (Boolean)

    returns true if server is being created

Raises:

See Also:



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 253

def create(options)
  requires :name, :image_id, :flavor_id
  modified_options = Marshal.load(Marshal.dump(options))

  if attributes[:keypair]
    Fog::Logger.deprecation(":keypair has been depreciated. Please use :key_name instead.")
    modified_options[:key_name] = attributes[:keypair]
  end

  modified_options[:password] ||= attributes[:password] unless password.nil?
  modified_options[:networks] ||= attributes[:networks]
  modified_options[:disk_config] = disk_config unless disk_config.nil?
  modified_options[:metadata] = .to_hash unless @metadata.nil?
  modified_options[:personality] = personality unless personality.nil?
  modified_options[:config_drive] = config_drive unless config_drive.nil?
  modified_options[:user_data] = user_data_encoded unless user_data_encoded.nil?
  modified_options[:key_name] ||= attributes[:key_name]
  modified_options[:boot_volume_id] ||= attributes[:boot_volume_id]
  modified_options[:boot_image_id] ||= attributes[:boot_image_id]
  modified_options[:boot_volume_size] ||= attributes[:boot_volume_size]

  if mn = modified_options[:networks]
    # If we've already processed it into the correct form don't process again.
    unless mn.first.is_a?(Hash)
      modified_options[:networks].map! { |id| { :uuid => id } }
    end
  end

  data = service.create_server(name, image_id, flavor_id, 1, 1, modified_options)
  merge_attributes(data.body['server'])
  true
end

#create_image(name, options = {}) ⇒ Fog::ComputeRackspaceV2::Image

Creates Image from server. Once complete, a new image is available that you can use to rebuild or create servers.

  • State Transition:

    • SAVING -> ACTIVE

    • SAVING -> ERROR (on error)

Parameters:

  • name (String)

    name of image to create

  • options (Hash) (defaults to: {})

    :

Options Hash (options):

  • metadata (Hash<String, String>)

    hash of containing metadata key value pairs.

Returns:

  • (Fog::ComputeRackspaceV2::Image)

    image being created

Raises:

See Also:



364
365
366
367
368
369
370
371
372
373
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 364

def create_image(name, options = {})
  requires :identity
  response = service.create_image(identity, name, options)
  begin
    image_id = response.headers["Location"].match(/\/([^\/]+$)/)[1]
    Fog::Compute::RackspaceV2::Image.new(:collection => service.images, :service => service, :id => image_id)
  rescue
    nil
  end
end

#destroyBoolean

Destroy the server

  • Status Transition:

    • ACTIVE -> DELETED

    • ERROR -> DELETED

Returns:

  • (Boolean)

    returns true if server has started deleting

Raises:

See Also:



322
323
324
325
326
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 322

def destroy
  requires :identity
  service.delete_server(identity)
  true
end

#flavorFog::Compute::RackspaceV2::Flavor

Server flavor

Returns:

Raises:



334
335
336
337
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 334

def flavor
  requires :flavor_id
  @flavor ||= service.flavors.get(flavor_id)
end

#get_vnc_console(console_type = "xvpvnc") ⇒ String

Note:

This URL will time out due to inactivity

VNC Console URL

Parameters:

  • Type (String)

    of vnc console to get (‘novnc’ or ‘xvpvnc’)

Returns:

  • (String)

    returns URL to vnc console

Raises:



665
666
667
668
669
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 665

def get_vnc_console(console_type = "xvpvnc")
  requires :identity
  data = service.get_vnc_console(identity, console_type)
  data.body['console']['url']
end

#imageFog::Compute::RackspaceV2::Image

Server image

Returns:

Raises:



345
346
347
348
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 345

def image
  requires :image_id
  @image ||= service.images.get(image_id)
end

#key_pairKeyPair

Note:

The key_pair/key_name is used to specify the keypair used for server creation. It is not populated by cloud servers.

Returns the key pair based on the key_name of the server

Returns:



207
208
209
210
211
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 207

def key_pair
  requires :key_name

  service.key_pairs.get(key_name)
end

#key_pair=(new_keypair) ⇒ Object

Note:

The key_pair/key_name is used to specify the keypair used for server creation. It is not populated by cloud servers.

Sets the key_pair used by the server.

Parameters:

  • new_keypair (KeyPair)

    key_pair object for server



216
217
218
219
220
221
222
223
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 216

def key_pair=(new_keypair)
  if new_keypair.is_a?(String)
     Fog::Logger.deprecation("#key_pair= should be used to set KeyPair objects. Please use #key_name method instead")
    self.key_name = new_keypair
  else
    self.key_name = new_keypair && new_keypair.name
  end
end

#metadataFog::Compute::RackspaceV2::Metadata

Server metadata

Returns:



189
190
191
192
193
194
195
196
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 189

def 
  @metadata ||= begin
    Fog::Compute::RackspaceV2::Metadata.new({
      :service => service,
      :parent => self
    })
  end
end

#metadata=(hash = {}) ⇒ Object

Set server metadata

Parameters:

  • hash (Hash) (defaults to: {})

    contains key value pairs



200
201
202
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 200

def metadata=(hash={})
  .from_hash(hash)
end

#private_ip_addressString

Server’s private IPv4 address

Returns:

  • (String)

    private IPv4 address



408
409
410
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 408

def private_ip_address
  addresses['private'].select{|a| a["version"] == 4}[0]["addr"] rescue ''
end

#public_ip_addressString

Server’s public IPv4 address

Returns:

  • (String)

    public IPv4 address



414
415
416
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 414

def public_ip_address
  ipv4_address
end

#ready?(ready_state = ACTIVE, error_states = [ERROR]) ⇒ Boolean

Is server is in ready state

Parameters:

  • ready_state (String) (defaults to: ACTIVE)

    By default state is ACTIVE

  • error_states (Array, String) (defaults to: [ERROR])

    By default state is ERROR

Returns:

  • (Boolean)

    returns true if server is in a ready state

Raises:



423
424
425
426
427
428
429
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 423

def ready?(ready_state = ACTIVE, error_states=[ERROR])
  if error_states
    error_states = Array(error_states)
    raise InvalidServerStateException.new(ready_state, state) if error_states.include?(state)
  end
  state == ready_state
end

#reboot(type = 'SOFT') ⇒ Boolean

Reboot server

  • State transition:

    • ACTIVE -> REBOOT -> ACTIVE (soft reboot)

    • ACTIVE -> HARD_REBOOT -> ACTIVE (hard reboot)

Parameters:

  • type (String<SOFT, HARD>) (defaults to: 'SOFT')

    ‘SOFT’ will do a soft reboot. ‘HARD’ will do a hard reboot.

Returns:

  • (Boolean)

    returns true if server is being rebooted

Raises:

See Also:



443
444
445
446
447
448
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 443

def reboot(type = 'SOFT')
  requires :identity
  service.reboot_server(identity, type)
  self.state = type == 'SOFT' ? REBOOT : HARD_REBOOT
  true
end

#rebuild(image_id, options = {}) ⇒ Boolean

Rebuild removes all data on the server and replaces it with the specified image. The id and all IP addresses remain the same.

  • Status Transition:

    • ACTIVE -> REBUILD -> ACTIVE

    • ACTIVE -> REBUILD -> ERROR (on error)

Parameters:

  • image_id (String)

    image to use for rebuild

Returns:

  • (Boolean)

    returns true if rebuild is in process

Raises:

See Also:



462
463
464
465
466
467
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 462

def rebuild(image_id, options={})
  requires :identity
  service.rebuild_server(identity, image_id, options)
  self.state = REBUILD
  true
end

#rescueBoolean

Note:

Rescue mode is only guaranteed to be active for 90 minutes.

Place existing server into rescue mode, allowing for offline editing of configuration. The original server’s disk is attached to a new instance of the same base image for a period of time to facilitate working within rescue mode. The original server will be automatically restored after 90 minutes.

  • Status Transition:

    • ACTIVE -> PREP_RESCUE -> RESCUE

Returns:

  • (Boolean)

    returns true if call to put server in rescue mode reports success

Raises:

See Also:



574
575
576
577
578
579
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 574

def rescue
  requires :identity
  data = service.rescue_server(identity)
  merge_attributes(data.body)
  true
end

#resize(flavor_id) ⇒ Boolean

Note:

All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.

Resize existing server to a different flavor, in essence, scaling the server up or down. The original server is saved for a period of time to allow rollback if there is a problem. All resizes should be tested and explicitly confirmed, at which time the original server is removed. All resizes are automatically confirmed after 24 hours if they are not confirmed or reverted.

  • Status Transition:

    • ACTIVE -> QUEUE_RESIZE -> PREP_RESIZE -> VERIFY_RESIZE

    • ACTIVE -> QUEUE_RESIZE -> ACTIVE (on error)

Parameters:

  • flavor_id (String)

    to resize

Returns:

  • (Boolean)

    returns true if resize is in process

Raises:

See Also:



484
485
486
487
488
489
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 484

def resize(flavor_id)
  requires :identity
  service.resize_server(identity, flavor_id)
  self.state = RESIZE
  true
end

#revert_resizeBoolean

Note:

All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.

Reverts server resize operation

  • Status Transition:

    • VERIFY_RESIZE -> ACTIVE

    • VERIFY_RESIZE -> ERROR (on error)

Returns:

  • (Boolean)

    returns true if resize is being reverted

Raises:

See Also:



523
524
525
526
527
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 523

def revert_resize
  requires :identity
  service.revert_resize_server(identity)
  true
end

#save(options = {}) ⇒ Boolean

Saves the server. Creates server if it is new, otherwise it will update server attributes name, accessIPv4, and accessIPv6.

Returns:

  • (Boolean)

    true if server has started saving



228
229
230
231
232
233
234
235
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 228

def save(options = {})
  if persisted?
    update
  else
    create(options)
  end
  true
end

#setup(credentials = {}) ⇒ Object

Setup server for SSH access



623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 623

def setup(credentials = {})
  requires :ssh_ip_address, :identity, :public_key, :username

  retried_disconnect = false

  commands = [
    %{mkdir .ssh},
    %{echo "#{public_key}" >> ~/.ssh/authorized_keys},
    password_lock,
    %{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json},
    %{echo "#{Fog::JSON.encode()}" >> ~/metadata.json}
  ]
  commands.compact

  self.password = nil if password_lock

  Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
rescue Errno::ECONNREFUSED
  sleep(1)
  retry
# Ubuntu 12.04 images seem to be disconnecting during the ssh setup process.
# This rescue block is an effort to address that issue.
rescue Net::SSH::Disconnect
  unless retried_disconnect
    retried_disconnect = true
    sleep(1)
    retry
  end
end

#startBoolean

Note:

Rescue mode is only guaranteed to be active for 90 minutes

This operation starts a stopped server, and changes its status to ACTIVE. Prior to running this command, the server status must be SHUTTOFF

Parameters:

  • server_id (String)

    id of server to rescue

Returns:

  • (Boolean)

    returns true if call to put server in ACTIVE mode reports success

Raises:

See Also:



539
540
541
542
543
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 539

def start
  requires :identity
  service.start_server(identity)
  true
end

#stopBoolean

Note:

Rescue mode is only guaranteed to be active for 90 minutes

This operation stops a running server, and changes the server status to SHUTOFF and changes the clean_shutdown parameter to TRUE. Prior to running this command, the server status must be ACTIVE or ERROR.

Parameters:

  • server_id (String)

    id of server to rescue

Returns:

  • (Boolean)

    returns true if call to put server in SHUTOFF mode reports success

Raises:

See Also:



556
557
558
559
560
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 556

def stop
  requires :identity
  service.stop_server(identity)
  true
end

#unrescueBoolean

Note:

Rescue mode is only guaranteed to be active for 90 minutes.

Remove existing server from rescue mode.

  • Status Transition:

    • PREP_UNRESCUE -> ACTIVE

Returns:

  • (Boolean)

    returns true if call to remove server from rescue mode reports success

Raises:

See Also:



593
594
595
596
597
598
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 593

def unrescue
  requires :identity
  service.unrescue_server(identity)
  self.state = ACTIVE
  true
end

#updateObject

Note:

If you edit the server name, the server host name does not change. Also, server names are not guaranteed to be unique.

Updates server This will update :name, :accessIPv4, and :accessIPv6 attributes.

  • State Transition

    • ACTIVE -> ACTIVE

Returns:

  • true if update has started updating

Raises:

See Also:



298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 298

def update
  requires :identity
  options = {
    'name' => name,
    'accessIPv4' => ipv4_address,
    'accessIPv6' => ipv6_address
  }

  data = service.update_server(identity, options)
  merge_attributes(data.body['server'])
  true
end

#virtual_interfacesObject



653
654
655
# File 'lib/fog/rackspace/models/compute_v2/server.rb', line 653

def virtual_interfaces
  @virtual_interfaces ||= Fog::Compute::RackspaceV2::VirtualInterfaces.new :server => self, :service => service
end