update_engine: added CanRollback dbus method
Added a method to the update engine to check if a rollback
partition is available and can be booted from.
update_engine_client is also updated to call the function
when --can_rollback paramater is specified
BUG=chromium:343301
TEST=Ran "update_engine_client --can_rollback" and unit tests
Change-Id: If3fcb29a0067069a22812f60e9b67c6fdbbd18bd
Reviewed-on: https://chromium-review.googlesource.com/187157
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/fake_hardware.h b/fake_hardware.h
index 97ab8dd..6f4be77 100644
--- a/fake_hardware.h
+++ b/fake_hardware.h
@@ -17,6 +17,7 @@
FakeHardware()
: kernel_device_("/dev/sdz4"),
boot_device_("/dev/sdz5"),
+ bootable_devices_{"/dev/sdz4", "/dev/sdz5"},
is_official_build_(true),
is_normal_boot_mode_(true),
hardware_class_("Fake HWID BLAH-1234"),
@@ -26,6 +27,9 @@
// HardwareInterface methods.
virtual const std::string BootKernelDevice() { return kernel_device_; }
virtual const std::string BootDevice() { return boot_device_; }
+ virtual std::vector<std::string> GetKernelDevices() override
+ { return bootable_devices_; }
+
virtual bool IsKernelBootable(const std::string& kernel_device,
bool* bootable)
{ std::map<std::string, bool>::const_iterator i =
@@ -70,6 +74,7 @@
private:
std::string kernel_device_;
std::string boot_device_;
+ std::vector<std::string> bootable_devices_;
std::map<std::string, bool> is_bootable_;
bool is_official_build_;
bool is_normal_boot_mode_;