Sha256: 4acc94d1b42c339f8e5251bc049009a6a031dd145e959be13e871beaec3e8746

Contents?: true

Size: 1.86 KB

Versions: 28

Compression:

Stored size: 1.86 KB

Contents

require 'fog/compute/models/server'

module Fog
  module Compute
    class OpenNebula
      class Server < Fog::Compute::Server
        identity :id
        attribute :template_str
        attribute :name
        attribute :uuid
        attribute :state
        attribute :status
        attribute :ip
        attribute :mac
        attribute :vcpu
        attribute :cpu
        attribute :memory
        attribute :user
        attribute :gid
        attribute :group
        attribute :onevm_object
        attribute :flavor

        def save
          merge_attributes(service.vm_allocate(attributes))
        end

        # only for integration in foreman
        # needed by formbuilder
        # should be handled by foreman and not by fog
        def vminterfaces
          []
        end

        # only for integration in foreman
        # needed by formbuilder
        # should be handled by foreman and not from by fog
        def vminterfaces_attributes=(attributes)
          true
        end

        def vm_ip_address
          ip
        end

        def private_ip_address
          ip
        end

        def public_ip_address
          ip
        end

        def vm_mac_address
          mac
        end

        def start
          if status == 4
            service.vm_resume(id)
          end
          true
        end	

        def stop
          Fog::Logger.warning("stop VM: ID:#{id}")
          service.vm_stop(id)
        end

        def destroy
          service.vm_destroy(id)
        end

        def ready?
          (status == 3) 
        end

        # only for integration in foreman
        # needed by formbuilder
        # should be handled by foreman and not by fog
        def template_id
          ""
        end

        def console_output
          requires :id
          service.get_vnc_console(id, "vnc", onevm_object)
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
fog-1.38.0 lib/fog/opennebula/models/compute/server.rb
fog-1.37.0 lib/fog/opennebula/models/compute/server.rb
fog-1.36.0 lib/fog/opennebula/models/compute/server.rb
fog-1.35.0 lib/fog/opennebula/models/compute/server.rb
fog-2.0.0.pre.0 lib/fog/opennebula/models/compute/server.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/opennebula/models/compute/server.rb
fog-1.34.0 lib/fog/opennebula/models/compute/server.rb
fog-1.33.0 lib/fog/opennebula/models/compute/server.rb
fog-1.32.0 lib/fog/opennebula/models/compute/server.rb
fog-1.31.0 lib/fog/opennebula/models/compute/server.rb
fog-1.30.0 lib/fog/opennebula/models/compute/server.rb
fog-1.29.0 lib/fog/opennebula/models/compute/server.rb
fog-1.28.0 lib/fog/opennebula/models/compute/server.rb
fog-1.27.0 lib/fog/opennebula/models/compute/server.rb
fog-1.26.0 lib/fog/opennebula/models/compute/server.rb
fog-1.25.0 lib/fog/opennebula/models/compute/server.rb
nsidc-fog-1.24.1 lib/fog/opennebula/models/compute/server.rb
fog-1.24.0 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.11 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.10 lib/fog/opennebula/models/compute/server.rb