IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
If a variable is defined and assigned in a conditional statement, it
is not defined behavior in Perl.
For more information about this behaviour see
https://perldoc.perl.org/perlsyn.html#Statement-Modifiers
> NOTE: The behaviour of a my, state, or our modified with a
> statement modifier conditional or loop construct (for example,
> `my $x if ...`) is undefined.
> The value of the my variable may be undef, any previously assigned
> value, or possibly anything else.
> Don't rely on it. Future versions of perl might do something
> different from the version of perl you try it out on. Here be
> dragons."
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Introduce a parameter $opts to allow for better control of which
keys/volumes to use for the iteration and ability to reverse the order.
Also, allow extra parameters for the function.
Removes the '__snapshot'-prefix for future use from outside the module.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
or else the Exports will not work
found by hotplugging nics with current master from qemu-server
which resulted in a
'undefined subroutine &PVE::QemuServer::safe_string_ne'
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Aaron clarified that one documented element actually slipped through
and won't be returned.
Also firx the mixed tab/space indentation, for such comments we can
be pretty liberal and I just went with the two spaces per level, as
some part already had that.
Clarify that both array and hash are refs.
[0]: https://pve.proxmox.com/pipermail/pve-devel/2020-March/042070.html
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
allows partial fast plugging of functions as defined in the
$partial_fast_plug_option in qemuserver (and possibly lxc later on)
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
move the safe_string_ne and safe_num_ne functions to guesthelpers to
remove duplicate code.
add the new safe_boolean_ne and typesafe_ne helper functions
also add them in @EXPORT_OK
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
allows us to reuse this for clone, where we want to create a "clone"
locked config for the target guest.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
pull out $conf->{pending} in a intermediate variable.
While for now only a force key could be in a pending delete value it
still is completely wrong to say the whole hash value is thus $force.
Fix that by omitting that intermediate variable completely and copy
over directly from the source hash.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
return $conf for tests, use intermediate variable for
$conf->{pending}, which besides shorter lines avoids also the
autovification of $config stuff.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
no need to delete, then re-fill by autovification; just explicitly
overwrite with new value.
Also explicitly populate pending hash if not defined, avoids
auto-vivification which is a bit intransparent.
explicitly return $conf for tests
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
while this was much better than the old mess from
parse_pending_delete it still was a bit much nested into one line.
split that up a bit, add a render_key helper which does the clunky
"add !" check and just call that one in the map {}
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
this was quite the mess, a perl greedy match over non-whitespace
character is equivalent to a split on whitespace on, but the latter
is much easier to grasp when looking at this the first time.
Do a real for loop with real variable names and less nest everything
into one line.
the test added in the previous commit should give use the safety net
for that cleanup.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
in vm_pending API, this method is used to represent the configuration as
a table with current, pending and delete columns.
by adding it as a guesthelper, we can also use it for container pending
changes.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
this code is already used by qemu-server's GET config API call. it is
however better to split this into to methods and decide what to run in
the API call.
this general implementation uses some $class helpers which allow to abstract
away the difference in the child classes. this will be used for
containers once they can do pending changes.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
use a better naming scheme for methods from qemuserver:
split_flagged_list -> parse_pending_delete
join_flagged_list -> print_pending_delete
vmconfig_delete_pending_option -> add_to_pending_delete
vmconfig_undelete_pending_option -> remove_from_pending_delete
vmconfig_cleanup_pending -> cleanup_pending
parse_pending_delete now has a better representation of the force value,
which is encoded in a perl hash i.e. $conf->{$opt}->{force} = 1 or 0
depending on if the string in config has '!' or not.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>