<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 03/10/2014 10:48 PM, Aline Manera
      wrote:<br>
    </div>
    <blockquote cite="mid:531DD0D5.1030902@linux.vnet.ibm.com"
      type="cite">On 03/10/2014 10:06 AM, Sheldon wrote:
      <br>
      <blockquote type="cite">On 03/08/2014 02:13 AM, Aline Manera
        wrote:
        <br>
        <blockquote type="cite">
          <br>
          It will not work in most of cases.
          <br>
        </blockquote>
        This patch is to fix #302.
        <br>
        <br>
      </blockquote>
      <br>
      Yeap! And I agree with it.
      <br>
      I am suggesting you to also edit the current network default to an
      unused address - for the nested virtualization case.
      <br>
      <br>
      For example:
      <br>
      <br>
      # check default network exists
      <br>
      try:
      <br>
          net = networkLookupByName(default)
      <br>
      except:
      <br>
          # network default does not exist
      <br>
          &lt;create network default using _get_available_address as you
      did in this patch set&gt;
      <br>
      <br>
      # now we need to make sure the network is active
      <br>
      if net.isActive() == 0:
      <br>
          try:
      <br>
      net.create()
      <br>
          except libvirt.libvirtError, e:
      <br>
              # default network exists but it is using an used address
      <br>
              # libvir: Network Driver error : internal error Network is
      already in use by interface eth0
      <br>
              try:
      <br>
                  &lt;update network address&gt;
      <br>
    </blockquote>
    <br>
    So how about delete this network and recreate it?<br>
    <br>
    Try network update method for IP modify, it can not work.<br>
    This function is not supported by the connection driver<br>
    <br>
    static int<br>
    virNetworkDefUpdateIP(virNetworkDefPtr def,<br>
                          unsigned int command ATTRIBUTE_UNUSED,<br>
                          int parentIndex ATTRIBUTE_UNUSED,<br>
                          xmlXPathContextPtr ctxt ATTRIBUTE_UNUSED,<br>
                          /* virNetworkUpdateFlags */<br>
                          unsigned int fflags ATTRIBUTE_UNUSED)<br>
    {<br>
    <b>    virNetworkDefUpdateNoSupport(def, "ip");</b><br>
        return -1;<br>
    }<br>
    <br>
    <br>
    In [89]: net1.update(libvirt.VIR_NETWORK_UPDATE_COMMAND_MODIFY,<br>
                         libvirt.VIR_NETWORK_SECTION_IP,<br>
                         -1, "&lt;ip address='192.168.44.1' /&gt;",
    flags=0)<br>
    libvirt: Network Driver error : this function is not supported by
    the connection driver: can't update 'ip' section of network
    'test_abc'<br>
---------------------------------------------------------------------------<br>
    libvirtError                              Traceback (most recent
    call last)<br>
    &lt;ipython-input-89-3ba60f76cce4&gt; in &lt;module&gt;()<br>
          1 net1.update(libvirt.VIR_NETWORK_UPDATE_COMMAND_MODIFY,<br>
          2                      libvirt.VIR_NETWORK_SECTION_IP,<br>
    ----&gt; 3                      -1, "&lt;ip address='192.168.44.1'
    /&gt;", flags=0)<br>
    <br>
    /usr/lib64/python2.7/site-packages/libvirt.pyc in update(self,
    command, section, parentIndex, xml, flags)<br>
       2363         running state, its persistent configuration, or
    both. """<br>
       2364         ret = libvirtmod.virNetworkUpdate(self._o, command,
    section, parentIndex, xml, flags)<br>
    -&gt; 2365         if ret == -1: raise libvirtError
    ('virNetworkUpdate() failed', net=self)<br>
       2366         return ret<br>
       2367 <br>
    <br>
    libvirtError: this function is not supported by the connection
    driver: can't update 'ip' section of network 'test_abc'<br>
    <br>
    <blockquote cite="mid:531DD0D5.1030902@linux.vnet.ibm.com"
      type="cite">            &lt;activate network&gt;
      <br>
              except:
      <br>
                  cherrypy.log.error("Fatal: Cannot activate default
      network "
      <br>
                                         "because of %s, exit kimchid" %
      e.message,
      <br>
      severity=logging.ERROR)
      <br>
                  sys.exit(1)
      <br>
      <br>
      What do you think about it?
      <br>
      <br>
      <blockquote type="cite">I just touch the the related code to
        create default network.
        <br>
        I can works in default network missing case.
        <br>
        <br>
        As the code says, if nested kvm does not has default network,
        then kimchi can choose a network address
        <br>
        and create a default network.
        <br>
        If it has, then it will do not create it.
        <br>
        <br>
        I agree, we should not to send patch just for fix issue, we can
        consider more.
        <br>
        actually the Issue #302 is caused by the patch fixing the Issue
        #22 and Issue #56
        <br>
        <br>
        we can list all cases, and let me fixed this time.
        <br>
        <br>
        <blockquote type="cite">
          <br>
          1. The default network and storage pool is usually created by
          libvirt with the default values.
          <br>
          So an kimchi user will face the same issue while running
          kimchi on nested virtualization.
          <br>
          I.e, there is not way to fix it. Just warning the user about
          the problem.
          <br>
          <br>
          2. This issue is in some way related to
          <a class="moz-txt-link-freetext" href="https://github.com/kimchi-project/kimchi/issues/265">https://github.com/kimchi-project/kimchi/issues/265</a>
          <br>
          And why should not the user delete default network/storage
          pool?
          <br>
          This limitation should be impose to user when a
          network/storage pool is used by a template or vm.
          <br>
          Otherwise, the user can remove it.
          <br>
          <br>
          Usually the default network/storage pool is created by
          libvirt.
          <br>
          But some time ago, we identified it did not happen in some
          distros.
          <br>
          And as the Kimchi default configuration for templates is
          pointing to those resources we decided to
          <br>
          create them manually on kimchi code to avoid problems while
          using the templates.
          <br>
          <br>
          So my proposal is: let's revisit all the supported distros and
          check if libvirt creates default
          <br>
          network/storage pool by default, and if so remove this code
          from kimchi.
          <br>
          Then default network/storage pool will have the same behavior
          from other networks/storage pools.
          <br>
          <br>
          <br>
          On 03/07/2014 06:52 AM, <a class="moz-txt-link-abbreviated" href="mailto:shaohef@linux.vnet.ibm.com">shaohef@linux.vnet.ibm.com</a> wrote:
          <br>
          <blockquote type="cite">From: ShaoHe Feng
            <a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
            <br>
            <br>
            let 'create' attr of networks model to create the default
            network
            <br>
            <br>
            ShaoHe Feng (3):
            <br>
            move _default_network_check from top model to networks model
            <br>
            add a new function to get an available network address
            <br>
            Issue #302: let 'create' attr of networks model to create
            default
            <br>
            network
            <br>
            <br>
            src/kimchi/model/model.py | 35
            ---------------------------------
            <br>
            src/kimchi/model/networks.py | 46
            +++++++++++++++++++++++++++++++++++++-------
            <br>
            src/kimchi/network.py | 7 +++++--
            <br>
            3 files changed, 44 insertions(+), 44 deletions(-)
            <br>
            <br>
          </blockquote>
          <br>
          <br>
          <br>
        </blockquote>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Thanks and best regards!

Sheldon Feng(冯少合)<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
IBM Linux Technology Center</pre>
  </body>
</html>