From 255e681f3c79a45c534eff41a756dd57dc3222d7 Mon Sep 17 00:00:00 2001 From: Graham Bleach Date: Sat, 30 Apr 2011 18:53:24 +0100 Subject: [PATCH 1/4] boot1 and ioapic are no longer vm attributes. --- docs/GettingStarted.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index fc638ca..627d888 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -57,7 +57,7 @@ This example uses {VirtualBox::VM}, which will probably be the most common model you search for. vm = VirtualBox::VM.find("MyVM") - puts "This VM has #{vm.memory} MB of RAM allocated to it." + puts "This VM has #{vm.memory_size} MB of RAM allocated to it." Find can also be used with UUIDs: @@ -92,8 +92,8 @@ Reading attributes is simple. Let's use a {VirtualBox::VM} as an example: # Accessing attributes: vm.memory vm.name - vm.boot1 - vm.ioapic + vm.boot_order[0] + vm.bios.io_apic_enabled ### Relationships @@ -193,4 +193,4 @@ Below is an example where an exception will be raised if an error occurs: vm.memory = "INVALID" # This will raise an exception, since the memory is invalid - vm.save(true) \ No newline at end of file + vm.save(true) From 1ed17669454c86aa459e2295652e91d07578c327 Mon Sep 17 00:00:00 2001 From: Graham Bleach Date: Sat, 30 Apr 2011 18:57:38 +0100 Subject: [PATCH 2/4] memory is now called memory_size. --- docs/GettingStarted.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index 627d888..7dc4c5e 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -90,7 +90,7 @@ Reading attributes is simple. Let's use a {VirtualBox::VM} as an example: vm = VirtualBox::VM.find("FooVM") # Accessing attributes: - vm.memory + vm.memory_size vm.name vm.boot_order[0] vm.bios.io_apic_enabled @@ -182,7 +182,7 @@ Below is an example of saving a simple {VirtualBox::VM} object: vm = VirtualBox::VM.find("FooVM") # Double the memory - vm.memory = vm.memory.to_i * 2 + vm.memory_size = vm.memory_size.to_i * 2 # This will return true/false depending on success vm.save @@ -190,7 +190,7 @@ Below is an example of saving a simple {VirtualBox::VM} object: Below is an example where an exception will be raised if an error occurs: vm = VirtualBox::VM.find("FooVM") - vm.memory = "INVALID" + vm.memory_size = "INVALID" # This will raise an exception, since the memory is invalid vm.save(true) From d9ac87981b52d801680847e5a11ba4459a428e3d Mon Sep 17 00:00:00 2001 From: Graham Bleach Date: Sat, 30 Apr 2011 18:59:21 +0100 Subject: [PATCH 3/4] It appears that save no longer accepts an argument. --- docs/GettingStarted.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index 7dc4c5e..e19a82f 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -172,10 +172,7 @@ Saving models is _really_ easy: you simply call `save`. That's all! Well, there some subtleties, but that's the basic idea. `save` will typically **also save relationships** so if you modify a relationship object or relationship itself, calling `save` on the parent object will typically save the relationships as well. `save` always returns -`true` or `false` depending on whether the operation was a success or not. If you'd like -instead to know why a `save` failed, you can call the method with a `true` parameter -which sets `raise_errors` to `true` and will raise a {VirtualBox::Exceptions::CommandFailedException} -if there is a failure. The message on this object contains the reason. +`true` or `false` depending on whether the operation was a success or not. Below is an example of saving a simple {VirtualBox::VM} object: @@ -187,10 +184,10 @@ Below is an example of saving a simple {VirtualBox::VM} object: # This will return true/false depending on success vm.save -Below is an example where an exception will be raised if an error occurs: +Below is an example which will return `false`: vm = VirtualBox::VM.find("FooVM") vm.memory_size = "INVALID" - # This will raise an exception, since the memory is invalid - vm.save(true) + # This will return false, since the memory is invalid + vm.save From 31b72353008bb6efdb32171be8a3577d9d22d748 Mon Sep 17 00:00:00 2001 From: Graham Bleach Date: Sat, 30 Apr 2011 19:13:32 +0100 Subject: [PATCH 4/4] HardDrive.size and StorageController.uuid have also disappeared. --- docs/GettingStarted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index e19a82f..050dcbc 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -105,7 +105,7 @@ Relationships are read the exact same way as attributes. Again using a # storage_controllers is a relationship containing an array of all the # storage controllers on this VM vm.storage_controllers.each do |sc| - puts "Storage Controller: #{sc.uuid}" + puts "Storage Controller: #{sc.name}" end The difference from an attribute is that while attributes are typically ruby @@ -140,7 +140,7 @@ Attributes which support modification are modified like standard ruby attributes following example uses {VirtualBox::HardDrive}: hd = VirtualBox::HardDrive.new - hd.size = 2000 # megabytes + hd.logical_size = 2000 # megabytes hd.format = "VMDK" As you can see, there is nothing sneaky going on here, and does what you expect.