Commit Graph

371 Commits

Author SHA1 Message Date
Dominik Csapak
68e46b8452 fix #1749: do not copy pending changes when cloning a vm
cloning a vm means copying the current state, not the
state of 'some time in the future, when the vm is started again'
we should not copy the pending changes, which also fixes the
issue that we got a wrong pending change on the disks,net,smbios,etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-05-04 08:26:26 +02:00
Thomas Lamprecht
eb84566b49 sync bwlimit description with the container one 2018-03-21 11:15:35 +01:00
Wolfgang Bumiller
7c536e11c4 restore: implement rate limiting
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-21 11:15:35 +01:00
Dietmar Maurer
1ae43f8c11 clone: add command line completion for newid
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-03-20 11:09:45 +01:00
Dietmar Maurer
fd13b1d0e1 clone: use better default for parameter 'full'
template => linked clone
normal VM => full clone

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-03-20 11:09:45 +01:00
Dominik Csapak
2254ffcf87 cloudinit: hide password on the api
since password is easily decrypted, hide it on the api
if someone needs it, they can get it directly from the
config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-03-16 10:03:57 +01:00
Wolfgang Bumiller
cefb41fa76 cloud-init: replace password parameter in log messages
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-12 12:43:44 +01:00
Wolfgang Bumiller
230406dc52 cloud-init: pre-hash passwords
We don't leave this up to cloud-init as we don't want
un-hashed values at all in our configs.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-08 14:59:27 +01:00
Wolfgang Bumiller
231f824b1a whitespace fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-08 14:58:34 +01:00
Wolfgang Bumiller
931432bd2d cloud-init: clone/move support
move: don't error out with "you can't move a cdrom"
clone: always full-clone cloud-init images
  They get completely replaced anyway at the next start, so
  there's no point in keeping them.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-07 09:11:31 +01:00
Wolfgang Bumiller
9ed7a77c6e cloud-init: hotplug support
*) always replace old cloudinit images
*) apply pending cloudinit changes when generating a new
image

For cloudinit we now always use vdisk_free before
vdisk_alloc in order to always replace old images, this
allows us to hotplug a new drive by setting it to
`none,media=cdrom` first (to eject the disk), then setting
it back to 'storage:cloudinit' to have a new image generated
after applying the currently pending changes.
2018-03-07 09:11:31 +01:00
Alexandre Derumier
0c9a7596f6 implement cloudinit
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Co-developed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-07 09:11:31 +01:00
Dominik Csapak
b8158701aa move guest agent api call to its own file
so we do not pollute the Qemu.pm too much

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-02-20 09:55:15 +01:00
Dominik Csapak
c9a074b8bf add agent flag to vm status api call
so that we can check in the gui if we have the agent set without
having to load the whole config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-02-20 09:55:15 +01:00
Thomas Lamprecht
e5caa02e05 avoid harmful '<>' pattern, explicitly read from STDIN
Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
    ...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-01-22 14:56:27 +01:00
Wolfgang Bumiller
ccb88f4578 termproxy, vncproxy: use -escape 0 for qm terminal
There's no reason to have Ctrl+O terminate these sessions.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
2017-12-13 14:52:28 +01:00
Dominik Csapak
9e6d6e97c4 enable vncproxy with vncterm for serial ports
this enables the output via vncterm when the vm has
configured a serial port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-12-12 08:34:03 +01:00
Dominik Csapak
8730200273 add termproxy api call
for xtermjs web client

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-12-12 08:34:03 +01:00
Dominik Csapak
6a567ae731 make ssh connection transparent
do not use an escape character for vncproxy

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-11-17 10:38:26 +01:00
Emmanuel Kasper
ae2fcb3be6 Refactor defaut bootdisk and smbios1 uuid generation in own subs
This will allow code reuse for qm importovf
2017-09-25 13:31:55 +02:00
Fabian Grünbichler
253624c76f config: add vmstatestorage option
and permission checks

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-22 10:02:54 +02:00
Matthias Urban
c268337d93 VM.Snapshot.Rollback privilege added
VM.Snapshot.Rollback privilege added

Signed-off-by: Matthias Urban <matthias.urban@pure-systems.com>
2017-09-22 09:26:55 +02:00
Emmanuel Kasper
6cb0144ae3 do not overwrite global signal handlers
perls 'local' must be either used in front of each $SIG{...}
assignments or they must be put in a list, else it affects only the
first variable and the rest are *not* in local context.

In all cases the global signal handlers we overwrote were in cli programs or
forked workers, not in daemons.
2017-09-14 15:25:28 +02:00
Thomas Lamprecht
3e1f112286 create_disks: refactor out and improve efidisk creation
factor out code in a new create_efidisk submethod, as else this code
is hardly readable as the efidisk0 case is a special case. Refer from
putting all this specialised handling directly to the much shorter
code for all other cases.

Also the disk was created with a specific format and then a format
detection on the newly created disk was done, which is pretty
useless, clear that up.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-11 10:04:46 +02:00
Thomas Lamprecht
a1d8c038c5 efidisk: do not hard code efivar base image size
The size of this image is not fixed, it increased to 528k in more
recent build of OVMF and could increase further (not likely, but
possible).

Instead of changing the hardcoded value move to a more generic
approach and read the size from the base image at creation time.

Use the new convert_size method and generalise the assignment of
size and volid between the efidisk and the normal case, as a part of
this change.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-11 10:04:46 +02:00
Thomas Lamprecht
eaae66be9f API/clone: do not overwrite global signal handlers
perls 'local' must be either used in front of each $SIG{...}
assignments or they must be put in a list, else it affects only the
first variable and the rest are *not* in local context.

This may cause weird behaviour where daemons seemingly do not get
terminating signals delivered correctly and thus may not shutdown
gracefully anymore.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-07 10:39:28 +02:00
Fabian Grünbichler
edd48c325a update_vm: sort logged parameters
otherwise the (log) output looks really strange when mass-updating VMs, e.g.:
update VM 400001: -scsi1 somestore:64 -scsi0 somestore:64 -ide2 isostore:iso/somefile.iso,media=cdrom
update VM 400002: -ide2 isostore:iso/somefile.iso,media=cdrom -scsi1 somestore:64 -scsi0 somestore:64
update VM 400003: -scsi0 somestore:64 -ide2 isostore:iso/somefile.iso,media=cdrom -scsi1 somestore:64

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 10:21:47 +02:00
Wolfgang Bumiller
bf1312d811 cleanup: more the new-disk regex deduplication 2017-06-30 09:31:29 +02:00
Dominik Csapak
c46366fd49 fix #1417: check if storage has 'images' set in content
otherwise, qm and the api ignore this setting completely when creating
a vm

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-06-30 09:26:53 +02:00
Wolfgang Link
223e032b74 Remove guest states to ensure no old states are exists 2017-06-27 15:31:41 +02:00
Wolfgang Bumiller
9b1396edd2 allow disks on shared storages on replicated VMs 2017-06-27 15:22:08 +02:00
Wolfgang Bumiller
17677004cc refuse to add non-replicatable disks to replicating VMs
Unless replication is explicitly disabled for them.
2017-06-27 10:37:07 +02:00
Thomas Lamprecht
0276584456 API HA tasks: we request states not execute them
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-06-27 07:59:12 +02:00
Dietmar Maurer
7c876ec165 PVE/API2/Qemu.pm: cleanup - remove unused $upid parameter 2017-06-12 11:09:47 +02:00
Dietmar Maurer
f53c6ad8b9 PVE/API2/Qemu.pm: aquire guest_migration_lock inside worker 2017-06-12 11:05:46 +02:00
Wolfgang Link
c068c1c3a9 Add a migration lock to avoid a replication on rollback-time. 2017-06-12 10:58:49 +02:00
Dominik Csapak
af6d2db4b3 check also pending changes when reverting/deleting
otherwise we are not able to revert/delete pending changes which
introduce a new config line

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-05-31 11:40:14 +02:00
Dietmar Maurer
95f42d61fa migrate: aquire guest_migration_lock during migration
To block replication jobs.
2017-05-31 07:57:03 +02:00
Dietmar Maurer
628bb7f231 do not allow destroy if there are replication jobs 2017-05-31 07:53:58 +02:00
Dietmar Maurer
3ab7663a91 remove 'replicate' configuration - we will store that in another file 2017-05-31 07:53:57 +02:00
Thomas Lamprecht
6318daca96 improve error on '{full, linked} clone not available' error
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-05-24 11:29:26 +02:00
Dominik Csapak
dd32a4664f use ReuseAddr for vncproxy
to avoid "Socket already in use" errors, when quickly opening/closing
console sessions on the webinterface

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-05-17 13:38:54 +02:00
Wolfgang Bumiller
175b51fdb5 Fix #1361: create disk: stricter parsing of storage:size
This fixes paths such as
/dev/disk/by-id/some-ID:0.5
being interpreted as a request to create a 0.5G-sized disk
in the storage named '/dev/disk/by-id/some-ID'.
2017-05-10 10:31:25 +02:00
Dietmar Maurer
3aa44d3b57 move get_replicatable_volumes from QemuServer.pm to QemuConfig.pm 2017-05-06 17:13:31 +02:00
Dietmar Maurer
64932aebff PVE::QemuServer::create_disks - run code inside eval
So that we can free allocated volumes ins something fails.

Thi bug was introduced with commit ae57f6b352
2017-05-06 17:00:20 +02:00
Dietmar Maurer
0342b45bee get_replicatable_volumes: replacemnet for PVE::ReplicationTools::get_syncable_guestdisks()
correctly scan for volumes inside snapshots.

This will also solve the cyclic package dependency propblem.
2017-05-06 15:11:46 +02:00
Dietmar Maurer
2286cb8c23 use a single replicate property (format pve-replicate) 2017-05-06 10:35:08 +02:00
Dominik Csapak
2c7fc94783 start vncproxy worker in the background
this allows it to use the vncproxy api call to use from pvesh,
because before we waited until the task finished to get the vncticket
which was too late

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-05-03 08:35:03 +02:00
Wolfgang Bumiller
6d449202ba api: replica: safer config update
Configuration updates should only happen if and after their
change has successfully taken effect.
2017-04-28 10:40:22 +02:00
Wolfgang Link
9b49ba658f Destroy all remote and local replication datasets when a VM will destroyed. 2017-04-28 10:11:33 +02:00