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
ns-fog-1.22.9 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.8 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.7 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.6 lib/fog/opennebula/models/compute/server.rb
fog-1.23.0 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.4 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.3 lib/fog/opennebula/models/compute/server.rb
ns-fog-1.22.2 lib/fog/opennebula/models/compute/server.rb