[patch iwhd 1/3] Add dc-rhev-image

Jim Meyering jim at meyering.net
Tue Mar 1 19:37:44 UTC 2011


Jim Meyering wrote:

> Pete Zaitcev wrote:
>> This patch adds a "script" that does the same thing dc-register-image
>> does for EC2, only for RHEV-M. Unfortunately, it wasn't feasible to get
>> away with a shell script, so dc-rhev-image is actually a C program.
>>
>> Instead of /bin/cp, gnulib's copy_file_preserving is used.
>>
>> This version adds the invocation harness to iwhd proper, with a type
>> of "fs-rhev-m".
>>
>> Documentation is not updated for now. The usual "?op=register" on a
>> pre-existing object is used to drive the registration. Generally the
>> RHEV-M registration looks very similar to EC2.
>>
>> Signed-off-by: Pete Zaitcev <zaitcev at redhat.com>
>>
>> ---
>>  .gitignore              |    1
>>  Makefile.am             |   13
>>  backend.c               |  268 ++++++
>>  bootstrap.conf          |    2
>>  configure.ac            |    5
>>  dc-rhev-image.c         | 1568 ++++++++++++++++++++++++++++++++++++++
>>  gnulib-tests/.gitignore |   22
>>  iwhd.spec.in            |    1
>>  lib/.gitignore          |   23
>>  setup.c                 |    8
>>  10 files changed, 1907 insertions(+), 4 deletions(-)
> ...
>> +	if (!json_is_string(elem)) {
>> +		fprintf(stderr,
>> +		    "ERROR configuration %s: tag %s is not a string\n",
>> +		    cfgname, cfgtag);
>> +		exit(2);
>
> In place of each use of fprintf, iwhd makes an effort to use error.
> That assures that the diagnostic starts with the program name, i.e.,
> "iwhd: ...", among other benefits.  For example, the above would
> become this, where ERR_INVAL is defined to 2:
>
>       error (ERR_INVAL, 0,
>              "ERROR configuration %s: tag %s is not a string\n",
>              cfgname, cfgtag);

What I suggested is not quite right.
With error, I should omit the trailing \n in the format string,
but other uses of error in your patch make it clear you
know that already.

...
> I'd write this:
>
>    	if (mkdir(tmpovfdir, 0770) < 0)
>    		error(EXIT_FAILURE, error,
>                       "ERROR Failed to make directory %s\n", tmpovfdir);

Here, too.


More information about the iwhd-devel mailing list