On Thu, Jan 03, 2013 at 10:51:09AM -0700, Eric Blake wrote:
On 01/03/2013 09:45 AM, Peter Krempa wrote:
> ---
> po/POTFILES.in | 1 +
> src/Makefile.am | 1 +
> src/qemu/qemu_driver.c | 1699 +-------------------------------------------
> src/qemu/qemu_snapshot.c | 1752 ++++++++++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_snapshot.h | 38 +
> 5 files changed, 1793 insertions(+), 1698 deletions(-)
> create mode 100644 src/qemu/qemu_snapshot.c
> create mode 100644 src/qemu/qemu_snapshot.h
Now that I've seen Dan's arguments against 1/2, I tend to agree that
qemu_util.c doesn't make much sense. But qemu_snapshot.c still makes
sense, so I will still review this one.
> +++ b/src/qemu/qemu_snapshot.c
> @@ -0,0 +1,1752 @@
> +/*
> + * qemu_snapshot.c: QEMU snapshot handling
> + *
> + * Copyright (C) 2013 Red Hat, Inc.
Same comments as in 1/2 about copying over copyright years from the
original location.
> +
> +#include <config.h>
> +
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +
And same comment about sorting includes.
> +#ifndef __QEMU_SNAPSHOT_H__
> +# define __QEMU_SNAPSHOT_H__
> +
> +# include "qemu_domain.h"
> +
> +virDomainSnapshotPtr qemuDomainSnapshotCreateXML(virDomainPtr domain,
> + const char *xmlDesc,
> + unsigned int flags);
> +
> +int qemuDomainRevertToSnapshot(virDomainSnapshotPtr,
> + unsigned int flags);
> +
> +int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
> + unsigned int flags);
> +
Interesting subset. Why not move any of these other snapshot-related
driver callbacks? qemuDomainSnapshotGetXMLDesc, qemuDomainSnapshotNum,
qemuDomainSnapshotListNames, qemuDomainListAllSnapshots,
qemuDomainSnapshotNumChildren, qemuDomainSnapshotListChildrenNames,
qemuDomainSnapshotListAllChildren, qemuDomainSnapshotLookupByName,
qemuDomainSnapshotGetParent, qemuDomainSnapshotCurrent,
qemuDomainSnapshotIsCurrent, qemuDomainSnapshotHasMetadata
IMHO all methods which are directly part of the public API
driver struct should be in qemu_driver.c. If we want to split
code, then there should be a set of internal helpers which
those public API methods call.
eg, see how it is done for migration.
qemu_driver.c contains qemuDomainMigratePrepare2
which in turn calls
qemuMigrationPrepareDirect in qemu_migration.c
Basically all the qemu_driver.c code does is convert from the public
API types (virDomainPtr) into the private API types (virDomainObjPtr)
and then call the main impl code.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|