NAME
Illumos::Zones - Zone administration class
SYNOPSIS
use Illumos::Zones;
...
my $zone = Illumos::Zones->new(debug => 0);
...
DESCRIPTION
class to manage Zones
ATTRIBUTES
debug
print debug information to STDERR
METHODS
schema
returns a schema for "Data::Processor" so that the zone config can be validated before written to the zone.
my $schema = $zone->schema();
template
returns a minimal template config for creating a zone
my $cfg = $zone->template();
resources
returns a list of zone resources
my @res = @{$zone->resources()};
resourceArrays
returns a list of zone resources which are arrays (i.e. can have multiple entries)
my @resArray = @{$zone->resourceArrays()};
zoneName
static method. returns the name of the current zone
Illumos::Zones->zonename();
isGZ
static method. returns true if we are on the global zone
Illumos::Zones->isGZ();
listZones
returns the list of zones. each element contains a hash with all the zone infos (cf. 'zoneamd list')
my @zones = @{$zone->listZones()};
listZone
returns a hash with all the zone infos (cf. 'zoneadm list')
my %zone = %{$zone->listZone($zonename)};
zoneState
returns the state of the zone
$zone->zoneState($zonename);
boot
boots the zone
$zone->boot($zonename);
shutdown
gracefully shuts down the zone
$zone->shutdown($zonename);
reboot
reboots the zone
$zone->reboot($zonename);
createZone
creates a zone and applies the properties
$zone->createZone($zonename, { %props });
deleteZone
deletes a zone (zone must be uninstalled first)
$zone->deleteZone($zonename);
installZone
installs a zone
$zone->install($zonename);
uninstallZone
uninstalls a zone
$zone->uninstall($zonename);
zoneExists
checks whether a zone exists or not
$zone->zoneExists($zonename);
getZoneProperties
returns a JSON data structure which contains all the zone properties
my %zonecfg = %{$zone->getZoneProperties($zonename)};
setZoneProperties
applies the properties provided in a JSON data structure to the zone if the zone does not exist it will be created
$zone->setZoneProperties($zonename, { %zonecfg });
resourceExists
checks whether a resource exists or not. $property
and $value
are optional parameters
$zone->resourceExists($zonename, $resource, $property, $value);
addResource
adds a resource
$zone->addResource($zonename, $resource, { %props });
delResource
deletes a resource. $property
and $value
are optional parameters for distinction if multiple resources of the same type exists.
$zone->delResource($zonename, $resource, $property, $value);
clearResources
deletes all resrouces
$zone->clearResources($zonename);
setProperty
sets a property
$zone->setProperty($zonename, $property, $value);
clearProperty
sets a property to the default value
$zone->clearProperty($zonename, $property);
COPYRIGHT
Copyright (c) 2015 by OETIKER+PARTNER AG. All rights reserved.
LICENSE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
AUTHOR
Andy Fiddaman <omnios@citrus-it.co.uk>, Dominik Hassler <hadfl@cpan.org>, Tobias Oetiker <tobi@oetiker.ch>
HISTORY
2015-05-08 had Initial Version