[Libvir] [PATCH][DOC] fix typos
by Atsushi SAKAI
Hi,
Sorry about frequent posting about typos.
commiting => committing
concurently => concurrently
accces => access
capbilities => capabilities
prossible => possible
targetted => targeted
chech => check
overriden => overridden
independant => independent
adminsitrator => administrator
developper's => developer's
priviledges => privileges
emultation => emulation
libbrary => library
availble => available
persitent => persistent
garanteed => guaranteed
lenght => length
lieing => lying
virtsh => virsh
Delibrate => Deliberate
tring => trying
begi => begin
commad => command
noumber => number
cupmap => cpumap
is'nt => isn't
comain => domain
docs/FAQ.html | 2 -
docs/architecture.html | 8 +++----
docs/auth.html | 6 ++---
docs/bugs.html | 2 -
docs/devhelp/libvirt-conf.html | 4 +--
docs/devhelp/libvirt-libvirt.html | 14 ++++++------
docs/downloads.html | 2 -
docs/errors.html | 6 ++---
docs/format.html | 14 ++++++------
docs/html/libvirt-conf.html | 4 +--
docs/html/libvirt-libvirt.html | 14 ++++++------
docs/index.html | 2 -
docs/intro.html | 2 -
docs/libvir.html | 42 +++++++++++++++++++-------------------
docs/libvirt-api.xml | 12 +++++-----
docs/libvirt-refs.xml | 8 +++----
docs/site.xsl | 2 -
proxy/libvirt_proxy.c | 4 +--
src/conf.c | 2 -
src/hash.c | 2 -
src/libvirt.c | 24 ++++++++++-----------
src/proxy_internal.c | 8 +++----
src/remote_internal.c | 2 -
src/virsh.c | 16 +++++++-------
src/xen_internal.c | 2 -
src/xend_internal.c | 8 +++----
src/xml.c | 2 -
27 files changed, 107 insertions(+), 107 deletions(-)
Thanks
Atsushi SAKAI
16 years, 8 months
[Libvir] [PATCH] Add virNodeGetCellsFreeMemory support to test driver
by Cole Robinson
The attached patch adds support for the command virNodeGetCellsFreeMemory
to the test driver. The patch also moves numa cell information into
the connection structure rather than hard coding it in GetCapabilities,
so the memory values have some place to be stored, and so the driver
can be expanded in the future to allow numa info to be specified by a
test driver config file.
Tested this to verify the capabilities xml is generated the same and
that the GetCells command works as expected via the python bindings.
Thanks,
Cole
diff --git a/src/test.c b/src/test.c
index 6cf3fda..135d96f 100644
--- a/src/test.c
+++ b/src/test.c
@@ -106,6 +106,17 @@ typedef struct _testNet *testNetPtr;
#define MAX_DOMAINS 20
#define MAX_NETWORKS 20
+#define MAX_CPUS 128
+
+struct _testCell {
+ unsigned long mem;
+ int numCpus;
+ int cpus[MAX_CPUS];
+};
+typedef struct _testCell testCell;
+typedef struct _testCell *testCellPtr;
+
+#define MAX_CELLS 128
struct _testConn {
char path[PATH_MAX];
@@ -115,6 +126,8 @@ struct _testConn {
testDom domains[MAX_DOMAINS];
int numNetworks;
testNet networks[MAX_NETWORKS];
+ int numCells;
+ testCell cells[MAX_CELLS];
};
typedef struct _testConn testConn;
typedef struct _testConn *testConnPtr;
@@ -638,6 +651,16 @@ static int testOpenDefault(virConnectPtr conn) {
strcpy(privconn->networks[0].dhcpStart, "192.168.122.128");
strcpy(privconn->networks[0].dhcpEnd, "192.168.122.253");
+ // Numa setup
+ privconn->numCells = 2;
+ for (u = 0; u < 2; ++u) {
+ privconn->cells[u].numCpus = 8;
+ privconn->cells[u].mem = (u + 1) * 2048 * 1024;
+ }
+ for (u = 0 ; u < 16 ; u++) {
+ privconn->cells[u % 2].cpus[(u / 2)] = u;
+ }
+
conn->privateData = privconn;
return (VIR_DRV_OPEN_SUCCESS);
}
@@ -711,6 +734,7 @@ static int testOpenFromFile(virConnectPtr conn,
privconn->nextDomID = 1;
privconn->numDomains = 0;
privconn->numNetworks = 0;
+ privconn->numCells = 0;
strncpy(privconn->path, file, PATH_MAX-1);
privconn->path[PATH_MAX-1] = '\0';
memmove(&privconn->nodeInfo, &defaultNodeInfo, sizeof(defaultNodeInfo));
@@ -982,8 +1006,9 @@ static char *testGetCapabilities (virConnectPtr conn)
virCapsPtr caps;
virCapsGuestPtr guest;
char *xml;
- int cell1[] = { 0, 2, 4, 6, 8, 10, 12, 14 };
- int cell2[] = { 1, 3, 5, 7, 9, 11, 13, 15 };
+ int i;
+
+ GET_CONNECTION(conn, -1);
if ((caps = virCapabilitiesNew(TEST_MODEL, 0, 0)) == NULL)
goto no_memory;
@@ -993,10 +1018,11 @@ static char *testGetCapabilities (virConnectPtr conn)
if (virCapabilitiesAddHostFeature(caps ,"nonpae") < 0)
goto no_memory;
- if (virCapabilitiesAddHostNUMACell(caps, 0, 8, cell1) < 0)
- goto no_memory;
- if (virCapabilitiesAddHostNUMACell(caps, 1, 8, cell2) < 0)
- goto no_memory;
+ for (i = 0; i < privconn->numCells; ++i) {
+ if (virCapabilitiesAddHostNUMACell(caps, i, privconn->cells[i].numCpus,
+ privconn->cells[i].cpus) < 0)
+ goto no_memory;
+ }
if ((guest = virCapabilitiesAddGuest(caps,
"linux",
@@ -1576,6 +1602,29 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
return virGetDomain(conn, privconn->domains[handle].name, privconn->domains[handle].uuid);
}
+static int testNodeGetCellsFreeMemory(virConnectPtr conn,
+ unsigned long long *freemems,
+ int startCell, int maxCells) {
+ int i, j;
+
+ GET_CONNECTION(conn, -1);
+
+ if (startCell > privconn->numCells) {
+ testError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
+ _("Range exceeds available cells"));
+ return -1;
+ }
+
+ for (i = startCell, j = 0;
+ (i < privconn->numCells && j < maxCells) ;
+ ++i, ++j) {
+ freemems[j] = privconn->cells[i].mem;
+ }
+
+ return j;
+}
+
+
static int testDomainCreate(virDomainPtr domain) {
GET_DOMAIN(domain, -1);
@@ -2014,7 +2063,7 @@ static virDriver testDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
- NULL, /* nodeGetCellsFreeMemory */
+ testNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
NULL, /* getFreeMemory */
};
16 years, 8 months
[Libvir] bug with vnc port/display#
by Vadim Zaliva
I think I see a bug in libvirt. Here is step-by-step instructions how
to reproduce:
1. Create domain from XML (note vnc port):
<domain type="xen">
<name>lvnc</name>
<os>
<type>linux</type>
<kernel>/boot/vmlinuz-2.6.15-1.43_FC5guest</kernel>
<initrd>/boot/initrd-2.6.15-1.43_FC5guest.img</initrd>
<root>/dev/sda1</root>
<cmdline> ro selinux=0 3</cmdline>
</os>
<memory>10</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<graphics type="vnc" port="5905"/>
</devices>
</domain>
2. Examine s-expr definition:
sudo /usr/sbin/xm list -l lvnc
(domain
(on_crash restart)
(uuid 5c56456a-1f19-d996-35e3-f5e514b79601)
(bootloader_args )
(vcpus 1)
(name lvnc)
(on_poweroff destroy)
(on_reboot restart)
(bootloader )
(maxmem 128)
(memory 128)
(shadow_memory 0)
(features )
(on_xend_start ignore)
(on_xend_stop ignore)
(image
(linux
(kernel /boot/vmlinuz-2.6.15-1.43_FC5guest)
(ramdisk /boot/initrd-2.6.15-1.43_FC5guest.img)
(args 'root=/dev/sda1 ro selinux=0 3')
(device_model /usr/lib/xen/bin/qemu-dm)
)
)
(status 0)
(device (vkbd (uuid c1ea89ea-903c-ba5b-603d-7b5c7bc25654)))
(device
(vfb
(type vnc)
(vncdisplay 5)
(uuid bc92b909-8ca3-eece-8ef5-7551eaccda6e)
)
)
)
So far, so good: vncdisplay 5
3. dumpxml lvnc
<domain type='xen' id='-1'>
<name>lvnc</name>
<uuid>5c56456a-1f19-d996-35e3-f5e514b79601</uuid>
<bootloader/>
<os>
<type>linux</type>
<kernel>/boot/vmlinuz-2.6.15-1.43_FC5guest</kernel>
<initrd>/boot/initrd-2.6.15-1.43_FC5guest.img</initrd>
<cmdline>root=/dev/sda1 ro selinux=0 3</cmdline>
</os>
<memory>131072</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1'/>
</devices>
</domain>
As you can see, port is now -1 instead of expected 5905.
Looks like the problem around 'vncunused' variable handling in
xml_internal.c. (I
think it should be assigned 0 not 1 by default and if 'vncunused'
config keyword
is not found. I tried to fix it myself, but without much luck so far.
By the way, what would be a good way to do logging in libvirt code?
Sincerely,
Vadim
--
"La perfection est atteinte non quand il ne reste rien a ajouter, mais
quand il ne reste rien a enlever." (Antoine de Saint-Exupery)
16 years, 8 months
[Libvir] Proposal for dealing with host devices
by Daniel P. Berrange
The following document illustrates an API for host device enumeration,
creation and deletion. This has a number of use cases:
- PCI passthrough. Need to enumerate PCI devices, get their domain,
bus, slot, function IDs to be able to pass-though to a guest.
Need to disable the host kernel driver. Need to get metadata about
the device to present to the user, eg model / vendor.
- USB passthrough. Need to enumerate USB devices, get their bus, device
IDs to be able to pass-though to a guest. Need to disable the host
kernel driver. Need to get metadata about the device to present to
the user, eg model / vendor.
- Fibre Channel. Need to enumerate SCSI HBAs with FC capability and
get their WWNN and WWPN (World Wide Node/Port Name) to enable the
administrator to associate with the SAN.
This relates to the SCSI storage pool impl I posted last week
- NPIV. Need to create/delete NPIV virtual Fibre Channel adapters.
This relates to the SCSI storage pool impl I posted last week
- Networking. Need to enumerate NICs, bridges, VLANs, bonding.
This all sounds like alot of data / stuff to manage, but the good news
is that there is already an application which does most of this for
us. ie HAL. So at the basic level all we need to do is map the HAL
properties into a libvirt XML format for describing devices.
I have chosen to define a very direct mapping.
- At the top level, "<device>" element
- A short 'name' and longer 'key' both unique to host
The key is the HAL 'udi' value
- A 'parent' key to show nesting of devices.
- Optional 'bus' information inside a <bus> element
Bus names will map straight into HAL bus names.
The content is bus specific
- Optional 'capability' information inside one or more
<capability> elements. NB a single device can provide
several capabilites. Capability names will map straight
onto HAL capability names. The content is capability
specific.
- Capabilities can be nested for specialization. eg a
'net' capability can have a '80211' sub-capability
if it is a wifi device.
Now some example XML descriptions....
An arbitrary PCI device
<device>
<name>pci_8086_27c5</name>
<key>/org/freedesktop/Hal/devices/pci_8086_27c5</key>
<parent>/org/freedesktop/Hal/devices/computer</parent>
<bus type="pci">
<vendor id="32902">Intel Corporation</vendor>
<product id="10202">82801G (ICH7 Family) SMBus Controller</product>
<address domain="0000" bus="00" slot="1f" function="3"/>
</bus>
</device>
An arbitrary USB device
<device>
<name>usb_device_483_2016_noserial</name>
<key>/org/freedesktop/Hal/devices/usb_device_483_2016_noserial</key>
<parent>/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_3</parent>
<bus type="usb">
<vendor id="1155">SGS Thomson Microelectronics</vendor>
<product id="8214">Fingerprint Reader</product>
<address bus="003" dev="005"/>
</bus>
</device>
A SCSI HBA
<device>
<name>pci_8086_27df_scsi_host</name>
<key>/org/freedesktop/Hal/devices/pci_8086_27df_scsi_host</key>
<parent>/org/freedesktop/Hal/devices/pci_8086_27df</parent>
<capability type="scsihost">
<capability type="fc">
<address wwnn="023432532532632" wwpn="32453253252352"/>
<vports max="4"/>
</capability>
</capability>
</device>
As an example, consider a wireless NIC
<device>
<name>net_00_13_02_b9_f9_d3_0</name>
<key>/org/freedesktop/Hal/devices/net_00_13_02_b9_f9_d3_0</key>
<parent>/org/freedesktop/Hal/devices/pci_8086_4227</parent>
<capability type="net">
<hwaddr>00:13:02:b9:f9:d3</hwaddr>
<name>eth0</name>
<capability type="80211"/>
</capability>
</device>
Notice how the specific functional devices like NICs, HBAs, are
children of the physical USB or PCI device. This is where the
hierarchy comes in.
There are a few other types of devices we want explicit representations
for, block devices, sound devices, storage devices, input devices. I
want describe them here, but they follow same pattern of mapping the
XML onto the HAL properties in their <capability> tags.
There are some devices HAL does not represent so we'll have to augment
the HAL information. Specifically devices which don't correspond to
a physical device, eg
- Bonding NICs
- Bridges
- VLANs
There are also cases where HAL does not have enough properties so we
again need to augment the data
- Fibre Channel / NPIV: Add WWPN, WWNN
The API to deal with this is really very simple. APIs to query all
devices, or query devices based on a capability, or bus type:
int
virNodeNumOfDevices(virConnectPtr conn)
int
virNodeListDevices(virConnectPtr conn,
char **const names,
int maxnames)
int
virNodeNumOfDevicesByCap(virConnectPtr conn,
const char *cap)
int
virNodeListDevicesByCap(virConnectPtr conn,
const char *cap,
char **const names,
int maxnames)
int
virNodeNumOfDevicesByBus(virConnectPtr conn,
const char *bus)
int
virNodeListDevicesByBus(virConnectPtr conn,
const char *bus,
char **const names,
int maxnames)
Then APIs to obtain a virNodeDevicePtr object corresponding to a
device name / key :
virNodeDevicePtr
virNodeDeviceLookupByName(virConnectPtr conn, const char *name)
virNodeDevicePtr
virNodeDeviceLookupByName(virConnectPtr conn, const char *key)
int
virNodeDeviceFree(virNodeDevicePtr dev)
An API to get the XML description:
char *
virNodeDeviceDumpXML(virConnectPtr conn,
unsigned int flags)
Finally an API to create / delete devices - this is only for devices
with certain capabilities
virNodeDevicePtr
virNodeDeviceCreate(virConnectPtr conn,
const char *xml)
int
virNodeDeviceDestroy(virNodeDevicePtr dev)
BTW if you want to see all the HAL metadata on your machine run
lshal
I don't propose to expose all the data - only specific properties we have
immediate need for. The HAL spec describes the meaning of various props
http://people.freedesktop.org/~david/hal-spec/hal-spec.html
Dan.
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years, 8 months
[Libvir] Problem in Migrating domain....
by manon.mani@wipro.com
Hi...
This is my program for Domain Migrating using virDomainMigrate() Function....
#include <stdlib.h>
#include <stdio.h>
#include <libvirt/libvirt.h>
static virConnectPtr conn = NULL; /* the hypervisor connection */
static int
checkDomainState(virDomainPtr dom)
{
virDomainInfo info; /* the information being fetched */
int ret;
ret = virDomainGetInfo(dom, &info);
if (ret < 0)
{
return(-1);
}
return(info.state);
}
static void
migrate(int id)
{
virDomainPtr dom = NULL; /* the domain being checked */
virDomainPtr dom1= NULL;
int ret, state;
/* Find the domain of the given id */
dom = virDomainLookupByID(conn, id);
if (dom == NULL)
{
fprintf(stderr, "Failed to find Domain %d\n", id);
goto error;
}
state = checkDomainState(dom);
if ((state == VIR_DOMAIN_RUNNING))
{
dom1=virDomainMigrate(dom,conn,VIR_MIGRATE_LIVE,NULL,NULL,0);
if(dom1==NULL)
{
fprintf(stderr,"Failed to migrate");
}
else
{
fprintf(stderr,"migrate successfully");
}
}
error:
if (dom != NULL)
virDomainFree(dom);
}
int main(int argc, char **argv) {
int id = 0;
/* NULL means connect to local Xen hypervisor */
conn = virConnectOpen(NULL);
if (conn == NULL) {
fprintf(stderr, "Failed to connect to hypervisor\n");
goto error;
}
if (argc > 1) {
id = atoi(argv[1]);
}
if (id == 0) {
int i, j, ids[10];
i = virConnectListDomains(conn, &ids[0], 10);
if (i < 0) {
fprintf(stderr, "Failed to list the domains\n");
goto error;
}
for (j = 0;j < i;j++) {
if (ids[j] != 0) {
id = ids[j];
break;
}
}
}
if (id == 0) {
fprintf(stderr, "Failed find a running guest domain\n");
goto error;
}
migrate(id);
error:
if (conn != NULL)
virConnectClose(conn);
return(0);
}
When I Compile this by the command
gcc `pkg-config --cflags --libs libvirt` migrate1.c
I got the error...
migrate1.c: In function migrate:
migrate1.c:67: warning: assignment makes pointer from integer without a cast
/tmp/ccmgmkE1.o: In function `migrate':
migrate1.c:(.text+0xd4): undefined reference to `virDomainMigrate'
collect2: ld returned 1 exit status
Can you help me...
with regard,
Mano
16 years, 8 months
[Libvir] FW: Problem in Migrating domain....
by manon.mani@wipro.com
Hi to all...
I was Installed xen and installing Virtual OS...
And I Migrate it Mannually...
Its Getting Migrated...
I want to Write the coding for Automated Migration
using the API virDomaiMigrate...
Anybody guide me to write the coding...
Thanks in advance...
With Regards,
Mano
16 years, 8 months
[Libvir] uuid of newly created domain
by Vadim Zaliva
Hi!
I am running into interesting problem with UUID. I am using Ruby
bindings, but I think the
problem is not specific to Ruby. I am doing roughly the following:
dom = c.define_domain_xml(xml)
dom1 = c.ookup_domain_by_uuid(dom.uuid)
and I got an error that domain with given UUID is not found.
If I print UUID of newly defined domain and compare it with output
of 'dominfo' command in virsh I can see that it differs.
Could anybody shed some light on why UUID returned by
define_domain_xml()
is invalid?
Sincerely,
Vadim
--
"La perfection est atteinte non quand il ne reste rien a ajouter, mais
quand il ne reste rien a enlever." (Antoine de Saint-Exupery)
16 years, 8 months
[Libvir] [PATCH] [RUBY-LIBVIRT]: Make the flags parameter optional
by Chris Lalancette
All,
While using the ruby-libvirt bindings, I usually end up setting the "flags"
parameter to various calls to 0. While this is required by the C side of
things, for Ruby we have no such constraint; we can have methods with optional
arguments. Since most of the time we will be passing "flags" as 0, we will just
assume 0 if it isn't specified, and actually use the value in flags if it is.
The attached patch does just that. Note that I've only tested about half of the
calls in here; further breakage should be easy to find and fix. Also note that
this should not impact existing users, since we will honor the flags they are
already passing.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 8 months
[Libvir] patch: Domain.free() in Ruby bindings
by Vadim Zaliva
Attached patch adds new method free() to Domain class. Invocation of
this method
calls virDomainFree(). After this call, all other calls to this domain
object would
fail.
The purpose of this patch is to solve problem caused by libvirt
caching, when creation
of new domain from XML is re-using previous definition with the same
name, if domain
object associated with older definition have not been yet freed by
Ruby garbage collector
(see previous discussion in this mailing list for details).
Sincerely,
Vadim Zaliva
P.S. I think Python bindings will need similar method as well.
P.P.S. I have tested this patch, and I can see that it solves the
problem I was facing.
16 years, 8 months