forked from kubevirt/containerized-data-importer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s390x enablement WIP (kubevirt#3357)
* s390x enablement Signed-off-by: cfilleke <[email protected]> * should resolve remaining merge conflicts Signed-off-by: cfilleke <[email protected]> * correct prev commit to resolve merge conflicts Signed-off-by: cfilleke <[email protected]> * to resolve generate-verify issue Signed-off-by: cfilleke <[email protected]> * provide registry container for s390x, vddk datasource stub fix and util data type fix Signed-off-by: cfilleke <[email protected]> * get the linter to fix things Signed-off-by: cfilleke <[email protected]> * fix linter issue Signed-off-by: cfilleke <[email protected]> --------- Signed-off-by: cfilleke <[email protected]> Signed-off-by: cfillekes <[email protected]>
- Loading branch information
1 parent
0ee9782
commit 7c6b06a
Showing
23 changed files
with
313 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load(":cc_toolchain_config.bzl", "cc_toolchain_config") | ||
|
||
filegroup(name = "empty") | ||
|
||
cc_toolchain_config(name = "s390x_toolchain_config") | ||
|
||
cc_toolchain( | ||
name = "s390x_toolchain", | ||
all_files = ":empty", | ||
compiler_files = ":empty", | ||
dwp_files = ":empty", | ||
linker_files = ":empty", | ||
objcopy_files = ":empty", | ||
strip_files = ":empty", | ||
toolchain_config = ":s390x_toolchain_config", | ||
toolchain_identifier = "s390x-toolchain", | ||
) | ||
|
||
cc_toolchain_suite( | ||
name = "gcc_toolchain", | ||
tags = ["manual"], | ||
toolchains = { | ||
"s390x": ":s390x_toolchain", | ||
}, | ||
) | ||
|
||
toolchain( | ||
name = "s390x_linux_toolchain", | ||
exec_compatible_with = [ | ||
"@platforms//os:linux", | ||
"@platforms//cpu:x86_64", | ||
], | ||
target_compatible_with = [ | ||
"@platforms//os:linux", | ||
"@platforms//cpu:s390x", | ||
], | ||
toolchain = ":s390x_toolchain", | ||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
) |
144 changes: 144 additions & 0 deletions
144
bazel/toolchain/s390x-none-linux-gnu/cc_toolchain_config.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") | ||
load( | ||
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", | ||
"feature", | ||
"flag_group", | ||
"flag_set", | ||
"tool_path", | ||
) | ||
|
||
all_link_actions = [ | ||
ACTION_NAMES.cpp_link_executable, | ||
ACTION_NAMES.cpp_link_dynamic_library, | ||
ACTION_NAMES.cpp_link_nodeps_dynamic_library, | ||
] | ||
|
||
all_compile_actions = [ | ||
ACTION_NAMES.assemble, | ||
ACTION_NAMES.c_compile, | ||
ACTION_NAMES.clif_match, | ||
ACTION_NAMES.cpp_compile, | ||
ACTION_NAMES.cpp_header_parsing, | ||
ACTION_NAMES.cpp_module_codegen, | ||
ACTION_NAMES.cpp_module_compile, | ||
ACTION_NAMES.linkstamp_compile, | ||
ACTION_NAMES.lto_backend, | ||
ACTION_NAMES.preprocess_assemble, | ||
] | ||
|
||
def _impl(ctx): | ||
tool_paths = [ | ||
tool_path( | ||
name = "ar", | ||
path = "/usr/bin/s390x-linux-gnu-ar", | ||
), | ||
tool_path( | ||
name = "cpp", | ||
path = "/usr/bin/s390x-linux-gnu-cpp", | ||
), | ||
tool_path( | ||
name = "gcc", | ||
path = "/usr/bin/s390x-linux-gnu-gcc", | ||
), | ||
tool_path( | ||
name = "gcov", | ||
path = "/usr/bin/s390x-linux-gnu-gcov", | ||
), | ||
tool_path( | ||
name = "ld", | ||
path = "/usr/bin/s390x-linux-gnu-ld", | ||
), | ||
tool_path( | ||
name = "nm", | ||
path = "/usr/bin/s390x-linux-gnu-nm", | ||
), | ||
tool_path( | ||
name = "objdump", | ||
path = "/usr/bin/s390x-linux-gnu-objdump", | ||
), | ||
tool_path( | ||
name = "strip", | ||
path = "/usr/bin/s390x-linux-gnu-strip", | ||
), | ||
] | ||
|
||
# Update the value of __TOOLCHAIN_SYSROOT__ every time the list | ||
# of cxx_builtin_include_directories has been modified. | ||
# | ||
# This is needed to make bazel realize that the updated toolchain | ||
# is different from the previous one and handle caching correctly. | ||
# | ||
# https://github.com/kubevirt/kubevirt/pull/8404#issuecomment-1275096374 | ||
default_compiler_flags = feature( | ||
name = "default_compiler_flags", | ||
enabled = True, | ||
flag_sets = [ | ||
flag_set( | ||
actions = all_compile_actions, | ||
flag_groups = [ | ||
flag_group( | ||
flags = [ | ||
"-no-canonical-prefixes", | ||
"-fno-canonical-system-headers", | ||
"-Wno-builtin-macro-redefined", | ||
"-D__DATE__=\"redacted\"", | ||
"-D__TIMESTAMP__=\"redacted\"", | ||
"-D__TIME__=\"redacted\"", | ||
"-D__TOOLCHAIN_SYSROOT__=\"centos-stream-9\"", | ||
"-nostdinc", | ||
"-I/usr/s390x-linux-gnu/sys-root/usr/include", | ||
"-I/usr/lib/gcc/s390x-linux-gnu/12/include", | ||
"-I/usr/lib/gcc/s390x-linux-gnu/12/include-fixed", | ||
], | ||
), | ||
], | ||
), | ||
], | ||
) | ||
|
||
default_linker_flags = feature( | ||
name = "default_linker_flags", | ||
enabled = True, | ||
flag_sets = [ | ||
flag_set( | ||
actions = all_link_actions, | ||
flag_groups = ([ | ||
flag_group( | ||
flags = [ | ||
"", | ||
], | ||
), | ||
]), | ||
), | ||
], | ||
) | ||
|
||
features = [ | ||
default_compiler_flags, | ||
default_linker_flags, | ||
] | ||
|
||
return cc_common.create_cc_toolchain_config_info( | ||
ctx = ctx, | ||
cxx_builtin_include_directories = [ | ||
"/usr/s390x-linux-gnu/sys-root/usr/include", | ||
"/usr/lib/gcc/s390x-linux-gnu/12/include", | ||
"/usr/lib/gcc/s390x-linux-gnu/12/include-fixed", | ||
], | ||
features = features, | ||
toolchain_identifier = "s390x-toolchain", | ||
host_system_name = "local", | ||
target_system_name = "unknown", | ||
target_cpu = "unknown", | ||
target_libc = "unknown", | ||
compiler = "unknown", | ||
abi_version = "unknown", | ||
abi_libc_version = "unknown", | ||
tool_paths = tool_paths, | ||
) | ||
|
||
cc_toolchain_config = rule( | ||
implementation = _impl, | ||
attrs = {}, | ||
provides = [CcToolchainConfigInfo], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
def register_all_toolchains(): | ||
native.register_toolchains( | ||
"//bazel/toolchain/s390x-none-linux-gnu:s390x_linux_toolchain", | ||
"//bazel/toolchain/aarch64-none-linux-gnu:aarch64_linux_toolchain", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,3 +234,4 @@ bazel run \ | |
bazel run \ | ||
--config=s390x \ | ||
//:bazeldnf -- prune | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//go:build s390x | ||
// +build s390x | ||
|
||
package importer | ||
|
||
import ( | ||
"errors" | ||
"net/url" | ||
|
||
v1 "k8s.io/api/core/v1" | ||
|
||
|
||
"kubevirt.io/containerized-data-importer/pkg/common" | ||
) | ||
|
||
// VDDKDataSource is the data provider for vddk. | ||
type VDDKDataSource struct { | ||
} | ||
|
||
func (V VDDKDataSource) Info() (ProcessingPhase, error) { | ||
panic("not support") | ||
} | ||
|
||
func (V VDDKDataSource) Transfer(path string) (ProcessingPhase, error) { | ||
panic("not support") | ||
} | ||
|
||
func (V VDDKDataSource) TransferFile(fileName string) (ProcessingPhase, error) { | ||
panic("not support") | ||
} | ||
|
||
func (V VDDKDataSource) GetURL() *url.URL { | ||
panic("not support") | ||
} | ||
|
||
func (V VDDKDataSource) GetTerminationMessage() *common.TerminationMessage { | ||
panic("not support") | ||
} | ||
|
||
func (V VDDKDataSource) Close() error { | ||
panic("not support") | ||
} | ||
|
||
func (V VDDKDataSource) IsDeltaCopy() bool { | ||
return false | ||
} | ||
|
||
func NewVDDKDataSource(endpoint string, accessKey string, secKey string, thumbprint string, uuid string, backingFile string, currentCheckpoint string, previousCheckpoint string, finalCheckpoint string, volumeMode v1.PersistentVolumeMode) (*VDDKDataSource, error) { | ||
return nil, errors.New("the s390x architecture does not support VDDK") | ||
} | ||
|
||
var _ DataSourceInterface = &VDDKDataSource{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.