diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2018-01-10 15:02:06 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2018-01-10 15:02:06 -0800 |
commit | 2a69a137285fc9951ecc7de2714a886d6f917c09 (patch) | |
tree | e2597930ad36bb3f25a8af01af7a648eed11b281 | |
parent | 6fa8e5e7302107fa628ad8d39a3e7e82460b8ea5 (diff) |
-rw-r--r-- | doc/version.mk | 2 | ||||
-rw-r--r-- | samples/version.mk | 2 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkgridlicense.c | 519 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkgridlicense.h | 28 | ||||
-rw-r--r-- | src/libXNVCtrl/version.mk | 2 | ||||
-rw-r--r-- | src/nv_grid_dbus.h | 37 | ||||
-rw-r--r-- | src/version.h | 2 | ||||
-rw-r--r-- | src/version.mk | 2 | ||||
-rw-r--r-- | version.mk | 2 |
9 files changed, 392 insertions, 204 deletions
diff --git a/doc/version.mk b/doc/version.mk index 38de1ec..f4a6a7c 100644 --- a/doc/version.mk +++ b/doc/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 384.98 +NVIDIA_VERSION = 384.111 diff --git a/samples/version.mk b/samples/version.mk index 38de1ec..f4a6a7c 100644 --- a/samples/version.mk +++ b/samples/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 384.98 +NVIDIA_VERSION = 384.111 diff --git a/src/gtk+-2.x/ctkgridlicense.c b/src/gtk+-2.x/ctkgridlicense.c index a0ba600..f995d0a 100644 --- a/src/gtk+-2.x/ctkgridlicense.c +++ b/src/gtk+-2.x/ctkgridlicense.c @@ -52,7 +52,7 @@ static const char * __manage_grid_licenses_help = "for GRID vGPU or Quadro Virtual Datacenter Workstation on supported Tesla products."; static const char * __grid_virtual_workstation_help = "Select this option to enable Quadro Virtual Datacenter Workstation license."; -static const char * __tesla_unlicensed_help = +static const char * __grid_vapp_help = "Select this option to disable the Quadro Virtual Datacenter Workstation license."; static const char * __license_edition_help = "This section indicates the status of GRID licensing for the system."; @@ -226,7 +226,7 @@ static NvGriddConfigParams *AllocNvGriddConfigParams(void) griddConfig->str[NV_GRIDD_SERVER_ADDRESS] = nvstrdup(""); griddConfig->str[NV_GRIDD_SERVER_PORT] = nvstrdup(""); griddConfig->str[NV_GRIDD_FEATURE_TYPE] = nvstrdup("0"); - griddConfig->str[NV_GRIDD_ENABLE_UI] = nvstrdup("TRUE"); + griddConfig->str[NV_GRIDD_ENABLE_UI] = nvstrdup("FALSE"); griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS] = nvstrdup(""); griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT] = nvstrdup(""); @@ -371,6 +371,9 @@ static void UpdateConfigFileLinesFromGriddConfig( /* Update the lines in pLines */ for (i = 0; i < pLines->nLines; i++) { + /* TODO: "EnableUI" config parameter will never be + * set by the user through UI, so skip updating the + * pLines with "EnableUI" parameter */ pLines->lines[i] = UpdateLineWithGriddConfig(griddConfig, pLines->lines[i], itemIsPresent); @@ -396,52 +399,62 @@ static void UpdateGriddConfigFromGui( /* serverAddress */ - nvfree(griddConfig->str[NV_GRIDD_SERVER_ADDRESS]); tmp = gtk_entry_get_text(GTK_ENTRY( ctk_manage_grid_license->txt_server_address)); - griddConfig->str[NV_GRIDD_SERVER_ADDRESS] = nvstrdup(tmp ? tmp : ""); + if (strcmp(tmp, griddConfig->str[NV_GRIDD_SERVER_ADDRESS]) != 0) { + nvfree(griddConfig->str[NV_GRIDD_SERVER_ADDRESS]); + griddConfig->str[NV_GRIDD_SERVER_ADDRESS] = nvstrdup(tmp ? tmp : ""); + } /* serverPort */ - nvfree(griddConfig->str[NV_GRIDD_SERVER_PORT]); tmp = gtk_entry_get_text(GTK_ENTRY( ctk_manage_grid_license->txt_server_port)); - griddConfig->str[NV_GRIDD_SERVER_PORT] = - nvstrdup((strcmp(tmp, "") != 0) ? tmp : "7070"); + if (strcmp(tmp, griddConfig->str[NV_GRIDD_SERVER_PORT]) != 0) { + nvfree(griddConfig->str[NV_GRIDD_SERVER_PORT]); + griddConfig->str[NV_GRIDD_SERVER_PORT] = + nvstrdup((strcmp(tmp, "") != 0) ? tmp : "7070"); + } /* featureType */ - nvfree(griddConfig->str[NV_GRIDD_FEATURE_TYPE]); switch (ctk_manage_grid_license->feature_type) { - case GRID_LICENSED_FEATURE_TYPE_TESLA: - tmp = "0"; - break; - case GRID_LICENSED_FEATURE_TYPE_VGPU: - tmp = "1"; - break; - case GRID_LICENSED_FEATURE_TYPE_GVW: - tmp = "2"; - break; - default: - tmp = "0"; + case NV_GRID_LICENSE_FEATURE_TYPE_VAPP: + tmp = "0"; + break; + case NV_GRID_LICENSE_FEATURE_TYPE_VGPU: + tmp = "1"; + break; + case NV_GRID_LICENSE_FEATURE_TYPE_QDWS: + tmp = "2"; + break; + default: + tmp = "0"; + } + if (strcmp(tmp, griddConfig->str[NV_GRIDD_FEATURE_TYPE]) != 0) { + nvfree(griddConfig->str[NV_GRIDD_FEATURE_TYPE]); + griddConfig->str[NV_GRIDD_FEATURE_TYPE] = nvstrdup(tmp); } - griddConfig->str[NV_GRIDD_FEATURE_TYPE] = nvstrdup(tmp); /* note: nothing in the UI will alter enableUI */ /* backupServerAddress */ - nvfree(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]); tmp = gtk_entry_get_text(GTK_ENTRY( ctk_manage_grid_license->txt_secondary_server_address)); - griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS] = nvstrdup(tmp ? tmp : ""); + if (strcmp(tmp, griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]) != 0) { + nvfree(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]); + griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS] = nvstrdup(tmp ? tmp : ""); + } /* backupServerPort */ - nvfree(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]); tmp = gtk_entry_get_text(GTK_ENTRY( ctk_manage_grid_license->txt_secondary_server_port)); - griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT] = nvstrdup(tmp ? tmp : ""); + if (strcmp(tmp, griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]) != 0) { + nvfree(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]); + griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT] = nvstrdup(tmp ? tmp : ""); + } } /* @@ -517,7 +530,6 @@ static int UpdateConfigFile(CtkManageGridLicense *ctk_manage_grid_license) /* Read gridd.conf */ retErr = ReadConfigFile(&pLines); - if (retErr != 0) { goto done; } @@ -556,16 +568,15 @@ static NvGriddConfigParams *GetNvGriddConfigParams(void) NvGriddConfigParams *griddConfig = NULL; int retErr; + /* Create a griddConfig */ + griddConfig = AllocNvGriddConfigParams(); + /* Read gridd.conf */ retErr = ReadConfigFile(&pLines); - if (retErr != 0) { goto done; } - /* Create a griddConfig */ - griddConfig = AllocNvGriddConfigParams(); - /* Update the griddConfig with the lines from gridd.conf */ UpdateGriddConfigFromConfigFileLines(griddConfig, pLines); @@ -730,101 +741,205 @@ done: static gboolean update_manage_grid_license_state_info(gpointer user_data) { CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data); - gchar *licenseState = ""; + gchar *licenseStatusMessage = ""; gboolean ret = TRUE; - int licenseStatus = NV_GRID_UNLICENSED; + int licenseStatus = NV_GRID_UNLICENSED_VGPU; + int licenseState = NV_GRID_UNLICENSED; + int griddFeatureType = ctk_manage_grid_license->feature_type; /* Send license state request */ if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_STATE_REQUEST, - &licenseStatus))) { + &licenseState))) { ret = FALSE; } - /* Set default unlicensed state string if could not communicate with nvidia-gridd */ - if (licenseStatus == NV_GRID_UNLICENSED) - { + if (licenseState == NV_GRID_UNLICENSED) { switch (ctk_manage_grid_license->feature_type) { - case GRID_LICENSED_FEATURE_TYPE_VGPU: - licenseStatus = NV_GRID_UNLICENSED_VGPU; - break; - case GRID_LICENSED_FEATURE_TYPE_TESLA: - case GRID_LICENSED_FEATURE_TYPE_GVW: - licenseStatus = NV_GRID_UNLICENSED_TESLA; - break; - default: - break; + case NV_GRID_LICENSE_FEATURE_TYPE_VAPP: + licenseStatus = NV_GRID_UNLICENSED_VAPP; + break; + case NV_GRID_LICENSE_FEATURE_TYPE_QDWS: + licenseStatus = NV_GRID_UNLICENSED_QDWS_SELECTED; + break; + case NV_GRID_LICENSE_FEATURE_TYPE_VGPU: + licenseStatus = NV_GRID_UNLICENSED_VGPU; + break; + default: + break; } } - - /* Set correct status message when Quadro Virtual Datacenter Workstation - * checkbox selected */ - if ((licenseStatus == NV_GRID_UNLICENSED_TESLA) && - (ctk_manage_grid_license->license_edition_gvw_selected == TRUE)) { - licenseStatus = NV_GRID_UNLICENSED_GVW_SELECTED; + else { + /* Send license feature type request */ + if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_FEATURE_TYPE_REQUEST, + &griddFeatureType))) { + ret = FALSE; + } + /* Set the license feature type fetched from nvidia-gridd.*/ + ctk_manage_grid_license->gridd_feature_type = griddFeatureType; + + if ((licenseState == NV_GRID_LICENSED) || + (licenseState == NV_GRID_LICENSE_RENEWING) || + (licenseState == NV_GRID_LICENSE_RENEW_FAILED)) { + switch (ctk_manage_grid_license->feature_type) { + case NV_GRID_LICENSE_FEATURE_TYPE_VAPP: + licenseStatus = NV_GRID_LICENSE_ACQUIRED_QDWS; // Default status in licensed state on non-vGPU case + if (ctk_manage_grid_license->feature_type == ctk_manage_grid_license->gridd_feature_type) { + licenseStatus = NV_GRID_LICENSE_RESTART_REQUIRED; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_QDWS: + licenseStatus = NV_GRID_LICENSE_ACQUIRED_QDWS; + if (ctk_manage_grid_license->feature_type != ctk_manage_grid_license->gridd_feature_type) { + /* On licensed non-vGPU setup, mismatch in feature type fetched from nvidia-gridd service and + the feature type read from gridd.conf/UI controls indicates user has edited the feature type + directly in the gridd.conf file and hence those changes will not be reflected until the system + is rebooted. Set appropriate license status to indicate the same. */ + licenseStatus = NV_GRID_LICENSE_RESTART_REQUIRED; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_VGPU: + licenseStatus = NV_GRID_LICENSE_ACQUIRED_VGPU; + break; + default: + break; + } + } + else if (licenseState == NV_GRID_LICENSE_REQUESTING) { + switch (ctk_manage_grid_license->feature_type) { + case NV_GRID_LICENSE_FEATURE_TYPE_VAPP: + licenseStatus = NV_GRID_LICENSE_REQUESTING_QDWS; // Default status in license requesting state on non-vGPU case + if (ctk_manage_grid_license->feature_type == ctk_manage_grid_license->gridd_feature_type) { + licenseStatus = NV_GRID_UNLICENSED_VAPP; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_QDWS: + licenseStatus = NV_GRID_LICENSE_REQUESTING_QDWS; + if (ctk_manage_grid_license->feature_type != ctk_manage_grid_license->gridd_feature_type) { + /* On non-vGPU setup with license requesting state, mismatch in feature type fetched from nvidia-gridd service and + the feature type read from gridd.conf/UI controls indicates user has edited the feature type + directly in the gridd.conf file. So set appropriate license status message. */ + licenseStatus = NV_GRID_UNLICENSED_QDWS_SELECTED; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_VGPU: + licenseStatus = NV_GRID_LICENSE_REQUESTING_VGPU; + break; + default: + break; + } + } + else if (licenseState == NV_GRID_LICENSE_FAILED) { + switch (ctk_manage_grid_license->feature_type) { + case NV_GRID_LICENSE_FEATURE_TYPE_VAPP: + licenseStatus = NV_GRID_LICENSE_FAILED_QDWS; // Default status in license failed state on non-vGPU case + if (ctk_manage_grid_license->feature_type == ctk_manage_grid_license->gridd_feature_type) { + licenseStatus = NV_GRID_UNLICENSED_VAPP; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_QDWS: + licenseStatus = NV_GRID_LICENSE_FAILED_QDWS; + if (ctk_manage_grid_license->feature_type != ctk_manage_grid_license->gridd_feature_type) { + /* On non-vGPU setup with license failed state, mismatch in feature type fetched from nvidia-gridd service and + the feature type read from gridd.conf/UI controls indicates user has edited the feature type + directly in the gridd.conf file. So set appropriate license status message. */ + licenseStatus = NV_GRID_UNLICENSED_QDWS_SELECTED; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_VGPU: + licenseStatus = NV_GRID_LICENSE_FAILED_VGPU; + break; + default: + break; + } + } + else if (licenseState == NV_GRID_LICENSE_EXPIRED) { + switch (ctk_manage_grid_license->feature_type) { + case NV_GRID_LICENSE_FEATURE_TYPE_VAPP: + licenseStatus = NV_GRID_LICENSE_EXPIRED_QDWS; // Default status in license expired state on non-vGPU case + if (ctk_manage_grid_license->feature_type == ctk_manage_grid_license->gridd_feature_type) { + licenseStatus = NV_GRID_LICENSE_RESTART_REQUIRED; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_QDWS: + licenseStatus = NV_GRID_LICENSE_EXPIRED_QDWS; + if (ctk_manage_grid_license->feature_type != ctk_manage_grid_license->gridd_feature_type) { + /* On non-vGPU setup with expired license, mismatch in feature type fetched from nvidia-gridd service and + the feature type read from gridd.conf/UI controls indicates user has edited the feature type + directly in the gridd.conf file and hence those changes will not be reflected until the system + is rebooted. Set appropriate license status to indicate the same. */ + licenseStatus = NV_GRID_LICENSE_RESTART_REQUIRED; + } + break; + case NV_GRID_LICENSE_FEATURE_TYPE_VGPU: + licenseStatus = NV_GRID_LICENSE_EXPIRED_VGPU; + break; + default: + break; + } + } } - /* Show the message received */ switch (licenseStatus) { case NV_GRID_UNLICENSED_VGPU: - licenseState = "Your system does not have a valid GRID vGPU license.\n" + licenseStatusMessage = "Your system does not have a valid GRID vGPU license.\n" "Enter license server details and apply."; break; - case NV_GRID_UNLICENSED_TESLA: - licenseState = "Your system is currently running on " - "Tesla (unlicensed)."; + case NV_GRID_UNLICENSED_VAPP: + licenseStatusMessage = "Your system is currently configured for " + "GRID Virtual Apps."; break; - case NV_GRID_UNLICENSED_GVW_SELECTED: - licenseState = "Your system is currently running on Tesla (unlicensed).\n" + case NV_GRID_UNLICENSED_QDWS_SELECTED: + licenseStatusMessage = "Your system is currently configured for GRID Virtual Apps.\n" "Enter license server details and apply."; break; case NV_GRID_LICENSE_ACQUIRED_VGPU: - licenseState = "Your system is licensed for GRID vGPU."; + licenseStatusMessage = "Your system is licensed for GRID vGPU."; break; - case NV_GRID_LICENSE_ACQUIRED_GVW: - licenseState = "Your system is licensed for Quadro Virtual Datacenter " - "Workstation Edition."; + case NV_GRID_LICENSE_ACQUIRED_QDWS: + licenseStatusMessage = "Your system is licensed for Quadro Virtual Datacenter " + "Workstation."; break; case NV_GRID_LICENSE_REQUESTING_VGPU: - licenseState = "Acquiring license for GRID vGPU Edition.\n" + licenseStatusMessage = "Acquiring license for GRID vGPU.\n" "Your system does not have a valid GRID vGPU license."; break; - case NV_GRID_LICENSE_REQUESTING_GVW: - licenseState = "Acquiring license for Quadro Virtual Datacenter " - "Workstation Edition.\n" - "Your system does not have a valid Quadro Virtual Datacenter " - "Workstation license."; + case NV_GRID_LICENSE_REQUESTING_QDWS: + licenseStatusMessage = "Acquiring license for Quadro Virtual Datacenter " + "Workstation.\n" + " Your system is currently configured for GRID Virtual Apps."; break; case NV_GRID_LICENSE_FAILED_VGPU: - licenseState = "Failed to acquire NVIDIA vGPU license."; + licenseStatusMessage = "Failed to acquire GRID vGPU license."; break; - case NV_GRID_LICENSE_FAILED_GVW: - licenseState = "Failed to acquire NVIDIA Quadro Virtual Datacenter " - "Workstation license."; + case NV_GRID_LICENSE_FAILED_QDWS: + licenseStatusMessage = "Failed to acquire Quadro Virtual Datacenter " + "Worstation license.\n" + " Your system is currently configured for GRID Virtual Apps."; break; case NV_GRID_LICENSE_EXPIRED_VGPU: - licenseState = "Failed to renew license for GRID vGPU Edition.\n" + licenseStatusMessage = "GRID vGPU license has expired.\n" "Your system does not have a valid GRID vGPU license."; break; - case NV_GRID_LICENSE_EXPIRED_GVW: - licenseState = "License for Quadro Virtual Datacenter Workstation " + case NV_GRID_LICENSE_EXPIRED_QDWS: + licenseStatusMessage = "License for Quadro Virtual Datacenter Workstation " "has expired.\n" "Your system does not have a valid Quadro Virtual Datacenter " "Workstation license."; break; case NV_GRID_LICENSE_RESTART_REQUIRED: - licenseState = "Restart your system for Tesla Edition.\n" - "Your system is currently running Quadro Virtual Datacenter " - "Workstation Edition."; + licenseStatusMessage = "Restart your system for GRID Virtual Apps.\n" + "Your system is currently licensed for Quadro Virtual Datacenter " + "Workstation."; break; default: - licenseState = "Your system does not have a valid GPU license.\n" + licenseStatusMessage = "Your system does not have a valid GPU license.\n" "Enter license server details and apply."; break; } gtk_label_set_text(GTK_LABEL(ctk_manage_grid_license->label_license_state), - licenseState); + licenseStatusMessage); return ret; } @@ -840,33 +955,62 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) gboolean ret; int err = 0; gint status = 0; + gboolean configFileAvailable; + gboolean writable = FALSE; - /* Add information to gridd.conf file */ - err = UpdateConfigFile(ctk_manage_grid_license); - - if (err == 0) { - /* Send update request to nvidia-gridd */ - ret = send_message_to_gridd(ctk_manage_grid_license, - LICENSE_DETAILS_UPDATE_REQUEST, - &status); - if ((!ret) || (status != LICENSE_DETAILS_UPDATE_SUCCESS)) { + /* Check available config file */ + configFileAvailable = checkConfigfile(&writable); + if (configFileAvailable && writable) { + /* Add information to gridd.conf file */ + err = UpdateConfigFile(ctk_manage_grid_license); + if (err == 0) { + /* Send update request to nvidia-gridd */ + ret = send_message_to_gridd(ctk_manage_grid_license, + LICENSE_DETAILS_UPDATE_REQUEST, + &status); + if ((!ret) || (status != LICENSE_DETAILS_UPDATE_SUCCESS)) { + GtkWidget *dlg, *parent; + + parent = ctk_get_parent_window(GTK_WIDGET(ctk_manage_grid_license)); + + dlg = gtk_message_dialog_new(GTK_WINDOW(parent), + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + "Unable to send license information " + "update request to the NVIDIA GRID " + "licensing daemon.\n" + "Please make sure nvidia-gridd and " + "dbus-daemon are running and retry applying the " + "license settings.\n"); + gtk_dialog_run(GTK_DIALOG(dlg)); + gtk_widget_destroy(dlg); + } + } else { GtkWidget *dlg, *parent; parent = ctk_get_parent_window(GTK_WIDGET(ctk_manage_grid_license)); - dlg = gtk_message_dialog_new(GTK_WINDOW(parent), GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Unable to send license information " - "update request to the NVIDIA GRID " - "licensing daemon.\n" - "Please make sure nvidia-gridd and " - "dbus-daemon are running and retry applying the " - "license settings.\n"); + "Unable to update GRID license configuration " + "file (%s): %s", GRID_CONFIG_FILE, strerror(err)); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } + } else if (configFileAvailable && !(writable)) { + GtkWidget *dlg, *parent; + + parent = ctk_get_parent_window(GTK_WIDGET(ctk_manage_grid_license)); + dlg = gtk_message_dialog_new(GTK_WINDOW(parent), + GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "You do not have enough " + "permissions to edit '%s' file.", GRID_CONFIG_FILE); + gtk_dialog_run(GTK_DIALOG(dlg)); + gtk_widget_destroy(dlg); } else { GtkWidget *dlg, *parent; @@ -875,8 +1019,8 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Unable to update GRID license configuration " - "file (%s): %s", GRID_CONFIG_FILE, strerror(err)); + "'%s' file does not exist.\n You do not have " + "permissions to create this file.", GRID_CONFIG_FILE); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } @@ -938,7 +1082,19 @@ static void license_edition_toggled(GtkWidget *widget, gpointer user_data) { CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data); gboolean enabled; - gchar *licenseState = ""; + gchar *statusBarMsg = ""; + NvGriddConfigParams *griddConfig; + const char *textBoxServerStr, *textBoxServerPortStr, *textBoxSecondaryServerStr, *textBoxSecondaryServerPortStr; + + griddConfig = GetNvGriddConfigParams(); + if (!griddConfig) { + return; + } + + textBoxServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address)); + textBoxServerPortStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_port)); + textBoxSecondaryServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address)); + textBoxSecondaryServerPortStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port)); enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); if (!enabled) { @@ -947,23 +1103,65 @@ static void license_edition_toggled(GtkWidget *widget, gpointer user_data) } user_data = g_object_get_data(G_OBJECT(widget), "button_id"); - if (GPOINTER_TO_INT(user_data) == GRID_LICENSED_FEATURE_TYPE_GVW) { + if (GPOINTER_TO_INT(user_data) == NV_GRID_LICENSE_FEATURE_TYPE_QDWS) { gtk_widget_set_sensitive(ctk_manage_grid_license->box_server_info, TRUE); - licenseState = "You selected Quadro Virtual Datacenter Workstation Edition."; + statusBarMsg = "You selected Quadro Virtual Datacenter Workstation Edition."; ctk_manage_grid_license->feature_type = - GRID_LICENSED_FEATURE_TYPE_GVW; - ctk_manage_grid_license->license_edition_gvw_selected = TRUE; - } else if (GPOINTER_TO_INT(user_data) == GRID_LICENSED_FEATURE_TYPE_TESLA) { + NV_GRID_LICENSE_FEATURE_TYPE_QDWS; + /* Enable Apply/Cancel button if the feature type selection has changed*/ + if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2") != 0) { + /* Disable Apply/Cancel button if Primary server address textbox string is empty. */ + if (strcmp(textBoxServerStr, "") == 0) { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE); + } else { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, TRUE); + } + } else { + /* feature type selection has not changed. But Enable Apply/Cancel button when user make changes + in any of the textbox entries to retain those changes. */ + if ((strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], textBoxServerStr) != 0) || + ((strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS], textBoxSecondaryServerStr) != 0) || + (strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT], textBoxSecondaryServerPortStr) != 0) || + (strcmp(griddConfig->str[NV_GRIDD_SERVER_PORT], textBoxServerPortStr) != 0))) { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, TRUE); + } else { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE); + } + } + + } else if (GPOINTER_TO_INT(user_data) == NV_GRID_LICENSE_FEATURE_TYPE_VAPP) { gtk_widget_set_sensitive(ctk_manage_grid_license->box_server_info, FALSE); - /* force unlicensed mode */ ctk_manage_grid_license->feature_type = - GRID_LICENSED_FEATURE_TYPE_TESLA; - licenseState = "You selected Tesla (Unlicensed) mode."; - ctk_manage_grid_license->license_edition_gvw_selected = FALSE; + NV_GRID_LICENSE_FEATURE_TYPE_VAPP; + statusBarMsg = "You selected GRID Virtual Apps Edition."; + /* Enable Apply/Cancel button if the feature type selection has changed*/ + if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "0") != 0) { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, TRUE); + } else { + /* feature type selection has not changed. But Enable Apply/Cancel button when user make changes + in any of the textbox entries to retain those changes. */ + if ((strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], textBoxServerStr) != 0) || + ((strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS], textBoxSecondaryServerStr) != 0) || + (strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT], textBoxSecondaryServerPortStr) != 0) || + (strcmp(griddConfig->str[NV_GRIDD_SERVER_PORT], textBoxServerPortStr) != 0))) { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, TRUE); + } else { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE); + } + } } /* update status bar message */ ctk_config_statusbar_message(ctk_manage_grid_license->ctk_config, - "%s", licenseState); + "%s", statusBarMsg); + update_manage_grid_license_state_info(ctk_manage_grid_license); + FreeNvGriddConfigParams(griddConfig); } static gboolean disallow_whitespace(GtkWidget *widget, GdkEvent *event, gpointer user_data) @@ -1097,24 +1295,21 @@ static gboolean checkConfigfile(gboolean *writable) if ((fstat(fileno(configFile), &st) == 0) && (st.st_size == 0)) { if (*writable) { ConfigFileLines *pLines; - templateFile = fopen(GRID_CONFIG_FILE_TEMPLATE, "r"); if (templateFile == NULL) { nv_error_msg("Config file '%s' had size zero.", GRID_CONFIG_FILE); - goto done; - } - - pLines = ReadConfigFileStream(templateFile); + } else { + pLines = ReadConfigFileStream(templateFile); - WriteConfigFileStream(configFile, pLines); + WriteConfigFileStream(configFile, pLines); - FreeConfigFileLines(pLines); + FreeConfigFileLines(pLines); + } } else { nv_error_msg("Config file '%s' had size zero.", GRID_CONFIG_FILE); - goto done; } } ret = TRUE; @@ -1144,11 +1339,9 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, GtkWidget *button1 = NULL, *button2 = NULL; GSList *slist = NULL; gint ret; - gboolean configFileAvailable; DBusError err; DBusConnection* conn; DbusData *dbusData; - gboolean writable = FALSE; int64_t gridLicenseSupported; NvGriddConfigParams *griddConfig; @@ -1182,7 +1375,7 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, } /* GRID M6 is licensable gpu so we want to allow users to choose - * Quadro Virtual Datacenter Workstation and Unlicensed Tesla mode on baremetal setup. + * Quadro Virtual Datacenter Workstation and GRID Virtual Apps on baremetal setup. * When virtualization mode is NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_NONE * treat it same way like NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH. * So that it will show the Quadro Virtual Datacenter Workstation interface in case of @@ -1220,14 +1413,10 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, dbusData->dbus.dbusErrorFree(&err); } - /* Check available config file */ - configFileAvailable = checkConfigfile(&writable); - /* Initialize config parameters */ griddConfig = GetNvGriddConfigParams(); - if (griddConfig && - (strcmp(griddConfig->str[NV_GRIDD_ENABLE_UI], "FALSE") == 0)) { + (strcmp(griddConfig->str[NV_GRIDD_ENABLE_UI], "TRUE") != 0)) { return NULL; } @@ -1240,35 +1429,27 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, ctk_manage_grid_license->ctk_config = ctk_config; ctk_manage_grid_license->license_edition_state = mode; ctk_manage_grid_license->dbusData = dbusData; - ctk_manage_grid_license->license_edition_gvw_selected = FALSE; ctk_manage_grid_license->feature_type = 0; /* set default value for feature type based on the user configured parameter or virtualization mode */ if (griddConfig) { - if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "0")) - { - ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_TESLA; - } - else if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "1")) - { - ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_VGPU; - } - else if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2")) - { - ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_GVW; + /* Check Feature type "2" for Quadro Virtual Datacenter Workstation. */ + if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2") == 0) { + ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_QDWS; } - else - { - ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_TESLA; + else { + ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VAPP; } } /* Overwrite feature type in vGPU case */ if (ctk_manage_grid_license->license_edition_state == NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_VGPU) { - ctk_manage_grid_license->feature_type = GRID_LICENSED_FEATURE_TYPE_VGPU; + ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VGPU; } + ctk_manage_grid_license->gridd_feature_type = ctk_manage_grid_license->feature_type; + /* set container properties for the CtkManageGridLicense widget */ gtk_box_set_spacing(GTK_BOX(ctk_manage_grid_license), 5); @@ -1287,21 +1468,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox1); - /* Show message if config file not available and user do not have - * permissions to create new file. - */ - if (!configFileAvailable && !griddConfig) { - str = g_strdup_printf("'%s' file does not exist.\n You do not have " - "permissions to create this file.", GRID_CONFIG_FILE); - label = gtk_label_new(str); - g_free(str); - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 5); - - goto done; - } - if (mode == NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH) { label = gtk_label_new("License Edition:"); hbox = gtk_hbox_new(FALSE, 0); @@ -1320,15 +1486,15 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, slist = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button1)); gtk_box_pack_start(GTK_BOX(vbox3), button1, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(button1), "button_id", - GINT_TO_POINTER(GRID_LICENSED_FEATURE_TYPE_GVW)); + GINT_TO_POINTER(NV_GRID_LICENSE_FEATURE_TYPE_QDWS)); g_signal_connect(G_OBJECT(button1), "toggled", G_CALLBACK(license_edition_toggled), (gpointer) ctk_manage_grid_license); - button2 = gtk_radio_button_new_with_label(slist, "Tesla (Unlicensed)"); + button2 = gtk_radio_button_new_with_label(slist, "GRID Virtual Apps"); gtk_box_pack_start(GTK_BOX(vbox3), button2, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(button2), "button_id", - GINT_TO_POINTER(GRID_LICENSED_FEATURE_TYPE_TESLA)); + GINT_TO_POINTER(NV_GRID_LICENSE_FEATURE_TYPE_VAPP)); g_signal_connect(G_OBJECT(button2), "toggled", G_CALLBACK(license_edition_toggled), @@ -1336,13 +1502,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, } - /* Only users with sufficient privileges can update server address - * and port number. - */ - if (!writable) { - gtk_widget_set_sensitive(GTK_WIDGET(vbox2), FALSE); - } - /* Show current license status message */ ctk_manage_grid_license->label_license_state = gtk_label_new("Unknown"); hbox = gtk_hbox_new(FALSE, 0); @@ -1505,7 +1664,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, /* Apply button */ ctk_manage_grid_license->btn_apply = gtk_button_new_with_label (" Apply "); - gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE); gtk_widget_set_size_request(ctk_manage_grid_license->btn_apply, 100, -1); ctk_config_set_tooltip(ctk_config, ctk_manage_grid_license->btn_apply, __apply_button_help); @@ -1520,7 +1678,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, /* Cancel button */ ctk_manage_grid_license->btn_cancel = gtk_button_new_with_label (" Cancel "); - gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE); gtk_widget_set_size_request(ctk_manage_grid_license->btn_cancel, 100, -1); ctk_config_set_tooltip(ctk_config, ctk_manage_grid_license->btn_cancel, __cancel_button_help); @@ -1532,17 +1689,16 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, /* Set license edition toggle button active */ if (button2 && button1) { - if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2") == 0) { + if (ctk_manage_grid_license->feature_type == NV_GRID_LICENSE_FEATURE_TYPE_QDWS) { /* Set 'Quadro Virtual Datacenter Workstation' toggle button active */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button1), TRUE); } else { - /* Set 'Tesla (unlicensed)' toggle button active */ + /* Set 'GRID Virtual Apps' toggle button active */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button2), TRUE); } } - FreeNvGriddConfigParams(griddConfig); /* Register a timer callback to update license status info */ str = g_strdup_printf("Manage GRID License"); @@ -1552,10 +1708,23 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target, str, (GSourceFunc) update_manage_grid_license_state_info, (gpointer) ctk_manage_grid_license); - g_free(str); + update_manage_grid_license_state_info(ctk_manage_grid_license); -done: + /* Enable Apply/Cancel button if there is mismatch between feature type fetched from nvidia-gridd + and feature type updated from UI/gridd.conf. */ + if (ctk_manage_grid_license->feature_type != ctk_manage_grid_license->gridd_feature_type) { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, TRUE); + } + else { + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE); + gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE); + } + + g_free(str); + FreeNvGriddConfigParams(griddConfig); + gtk_widget_show_all(GTK_WIDGET(ctk_manage_grid_license)); return GTK_WIDGET(ctk_manage_grid_license); @@ -1580,8 +1749,8 @@ GtkTextBuffer *ctk_manage_grid_license_create_help(GtkTextTagTable *table, ctk_help_heading(b, &i, "Quadro Virtual Datacenter Workstation"); ctk_help_para(b, &i, "%s", __grid_virtual_workstation_help); - ctk_help_heading(b, &i, "Tesla (Unlicensed)"); - ctk_help_para(b, &i, "%s", __tesla_unlicensed_help); + ctk_help_heading(b, &i, "GRID Virtual Apps"); + ctk_help_para(b, &i, "%s", __grid_vapp_help); } ctk_help_heading(b, &i, "License Server"); diff --git a/src/gtk+-2.x/ctkgridlicense.h b/src/gtk+-2.x/ctkgridlicense.h index 54ac6d2..c72a8ef 100644 --- a/src/gtk+-2.x/ctkgridlicense.h +++ b/src/gtk+-2.x/ctkgridlicense.h @@ -20,11 +20,6 @@ #ifndef __CTK_MANAGE_GRID_LICENSE_H__ #define __CTK_MANAGE_GRID_LICENSE_H__ -// Licensed feature types -#define GRID_LICENSED_FEATURE_TYPE_TESLA 0 -#define GRID_LICENSED_FEATURE_TYPE_VGPU 1 -#define GRID_LICENSED_FEATURE_TYPE_GVW 2 - G_BEGIN_DECLS #define CTK_TYPE_MANAGE_GRID_LICENSE (ctk_manage_grid_license_get_type()) @@ -66,10 +61,29 @@ struct _CtkManageGridLicense DbusData *dbusData; gint license_edition_state; - gboolean license_edition_gvw_selected; - gint feature_type; + gint feature_type; // Feature type from UI/gridd.conf. + int gridd_feature_type; // Feature type fetched from nvidia-gridd. }; +/* + * Status related to GRID licensing + */ +typedef enum +{ + NV_GRID_UNLICENSED_VGPU = 0, + NV_GRID_UNLICENSED_VAPP, + NV_GRID_UNLICENSED_QDWS_SELECTED, + NV_GRID_LICENSE_ACQUIRED_VGPU, + NV_GRID_LICENSE_ACQUIRED_QDWS, + NV_GRID_LICENSE_REQUESTING_VGPU, + NV_GRID_LICENSE_REQUESTING_QDWS, + NV_GRID_LICENSE_FAILED_VGPU, + NV_GRID_LICENSE_FAILED_QDWS, + NV_GRID_LICENSE_EXPIRED_VGPU, + NV_GRID_LICENSE_EXPIRED_QDWS, + NV_GRID_LICENSE_RESTART_REQUIRED, +} licenseStatus; + struct _CtkManageGridLicenseClass { GtkVBoxClass parent_class; diff --git a/src/libXNVCtrl/version.mk b/src/libXNVCtrl/version.mk index 38de1ec..f4a6a7c 100644 --- a/src/libXNVCtrl/version.mk +++ b/src/libXNVCtrl/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 384.98 +NVIDIA_VERSION = 384.111 diff --git a/src/nv_grid_dbus.h b/src/nv_grid_dbus.h index 7c4f51e..557c781 100644 --- a/src/nv_grid_dbus.h +++ b/src/nv_grid_dbus.h @@ -27,28 +27,33 @@ #define NV_GRID_DBUS_OBJECT "/nvidia/grid/license" #define NV_GRID_DBUS_INTERFACE "nvidia.grid.license" #define NV_GRID_DBUS_METHOD "GridLicenseState" +#define LICENSE_DETAILS_UPDATE_SUCCESS 0 #define LICENSE_STATE_REQUEST 1 #define LICENSE_DETAILS_UPDATE_REQUEST 2 -#define LICENSE_DETAILS_UPDATE_SUCCESS 0 +#define LICENSE_FEATURE_TYPE_REQUEST 3 + +/* + * GRID license states + */ +typedef enum +{ + NV_GRID_UNLICENSED = 0, + NV_GRID_LICENSE_REQUESTING, + NV_GRID_LICENSE_FAILED, + NV_GRID_LICENSED, + NV_GRID_LICENSE_RENEWING, + NV_GRID_LICENSE_RENEW_FAILED, + NV_GRID_LICENSE_EXPIRED, +} gridLicenseState; /* - * List of grid license states + * GRID license feature types */ typedef enum { - NV_GRID_UNLICENSED = 0, // Your system does not have a valid GPU license. Enter license server details and apply. - NV_GRID_UNLICENSED_VGPU, // Your system does not have a valid vGPU license. Enter license server details and apply. - NV_GRID_UNLICENSED_TESLA, // Your system is currently running on Tesla (unlicensed). - NV_GRID_UNLICENSED_GVW_SELECTED, // Your system is currently running on Tesla (unlicensed). Enter license server details and apply. - NV_GRID_LICENSE_ACQUIRED_VGPU, // Your system is licensed for GRID vGPU. - NV_GRID_LICENSE_ACQUIRED_GVW, // Your system is licensed for Quadro Virtual Datacenter Workstation Edition. - NV_GRID_LICENSE_REQUESTING_VGPU, // Acquiring license for GRID vGPU Edition. Your system does not have a valid GRID vGPU license. - NV_GRID_LICENSE_REQUESTING_GVW, // Acquiring license for Quadro Virtual Datacenter Workstation Edition. Your system does not have a valid Quadro Virtual Datacenter Workstation license. - NV_GRID_LICENSE_FAILED_VGPU, // Failed to acquire NVIDIA vGPU license. - NV_GRID_LICENSE_FAILED_GVW, // Failed to acquire NVIDIA Quadro Virtual Datacenter Workstation license. - NV_GRID_LICENSE_EXPIRED_VGPU, // Failed to renew license for GRID vGPU Edition. Your system does not have a valid GRID vGPU license. - NV_GRID_LICENSE_EXPIRED_GVW, // License for Quadro Virtual Datacenter Workstation has expired. Your system does not have a valid Quadro Virtual Datacenter Workstation license. - NV_GRID_LICENSE_RESTART_REQUIRED, // Restart your system for Tesla Edition. Your system is currently running Quadro Virtual Datacenter Workstation Edition. -} gridLicenseStatus; + NV_GRID_LICENSE_FEATURE_TYPE_VAPP = 0, + NV_GRID_LICENSE_FEATURE_TYPE_VGPU, + NV_GRID_LICENSE_FEATURE_TYPE_QDWS, +} gridLicenseFeatureType; #endif // _NVIDIA_NV_GRID_DBUS_H_ diff --git a/src/version.h b/src/version.h index e415288..147c91a 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define NVIDIA_VERSION "384.98" +#define NVIDIA_VERSION "384.111" diff --git a/src/version.mk b/src/version.mk index 38de1ec..f4a6a7c 100644 --- a/src/version.mk +++ b/src/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 384.98 +NVIDIA_VERSION = 384.111 @@ -1 +1 @@ -NVIDIA_VERSION = 384.98 +NVIDIA_VERSION = 384.111 |