kimchi-project / kimchi

An HTML5 management interface for KVM guests
https://github.com/kimchi-project/kimchi/releases/latest
Other
3.08k stars 365 forks source link

Should not be allowed to remove "default" storagepool and network #265

Open Truja opened 10 years ago

Truja commented 10 years ago

Currently, it is possible to remove "default storagepool" and "default network".

But, those come back next time Kimchi runs and libvirt gives error like: """ libvir: Network Driver error : Network not found: no network with matching name 'default' """

sming56 commented 10 years ago

I think we should not allow the network or storage to be removed if there is any VM or template depending on it. That is definitely a bug.

lvroyce commented 10 years ago

I think since all our vm depends on default pool and network, we may prefer not to deactive and delete them. I agree with ming that for other pools and networks we need to check the dependency. We had discussed in mailist about introduce a ref count for storage pool. We can get this ref count from querying libvirt and caculating it or by storing it into db. Personally I tend to query with libvirt and caculating ref. Also @shaohef will introduce vms list which are attached to network list.

Truja commented 10 years ago

Yes, I found a lot of dependency problems while testing yesterday. I am going to open bugs or send fixes.

shaohef commented 10 years ago

@Truja db954e9 do not allow the network to be removed if there is any VM or template depending on it. for storagepool another patch will send out later.

cd1 commented 10 years ago

This issue is about not being allowed to remove the storage pool and network named "default", regardless of whether they are being used or not. Is this actually a problem? Are those elements special to Kimchi so we should not allow them do be deleted? If not, we should close this issue.

The patch mentioned above does not allow removing a storage pool or network which is being used by some template/VM, regardless of their names. That fixes a different problem (the one that @sming56 described in his comment), not this one.

shaohef commented 10 years ago

I think we can remove the "default" safely. if no template or vms use it. if user need it, user can create a new "default" network. Actually, if no "default" network, kimchi will create one with a fixed IP address. There may be a conflict is some scenarios. such as in nested KVM This can be fixed by:

  1. delete the "default" network and create a new one at present.
  2. edit the "default" network, if we do not want to remove the "default".
    But 2 is not support at present. so any IP conflict, user can use other tools such as virsh, virt-manager to solve this problem. for other tools can delete the "default" network.

for the default storage pool there is also the similar problem. the pool path is in /var/lib, if its space is not big enough, the user will need to delete and create a new one, or edit this one.

so I prefer we could allow to delete them safely as commit db954e9

@cd1 what about you?

Truja commented 10 years ago

Actually, my point in this bug is: why remove default storagepool and/or default network if they are going to be recreated every time Kimchis restart ?

If you make a test: remove both 'defaults' and then restart Kimchi. They will be there again. So, why remove ? Or, does not recreate them in Kimchi start, or recreate only if no other pool/network exist.

Truja commented 10 years ago

Please, see also the problem in #302

shaohef commented 10 years ago

patch submit to fix #302

For this issue: if all agree that kimchi should not be allowed to remove "default" storagepool and network I will send a patch to fix this one.

sming56 commented 10 years ago

In my opinion, we should have ways to mark all the storagepools and networks created by Kimchi. And only the storagepools and networks created by Kimchi can be removed by Kimchi.

cd1 commented 10 years ago

I don't think so. What if a user migrates to Kimchi? They will not be able to interact with what they have created before, and that does not make sense.

alinefm commented 10 years ago

I made some comments on #302 which applies to this issue too. https://github.com/kimchi-project/kimchi/issues/302#issuecomment-37052576

~~So yes, default network/storage pool can be deleted if any vms or template is associated to them. The problem is kimchi always create those resources on start up.~~ It should be done by libvirt not by kimchi

alinefm commented 10 years ago

I thought more about that and while creating a template user only provides the ISO file and all other configuration is provided by kimchi. Which means we will always set the default network and storage pool for a new template.

So yes, those resources should not be deactivated or removed otherwise we will create inconsistent templates from the scratch

alinefm commented 10 years ago

Network fixed in e6806e4a60c3357765a0f5efac7b2d51d5831ec4