[pve-devel] [PATCH 8/8] add setup_blockdev_mounts to pve-mount hook

Alexandre DERUMIER aderumier at odiso.com
Sat Aug 15 19:58:00 CEST 2015


>>my $scfg = PVE::Cluster::cfs_read_file("storage.cfg"); 
>>It's totally skip the rbd storage ???? 

If I run lxc-pve-mount-hook as root, it's working fine.
I need to check that monday


$VAR1 = {
          'order' => {
                       'local' => 2,
                       'ceph1' => 1
                     },
          'ids' => {
                     'ceph1' => {
                                  'type' => 'rbd',
                                  'krbd' => '1',
                                  'content' => {
                                                 'images' => 1
                                               },
                                  'shared' => 1,
                                  'pool' => 'pooltest2',
                                  'username' => 'admin',
                                  'monhost' => '10.3.94.69'
                                },
                     'local' => {
                                  'path' => '/var/lib/vz',
                                  'type' => 'dir',
                                  'maxfiles' => '0',
                                  'content' => {
                                                 'iso' => 1,
                                                 'rootdir' => 1,
                                                 'vztmpl' => 1,
                                                 'images' => 1
                                               }
                                }
                   },
          'digest' => 'a4bceec90ca21b325281c0b22808bc1e98467016'
        };






----- Mail original -----
De: "aderumier" <aderumier at odiso.com>
À: "dietmar" <dietmar at proxmox.com>
Cc: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Samedi 15 Août 2015 19:00:37
Objet: Re: [pve-devel] [PATCH 8/8] add setup_blockdev_mounts to pve-mount hook

>>But you do niot need to parse - data is already available: 

Well, from $conf, I have for example 

'mp0' => 'local:1000/vm-1000-disk-1.raw,mp=/home', 
'mp1' => 'ceph1:vm-1000-disk-2,size=4,mp=/tmp', 

But I need to find the /dev/... device to expose the device to guest and mount the share 
So in this case, I need to read storage.cfg, to parse the volid, and find the correct device. 

But I don't known why,if I read storage.cfg from lxc-pve-mount-hook 


my $scfg = PVE::Cluster::cfs_read_file("storage.cfg"); 
die Dumper($scfg); 

I have 


$VAR1 = { 
'order' => {}, 
'ids' => { 
'local' => { 
'maxfiles' => 0, 
'content' => { 
'images' => 1, 
'vztmpl' => 1, 
'iso' => 1, 
'rootdir' => 1 
}, 
'type' => 'dir', 
'path' => '/var/lib/vz', 
'priority' => 0 
} 
}, 
'digest' => 'da39a3ee5e6b4b0d3255bfef95601890afd80709' 
}; 


but the storage.cfg is 

rbd: ceph1 
monhost 10.3.94.69 
username admin 
content images 
pool pooltest2 
krbd 

dir: local 
path /var/lib/vz 
content images,iso,rootdir,vztmpl 
maxfiles 0 



It's totally skip the rbd storage ???? 




----- Mail original ----- 
De: "dietmar" <dietmar at proxmox.com> 
À: "aderumier" <aderumier at odiso.com> 
Cc: "pve-devel" <pve-devel at pve.proxmox.com> 
Envoyé: Samedi 15 Août 2015 16:55:34 
Objet: Re: [pve-devel] [PATCH 8/8] add setup_blockdev_mounts to pve-mount hook 

> On August 15, 2015 at 3:30 PM Alexandre DERUMIER <aderumier at odiso.com> wrote: 
> 
> 
> >>why do you use the raw lxc config here (instead of pve $conf)? 
> 
> I don't known why, but I have problems to read/parse storage.cfg from the 
> hook. 

But you do niot need to parse - data is already available: 

> > $self->setup_init($conf); 
> > $self->setup_blockdev($vmid); 
> > + $self->setup_blockdev_mounts($vmid); 

you can simply pass the $conf variable to your functions: 

$self->setup_init($conf); 
$self->setup_blockdev($conf, $vmid); 
$self->setup_blockdev_mounts($conf, $vmid); 

or do I miss something? 
_______________________________________________ 
pve-devel mailing list 
pve-devel at pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 



More information about the pve-devel mailing list