Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix copySparse for empty qcow2 disk #2255

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

vasileknik76
Copy link
Contributor

Hi!

We are trying to migrate a vm for our users from qemu to vz virtualization. In our configuration we use an additional disk.

When the disk is empty and vmType is vz limactl hangs at Waiting for the essential requirement 1 of 2: "ssh".

This happens because neither write nor ftruncate is called for the file. In result after conversion, the file size is 0 bytes and the operating system cannot boot.

Steps to reproduce:

$ limactl disk create --size 1GB --format qcow2 test-disk
$ limactl start --name=test <config_file>

lima config:

vmType: "vz"
mountType: "virtiofs"
additionalDisks:
  - name: test-disk
    format: true
    fsType: "ext4"
images:
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20240308/ubuntu-22.04-server-cloudimg-amd64.img"
  arch: "x86_64"
  digest: "sha256:42dcf9757e75c3275486b397a752fb535c7cd8e5232ee5ee349554b7a55f1702"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20240308/ubuntu-22.04-server-cloudimg-arm64.img"
  arch: "aarch64"
  digest: "sha256:0f5f68b9b74686b8a847024364031e2b95e4d3855e5177a99b33d7c55e45907f"

AkihiroSuda
AkihiroSuda previously approved these changes Mar 19, 2024
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda added this to the v0.21.1 (tentative) milestone Mar 19, 2024
@vasileknik76
Copy link
Contributor Author

Fixes #1964

@vasileknik76
Copy link
Contributor Author

I would like to write a test for converting disks, but I haven't found a simple way to create a qcow disk from tests. Alternatively, I can embed a small disk and use it in tests. If you agree, I'll write a test

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Mar 20, 2024

Thanks, you can just exec qemu-img and call it a day for creating test disks

@vasileknik76
Copy link
Contributor Author

vasileknik76 commented Mar 20, 2024

I added test and installation of qemu-utils for unit tests and disabled test for windows

@vasileknik76
Copy link
Contributor Author

@AkihiroSuda can you rerun failed tests?

AkihiroSuda
AkihiroSuda previously approved these changes Mar 25, 2024
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Signed-off-by: Nikita Vasilchenko <n@mintscale.ru>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants