Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package libstorage-ng for openSUSE:Factory checked in at 2021-06-01 10:33:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old)
and /work/SRC/openSUSE:Factory/.libstorage-ng.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng"
Tue Jun 1 10:33:47 2021 rev:117 rq:896349 version:4.4.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2021-05-23 23:30:47.676690010 +0200
+++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.1898/libstorage-ng.changes 2021-06-01 10:34:00.452460193 +0200
@@ -1,0 +2,14 @@
+Mon May 31 11:30:21 UTC 2021 - aschnell@suse.com
+
+- merge gh#openSUSE/libstorage-ng#809
+- work on image mode
+- 4.4.11
+
+--------------------------------------------------------------------
+Fri May 28 06:34:26 UTC 2021 - aschnell@suse.com
+
+- merge gh#openSUSE/libstorage-ng#808
+- adjust partition names from set_source
+- 4.4.10
+
+--------------------------------------------------------------------
Old:
----
libstorage-ng-4.4.9.tar.xz
New:
----
libstorage-ng-4.4.11.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libstorage-ng.spec ++++++
--- /var/tmp/diff_new_pack.vNld9k/_old 2021-06-01 10:34:00.932461011 +0200
+++ /var/tmp/diff_new_pack.vNld9k/_new 2021-06-01 10:34:00.932461011 +0200
@@ -18,7 +18,7 @@
%define libname %{name}1
Name: libstorage-ng
-Version: 4.4.9
+Version: 4.4.11
Release: 0
Summary: Library for storage management
License: GPL-2.0-only
++++++ libstorage-ng-4.4.9.tar.xz -> libstorage-ng-4.4.11.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/LIBVERSION new/libstorage-ng-4.4.11/LIBVERSION
--- old/libstorage-ng-4.4.9/LIBVERSION 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/LIBVERSION 2021-05-31 13:30:21.000000000 +0200
@@ -1 +1 @@
-1.53.1
+1.54.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/VERSION new/libstorage-ng-4.4.11/VERSION
--- old/libstorage-ng-4.4.9/VERSION 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/VERSION 2021-05-31 13:30:21.000000000 +0200
@@ -1 +1 @@
-4.4.9
+4.4.11
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/configure.ac new/libstorage-ng-4.4.11/configure.ac
--- old/libstorage-ng-4.4.9/configure.ac 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/configure.ac 2021-05-31 13:30:21.000000000 +0200
@@ -150,6 +150,7 @@
integration-tests/bcache/Makefile
integration-tests/misc/Makefile
integration-tests/pools/Makefile
+ integration-tests/image/Makefile
bindings/Makefile
bindings/python/Makefile
bindings/python/examples/Makefile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/integration-tests/Makefile.am new/libstorage-ng-4.4.11/integration-tests/Makefile.am
--- old/libstorage-ng-4.4.9/integration-tests/Makefile.am 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/integration-tests/Makefile.am 2021-05-31 13:30:21.000000000 +0200
@@ -3,7 +3,7 @@
#
SUBDIRS = partition-tables partitions filesystems mount-points md lvm \
- plain-encryption luks bcache pools misc
+ plain-encryption luks bcache pools misc image
python_PYTHON = storageitu.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/integration-tests/image/Makefile.am new/libstorage-ng-4.4.11/integration-tests/image/Makefile.am
--- old/libstorage-ng-4.4.9/integration-tests/image/Makefile.am 1970-01-01 01:00:00.000000000 +0100
+++ new/libstorage-ng-4.4.11/integration-tests/image/Makefile.am 2021-05-31 13:30:21.000000000 +0200
@@ -0,0 +1,10 @@
+#
+# Makefile.am for libstorage/integration-tests/image
+#
+
+integration_testsdir = /usr/lib/libstorage-ng/integration-tests/image
+
+integration_tests_SCRIPTS = *.py
+
+EXTRA_DIST = $(integration_tests_SCRIPTS)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/integration-tests/image/create.py new/libstorage-ng-4.4.11/integration-tests/image/create.py
--- old/libstorage-ng-4.4.9/integration-tests/image/create.py 1970-01-01 01:00:00.000000000 +0100
+++ new/libstorage-ng-4.4.11/integration-tests/image/create.py 2021-05-31 13:30:21.000000000 +0200
@@ -0,0 +1,54 @@
+#!/usr/bin/python3
+
+# requirements:
+
+
+from storage import *
+from storageitu import *
+
+
+def create_partition(gpt, size):
+
+ for slot in gpt.get_unused_partition_slots():
+
+ if not slot.primary_possible:
+ continue
+
+ region = slot.region
+ region.set_length(int(size / region.get_block_size()))
+ region = gpt.align(region)
+ partition = gpt.create_partition(slot.name, region, PartitionType_PRIMARY)
+ return partition
+
+ raise "no slot for partition found"
+
+
+set_logger(get_logfile_logger())
+
+environment = Environment(False, ProbeMode_NONE, TargetMode_IMAGE)
+
+storage = Storage(environment)
+storage.set_rootprefix("/mnt")
+
+staging = storage.get_staging()
+
+# TODO find free loop device
+
+disk = Disk.create(staging, "/dev/loop0", 3 * GiB)
+disk.set_image_filename("/tmp/test.image")
+
+gpt = to_gpt(disk.create_partition_table(PtType_GPT))
+
+partition1 = create_partition(gpt, 1 * GiB)
+file_system1 = partition1.create_filesystem(FsType_EXT4)
+mount_point1 = file_system1.create_mount_point("/")
+
+partition2 = create_partition(gpt, 1.5 * GiB)
+file_system2 = partition2.create_filesystem(FsType_XFS)
+mount_point2 = file_system2.create_mount_point("/data")
+
+print(staging)
+
+commit(storage)
+
+# TODO allow cleanup: unmount, deactivate loop devices, ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/DevicegraphImpl.cc new/libstorage-ng-4.4.11/storage/DevicegraphImpl.cc
--- old/libstorage-ng-4.4.9/storage/DevicegraphImpl.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/DevicegraphImpl.cc 2021-05-31 13:30:21.000000000 +0200
@@ -474,6 +474,9 @@
remove_edge(old_edge);
+ Device* target = graph[target_vertex].get();
+ target->get_impl().has_new_parent();
+
return new_edge;
}
@@ -493,6 +496,9 @@
remove_edge(old_edge);
+ Device* target = graph[target_vertex].get();
+ target->get_impl().has_new_parent();
+
return new_edge;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/DeviceImpl.cc new/libstorage-ng-4.4.11/storage/Devices/DeviceImpl.cc
--- old/libstorage-ng-4.4.9/storage/Devices/DeviceImpl.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/DeviceImpl.cc 2021-05-31 13:30:21.000000000 +0200
@@ -245,6 +245,12 @@
void
+ Device::Impl::has_new_parent()
+ {
+ }
+
+
+ void
Device::Impl::parent_has_new_region(const Device* parent)
{
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/DeviceImpl.h new/libstorage-ng-4.4.11/storage/Devices/DeviceImpl.h
--- old/libstorage-ng-4.4.9/storage/Devices/DeviceImpl.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/DeviceImpl.h 2021-05-31 13:30:21.000000000 +0200
@@ -146,6 +146,8 @@
virtual ResizeInfo detect_resize_info(const BlkDevice* blk_device = nullptr) const = 0;
+ virtual void has_new_parent();
+
virtual void parent_has_new_region(const Device* parent);
virtual uf_t used_features(UsedFeaturesDependencyType used_features_dependency_type) const { return 0; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/Disk.cc new/libstorage-ng-4.4.11/storage/Devices/Disk.cc
--- old/libstorage-ng-4.4.9/storage/Devices/Disk.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/Disk.cc 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -166,6 +166,20 @@
}
+ const string&
+ Disk::get_image_filename() const
+ {
+ return get_impl().get_image_filename();
+ }
+
+
+ void
+ Disk::set_image_filename(const string& image_filename)
+ {
+ get_impl().set_image_filename(image_filename);
+ }
+
+
vector
Disk::get_all(Devicegraph* devicegraph)
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/Disk.h new/libstorage-ng-4.4.11/storage/Devices/Disk.h
--- old/libstorage-ng-4.4.9/storage/Devices/Disk.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/Disk.h 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -141,6 +141,17 @@
bool is_nvme() const;
/**
+ * Get the filename for the underlying image. Only for TargetMode::IMAGE.
+ */
+ const std::string& get_image_filename() const;
+
+ /**
+ * Set the filename for the underlying image. The file must not exist already.
+ * Only for TargetMode::IMAGE.
+ */
+ void set_image_filename(const std::string& image_filename);
+
+ /**
* Find a Disk by its name. Only the name returned by get_name() is
* considered.
*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/DiskImpl.cc new/libstorage-ng-4.4.11/storage/Devices/DiskImpl.cc
--- old/libstorage-ng-4.4.9/storage/Devices/DiskImpl.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/DiskImpl.cc 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -40,6 +40,7 @@
#include "storage/UsedFeatures.h"
#include "storage/Prober.h"
#include "storage/Utils/Format.h"
+#include "storage/Utils/SystemCmd.h"
namespace storage
@@ -234,6 +235,7 @@
{
vectorAction::Base* actions;
actions.push_back(new Action::Create(get_sid()));
+ actions.push_back(new Action::Activate(get_sid()));
actiongraph.add_chain(actions);
}
else
@@ -332,17 +334,66 @@
Text
Disk::Impl::do_create_text(Tense tense) const
{
+ // only used for TargetMode::IMAGE
+
Text text = tenser(tense,
// TRANSLATORS: displayed before action,
- // %1$s is replaced by the device name (e.g. /dev/vda),
+ // %1$s is replaced by the device name (e.g. /dev/loop0),
// %2$s is replaced by the size (e.g. 20.00 GiB)
_("Create hard disk %1$s (%2$s)"),
// TRANSLATORS: displayed during action,
- // %1$s is replaced by the device name (e.g. /dev/vda),
+ // %1$s is replaced by the device name (e.g. /dev/loop0),
// %2$s is replaced by the size (e.g. 20.00 GiB)
_("Creating hard disk %1$s (%2$s)"));
return sformat(text, get_displayname(), get_size_text());
}
+
+ void
+ Disk::Impl::do_create()
+ {
+ // only used for TargetMode::IMAGE
+
+ if (image_filename.empty())
+ ST_THROW(Exception("image filename empty"));
+
+ string cmd_line = DD_BIN " if='" DEV_ZERO_FILE "' of=" + quote(image_filename) +
+ " obs=" + to_string(get_region().get_block_size()) + " seek=" +
+ to_string(get_region().get_length()) + " count=0 conv=excl";
+
+ SystemCmd cmd(cmd_line, SystemCmd::DoThrow);
+ }
+
+
+ Text
+ Disk::Impl::do_activate_text(Tense tense) const
+ {
+ // only used for TargetMode::IMAGE
+
+ Text text = tenser(tense,
+ // TRANSLATORS: displayed before action,
+ // %1$s is replaced by the device name (e.g. /dev/loop0),
+ // %2$s is replaced by the size (e.g. 20.00 GiB)
+ _("Activate hard disk %1$s (%2$s)"),
+ // TRANSLATORS: displayed during action,
+ // %1$s is replaced by the device name (e.g. /dev/loop0),
+ // %2$s is replaced by the size (e.g. 20.00 GiB)
+ _("Activating hard disk %1$s (%2$s)"));
+
+ return sformat(text, get_displayname(), get_size_text());
+ }
+
+
+ void
+ Disk::Impl::do_activate() const
+ {
+ // only used for TargetMode::IMAGE
+
+ string cmd_line = LOSETUP_BIN " --sector-size " + to_string(get_region().get_block_size()) + " " +
+ quote(get_name()) + " " + quote(image_filename);
+
+ SystemCmd cmd(cmd_line, SystemCmd::DoThrow);
+ }
+
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/DiskImpl.h new/libstorage-ng-4.4.11/storage/Devices/DiskImpl.h
--- old/libstorage-ng-4.4.9/storage/Devices/DiskImpl.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/DiskImpl.h 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -85,6 +85,9 @@
bool is_pmem() const;
bool is_nvme() const;
+ const string& get_image_filename() const { return image_filename; }
+ void set_image_filename(const string& image_filename) { Impl::image_filename = image_filename; }
+
static void probe_disks(Prober& prober);
virtual void probe_pass_1a(Prober& prober) override;
@@ -101,6 +104,10 @@
virtual void process_udev_ids(vector<string>& udev_ids) const override;
virtual Text do_create_text(Tense tense) const override;
+ virtual void do_create() override;
+
+ virtual Text do_activate_text(Tense tense) const override;
+ virtual void do_activate() const override;
private:
@@ -111,6 +118,8 @@
ZoneModel zone_model = ZoneModel::NONE;
+ string image_filename;
+
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/PartitionImpl.cc new/libstorage-ng-4.4.11/storage/Devices/PartitionImpl.cc
--- old/libstorage-ng-4.4.9/storage/Devices/PartitionImpl.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/PartitionImpl.cc 2021-05-31 13:30:21.000000000 +0200
@@ -515,6 +515,15 @@
void
+ Partition::Impl::update_name()
+ {
+ const Partitionable* partitionable = get_partitionable();
+
+ set_name(name_and_number_to_device(partitionable->get_name(), get_number()));
+ }
+
+
+ void
Partition::Impl::update_sysfs_name_and_path()
{
const Partitionable* partitionable = get_partitionable();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/PartitionImpl.h new/libstorage-ng-4.4.11/storage/Devices/PartitionImpl.h
--- old/libstorage-ng-4.4.9/storage/Devices/PartitionImpl.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/PartitionImpl.h 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -101,6 +101,7 @@
const string& get_uuid() const { return uuid; }
void set_uuid(const string& uuid) { Impl::uuid = uuid; }
+ void update_name();
void update_sysfs_name_and_path();
void update_udev_paths_and_ids();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/PartitionTableImpl.cc new/libstorage-ng-4.4.11/storage/Devices/PartitionTableImpl.cc
--- old/libstorage-ng-4.4.9/storage/Devices/PartitionTableImpl.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/PartitionTableImpl.cc 2021-05-31 13:30:21.000000000 +0200
@@ -234,6 +234,20 @@
}
+ void
+ PartitionTable::Impl::has_new_parent()
+ {
+ for (Partition* partition : get_partitions())
+ {
+ partition->get_impl().update_name();
+ partition->get_impl().update_sysfs_name_and_path();
+ partition->get_impl().update_udev_paths_and_ids();
+
+ // TODO topology? at least block size? could cascade to even more devices
+ }
+ }
+
+
bool
PartitionTable::Impl::equal(const Device::Impl& rhs_base) const
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/PartitionTableImpl.h new/libstorage-ng-4.4.11/storage/Devices/PartitionTableImpl.h
--- old/libstorage-ng-4.4.9/storage/Devices/PartitionTableImpl.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/PartitionTableImpl.h 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -68,6 +68,8 @@
Partitionable* get_partitionable();
const Partitionable* get_partitionable() const;
+ virtual void has_new_parent() override;
+
virtual bool equal(const Device::Impl& rhs) const override = 0;
virtual void log_diff(std::ostream& log, const Device::Impl& rhs_base) const override = 0;
virtual void print(std::ostream& out) const override = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Devices/PartitionableImpl.cc new/libstorage-ng-4.4.11/storage/Devices/PartitionableImpl.cc
--- old/libstorage-ng-4.4.9/storage/Devices/PartitionableImpl.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Devices/PartitionableImpl.cc 2021-05-31 13:30:21.000000000 +0200
@@ -31,12 +31,10 @@
#include "storage/Devices/ImplicitPt.h"
#include "storage/Holders/User.h"
#include "storage/Devicegraph.h"
-#include "storage/Action.h"
#include "storage/Utils/XmlFile.h"
#include "storage/Utils/Enum.h"
#include "storage/Utils/StorageTmpl.h"
#include "storage/Utils/StorageDefines.h"
-#include "storage/Utils/SystemCmd.h"
#include "storage/Utils/CallbacksImpl.h"
#include "storage/SystemInfo/SystemInfo.h"
#include "storage/StorageImpl.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Environment.h new/libstorage-ng-4.4.11/storage/Environment.h
--- old/libstorage-ng-4.4.9/storage/Environment.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Environment.h 2021-05-31 13:30:21.000000000 +0200
@@ -41,11 +41,21 @@
READ_MOCKUP // fake probe - for testsuite
};
- //! Is the target a disk, chroot, or image?
+
+ /**
+ * Enum with target modes.
+ */
enum class TargetMode {
- DIRECT, // direct target
- CHROOT, // the target is chrooted, e.g. inst-sys
- IMAGE // the target is image based
+
+ /** Direct target. */
+ DIRECT,
+
+ /** The target is chrooted, e.g. inst-sys. */
+ CHROOT,
+
+ /** The target is image based. Experimental. */
+ IMAGE
+
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/EnvironmentImpl.h new/libstorage-ng-4.4.11/storage/EnvironmentImpl.h
--- old/libstorage-ng-4.4.9/storage/EnvironmentImpl.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/EnvironmentImpl.h 2021-05-31 13:30:21.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2018-2020] SUSE LLC
+ * Copyright (c) [2018-2021] SUSE LLC
*
* All Rights Reserved.
*
@@ -64,9 +64,10 @@
private:
- bool read_only;
- ProbeMode probe_mode;
- TargetMode target_mode;
+ const bool read_only;
+ const ProbeMode probe_mode;
+ const TargetMode target_mode;
+
string devicegraph_filename;
string arch_filename;
string mockup_filename;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Holders/Holder.h new/libstorage-ng-4.4.11/storage/Holders/Holder.h
--- old/libstorage-ng-4.4.9/storage/Holders/Holder.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Holders/Holder.h 2021-05-31 13:30:21.000000000 +0200
@@ -72,9 +72,10 @@
/**
* Set the source device of the holder. Experimental.
*
- * So far this function does not adjust the devices connected to the holder. E.g.
- * setting a disk as source for a partition table does not adjust the device names
- * of the partitions. This may change in the future.
+ * So far it is undefined whether this function adjusts the devices connected to
+ * the holder. E.g. setting a disk as source for a partition table adjusts the
+ * device names of the partitions but not the topology. This may change in the
+ * future.
*
* @throw Exception
*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/SystemInfo/CmdBlkid.cc new/libstorage-ng-4.4.11/storage/SystemInfo/CmdBlkid.cc
--- old/libstorage-ng-4.4.9/storage/SystemInfo/CmdBlkid.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/SystemInfo/CmdBlkid.cc 2021-05-31 13:30:21.000000000 +0200
@@ -40,7 +40,7 @@
Blkid::Blkid()
{
- SystemCmd cmd(BLKID_BIN " -c '/dev/null'", SystemCmd::DoThrow);
+ SystemCmd cmd(BLKID_BIN " -c '" DEV_NULL_FILE "'", SystemCmd::DoThrow);
parse(cmd.stdout());
}
@@ -48,7 +48,7 @@
Blkid::Blkid(const string& device)
{
- SystemCmd cmd(BLKID_BIN " -c '/dev/null' " + quote(device), SystemCmd::DoThrow);
+ SystemCmd cmd(BLKID_BIN " -c '" DEV_NULL_FILE "' " + quote(device), SystemCmd::DoThrow);
parse(cmd.stdout());
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/storage/Utils/StorageDefines.h new/libstorage-ng-4.4.11/storage/Utils/StorageDefines.h
--- old/libstorage-ng-4.4.9/storage/Utils/StorageDefines.h 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/storage/Utils/StorageDefines.h 2021-05-31 13:30:21.000000000 +0200
@@ -42,6 +42,13 @@
#define EFIVARS_DIR SYSFS_DIR "/firmware/efi/efivars"
+// files
+
+#define DEV_NULL_FILE DEV_DIR "/null"
+#define DEV_ZERO_FILE DEV_DIR "/zero"
+#define DEV_URANDOM_FILE DEV_DIR "/urandom"
+
+
// commands
#define SH_BIN "/bin/sh"
@@ -99,6 +106,8 @@
#define TEST_BIN "/usr/bin/test"
#define STAT_BIN "/usr/bin/stat"
+#define LOSETUP_BIN "/sbin/losetup"
+
#define LSATTR_BIN "/usr/bin/lsattr"
#define CHATTR_BIN "/usr/bin/chattr"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/testsuite/Makefile.am new/libstorage-ng-4.4.11/testsuite/Makefile.am
--- old/libstorage-ng-4.4.9/testsuite/Makefile.am 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/testsuite/Makefile.am 2021-05-31 13:30:21.000000000 +0200
@@ -19,7 +19,7 @@
md1.test md2.test md3.test md4.test md5.test encryption1.test \
encryption2.test lvm1.test lvm-pv-usable-size.test graphviz.test \
copy-individual.test mountpoint.test bcache1.test graph.test \
- restore.test
+ restore.test set-source.test
AM_DEFAULT_SOURCE_EXT = .cc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/testsuite/disk.cc new/libstorage-ng-4.4.11/testsuite/disk.cc
--- old/libstorage-ng-4.4.9/testsuite/disk.cc 2021-05-21 16:52:25.000000000 +0200
+++ new/libstorage-ng-4.4.11/testsuite/disk.cc 2021-05-31 13:30:21.000000000 +0200
@@ -50,5 +50,5 @@
Actiongraph actiongraph(storage, lhs, rhs);
- BOOST_CHECK_EQUAL(actiongraph.get_commit_actions().size(), 1);
+ BOOST_CHECK_EQUAL(actiongraph.get_commit_actions().size(), 2);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.4.9/testsuite/set-source.cc new/libstorage-ng-4.4.11/testsuite/set-source.cc
--- old/libstorage-ng-4.4.9/testsuite/set-source.cc 1970-01-01 01:00:00.000000000 +0100
+++ new/libstorage-ng-4.4.11/testsuite/set-source.cc 2021-05-31 13:30:21.000000000 +0200
@@ -0,0 +1,63 @@
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE libstorage
+
+#include
+
+#include "storage/Utils/HumanString.h"
+#include "storage/Devices/DiskImpl.h"
+#include "storage/Devices/Gpt.h"
+#include "storage/Holders/Holder.h"
+#include "storage/Devicegraph.h"
+#include "storage/Storage.h"
+#include "storage/Environment.h"
+
+
+using namespace std;
+using namespace storage;
+
+
+BOOST_AUTO_TEST_CASE(test1)
+{
+ Environment environment(true, ProbeMode::NONE, TargetMode::DIRECT);
+
+ Storage storage(environment);
+
+ Devicegraph* staging = storage.get_staging();
+
+ Disk* sda = Disk::create(staging, "/dev/sda");
+ sda->set_size(16 * GiB);
+ sda->get_impl().set_sysfs_name("sda");
+ sda->get_impl().set_sysfs_path("/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda");
+ sda->get_impl().set_udev_paths({ "pci-0000:00:1f.2-ata-1.0" });
+ sda->get_impl().set_udev_ids({ "scsi-SATA_VBOX_HARDDISK_VB098dbc19-95da593f" });
+
+ Disk* sdb = Disk::create(staging, "/dev/sdb");
+ sdb->set_size(16 * GiB);
+ sdb->get_impl().set_sysfs_name("sdb");
+ sdb->get_impl().set_sysfs_path("/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb");
+ sdb->get_impl().set_udev_paths({ "pci-0000:00:1f.2-ata-2.0" });
+ sdb->get_impl().set_udev_ids({ "scsi-SATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc" });
+
+ Gpt* gpt = to_gpt(sda->create_partition_table(PtType::GPT));
+ Partition* sda1 = gpt->create_partition("/dev/sda1", Region(2048, 1048576, 512), PartitionType::PRIMARY);
+
+ BOOST_CHECK_EQUAL(sda1->get_name(), "/dev/sda1");
+ BOOST_CHECK_EQUAL(sda1->get_sysfs_name(), "sda1");
+ BOOST_CHECK_EQUAL(sda1->get_sysfs_path(), "/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1");
+ BOOST_CHECK_EQUAL(sda1->get_udev_paths().size(), 1);
+ BOOST_CHECK_EQUAL(sda1->get_udev_paths()[0], "pci-0000:00:1f.2-ata-1.0-part1");
+ BOOST_CHECK_EQUAL(sda1->get_udev_ids().size(), 1);
+ BOOST_CHECK_EQUAL(sda1->get_udev_ids()[0], "scsi-SATA_VBOX_HARDDISK_VB098dbc19-95da593f-part1");
+
+ Holder* holder = staging->find_holder(sda->get_sid(), gpt->get_sid());
+ holder->set_source(sdb);
+
+ BOOST_CHECK_EQUAL(sda1->get_name(), "/dev/sdb1");
+ BOOST_CHECK_EQUAL(sda1->get_sysfs_name(), "sdb1");
+ BOOST_CHECK_EQUAL(sda1->get_sysfs_path(), "/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb/sdb1");
+ BOOST_CHECK_EQUAL(sda1->get_udev_paths().size(), 1);
+ BOOST_CHECK_EQUAL(sda1->get_udev_paths()[0], "pci-0000:00:1f.2-ata-2.0-part1");
+ BOOST_CHECK_EQUAL(sda1->get_udev_ids().size(), 1);
+ BOOST_CHECK_EQUAL(sda1->get_udev_ids()[0], "scsi-SATA_VBOX_HARDDISK_VB20a8f410-8a3f17dc-part1");
+}