libsnapshot: no overlayfs during virtual a/b ota.
With overlayfs enabled, the scratch partition takes up super partition, causing retrofit devices to create COW images. Test: OTA on retrofit device, no COW images created. Change-Id: I35a1a2d02c8acf9efc33965c7e015f960bf45296
This commit is contained in:
parent
20a23bb41c
commit
65d94596f2
|
@ -100,6 +100,7 @@ class SnapshotManager final {
|
|||
virtual std::string GetSlotSuffix() const = 0;
|
||||
virtual std::string GetSuperDevice(uint32_t slot) const = 0;
|
||||
virtual const IPartitionOpener& GetPartitionOpener() const = 0;
|
||||
virtual bool IsOverlayfsSetup() const = 0;
|
||||
};
|
||||
|
||||
~SnapshotManager();
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <ext4_utils/ext4_utils.h>
|
||||
#include <fs_mgr.h>
|
||||
#include <fs_mgr_dm_linear.h>
|
||||
#include <fs_mgr_overlayfs.h>
|
||||
#include <fstab/fstab.h>
|
||||
#include <libdm/dm.h>
|
||||
#include <libfiemap/image_manager.h>
|
||||
|
@ -77,6 +78,7 @@ class DeviceInfo final : public SnapshotManager::IDeviceInfo {
|
|||
std::string GetSuperDevice(uint32_t slot) const override {
|
||||
return fs_mgr_get_super_partition_name(slot);
|
||||
}
|
||||
bool IsOverlayfsSetup() const override { return fs_mgr_overlayfs_is_setup(); }
|
||||
|
||||
private:
|
||||
android::fs_mgr::PartitionOpener opener_;
|
||||
|
@ -1731,6 +1733,15 @@ bool SnapshotManager::CreateUpdateSnapshots(MetadataBuilder* target_metadata,
|
|||
return false;
|
||||
}
|
||||
|
||||
// TODO(b/134949511): remove this check. Right now, with overlayfs mounted, the scratch
|
||||
// partition takes up a big chunk of space in super, causing COW images to be created on
|
||||
// retrofit Virtual A/B devices.
|
||||
if (device_->IsOverlayfsSetup()) {
|
||||
LOG(ERROR) << "Cannot create update snapshots with overlayfs setup. Run `adb enable-verity`"
|
||||
<< ", reboot, then try again.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that all these metadata is not retrofit dynamic partitions. Snapshots on
|
||||
// devices with retrofit dynamic partitions does not make sense.
|
||||
// This ensures that current_metadata->GetFreeRegions() uses the same device
|
||||
|
|
|
@ -51,6 +51,7 @@ class TestDeviceInfo : public SnapshotManager::IDeviceInfo {
|
|||
const android::fs_mgr::IPartitionOpener& GetPartitionOpener() const override {
|
||||
return *opener_.get();
|
||||
}
|
||||
bool IsOverlayfsSetup() const override { return false; }
|
||||
|
||||
void set_slot_suffix(const std::string& suffix) { slot_suffix_ = suffix; }
|
||||
void set_fake_super(const std::string& path) {
|
||||
|
|
Loading…
Reference in New Issue