Skip to content

Commit

Permalink
replace --no-growpart with --fix-disk
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Montes committed Jan 28, 2016
1 parent d7430bf commit e521090
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion data/cloud-init-firstboot.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ConditionFirstBoot=yes

[Service]
Type=oneshot
ExecStart=@prefix@/bin/cloud-init --user-data --metadata
ExecStart=@prefix@/bin/cloud-init --fix-disk --user-data --metadata
RemainAfterExit=yes
TimeoutSec=0

Expand Down
2 changes: 1 addition & 1 deletion data/cloud-init.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ConditionFirstBoot=no

[Service]
Type=oneshot
ExecStart=@prefix@/bin/cloud-init --metadata
ExecStart=@prefix@/bin/cloud-init --fix-disk --metadata
RemainAfterExit=yes
TimeoutSec=0

Expand Down
5 changes: 2 additions & 3 deletions docs/cloud-init.1
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ Get and process user data from data sources.
Get and process metadata from data sources.
.RE
.PP
\fB\-\-no\-growpart\fR
\fB\-\-fix\-disk\fR
.RS 4
Do not verify disk partitions. \fBcloud-init\fR
will not resize/fix partitions and/or filesystems.
Fix disk and filesystem if it is needed.
.RE
.PP
\fB\-v\fR, \fB\-\-version\fR
Expand Down
19 changes: 9 additions & 10 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum {
OPT_OPENSTACK_CONFIG_DRIVE,
OPT_USER_DATA,
OPT_METADATA,
OPT_NO_GROWPART,
OPT_FIX_DISK,
};

/* supported datasources */
Expand All @@ -79,7 +79,7 @@ static struct option opts[] = {
{ "metadata", no_argument, NULL, OPT_METADATA },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ "no-growpart", no_argument, NULL, OPT_NO_GROWPART },
{ "fix-disk", no_argument, NULL, OPT_FIX_DISK },
{ NULL, 0, NULL, 0 }
};

Expand Down Expand Up @@ -107,7 +107,7 @@ static void async_process_watcher(GPid pid, gint status, gpointer _data) {
}
}

bool async_checkdisk(gpointer data) {
bool async_fixdisk(gpointer data) {
char* root_disk;
bool result = false;

Expand Down Expand Up @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) {
int i;
unsigned int datasource = 0;
int result_code = EXIT_SUCCESS;
bool no_growpart = false;
bool fix_disk = false;
bool first_boot = false;
char* userdata_filename = NULL;
char* tmp_metadata_filename = NULL;
Expand Down Expand Up @@ -243,8 +243,7 @@ int main(int argc, char *argv[]) {
LOG(" --metadata get and process metadata from data sources\n");
LOG("-h, --help display this help message\n");
LOG("-v, --version display the version number of this program\n");
LOG(" --no-growpart do not verify disk partitions.\n");
LOG(" %s will not resize the filesystem\n", argv[0]);
LOG(" --fix-disk fix disk and filesystem if it is needed\n");
exit(EXIT_SUCCESS);
break;

Expand Down Expand Up @@ -275,8 +274,8 @@ int main(int argc, char *argv[]) {
process_metadata = true;
break;

case OPT_NO_GROWPART:
no_growpart = true;
case OPT_FIX_DISK:
fix_disk = true;
break;
}
}
Expand Down Expand Up @@ -353,8 +352,8 @@ int main(int argc, char *argv[]) {
LOG("Unable to create a new ptr array for async tasks\n");
}

if (!no_growpart && async_tasks_array) {
func = async_checkdisk;
if (fix_disk && async_tasks_array) {
func = async_fixdisk;
g_ptr_array_add(async_tasks_array, *(async_task_function**)&func);
}

Expand Down

0 comments on commit e521090

Please sign in to comment.