BackupPC-users

Re: [BackupPC-users] Re-read hostname config after DumpPreUserCmd

2011-04-15 04:28:40
Subject: Re: [BackupPC-users] Re-read hostname config after DumpPreUserCmd
From: Marcos Lorenzo de Santiago <mlorenzo AT andago DOT com>
To: Holger Parplies <wbppc AT parplies DOT de>
Date: Fri, 15 Apr 2011 10:25:27 +0200 (CEST)
Holger Parplies <wbppc AT parplies DOT de> wrote [Yesterday +0200]

   HP > while I like the idea of being flexible about how to obtain the backup, 
I
   HP > don't see that you would need to modify the configuration at runtime for
   HP > that to work. Maybe I'm missing something obvious, but I would imagine 
either

That's because I need to tell BackupPC to contact another host (rather 
than the actual virtual machine that is turned off) that has access to the 
NetStorage disks.

   HP > 
   HP > 1.) RsyncClientCmd could do all the work - simply point that to a script
   HP >     that sets things up and execs the appropriate 'ssh $host rsync ...'
   HP >     command.

No, I don't think so. I need to modify more things inside configuration. 
I find it easier to reload config (4 lines of code inside BackupPC_dump) 
than handling BackupPC perl variables inside a pre-backup command.

   HP > 2.) DumpPreUserCmd could prepare things (as you are doing now) and 
write into
   HP >     a state file whether a native or chroot backup should be done.
   HP >     RsyncClientCmd could be a script that reads that state file and 
then execs
   HP >     the appropriate command like above.

Again, I need more modifications inside config file.

   HP > 3.) DumpPreUserCmd *can* be Perl code, so you could probably even use it
   HP >     to do exactly what you are proposing *without* modifying the 
BackupPC
   HP >     code (meaning if the change is not of general interest, you don't 
need to
   HP >     patch the source to get its benefits; you can put it in the
   HP >     configuration) - if you really need it.

Well, maybe you're right at this point, but for me it's easier and faster 
just reload configuration after DumpPreUserCmd

   HP > You'll have to be smart about PingCmd in any case (probably just ping 
the
   HP > server holding the virtual disk contents?).

I just don't use PingCmd for this particular cases as it is the first 
thing BackupPC runs. So if I turn off the virtual machine BackupPC would 
try to ping the virtual machine and find out it's unreachable so it will 
never begin the backup. And viceversa.

I need to check for the virtual machines status at DumpPreUserCmd or 
whatever command BackupPC may run. But the main problem persists, because 
if that command finds out that the virtual machine host is turned off and 
config is prepared for a running machine I need to change the config 
template for the host from this:

<template_on.pl>
$Conf{ClientNameAlias} = '_VIRTUALMACHINE_';
$Conf{BackupFilesExclude} = {
  '*' => [
    '/proc/*',
    '/sys/*'
  ]
};
$Conf{XferMethod} = 'rsync';
$Conf{BlackoutPeriods} = [
  {
    'hourEnd' => '21.5',
    'weekDays' => [
      '1',
      '2',
      '3',
      '4',
      '5',
      '6',
      '7'
    ],
    'hourBegin' => '7'
  }
];
$Conf{PingMaxMsec} = '100';
$Conf{FullAgeMax} = '15';
$Conf{IncrAgeMax} = '15';
$Conf{PingCmd} = '';
$Conf{DumpPreUserCmd} = '/var/lib/backuppc/configure_vm_backuppc.sh 
_VIRTUALMACHINE_';
</template_on.pl>


to this:


<template_off.pl>
$Conf{ClientNameAlias} = '_VIRTUALSERVER_';
$Conf{BackupFilesExclude} = {
  '*' => [
_EXCLUDE_
  ]
};
$Conf{XferMethod} = 'rsync';
$Conf{BlackoutPeriods} = [
  {
    'hourEnd' => '21.5',
    'weekDays' => [
      '1',
      '2',
      '3',
      '4',
      '5',
      '6',
      '7'
    ],
    'hourBegin' => '7'
  }
];
$Conf{PingMaxMsec} = '100';
$Conf{FullAgeMax} = '15';
$Conf{IncrAgeMax} = '15';
$Conf{PingCmd} = '';
$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+ 
vm=_VIRTUALMACHINE_';
# Restore disabled if _VIRTUALMACHINE_ is off
$Conf{RsyncClientRestoreCmd} = '';
$Conf{DumpPreUserCmd} = '/var/lib/backuppc/configure_vm_backuppc.sh 
_VIRTUALMACHINE_';
$Conf{DumpPostUserCmd} = 'ssh -lroot _VIRTUAL_SERVER_ offvirtuals umount 
_VIRTUALMACHINE_';
</template_off.pl>

   HP > Aside from all that, can't you just run the backup in the chroot 
environment
   HP > regardless of whether the virtual machine is running? What kind of
   HP > virtualization are we talking about?

Xen virtualization with NetStorage disks. When virtual machine is off 
BackupPC should back it up from a server that has access to that 
NetStorage that is always available to BackupPC. When it is turned on I 
just can't mount the disk on another server as filesystem may become 
corrupt.

   HP > I'm not saying your approach doesn't work. It's just that, personally, 
I'd
   HP > find a solution which does not modify the configuration at runtime more
   HP > readable (maintainable) and more resilient against errors.

I'm open to new suggests. Tell me how can I modify RsyncClientCmd once 
BackupPC already started BackupPC_dump. Because that's what I really need 
to change in runtime tha value of variables such as $host or $hostIP.

   HP > I disagree. As I said, I don't see that it makes anything possible that 
isn't
   HP > already. It *does* add a failure case (if a narrow one) and unnecessary 
work
   HP > (if not much) for the vast majority of BackupPC installations. And it 
could
   HP > conceivably break installations if anyone should currently use 
DumpPreUserCmd
   HP > to modify his configuration and rely on it *not* taking immediate 
effect (not
   HP > that I'd expect that, but who knows?).

I cannot see that case of failure you are talking about. I guess the vast 
majority of BackupPC users doesn't need to modify host configuration 
within BackupPC_dump runtime.

Again, I cannot imagine a practical case in which anyone would like 
BackupPC to wake up, run DumpPreUserCmd to modify its own BackupPC 
config file and then expect new parameters not to be applied to the config 
of the current backup proceess but in the next wakeup.

My intention is to easily add a config line

$Conf{DumpPreUserCmd} = '/var/lib/backuppc/configure_vm_backuppc.sh 
_VIRTUALMACHINE_';

to each virtual machine BackupPC's configuration so I can easily configure 
ignore-state
backups for new virtual machines. This way BackupPC server will always 
backup virtual machines regardless of their power status.

Best Regards.

-- 

Marcos Lorenzo de Santiago
System administrator
marcos.lorenzo AT andago DOT com

ÁNDAGO INGENIERÍA
Tlf: +34 916 011 373          Álcalde Ángel Arroyo, 10, 1º
Mvl: +34 637 741 034          28904, Getafe, Madrid (Spain)
Fax: +34 916 011 372               www.andago.com

-----------------------------------------------------------------------
"Linux: the operating system with a CLUE...
Command Line User Environment".
(seen in a posting in comp.software.testing)
-----------------------------------------------------------------------
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/