Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kairos-io/AuroraBoot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.2
Choose a base ref
...
head repository: kairos-io/AuroraBoot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.6.3
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Mar 19, 2025

  1. Fix azure (#210)

    * Add header with "conectix" value
    
    To fix this error:
    
    Message: The specified cookie value in VHD footer indicates that disk 'kairos-ubuntu-24.04-core-amd64-generic-3.3.1-88-g70ebc315.raw.vhd' with blob https://kairoscloudimages.blob.core.windows.net:8443/kairos-cloud-images/kairos-ubuntu-24.04-core-amd64-generic-3.3.1-88-g70ebc315.raw.vhd is not a supported VHD. Disk is expected to have cookie value 'conectix'.
    
    Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
    
    * Azure expect the file size without the header to be rounded to MB
    
    Thus we don't have to remove 512 bytes (the "footer"/header size). We
    just round the file up and we add the footer in the end.
    
    Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
    
    * Fix test
    
    Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
    
    ---------
    
    Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
    jimmykarily authored Mar 19, 2025
    Copy the full SHA
    cfd153a View commit details
Showing with 9 additions and 8 deletions.
  1. +5 −4 e2e/disks_test.go
  2. +4 −4 pkg/ops/rawDiskOutput.go
9 changes: 5 additions & 4 deletions e2e/disks_test.go
Original file line number Diff line number Diff line change
@@ -7,12 +7,13 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"github.com/kairos-io/AuroraBoot/pkg/constants"
"github.com/kairos-io/AuroraBoot/pkg/ops"
"os"
"os/exec"
"path/filepath"

"github.com/kairos-io/AuroraBoot/pkg/constants"
"github.com/kairos-io/AuroraBoot/pkg/ops"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
@@ -141,8 +142,8 @@ var _ = Describe("Disk image generation", Label("raw-disks", "e2e"), Serial, Ord
f, _ := os.Open(filepath.Join(tempDir, "kairos-rockylinux-9-core-amd64-generic-v3.2.1.raw.vhd"))
defer f.Close()
info, _ := f.Stat()
// Should be divisible by 1024*1024
Expect(info.Size() % constants.MB).To(BeNumerically("==", 0))
// Should be divisible by 1024*1024 + 512 bytes header
Expect(info.Size() % constants.MB).To(BeNumerically("==", 512))
// Dump the header from the file into our VHDHeader
buff := make([]byte, 512)
_, _ = f.ReadAt(buff, info.Size()-512)
8 changes: 4 additions & 4 deletions pkg/ops/rawDiskOutput.go
Original file line number Diff line number Diff line change
@@ -7,13 +7,14 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"github.com/kairos-io/AuroraBoot/pkg/utils"
"io"
"io/fs"
"math"
"os"
"time"

"github.com/kairos-io/AuroraBoot/pkg/utils"

uuidPkg "github.com/gofrs/uuid"
"github.com/kairos-io/AuroraBoot/internal"
"github.com/kairos-io/AuroraBoot/pkg/constants"
@@ -44,8 +45,6 @@ func Raw2Azure(source string) (string, error) {
var finalSize int64
// Calculate the final size in bytes
finalSize = ((actualSize + constants.MB - 1) / constants.MB) * constants.MB
finalSize -= 512
// Remove the 512 bytes for the header that we are going to add afterwards

// If the actual size is different from the final size, we have to resize the image
if actualSize != finalSize {
@@ -88,7 +87,7 @@ func Raw2Azure(source string) (string, error) {
}
sizeFile := fileInfo.Size()

if sizeFile%constants.MB != 0 {
if int64(size)%constants.MB != 0 {
err = fmt.Errorf("The file %s size %d bytes is not divisible by 1 MB.\n", fileInfo.Name(), sizeFile)
internal.Log.Logger.Error().Err(err).Msg("Error validating file size")
return name, err
@@ -233,6 +232,7 @@ type VHDHeader struct {
// Lots of magic numbers here, but they are all defined in the VHD format spec
func newVHDFixed(size uint64) VHDHeader {
header := VHDHeader{}
hexToField("636f6e6563746978", header.Cookie[:])
hexToField("00000002", header.Features[:])
hexToField("00010000", header.FileFormatVersion[:])
hexToField("ffffffffffffffff", header.DataOffset[:])