mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
crosvm: Add more information of adding block device.
Trying to chase down what is failing in the bots that cannot be reproduced. BUG=b:199094605 TEST=tast run localhost:2229 arc.Boot.vm shows: 2021-09-30T00:51:27.843991Z INFO ARCVM(34)[23414]: [src/linux.rs:228] Trying to attach block device: /opt/google/vms/android/system.raw.img 2021-09-30T00:51:27.844122Z INFO ARCVM(34)[23414]: [disk/src/disk.rs:283] disk size 648871936, 2021-09-30T00:51:27.844456Z INFO ARCVM(34)[23414]: [disk/src/disk.rs:283] disk size 648871936, 2021-09-30T00:51:27.844753Z INFO ARCVM(34)[23414]: [src/linux.rs:228] Trying to attach block device: /opt/google/vms/android/vendor.raw.img 2021-09-30T00:51:27.844785Z INFO ARCVM(34)[23414]: [disk/src/disk.rs:283] disk size 139890688, 2021-09-30T00:51:27.844998Z INFO ARCVM(34)[23414]: [disk/src/disk.rs:283] disk size 139890688, Change-Id: Ief63cf75ba86e5324c6cc65a825c2717d3a0cb18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3195154 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
This commit is contained in:
parent
d38a34c038
commit
52437db2e9
3 changed files with 12 additions and 3 deletions
|
@ -10,7 +10,7 @@ use std::sync::Arc;
|
|||
|
||||
use async_trait::async_trait;
|
||||
use base::{
|
||||
AsRawDescriptors, FileAllocate, FileReadWriteAtVolatile, FileSetLen, FileSync, PunchHole,
|
||||
info, AsRawDescriptors, FileAllocate, FileReadWriteAtVolatile, FileSetLen, FileSync, PunchHole,
|
||||
SeekHole, WriteZeroesAt,
|
||||
};
|
||||
use cros_async::Executor;
|
||||
|
@ -280,6 +280,7 @@ pub fn detect_image_type(file: &File) -> Result<ImageType> {
|
|||
let orig_seek = f.seek(SeekFrom::Current(0)).map_err(Error::SeekingFile)?;
|
||||
f.seek(SeekFrom::Start(0)).map_err(Error::SeekingFile)?;
|
||||
|
||||
info!("disk size {}, ", disk_size);
|
||||
// Try to read the disk in a nicely-aligned block size unless the whole file is smaller.
|
||||
const MAGIC_BLOCK_SIZE: usize = 4096;
|
||||
#[repr(align(512))]
|
||||
|
|
|
@ -50,8 +50,10 @@ pub enum Error {
|
|||
CrasSoundDeviceNew(virtio::snd::cras_backend::Error),
|
||||
#[cfg(feature = "audio")]
|
||||
CreateAc97(devices::PciDeviceError),
|
||||
CreateAsyncDiskError(disk::Error),
|
||||
CreateConsole(devices::SerialError),
|
||||
CreateControlServer(io::Error),
|
||||
CreateDiskCheckAsyncOkError(disk::Error),
|
||||
CreateDiskError(disk::Error),
|
||||
CreateEvent(base::Error),
|
||||
CreateGrallocError(rutabaga_gfx::RutabagaError),
|
||||
|
@ -186,8 +188,12 @@ impl Display for Error {
|
|||
CrasSoundDeviceNew(e) => write!(f, "failed to create cras sound device: {}", e),
|
||||
#[cfg(feature = "audio")]
|
||||
CreateAc97(e) => write!(f, "failed to create ac97 device: {}", e),
|
||||
CreateAsyncDiskError(e) => write!(f, "failed to create virtual disk (async): {}", e),
|
||||
CreateConsole(e) => write!(f, "failed to create console device: {}", e),
|
||||
CreateControlServer(e) => write!(f, "failed to create control server: {}", e),
|
||||
CreateDiskCheckAsyncOkError(e) => {
|
||||
write!(f, "failed to create virtual disk checking async: {}", e)
|
||||
}
|
||||
CreateDiskError(e) => write!(f, "failed to create virtual disk: {}", e),
|
||||
CreateEvent(e) => write!(f, "failed to create event: {}", e),
|
||||
CreateGrallocError(e) => write!(f, "failed to create gralloc: {}", e),
|
||||
|
|
|
@ -225,8 +225,10 @@ fn create_block_device(cfg: &Config, disk: &DiskOption, disk_device_tube: Tube)
|
|||
};
|
||||
flock(&raw_image, lock_op, true).map_err(Error::DiskImageLock)?;
|
||||
|
||||
let dev = if disk::async_ok(&raw_image).map_err(Error::CreateDiskError)? {
|
||||
let async_file = disk::create_async_disk_file(raw_image).map_err(Error::CreateDiskError)?;
|
||||
info!("Trying to attach block device: {}", disk.path.display());
|
||||
let dev = if disk::async_ok(&raw_image).map_err(Error::CreateDiskCheckAsyncOkError)? {
|
||||
let async_file =
|
||||
disk::create_async_disk_file(raw_image).map_err(Error::CreateAsyncDiskError)?;
|
||||
Box::new(
|
||||
virtio::BlockAsync::new(
|
||||
virtio::base_features(cfg.protected_vm),
|
||||
|
|
Loading…
Reference in a new issue