Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aii-opennebula: Include VM disk CACHE option #149

Merged
merged 7 commits into from Dec 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -41,7 +41,7 @@ bind "/system/aii/hooks" = nlist with validate_aii_opennebula_hooks('install');

"image", OPENNEBULA_AII_FORCE_REMOVE,
"template", OPENNEBULA_AII_FORCE_REMOVE,
"remove", OPENNEBULA_AII_FORCE_REMOVE,
"vm", OPENNEBULA_AII_FORCE_REMOVE,
));

SELF;
Expand Down
6 changes: 3 additions & 3 deletions aii-opennebula/src/main/pan/quattor/aii/opennebula/schema.pan
Expand Up @@ -49,7 +49,6 @@ type structure_aii_opennebula = {
"template" : boolean = false # force (re)create template [implies on remove template (also stop/delete vm) ]
"vm" : boolean = false # instantiate template (i.e. make vm)
"onhold" : boolean = true # when template is instantiated, then vm is placed onhold [if false, will start the VM asap]
"remove" : boolean = true # remove all VM resources
};

type opennebula_vmtemplate_vnet = string{} with {
Expand Down Expand Up @@ -109,8 +108,9 @@ type opennebula_ignoremac = {
};

type opennebula_vmtemplate = {
"vnet" : opennebula_vmtemplate_vnet
"vnet" : opennebula_vmtemplate_vnet
"datastore" : opennebula_vmtemplate_datastore
"ignoremac" ? opennebula_ignoremac
"graphics" : string = 'VNC' with match (SELF, '^(VNC|SDL|SPICE)$')
"graphics" : string = 'VNC' with match (SELF, '^(VNC|SDL|SPICE)$')
"diskcache" ? string with match(SELF, '^(default|none|writethrough|writeback|directsync|unsafe)$')
} = dict();
26 changes: 16 additions & 10 deletions aii-opennebula/src/main/perl/opennebula.pm
Expand Up @@ -29,24 +29,30 @@ use constant MINIMAL_ONE_VERSION => version->new("4.8.0");
# password=secret
sub make_one
{
my $self = shift;
my $filename = shift || AII_OPENNEBULA_CONFIG;
my ($self, $data) = @_;
my $filename = AII_OPENNEBULA_CONFIG;
my $rpc = "rpc";

if (! -f $filename) {
$main::this_app->error("No configfile $filename.");
return;
}

my $config = Config::Tiny->new;
my $domainname = $data->getElement (DOMAINNAME)->getValue;

$config = Config::Tiny->read($filename);
my $port = $config->{rpc}->{port} || 2633;
my $host = $config->{rpc}->{host} || "localhost";
my $user = $config->{rpc}->{user} || "oneadmin";
my $password = $config->{rpc}->{password};
if (exists($config->{$domainname})) {
$rpc = $domainname;
$main::this_app->info ("Detected configfile RPC section: [$rpc]");
};
my $port = $config->{$rpc}->{port} || 2633;
my $host = $config->{$rpc}->{host} || "localhost";
my $user = $config->{$rpc}->{user} || "oneadmin";
my $password = $config->{$rpc}->{password};

if (! $password ) {
$main::this_app->error("No password set in configfile $filename.");
$main::this_app->error("No password set in configfile $filename. Section [$rpc]");
return;
}

Expand Down Expand Up @@ -479,7 +485,7 @@ sub configure
my $fqdn = $self->get_fqdn($config);

# Set one endpoint RPC connector
my $one = make_one();
my $one = $self->make_one($config);
if (!$one) {
$main::this_app->error("No ONE instance returned");
return 0;
Expand Down Expand Up @@ -520,7 +526,7 @@ sub install
my $fqdn = $self->get_fqdn($config);

# Set one endpoint RPC connector
my $one = make_one();
my $one = $self->make_one($config);
if (!$one) {
$main::this_app->error("No ONE instance returned");
return 0;
Expand Down Expand Up @@ -598,7 +604,7 @@ sub remove
my $fqdn = $self->get_fqdn($config);

# Set one endpoint RPC connector
my $one = make_one();
my $one = $self->make_one($config);
if (!$one) {
$main::this_app->error("No ONE instance returned");
return 0;
Expand Down
28 changes: 27 additions & 1 deletion aii-opennebula/src/main/perl/opennebula.pod
Expand Up @@ -38,6 +38,8 @@ Modify your machine template to:

=item * (Optional) Set /system/opennebula/graphics to export VM graphical display (VNC is used by default)

=item * (Optional) Set /system/opennebula/diskcache to select the cache mechanism for your disks. (by default is set to none)

=item * (Optional) Set OPENNEBULA_AII_REPLACE_MAC and MAC_PREFIX variables to replace VM MACs to use OpenNebula style

=back
Expand Down Expand Up @@ -98,9 +100,11 @@ Remove VM templates

=back

=back

=head2 DEPENDENCIES

The AII was tested with OpenNebula version 4.8 and 4.10
The AII was tested with OpenNebula version 4.8 and 4.1x

Following package dependencies should be installed to run the AII:

Expand All @@ -116,6 +120,28 @@ Following package dependencies should be installed to run the AII:

=back

Set OpenNebula endpoints RPC connector /etc/aii/opennebula.conf

It must include at least one RPC endpoint and password.

By default ONE AII uses oneadmin user and port 2633.

It is also possible to set a different endpoint for each VM domain, as example:

[rpc]
password=
host=

[VM_DOMAIN_NAME1]
password=
user=
host=
port=

[VM_DOMAIN_NAME2]
password=
host=

=head2 AUTHOR

${author-info}
Expand Down
2 changes: 2 additions & 0 deletions aii-opennebula/src/main/resources/tests/profiles/vm.pan
Expand Up @@ -123,6 +123,8 @@ prefix "/system/opennebula";

"graphics" = "SPICE";

"diskcache" = "default";

"ignoremac/interface" = list (
"eth2",
);
Expand Down
Expand Up @@ -20,6 +20,7 @@ multiline
^\s*IMAGE\s?=\s*".+",\s*$
^\s*TARGET\s?=\s*".+",\s*$
^\s*DEV_PREFIX\s?=\s*".+",\s*$
^\s*CACHE\s?=\s*".+",\s*$
^\s*IMAGE_UNAME\s?=\s*".+"\s*$
^GRAPHICS\s?=\s?\[$
^\s*LISTEN\s?=\s*".+",\s*$
Expand Down
Expand Up @@ -40,11 +40,14 @@ multiline
^\s{4}IMAGE\s?=\s?"node630.cubone.os_vda",$
^\s{4}TARGET\s?=\s?"vda",$
^\s{4}DEV_PREFIX\s?=\s?"vd",$
^\s{4}CACHE\s?=\s?"default",$
^\s{4}IMAGE_UNAME\s?=\s?"oneadmin"$
^\]$
^DISK\s?=\s?\[$
^\s{4}IMAGE\s?=\s?"node630.cubone.os_vdb",$
^\s{4}TARGET\s?=\s?"vdb",$
^\s{4}DEV_PREFIX\s?=\s?"vd",$
^\s{4}CACHE\s?=\s?"default",$
^\s{4}IMAGE_UNAME\s?=\s?"oneadmin"$
^\]$
^GRAPHICS\s?=\s?\[$
Expand Down
3 changes: 3 additions & 0 deletions aii-opennebula/src/main/resources/vmtemplate.tt
Expand Up @@ -40,6 +40,9 @@ DISK = [
IMAGE = "[%- fqdn %]_[% pair.key %]",
TARGET = "[% pair.key %]",
DEV_PREFIX = "vd",
[% IF system.opennebula.diskcache.defined -%]
CACHE = "[% system.opennebula.diskcache %]",
[% END -%]
IMAGE_UNAME = "oneadmin"
[%- END %]
]
Expand Down