[libvirt] [PATCH] Openvz: how to use a nondefault config

Anton Protopopov aspsk2 at gmail.com
Mon Mar 16 15:12:07 UTC 2009


Hi all.

When libvirt creates an OpenVZ machine, it does smth like
  # vzctl create $ctid --ostemplate `ostemplate`
And we can't specify an --config `config` argument. In this case vzctl
chooses
a default config file (a value of CONFIG variable from /etc/vz/vz.conf).

But there are cases when we want to specify a config file directly, as in
  # vzctl create $ctid --ostemplate `ostemplate` --config `config`

I think, that we can try to use the same `ostemplate` name as --config
value, if corresponding template exists,
i.e., if there is a file /etc/vz/conf/ve-`ostemplate`.conf-sample, libvirt
will run a command
  # vzctl create $ctid --ostemplate `ostemplate` --config `ostemplate`
Otherwise, it will run it's default command
  # vzctl create $ctid --ostemplate `ostemplate`
(the same arguments.)

-----------
Example of creating a machine with nondefault config:

1. Create /etc/vz/conf/ve-altlinux-test.conf-sample
2. Create /var/lib/vz/template/cache/altlinux-test.tar
3. Use libvirt with (hypothetical) XML:
<domain type="openvz">
  <name>100</name>
  <memory>1</memory>
  <os><type>exe</type></os>
  <devices>
    <filesystem type="template">
      <source name="altlinux-test"/>
      <target dir="/"/>
    </filesystem>
  </devices>
</domain>

-----------
Example of creating a machine with default config:

1. Ensure there is no /etc/vz/conf/ve-altlinux-test.conf-sample
2. Create /var/lib/vz/template/cache/altlinux-test.tar
3. Use libvirt with (the same as above) XML file
-----------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090316/f38df292/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt_openvz_access_profile.patch
Type: application/octet-stream
Size: 2474 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090316/f38df292/attachment-0001.obj>


More information about the libvir-list mailing list