Hello community,

here is the log from the commit of package snapper for openSUSE:Factory checked 
in at 2014-07-02 15:04:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/snapper (Old)
 and      /work/SRC/openSUSE:Factory/.snapper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "snapper"

Changes:
--------
--- /work/SRC/openSUSE:Factory/snapper/snapper.changes  2014-06-26 
08:00:39.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.snapper.new/snapper.changes     2014-07-02 
15:04:28.000000000 +0200
@@ -1,0 +2,10 @@
+Mon Jun 30 15:43:56 CEST 2014 - [email protected]
+
+- make rollback command print verbose messages
+
+-------------------------------------------------------------------
+Mon Jun 30 14:44:25 CEST 2014 - [email protected]
+
+- allow to add snapshots to qgroup (prototype for fate#312751)
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ snapper.spec ++++++
--- /var/tmp/diff_new_pack.pmOzgp/_old  2014-07-02 15:04:29.000000000 +0200
+++ /var/tmp/diff_new_pack.pmOzgp/_new  2014-07-02 15:04:29.000000000 +0200
@@ -82,7 +82,7 @@
 ./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir}         
\
        --docdir=%{prefix}/share/doc/packages/snapper                           
\
 %if 0%{?suse_version} <= 1310
-       --disable-rollback                                                      
\
+       --disable-rollback --disable-btrfs-quota                                
\
 %endif
        --disable-silent-rules --disable-ext4
 make %{?jobs:-j%jobs}

++++++ snapper-0.2.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/client/snapper.cc 
new/snapper-0.2.3/client/snapper.cc
--- old/snapper-0.2.3/client/snapper.cc 2014-06-06 13:36:33.000000000 +0200
+++ new/snapper-0.2.3/client/snapper.cc 2014-07-01 11:10:53.000000000 +0200
@@ -1274,22 +1274,42 @@
 
     if (getopts.numArgs() == 0)
     {
-       command_create_single_xsnapshot_of_default(*conn, config_name, true, 
description, cleanup,
-                                                  userdata);
+       if (!quiet)
+           cout << _("Creating read-only snapshot of default subvolume.") << 
flush;
+       unsigned int num1 = command_create_single_xsnapshot_of_default(*conn, 
config_name, true,
+                                                                      
description, cleanup,
+                                                                      
userdata);
+       if (!quiet)
+           cout << " " << sformat(_("(Snapshot %d.)"), num1) << endl;
 
+       if (!quiet)
+           cout << _("Creating read-write snapshot of current subvolume.") 
<<flush;
        num2 = command_create_single_xsnapshot_v2(*conn, config_name, 0, false, 
description,
                                                  cleanup, userdata);
+       if (!quiet)
+           cout << " " << sformat(_("(Snapshot %d.)"), num2) << endl;
     }
     else
     {
        unsigned int tmp = read_num(getopts.popArg());
 
-       command_create_single_xsnapshot(*conn, config_name, description, 
cleanup, userdata);
+       if (!quiet)
+           cout << _("Creating read-only snapshot of current system.") << 
flush;
+       unsigned int num1 = command_create_single_xsnapshot(*conn, config_name, 
description,
+                                                           cleanup, userdata);
+       if (!quiet)
+           cout << " " << sformat(_("(Snapshot %d.)"), num1) << endl;
 
+       if (!quiet)
+           cout << sformat(_("Creating read-write snapshot of snapshot %d."), 
tmp) << flush;
        num2 = command_create_single_xsnapshot_v2(*conn, config_name, tmp, 
false,
                                                  description, cleanup, 
userdata);
+       if (!quiet)
+           cout << " " << sformat(_("(Snapshot %d.)"), num2) << endl;
     }
 
+    if (!quiet)
+       cout << sformat(_("Setting default subvolume to snapshot %d."), num2) 
<< endl;
     filesystem->setDefault(num2);
 
     if (print_number)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/config.h.in 
new/snapper-0.2.3/config.h.in
--- old/snapper-0.2.3/config.h.in       2014-06-24 11:09:17.000000000 +0200
+++ new/snapper-0.2.3/config.h.in       2014-07-01 11:11:26.000000000 +0200
@@ -15,6 +15,9 @@
 /* Enable Btrfs internal snapshots support */
 #undef ENABLE_BTRFS
 
+/* Enable btrfs quota support */
+#undef ENABLE_BTRFS_QUOTA
+
 /* Enable Ext4 snapshots support */
 #undef ENABLE_EXT4
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/configure new/snapper-0.2.3/configure
--- old/snapper-0.2.3/configure 2014-06-24 11:09:17.000000000 +0200
+++ new/snapper-0.2.3/configure 2014-07-01 11:11:26.000000000 +0200
@@ -646,6 +646,8 @@
 PKG_CONFIG
 HAVE_PAM_FALSE
 HAVE_PAM_TRUE
+ENABLE_BTRFS_QUOTA_FALSE
+ENABLE_BTRFS_QUOTA_TRUE
 ENABLE_ROLLBACK_FALSE
 ENABLE_ROLLBACK_TRUE
 HAVE_XATTRS_FALSE
@@ -809,6 +811,7 @@
 enable_zypp
 enable_xattrs
 enable_rollback
+enable_btrfs_quota
 enable_pam
 '
       ac_precious_vars='build_alias
@@ -1462,6 +1465,7 @@
   --disable-zypp          Disable zypp plugin support
   --disable-xattrs        Disable extended attributes support
   --disable-rollback      Disable rollback support
+  --disable-btrfs-quota   Disable btrfs quota support
   --disable-pam           Disable pam plugin support
 
 Optional Packages:
@@ -15873,6 +15877,28 @@
 
 fi
 
+# Check whether --enable-btrfs-quota was given.
+if test "${enable_btrfs_quota+set}" = set; then :
+  enableval=$enable_btrfs_quota; enable_btrfs_quota=$enableval
+else
+  enable_btrfs_quota=yes
+fi
+
+ if test "x$enable_btrfs_quota" = "xyes"; then
+  ENABLE_BTRFS_QUOTA_TRUE=
+  ENABLE_BTRFS_QUOTA_FALSE='#'
+else
+  ENABLE_BTRFS_QUOTA_TRUE='#'
+  ENABLE_BTRFS_QUOTA_FALSE=
+fi
+
+
+if test "x$enable_btrfs_quota" = "xyes"; then
+
+$as_echo "#define ENABLE_BTRFS_QUOTA 1" >>confdefs.h
+
+fi
+
 # Check whether --enable-pam was given.
 if test "${enable_pam+set}" = set; then :
   enableval=$enable_pam; with_pam=$enableval
@@ -16272,6 +16298,10 @@
   as_fn_error $? "conditional \"ENABLE_ROLLBACK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${ENABLE_BTRFS_QUOTA_TRUE}" && test -z 
"${ENABLE_BTRFS_QUOTA_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_BTRFS_QUOTA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${HAVE_PAM_TRUE}" && test -z "${HAVE_PAM_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_PAM\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/configure.ac 
new/snapper-0.2.3/configure.ac
--- old/snapper-0.2.3/configure.ac      2014-04-02 14:27:32.000000000 +0200
+++ new/snapper-0.2.3/configure.ac      2014-06-30 15:03:26.000000000 +0200
@@ -119,6 +119,14 @@
        AC_DEFINE(ENABLE_ROLLBACK, 1, [Enable rollback support])
 fi
 
+AC_ARG_ENABLE([btrfs-quota], AC_HELP_STRING([--disable-btrfs-quota],[Disable 
btrfs quota support]),
+               [enable_btrfs_quota=$enableval],[enable_btrfs_quota=yes])
+AM_CONDITIONAL(ENABLE_BTRFS_QUOTA, [test "x$enable_btrfs_quota" = "xyes"])
+
+if test "x$enable_btrfs_quota" = "xyes"; then
+       AC_DEFINE(ENABLE_BTRFS_QUOTA, 1, [Enable btrfs quota support])
+fi
+
 AC_ARG_ENABLE([pam], AC_HELP_STRING([--disable-pam],[Disable pam plugin 
support]),
                 [with_pam=$enableval],[with_pam=yes])
 AM_CONDITIONAL(HAVE_PAM, [test "x$with_pam" = "xyes"])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/Btrfs.cc 
new/snapper-0.2.3/snapper/Btrfs.cc
--- old/snapper-0.2.3/snapper/Btrfs.cc  2014-04-10 12:28:10.000000000 +0200
+++ new/snapper-0.2.3/snapper/Btrfs.cc  2014-06-30 15:03:26.000000000 +0200
@@ -69,12 +69,31 @@
 
 
     Btrfs::Btrfs(const string& subvolume)
-       : Filesystem(subvolume)
+       : Filesystem(subvolume), qgroup(no_qgroup)
     {
     }
 
 
     void
+    Btrfs::evalConfigInfo(const ConfigInfo& config_info)
+    {
+       string qgroup_str;
+       if (config_info.getValue("QGROUP", qgroup_str) && !qgroup_str.empty())
+       {
+           try
+           {
+               qgroup = make_qgroup(qgroup_str);
+           }
+           catch (const runtime_error& e)
+           {
+               y2err("failed to parse qgroup '" << qgroup_str << "'");
+               throw InvalidConfigException();
+           }
+       }
+    }
+
+
+    void
     Btrfs::createConfig(bool add_fstab) const
     {
        SDir subvolume_dir = openSubvolumeDir();
@@ -232,7 +251,7 @@
 
            try
            {
-               create_snapshot(subvolume_dir.fd(), info_dir.fd(), "snapshot", 
read_only);
+               create_snapshot(subvolume_dir.fd(), info_dir.fd(), "snapshot", 
read_only, qgroup);
            }
            catch (const runtime_error& e)
            {
@@ -247,7 +266,7 @@
 
            try
            {
-               create_snapshot(snapshot_dir.fd(), info_dir.fd(), "snapshot", 
read_only);
+               create_snapshot(snapshot_dir.fd(), info_dir.fd(), "snapshot", 
read_only, qgroup);
            }
            catch (const runtime_error& e)
            {
@@ -284,7 +303,7 @@
 
        try
        {
-           create_snapshot(tmp_mount_dir.fd(), info_dir.fd(), "snapshot", 
read_only);
+           create_snapshot(tmp_mount_dir.fd(), info_dir.fd(), "snapshot", 
read_only, qgroup);
        }
        catch (const runtime_error& e)
        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/Btrfs.h 
new/snapper-0.2.3/snapper/Btrfs.h
--- old/snapper-0.2.3/snapper/Btrfs.h   2014-04-10 12:28:10.000000000 +0200
+++ new/snapper-0.2.3/snapper/Btrfs.h   2014-06-30 15:03:26.000000000 +0200
@@ -25,6 +25,7 @@
 
 
 #include "snapper/Filesystem.h"
+#include "snapper/BtrfsUtils.h"
 
 
 namespace snapper
@@ -38,6 +39,8 @@
 
        Btrfs(const string& subvolume);
 
+       virtual void evalConfigInfo(const ConfigInfo& config_info);
+
        virtual string fstype() const { return "btrfs"; }
 
        virtual void createConfig(bool add_fstab) const;
@@ -68,6 +71,8 @@
 
     private:
 
+       qgroup_t qgroup;
+
        void addToFstab() const;
        void removeFromFstab() const;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/BtrfsUtils.cc 
new/snapper-0.2.3/snapper/BtrfsUtils.cc
--- old/snapper-0.2.3/snapper/BtrfsUtils.cc     2014-04-10 12:28:10.000000000 
+0200
+++ new/snapper-0.2.3/snapper/BtrfsUtils.cc     2014-06-30 15:03:26.000000000 
+0200
@@ -112,7 +112,7 @@
 
 
     void
-    create_snapshot(int fd, int fddst, const string& name, bool read_only)
+    create_snapshot(int fd, int fddst, const string& name, bool read_only, 
qgroup_t qgroup)
     {
        struct btrfs_ioctl_vol_args_v2 args_v2;
        memset(&args_v2, 0, sizeof(args_v2));
@@ -121,6 +121,24 @@
        args_v2.flags = read_only ? BTRFS_SUBVOL_RDONLY : 0;
        strncpy(args_v2.name, name.c_str(), sizeof(args_v2.name) - 1);
 
+#ifdef ENABLE_BTRFS_QUOTA
+       if (qgroup != no_qgroup)
+       {
+           size_t size = sizeof(btrfs_qgroup_inherit) + 
sizeof(((btrfs_qgroup_inherit*) 0)->qgroups[0]);
+           vector<char> buffer(size, 0);
+           struct btrfs_qgroup_inherit* inherit = (btrfs_qgroup_inherit*) 
&buffer[0];
+
+           inherit->num_qgroups = 1;
+           inherit->num_ref_copies = 0;
+           inherit->num_excl_copies = 0;
+           inherit->qgroups[0] = qgroup;
+
+           args_v2.flags |= BTRFS_SUBVOL_QGROUP_INHERIT;
+           args_v2.size = size;
+           args_v2.qgroup_inherit = inherit;
+       }
+#endif
+
        if (ioctl(fddst, BTRFS_IOC_SNAP_CREATE_V2, &args_v2) == 0)
            return;
        else if (errno != ENOTTY && errno != EINVAL)
@@ -225,4 +243,34 @@
 
 #endif
 
+
+    qgroup_t
+    make_qgroup(uint64_t level, uint64_t id)
+    {
+       return (level << 48) | id;
+    }
+
+
+    qgroup_t
+    make_qgroup(const string& str)
+    {
+       string::size_type pos = str.find('/');
+       if (pos == string::npos)
+           throw std::runtime_error("parsing qgroup failed");
+
+       std::istringstream a(str.substr(0, pos));
+       uint64_t level = 0;
+       a >> level;
+       if (a.fail() || !a.eof())
+           throw std::runtime_error("parsing qgroup failed");
+
+       std::istringstream b(str.substr(pos + 1));
+       uint64_t id = 0;
+       b >> id;
+       if (b.fail() || !b.eof())
+           throw std::runtime_error("parsing qgroup failed");
+
+       return make_qgroup(level, id);
+    }
+
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/BtrfsUtils.h 
new/snapper-0.2.3/snapper/BtrfsUtils.h
--- old/snapper-0.2.3/snapper/BtrfsUtils.h      2014-04-02 14:27:32.000000000 
+0200
+++ new/snapper-0.2.3/snapper/BtrfsUtils.h      2014-06-30 15:03:26.000000000 
+0200
@@ -32,12 +32,16 @@
     using std::string;
 
 
+    typedef uint64_t qgroup_t;
+    const qgroup_t no_qgroup = 0;
+
     bool is_subvolume(const struct stat& stat);
 
     bool is_subvolume_read_only(int fd);
 
     void create_subvolume(int fddst, const string& name);
-    void create_snapshot(int fd, int fddst, const string& name, bool 
read_only);
+    void create_snapshot(int fd, int fddst, const string& name, bool read_only,
+                        qgroup_t qgroup);
     void delete_subvolume(int fd, const string& name);
 
     void set_default_id(int fd, unsigned long long id);
@@ -46,6 +50,9 @@
     string get_subvolume(int fd, unsigned long long id);
     unsigned long long get_id(int fd);
 
+    qgroup_t make_qgroup(uint64_t level, uint64_t id);
+    qgroup_t make_qgroup(const string& str);
+
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/Filesystem.cc 
new/snapper-0.2.3/snapper/Filesystem.cc
--- old/snapper-0.2.3/snapper/Filesystem.cc     2014-04-10 12:28:10.000000000 
+0200
+++ new/snapper-0.2.3/snapper/Filesystem.cc     2014-06-30 15:03:26.000000000 
+0200
@@ -105,7 +105,8 @@
 #ifdef ENABLE_LVM
                &Lvm::create,
 #endif
-       NULL };
+               NULL
+       };
 
        for (const func_t* func = funcs; *func != NULL; ++func)
        {
@@ -119,6 +120,20 @@
     }
 
 
+    Filesystem*
+    Filesystem::create(const ConfigInfo& config_info)
+    {
+       string fstype = "btrfs";
+       config_info.getValue(KEY_FSTYPE, fstype);
+
+       Filesystem* fs = create(fstype, config_info.getSubvolume());
+
+       fs->evalConfigInfo(config_info);
+
+       return fs;
+    }
+
+
     SDir
     Filesystem::openSubvolumeDir() const
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/Filesystem.h 
new/snapper-0.2.3/snapper/Filesystem.h
--- old/snapper-0.2.3/snapper/Filesystem.h      2014-04-10 12:28:10.000000000 
+0200
+++ new/snapper-0.2.3/snapper/Filesystem.h      2014-06-30 15:03:26.000000000 
+0200
@@ -38,6 +38,7 @@
 
 
     class MtabData;
+    class ConfigInfo;
 
 
     class Filesystem
@@ -48,6 +49,9 @@
        virtual ~Filesystem() {}
 
        static Filesystem* create(const string& fstype, const string& 
subvolume);
+       static Filesystem* create(const ConfigInfo& config_info);
+
+       virtual void evalConfigInfo(const ConfigInfo& config_info) {}
 
        virtual string fstype() const = 0;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper/Snapper.cc 
new/snapper-0.2.3/snapper/Snapper.cc
--- old/snapper-0.2.3/snapper/Snapper.cc        2014-04-10 12:28:10.000000000 
+0200
+++ new/snapper-0.2.3/snapper/Snapper.cc        2014-06-30 15:03:26.000000000 
+0200
@@ -91,9 +91,7 @@
            throw ConfigNotFoundException();
        }
 
-       string fstype = "btrfs";
-       config_info->getValue(KEY_FSTYPE, fstype);
-       filesystem = Filesystem::create(fstype, config_info->getSubvolume());
+       filesystem = Filesystem::create(*config_info);
 
        bool sync_acl;
        if (config_info->getValue(KEY_SYNC_ACL, sync_acl) && sync_acl == true)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.3/snapper.spec.in 
new/snapper-0.2.3/snapper.spec.in
--- old/snapper-0.2.3/snapper.spec.in   2014-04-16 17:10:23.000000000 +0200
+++ new/snapper-0.2.3/snapper.spec.in   2014-06-30 15:03:26.000000000 +0200
@@ -82,7 +82,7 @@
 ./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir}         
\
        --docdir=%{prefix}/share/doc/packages/snapper                           
\
 %if 0%{?suse_version} <= 1310
-       --disable-rollback                                                      
\
+       --disable-rollback --disable-btrfs-quota                                
\
 %endif
        --disable-silent-rules --disable-ext4
 make %{?jobs:-j%jobs}

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to