Print better warning if online reencrypt is called over LUKS1.

This commit is contained in:
Milan Broz
2019-08-14 08:14:02 +02:00
parent ea1dbfe961
commit 7aa197be7d

View File

@@ -3113,11 +3113,16 @@ static int action_reencrypt(void)
if ((r = crypt_init_data_device(&cd, uuid_or_device(opt_header_device ?: action_argv[0]), action_argv[0])))
return r;
if ((r = crypt_load(cd, CRYPT_LUKS2, NULL))) {
if ((r = crypt_load(cd, CRYPT_LUKS, NULL))) {
log_err(_("Device %s is not a valid LUKS device."),
uuid_or_device(opt_header_device ?: action_argv[0]));
goto out;
}
if (strcmp(crypt_get_type(cd), CRYPT_LUKS2)) {
log_err(_("Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."));
r = -EINVAL;
goto out;
}
}
if (crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags)) {