We have a program that uses stat() to get the ID of the device containing a given file. This ID is then used in ustat() to get the amount of free blocks on the corresponding device.
The program worked perfectly while we were running Proxmox 1.8. But since we upgraded to Proxmox 2.3, stat() delivers incorrect information at least for the device ID (I didn't look at the other fields of struct stat).
Upgrade was done by installing from scratch and restoring all VMs from backups.
The relevant part of the program works like this:
The minor number returned in stat.st_dev is incorrect and does not correspond to the minor number of the device in the /dev FS.
Here are examples of two VZ Containers sitting on the same cluster node:
VM101:
VM104:
Is there a know fix for this problem or do we have to try to fix it by modifying our program?
Thanks a lot
Joe
The program worked perfectly while we were running Proxmox 1.8. But since we upgraded to Proxmox 2.3, stat() delivers incorrect information at least for the device ID (I didn't look at the other fields of struct stat).
Upgrade was done by installing from scratch and restoring all VMs from backups.
The relevant part of the program works like this:
Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <ustat.h>
#include <stdio.h>
int main(void)
{
struct stat statbuf;
struct ustat ustatbuf;
char file[80];
sprintf(file, "/tmp/xyz");
if (stat(file, &statbuf) == -1) {
perror("stat()");
return(1);
} else {
printf("Using device: %d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev));
}
if (ustat(statbuf.st_dev, &ustatbuf) == -1) {
perror("ustat()");
return(1);
}
printf ("Free space: %d\n", ustatbuf.f_tfree);
return(0);
}
Here are examples of two VZ Containers sitting on the same cluster node:
VM101:
Code:
~# mystat
Using device: 0:25
ustat(): Operation not permitted
~# ls -al /dev/simfs
b-----x--- 1 root root 0, 17 2013-03-13 17:43 /dev/simfs
~# mount | grep simfs
/dev/simfs on / type simfs (rw,relatime)
VM104:
Code:
~# mystat
Using device: 0:32
ustat(): Operation not permitted
~# ls -al /dev/simfs
b-----x--- 1 root root 0, 35 2013-03-13 17:43 /dev/simfs
~# mount | grep simfs
/dev/simfs on / type simfs (rw,relatime)
Thanks a lot
Joe