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 ONE labels support #226

Merged
merged 5 commits into from Nov 30, 2016
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions aii-opennebula/src/main/pan/quattor/aii/opennebula/schema.pan
Expand Up @@ -171,4 +171,9 @@ type opennebula_vmtemplate = {
"diskcache" ? string with match(SELF, '^(default|none|writethrough|writeback|directsync|unsafe)$')
"permissions" ? opennebula_permissions
"pci" ? opennebula_vmtemplate_pci[]
@{labels is a string list to group the VMs under a given name and filter them
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string list - >list of strings

in the admin and cloud views. It is also possible to include in the list
sub-labels using a common slash "Name, Name/SubName". This feature is available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example shoudl be pan code like list("Name", "Name/SubName")

since OpenNebula 5.x, below this version the change does take any effect.}
"labels" ? string[]
} = dict();
2 changes: 1 addition & 1 deletion aii-opennebula/src/main/perl/opennebula.pm
Expand Up @@ -637,7 +637,7 @@ sub install
$vmtemplate = $vmtpl[0];
$main::this_app->info("Found VM template from ONE database: ", $vmtemplate->name);
} else {
$main::this_app->error("VM template is not available to be instantiated: ", $vmtemplate->name);
$main::this_app->error("VM template is not available to instantiate VM: $fqdn");
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions aii-opennebula/src/main/perl/opennebula.pod
Expand Up @@ -39,6 +39,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/labels list to include OpenNebula search labels

=item * (Optional) Set /system/opennebula/pci list values to enable PCI Passthrough

=over 6
Expand Down
3 changes: 3 additions & 0 deletions aii-opennebula/src/main/resources/imagetemplate.tt
Expand Up @@ -8,6 +8,9 @@ NAME = "[%- fqdn %]_[% pair.key %]"
TARGET = "[% pair.key %]"
SIZE = [% hardware.harddisks.${pair.key}.capacity %]
DESCRIPTION = "QUATTOR image for [% fqdn %]: [% pair.key %]"
[%- IF system.opennebula.labels.defined %]
LABELS = "[% system.opennebula.labels.join(',') %]"
[%- END %]
QUATTOR = 1
[% # If we have several disks we have to split vmtemplate in several files
# Using DATASTORE line. THIS MUST BE THE LAST TT FILE LINE-%]
Expand Down
5 changes: 5 additions & 0 deletions aii-opennebula/src/main/resources/tests/profiles/vm.pan
Expand Up @@ -164,3 +164,8 @@ prefix "/system/opennebula";
"device", 0x0a0c,
"class", 0x0403,
));

"labels" = list (
"quattor",
"quattor/CE",
);
Expand Up @@ -13,5 +13,6 @@ multiline
^TARGET\s?=\s?"vdb"$
^SIZE\s?=\s?10480$
^DESCRIPTION\s?=\s?"QUATTOR image for node630.cubone.os: vdb"$
^LABELS\s?=\s?"quattor,quattor/CE"$
^QUATTOR\s?=\s?1$
^DATASTORE\s?=\s?"default"$
Expand Up @@ -9,5 +9,6 @@ multiline
^TARGET\s?=\s*".+"\s*$
^SIZE\s?=\s*\d+\s*$
^DESCRIPTION\s?=\s*".+"\s*$
^LABELS\s?=\s?".+"$
^QUATTOR\s?=\s?\d?\s*$
^DATASTORE\s?=\s*".+"\s*$
Expand Up @@ -37,4 +37,5 @@ multiline
^\s*CLASS\s?=\s*".+",\s*$
^\s*DEVICE\s?=\s*".+",\s*$
^\s*VENDOR\s?=\s*".+"\s*$
^LABELS\s?=\s*".+"$
^QUATTOR\s?=\s?\d+\s*$
Expand Up @@ -64,4 +64,5 @@ multiline
^\s{4}\<devices\>\<video\>\<model\s{1}type\=\'qxl\'\/\>\<\/video\>\<\/devices\>",$
^\s{4}TYPE\s?=\s?"kvm"$
^\]$
^LABELS\s?=\s?"quattor,quattor/CE"$
^QUATTOR\s?=\s?1$
3 changes: 3 additions & 0 deletions aii-opennebula/src/main/resources/vmtemplate.tt
Expand Up @@ -85,4 +85,7 @@ PCI = [
[%- END %]
[%- END %]
[%- END %]
[%- IF system.opennebula.labels.defined %]
LABELS = "[% system.opennebula.labels.join(',') %]"
[%- END %]
QUATTOR = 1
3 changes: 3 additions & 0 deletions aii-opennebula/src/test/perl/rpcdata.pm
Expand Up @@ -490,6 +490,7 @@ NAME = "node630.cubone.os_vda"
TARGET = "vda"
SIZE = 20480
DESCRIPTION = "QUATTOR image for node630.cubone.os: vda"
LABELS = "quattor,quattor/CE"
QUATTOR = 1
EOF
$cmds{rpc_create_image}{params} = [$data, 102];
Expand All @@ -505,6 +506,7 @@ NAME = "node630.cubone.os_vdb"
TARGET = "vdb"
SIZE = 10480
DESCRIPTION = "QUATTOR image for node630.cubone.os: vdb"
LABELS = "quattor,quattor/CE"
QUATTOR = 1
EOF
$cmds{rpc_create_image2}{params} = [$data, 102];
Expand Down Expand Up @@ -621,6 +623,7 @@ PCI = [
DEVICE = "1616",
VENDOR = "8086"
]
LABELS = "quattor,quattor/CE"
QUATTOR = 1
EOF
$cmds{rpc_create_template}{params} = [$data];
Expand Down
5 changes: 5 additions & 0 deletions aii-opennebula/src/test/resources/vm.pan
Expand Up @@ -144,3 +144,8 @@ prefix "/system/opennebula";
"device", 0x0a0c,
"class", 0x0403,
));

"labels" = list (
"quattor",
"quattor/CE",
);