xscontainer is the back-end of XenServer's Container Management.
There are 3 main entry points:
This plugin is a XAPI plugin, which can be called through the host.call_plugin
method.
Reminder from the XAPI documentation:
string call_plugin (session ref, host ref, string, string, (string → string) map)
Parameters:
Result: Result from the plugin
In this case, a typical call should look like this:
host.call_plugin(sessionRef,hostRef,'xscontainer',function,args)
Example for starting a container:
host.call_plugin(sessionRef,hostRef,'xscontainer','start',(vmuuid: '<VM.UUID>', container: '<Container.UUID>'))
All the life cycle operation are defined in the function
parameters from the prototype given above. It could take those values:
args
is be a map with vmuuid: '<VM.UUID>', container: '<Container.UUID>'
The plugin returns data on a VM if it's registered.
The function
parameter could be:
args
is a map with only the VM: vmuuid: '<VM.UUID>'
You need to get the config drive default configuration for a specific template, by calling:
host.call_plugin(sessionRef,hostRef,'xscontainer','get_config_drive_default',(templateuuid: '<template.UUID>'))
You can modify this configuration (e.g by adding your SSH public key). You should store this configuration somewhere.
Then, after the VM is created in XenServer, you can call the config drive creation:
host.call_plugin(sessionRef,hostRef,'xscontainer','create_config_drive',(vmuuid: '<VM.UUID>', sruuid: <SR.UUID>, configuration: 'Your whole CloudConfig configuration'))
Which SR should I use? XenCenter and Xen Orchestra both use the SR of the first VDI created on the VM.