--- a/usr/src/cmd/auto-install/auto_install.c Fri Jan 16 13:51:52 2009 -0500
+++ b/usr/src/cmd/auto-install/auto_install.c Tue Jan 20 08:52:20 2009 -0700
@@ -407,14 +407,12 @@
/*
* Should an existing Solaris fdisk partition be used
* on the selected target disk?
- *
- * If not, then we want to create a Solaris fdisk
- * partitioning encompassing the entire disk
*/
if (strncasecmp(adi.diskusepart, "true",
sizeof (adi.diskusepart)) == 0)
- auto_debug_print(AUTO_DBGLVL_INFO,
- "use existing fdisk partition set to true\n");
+ auto_log_print(
+ "Manifest indicates that Solaris fdisk partition must \n"
+ "be on the target disk prior to installation.\n");
#endif
if (auto_validate_target(&diskname, ¶ms, &adi) !=
AUTO_TD_SUCCESS) {
@@ -469,7 +467,7 @@
return (AUTO_INSTALL_FAILURE);
}
diskname = strdup(p);
- auto_log_print(gettext("diskname selected for installation is %s\n"),
+ auto_log_print(gettext("Disk name selected for installation is %s\n"),
diskname);
#ifndef __sparc
/*
--- a/usr/src/cmd/auto-install/auto_install.h Fri Jan 16 13:51:52 2009 -0500
+++ b/usr/src/cmd/auto-install/auto_install.h Tue Jan 20 08:52:20 2009 -0700
@@ -45,6 +45,7 @@
#define INSTALLED_ROOT_DIR "/a"
#define AUTO_UNKNOWN_STRING "unknown"
#define AUTO_DBGLVL_INFO LS_DBGLVL_INFO
+#define AUTO_DBGLVL_WARN LS_DBGLVL_WARN
#define AUTO_DBGLVL_ERR LS_DBGLVL_ERR
#define AUTO_VALID_MANIFEST 0
@@ -88,13 +89,21 @@
} auto_size_units_t;
typedef struct {
+ /*
+ * disk criteria for selection of target disk
+ */
char diskname[MAXNAMELEN];
char disktype[MAXNAMELEN];
char diskvendor[MAXNAMELEN];
uint64_t disksize;
+#ifndef __sparc
char diskusepart[6]; /* 'true' or 'false' */
+#endif
char diskoverwrite_rpool[6]; /* 'true' or 'false' */
- uint8_t install_slice_number;
+ /*
+ * other data related to disk target
+ */
+ uint8_t install_slice_number; /* install Solaris here */
} auto_disk_info;
typedef struct {
--- a/usr/src/cmd/auto-install/auto_parse.c Fri Jan 16 13:51:52 2009 -0500
+++ b/usr/src/cmd/auto-install/auto_parse.c Tue Jan 20 08:52:20 2009 -0700
@@ -263,8 +263,14 @@
p = get_manifest_element_value(
"ai_manifest/ai_target_device/target_device_use_solaris_partition");
- if (p != NULL)
+ if (p != NULL) {
+#ifdef __sparc
+ auto_log_print("Warning: ignoring manifest element "
+ "target_device_use_solaris_partition on SPARC\n");
+#else
(void) strncpy(adi->diskusepart, p, sizeof (adi->diskusepart));
+#endif
+ }
p = get_manifest_element_value(
"target_device_overwrite_root_zfs_pool");
--- a/usr/src/cmd/auto-install/auto_td.c Fri Jan 16 13:51:52 2009 -0500
+++ b/usr/src/cmd/auto-install/auto_td.c Tue Jan 20 08:52:20 2009 -0700
@@ -45,6 +45,7 @@
auto_disk_info *);
static disk_info_t *select_default_disk(disk_info_t *);
static boolean_t disk_criteria_specified(auto_disk_info *);
+static uint64_t find_solaris_disk_size(disk_info_t *);
om_handle_t handle;
void update_progress(om_callback_info_t *cb_data, uintptr_t app_data);
@@ -89,9 +90,7 @@
disk_parts_t *
get_disk_partition_info(om_handle_t handle, char *disk_name)
{
- disk_info_t *dt;
- disk_parts_t *dp, *dp1;
- int j;
+ disk_parts_t *dp;
if (disk_name == NULL) {
(void) auto_debug_print(AUTO_DBGLVL_INFO,
@@ -188,15 +187,15 @@
} else {
for (di = disks; di != NULL; di = di->next) {
if (strcmp(di->disk_name, *diskname) == 0) {
- auto_debug_print(AUTO_DBGLVL_INFO,
+ auto_log_print(
"Disk = %s found on the system\n",
di->disk_name);
break;
}
}
if (di == NULL) {
- auto_log_print(gettext("Cannot find the disk %s on the "
- "target system.\n"), *diskname);
+ auto_log_print(gettext("Cannot find the specified disk "
+ "%s on the target system.\n"), *diskname);
return (AUTO_TD_FAILURE);
}
}
@@ -287,7 +286,7 @@
* TODO: investigate - until then, use disk_size
*/
if (disk_size_sec < find_disk_size_sec) {
- auto_debug_print(AUTO_DBGLVL_INFO, "Disk %s "
+ auto_log_print("Disk %s "
"size %lld sectors smaller than requested "
"%lld sectors\n",
di->disk_name, disk_size_sec,
@@ -297,15 +296,17 @@
}
if (adi->disktype[0] != '\0' &&
!disk_type_match(adi->disktype, di->disk_type)) {
- auto_debug_print(AUTO_DBGLVL_INFO, "Disk %s "
- "not requested type %s\n",
- di->disk_name, adi->disktype);
+ auto_log_print(
+ "Disk %s type %s not requested type %s\n",
+ di->disk_name,
+ adi->disktype == NULL ? "(unknown)" : adi->disktype,
+ adi->disktype);
continue; /* no type match */
}
if (adi->diskvendor[0] != '\0' &&
(di->vendor == NULL ||
strcasecmp(adi->diskvendor, di->vendor) != 0)) {
- auto_debug_print(AUTO_DBGLVL_INFO, "Disk %s "
+ auto_log_print("Disk %s "
"vendor (%s) not requested vendor %s\n",
di->disk_name,
NULLCHK(di->vendor, "name not available"),
@@ -319,15 +320,19 @@
disk_parts_t *part;
part = get_disk_partition_info(handle, di->disk_name);
- if (part == NULL)
+ if (part == NULL) {
+ auto_log_print(
+ "Disk %s has no partition information\n",
+ di->disk_name);
continue;
+ }
for (ipr = 0; ipr < FD_NUMPART; ipr++)
if (part->pinfo[ipr].partition_type == SUNIXOS2)
break;
free(part);
if (ipr >= FD_NUMPART) { /* no Solaris partition */
- auto_debug_print(AUTO_DBGLVL_INFO, "Disk %s "
- "has no Solaris2 partitions\n",
+ auto_log_print(
+ "Disk %s has no Solaris2 partitions\n",
di->disk_name);
continue;
}
@@ -336,14 +341,15 @@
break;
}
if (di == NULL) {
- char *errmsg = "No disk that matches all manifest criteria "
- "was found\n";
+ char *errmsg = gettext(
+ "No disk that matches all manifest criteria was found\n");
printf(errmsg);
- auto_debug_print(AUTO_DBGLVL_ERR, errmsg);
+ auto_log_print(errmsg);
} else
- auto_debug_print(AUTO_DBGLVL_INFO, "Disk %s selected based on "
- "manifest criteria\n", di->disk_name);
+ auto_log_print(gettext(
+ "Disk %s selected based on manifest criteria\n"),
+ di->disk_name);
return (di);
}
@@ -362,69 +368,63 @@
select_default_disk(disk_info_t *disks)
{
disk_info_t *di;
- disk_slices_t *ds;
- uint64_t min_disk_size;
- int i;
+ uint64_t min_disk_size_MB;
+ uint64_t min_disk_size_secs;
- /*
- * get the minimum recommended disk size in sectors
- *
- * XXX since om_get_recommended_size() looks at the
- * .image_info file which isn't present in the case
- * of an automated installation, it just picks a
- * default. The lack of .image_info for automated
- * install is a deficiency that needs to be re-visited
- * longer term
- */
- min_disk_size = (om_get_recommended_size(NULL, NULL) * ONEMB) / 512;
+ /* get the minimum recommended disk size in sectors */
+ min_disk_size_MB = om_get_recommended_size(NULL, NULL);
+ auto_log_print(
+ "Checking any disks for minimum recommended size of %lld MB\n",
+ min_disk_size_MB);
+ min_disk_size_secs = min_disk_size_MB * MB_TO_SECTORS;
for (di = disks; di != NULL; di = di->next) {
- ds = om_get_slice_info(handle, di->disk_name);
- if (ds == NULL)
- continue;
+ uint64_t disk_size_secs = find_solaris_disk_size(di);
- /*
- * the list of slices is sorted in some order
- * to satisfy the GUI install requirements.
- * Loop through to find which slice corresponds
- * to slice 0 and compare it's size
- */
- for (i = 0; i < NDKMAP; i++) {
- if (ds->sinfo[i].slice_size >=
- min_disk_size) {
- auto_debug_print(AUTO_DBGLVL_INFO,
- "Default disk selected is %s\n",
- di->disk_name);
- return (di);
- } else {
- /*
- * no slice on this disk is
- * big enough, so move on to the
- * next disk
- */
- break;
- }
+ auto_log_print("Disk %s size listed as %lld MB\n",
+ di->disk_name, disk_size_secs / MB_TO_SECTORS);
+ if (disk_size_secs >= min_disk_size_secs) {
+ auto_log_print("Default disk selected is %s\n",
+ di->disk_name);
+ return (di);
}
+ /* disk is not big enough, so move on to the next disk */
}
- auto_debug_print(AUTO_DBGLVL_INFO, "No default disk selected\n");
+ auto_debug_print(AUTO_DBGLVL_INFO, "No default disk was selected\n");
return (NULL);
}
/*
+ * get disk (SPARC) or partition (x86) size in sectors from target information
+ */
+static uint64_t
+find_solaris_disk_size(disk_info_t *di)
+{
+ return (di->disk_size_sec > 0 ? di->disk_size_sec:
+ ((uint64_t)di->disk_size * MB_TO_SECTORS));
+}
+
+/*
* Check to see if the disk criteria was specified
* at all in the manifest.
*
* Returns:
- * B_TRUE if any of the disk type, disk vendor
- * or disk size fields were specified
+ * B_TRUE if any of the disk selection criteria were specified
* B_FALSE otherwise
*/
-boolean_t
+static boolean_t
disk_criteria_specified(auto_disk_info *adi)
{
- if ((adi->disktype[0] == '\0') &&
- (adi->diskvendor[0] == '\0') &&
- (adi->disksize == '\0'))
- return (B_FALSE);
-
- return (B_TRUE);
+ if (adi->disktype[0] != '\0')
+ return (B_TRUE);
+ if (adi->diskvendor[0] != '\0')
+ return (B_TRUE);
+ if (adi->disksize != 0)
+ return (B_TRUE);
+#ifndef __sparc
+ if (adi->diskusepart[0] != '\0')
+ return (B_TRUE);
+#endif
+ if (adi->diskoverwrite_rpool[0] != '\0')
+ return (B_TRUE);
+ return (B_FALSE);
}
--- a/usr/src/lib/liborchestrator/disk_slices.c Fri Jan 16 13:51:52 2009 -0500
+++ b/usr/src/lib/liborchestrator/disk_slices.c Tue Jan 20 08:52:20 2009 -0700
@@ -1071,15 +1071,16 @@
{
int isl;
slice_info_t *psinfo;
+#ifndef __sparc
int ipart;
disk_parts_t *dparts;
-
+#endif
/* check slice 2 for length */
psinfo = committed_disk_target->dslices->sinfo;
for (isl = 0; isl < NDKMAP; isl++, psinfo++)
if (psinfo->slice_id == 2 && psinfo->slice_size != 0)
return (psinfo->slice_size);
-#ifdef __sparc
+#ifndef __sparc
assert(committed_disk_target->dparts != NULL);
assert(committed_disk_target->dparts->pinfo != NULL);