From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48C071FECAB for ; Wed, 27 Aug 2025 03:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756267069; cv=none; b=WK8/1jPJFjVowqETtr2hzvb8YvhZyM+DigRU/1gUEP+Xa0p14GjiVsnLJH0IqqVus1uSWIIzVBkyTQZQQ7HPbJvPd3kbpDaIetedQ5v35l2Em5Ro/auOwdBmriunkh3vnNOIieqg439ktY7L236JTTwaSdH2OOLiSAifq/7GAZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756267069; c=relaxed/simple; bh=ANpo2DiOml0cLcPfoRKOrUERAPYHTWBadiC08Cfi9wM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y6N3artgATUnj0XNPzCl4vLVMRKbu0aPh5ogp0MTyOL063wXolpndHZ54oLcQZXba0QqReLQT4O3XBYdUZhxhiY11wegBqULoOEf3KqV4nLaHtIY+wIemTZDHPHTN9YvCHy4DBqIj0oqJE0UynBen9FCfugl9FPfc4sCPhFUjQk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=yTeG/Q2r; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="yTeG/Q2r" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=5BLg6NCJuItPyxfTTvDbn9Nme2EYocUiU37G1jWfn3k=; b=yTeG/Q2roG7W6fTJ+9F/tesRAT dkP2+BiLoTCY5FZcW7jCiXm48iaPnXeZ97vyec/GhWSRPKAz+UMbSDxZW8Yh8MOururpKRrTXYa9i ztsnd/WPmMoS9SH3/3KyBRCUaJzT9emKSxRBmfe1gTmiQQQx17pCOy6IuFtY4A03u196uF6bqMIxG Dk8wJDp9INorSt3kDwzHmvBsDkh7Lvm8h1UkH60GwmKAwcd8f5wNwg4Rf6SU+isv4APWCQn2BYPFo mTA7TTwtwDQVa2CdQgf6pdlEMyEdHuwM6lLbZufPG518cDbVfD9vRt9fmGk+FQQhbpygN7RsOhbGI dC/aL5nw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ur7IB-0000000DuAB-41aW; Wed, 27 Aug 2025 03:57:47 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [RFT 3/4] guestfs: fix virt-resize failure for custom images Date: Tue, 26 Aug 2025 20:57:46 -0700 Message-ID: <20250827035747.3314144-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250827035747.3314144-1-mcgrof@kernel.org> References: <20250827035747.3314144-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain The virt-resize command was failing because it requires a pre-allocated output file with the target size, not an empty temporary file. Fix by: 1. Pre-allocating the temporary image file with qemu-img create before running virt-resize 2. Adding -f raw flag to qemu-img resize to avoid format detection warnings This ensures the partition expansion works correctly when resizing custom images like Debian 13 daily builds. Error was: virt-resize: error: /tmp/ansible.depq5vk0.raw: file is too small to be a disk image (0 bytes) Generated-by: Claude AI Signed-off-by: Luis Chamberlain --- playbooks/roles/base_image/tasks/custom-image.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/base_image/tasks/custom-image.yml b/playbooks/roles/base_image/tasks/custom-image.yml index 296424bc..a3a8cbbd 100644 --- a/playbooks/roles/base_image/tasks/custom-image.yml +++ b/playbooks/roles/base_image/tasks/custom-image.yml @@ -50,7 +50,7 @@ become: true become_method: ansible.builtin.sudo ansible.builtin.command: - cmd: "qemu-img resize {{ custom_image }} {{ libvirt_image_size }}" + cmd: "qemu-img resize -f raw {{ custom_image }} {{ libvirt_image_size }}" changed_when: true when: - custom_image_download is changed @@ -65,6 +65,17 @@ - custom_image_download is changed - guestfs_has_custom_raw_image_url|bool +- name: Pre-allocate space for the resized image + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + cmd: "qemu-img create -f raw {{ temp_resized_image.path }} {{ libvirt_image_size }}" + changed_when: true + when: + - custom_image_download is changed + - guestfs_has_custom_raw_image_url|bool + - temp_resized_image.path is defined + - name: Expand root partition to use full disk become: true become_method: ansible.builtin.sudo -- 2.50.1