add_interface(attrs)
click to toggle source
def add_interface attrs
wait_for { stopped? } if attrs[:blocking]
connection.add_interface(id, attrs)
end
add_volume(attrs)
click to toggle source
def add_volume attrs
wait_for { stopped? } if attrs[:blocking]
connection.add_volume(id, attrs)
end
destroy(options = {})
click to toggle source
def destroy(options = {})
(stop unless stopped?) rescue nil
wait_for { stopped? }
connection.destroy_vm(:id => id)
end
destroy_interface(attrs)
click to toggle source
def destroy_interface attrs
wait_for { stopped? } if attrs[:blocking]
connection.destroy_interface(id, attrs)
end
destroy_volume(attrs)
click to toggle source
def destroy_volume attrs
wait_for { stopped? } if attrs[:blocking]
connection.destroy_volume(id, attrs)
end
interfaces()
click to toggle source
def interfaces
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
:connection => connection,
:vm => self
)
end
locked?()
click to toggle source
def locked?
!!(status =~ /locked/)
end
mac()
click to toggle source
def mac
interfaces.first.mac unless interfaces.empty?
end
ready?()
click to toggle source
def ready?
!(status =~ /down/)
end
reboot(options = {})
click to toggle source
def reboot(options = {})
stop unless stopped?
start options.merge(:blocking => true)
end
save()
click to toggle source
def save
if identity
connection.update_vm(attributes)
else
self.id = connection.create_vm(attributes).id
end
reload
end
start(options = {})
click to toggle source
def start(options = {})
wait_for { stopped? } if options[:blocking]
connection.vm_action(:id =>id, :action => :start)
reload
end
stop(options = {})
click to toggle source
def stop(options = {})
connection.vm_action(:id =>id, :action => :stop)
reload
end
stopped?()
click to toggle source
def stopped?
!!(status =~ /down/)
end
suspend(options = {})
click to toggle source
def suspend(options = {})
connection.vm_action(:id =>id, :action => :suspend)
reload
end
ticket(options = {})
click to toggle source
def ticket(options = {})
raise "Can not set console ticket, Server is not ready. Server status: #{status}" unless ready?
connection.vm_ticket(id, options)
end
to_s()
click to toggle source
update_interface(attrs)
click to toggle source
def update_interface attrs
wait_for { stopped? } if attrs[:blocking]
connection.update_interface(id, attrs)
end
volumes()
click to toggle source
def volumes
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
:connection => connection,
:vm => self
)
end