Re: [systemd-devel] Help: Local and Remote targets

2019-08-27 Thread Lennart Poettering
On Di, 20.08.19 15:26, Tony Rodriguez (unixpro1...@gmail.com) wrote:

> I modified systemd-219 functionality to meet a custom requirement for
> detecting filesystems/devices that use iscsi without using the _netdev
> keyword in /etc/fstab.  It is a strict requirement regarding not using
> _netdev that I have no control over.   However,  I am stuck.

I am sorry, but "_netdev" is the method we use for ordering mounts
against networking. It's what it does, it's the all that it is.

What you are asking for is like asking for "I'd like to hammer this
nail into a wall, but I really don't want to use a hammer." I mean,
sure you can use other stuff, but the hammer is what is what the tool
is called you hammer stuff into walls with, so that's what you use...

> From my understanding, src/fstab-generator.c is used to determine LOCAL-FS
> and REMOTE-FS.  I have modified fstab-generator.c to search for iscsi udev
> devices which works, provided the system is already fully booted
> (typical

Generators are run during early boot already, they may not have
dependencies on system state and just convert configuration from
arbitrary external formats to units files as understood by systemd.

If you do IPC or generate different units based on dnymaically
changing system state you will run into trouble, you are misusing
generators, and this is explicitly documented.

> multi-user state type of thing).  I can also find /dev/disk/ block devices
> including iscsi devices using my logic within fstab-generator.c.  The
> problem is when the system reboots, it appears systemd using the same
> fstab-generator logic that I implemented is unable to detect any iscsi
> devices.  After doing some research, it appears normal systemd behavior is
> to mount  /  and /usr then invoke fstab-generator.c to determine if a given
> filesystem in /etc/fstab should be a local or remote target.

Well, ISCSI is usually set up later during boot and generators run
very early, hence if you look for already active iscsi devices in
generators you are not going to find any.

Did you read the docs about generators? Please have a look at these
notes:

https://www.freedesktop.org/software/systemd/man/systemd.generator.html#Notes%20about%20writing%20generators

> The problem is I have no way to tell if a given iscsi filesystem/device
> specified in /etc/fstab (without the _netdev keyord ) is local/remote during
> the booting state.  Mainly because devices are not yet populated in

There's an easy way to denote that, it's called _netdev, it's what it does.

> /dev/disk or udev.  Is there a way I can determine if a filesystem/mount
> point/device specified in /etc/fstab is local or remote without the _netdev
> or fstype (which handles nfs, etc) keywords within fstab-generator.c? If
> checking udev and /dev/disk are not possible within fstab-generator.c,
> because such devices are not yet populated, then what should I modify within
> the systemd source so I can determine such local/remote targets myself and
> pass it to fstab-generator.c (especially when the system is in that / and
> /usr mounting state and udev devices are not yet populated?

Use _netdev, that's what it is for.

You may use "x-systemd.after=remote-fs-pre.target" as mount option to
emulate some of the effect of _netdev, but that does more.

Anyway, sorry for the disappointing answer, but your quest makes
little sense to me. What you are looking for is _netdev. If you don't
want to use that you created yourself a problem you have to solve
yourself.

Sorr,

Lennart

--
Lennart Poettering, Berlin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Help: Local and Remote targets

2019-08-20 Thread Tony Rodriguez
Understood but I don't have to worry about iscsi offloading for now.   
Some theories I have to attack the problem but each has a problem and 
may be complex.


1) Since I can obtain udev/disk information when the system is in a 
multi-user already booted stated.  Check for "iscsi" devices and 
filesystems then create a file on "/" that has the device id and specify 
it as an iscsi device.  When the system reboots then check for that 
file, if it exists set state to REMOTE-FS target within fstab-generator.c


Problem:  I will have to manage create/remove such files within systemd 
especially if contents within /etc/fstab are manually modified by the 
user.  Where would be the best place to put such logic within systemd 
source?


2) Boot the system mounting only "/" and "/usr" and defer 
fstab-generatoration until the system is booted.  Then find a way to 
manually re-start fstab-generation after iscsi/network are operational.  
After that restart systemd.


Problem: Unsure if this is reasonable. Wondering if doing so may 
introduce some kind of side effect issues regarding mounting and other 
services.


Note:
Really hoping for an easier way instead of trying to implement points 
(1) or (2)


Tony

On 8/20/19 3:33 PM, Rick Beldin wrote:

This might be problematic.  What will you do with iscsi devices that support
iscsi offload?  Those are typically completely invisible to the OS and just
appear as another HBA.

On 8/20/19 3:26 PM, Tony Rodriguez wrote:

I modified systemd-219 functionality to meet a custom requirement for
detecting filesystems/devices that use iscsi without using the _netdev keyword
in /etc/fstab.  It is a strict requirement regarding not using _netdev that I
have no control over.   However,  I am stuck.

 From my understanding, src/fstab-generator.c is used to determine LOCAL-FS and
REMOTE-FS.  I have modified fstab-generator.c to search for iscsi udev devices
which works, provided the system is already fully booted (typical multi-user
state type of thing).  I can also find /dev/disk/ block devices including
iscsi devices using my logic within fstab-generator.c.  The problem is when
the system reboots, it appears systemd using the same fstab-generator logic
that I implemented is unable to detect any iscsi devices.  After doing some
research, it appears normal systemd behavior is to mount  /  and /usr then
invoke fstab-generator.c to determine if a given filesystem in /etc/fstab
should be a local or remote target.

The problem is I have no way to tell if a given iscsi filesystem/device
specified in /etc/fstab (without the _netdev keyord ) is local/remote during
the booting state.  Mainly because devices are not yet populated in /dev/disk
or udev.  Is there a way I can determine if a filesystem/mount point/device
specified in /etc/fstab is local or remote without the _netdev or fstype
(which handles nfs, etc) keywords within fstab-generator.c? If checking udev
and /dev/disk are not possible within fstab-generator.c, because such devices
are not yet populated, then what should I modify within the systemd source so
I can determine such local/remote targets myself and pass it to
fstab-generator.c (especially when the system is in that / and /usr mounting
state and udev devices are not yet populated?

Thanks,
Tony
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Help: Local and Remote targets

2019-08-20 Thread Rick Beldin
This might be problematic.  What will you do with iscsi devices that support
iscsi offload?  Those are typically completely invisible to the OS and just
appear as another HBA.

On 8/20/19 3:26 PM, Tony Rodriguez wrote:
> I modified systemd-219 functionality to meet a custom requirement for
> detecting filesystems/devices that use iscsi without using the _netdev keyword
> in /etc/fstab.  It is a strict requirement regarding not using _netdev that I
> have no control over.   However,  I am stuck.
> 
> From my understanding, src/fstab-generator.c is used to determine LOCAL-FS and
> REMOTE-FS.  I have modified fstab-generator.c to search for iscsi udev devices
> which works, provided the system is already fully booted (typical multi-user
> state type of thing).  I can also find /dev/disk/ block devices including
> iscsi devices using my logic within fstab-generator.c.  The problem is when
> the system reboots, it appears systemd using the same fstab-generator logic
> that I implemented is unable to detect any iscsi devices.  After doing some
> research, it appears normal systemd behavior is to mount  /  and /usr then
> invoke fstab-generator.c to determine if a given filesystem in /etc/fstab
> should be a local or remote target.
> 
> The problem is I have no way to tell if a given iscsi filesystem/device
> specified in /etc/fstab (without the _netdev keyord ) is local/remote during
> the booting state.  Mainly because devices are not yet populated in /dev/disk
> or udev.  Is there a way I can determine if a filesystem/mount point/device
> specified in /etc/fstab is local or remote without the _netdev or fstype
> (which handles nfs, etc) keywords within fstab-generator.c? If checking udev
> and /dev/disk are not possible within fstab-generator.c, because such devices
> are not yet populated, then what should I modify within the systemd source so
> I can determine such local/remote targets myself and pass it to
> fstab-generator.c (especially when the system is in that / and /usr mounting
> state and udev devices are not yet populated?
> 
> Thanks,
> Tony
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

-- 
Rick Beldin
HPE Master Technologist, ERT
HPE Pointnext
Tel:  +1 470 2129073  Email: rick.bel...@hpe.com
Physical: 8000 Foothills Blvd. | Roseville, CA 95747 Hewlett Packard Enterprise
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Help: Local and Remote targets

2019-08-20 Thread Tony Rodriguez
I modified systemd-219 functionality to meet a custom requirement for 
detecting filesystems/devices that use iscsi without using the _netdev 
keyword in /etc/fstab.  It is a strict requirement regarding not using 
_netdev that I have no control over.   However,  I am stuck.


From my understanding, src/fstab-generator.c is used to determine 
LOCAL-FS and REMOTE-FS.  I have modified fstab-generator.c to search for 
iscsi udev devices which works, provided the system is already fully 
booted (typical multi-user state type of thing).  I can also find 
/dev/disk/ block devices including iscsi devices using my logic within 
fstab-generator.c.  The problem is when the system reboots, it appears 
systemd using the same fstab-generator logic that I implemented is 
unable to detect any iscsi devices.  After doing some research, it 
appears normal systemd behavior is to mount  /  and /usr then invoke 
fstab-generator.c to determine if a given filesystem in /etc/fstab 
should be a local or remote target.


The problem is I have no way to tell if a given iscsi filesystem/device 
specified in /etc/fstab (without the _netdev keyord ) is local/remote 
during the booting state.  Mainly because devices are not yet populated 
in /dev/disk or udev.  Is there a way I can determine if a 
filesystem/mount point/device specified in /etc/fstab is local or remote 
without the _netdev or fstype (which handles nfs, etc) keywords within 
fstab-generator.c? If checking udev and /dev/disk are not possible 
within fstab-generator.c, because such devices are not yet populated, 
then what should I modify within the systemd source so I can determine 
such local/remote targets myself and pass it to fstab-generator.c 
(especially when the system is in that / and /usr mounting state and 
udev devices are not yet populated?


Thanks,
Tony
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel