Dawnfoster (Talk | contribs) m (moved Infrastructure/IMG to Release Infrastructure/IMG: Original title was broader than intended) |
|||
| Line 98: | Line 98: | ||
- gcc | - gcc | ||
- -google-chrome | - -google-chrome | ||
| - | + | ||
= Client = | = Client = | ||
For demonstration see [http://meego.gitorious.org/meego-infrastructure-tools/imger/blobs/master/src/meego_img/client.py client.py] for example client. | For demonstration see [http://meego.gitorious.org/meego-infrastructure-tools/imger/blobs/master/src/meego_img/client.py client.py] for example client. | ||
| + | |||
== Usage == | == Usage == | ||
| Line 111: | Line 112: | ||
: -t|--type <imagetype>, image type, can be of: livecd, liveusb, loop, raw, nand, mrstnand, vdi or vmdk | : -t|--type <imagetype>, image type, can be of: livecd, liveusb, loop, raw, nand, mrstnand, vdi or vmdk | ||
: -a|--async <kickstart_file.ks>, the kickstart file to submit | : -a|--async <kickstart_file.ks>, the kickstart file to submit | ||
| - | + | --> | |
= BOSS Client = | = BOSS Client = | ||
See [http://meego.gitorious.org/meego-infrastructure-tools/imger/blobs/master/src/meego_img/boss_client.py boss_client.py] for example BOSS client. | See [http://meego.gitorious.org/meego-infrastructure-tools/imger/blobs/master/src/meego_img/boss_client.py boss_client.py] for example BOSS client. | ||
| - | + | ||
== Usage == | == Usage == | ||
| - | boss_client.py <kickstart.ks> | + | Usage: boss_client.py -t|--type <imagetype> -e|--email <author@email> -s|--submit -k <kickstart_file.ks> |
| + | |||
| + | boss_client.py Sends a message (poll for result later) to the BOSS, using | ||
| + | <kickstart.ks> as the kickstart file. | ||
| + | |||
| + | Options: | ||
| + | -h, --help show this help message and exit | ||
| + | -s, --submit Submit to BOSS, takes no options | ||
| + | -k KICKSTART, --kickstart=KICKSTART | ||
| + | Kickstart file | ||
| + | -t TYPE, --type=TYPE Image type | ||
| + | -n NAME, --name=NAME Image name | ||
| + | -e EMAIL, --email=EMAIL | ||
| + | Author email | ||
= Django client = | = Django client = | ||
| Line 178: | Line 192: | ||
* imagetype, select field for the image type, with values: livecd, liveusb, loop, raw, nand, mrstnand, vdi, vmdk | * imagetype, select field for the image type, with values: livecd, liveusb, loop, raw, nand, mrstnand, vdi, vmdk | ||
* ksfile, the raw kickstart file | * ksfile, the raw kickstart file | ||
| - | + | <!-- | |
= Server = | = Server = | ||
| Line 184: | Line 198: | ||
This section documents the server component of IMG. | This section documents the server component of IMG. | ||
| + | --> | ||
| + | |||
| + | = Worker configuration = | ||
| + | |||
| + | The configuration file is to be installed in /etc/imger/img.conf and a sample file is [http://meego.gitorious.org/meego-infrastructure-tools/imger/blobs/master/src/meego_img/img.conf here]. | ||
| + | |||
| + | == Configuration file == | ||
| + | base_url: A base URL that has a direct access to the base_dir via HTTP, example http://127.0.0.1 | ||
| + | base_dir: A directory to put the finished images, example /var/www/images | ||
| + | num_workers: Number of workers to start, OBSOLETE, USE INITSCRIPT OR MANUALLY RUN MANY PARTICIPANTS | ||
| + | post_creation: Path to a script to run after the image is created | ||
| + | use_kvm: Wether to use a virtual machine, values are "yes" or "no" | ||
| + | |||
| + | mic_opts: Example, mic_opts = --save-kernel, --use_comps, so comma separated options | ||
| + | |||
| + | amqp_host: Host that runs BOSS | ||
| + | amqp_user: Username to tap into the BOSS virtual host | ||
| + | amqp_pwd: Password | ||
| + | amqp_vhost: The actual virtual host to connect to | ||
| + | |||
| + | == Virtual machine == | ||
| + | |||
| + | Currently, IMGer can run the MIC2 jobs inside a KVM virtual machine, the only prerequisites are that image is located in /usr/share/img/base.img (configurable in the future) path and that the virtual machine has MIC2 installed and configured. | ||
| + | |||
| + | One must also confirm that the image SSH-keys in the source distribution are configured in the virtual machine and both keys exist in /usr/share/img (configurable in the future) | ||
| + | |||
| + | = BOSS Workitem definition = | ||
| + | |||
| + | == Input == | ||
| + | |||
| + | The following defines the input dictionary for the participant: | ||
| + | "kickstart" : a kickstart file, in raw, not a path | ||
| + | "email": email address, not parsed so can be a dummy address | ||
| + | "id": a simple UUID, eg. from pythons uuid library | ||
| + | "type":type, from values: livecd, liveusb, loop, raw, nand, mrstnand, vdi or vmdk | ||
| + | "name":name, a simple string for the image name | ||
| + | |||
| + | == Output == | ||
| + | |||
| + | The work item can contain the following dictionary entries: | ||
| + | |||
| + | Status: Status, is either "DONE" or "ERROR" in the final workitem, depending on success/failure | ||
| + | URL: URL to a image/log/kickstart file location on the worker | ||
| + | Error: An error string with details of the error, if any | ||
| + | Image: A direct URL to the finished image | ||
| + | Log: A direct URL to the log file of the mic2 output | ||
| + | <!-- | ||
== Functionality == | == Functionality == | ||
| Line 266: | Line 327: | ||
* imagetype, image type of values: livecd, liveusb, loop, raw, nand, mrstnand, vdi or vmdk | * imagetype, image type of values: livecd, liveusb, loop, raw, nand, mrstnand, vdi or vmdk | ||
* ksfile, the actual kickstar file to upload (in text) | * ksfile, the actual kickstar file to upload (in text) | ||
| + | --> | ||
Contents |
IMG (Image Me Give) is a small python client/server application suite, its sole job is to get a POST'd kickstart file from a user and then run Moblin-Image-Creator. It is also possible to use kickstarter yaml files to create a tailor-made image or using the default selection of yaml templates.
The application consists of two parts, django frontend and the actual image creation application. Both of them are connected via AMQP, RabbitMQ is used as the server.
So an example workflow:
See boss_client.py for example BOSS client.
Usage: boss_client.py -t|--type <imagetype> -e|--email <author@email> -s|--submit -k <kickstart_file.ks>
boss_client.py Sends a message (poll for result later) to the BOSS, using <kickstart.ks> as the kickstart file.
Options:
-h, --help show this help message and exit
-s, --submit Submit to BOSS, takes no options
-k KICKSTART, --kickstart=KICKSTART
Kickstart file
-t TYPE, --type=TYPE Image type
-n NAME, --name=NAME Image name
-e EMAIL, --email=EMAIL
Author email
url(r'submit/$', 'meego_img.app.views.submit', name='img-app-submit'), url(r'queue/$', 'meego_img.app.views.queue', name='img-app-queue'), url(r'job/(?P<msgid>\S+)$', 'meego_img.app.views.job', name='img-app-job'), url(r'images/(?P<msgid>\S+)$', 'meego_img.app.views.download',name='img-app-download'),
IMG currently has only one model, !ImageJob, here is the Django code for it:
# Create your models here.
class ImageJob(models.Model):
email = models.CharField(max_length=40)
filename = models.CharField(max_length=40)
logfile = models.CharField(max_length=50)
task_id = models.CharField(max_length=30)
imagefile = models.CharField(max_length=50)
created = models.DateTimeField(auto_now_add=True)
error = models.CharField(max_length=500)
type = models.CharField(max_length=10)
status = models.CharField(max_length=30)
def delete(self, *args, **kwargs):
if self.logfile:
if os.path.exists(self.logfile):
os.remove(self.logfile)
os.remove(self.logfile.replace("-log", ""))
print "Removed %s"%self.logfile
super(ImageJob, self).delete(*args, **kwargs)
As can be seen in the delete method, this model cleans up all image creation related files, like the kickstarter file and log file.
Contains the following fields
The configuration file is to be installed in /etc/imger/img.conf and a sample file is here.
base_url: A base URL that has a direct access to the base_dir via HTTP, example http://127.0.0.1 base_dir: A directory to put the finished images, example /var/www/images num_workers: Number of workers to start, OBSOLETE, USE INITSCRIPT OR MANUALLY RUN MANY PARTICIPANTS post_creation: Path to a script to run after the image is created use_kvm: Wether to use a virtual machine, values are "yes" or "no"
mic_opts: Example, mic_opts = --save-kernel, --use_comps, so comma separated options
amqp_host: Host that runs BOSS amqp_user: Username to tap into the BOSS virtual host amqp_pwd: Password amqp_vhost: The actual virtual host to connect to
Currently, IMGer can run the MIC2 jobs inside a KVM virtual machine, the only prerequisites are that image is located in /usr/share/img/base.img (configurable in the future) path and that the virtual machine has MIC2 installed and configured.
One must also confirm that the image SSH-keys in the source distribution are configured in the virtual machine and both keys exist in /usr/share/img (configurable in the future)
The following defines the input dictionary for the participant:
"kickstart" : a kickstart file, in raw, not a path "email": email address, not parsed so can be a dummy address "id": a simple UUID, eg. from pythons uuid library "type":type, from values: livecd, liveusb, loop, raw, nand, mrstnand, vdi or vmdk "name":name, a simple string for the image name
The work item can contain the following dictionary entries:
Status: Status, is either "DONE" or "ERROR" in the final workitem, depending on success/failure URL: URL to a image/log/kickstart file location on the worker Error: An error string with details of the error, if any Image: A direct URL to the finished image Log: A direct URL to the log file of the mic2 output