| 1 | # | ||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||
| 3 | # | ||
| 4 | # vim: set ts=3 sw=3 tw=0: | ||
| 5 | # vim: set expandtab: | ||
| 6 | # | ||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | |||
| 10 | package Net::OpenNebula::Datastore; | ||
| 11 | $Net::OpenNebula::Datastore::VERSION = '0.317.0'; | ||
| 12 | use Net::OpenNebula::RPC; | ||
| 13 | push our @ISA , qw(Net::OpenNebula::RPC); | ||
| 14 | |||
| 15 | use constant ONERPC => 'datastore'; | ||
| 16 | |||
| 17 | sub create { | ||
| 18 | my ($self, $tpl_txt, %option) = @_; | ||
| 19 | return $self->_allocate([ string => $tpl_txt ], | ||
| 20 | [ int => (exists $option{cluster} ? $option{cluster} : -1) ], | ||
| 21 | ); | ||
| 22 | } | ||
| 23 | |||
| 24 | sub used { | ||
| 25 | my ($self) = @_; | ||
| 26 | my $img = $self->_get_info_extended('IMAGES'); | ||
| 27 | if (defined($img->[0]->{ID}->[0])) { | ||
| 28 | return 1; | ||
| 29 | } | ||
| 30 | }; | ||
| 31 | |||
| 32 | 1; |