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

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


>>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? 



More information about the pve-devel mailing list