1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00
Files
installer/vendor/github.com/diskfs/go-diskfs/diskfs_linux.go
Pawan Pinjarkar f84c94ead4 AGENT-702: Generate minimal ISO for external platform
- 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>
2023-09-07 12:44:09 -04:00

36 lines
1.0 KiB
Go

package diskfs
import (
"fmt"
"os"
"golang.org/x/sys/unix"
)
// getBlockDeviceSize get the size of an opened block device in Bytes.
func getBlockDeviceSize(f *os.File) (int64, error) {
blockDeviceSize, err := unix.IoctlGetInt(int(f.Fd()), unix.BLKGETSIZE64)
if err != nil {
return 0, fmt.Errorf("unable to get block device size: %v", err)
}
return int64(blockDeviceSize), nil
}
// getSectorSizes get the logical and physical sector sizes for a block device
func getSectorSizes(f *os.File) (logicalSectorSize, physicalSectorSize int64, err error) {
//
// equivalent syscall to
// ioctl(fd, BLKPBSZGET, &physicalsectsize);
fd := f.Fd()
logicalSectorSizeInt, err := unix.IoctlGetInt(int(fd), unix.BLKSSZGET)
if err != nil {
return 0, 0, fmt.Errorf("unable to get device logical sector size: %v", err)
}
physicalSectorSizeInt, err := unix.IoctlGetInt(int(fd), unix.BLKPBSZGET)
if err != nil {
return 0, 0, fmt.Errorf("unable to get device physical sector size: %v", err)
}
return int64(logicalSectorSizeInt), int64(physicalSectorSizeInt), nil
}