lib/virtualbox/vm.rb in virtualbox-0.7.1 vs lib/virtualbox/vm.rb in virtualbox-0.7.2

- old
+ new

@@ -172,11 +172,11 @@ relationship :vrdp_server, :VRDPServer relationship :storage_controllers, :StorageController, :dependent => :destroy relationship :medium_attachments, :MediumAttachment relationship :shared_folders, :SharedFolder relationship :extra_data, :ExtraData - relationship :forwarded_ports, :ForwardedPort + relationship :forwarded_ports, :ForwardedPort, :version => "3.1" relationship :network_adapters, :NetworkAdapter relationship :usb_controller, :USBController relationship :current_snapshot, :Snapshot class << self @@ -527,10 +527,15 @@ # Discards any saved state on the current VM. The VM is not destroyed though # and can still be started by calling {#start}. # # @return [Boolean] True if command was successful, false otherwise. def discard_state - control(:forget_saved_state, true) + # Since the VM should be saved as it is, we don't open an + # existing session like the other control methods. We open a new + # session. + with_open_session do |session| + session.console.forget_saved_state(true) + end end # Controls the virtual machine. This method is used by {#stop}, # {#pause}, {#resume}, and {#save_state} to control the virtual machine. # Typically, you won't ever have to call this method and should