-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from hadfl/emu
add support for emu brand
- Loading branch information
Showing
13 changed files
with
434 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
requires 'Bytes::Random::Secure::Tiny', '== 1.011'; | ||
requires 'Cpanel::JSON::XS', '== 4.32'; | ||
requires 'Cpanel::JSON::XS', '== 4.36'; | ||
requires 'Curses::UI', '== 0.9609'; | ||
requires 'Data::Processor', '== 1.0.9'; | ||
requires 'Mojolicious', '== 9.28'; | ||
requires 'IO::Socket::SSL', '== 2.075'; | ||
requires 'IO::Uncompress::UnXz', '== 2.201'; | ||
requires 'IO::Uncompress::UnZstd', '== 2.201'; | ||
requires 'Mojolicious', '== 9.32'; | ||
requires 'IO::Socket::SSL', '== 2.083'; | ||
requires 'IO::Uncompress::UnXz', '== 2.204'; | ||
requires 'IO::Uncompress::UnZstd', '== 2.204'; | ||
requires 'Regexp::IPv4', '== 0.003'; | ||
requires 'Regexp::IPv6', '== 0.03'; | ||
requires 'TOML::Tiny', '== 0.15'; | ||
requires 'YAML::XS', '== 0.85'; | ||
requires 'YAML::XS', '== 0.88'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package Zadm::Schema::Emu; | ||
use Mojo::Base 'Zadm::Schema::KVM', -signatures; | ||
|
||
my $SCHEMA; | ||
has schema => sub($self) { | ||
my $kvmschema = $self->SUPER::schema; | ||
|
||
my $dp = Data::Processor->new($kvmschema); | ||
my $ec = $dp->merge_schema($self->$SCHEMA); | ||
|
||
$ec->count and Mojo::Exception->throw(join ("\n", map { $_->stringify } @{$ec->{errors}})); | ||
|
||
return $dp->schema; | ||
}; | ||
|
||
has archs => sub { | ||
return [ | ||
map { /qemu-system-(\w+)$/ } glob '/opt/ooce/qemu/bin/qemu-system-*' | ||
]; | ||
}; | ||
|
||
$SCHEMA = sub($self) { | ||
return { | ||
arch => { | ||
description => 'architecture to emulate', | ||
example => '"arch" : "aarch64"', | ||
validator => $self->sv->elemOf(@{$self->archs}), | ||
'x-attr' => 1, | ||
}, | ||
cpu => { | ||
description => 'cpu to emulate', | ||
example => '"cpu" : "cortex-a53"', | ||
validator => $self->sv->regexp(qr/^.+$/, 'expected a string'), | ||
'x-attr' => 1, | ||
}, | ||
'cloud-init' => { | ||
optional => 1, | ||
description => 'provide cloud-init data - on|off|file path|URL', | ||
default => 'off', | ||
example => '"cloud-init" : "on"', | ||
validator => $self->sv->cloudinit, | ||
'x-attr' => 1, | ||
}, | ||
password => { | ||
optional => 1, | ||
description => 'provide cloud-init password/hash or path to file', | ||
example => '"password" : "$6$SEeDRaFR$...5/"', | ||
validator => $self->sv->stringorfile, | ||
transformer => $self->sv->toPWHash, | ||
'x-attr' => 1, | ||
}, | ||
rng => { | ||
optional => 1, | ||
description => 'attach VirtIO random number generator (RNG) to the guest', | ||
default => 'off', | ||
example => '"rng" : "on"', | ||
validator => $self->sv->bool, | ||
'x-attr' => 1, | ||
}, | ||
sshkey => { | ||
optional => 1, | ||
description => 'provide cloud-init public SSH key - string or path to file', | ||
example => '"sshkey" : "/root/.ssh/id_rsa.pub"', | ||
validator => $self->sv->stringorfile, | ||
'x-attr' => 1, | ||
}, | ||
} | ||
}; | ||
|
||
1; | ||
|
||
__END__ | ||
=head1 COPYRIGHT | ||
Copyright 2023 OmniOS Community Edition (OmniOSce) Association. | ||
=head1 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 L<http://www.gnu.org/licenses/>. | ||
=head1 AUTHOR | ||
S<Dominik Hassler E<lt>[email protected]E<gt>> | ||
=head1 HISTORY | ||
2020-04-12 had Initial Version | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -344,7 +344,8 @@ has schema => sub($self) { | |
}, | ||
}, | ||
}, | ||
}}; | ||
} | ||
}; | ||
|
||
1; | ||
|
||
|
Oops, something went wrong.