mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
- Renamed `ipxeBaseURL` to more generic `bootArtifactsBaseURL` - Removed unwanted lint - Added integration tests to create minimal ISO for external platform with and without bootArtifactsBaseURL in agent-config.yaml - Fixed existing integration tests to include change of name from `ipxeBaseURL` to more generic `bootArtifactsBaseURL` - Added BootArtifactsBaseUrl and bootArtifactsPath into parent asset AgentArtifacts - AgentArtifacts also depends on AgentConfig asset - Moved common code to generate rootfs.img file into extractRootFS() in AgentArtifacts asset - If the bootArtifactsBaseURL is specified, construct the custom rootfs URL otherwise default to the URL from the RHCOS streams file - For external platform when the bootArtifactsBaseUrl is specified, output the rootfs file alongside the minimal ISO - For all other platforms, continue generating full ISO (no explicit rootfs.img is generated) - Vendor changes after updating github.com/openshift/assisted-image-service dependency - set IMAGE_TYPE_ISO to 'minimal-iso' in create-cluster-and-infraenv.service.template when using external platform - Log an info message to upload CCM manifests Signed-off-by: Pawan Pinjarkar <ppinjark@redhat.com>
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package diskfs
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// this constants should be part of "golang.org/x/sys/unix", but aren't, yet
|
|
const (
|
|
DKIOCGETBLOCKSIZE = 0x40046418
|
|
DKIOCGETPHYSICALBLOCKSIZE = 0x4004644D
|
|
DKIOCGETBLOCKCOUNT = 0x40086419
|
|
)
|
|
|
|
// getBlockDeviceSize get the size of an opened block device in Bytes.
|
|
func getBlockDeviceSize(f *os.File) (int64, error) {
|
|
fd := f.Fd()
|
|
|
|
blockSize, err := unix.IoctlGetInt(int(fd), DKIOCGETBLOCKSIZE)
|
|
if err != nil {
|
|
return 0, fmt.Errorf("unable to get device logical sector size: %v", err)
|
|
}
|
|
|
|
blockCount, err := unix.IoctlGetInt(int(fd), DKIOCGETBLOCKCOUNT)
|
|
if err != nil {
|
|
return 0, fmt.Errorf("unable to get device block count: %v", err)
|
|
}
|
|
return int64(blockSize) * int64(blockCount), nil
|
|
}
|
|
|
|
// getSectorSizes get the logical and physical sector sizes for a block device
|
|
func getSectorSizes(f *os.File) (logicalSectorSize, physicalSectorSize int64, err error) {
|
|
fd := f.Fd()
|
|
|
|
logicalSectorSizeInt, err := unix.IoctlGetInt(int(fd), DKIOCGETBLOCKSIZE)
|
|
if err != nil {
|
|
return 0, 0, fmt.Errorf("unable to get device logical sector size: %v", err)
|
|
}
|
|
physicalSectorSizeInt, err := unix.IoctlGetInt(int(fd), DKIOCGETPHYSICALBLOCKSIZE)
|
|
if err != nil {
|
|
return 0, 0, fmt.Errorf("unable to get device physical sector size: %v", err)
|
|
}
|
|
return int64(logicalSectorSizeInt), int64(physicalSectorSizeInt), nil
|
|
}
|