kvm tools: Fix spelling mistake
PATCH 1/7 kvm tools: Fix spelling mistake
--- tools/kvm/guest_compat.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/kvm/guest_compat.c +1 -1
@@ -91,7 +91,7 @@ int compat__print_all_messages(void) msg = list_first_entry(&messages, struct compat_message, list); -printf ("\n\n*** Compatability Warning ***\n\n\t%s\n\n%s\n" , +printf ("\n\n*** Compatibility Warning ***\n\n\t%s\n\n%s\n" , msg->title, msg->desc);list_del (&msg->list);
Signature · 1 line
1.7.7
PATCH 2/7 kvm tools: Use compat message per device instead of per instance
This prevents multiple messages for the same type of device.
--- tools/kvm/include/kvm/virtio-9p.h | 1 - tools/kvm/virtio/9p.c | 6 ++++-- tools/kvm/virtio/balloon.c | 7 ++++--- tools/kvm/virtio/blk.c | 7 ++++--- tools/kvm/virtio/console.c | 8 +++++--- tools/kvm/virtio/net.c | 7 ++++--- tools/kvm/virtio/rng.c | 7 ++++--- 7 files changed, 25 insertions(+), 18 deletions(-)
tools/kvm/include/kvm/virtio-9p.h +0 -1
@@ -45,7 +45,6 @@ struct p9_dev {struct virtio_pci vpci;struct virtio_9p_config *config; -int compat_id;u32 features;/* virtio queue */
tools/kvm/virtio/9p.c +4 -2
@@ -20,6 +20,7 @@#include <net/9p/9p.h> static LIST_HEAD (devs); +static int compat_id =-1 ;/* Warning: Immediately use value returned from this function */ static const char *rel_to_abs(struct p9_dev *p9dev,
@@ -1148,7 +1149,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)struct virt_queue *queue;void *p; -compat__remove_message (p9dev->compat_id); +compat__remove_message (compat_id); queue = &p9dev->vqs[vq]; queue->pfn = pfn;
@@ -1247,7 +1248,8 @@ int virtio_9p__register(struct kvm *kvm, const char *root, const char *tag_name)list_add (&p9dev->list, &devs); - p9dev->compat_id =compat__add_message ("virtio-9p device was not detected" , +if (compat_id !=-1 ) + compat_id =compat__add_message ("virtio-9p device was not detected" ,"While you have requested a virtio-9p device, " "the guest kernel didn't seem to detect it.\n" "Please make sure that the kernel was compiled "
tools/kvm/virtio/balloon.c +4 -3
@@ -44,12 +44,12 @@ struct bln_dev {u16 stat_count;int stat_waitfd; -int compat_id;struct virtio_balloon_config config; };static struct bln_dev bdev;extern struct kvm *kvm; +static int compat_id =-1 ;static bool virtio_bln_do_io_request (struct kvm *kvm,struct bln_dev *bdev,struct virt_queue *queue) {
@@ -226,7 +226,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)struct virt_queue *queue;void *p; -compat__remove_message (bdev->compat_id); +compat__remove_message (compat_id); queue = &bdev->vqs[vq]; queue->pfn = pfn;
@@ -280,7 +280,8 @@ void virtio_bln__init(struct kvm *kvm) .get_size_vq = get_size_vq, }; - bdev.compat_id =compat__add_message ("virtio-balloon device was not detected" , +if (compat_id !=-1 ) + compat_id =compat__add_message ("virtio-balloon device was not detected" ,"While you have requested a virtio-balloon device, " "the guest kernel didn't seem to detect it.\n" "Please make sure that the kernel was compiled "
tools/kvm/virtio/blk.c +4 -3
@@ -44,7 +44,6 @@ struct blk_dev {struct virtio_pci vpci;struct virtio_blk_config blk_config;struct disk_image *disk; -int compat_id;u32 features;struct virt_queue vqs[NUM_VIRT_QUEUES ];
@@ -53,6 +52,7 @@ struct blk_dev { };static LIST_HEAD (bdevs); +static int compat_id;static void virtio_blk_do_io_request (struct kvm *kvm,void *param) {
@@ -154,7 +154,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)struct virt_queue *queue;void *p; -compat__remove_message (bdev->compat_id); +compat__remove_message (compat_id); queue = &bdev->vqs[vq]; queue->pfn = pfn;
@@ -220,7 +220,8 @@ void virtio_blk__init(struct kvm *kvm, struct disk_image *disk)list_add_tail (&bdev->list, &bdevs); - bdev->compat_id =compat__add_message ("virtio-blk device was not detected" , +if (compat_id !=-1 ) + compat_id =compat__add_message ("virtio-blk device was not detected" ,"While you have requested a virtio-blk device, " "the guest kernel didn't seem to detect it.\n" "Please make sure that the kernel was compiled "
tools/kvm/virtio/console.c +5 -3
@@ -37,7 +37,6 @@ struct con_dev {struct virt_queue vqs[VIRTIO_CONSOLE_NUM_QUEUES ];struct virtio_console_config config;u32 features; -int compat_id;struct thread_pool__job jobs[VIRTIO_CONSOLE_NUM_QUEUES ]; };
@@ -52,6 +51,8 @@ static struct con_dev cdev = { }, }; +static int compat_id =-1 ; +/* * Interrupts are injected for hvc0 only. */
@@ -137,7 +138,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)assert (vq <VIRTIO_CONSOLE_NUM_QUEUES ); -compat__remove_message (cdev.compat_id); +compat__remove_message (compat_id); queue = &cdev.vqs[vq]; queue->pfn = pfn;
@@ -188,7 +189,8 @@ void virtio_console__init(struct kvm *kvm) .get_size_vq = get_size_vq, }; - cdev.compat_id =compat__add_message ("virtio-console device was not detected" , +if (compat_id !=-1 ) + compat_id =compat__add_message ("virtio-console device was not detected" ,"While you have requested a virtio-console device, " "the guest kernel didn't seem to detect it.\n" "Please make sure that the kernel was compiled "
tools/kvm/virtio/net.c +4 -3
@@ -48,7 +48,6 @@ struct net_dev {struct virt_queue vqs[VIRTIO_NET_NUM_QUEUES ];struct virtio_net_config config;u32 features; -int compat_id;pthread_t io_rx_thread;pthread_mutex_t io_rx_lock;
@@ -69,6 +68,7 @@ struct net_dev { };static LIST_HEAD (ndevs); +static int compat_id =-1 ;static void *virtio_net_rx_thread (void *p) {
@@ -327,7 +327,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)struct virt_queue *queue;void *p; -compat__remove_message (ndev->compat_id); +compat__remove_message (compat_id); queue = &ndev->vqs[vq]; queue->pfn = pfn;
@@ -413,7 +413,8 @@ void virtio_net__init(const struct virtio_net_params *params)virtio_net__io_thread_init (params->kvm, ndev); - ndev->compat_id =compat__add_message ("virtio-net device was not detected" , +if (compat_id !=-1 ) + compat_id =compat__add_message ("virtio-net device was not detected" ,"While you have requested a virtio-net device, " "the guest kernel didn't seem to detect it.\n" "Please make sure that the kernel was compiled "
tools/kvm/virtio/rng.c +4 -3
@@ -33,7 +33,6 @@ struct rng_dev {struct virtio_pci vpci;int fd; -int compat_id;/* virtio queue */ struct virt_queue vqs[NUM_VIRT_QUEUES ];
@@ -41,6 +40,7 @@ struct rng_dev { };static LIST_HEAD (rdevs); +static int compat_id =-1 ;static void set_config (struct kvm *kvm,void *dev,u8 data,u32 offset) {
@@ -97,7 +97,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)struct rng_dev_job *job;void *p; -compat__remove_message (rdev->compat_id); +compat__remove_message (compat_id); queue = &rdev->vqs[vq]; queue->pfn = pfn;
@@ -164,7 +164,8 @@ void virtio_rng__init(struct kvm *kvm)list_add_tail (&rdev->list, &rdevs); - rdev->compat_id =compat__add_message ("virtio-rng device was not detected" , +if (compat_id !=-1 ) + compat_id =compat__add_message ("virtio-rng device was not detected" ,"While you have requested a virtio-rng device, " "the guest kernel didn't seem to detect it.\n" "Please make sure that the kernel was compiled "
Signature · 1 line
1.7.7
PATCH 3/7 kvm tools: Improve compat message
In reply to Sasha Levin--- tools/kvm/virtio/9p.c | 7 ++++--- tools/kvm/virtio/balloon.c | 7 ++++--- tools/kvm/virtio/blk.c | 7 ++++--- tools/kvm/virtio/console.c | 7 ++++--- tools/kvm/virtio/net.c | 7 ++++--- tools/kvm/virtio/rng.c | 7 ++++--- 6 files changed, 24 insertions(+), 18 deletions(-)
tools/kvm/virtio/9p.c +4 -3
@@ -1251,9 +1251,10 @@ int virtio_9p__register(struct kvm *kvm, const char *root, const char *tag_name)if (compat_id !=-1 ) compat_id =compat__add_message ("virtio-9p device was not detected" ,"While you have requested a virtio-9p device, " -"the guest kernel didn't seem to detect it.\n" -"Please make sure that the kernel was compiled " -"with CONFIG_NET_9P_VIRTIO." ); +"the guest kernel did not initialize it.\n" +"Please make sure that the guest kernel was " +"compiled with CONFIG_NET_9P_VIRTIO=y enabled " +"in its .config" );return err;
tools/kvm/virtio/balloon.c +4 -3
@@ -283,7 +283,8 @@ void virtio_bln__init(struct kvm *kvm)if (compat_id !=-1 ) compat_id =compat__add_message ("virtio-balloon device was not detected" ,"While you have requested a virtio-balloon device, " -"the guest kernel didn't seem to detect it.\n" -"Please make sure that the kernel was compiled " -"with CONFIG_VIRTIO_BALLOON." ); +"the guest kernel did not initialize it.\n" +"Please make sure that the guest kernel was " +"compiled with CONFIG_VIRTIO_BALLOON=y enabled " +"in its .config" ); }
tools/kvm/virtio/blk.c +4 -3
@@ -223,9 +223,10 @@ void virtio_blk__init(struct kvm *kvm, struct disk_image *disk)if (compat_id !=-1 ) compat_id =compat__add_message ("virtio-blk device was not detected" ,"While you have requested a virtio-blk device, " -"the guest kernel didn't seem to detect it.\n" -"Please make sure that the kernel was compiled " -"with CONFIG_VIRTIO_BLK." ); +"the guest kernel did not initialize it.\n" +"Please make sure that the guest kernel was " +"compiled with CONFIG_VIRTIO_BLK=y enabled " +"in its .config" ); }void virtio_blk__init_all (struct kvm *kvm)
tools/kvm/virtio/console.c +4 -3
@@ -192,7 +192,8 @@ void virtio_console__init(struct kvm *kvm)if (compat_id !=-1 ) compat_id =compat__add_message ("virtio-console device was not detected" ,"While you have requested a virtio-console device, " -"the guest kernel didn't seem to detect it.\n" -"Please make sure that the kernel was compiled " -"with CONFIG_VIRTIO_CONSOLE." ); +"the guest kernel did not initialize it.\n" +"Please make sure that the guest kernel was " +"compiled with CONFIG_VIRTIO_CONSOLE=y enabled " +"in its .config" ); }
tools/kvm/virtio/net.c +4 -3
@@ -416,7 +416,8 @@ void virtio_net__init(const struct virtio_net_params *params)if (compat_id !=-1 ) compat_id =compat__add_message ("virtio-net device was not detected" ,"While you have requested a virtio-net device, " -"the guest kernel didn't seem to detect it.\n" -"Please make sure that the kernel was compiled " -"with CONFIG_VIRTIO_NET." ); +"the guest kernel did not initialize it.\n" +"Please make sure that the guest kernel was " +"compiled with CONFIG_VIRTIO_NET=y enabled " +"in its .config" ); }
tools/kvm/virtio/rng.c +4 -3
@@ -167,9 +167,10 @@ void virtio_rng__init(struct kvm *kvm)if (compat_id !=-1 ) compat_id =compat__add_message ("virtio-rng device was not detected" ,"While you have requested a virtio-rng device, " -"the guest kernel didn't seem to detect it.\n" -"Please make sure that the kernel was compiled " -"with CONFIG_HW_RANDOM_VIRTIO." ); +"the guest kernel did not initialize it.\n" +"Please make sure that the guest kernel was " +"compiled with CONFIG_HW_RANDOM_VIRTIO=y enabled " +"in its .config" ); }void virtio_rng__delete_all (struct kvm *kvm)
Signature · 1 line
1.7.7
PATCH 4/7 kvm tools: Add basic help when starting 'kvm' without args
In reply to Sasha Levin--- tools/kvm/builtin-help.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
tools/kvm/builtin-help.c +2 -1
@@ -34,7 +34,8 @@ static void list_common_cmds_help(void)static void kvm_help (void ) { -printf ("\n usage: %s\n\n" , kvm_usage_string); +printf ("\n To start a simple non-privliged shell run 'kvm run'\n\n" +"usage: %s\n\n" , kvm_usage_string);list_common_cmds_help ();printf ("\n %s\n\n" , kvm_more_info_string); }
Signature · 1 line
1.7.7
PATCH 5/7 kvm tools: Add help and info messages to 'kvm setup'
In reply to Sasha Levin--- tools/kvm/builtin-setup.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
tools/kvm/builtin-setup.c +11 -1
@@ -47,6 +47,8 @@ static void parse_setup_options(int argc, const char **argv)void kvm_setup_help (void ) { +printf ("\nkvm setup creates a new rootfs and stores it under ~/.kvm-tools/ .\n" +"This can be used later by the '-d' parameter of 'kvm run'.\n" );usage_with_options (setup_usage, setup_options); }
@@ -205,10 +207,18 @@ int kvm_setup_create_new(const char *guestfs_name)int kvm_cmd_setup (int argc,const char **argv,const char *prefix) { +int r; +parse_setup_options (argc, argv);if (instance_name ==NULL )kvm_setup_help (); -return do_setup (instance_name); + r =do_setup (instance_name); +if (r ==0 ) +pr_info ("Your new rootfs named %s has been created.\n" +"You can now start it by running 'kvm run -d %s'\n" , + instance_name, instance_name); + +return r; }
Signature · 1 line
1.7.7
PATCH 6/7 kvm tools: Modify 'kvm setup' parameters
In reply to Sasha LevinThis patch makes the name as the default parameter, this makes usability easier since this is the only parameter available at the moment anyway.
--- tools/kvm/builtin-setup.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
tools/kvm/builtin-setup.c +8 -4
@@ -25,13 +25,11 @@static const char *instance_name;static const char *const setup_usage[] = { -"kvm setup [-n name]" , +"kvm setup [name]" ,NULL };static const struct option setup_options[] = { -OPT_GROUP ("General options:" ), -OPT_STRING ('n' ,"name" , &instance_name,"name" ,"Instance name" ),OPT_END () };
@@ -40,8 +38,12 @@ static void parse_setup_options(int argc, const char **argv)while (argc !=0 ) { argc =parse_options (argc, argv, setup_options, setup_usage,PARSE_OPT_STOP_AT_NON_OPTION ); -if (argc !=0 ) +if (argc !=0 && instance_name)kvm_setup_help (); +else + instance_name = argv[0 ]; + argv++; + argc--; } }
@@ -219,6 +221,8 @@ int kvm_cmd_setup(int argc, const char **argv, const char *prefix)pr_info ("Your new rootfs named %s has been created.\n" "You can now start it by running 'kvm run -d %s'\n" , instance_name, instance_name); + else + perror("Error creating rootfs");return r; }
Signature · 1 line
1.7.7
PATCH 7/7 kvm tools: Add option to list rootfs in 'kvm list'
In reply to Sasha LevinPreviously we would only list running instances, now that we create rootfs instances it's appropriate to add a method to list them as well.
--- tools/kvm/builtin-list.c | 68 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 2 deletions(-)
tools/kvm/builtin-list.c +66 -2
@@ -4,6 +4,7 @@#include <kvm/kvm.h> #include <kvm/parse-options.h> +#include <dirent.h> #include <stdio.h> #include <string.h> #include <signal.h>
@@ -11,12 +12,18 @@#define PROCESS_NAME "kvm" +static bool run; +static bool rootfs; +static const char *const list_usage[] = {"kvm list" ,NULL };static const struct option list_options[] = { +OPT_GROUP ("General options:" ), +OPT_BOOLEAN ('i' ,"run" , &run,"List running instances" ), +OPT_BOOLEAN ('r' ,"rootfs" , &rootfs,"List rootfs instances" ),OPT_END () };
@@ -58,9 +65,66 @@ cleanup:return 0 ; } -int kvm_cmd_list (int argc,const char **argv,const char *prefix) +static int kvm_list_running_instances (void ) {printf (" PID GUEST\n" ); -return kvm__enumerate_instances (print_guest); +return kvm__enumerate_instances (print_guest); +} + +static int kvm_list_rootfs (void ) +{ +char name[PATH_MAX ]; +DIR *dir; +struct dirent *dirent; + +snprintf (name,PATH_MAX ,"%s%s" ,HOME_DIR ,KVM_PID_FILE_PATH ); + dir =opendir (name); +if (dir ==NULL ) +return -1 ; + +printf (" ROOTFS\n" ); + +while ((dirent =readdir (dir))) { +if (dirent->d_type ==DT_DIR && +strcmp (dirent->d_name,"." ) && +strcmp (dirent->d_name,".." )) +printf ("%s\n" , dirent->d_name); + } + +return 0 ; +} + +static void parse_setup_options (int argc,const char **argv) +{ +while (argc !=0 ) { + argc =parse_options (argc, argv, list_options, list_usage, +PARSE_OPT_STOP_AT_NON_OPTION ); +if (argc !=0 ) +kvm_list_help (); + } +} + +int kvm_cmd_list (int argc,const char **argv,const char *prefix) +{ +int r; + +parse_setup_options (argc, argv); + +if (!run && !rootfs) +kvm_list_help (); + +if (run) { + r =kvm_list_running_instances (); +if (r <0 ) +perror ("Error listing instances" ); + } + +if (rootfs) { + r =kvm_list_rootfs (); +if (r <0 ) +perror ("Error listing rootfs" ); + } + +return 0 ; }
Signature · 1 line
1.7.7
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
In reply to Sasha Levintools/kvm/builtin-setup.c int kvm_setup_create_new(const char *guestfs_name) · line 221
Quoted 5 lines · Sasha Levin
tools/kvm/builtin-setup.c +5
-0+ r =do_setup (instance_name); +if (r ==0 ) +pr_info ("Your new rootfs named %s has been created.\n" +"You can now start it by running 'kvm run -d %s'\n" , + instance_name, instance_name);
Btw., will 'kvm run' select the last-created rootfs by default?
The patches look good otherwise.
Thanks,
Ingo
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
Quoted 11 lines · Ingo Molnar
tools/kvm/builtin-setup.c int kvm_setup_create_new(const char *guestfs_name) · line 221
Quoted 5 lines · Sasha Levin
tools/kvm/builtin-setup.c +5
-0+ r =do_setup (instance_name); +if (r ==0 ) +pr_info ("Your new rootfs named %s has been created.\n" +"You can now start it by running 'kvm run -d %s'\n" , + instance_name, instance_name);Btw., will 'kvm run' select the last-created rootfs by default?
The patches look good otherwise.
A simple 'kvm run' (creates if needed) and starts a rootfs named 'default'.
Signature · 1 line
Sasha.
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
In reply to Ingo MolnarQuoted 9 lines · Ingo Molnar
tools/kvm/builtin-setup.c int kvm_setup_create_new(const char *guestfs_name) · line 221
Quoted 5 lines · Sasha Levin
tools/kvm/builtin-setup.c +5
-0+ r =do_setup (instance_name); +if (r ==0 ) +pr_info ("Your new rootfs named %s has been created.\n" +"You can now start it by running 'kvm run -d %s'\n" , + instance_name, instance_name);Btw., will 'kvm run' select the last-created rootfs by default?
No, it runs rootfs that's named 'default'. We can change that but I'm not completely convinced running that last-created rootfs is the right thing to do here. Hmm.
Quoted 1 line
The patches look good otherwise.
Thanks for the review!
Pekka
Re: [PATCH 7/7] kvm tools: Add option to list rootfs in 'kvm list'
In reply to Sasha LevinQuoted 6 lines · Sasha Levin
Previously we would only list running instances, now that we create rootfs instances it's appropriate to add a method to list them as well.
Suggested-by Ingo Molnar <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I applied the patch but we really ought to print out both of them by default. Something like this:
PID GUEST 1234 debian <not running> default
Pekka
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
In reply to Pekka EnbergQuoted 11 lines · Pekka Enberg
Quoted 9 lines · Ingo Molnar
tools/kvm/builtin-setup.c int kvm_setup_create_new(const char *guestfs_name) · line 221
Quoted 5 lines · Sasha Levin
tools/kvm/builtin-setup.c +5
-0+ r =do_setup (instance_name); +if (r ==0 ) +pr_info ("Your new rootfs named %s has been created.\n" +"You can now start it by running 'kvm run -d %s'\n" , + instance_name, instance_name);Btw., will 'kvm run' select the last-created rootfs by default?
Quoted 3 lines
No, it runs rootfs that's named 'default'. We can change that but I'm not completely convinced running that last-created rootfs is the right thing to do here. Hmm.
I'm not convinced either - just wanted to raise the issue.
Also, i raised this in the other thread, why not use .kvmtool of the current directory? That way it's cwd local like Git and perf. A 'kvm run' (union?) mount the cwd or so - so this would be a natural equivalent to chroot. The $HOME/.kvmtool is a Qemu-ish global workflow.
Thanks,
Ingo
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
Quoted 7 lines · Ingo Molnar
Quoted 5 lines
Quoted 1 line
Btw., will 'kvm run' select the last-created rootfs by default?
No, it runs rootfs that's named 'default'. We can change that but I'm not completely convinced running that last-created rootfs is the right thing to do here. Hmm.
I'm not convinced either - just wanted to raise the issue.
Right. So 'kvm run' is supposed to setup and launch a 'default' rootfs if no rootfs is specified.
Quoted 5 lines
Also, i raised this in the other thread, why not use .kvmtool of the current directory? That way it's cwd local like Git and perf. A 'kvm run' (union?) mount the cwd or so - so this would be a natural equivalent to chroot. The $HOME/.kvmtool is a Qemu-ish global workflow.
Yeah, that definitely makes sense. 'kvm setup rootfs' wouldn't create rootfs under $HOME/.kvmtool/rootfs but under $(PWD)/rootfs.
I guess we'll lose the ability to 'kvm list' all available rootfs directories, though?
Pekka
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
Quoted 12 lines · Pekka Enberg
Quoted 7 lines · Ingo Molnar
Quoted 5 lines
Quoted 1 line
Btw., will 'kvm run' select the last-created rootfs by default?
No, it runs rootfs that's named 'default'. We can change that but I'm not completely convinced running that last-created rootfs is the right thing to do here. Hmm.
I'm not convinced either - just wanted to raise the issue.
Right. So 'kvm run' is supposed to setup and launch a 'default' rootfs if no rootfs is specified.
Quoted 8 lines
Quoted 5 lines
Also, i raised this in the other thread, why not use .kvmtool of the current directory? That way it's cwd local like Git and perf. A 'kvm run' (union?) mount the cwd or so - so this would be a natural equivalent to chroot. The $HOME/.kvmtool is a Qemu-ish global workflow.
Yeah, that definitely makes sense. 'kvm setup rootfs' wouldn't create rootfs under $HOME/.kvmtool/rootfs but under $(PWD)/rootfs.
I also think $(PWD)/rootfs is much better than $HOME/.kvmtool/rootfs. I think 'kvm setup $absolute_rootfs_path' make sense as well.
Quoted 2 lines
I guess we'll lose the ability to 'kvm list' all available rootfs directories, though?
User can create and put the rootfs directories where he/she likes. We do not need to track where the rootfs directories is, thus we do not need to 'kvm list' them.
Signature · 1 line
Asias He
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
Quoted 19 lines · Asias He
Quoted 18 lines · Pekka Enberg
Quoted 7 lines · Ingo Molnar
Quoted 5 lines
Quoted 1 line
Btw., will 'kvm run' select the last-created rootfs by default?
No, it runs rootfs that's named 'default'. We can change that but I'm not completely convinced running that last-created rootfs is the right thing to do here. Hmm.
I'm not convinced either - just wanted to raise the issue.
Right. So 'kvm run' is supposed to setup and launch a 'default' rootfs if no rootfs is specified.
Quoted 5 lines
Also, i raised this in the other thread, why not use .kvmtool of the current directory? That way it's cwd local like Git and perf. A 'kvm run' (union?) mount the cwd or so - so this would be a natural equivalent to chroot. The $HOME/.kvmtool is a Qemu-ish global workflow.
Quoted 6 lines
Quoted 2 lines
Yeah, that definitely makes sense. 'kvm setup rootfs' wouldn't create rootfs under $HOME/.kvmtool/rootfs but under $(PWD)/rootfs.
I also think $(PWD)/rootfs is much better than $HOME/.kvmtool/rootfs. I think 'kvm setup $absolute_rootfs_path' make sense as well.
The nice thing about $CWD and chroot is that it takes the current directly as the 'root directory' of the chroot environment.
The canonical extension of that would be to create .kvmtool/ in $CWD and to union-mount the files in the current directory on top of the .kvmtool 'binary environment' - or such.
Or, an approximation of that would be to simply mount $CWD as /home of the guest environment.
Thus $CWD/.kvmtool/default/ would be the default root fs (multiple instances can be created), and $CWD would be the default /home or /host filesystem.
Quoted 6 lines
Quoted 2 lines
I guess we'll lose the ability to 'kvm list' all available rootfs directories, though?
User can create and put the rootfs directories where he/she likes. We do not need to track where the rootfs directories is, thus we do not need to 'kvm list' them.
listing the current ones in $CWD would still be handy.
*If* users prefer some kind of global workflow then $HOME/.kvmtool can still be special and we can do a 'kvm list --all' kind of thing which would also list $HOME/.kvmtool instances.
Or 'kvm list' could list both $CWD and $HOME instances and would be able to run them. Naming clashes could be handled via some straightforward way, for example by naming the default rootfs in $HOME 'global' - it would be in $HOME/.kvmtool/global. The default one in $CWD would be named 'local' and be in $CWD/.kvmtool/local.
Or so.
Thanks,
Ingo
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
Quoted 3 lines · Ingo Molnar
The canonical extension of that would be to create .kvmtool/ in $CWD and to union-mount the files in the current directory on top of the .kvmtool 'binary environment' - or such.
Union mount is off the table for now because neither overlayfs nor union mounts are in Linus' tree.
Quoted 6 lines
Or, an approximation of that would be to simply mount $CWD as /home of the guest environment.
Thus $CWD/.kvmtool/default/ would be the default root fs (multiple instances can be created), and $CWD would be the default /home or /host filesystem.
I like it!
Should we also introduce KVMTOOLDIR environment variable (much like GIT_DIR) that can override the default $CWD?
Pekka
Re: [PATCH 5/7] kvm tools: Add help and info messages to 'kvm setup'
Quoted 11 lines · Pekka Enberg
Quoted 3 lines · Ingo Molnar
The canonical extension of that would be to create .kvmtool/ in $CWD and to union-mount the files in the current directory on top of the .kvmtool 'binary environment' - or such.
Union mount is off the table for now because neither overlayfs nor union mounts are in Linus' tree.
Quoted 3 lines
Or, an approximation of that would be to simply mount $CWD as /home of the guest environment.
Quoted 8 lines
Quoted 3 lines
Thus $CWD/.kvmtool/default/ would be the default root fs (multiple instances can be created), and $CWD would be the default /home or /host filesystem.
I like it!
Should we also introduce KVMTOOLDIR environment variable (much like
GIT_DIR) that can override the default $CWD?
Per KISS i'd suggest to only implement it on request - but allow an option to point to whatever explicit combination of rootfs and hostfs.
Thanks,
Ingo