diff --git a/read_values.c b/read_values.c index 9c39748..0b75b1e 100644 --- a/read_values.c +++ b/read_values.c @@ -37,9 +37,9 @@ enum datatypes { #define WITHOUT_KEY 0 #define WITH_KEY 1 -static char *versionstring = "Version 1.0.2 2020-03-30 23:30"; +static char *versionstring = "Version 1.0.3 2023-02-16 17:00"; -static char *version = "1.0.2"; +static char *version = "1.0.3"; void *configuration_handle = NULL; int layers = -1; @@ -339,12 +339,47 @@ return; /* */ /* print out the uuid for this machine */ /* */ -/* TODO! */ +/* */ /* */ /******************************************************************************/ -void print_uuid() +int print_uuid() { -return; + const char *result_string = NULL; + int erg; + + erg = qc_get_attribute_string(configuration_handle, qc_sequence_code, 0, &result_string); + if (erg != 1) + { + puts("Error reading the Serial Number"); + return 1; + } + printf("%s", result_string); + + result_string = NULL; + + erg = qc_get_attribute_string(configuration_handle, qc_layer_name, 1, &result_string); + if (erg != 1) + { + puts("Error reading the LPAR Name"); + return 1; + } + printf("-%s", result_string); + + result_string = NULL; + if (layers > 2) { + + erg = qc_get_attribute_string(configuration_handle, qc_layer_name, 3, &result_string); + if (erg != 1) + { + puts("Error Reading the VM Name"); + return 1; + } + printf("-%s", result_string); + + result_string = NULL; + } + printf("\n", result_string); + return 0; } /* print_uuid */ /******************************************************************************/ @@ -501,7 +536,7 @@ void *configuration_handle_tmp = NULL; return 1; } /* endif */ /* still not im[plemented thatfore set to zero */ - create_uuid = list_attr = print_attr = 0; + list_attr = print_attr = 0; if (print_attr != 0) { print_user_attribute(NULL, print_attribute_param, layers); goto main_exit; @@ -523,7 +558,9 @@ void *configuration_handle_tmp = NULL; goto main_exit; } /* endif */ if (create_uuid != 0) { - print_uuid(); + if(print_uuid() == 1){ + goto main_exit_error; + } goto main_exit; } /* endif */ help(); @@ -535,5 +572,9 @@ main_exit: setenv("QC_AUTODUMP", "0", 1); qc_close(configuration_handle_tmp); } /* endif */ + return 0; + +main_exit_error: +return 1; } /* end main */ diff --git a/s390-tools.changes b/s390-tools.changes index 4c89785..5209143 100644 --- a/s390-tools.changes +++ b/s390-tools.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Feb 16 16:24:33 UTC 2023 - José Gómez + +- Implemented read_values -u. The result of -u is a unique identifier composed of: + * Machine Serial Number. + * LPAR Name. + * VM Name (can be optional). + ------------------------------------------------------------------- Mon Feb 6 17:00:40 UTC 2023 - Nikolay Gueorguiev diff --git a/s390-tools.spec b/s390-tools.spec index 713d8e2..639613a 100644 --- a/s390-tools.spec +++ b/s390-tools.spec @@ -1,7 +1,7 @@ # # spec file for package s390-tools # -# Copyright (c) 2001-2023 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed