Here are the examples of the python api mcvirt.parser.Parser taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
0
Example 1
def parse_command(self, command, username, password):
"""Parse the specified command with the specified credentials"""
Parser(verbose=False).parse_arguments('%s --username %s --password %s' %
(command, username, password))
0
Example 2
Project: MCVirt Source File: ldap_tests.py
def run_test_command(self, username, password):
"""Run the list command with the provided credentials"""
Parser(verbose=False).parse_arguments('list --username %s --password %s' %
(username, password))
0
Example 3
Project: MCVirt Source File: test_base.py
def setUp(self):
"""Obtain connections to the daemon and create various
member variables.
"""
# Create and store RPC connection to daemon.
self.rpc = Connection(self.RPC_USERNAME, self.RPC_PASSWORD)
# Create and store parser instance
self.parser = Parser(verbose=False)
# Obtain the session ID from the RPC connection and re-use this,
# so that the parser does not need to authenticate with a password
# self.parser.parse_arguments('list --username %s --password %s' % (self.RPC_USERNAME,
# self.RPC_PASSWORD))
self.parser.USERNAME = self.RPC_USERNAME
self.parser.SESSION_ID = self.rpc.session_id
# Setup variable for test VM
self.test_vms = \
{
'TEST_VM_1':
{
'name': 'mcvirt-unittest-vm',
'cpu_count': 1,
'memory_allocation': 100,
'disk_size': [100],
'networks': ['Production']
},
'TEST_VM_2':
{
'name': 'mcvirt-unittest-vm2',
'cpu_count': 2,
'memory_allocation': 120,
'disk_size': [100],
'networks': ['Production']
}
}
# Ensure any test VM is stopped and removed from the machine
self.stop_and_delete(self.test_vms['TEST_VM_2']['name'])
self.stop_and_delete(self.test_vms['TEST_VM_1']['name'])
self.vm_factory = self.rpc.get_connection('virtual_machine_factory')
self.test_network_name = 'testnetwork'
self.test_physical_interface = 'vmbr0'
self.network_factory = self.rpc.get_connection('network_factory')
# Determine if the test network exists. If so, delete it
if self.network_factory.check_exists(self.test_network_name):
network = self.network_factory.get_network_by_name(self.test_network_name)
self.rpc.annotate_object(network)
network.delete()