public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [RFC PATCH] guestfs: Per-user storage pools
@ 2024-09-06 18:26 cel
  2024-09-06 20:10 ` Scott Mayhew
  0 siblings, 1 reply; 3+ messages in thread
From: cel @ 2024-09-06 18:26 UTC (permalink / raw)
  To: kdevops; +Cc: Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

I'd like to be able to run more than one instance of kdevops per
physical host. Currently the kdevops guestfs set-up steers all
storage pool activity into ${STORAGE_POOL}/kdevops/guestfs, which
means there's a good change that two different logged-in users will
create virtual machines whose names (and block devices) conflict.

So far I haven't been able to get the other storage pool-related
settings to add sufficient uniqueness to prevent this conflict.

Instead, replace the "kdevops" string in the storage pool path with
the name of the user account running kdevops.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 scripts/bringup_guestfs.sh | 2 +-
 scripts/destroy_guestfs.sh | 2 +-
 scripts/guestfs.Makefile   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

I'm not sure this is the best way to go about it, but this has
worked well for several weeks. Looking for comments and
suggestions!


diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index 0cd573ae187b..1c042d5f8b84 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -24,7 +24,7 @@ IMG_FMT="qcow2"
 if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
 	IMG_FMT="raw"
 fi
-STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
+STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs"
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
 OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
diff --git a/scripts/destroy_guestfs.sh b/scripts/destroy_guestfs.sh
index 3cdd21a83903..6daff3479250 100755
--- a/scripts/destroy_guestfs.sh
+++ b/scripts/destroy_guestfs.sh
@@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh
 
 export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
 
-STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
+STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs"
 GUESTFSDIR="${TOPDIR}/guestfs"
 
 if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index af901b8ddaa0..147389fd0534 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -20,7 +20,7 @@ GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)'
 GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)'
 
 STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))
-KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops
+KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/$(USER)
 GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
 GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
 
@@ -84,4 +84,4 @@ destroy_guestfs:
 PHONY += destroy_guestfs
 
 cleancache:
-	$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
+	$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] guestfs: Per-user storage pools
  2024-09-06 18:26 [RFC PATCH] guestfs: Per-user storage pools cel
@ 2024-09-06 20:10 ` Scott Mayhew
  2024-09-06 20:57   ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Mayhew @ 2024-09-06 20:10 UTC (permalink / raw)
  To: cel; +Cc: kdevops, Chuck Lever

On Fri, 06 Sep 2024, cel@kernel.org wrote:

> From: Chuck Lever <chuck.lever@oracle.com>
> 
> I'd like to be able to run more than one instance of kdevops per
> physical host. Currently the kdevops guestfs set-up steers all
> storage pool activity into ${STORAGE_POOL}/kdevops/guestfs, which
> means there's a good change that two different logged-in users will
> create virtual machines whose names (and block devices) conflict.
> 
> So far I haven't been able to get the other storage pool-related
> settings to add sufficient uniqueness to prevent this conflict.
> 
> Instead, replace the "kdevops" string in the storage pool path with
> the name of the user account running kdevops.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

Why don't you just include your user id in
CONFIG_KDEVOPS_STORAGE_POOL_PATH?  That's what Jeff and I did when he
was still at Red Hat and we never ran into issues.

-Scott
> ---
>  scripts/bringup_guestfs.sh | 2 +-
>  scripts/destroy_guestfs.sh | 2 +-
>  scripts/guestfs.Makefile   | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> I'm not sure this is the best way to go about it, but this has
> worked well for several weeks. Looking for comments and
> suggestions!
> 
> 
> diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
> index 0cd573ae187b..1c042d5f8b84 100755
> --- a/scripts/bringup_guestfs.sh
> +++ b/scripts/bringup_guestfs.sh
> @@ -24,7 +24,7 @@ IMG_FMT="qcow2"
>  if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
>  	IMG_FMT="raw"
>  fi
> -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
> +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs"
>  QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
>  GUESTFSDIR="${TOPDIR}/guestfs"
>  OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
> diff --git a/scripts/destroy_guestfs.sh b/scripts/destroy_guestfs.sh
> index 3cdd21a83903..6daff3479250 100755
> --- a/scripts/destroy_guestfs.sh
> +++ b/scripts/destroy_guestfs.sh
> @@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh
>  
>  export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
>  
> -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
> +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs"
>  GUESTFSDIR="${TOPDIR}/guestfs"
>  
>  if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
> diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
> index af901b8ddaa0..147389fd0534 100644
> --- a/scripts/guestfs.Makefile
> +++ b/scripts/guestfs.Makefile
> @@ -20,7 +20,7 @@ GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)'
>  GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)'
>  
>  STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))
> -KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops
> +KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/$(USER)
>  GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
>  GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
>  
> @@ -84,4 +84,4 @@ destroy_guestfs:
>  PHONY += destroy_guestfs
>  
>  cleancache:
> -	$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
> +	$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*
> -- 
> 2.46.0
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] guestfs: Per-user storage pools
  2024-09-06 20:10 ` Scott Mayhew
@ 2024-09-06 20:57   ` Chuck Lever
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2024-09-06 20:57 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: cel, kdevops

On Fri, Sep 06, 2024 at 04:10:12PM -0400, Scott Mayhew wrote:
> On Fri, 06 Sep 2024, cel@kernel.org wrote:
> 
> > From: Chuck Lever <chuck.lever@oracle.com>
> > 
> > I'd like to be able to run more than one instance of kdevops per
> > physical host. Currently the kdevops guestfs set-up steers all
> > storage pool activity into ${STORAGE_POOL}/kdevops/guestfs, which
> > means there's a good change that two different logged-in users will
> > create virtual machines whose names (and block devices) conflict.
> > 
> > So far I haven't been able to get the other storage pool-related
> > settings to add sufficient uniqueness to prevent this conflict.
> > 
> > Instead, replace the "kdevops" string in the storage pool path with
> > the name of the user account running kdevops.
> > 
> > Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> 
> Why don't you just include your user id in
> CONFIG_KDEVOPS_STORAGE_POOL_PATH?  That's what Jeff and I did when he
> was still at Red Hat and we never ran into issues.

I did try that, IIRC, and it didn't work. I can give it another try
to mine some details about the failure mode.


> > ---
> >  scripts/bringup_guestfs.sh | 2 +-
> >  scripts/destroy_guestfs.sh | 2 +-
> >  scripts/guestfs.Makefile   | 4 ++--
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > I'm not sure this is the best way to go about it, but this has
> > worked well for several weeks. Looking for comments and
> > suggestions!
> > 
> > 
> > diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
> > index 0cd573ae187b..1c042d5f8b84 100755
> > --- a/scripts/bringup_guestfs.sh
> > +++ b/scripts/bringup_guestfs.sh
> > @@ -24,7 +24,7 @@ IMG_FMT="qcow2"
> >  if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
> >  	IMG_FMT="raw"
> >  fi
> > -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
> > +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs"
> >  QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
> >  GUESTFSDIR="${TOPDIR}/guestfs"
> >  OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
> > diff --git a/scripts/destroy_guestfs.sh b/scripts/destroy_guestfs.sh
> > index 3cdd21a83903..6daff3479250 100755
> > --- a/scripts/destroy_guestfs.sh
> > +++ b/scripts/destroy_guestfs.sh
> > @@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh
> >  
> >  export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
> >  
> > -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
> > +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs"
> >  GUESTFSDIR="${TOPDIR}/guestfs"
> >  
> >  if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
> > diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
> > index af901b8ddaa0..147389fd0534 100644
> > --- a/scripts/guestfs.Makefile
> > +++ b/scripts/guestfs.Makefile
> > @@ -20,7 +20,7 @@ GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)'
> >  GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)'
> >  
> >  STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))
> > -KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops
> > +KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/$(USER)
> >  GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
> >  GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
> >  
> > @@ -84,4 +84,4 @@ destroy_guestfs:
> >  PHONY += destroy_guestfs
> >  
> >  cleancache:
> > -	$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
> > +	$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*
> > -- 
> > 2.46.0
> > 
> > 
> 

-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-06 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 18:26 [RFC PATCH] guestfs: Per-user storage pools cel
2024-09-06 20:10 ` Scott Mayhew
2024-09-06 20:57   ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox