Handle qcow image backed by a composite disk
Handle qcow image backed by a composite disk

This CL fixes a bug that was introduced by [1] where max_nesting_depth
is used to prevent unbounded nesting of qcow images.

When a qcow image is backed by a composite disk, the composite disk is
parsed twice: (1) once before the qcow header is created, and (2) once
again after the composite disk is written to the header and the header
is parsed. The max_nesting_depth was set correctly for (1), but was set
to 1 for (2). Since a composite disk inherently is nested,
max_nesting_depth drops to 0 and it causes an error.

This CL fixes the bug by respecting max_nesting_depth also for the case
(2).

Bug: N/A
Test: launch cuttlefish

[1] https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3146214

Change-Id: Ic2d30df6c76a0c1965e222960e0094fe847b1097
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3267734
Auto-Submit: Jiyong Park <1d4a5333a083d571e94292e134fee800449ea152@google.com>
Tested-by: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Reviewed-by: Andrew Walbran <91a7c1b7f9f624e0ed1b099dc85ecb6025941ee9@google.com>
Reviewed-by: Daniel Verkamp <72bc170b46ec491f7bdd4359a1c0bfed274de40c@chromium.org>
Commit-Queue: Keiichi Watanabe <815e4e8f7c92a23424d7c3f51ead622bcedbc720@chromium.org>

google/crosvm,google/crosvm,google/crosvm,google/crosvm