Linux VM disk encryption: add a systemd service for detecting arrived/changed volumes#1666
Linux VM disk encryption: add a systemd service for detecting arrived/changed volumes#1666canfikret wants to merge 5 commits intoade-singlepass-devfrom
Conversation
| static char log_file_path[1024]; | ||
|
|
||
| void custom_log(const char *format, ...) { | ||
| FILE *log_file = fopen(log_file_path, "a"); |
There was a problem hiding this comment.
Do we want to rotate the log after certain size
There was a problem hiding this comment.
Actually, what I am thinking is to do syslog instead of files. File could be used for debugging purposes.
| dev = udev_monitor_receive_device(mon); | ||
| custom_log("A new udev monitoring event is received!"); | ||
|
|
||
| const char *action = udev_device_get_action(dev); |
There was a problem hiding this comment.
null pointer checks needed for all the char* pointers which are returned before using them
| fd = udev_monitor_get_fd(mon); | ||
| if (fd < 0) { | ||
| custom_log("ERROR: Can't get udev monitor fd (error no=%d)\n", errno); | ||
| exit(1); |
There was a problem hiding this comment.
using exit should be avoided and better to terminate gracefully
There was a problem hiding this comment.
and if we do via return we should close all handles etc
| custom_log("Device node: %s", devnode); | ||
| int is_initialized = udev_device_get_is_initialized(dev); | ||
| custom_log("is_initialized: %d", is_initialized); | ||
| const char *fsType = udev_device_get_property_value(dev, "ID_FS_TYPE"); |
There was a problem hiding this comment.
magic string can be a literal
| // system(""); | ||
| } | ||
| custom_log("Processing udev monitoring event is done!\n"); | ||
| udev_device_unref(dev); |
There was a problem hiding this comment.
multiple unref s making difficult to prove correctness better to do:
takeref and allocate resources
callfoo() new funtion
deref and deallocate resources
| TimeoutSec=30 | ||
| IgnoreSIGPIPE=no | ||
| KillMode=control-group | ||
| ExecStart=/opt/microsoft/azure-diskencryption/bin/ade-volume-notif-svc -d |
There was a problem hiding this comment.
This should be %s and during ADE installation, replace it with /var/lib/waagent/Azure.Security..../
13883df to
4c9b33d
Compare
| cryptedDevices.push_back(it); | ||
| } | ||
| } | ||
| //remove previously add crypted devices, which are mounted now. |
There was a problem hiding this comment.
errata: "which are unlocked now",
assuming status change from add->change for crypted device is inferring ADE unlock to those devices.
Linux VM disk encryption: add a systemd service for detecting arrived/changed volumes.