Cannot create a non vm network using ovirtsdk

This is a multi-part message in MIME format. --------------959D32FB75F08ADEEDA5B907 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, I am trying to create a non vm network using the following code, but it still go a head and creates vm network. Can some one please help me to resolve this? Or can you let me know in case i am missing some parameter to add here? def create_gluster_network(network_name): networks_service = connection.system_service().networks_service() network = networks_service.add(types.Network(name=network_name,data_center=types.DataCenter(name='Default'),description='new gluster network' )) Thanks kasturi --------------959D32FB75F08ADEEDA5B907 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>Hi,</p> <p> I am trying to create a non vm network using the following code, but it still go a head and creates vm network. Can some one please help me to resolve this? Or can you let me know in case i am missing some parameter to add here?</p> <p> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </p> <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:13.5pt;"><span style="color:#000080;font-weight:bold;">def </span>create_gluster_network(network_name): networks_service = connection.system_service().networks_service() <span style="color:#808080;">network </span>= networks_service.add(types.<span style="background-color:#e4e4ff;">Network</span>(<span style="color:#660099;">name</span>=network_name, <span style="color:#660099;">data_center</span>=types.DataCenter(<span style="color:#660099;">name</span>=<span style="color:#008000;font-weight:bold;">'Default'</span>), <span style="color:#660099;">description</span>=<span style="color:#008000;font-weight:bold;">'new gluster network' </span><span style="color:#008000;font-weight:bold;"> </span>)) Thanks kasturi </pre> </body> </html> --------------959D32FB75F08ADEEDA5B907--

Hi, the VM network network is the default one, so in order to create different network type you have to pass what you need explicitly, for example: network = networks_service.add( types.Network( name='mynetwork', data_center=types.DataCenter( name='mydatacenter' ), usages=[ types.NetworkUsage.MANAGEMENT, ], ), ) Will create management network. Other options are: DISPLAY, MIGRATION, VM So just past explicitly what you need. Ondra On 09/22/2016 03:15 PM, knarra wrote:
Hi,
I am trying to create a non vm network using the following code, but it still go a head and creates vm network. Can some one please help me to resolve this? Or can you let me know in case i am missing some parameter to add here?
def create_gluster_network(network_name): networks_service = connection.system_service().networks_service() network = networks_service.add(types.Network(name=network_name, data_center=types.DataCenter(name='Default'), description='new gluster network' ))
Thanks kasturi

This is a multi-part message in MIME format. --------------F407D343FDBCA771CA158CA1 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Hi, Thanks ondra. It works . When i specify the "usages=types.NetworkUsage.Migration" it was throwing me an error. I was missing [] braces. Thanks kasturi. On 09/22/2016 06:45 PM, knarra wrote:
Hi,
I am trying to create a non vm network using the following code, but it still go a head and creates vm network. Can some one please help me to resolve this? Or can you let me know in case i am missing some parameter to add here?
def create_gluster_network(network_name): networks_service = connection.system_service().networks_service() network = networks_service.add(types.Network(name=network_name,data_center=types.DataCenter(name='Default'),description='new gluster network' ))
Thanks kasturi
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
--------------F407D343FDBCA771CA158CA1 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit <html> <head> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix">Hi,<br> Thanks ondra. It works . When i specify the "usages=types.NetworkUsage.Migration" it was throwing me an error. I was missing [] braces.<br> <br> Thanks<br> kasturi.<br> On 09/22/2016 06:45 PM, knarra wrote:<br> </div> <blockquote cite="mid:b58ac583-9f1d-f21e-74f5-1307872d3092@redhat.com" type="cite"> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <p>Hi,</p> <p> I am trying to create a non vm network using the following code, but it still go a head and creates vm network. Can some one please help me to resolve this? Or can you let me know in case i am missing some parameter to add here?</p> <p> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> </p> <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:13.5pt;"><span style="color:#000080;font-weight:bold;">def </span>create_gluster_network(network_name): networks_service = connection.system_service().networks_service() <span style="color:#808080;">network </span>= networks_service.add(types.<span style="background-color:#e4e4ff;">Network</span>(<span style="color:#660099;">name</span>=network_name, <span style="color:#660099;">data_center</span>=types.DataCenter(<span style="color:#660099;">name</span>=<span style="color:#008000;font-weight:bold;">'Default'</span>), <span style="color:#660099;">description</span>=<span style="color:#008000;font-weight:bold;">'new gluster network' </span><span style="color:#008000;font-weight:bold;"> </span>)) Thanks kasturi </pre> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ Users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Users@ovirt.org">Users@ovirt.org</a> <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a> </pre> </blockquote> <p><br> </p> </body> </html> --------------F407D343FDBCA771CA158CA1--
participants (2)
-
knarra
-
Ondra Machacek