Executing Script bevore/after VM start/stop

jasminj

Member
Sep 27, 2014
43
0
6
Vienna 19
jasmin.anw.at
Hi !

I try to use DRBD 8.4 with Proxmox 4.3. DRBD 8.4 lacks the Auto-Promote feature, so someone needs to do the primary setting. I don't want to use the primary-primary mode on my disks to be more secure.

I thought to use a script prior to starting a VM and after stopping it, which checks some things and does this primary setting automatically and can stop the start process with a return value. For this to work I need a hook in Proxmox prior to start the VM (and also when stopping).
Is there any possibility for executing Hook Scripts implemented in Proxmox?
I searched already, but I couldn't find something useful.

AFAIK it is /usr/sbin/qm (and the Perl classes behind) which does all the VM handling. If it is not implemented, is "PVE::CLI::qm" the point to start implementing this?

Is this something which would be useful to have and eventually accepted for the code base?

I noticed also, that my disks on the LVM storage are act/deactivated. It seems this is a function of the storage plugin. So it would be a possibility to write either a slightly modified LVM Plugin (DRBD8Plugin), or to implement this on a higher level inside the Proxmox code.

I also noticed, that my volume didn't get deactivated, when I stopped the VM by issuing a "poweroff" command inside the VM. Is this a bug or isn't it simply not possible to detect such a situation?
 

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
3,399
529
113
there are no such hook points at the moment (except for vzdump). if you want to discuss development ideas that you want to implement, it's probably best to subscribe and post to the pve-devel mailing list, as described in our Developer Documentation: http://pve.proxmox.com/wiki/Developer_Documentation :)
 

jasminj

Member
Sep 27, 2014
43
0
6
Vienna 19
jasmin.anw.at
So it would be a possibility to write either a slightly modified LVM Plugin (DRBD8Plugin)
I think this is the "right" solution. Yesterday I looked to the Storage implementation and I discovered "Storage/Custom".
I am now asking if there is a plugin already available, which can present any block device as a storage to Proxmox? I don't want to reinvent the wheel ;)
This should work very similar to a disk presented to KVM by the LVM plugin, resulting in a "-drive file=/dev/drbdXX" parameter.
And please don't tell me I could use LVM on top of DRBD. This would result in [Disk / VG / LVM / DRBD / VG / LVM / KVM-Disk] which looks complicated to recover in case of a disaster. This is not what I want and having a (shared) RAW disk plugin could be useful for other situations also.
I just found Physical-Disk-To_KVM. This realized by a storage plugin is exactly what I need.

Edit:
Sorry, didn't see you post during editing this.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE and Proxmox Mail Gateway. We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!