Repository: osbuild/osbuild-composer
Pull request #114 (2019-11-21 12:32:35)

Fix alignment for azure images
see individual commits


Patch:
diff --git a/internal/distro/fedora30/helpers.go b/internal/distro/fedora30/helpers.go
index 2d9810754..aec371174 100644
--- a/internal/distro/fedora30/helpers.go
+++ b/internal/distro/fedora30/helpers.go
@@ -181,7 +181,9 @@ func addF30QemuAssembler(p *pipeline.Pipeline, format string, filename string) {
 			Filename:           filename,
 			PTUUID:             "0x14fc63d2",
 			RootFilesystemUUDI: id,
-			Size:               3221225472,
+			// Azure requires this size to be a multiple of 1MB. If you change this, make sure
+			// the size still fulfills this requirement to prevent regressions.
+			Size: 3222274048,
 		})
 }
 
@@ -201,6 +203,6 @@ func addF30RawFSAssembler(p *pipeline.Pipeline, filename string) {
 		&pipeline.RawFSAssemblerOptions{
 			Filename:           filename,
 			RootFilesystemUUDI: id,
-			Size:               3221225472,
+			Size:               3222274048,
 		})
 }
diff --git a/internal/distro/fedora30/vhd.go b/internal/distro/fedora30/vhd.go
index 8837846a4..9f09f5148 100644
--- a/internal/distro/fedora30/vhd.go
+++ b/internal/distro/fedora30/vhd.go
@@ -29,7 +29,7 @@ func (t *vhdOutput) translate(b *blueprint.Blueprint) (*pipeline.Pipeline, error
 	addF30GRUB2Stage(p, b.GetKernelCustomization())
 	addF30FixBlsStage(p)
 	addF30SELinuxStage(p)
-	addF30QemuAssembler(p, "qcow2", t.getName())
+	addF30QemuAssembler(p, "vpc", t.getName())
 
 	if b.Customizations != nil {
 		err := customizeAll(p, b.Customizations)


Test patch:
diff --git a/test/cases/ami_empty_blueprint.json b/test/cases/ami_empty_blueprint.json
index 0a716f829..3b1e4e88f 100644
--- a/test/cases/ami_empty_blueprint.json
+++ b/test/cases/ami_empty_blueprint.json
@@ -111,7 +111,7 @@
         "filename": "image.ami",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
@@ -557,7 +557,7 @@
         "fstype": "ext4",
         "label": null,
         "partuuid": "14fc63d2-01",
-        "size": 3220176896,
+        "size": 3221225472,
         "start": 1048576,
         "type": "83",
         "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
diff --git a/test/cases/ami_local_boot.json b/test/cases/ami_local_boot.json
index 2d984e3fe..e2a70070b 100644
--- a/test/cases/ami_local_boot.json
+++ b/test/cases/ami_local_boot.json
@@ -165,7 +165,7 @@
         "filename": "image.ami",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }
diff --git a/test/cases/disk_empty_blueprint.json b/test/cases/disk_empty_blueprint.json
index 2e74ceecc..40cecfba5 100644
--- a/test/cases/disk_empty_blueprint.json
+++ b/test/cases/disk_empty_blueprint.json
@@ -107,7 +107,7 @@
         "filename": "disk.img",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
@@ -518,7 +518,7 @@
         "fstype": "ext4",
         "label": null,
         "partuuid": "14fc63d2-01",
-        "size": 3220176896,
+        "size": 3221225472,
         "start": 1048576,
         "type": "83",
         "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
diff --git a/test/cases/disk_local_boot.json b/test/cases/disk_local_boot.json
index 77f9a99f1..8014254e0 100644
--- a/test/cases/disk_local_boot.json
+++ b/test/cases/disk_local_boot.json
@@ -166,7 +166,7 @@
         "filename": "disk.img",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }
diff --git a/test/cases/ext4_empty_blueprint.json b/test/cases/ext4_empty_blueprint.json
index a400227cf..d0b7ad224 100644
--- a/test/cases/ext4_empty_blueprint.json
+++ b/test/cases/ext4_empty_blueprint.json
@@ -89,7 +89,7 @@
       "options": {
         "filename": "filesystem.img",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
diff --git a/test/cases/ext4_local_boot.json b/test/cases/ext4_local_boot.json
index 348a8833c..9466e8a55 100644
--- a/test/cases/ext4_local_boot.json
+++ b/test/cases/ext4_local_boot.json
@@ -149,7 +149,7 @@
       "options": {
         "filename": "filesystem.img",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }
diff --git a/test/cases/openstack_empty_blueprint.json b/test/cases/openstack_empty_blueprint.json
index 61fad3e27..459eabb28 100644
--- a/test/cases/openstack_empty_blueprint.json
+++ b/test/cases/openstack_empty_blueprint.json
@@ -111,7 +111,7 @@
         "filename": "image.qcow2",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
@@ -574,7 +574,7 @@
         "fstype": "ext4",
         "label": null,
         "partuuid": "14fc63d2-01",
-        "size": 3220176896,
+        "size": 3221225472,
         "start": 1048576,
         "type": "83",
         "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
diff --git a/test/cases/openstack_local_boot.json b/test/cases/openstack_local_boot.json
index 175d149e2..c6c338c1c 100644
--- a/test/cases/openstack_local_boot.json
+++ b/test/cases/openstack_local_boot.json
@@ -161,7 +161,7 @@
         "filename": "image.qcow2",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }
diff --git a/test/cases/qcow2_empty_blueprint.json b/test/cases/qcow2_empty_blueprint.json
index e4481cc5c..04eed0bb3 100644
--- a/test/cases/qcow2_empty_blueprint.json
+++ b/test/cases/qcow2_empty_blueprint.json
@@ -112,7 +112,7 @@
         "filename": "image.qcow2",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
@@ -555,7 +555,7 @@
         "fstype": "ext4",
         "label": null,
         "partuuid": "14fc63d2-01",
-        "size": 3220176896,
+        "size": 3221225472,
         "start": 1048576,
         "type": "83",
         "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
diff --git a/test/cases/qcow2_local_boot.json b/test/cases/qcow2_local_boot.json
index 139191860..560bfb84d 100644
--- a/test/cases/qcow2_local_boot.json
+++ b/test/cases/qcow2_local_boot.json
@@ -162,7 +162,7 @@
         "filename": "image.qcow2",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }
diff --git a/test/cases/vhd_empty_blueprint.json b/test/cases/vhd_empty_blueprint.json
index 6b22809ef..aff8c8975 100644
--- a/test/cases/vhd_empty_blueprint.json
+++ b/test/cases/vhd_empty_blueprint.json
@@ -106,11 +106,11 @@
     "assembler": {
       "name": "org.osbuild.qemu",
       "options": {
-        "format": "qcow2",
+        "format": "vpc",
         "filename": "image.vhd",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
@@ -528,7 +528,7 @@
         "fstype": "ext4",
         "label": null,
         "partuuid": "14fc63d2-01",
-        "size": 3220176896,
+        "size": 3221225472,
         "start": 1048576,
         "type": "83",
         "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
diff --git a/test/cases/vhd_local_boot.json b/test/cases/vhd_local_boot.json
index 9d3cad836..4001fa248 100644
--- a/test/cases/vhd_local_boot.json
+++ b/test/cases/vhd_local_boot.json
@@ -160,7 +160,7 @@
         "filename": "image.vhd",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }
diff --git a/test/cases/vmdk_empty_blueprint.json b/test/cases/vmdk_empty_blueprint.json
index 6321f73eb..abaaa101e 100644
--- a/test/cases/vmdk_empty_blueprint.json
+++ b/test/cases/vmdk_empty_blueprint.json
@@ -108,7 +108,7 @@
         "filename": "disk.vmdk",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   },
@@ -535,7 +535,7 @@
         "fstype": "ext4",
         "label": null,
         "partuuid": "14fc63d2-01",
-        "size": 3220176896,
+        "size": 3221225472,
         "start": 1048576,
         "type": "83",
         "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
diff --git a/test/cases/vmdk_local_boot.json b/test/cases/vmdk_local_boot.json
index b8ced1c4c..dfd6f5efa 100644
--- a/test/cases/vmdk_local_boot.json
+++ b/test/cases/vmdk_local_boot.json
@@ -158,7 +158,7 @@
         "filename": "disk.vmdk",
         "ptuuid": "0x14fc63d2",
         "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
-        "size": 3221225472
+        "size": 3222274048
       }
     }
   }