hobo-up now starts the VM in headless mode. hobo-down will force quit the VM if its running
This commit is contained in:
parent
900477d456
commit
2353ea1f81
|
@ -34,9 +34,15 @@ module Hobo
|
|||
setup_mac_address
|
||||
forward_ssh
|
||||
setup_shared_folder
|
||||
start
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @vm.running?
|
||||
HOBO_LOGGER.info "VM is running. Forcing immediate shutdown..."
|
||||
@vm.stop(true)
|
||||
end
|
||||
|
||||
HOBO_LOGGER.info "Destroying VM and associated drives..."
|
||||
@vm.destroy(:destroy_image => true)
|
||||
end
|
||||
|
@ -75,5 +81,13 @@ module Hobo
|
|||
@vm.shared_folders << folder
|
||||
@vm.save(true)
|
||||
end
|
||||
|
||||
def start
|
||||
HOBO_LOGGER.info "Booting VM..."
|
||||
@vm.start(:headless, true)
|
||||
|
||||
# Now we have to wait for the boot to be successful
|
||||
# TODO
|
||||
end
|
||||
end
|
||||
end
|
|
@ -60,15 +60,34 @@ class VMTest < Test::Unit::TestCase
|
|||
@vm.expects(:setup_mac_address).in_sequence(create_seq)
|
||||
@vm.expects(:forward_ssh).in_sequence(create_seq)
|
||||
@vm.expects(:setup_shared_folder).in_sequence(create_seq)
|
||||
@vm.expects(:start).in_sequence(create_seq)
|
||||
@vm.create
|
||||
end
|
||||
end
|
||||
|
||||
context "destroying" do
|
||||
setup do
|
||||
@mock_vm.stubs(:running?).returns(false)
|
||||
end
|
||||
|
||||
should "destoy the VM along with images" do
|
||||
@mock_vm.expects(:destroy).with(:destroy_image => true).once
|
||||
@vm.destroy
|
||||
end
|
||||
|
||||
should "stop the VM if its running" do
|
||||
@mock_vm.expects(:running?).returns(true)
|
||||
@mock_vm.expects(:stop).with(true)
|
||||
@mock_vm.expects(:destroy).with(:destroy_image => true).once
|
||||
@vm.destroy
|
||||
end
|
||||
end
|
||||
|
||||
context "starting" do
|
||||
should "start the VM in headless mode" do
|
||||
@mock_vm.expects(:start).with(:headless, true).once
|
||||
@vm.start
|
||||
end
|
||||
end
|
||||
|
||||
context "importing" do
|
||||
|
|
Loading…
Reference in New Issue