Commit 13e9bb03 authored by Andreas Beckmann's avatar Andreas Beckmann

New upstream version 384.111

parents 8bfa13bb 2a69a137
NVIDIA_VERSION = 384.98 NVIDIA_VERSION = 384.111
NVIDIA_VERSION = 384.98 NVIDIA_VERSION = 384.111
...@@ -52,7 +52,7 @@ static const char * __manage_grid_licenses_help = ...@@ -52,7 +52,7 @@ static const char * __manage_grid_licenses_help =
"for GRID vGPU or Quadro Virtual Datacenter Workstation on supported Tesla products."; "for GRID vGPU or Quadro Virtual Datacenter Workstation on supported Tesla products.";
static const char * __grid_virtual_workstation_help = static const char * __grid_virtual_workstation_help =
"Select this option to enable Quadro Virtual Datacenter Workstation license."; "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."; "Select this option to disable the Quadro Virtual Datacenter Workstation license.";
static const char * __license_edition_help = static const char * __license_edition_help =
"This section indicates the status of GRID licensing for the system."; "This section indicates the status of GRID licensing for the system.";
...@@ -226,7 +226,7 @@ static NvGriddConfigParams *AllocNvGriddConfigParams(void) ...@@ -226,7 +226,7 @@ static NvGriddConfigParams *AllocNvGriddConfigParams(void)
griddConfig->str[NV_GRIDD_SERVER_ADDRESS] = nvstrdup(""); griddConfig->str[NV_GRIDD_SERVER_ADDRESS] = nvstrdup("");
griddConfig->str[NV_GRIDD_SERVER_PORT] = nvstrdup(""); griddConfig->str[NV_GRIDD_SERVER_PORT] = nvstrdup("");
griddConfig->str[NV_GRIDD_FEATURE_TYPE] = nvstrdup("0"); 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_ADDRESS] = nvstrdup("");
griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT] = nvstrdup(""); griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT] = nvstrdup("");
...@@ -371,6 +371,9 @@ static void UpdateConfigFileLinesFromGriddConfig( ...@@ -371,6 +371,9 @@ static void UpdateConfigFileLinesFromGriddConfig(
/* Update the lines in pLines */ /* Update the lines in pLines */
for (i = 0; i < pLines->nLines; i++) { 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] = UpdateLineWithGriddConfig(griddConfig,
pLines->lines[i], pLines->lines[i],
itemIsPresent); itemIsPresent);
...@@ -396,52 +399,62 @@ static void UpdateGriddConfigFromGui( ...@@ -396,52 +399,62 @@ static void UpdateGriddConfigFromGui(
/* serverAddress */ /* serverAddress */
nvfree(griddConfig->str[NV_GRIDD_SERVER_ADDRESS]);
tmp = gtk_entry_get_text(GTK_ENTRY( tmp = gtk_entry_get_text(GTK_ENTRY(
ctk_manage_grid_license->txt_server_address)); 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 */ /* serverPort */
nvfree(griddConfig->str[NV_GRIDD_SERVER_PORT]);
tmp = gtk_entry_get_text(GTK_ENTRY( tmp = gtk_entry_get_text(GTK_ENTRY(
ctk_manage_grid_license->txt_server_port)); ctk_manage_grid_license->txt_server_port));
griddConfig->str[NV_GRIDD_SERVER_PORT] = if (strcmp(tmp, griddConfig->str[NV_GRIDD_SERVER_PORT]) != 0) {
nvstrdup((strcmp(tmp, "") != 0) ? tmp : "7070"); nvfree(griddConfig->str[NV_GRIDD_SERVER_PORT]);
griddConfig->str[NV_GRIDD_SERVER_PORT] =
nvstrdup((strcmp(tmp, "") != 0) ? tmp : "7070");
}
/* featureType */ /* featureType */
nvfree(griddConfig->str[NV_GRIDD_FEATURE_TYPE]);
switch (ctk_manage_grid_license->feature_type) { switch (ctk_manage_grid_license->feature_type) {
case GRID_LICENSED_FEATURE_TYPE_TESLA: case NV_GRID_LICENSE_FEATURE_TYPE_VAPP:
tmp = "0"; tmp = "0";
break; break;
case GRID_LICENSED_FEATURE_TYPE_VGPU: case NV_GRID_LICENSE_FEATURE_TYPE_VGPU:
tmp = "1"; tmp = "1";
break; break;
case GRID_LICENSED_FEATURE_TYPE_GVW: case NV_GRID_LICENSE_FEATURE_TYPE_QDWS:
tmp = "2"; tmp = "2";
break; break;
default: default:
tmp = "0"; 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 */ /* note: nothing in the UI will alter enableUI */
/* backupServerAddress */ /* backupServerAddress */
nvfree(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]);
tmp = gtk_entry_get_text(GTK_ENTRY( tmp = gtk_entry_get_text(GTK_ENTRY(
ctk_manage_grid_license->txt_secondary_server_address)); 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 */ /* backupServerPort */
nvfree(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]);
tmp = gtk_entry_get_text(GTK_ENTRY( tmp = gtk_entry_get_text(GTK_ENTRY(
ctk_manage_grid_license->txt_secondary_server_port)); 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) ...@@ -517,7 +530,6 @@ static int UpdateConfigFile(CtkManageGridLicense *ctk_manage_grid_license)
/* Read gridd.conf */ /* Read gridd.conf */
retErr = ReadConfigFile(&pLines); retErr = ReadConfigFile(&pLines);
if (retErr != 0) { if (retErr != 0) {
goto done; goto done;
} }
...@@ -556,16 +568,15 @@ static NvGriddConfigParams *GetNvGriddConfigParams(void) ...@@ -556,16 +568,15 @@ static NvGriddConfigParams *GetNvGriddConfigParams(void)
NvGriddConfigParams *griddConfig = NULL; NvGriddConfigParams *griddConfig = NULL;
int retErr; int retErr;
/* Create a griddConfig */
griddConfig = AllocNvGriddConfigParams();
/* Read gridd.conf */ /* Read gridd.conf */
retErr = ReadConfigFile(&pLines); retErr = ReadConfigFile(&pLines);
if (retErr != 0) { if (retErr != 0) {
goto done; goto done;
} }
/* Create a griddConfig */
griddConfig = AllocNvGriddConfigParams();
/* Update the griddConfig with the lines from gridd.conf */ /* Update the griddConfig with the lines from gridd.conf */
UpdateGriddConfigFromConfigFileLines(griddConfig, pLines); UpdateGriddConfigFromConfigFileLines(griddConfig, pLines);
...@@ -730,101 +741,205 @@ done: ...@@ -730,101 +741,205 @@ done:
static gboolean update_manage_grid_license_state_info(gpointer user_data) static gboolean update_manage_grid_license_state_info(gpointer user_data)
{ {
CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data); CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
gchar *licenseState = ""; gchar *licenseStatusMessage = "";
gboolean ret = TRUE; 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 */ /* Send license state request */
if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_STATE_REQUEST, if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_STATE_REQUEST,
&licenseStatus))) { &licenseState))) {
ret = FALSE; ret = FALSE;
} }
/* Set default unlicensed state string if could not communicate with nvidia-gridd */ if (licenseState == NV_GRID_UNLICENSED) {
if (licenseStatus == NV_GRID_UNLICENSED)
{
switch (ctk_manage_grid_license->feature_type) { switch (ctk_manage_grid_license->feature_type) {
case GRID_LICENSED_FEATURE_TYPE_VGPU: case NV_GRID_LICENSE_FEATURE_TYPE_VAPP:
licenseStatus = NV_GRID_UNLICENSED_VGPU; licenseStatus = NV_GRID_UNLICENSED_VAPP;
break; break;
case GRID_LICENSED_FEATURE_TYPE_TESLA: case NV_GRID_LICENSE_FEATURE_TYPE_QDWS:
case GRID_LICENSED_FEATURE_TYPE_GVW: licenseStatus = NV_GRID_UNLICENSED_QDWS_SELECTED;
licenseStatus = NV_GRID_UNLICENSED_TESLA; break;
break; case NV_GRID_LICENSE_FEATURE_TYPE_VGPU:
default: licenseStatus = NV_GRID_UNLICENSED_VGPU;
break; break;
default:
break;
} }
} }
else {
/* Set correct status message when Quadro Virtual Datacenter Workstation /* Send license feature type request */
* checkbox selected */ if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_FEATURE_TYPE_REQUEST,
if ((licenseStatus == NV_GRID_UNLICENSED_TESLA) && &griddFeatureType))) {
(ctk_manage_grid_license->license_edition_gvw_selected == TRUE)) { ret = FALSE;
licenseStatus = NV_GRID_UNLICENSED_GVW_SELECTED; }
/* 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) { switch (licenseStatus) {
case NV_GRID_UNLICENSED_VGPU: 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."; "Enter license server details and apply.";
break; break;
case NV_GRID_UNLICENSED_TESLA: case NV_GRID_UNLICENSED_VAPP:
licenseState = "Your system is currently running on " licenseStatusMessage = "Your system is currently configured for "
"Tesla (unlicensed)."; "GRID Virtual Apps.";
break; break;
case NV_GRID_UNLICENSED_GVW_SELECTED: case NV_GRID_UNLICENSED_QDWS_SELECTED:
licenseState = "Your system is currently running on Tesla (unlicensed).\n" licenseStatusMessage = "Your system is currently configured for GRID Virtual Apps.\n"
"Enter license server details and apply."; "Enter license server details and apply.";
break; break;
case NV_GRID_LICENSE_ACQUIRED_VGPU: case NV_GRID_LICENSE_ACQUIRED_VGPU:
licenseState = "Your system is licensed for GRID vGPU."; licenseStatusMessage = "Your system is licensed for GRID vGPU.";
break; break;
case NV_GRID_LICENSE_ACQUIRED_GVW: case NV_GRID_LICENSE_ACQUIRED_QDWS:
licenseState = "Your system is licensed for Quadro Virtual Datacenter " licenseStatusMessage = "Your system is licensed for Quadro Virtual Datacenter "
"Workstation Edition."; "Workstation.";
break; break;
case NV_GRID_LICENSE_REQUESTING_VGPU: 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."; "Your system does not have a valid GRID vGPU license.";
break; break;
case NV_GRID_LICENSE_REQUESTING_GVW: case NV_GRID_LICENSE_REQUESTING_QDWS:
licenseState = "Acquiring license for Quadro Virtual Datacenter " licenseStatusMessage = "Acquiring license for Quadro Virtual Datacenter "
"Workstation Edition.\n" "Workstation.\n"
"Your system does not have a valid Quadro Virtual Datacenter " " Your system is currently configured for GRID Virtual Apps.";
"Workstation license.";
break; break;
case NV_GRID_LICENSE_FAILED_VGPU: case NV_GRID_LICENSE_FAILED_VGPU:
licenseState = "Failed to acquire NVIDIA vGPU license."; licenseStatusMessage = "Failed to acquire GRID vGPU license.";
break; break;
case NV_GRID_LICENSE_FAILED_GVW: case NV_GRID_LICENSE_FAILED_QDWS:
licenseState = "Failed to acquire NVIDIA Quadro Virtual Datacenter " licenseStatusMessage = "Failed to acquire Quadro Virtual Datacenter "
"Workstation license."; "Worstation license.\n"
" Your system is currently configured for GRID Virtual Apps.";
break; break;
case NV_GRID_LICENSE_EXPIRED_VGPU: 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."; "Your system does not have a valid GRID vGPU license.";
break; break;
case NV_GRID_LICENSE_EXPIRED_GVW: case NV_GRID_LICENSE_EXPIRED_QDWS:
licenseState = "License for Quadro Virtual Datacenter Workstation " licenseStatusMessage = "License for Quadro Virtual Datacenter Workstation "
"has expired.\n" "has expired.\n"
"Your system does not have a valid Quadro Virtual Datacenter " "Your system does not have a valid Quadro Virtual Datacenter "
"Workstation license."; "Workstation license.";
break; break;
case NV_GRID_LICENSE_RESTART_REQUIRED: case NV_GRID_LICENSE_RESTART_REQUIRED:
licenseState = "Restart your system for Tesla Edition.\n" licenseStatusMessage = "Restart your system for GRID Virtual Apps.\n"
"Your system is currently running Quadro Virtual Datacenter " "Your system is currently licensed for Quadro Virtual Datacenter "
"Workstation Edition."; "Workstation.";
break; break;
default: 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."; "Enter license server details and apply.";
break; break;
} }
gtk_label_set_text(GTK_LABEL(ctk_manage_grid_license->label_license_state), gtk_label_set_text(GTK_LABEL(ctk_manage_grid_license->label_license_state),
licenseState); licenseStatusMessage);
return ret; return ret;
} }
...@@ -840,33 +955,62 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) ...@@ -840,33 +955,62 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data)
gboolean ret; gboolean ret;
int err = 0; int err = 0;
gint status = 0; gint status = 0;
gboolean configFileAvailable;
gboolean writable = FALSE;
/* Add information to gridd.conf file */ /* Check available config file */
err = UpdateConfigFile(ctk_manage_grid_license); configFileAvailable = checkConfigfile(&writable);
if (configFileAvailable && writable) {
if (err == 0) { /* Add information to gridd.conf file */
/* Send update request to nvidia-gridd */ err = UpdateConfigFile(ctk_manage_grid_license);
ret = send_message_to_gridd(ctk_manage_grid_license, if (err == 0) {
LICENSE_DETAILS_UPDATE_REQUEST, /* Send update request to nvidia-gridd */
&status); ret = send_message_to_gridd(ctk_manage_grid_license,
if ((!ret) || (status != LICENSE_DETAILS_UPDATE_SUCCESS)) { 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; GtkWidget *dlg, *parent;
parent = ctk_get_parent_window(GTK_WIDGET(ctk_manage_grid_license)); parent = ctk_get_parent_window(GTK_WIDGET(ctk_manage_grid_license));
dlg = gtk_message_dialog_new(GTK_WINDOW(parent), dlg = gtk_message_dialog_new(GTK_WINDOW(parent),
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, GTK_BUTTONS_OK,
"Unable to send license information " "Unable to update GRID license configuration "
"update request to the NVIDIA GRID " "file (%s): %s", GRID_CONFIG_FILE, strerror(err));
"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_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(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 { } else {
GtkWidget *dlg, *parent; GtkWidget *dlg, *parent;
...@@ -875,8 +1019,8 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) ...@@ -875,8 +1019,8 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data)
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, GTK_BUTTONS_OK,
"Unable to update GRID license configuration " "'%s' file does not exist.\n You do not have "
"file (%s): %s", GRID_CONFIG_FILE, strerror(err)); "permissions to create this file.", GRID_CONFIG_FILE);
gtk_dialog_run(GTK_DIALOG(dlg)); gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg); gtk_widget_destroy(dlg);
} }
...@@ -938,7 +1082,19 @@ static void license_edition_toggled(GtkWidget *widget, gpointer user_data) ...@@ -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); CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
gboolean enabled; 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)); enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
if (!enabled) { if (!enabled) {
...@@ -947,23 +1103,65 @@ static void license_edition_toggled(GtkWidget *widget, gpointer user_data) ...@@ -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"); 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); 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 = ctk_manage_grid_license->feature_type =
GRID_LICENSED_FEATURE_TYPE_GVW; NV_GRID_LICENSE_FEATURE_TYPE_QDWS;
ctk_manage_grid_license->license_edition_gvw_selected = TRUE; /* Enable Apply/Cancel button if the feature type selection has changed*/
} else if (GPOINTER_TO_INT(user_data) == GRID_LICENSED_FEATURE_TYPE_TESLA) { 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); gtk_widget_set_sensitive(ctk_manage_grid_license->box_server_info, FALSE);
/* force unlicensed mode */
ctk_manage_grid_license->feature_type = ctk_manage_grid_license->feature_type =
GRID_LICENSED_FEATURE_TYPE_TESLA; NV_GRID_LICENSE_FEATURE_TYPE_VAPP;
licenseState = "You selected Tesla (Unlicensed) mode."; statusBarMsg = "You selected GRID Virtual Apps Edition.";
ctk_manage_grid_license->license_edition_gvw_selected = FALSE; /* 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 */ /* update status bar message */
ctk_config_statusbar_message(ctk_manage_grid_license->ctk_config, 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) static gboolean disallow_whitespace(GtkWidget *widget, GdkEvent *event, gpointer user_data)
...@@ -1097,24 +1295,21 @@ static gboolean checkConfigfile(gboolean *writable) ...@@ -1097,24 +1295,21 @@ static gboolean checkConfigfile(gboolean *writable)
if ((fstat(fileno(configFile), &st) == 0) && (st.st_size == 0)) { if ((fstat(fileno(configFile), &st) == 0) && (st.st_size == 0)) {
if (*writable) { if (*writable) {
ConfigFileLines *pLines; ConfigFileLines *pLines;
templateFile = fopen(GRID_CONFIG_FILE_TEMPLATE, "r"); templateFile = fopen(GRID_CONFIG_FILE_TEMPLATE, "r");
if (templateFile == NULL) { if (templateFile == NULL) {
nv_error_msg("Config file '%s' had size zero.", nv_error_msg("Config file '%s' had size zero.",
GRID_CONFIG_FILE); GRID_CONFIG_FILE);
goto done; } else {
} pLines = ReadConfigFileStream(templateFile);
pLines = ReadConfigFileStream(templateFile);
WriteConfigFileStream(configFile, pLines); WriteConfigFileStream(configFile, pLines);
FreeConfigFileLines(pLines); FreeConfigFileLines(pLines);
}
} else { } else {
nv_error_msg("Config file '%s' had size zero.", nv_error_msg("Config file '%s' had size zero.",
GRID_CONFIG_FILE);