Commit 5e674ac7 authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Merge branch 'images-0.4'

parents c4b25bb6 b5f64efa
......@@ -141,6 +141,36 @@ to Synnefo v0.3.
FIXME: The CTRL_SOCKET setting will be moved to settings.py as
VNCAUTHPROXY_CTRL_SOCKET.
* Ganeti Instance Image
For Synnefo to be able to launch VMs from specified Images, you need
the gnt-instance-image OS Provider.
Download and install gnt-instance-image in all Ganeti nodes from its own
repository, at https://code.grnet.gr/git/gnt-instance-image
After installing gnt-instance-image do the following:
1.root@ganeti-master:/path-to-repo# cp ./defaults /etc/default/ganeti-instance-image
2.Uncomment the following in /etc/default/ganeti-instance-image:
SWAP=no
ARCH="x86_64"
3.Add to /etc/default/ganeti-instance-image (so that make-dump makes no /boot partition):
KERNEL_PATH="True"
4.Change the path in make-dump line 22 according to your installation
(/usr/share/ganeti/os/image/common.sh --> /srv/ganeti/os/image/common.sh)
5.In common.sh, comment out the KERNEL_PATH variable initialization.
(#KERNEL_PATH="$INSTANCE_HV_kernel_path")
6.In /etc/ganeti/instance-image/hooks, make sure the hooks you want to
run during instance creation process have execute permission. At least
`grub' and `root_passwd' should be triggered to make the instance
usable:
chmod +x /etc/ganeti/instance-image/hooks/{grub,root_passwd}
Your Custom Images should be stored in a dump format under /var/cache/ganeti-instance-image
and their filenames should have the following format:
{backend_id}-x86_64-root.dump
e.g. debian-6.0.1a-x86_64-root.dump (backend_id = "debian-6.0.1a")
-Administration
* Reconciliation process: On certain occasions, such as a Ganeti or
......@@ -176,4 +206,3 @@ to Synnefo v0.3.
* Debian Squeeze
TBD.
......@@ -13,7 +13,8 @@ Synnefo is written in Python 2.6 and depends on the following Python modules
WARNING: version python-dateutil==2.0 downloaded by pip known *not* to work
with Python 2.6
- south [south==0.7.1]
- ampqlib [ampqlib==0.6.1]
WARNING: not working with Debian squeeze's default south-0.7-1 package.
- amqplib [amqplib==0.6.1]
also, depending on the database engine of choice, on one of the following:
- MySQL-python [MySQL-python==1.2.3]
......@@ -175,7 +176,8 @@ print out DDL statements. It should not fail.
6. Create the DB and (optionally) load test data
$ ./bin/python manage.py syncdb
$ ./bin/python manage.py syncdb
$ ./bin/python manage.py migrate db
$ ./bin/python manage.py loaddata db/fixtures/flavors.json
$ ./bin/python manage.py loaddata db/fixtures/images.json
......@@ -193,6 +195,8 @@ testing requirements:
The fix_amqp_settings() function is called once at the end of
settings.py.dist, you must call it again if you change BACKEND_PREFIX_ID
at some later point.
Also make sure that if /var/log/synnefo/dispatcher.log exists, it has proper
permissions. If not, /var/log/synnefo/ should be writable by the dispatcher.
9. Start the system
$ ./bin/python logic/dispatcher.py # DB synch daemon
......@@ -238,7 +242,7 @@ See "Initial Migration" section.
Each time you make changes to the database and data migration is not required (WARNING: always
perform this with extreme care):
$ ./bin/python schemamigration db --auto
$ ./bin/python manage.py schemamigration db --auto
The above will create the migration script. Now this must be applied to the live database.
......
......@@ -172,7 +172,7 @@ def create_server(request):
password = random_password()
try:
create_instance(vm, flavor, password)
create_instance(vm, flavor, image, password)
except GanetiApiError:
vm.delete()
raise ServiceUnavailable('Could not create server.')
......
......@@ -3,33 +3,91 @@
"model": "db.Image",
"pk": 3,
"fields": {
"name": "Debian Unstable",
"name": "Debian base",
"owner": 1,
"created": "2011-02-06 00:00:00",
"updated": "2011-02-06 00:00:00",
"state": "ACTIVE"
"state": "ACTIVE",
"backend_id": "debian_base",
"format": "dump"
}
},
{
"model": "db.Image",
"pk": 4,
"fields": {
"name": "Red Hat Enterprise Linux",
"name": "Debian 6.0.1a Desktop",
"owner": 1,
"created": "2011-02-06 00:00:00",
"updated": "2011-02-06 00:00:00",
"state": "ACTIVE"
"state": "ACTIVE",
"backend_id": "debian-6.0.1a",
"format": "dump"
}
},
{
"model": "db.Image",
"pk": 5,
"fields": {
"name": "Ubuntu 10.10",
"name": "Ubuntu 11.04 Server",
"owner": 1,
"created": "2011-02-06 00:00:00",
"updated": "2011-02-06 00:00:00",
"state": "ACTIVE"
"state": "ACTIVE",
"backend_id": "ubuntu_11.04_server",
"format": "dump"
}
},
{
"model": "db.Image",
"pk": 6,
"fields": {
"name": "Ubuntu 11.04 Desktop",
"owner": 1,
"created": "2011-02-06 00:00:00",
"updated": "2011-02-06 00:00:00",
"state": "ACTIVE",
"backend_id": "ubuntu_11.04_desktop",
"format": "dump"
}
},
{
"model": "db.Image",
"pk": 7,
"fields": {
"name": "Debian base LVM",
"owner": 1,
"created": "2011-02-06 00:00:00",
"updated": "2011-02-06 00:00:00",
"state": "ACTIVE",
"backend_id": "debian_base",
"format": "lvm"
}
},
{
"model": "db.Image",
"pk": 8,
"fields": {
"name": "Fedora 14 Desktop",
"owner": 1,
"created": "2011-05-27 00:00:00",
"updated": "2011-05-27 00:00:00",
"state": "ACTIVE",
"backend_id": "fedora-14-1",
"format": "dump"
}
},
{
"model": "db.Image",
"pk": 9,
"fields": {
"name": "Fedora 15 Desktop",
"owner": 1,
"created": "2011-05-30 00:00:00",
"updated": "2011-05-30 00:00:00",
"state": "ACTIVE",
"backend_id": "fedora-15-1",
"format": "dump"
}
},
{
......@@ -55,7 +113,7 @@
"pk": 3,
"fields": {
"meta_key": "OS",
"meta_value": "redhat",
"meta_value": "debian",
"image": 4
}
},
......@@ -73,7 +131,7 @@
"pk": 5,
"fields": {
"meta_key": "description",
"meta_value": "Red Hat Enterprise Linux, full installation",
"meta_value": "Debian 6.0.1a Desktop, Vanilla Install",
"image": 4
}
},
......@@ -82,7 +140,7 @@
"pk": 6,
"fields": {
"meta_key": "size",
"meta_value": "2048",
"meta_value": "4000",
"image": 4
}
},
......@@ -109,7 +167,7 @@
"pk": 9,
"fields": {
"meta_key": "description",
"meta_value": "Ubuntu 10.10, full installation",
"meta_value": "Ubuntu 11.04 Server, Vanilla Installation",
"image": 5
}
},
......@@ -118,7 +176,7 @@
"pk": 10,
"fields": {
"meta_key": "size",
"meta_value": "8192",
"meta_value": "2000",
"image": 5
}
},
......@@ -127,7 +185,7 @@
"pk": 11,
"fields": {
"meta_key": "description",
"meta_value": "Debian Sid, full installation",
"meta_value": "Debian base Image, same as debootstrap",
"image": 3
}
},
......@@ -136,8 +194,152 @@
"pk": 12,
"fields": {
"meta_key": "size",
"meta_value": "8192",
"meta_value": "2000",
"image": 3
}
},
{
"model": "db.ImageMetadata",
"pk": 13,
"fields": {
"meta_key": "OS",
"meta_value": "ubuntu",
"image": 6
}
},
{
"model": "db.ImageMetadata",
"pk": 14,
"fields": {
"meta_key": "kernel",
"meta_value": "2.6.35",
"image": 6
}
},
{
"model": "db.ImageMetadata",
"pk": 15,
"fields": {
"meta_key": "description",
"meta_value": "Ubuntu 11.04 Desktop, Vanilla Installation",
"image": 6
}
},
{
"model": "db.ImageMetadata",
"pk": 16,
"fields": {
"meta_key": "size",
"meta_value": "4000",
"image": 6
}
},
{
"model": "db.ImageMetadata",
"pk": 17,
"fields": {
"meta_key": "OS",
"meta_value": "debian",
"image": 7
}
},
{
"model": "db.ImageMetadata",
"pk": 18,
"fields": {
"meta_key": "kernel",
"meta_value": "2.6.32",
"image": 7
}
},
{
"model": "db.ImageMetadata",
"pk": 19,
"fields": {
"meta_key": "description",
"meta_value": "This is the same as -Debian base- but stored in a LVM format",
"image": 7
}
},
{
"model": "db.ImageMetadata",
"pk": 20,
"fields": {
"meta_key": "size",
"meta_value": "2000",
"image": 7
}
},
{
"model": "db.ImageMetadata",
"pk": 21,
"fields": {
"meta_key": "OS",
"meta_value": "fedora",
"image": 8
}
},
{
"model": "db.ImageMetadata",
"pk": 22,
"fields": {
"meta_key": "kernel",
"meta_value": "2.6.35",
"image": 8
}
},
{
"model": "db.ImageMetadata",
"pk": 23,
"fields": {
"meta_key": "description",
"meta_value": "Fedora 14 Desktop, full installation",
"image": 8
}
},
{
"model": "db.ImageMetadata",
"pk": 24,
"fields": {
"meta_key": "size",
"meta_value": "3300",
"image": 8
}
},
{
"model": "db.ImageMetadata",
"pk": 25,
"fields": {
"meta_key": "OS",
"meta_value": "fedora",
"image": 9
}
},
{
"model": "db.ImageMetadata",
"pk": 26,
"fields": {
"meta_key": "kernel",
"meta_value": "2.6.38",
"image": 9
}
},
{
"model": "db.ImageMetadata",
"pk": 27,
"fields": {
"meta_key": "description",
"meta_value": "Fedora 15 Desktop Edition",
"image": 9
}
},
{
"model": "db.ImageMetadata",
"pk": 28,
"fields": {
"meta_key": "size",
"meta_value": "2284",
"image": 9
}
}
]
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Image.backend_id'
db.add_column('db_image', 'backend_id', self.gf('django.db.models.fields.TextField')(default='debian_base'), keep_default=False)
# Adding field 'Image.format'
db.add_column('db_image', 'format', self.gf('django.db.models.fields.TextField')(default='dump'), keep_default=False)
def backwards(self, orm):
# Deleting field 'Image.backend_id'
db.delete_column('db_image', 'backend_id')
# Deleting field 'Image.format'
db.delete_column('db_image', 'format')
models = {
'db.debit': {
'Meta': {'object_name': 'Debit'},
'description': ('django.db.models.fields.TextField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']"}),
'vm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.VirtualMachine']"}),
'when': ('django.db.models.fields.DateTimeField', [], {})
},
'db.disk': {
'Meta': {'object_name': 'Disk'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']", 'null': 'True', 'blank': 'True'}),
'size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'vm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.VirtualMachine']", 'null': 'True', 'blank': 'True'})
},
'db.flavor': {
'Meta': {'unique_together': "(('cpu', 'ram', 'disk'),)", 'object_name': 'Flavor'},
'cpu': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'disk': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ram': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'db.flavorcost': {
'Meta': {'object_name': 'FlavorCost'},
'cost_active': ('django.db.models.fields.PositiveIntegerField', [], {}),
'cost_inactive': ('django.db.models.fields.PositiveIntegerField', [], {}),
'effective_from': ('django.db.models.fields.DateTimeField', [], {}),
'flavor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.Flavor']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'db.image': {
'Meta': {'object_name': 'Image'},
'backend_id': ('django.db.models.fields.TextField', [], {'default': "'debian_base'"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'format': ('django.db.models.fields.TextField', [], {'default': "'dump'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']", 'null': 'True', 'blank': 'True'}),
'sourcevm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.VirtualMachine']", 'null': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'db.imagemetadata': {
'Meta': {'object_name': 'ImageMetadata'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.Image']"}),
'meta_key': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'meta_value': ('django.db.models.fields.CharField', [], {'max_length': '500'})
},
'db.limit': {
'Meta': {'object_name': 'Limit'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']"}),
'value': ('django.db.models.fields.IntegerField', [], {})
},
'db.network': {
'Meta': {'object_name': 'Network'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'machines': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['db.VirtualMachine']", 'symmetrical': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']"}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'db.synnefouser': {
'Meta': {'object_name': 'SynnefoUser'},
'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'credit': ('django.db.models.fields.IntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
'realname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
'uniq': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'db.virtualmachine': {
'Meta': {'object_name': 'VirtualMachine'},
'action': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
'backendjobid': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
'backendjobstatus': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
'backendlogmsg': ('django.db.models.fields.TextField', [], {'null': 'True'}),
'backendopcode': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
'charged': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2011, 5, 13, 15, 30, 44, 932805)'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'flavor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.Flavor']"}),
'hostid': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ipfour': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
'ipsix': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'operstate': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']"}),
'sourceimage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.Image']"}),
'suspended': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'db.virtualmachinegroup': {
'Meta': {'ordering': "['name']", 'object_name': 'VirtualMachineGroup'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'machines': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['db.VirtualMachine']", 'symmetrical': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']"}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'db.virtualmachinemetadata': {
'Meta': {'object_name': 'VirtualMachineMetadata'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'meta_key': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'meta_value': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
'vm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.VirtualMachine']"})
}
}
complete_apps = ['db']
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Image.format'
db.alter_column('db_image', 'format', self.gf('django.db.models.fields.CharField')(max_length=30))
# Changing field 'Image.backend_id'
db.alter_column('db_image', 'backend_id', self.gf('django.db.models.fields.CharField')(max_length=50))
def backwards(self, orm):
# Changing field 'Image.format'
db.alter_column('db_image', 'format', self.gf('django.db.models.fields.TextField')())
# Changing field 'Image.backend_id'
db.alter_column('db_image', 'backend_id', self.gf('django.db.models.fields.TextField')())
models = {
'db.debit': {
'Meta': {'object_name': 'Debit'},
'description': ('django.db.models.fields.TextField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']"}),
'vm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.VirtualMachine']"}),
'when': ('django.db.models.fields.DateTimeField', [], {})
},
'db.disk': {
'Meta': {'object_name': 'Disk'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.SynnefoUser']", 'null': 'True', 'blank': 'True'}),
'size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'vm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.VirtualMachine']", 'null': 'True', 'blank': 'True'})
},
'db.flavor': {
'Meta': {'unique_together': "(('cpu', 'ram', 'disk'),)", 'object_name': 'Flavor'},
'cpu': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'disk': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ram': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'db.flavorcost': {
'Meta': {'object_name': 'FlavorCost'},