[Libosinfo] how do i add an extra config parameter to InstallScript?

Christophe Fergeau cfergeau at redhat.com
Tue Apr 2 09:03:09 UTC 2013


Hey Dennis,

On Mon, Apr 01, 2013 at 06:39:34PM -0400, Dennis Kliban wrote:
> I have installed libosinfo 0.2.6 from koji.  The documentation that was
> installed with the libosinfo-devel package did not seem to be up to date.

Looking at the documentation at
/usr/share/gtk-doc/html/Libosinfo/index.html , I see that the various
install-related classes do not appear in the generated HTML, is that what
you mean when you say it's not up to date?

> After some googling I found the following pages:
> 
> http://www.valadoc.org/#!wiki=libosinfo-1.0/index
> The documentation above seems to go well with the codebase in 0.2.6.  Is
> this documentation ok to use with 0.2.6?  Also wondering why the above
> site has the version listed as 1.0?

Yes this documentation should be fine to use with 0.2.6. The -1.0 is the
same as the suffix -1.0 used the .pc and .gir files libosinfo generates.
For now this is a bit weird, but when 1.0 is released, if we decide to make
ABI incompatible changes, then this allows 1.0 and 2.0 to be installed in
parallel thanks to the -1.0 / -2.0 suffix on files/dirs that would
otherwise conflicts.


> I am attempting to use libosinfo to generate kickstart files for an image
> building service for OpenStack.  I need to be able to add extra
> parameters to the InstallScript.  According to the documentation,
> InstallScript object can have InstallConfigParam added to it.  My
> understanding is that the InstallConfigParam consists of a name and a
> policy.  What does a policy for a InstallConfigParam look like?

Looking into
/usr/include/libosinfo-1.0/osinfo/osinfo_install_config_param.h
you can find this:
/**
 * OsinfoInstallConfigParamPolicy:
 * @OSINFO_INSTALL_CONFIG_PARAM_POLICY_NONE: no policy defined
 * @OSINFO_INSTALL_CONFIG_PARAM_POLICY_REQUIRED: config parameter is
 * required
 * @OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL: config parameter may be
 * omitted
 *
 * Policy for configuration parameter presence
 */

For the XML equivalent, you can have a look at the RNG schema at
/usr/share/libosinfo/schemas/libosinfo.rng
which has

  <element name='config'>
    <oneOrMore>
      <element name='param'>
        <attribute name="name"/>
        <attribute name="policy">
          <ref name='policies'/>
        </attribute>
        <optional>
          <attribute name="value-map"/>
        </optional>
      </element>
    </oneOrMore>
  </element>

  <define name='policies'>
    <data type="string">
      <param name="pattern">required|optional</param>
    </data>
  </define>

This means the XML 'config' element has a mandatory 'param' element, which
in turn has a 'policy' attribute, which valid values are 'required' or
'optional':

<config>
  <param policy='required'/>
</config>

or

<config>
  <param policy='optional'/>
</config>

(I've omitted the other unrelated attributes/elements).

You can also have a look at existing install scripts when in doubt ;)

> I'd like to add the following line to the kickstart file.  It is not
> found in the default kickstart file for Fedorav 18.  How do I do this?
> 
> url --url=http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/os/

Hmm I'd have to look more into this, but at this point I'm afraid you have
to
- either patch libosinfo to optionally support this (imo this would be a
useful addition)
- or duplicate the fedora install script under a different ID, with just
  this argument added, and make sure you load it at the same time you load
  the libosinfo database.

Hope that helps,

Christophe




> 
> Thanks,
> Dennis 
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20130402/217fa269/attachment.sig>


More information about the Libosinfo mailing list