[PATCH] move VIRT_DEV_foo types to CIM_RES_TYPE_foo
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1205154179 -3600
# Node ID 581efd4f29eb6a9aa321cf54dbcf6f35f59055f9
# Parent 1aaf26015bb83a1b2433073c2ec5886cf828d9e6
move VIRT_DEV_foo types to CIM_RES_TYPE_foo
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Mon Mar 10 13:09:14 2008 +0100
+++ b/libxkutil/device_parsing.c Mon Mar 10 14:02:59 2008 +0100
@@ -81,13 +81,13 @@ void cleanup_virt_device(struct virt_dev
if (dev == NULL)
return; /* free()-like semantics */
- if (dev->type == VIRT_DEV_DISK)
+ if (dev->type == CIM_RES_TYPE_DISK)
cleanup_disk_device(&dev->dev.disk);
- else if (dev->type == VIRT_DEV_NET)
+ else if (dev->type == CIM_RES_TYPE_NET)
cleanup_net_device(&dev->dev.net);
- else if (dev->type == VIRT_DEV_EMU)
+ else if (dev->type == CIM_RES_TYPE_EMU)
cleanup_emu_device(&dev->dev.emu);
- else if (dev->type == VIRT_DEV_GRAPHICS)
+ else if (dev->type == CIM_RES_TYPE_GRAPHICS)
cleanup_graphics_device(&dev->dev.graphics);
free(dev->id);
@@ -181,7 +181,7 @@ static int parse_disk_device(xmlNode *dn
if ((ddev->source == NULL) || (ddev->virtual_dev == NULL))
goto err;
- vdev->type = VIRT_DEV_DISK;
+ vdev->type = CIM_RES_TYPE_DISK;
vdev->id = strdup(ddev->virtual_dev);
*vdevs = vdev;
@@ -248,7 +248,7 @@ static int parse_net_device(xmlNode *ino
}
}
- vdev->type = VIRT_DEV_NET;
+ vdev->type = CIM_RES_TYPE_NET;
vdev->id = strdup(ndev->mac);
*vdevs = vdev;
@@ -286,7 +286,7 @@ static int parse_vcpu_device(xmlNode *no
cdev->number = i;
- vdev->type = VIRT_DEV_VCPU;
+ vdev->type = CIM_RES_TYPE_PROC;
if (asprintf(&vdev->id, "%i", i) == -1)
vdev->id = NULL;
}
@@ -315,7 +315,7 @@ static int parse_emu_device(xmlNode *nod
if (edev->path != NULL)
goto err;
- vdev->type = VIRT_DEV_EMU;
+ vdev->type = CIM_RES_TYPE_EMU;
*vdevs = vdev;
@@ -376,7 +376,7 @@ static int parse_graphics_device(xmlNode
if ((gdev->type == NULL) || (gdev->port == NULL))
goto err;
- vdev->type = VIRT_DEV_GRAPHICS;
+ vdev->type = CIM_RES_TYPE_GRAPHICS;
*vdevs = vdev;
@@ -411,17 +411,17 @@ static int do_parse(xmlNodeSet *nsv, int
int (*do_real_parse)(xmlNode *, struct virt_device **) = NULL;
/* point to correct parser function according to type */
- if (type == VIRT_DEV_NET)
+ if (type == CIM_RES_TYPE_NET)
do_real_parse = &parse_net_device;
- else if (type == VIRT_DEV_DISK)
+ else if (type == CIM_RES_TYPE_DISK)
do_real_parse = &parse_disk_device;
- else if (type == VIRT_DEV_VCPU)
+ else if (type == CIM_RES_TYPE_PROC)
do_real_parse = parse_vcpu_device;
- else if (type == VIRT_DEV_EMU)
+ else if (type == CIM_RES_TYPE_EMU)
do_real_parse = parse_emu_device;
- else if (type == VIRT_DEV_MEM)
+ else if (type == CIM_RES_TYPE_MEM)
do_real_parse = parse_mem_device;
- else if (type == VIRT_DEV_GRAPHICS)
+ else if (type == CIM_RES_TYPE_GRAPHICS)
do_real_parse = parse_graphics_device;
else
goto out;
@@ -479,17 +479,17 @@ static int parse_devices(const char *xml
xmlXPathObject *xpathObj;
xmlChar *xpathstr;
- if (type == VIRT_DEV_NET)
+ if (type == CIM_RES_TYPE_NET)
xpathstr = NET_XPATH;
- else if (type == VIRT_DEV_DISK)
+ else if (type == CIM_RES_TYPE_DISK)
xpathstr = DISK_XPATH;
- else if (type == VIRT_DEV_VCPU)
+ else if (type == CIM_RES_TYPE_PROC)
xpathstr = VCPU_XPATH;
- else if (type == VIRT_DEV_EMU)
+ else if (type == CIM_RES_TYPE_EMU)
xpathstr = EMU_XPATH;
- else if (type == VIRT_DEV_MEM)
+ else if (type == CIM_RES_TYPE_MEM)
xpathstr = MEM_XPATH;
- else if (type == VIRT_DEV_GRAPHICS)
+ else if (type == CIM_RES_TYPE_GRAPHICS)
xpathstr = GRAPHICS_XPATH;
else
goto err1;
@@ -535,24 +535,24 @@ struct virt_device *virt_device_dup(stru
dev->type = _dev->type;
dev->id = strdup(_dev->id);
- if (dev->type == VIRT_DEV_NET) {
+ if (dev->type == CIM_RES_TYPE_NET) {
DUP_FIELD(dev, _dev, dev.net.mac);
DUP_FIELD(dev, _dev, dev.net.type);
DUP_FIELD(dev, _dev, dev.net.source);
- } else if (dev->type == VIRT_DEV_DISK) {
+ } else if (dev->type == CIM_RES_TYPE_DISK) {
DUP_FIELD(dev, _dev, dev.disk.type);
DUP_FIELD(dev, _dev, dev.disk.device);
DUP_FIELD(dev, _dev, dev.disk.driver);
DUP_FIELD(dev, _dev, dev.disk.source);
DUP_FIELD(dev, _dev, dev.disk.virtual_dev);
- } else if (dev->type == VIRT_DEV_MEM) {
+ } else if (dev->type == CIM_RES_TYPE_MEM) {
dev->dev.mem.size = _dev->dev.mem.size;
dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
- } else if (dev->type == VIRT_DEV_VCPU) {
+ } else if (dev->type == CIM_RES_TYPE_PROC) {
dev->dev.vcpu.number = _dev->dev.vcpu.number;
- } else if (dev->type == VIRT_DEV_EMU) {
+ } else if (dev->type == CIM_RES_TYPE_EMU) {
DUP_FIELD(dev, _dev, dev.emu.path);
- } else if (dev->type == VIRT_DEV_GRAPHICS) {
+ } else if (dev->type == CIM_RES_TYPE_GRAPHICS) {
DUP_FIELD(dev, _dev, dev.graphics.type);
DUP_FIELD(dev, _dev, dev.graphics.port);
}
@@ -566,7 +566,7 @@ static int _get_mem_device(const char *x
struct virt_device *mdev = NULL;
int ret;
- ret = parse_devices(xml, &mdevs, VIRT_DEV_MEM);
+ ret = parse_devices(xml, &mdevs, CIM_RES_TYPE_MEM);
if (ret <= 0)
return ret;
@@ -592,7 +592,7 @@ static int _get_mem_device(const char *x
mdev->dev.mem.maxsize = mdev->dev.mem.size;
}
- mdev->type = VIRT_DEV_MEM;
+ mdev->type = CIM_RES_TYPE_MEM;
mdev->id = strdup("mem");
*list = mdev;
@@ -610,7 +610,7 @@ int get_devices(virDomainPtr dom, struct
if (xml == NULL)
return 0;
- if (type == VIRT_DEV_MEM)
+ if (type == CIM_RES_TYPE_MEM)
ret = _get_mem_device(xml, list);
else
ret = parse_devices(xml, list, type);
@@ -775,19 +775,19 @@ int get_dominfo_from_xml(const char *xml
if (ret == 0)
goto err;
- parse_devices(xml, &(*dominfo)->dev_emu, VIRT_DEV_EMU);
- parse_devices(xml, &(*dominfo)->dev_graphics, VIRT_DEV_GRAPHICS);
+ parse_devices(xml, &(*dominfo)->dev_emu, CIM_RES_TYPE_EMU);
+ parse_devices(xml, &(*dominfo)->dev_graphics, CIM_RES_TYPE_GRAPHICS);
(*dominfo)->dev_mem_ct = _get_mem_device(xml, &(*dominfo)->dev_mem);
(*dominfo)->dev_net_ct = parse_devices(xml,
&(*dominfo)->dev_net,
- VIRT_DEV_NET);
+ CIM_RES_TYPE_NET);
(*dominfo)->dev_disk_ct = parse_devices(xml,
&(*dominfo)->dev_disk,
- VIRT_DEV_DISK);
+ CIM_RES_TYPE_DISK);
(*dominfo)->dev_vcpu_ct = parse_devices(xml,
&(*dominfo)->dev_vcpu,
- VIRT_DEV_VCPU);
+ CIM_RES_TYPE_PROC);
return ret;
@@ -933,10 +933,10 @@ static int change_vcpus(virDomainPtr dom
int attach_device(virDomainPtr dom, struct virt_device *dev)
{
- if ((dev->type == VIRT_DEV_NET) ||
- (dev->type == VIRT_DEV_DISK))
+ if ((dev->type == CIM_RES_TYPE_NET) ||
+ (dev->type == CIM_RES_TYPE_DISK))
return _change_device(dom, dev, true);
- else if (dev->type == VIRT_DEV_VCPU)
+ else if (dev->type == CIM_RES_TYPE_PROC)
return change_vcpus(dom, 1);
CU_DEBUG("Unhandled device type %i", dev->type);
@@ -946,10 +946,10 @@ int attach_device(virDomainPtr dom, stru
int detach_device(virDomainPtr dom, struct virt_device *dev)
{
- if ((dev->type == VIRT_DEV_NET) ||
- (dev->type == VIRT_DEV_DISK))
+ if ((dev->type == CIM_RES_TYPE_NET) ||
+ (dev->type == CIM_RES_TYPE_DISK))
return _change_device(dom, dev, false);
- else if (dev->type == VIRT_DEV_VCPU)
+ else if (dev->type == CIM_RES_TYPE_PROC)
return change_vcpus(dom, -1);
CU_DEBUG("Unhandled device type %i", dev->type);
@@ -959,7 +959,7 @@ int detach_device(virDomainPtr dom, stru
int change_device(virDomainPtr dom, struct virt_device *dev)
{
- if (dev->type == VIRT_DEV_MEM)
+ if (dev->type == CIM_RES_TYPE_MEM)
return change_memory(dom, dev);
CU_DEBUG("Unhandled device type %i", dev->type);
diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Mon Mar 10 13:09:14 2008 +0100
+++ b/libxkutil/device_parsing.h Mon Mar 10 14:02:59 2008 +0100
@@ -63,15 +63,7 @@ struct graphics_device {
};
struct virt_device {
- enum {
- VIRT_DEV_NET = CIM_RES_TYPE_NET,
- VIRT_DEV_DISK = CIM_RES_TYPE_DISK,
- VIRT_DEV_MEM = CIM_RES_TYPE_MEM,
- VIRT_DEV_VCPU = CIM_RES_TYPE_PROC,
- VIRT_DEV_UNKNOWN = CIM_RES_TYPE_UNKNOWN,
- VIRT_DEV_EMU,
- VIRT_DEV_GRAPHICS,
- } type;
+ uint16_t type;
union {
struct disk_device disk;
struct net_device net;
diff -r 1aaf26015bb8 -r 581efd4f29eb libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Mon Mar 10 13:09:14 2008 +0100
+++ b/libxkutil/xmlgen.c Mon Mar 10 14:02:59 2008 +0100
@@ -322,10 +322,10 @@ static bool concat_devxml(char **xml,
int i;
for (i = 0; i < count; i++) {
- /* Deleted devices are marked as VIRT_DEV_UNKNOWN
+ /* Deleted devices are marked as CIM_RES_TYPE_UNKNOWN
* and should be skipped
*/
- if (list[i].type != VIRT_DEV_UNKNOWN)
+ if (list[i].type != CIM_RES_TYPE_UNKNOWN)
func(&_xml, &list[i]);
}
@@ -342,22 +342,22 @@ char *device_to_xml(struct virt_device *
bool (*func)(char **, struct virt_device *);
switch (type) {
- case VIRT_DEV_DISK:
+ case CIM_RES_TYPE_DISK:
func = disk_to_xml;
break;
- case VIRT_DEV_VCPU:
+ case CIM_RES_TYPE_PROC:
func = vcpu_to_xml;
break;
- case VIRT_DEV_NET:
+ case CIM_RES_TYPE_NET:
func = net_to_xml;
break;
- case VIRT_DEV_MEM:
+ case CIM_RES_TYPE_MEM:
func = mem_to_xml;
break;
- case VIRT_DEV_EMU:
+ case CIM_RES_TYPE_EMU:
func = emu_to_xml;
break;
- case VIRT_DEV_GRAPHICS:
+ case CIM_RES_TYPE_GRAPHICS:
func = graphics_to_xml;
break;
default:
diff -r 1aaf26015bb8 -r 581efd4f29eb src/svpc_types.h
--- a/src/svpc_types.h Mon Mar 10 13:09:14 2008 +0100
+++ b/src/svpc_types.h Mon Mar 10 14:02:59 2008 +0100
@@ -27,6 +27,8 @@
#define CIM_RES_TYPE_MEM 4
#define CIM_RES_TYPE_NET 10
#define CIM_RES_TYPE_DISK 17
+#define CIM_RES_TYPE_EMU 1
+#define CIM_RES_TYPE_GRAPHICS 24
#define CIM_RES_TYPE_UNKNOWN 1000
#define CIM_VSSD_RECOVERY_NONE 2
16 years, 8 months
[PATCH] Fix a bug in MSD schema
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1204932278 28800
# Node ID e7c2e8fca9d4dac6477e1c3aafc36bd68e7fca1f
# Parent 79a937040287f70b36e35e2a0c397894d6473ac5
Fix a bug in MSD schema.
The last patach for the VSMigrationSettingData introduced a bug. Pegasus failed to clean up my repository properly when the previous patchset was tested.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 79a937040287 -r e7c2e8fca9d4 schema/VSMigrationSettingData.mof
--- a/schema/VSMigrationSettingData.mof Fri Mar 07 14:57:35 2008 -0800
+++ b/schema/VSMigrationSettingData.mof Fri Mar 07 15:24:38 2008 -0800
@@ -8,16 +8,14 @@ class CIM_VirtualSystemMigrationSettingD
[Provider("cmpi::Virt_VSMigrationSettingData")]
class Xen_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData {
- [ Description(
- ValueMap {"0","1","2","3","4","5","6"},
- Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }]
+ [ ValueMap {"0","1","2","3","4","5","6"},
+ Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }]
uint16 TransportType;
};
[Provider("cmpi::Virt_VSMigrationSettingData")]
class KVM_VirtualSystemMigrationSettingData : CIM_VirtualSystemMigrationSettingData {
- [ Description(
- ValueMap {"0","1","2","3","4","5","6"},
- Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }]
+ [ ValueMap {"0","1","2","3","4","5","6"},
+ Values { "Unknown", "Other", "SSH", "TLS", "TLS Strict", "TCP", "UNIX" }]
uint16 TransportType;
};
16 years, 8 months
[PATCH 0 of 3] #3 - Renamed device function for constistency with other providers
by Heidi Eckhart
Renamed the device_type_by_classname() to res_type_by_device_classname() for consistency with other interfaces.
Diff to patch set 1:
- moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set
Diff to patch set 2:
- Device patch was rejected because of patch set "#4 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP"
16 years, 8 months
[PATCH 0 of 3] #4 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP
by Heidi Eckhart
This patch set implements the configurable enum_devices() interface to the Device provider. This slight interface change is adopted to the associations SystemDevice and ElementAllocatedFromPool. Both associations profit from the easy access to the device instances.
Diff to patch set 1:
- fixed style issues
Diff to patch set 2:
- moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set
Diff to patch set 3:
- fixed style issue
- removed unneccsary check with the potential to leak memory
16 years, 8 months
[PATCH 0 of 4] #2 Add transport support to VSMigrationService.
by Kaitlin Rupert
libvirt also allows extra parameters for some of these transport types, but this just providers the basic support.
Updates from set 1 to set 2:
-See patch Extend the VirtualSystemMigrationSettingData to include an attribute for transport method)
-See patch Add URI support to VSMigrationService
16 years, 8 months