[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/3] backup: QEMU Backup Tool
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/3] backup: QEMU Backup Tool |
Date: |
Wed, 30 Aug 2017 16:05:30 +0100 |
On Wed, Aug 30, 2017 at 3:57 PM, Ishani
<address@hidden> wrote:
> ----- On Aug 30, 2017, at 9:51 AM, Fam Zheng address@hidden wrote:
>
>> On Tue, 08/29 22:13, Ishani Chugh wrote:
>>> +class BackupTool(object):
>>> + """BackupTool Class"""
>>> + def __init__(self, config_file=os.path.expanduser('~') +
>>> + '/.config/qemu/qemu-backup-config'):
>>> + if "QEMU_BACKUP_CONFIG" in os.environ:
>>> + self.config_file = os.environ["QEMU_BACKUP_CONFIG"]
>>> + else:
>>> + self.config_file = config_file
>>> + try:
>>> + if not os.path.isdir(os.path.dirname(self.config_file)):
>>> + os.makedirs(os.path.dirname(self.config_file))
>>> + except:
>>> + print("Cannot create config directory", file=sys.stderr)
>>> + sys.exit(1)
>>> + self.config = configparser.ConfigParser()
>>> + self.config.read(self.config_file)
>>
>> I suggest adding versioning to the config file, so that a future update to
>> this
>> tool can make an incompatible change without breaking older tool:
>>
>> [general]
>> version=0.1
>>
>> [guest_1]
>> ...
>>
>> [guest_2]
>> ...
>>
>> And only continue if the version is known.
>>
>> Fam
>
> I could not understand the intention behind adding versioning to config file.
> Can you please elaborate a little on what is meant by incompatible change?
If a new feature is added to qemu-backup in the future then it's
possible a user might have 2 machines, one with the old qemu-backup
version and one with the new qemu-backup.
When the new qemu-backup adds things to the configuration file the old
qemu-backup wouldn't know (because the code only queries the
configuration parameters it knows about). Running the old qemu-backup
again could conflict with the new configuration.
Fam is suggesting putting a version number into the configuration
file. This way the old qemu-backup can refuse to run with a newer
configuration file.
It also makes it possible for a new qemu-backup to detect that the
last run was with an older version so it can upgrade the configuration
file, if necessary.
Stefan