Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54711 - /trunk/storage/libstorage/src/Graph.cc
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Fri, 16 Jan 2009 15:11:17 -0000
  • Message-id: <E1LNqLt-0000ef-2t@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Fri Jan 16 16:11:16 2009
New Revision: 54711

URL: http://svn.opensuse.org/viewcvs/yast?rev=54711&view=rev
Log:
- extended generated graph

Modified:
trunk/storage/libstorage/src/Graph.cc

Modified: trunk/storage/libstorage/src/Graph.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Graph.cc?rev=54711&r1=54710&r2=54711&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Graph.cc (original)
+++ trunk/storage/libstorage/src/Graph.cc Fri Jan 16 16:11:16 2009
@@ -15,13 +15,17 @@

namespace storage
{
+ enum Rank { RANK_DISK, RANK_PARTITION, RANK_LVMVG, RANK_LVMLV,
+ RANK_MOUNTPOINT, RANK_NONE };
+
struct Node
{
- Node(const string& id, const string& label)
- : id(id), label(label)
+ Node(const string& id, Rank rank, const string& label)
+ : id(id), rank(rank), label(label)
{}

const string id;
+ const Rank rank;
const string label;
};

@@ -68,22 +72,35 @@
{
case DISK: {

- Node disk_node("device:" + i1->device, i1->device);
+ Node disk_node("device:" + i1->device, RANK_DISK, i1->device);
nodes.push_back(disk_node);

+ if (!i1->usedByDevice.empty())
+ {
+ edges.push_back(Edge(disk_node.id, "device:" +
i1->usedByDevice));
+ }
+
deque<PartitionInfo> partitions;
- getPartitionInfo (i1->name, partitions);
+ getPartitionInfo(i1->name, partitions);
for (deque<PartitionInfo>::iterator i2 = partitions.begin();
i2 != partitions.end(); ++i2)
{
- Node partition_node("device:" + i2->v.device, i2->v.device);
+ if (i2->partitionType == EXTENDED)
+ continue;
+
+ Node partition_node("device:" + i2->v.device,
RANK_PARTITION, i2->v.device);
nodes.push_back(partition_node);

edges.push_back(Edge(disk_node.id, partition_node.id));

+ if (!i2->v.usedByDevice.empty())
+ {
+ edges.push_back(Edge(partition_node.id, "device:" +
i2->v.usedByDevice));
+ }
+
if (!i2->v.mount.empty())
{
- Node mountpoint_node("mountpoint:" + i2->v.mount,
i2->v.mount);
+ Node mountpoint_node("mountpoint:" + i2->v.mount,
RANK_MOUNTPOINT, i2->v.mount);
nodes.push_back(mountpoint_node);

edges.push_back(Edge(partition_node.id,
mountpoint_node.id));
@@ -91,6 +108,32 @@
}

} break;
+
+ case LVM: {
+
+ Node vg_node("device:" + i1->device, RANK_LVMVG, i1->device);
+ nodes.push_back(vg_node);
+
+ deque<LvmLvInfo> lvs;
+ getLvmLvInfo(i1->name, lvs);
+ for (deque<LvmLvInfo>::iterator i2 = lvs.begin();
+ i2 != lvs.end(); ++i2)
+ {
+ Node lv_node("device:" + i2->v.device, RANK_LVMLV,
i2->v.device);
+ nodes.push_back(lv_node);
+
+ edges.push_back(Edge(vg_node.id, lv_node.id));
+
+ if (!i2->v.mount.empty())
+ {
+ Node mountpoint_node("mountpoint:" + i2->v.mount,
RANK_MOUNTPOINT, i2->v.mount);
+ nodes.push_back(mountpoint_node);
+
+ edges.push_back(Edge(lv_node.id, mountpoint_node.id));
+ }
+ }
+
+ } break;
}
}

@@ -107,6 +150,20 @@

out << endl;

+ // TODO
+ for (Rank rank = RANK_DISK; rank != RANK_NONE; rank = (storage::Rank)(rank
+ 1))
+ {
+ list<string> ids;
+ for (list<Node>::const_iterator node = nodes.begin(); node !=
nodes.end(); ++node)
+ if (node->rank == rank)
+ ids.push_back(dotQuote(node->id) + ";");
+
+ if (!ids.empty())
+ out << " { rank=same; " << boost::join(ids, " ") << " };" <<
endl;
+ }
+ out << endl;
+
+
for (list<Edge>::const_iterator edge = edges.begin(); edge != edges.end();
++edge)
out << " " << (*edge) << endl;

@@ -114,5 +171,6 @@

out.close();

+
return 0;
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages